Bugfix: Allow to unset extra contracts
Change-Id: I5478546c66a34cfbe66200853a50952bf9f7c327
This commit is contained in:
@@ -63,12 +63,19 @@ def _get_attrs_network_extension(client_manager, parsed_args):
|
|||||||
] = list(map(int,
|
] = list(map(int,
|
||||||
parsed_args.apic_nested_domain_allowed_vlans.split(
|
parsed_args.apic_nested_domain_allowed_vlans.split(
|
||||||
",")))
|
",")))
|
||||||
|
if parsed_args.apic_extra_provided_contracts is not None:
|
||||||
if parsed_args.apic_extra_provided_contracts:
|
if parsed_args.apic_extra_provided_contracts:
|
||||||
attrs['apic:extra_provided_contracts'
|
attrs['apic:extra_provided_contracts'
|
||||||
] = parsed_args.apic_extra_provided_contracts.split(",")
|
] = parsed_args.apic_extra_provided_contracts.split(",")
|
||||||
|
else:
|
||||||
|
attrs['apic:extra_provided_contracts'] = []
|
||||||
|
|
||||||
|
if parsed_args.apic_extra_consumed_contracts is not None:
|
||||||
if parsed_args.apic_extra_consumed_contracts:
|
if parsed_args.apic_extra_consumed_contracts:
|
||||||
attrs['apic:extra_consumed_contracts'
|
attrs['apic:extra_consumed_contracts'
|
||||||
] = parsed_args.apic_extra_consumed_contracts.split(",")
|
] = parsed_args.apic_extra_consumed_contracts.split(",")
|
||||||
|
else:
|
||||||
|
attrs['apic:extra_consumed_contracts'] = []
|
||||||
if parsed_args.apic_epg_contract_masters:
|
if parsed_args.apic_epg_contract_masters:
|
||||||
attrs['apic:epg_contract_masters'
|
attrs['apic:epg_contract_masters'
|
||||||
] = parsed_args.apic_epg_contract_masters.split(",")
|
] = parsed_args.apic_epg_contract_masters.split(",")
|
||||||
|
@@ -135,6 +135,29 @@ class TestNetworkCreate(test_network.TestNetwork, test_cli20.CLITestV20Base):
|
|||||||
'apic:policy_enforcement_pref': 'enforced',
|
'apic:policy_enforcement_pref': 'enforced',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def test_create_empty_contracts(self):
|
||||||
|
arglist = [
|
||||||
|
self._network.name,
|
||||||
|
"--apic-extra-provided-contracts", '',
|
||||||
|
"--apic-extra-consumed-contracts", '',
|
||||||
|
]
|
||||||
|
verifylist = [
|
||||||
|
('name', self._network.name),
|
||||||
|
('apic_extra_provided_contracts', ''),
|
||||||
|
('apic_extra_consumed_contracts', ''),
|
||||||
|
]
|
||||||
|
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,
|
||||||
|
'apic:extra_consumed_contracts': [],
|
||||||
|
'apic:extra_provided_contracts': [],
|
||||||
|
})
|
||||||
|
|
||||||
def test_create_no_nat_option(self):
|
def test_create_no_nat_option(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
self._network.name,
|
self._network.name,
|
||||||
|
Reference in New Issue
Block a user