Bugfix: Handling of --apic-nat-type ""
Change-Id: I874a60950de672d3cf3f30c84731e285acb0c870
This commit is contained in:
@@ -82,8 +82,8 @@ def _get_attrs_network_extension(client_manager, parsed_args):
|
|||||||
attrs['apic:policy_enforcement_pref'
|
attrs['apic:policy_enforcement_pref'
|
||||||
] = parsed_args.apic_policy_enforcement_pref
|
] = parsed_args.apic_policy_enforcement_pref
|
||||||
if parsed_args.external:
|
if parsed_args.external:
|
||||||
if 'apic_nat_type' in parsed_args and \
|
if ('apic_nat_type' in parsed_args and
|
||||||
parsed_args.apic_nat_type:
|
parsed_args.apic_nat_type is not None):
|
||||||
attrs['apic:nat_type'] = parsed_args.apic_nat_type
|
attrs['apic:nat_type'] = parsed_args.apic_nat_type
|
||||||
if parsed_args.apic_external_cidrs:
|
if parsed_args.apic_external_cidrs:
|
||||||
attrs['apic:external_cidrs'
|
attrs['apic:external_cidrs'
|
||||||
|
@@ -133,6 +133,35 @@ class TestNetworkCreate(test_network.TestNetwork, test_cli20.CLITestV20Base):
|
|||||||
'apic:policy_enforcement_pref': 'enforced',
|
'apic:policy_enforcement_pref': 'enforced',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def test_create_no_nat_option(self):
|
||||||
|
arglist = [
|
||||||
|
self._network.name,
|
||||||
|
"--external",
|
||||||
|
"--apic-distinguished-names", 'ExternalNetwork=test1',
|
||||||
|
"--apic-nat-type", "",
|
||||||
|
"--apic-external-cidrs", '20.20.20.0/8',
|
||||||
|
]
|
||||||
|
verifylist = [
|
||||||
|
('name', self._network.name),
|
||||||
|
('external', True),
|
||||||
|
('apic_distinguished_names', [{'ExternalNetwork': 'test1'}]),
|
||||||
|
('apic_nat_type', ""),
|
||||||
|
('apic_external_cidrs', '20.20.20.0/8'),
|
||||||
|
]
|
||||||
|
create_ext = network_ext.CreateNetworkExtension(self.app)
|
||||||
|
parsed_args = self.check_parser_ext(
|
||||||
|
self.cmd, arglist, verifylist, create_ext)
|
||||||
|
columns, data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
|
self.network.create_network.assert_called_once_with(**{
|
||||||
|
'admin_state_up': True,
|
||||||
|
'name': self._network.name,
|
||||||
|
'router:external': True,
|
||||||
|
'apic:distinguished_names': {"ExternalNetwork": "test1"},
|
||||||
|
'apic:external_cidrs': ['20.20.20.0/8'],
|
||||||
|
'apic:nat_type': '',
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
# Tests for network set with APIC extensions
|
# Tests for network set with APIC extensions
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user