network: Add missing subnet unset --gateway <subnet-id>
Story: 2008695 Task: 42003 Change-Id: I9486a09531b11f27a9ff0d68fd4ad8c68a65cccf
This commit is contained in:
parent
a507fb50f8
commit
ed731d6cd9
@ -672,6 +672,11 @@ class UnsetSubnet(command.Command):
|
||||
'subnet e.g.: start=192.168.199.2,end=192.168.199.254 '
|
||||
'(repeat option to unset multiple allocation pools)')
|
||||
)
|
||||
parser.add_argument(
|
||||
'--gateway',
|
||||
action='store_true',
|
||||
help=_("Remove gateway IP from this subnet")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--dns-nameserver',
|
||||
metavar='<dns-nameserver>',
|
||||
@ -715,6 +720,8 @@ class UnsetSubnet(command.Command):
|
||||
obj = client.find_subnet(parsed_args.subnet, ignore_missing=False)
|
||||
|
||||
attrs = {}
|
||||
if parsed_args.gateway:
|
||||
attrs['gateway_ip'] = None
|
||||
if parsed_args.dns_nameservers:
|
||||
attrs['dns_nameservers'] = copy.deepcopy(obj.dns_nameservers)
|
||||
_update_arguments(attrs['dns_nameservers'],
|
||||
|
@ -1264,6 +1264,7 @@ class TestUnsetSubnet(TestSubnet):
|
||||
'end': '8.8.8.170'}],
|
||||
'service_types': ['network:router_gateway',
|
||||
'network:floatingip_agent_gateway'],
|
||||
'gateway_ip': 'fe80::a00a:0:c0de:0:1',
|
||||
'tags': ['green', 'red'], })
|
||||
self.network.find_subnet = mock.Mock(return_value=self._testsubnet)
|
||||
self.network.update_subnet = mock.Mock(return_value=None)
|
||||
@ -1277,6 +1278,7 @@ class TestUnsetSubnet(TestSubnet):
|
||||
'--host-route', 'destination=10.30.30.30/24,gateway=10.30.30.1',
|
||||
'--allocation-pool', 'start=8.8.8.100,end=8.8.8.150',
|
||||
'--service-type', 'network:router_gateway',
|
||||
'--gateway',
|
||||
self._testsubnet.name,
|
||||
]
|
||||
verifylist = [
|
||||
@ -1286,6 +1288,7 @@ class TestUnsetSubnet(TestSubnet):
|
||||
('allocation_pools', [{
|
||||
'start': '8.8.8.100', 'end': '8.8.8.150'}]),
|
||||
('service_types', ['network:router_gateway']),
|
||||
('gateway', True),
|
||||
]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
@ -1297,6 +1300,7 @@ class TestUnsetSubnet(TestSubnet):
|
||||
"destination": "10.20.20.0/24", "nexthop": "10.20.20.1"}],
|
||||
'allocation_pools': [{'start': '8.8.8.160', 'end': '8.8.8.170'}],
|
||||
'service_types': ['network:floatingip_agent_gateway'],
|
||||
'gateway_ip': None,
|
||||
}
|
||||
self.network.update_subnet.assert_called_once_with(
|
||||
self._testsubnet, **attrs)
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Add missing ``openstack subnet unset --gateway <subnet-id>``.
|
Loading…
Reference in New Issue
Block a user