Allow setting floating IP description
Change-Id: If664bfe3c9fdcb69c7046eb16c5d32602d1b3262 Story: 2007439 Task: 39094
This commit is contained in:
parent
8c4ecbe35d
commit
d2826e89e9
@ -412,6 +412,11 @@ class SetFloatingIP(command.Command):
|
||||
help=_("Fixed IP of the port "
|
||||
"(required only if port has multiple IPs)")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--description',
|
||||
metavar='<description>',
|
||||
help=_('Set floating IP description')
|
||||
)
|
||||
qos_policy_group = parser.add_mutually_exclusive_group()
|
||||
qos_policy_group.add_argument(
|
||||
'--qos-policy',
|
||||
@ -443,6 +448,9 @@ class SetFloatingIP(command.Command):
|
||||
if parsed_args.fixed_ip_address:
|
||||
attrs['fixed_ip_address'] = parsed_args.fixed_ip_address
|
||||
|
||||
if parsed_args.description:
|
||||
attrs['description'] = parsed_args.description
|
||||
|
||||
if parsed_args.qos_policy:
|
||||
attrs['qos_policy_id'] = client.find_qos_policy(
|
||||
parsed_args.qos_policy, ignore_missing=False).id
|
||||
|
@ -776,6 +776,32 @@ class TestSetFloatingIP(TestFloatingIPNetwork):
|
||||
self.network.update_ip.assert_called_once_with(
|
||||
self.floating_ip, **attrs)
|
||||
|
||||
def test_description_option(self):
|
||||
arglist = [
|
||||
self.floating_ip.id,
|
||||
'--port', self.floating_ip.port_id,
|
||||
'--description', self.floating_ip.description,
|
||||
]
|
||||
verifylist = [
|
||||
('floating_ip', self.floating_ip.id),
|
||||
('port', self.floating_ip.port_id),
|
||||
('description', self.floating_ip.description),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
attrs = {
|
||||
'port_id': self.floating_ip.port_id,
|
||||
'description': self.floating_ip.description,
|
||||
}
|
||||
self.network.find_ip.assert_called_once_with(
|
||||
self.floating_ip.id,
|
||||
ignore_missing=False,
|
||||
)
|
||||
self.network.update_ip.assert_called_once_with(
|
||||
self.floating_ip, **attrs)
|
||||
|
||||
def test_qos_policy_option(self):
|
||||
qos_policy = network_fakes.FakeNetworkQosPolicy.create_one_qos_policy()
|
||||
self.network.find_qos_policy = mock.Mock(return_value=qos_policy)
|
||||
|
Loading…
x
Reference in New Issue
Block a user