diff --git a/gbpclient/gbp/v2_0/network.py b/gbpclient/gbp/v2_0/network.py index 2a3c45c..89d8986 100644 --- a/gbpclient/gbp/v2_0/network.py +++ b/gbpclient/gbp/v2_0/network.py @@ -93,6 +93,9 @@ def _get_attrs_network_extension(client_manager, parsed_args): if ('no_apic_no_nat_cidrs' in parsed_args and parsed_args.no_apic_no_nat_cidrs): attrs['apic:no_nat_cidrs'] = [] + if ('apic_multi_ext_nets' in parsed_args and + parsed_args.apic_multi_ext_nets): + attrs['apic:multi_ext_nets'] = parsed_args.apic_multi_ext_nets if parsed_args.external: if ('apic_nat_type' in parsed_args and parsed_args.apic_nat_type is not None): @@ -139,6 +142,7 @@ network_sdk.Network.apic_policy_enforcement_pref = resource.Body( network_sdk.Network.apic_nat_type = resource.Body('apic:nat_type') network_sdk.Network.apic_external_cidrs = resource.Body('apic:external_cidrs') network_sdk.Network.apic_no_nat_cidrs = resource.Body('apic:no_nat_cidrs') +network_sdk.Network.apic_multi_ext_nets = resource.Body('apic:multi_ext_nets') class CreateNetworkExtension(hooks.CommandHook): @@ -315,6 +319,15 @@ class CreateNetworkExtension(hooks.CommandHook): "Syntax Example: 10.10.10.0/24 " "or 10.10.10.0/24,20.20.20.0/24 ") ) + parser.add_argument( + '--apic-multi-ext-nets', + action='store_true', + default=None, + dest='apic_multi_ext_nets', + help=_("Makes it possible to associate multi external networks " + "with a single L3Outside\n" + "Default value is False ") + ) return parser def get_epilog(self): diff --git a/gbpclient/tests/unit/test_network.py b/gbpclient/tests/unit/test_network.py index 803371d..c93309f 100644 --- a/gbpclient/tests/unit/test_network.py +++ b/gbpclient/tests/unit/test_network.py @@ -55,6 +55,7 @@ class TestNetworkCreate(test_network.TestNetwork, test_cli20.CLITestV20Base): ('apic_extra_consumed_contracts', None), ('apic_policy_enforcement_pref', None), ('apic_no_nat_cidrs', None), + ('apic_multi_ext_nets', None), ] create_ext = network_ext.CreateNetworkExtension(self.app) parsed_args = self.check_parser_ext( @@ -88,6 +89,7 @@ class TestNetworkCreate(test_network.TestNetwork, test_cli20.CLITestV20Base): "--apic-extra-consumed-contracts", 'contest1', "--apic-policy-enforcement-pref", 'enforced', "--apic-no-nat-cidrs", '10.10.10.0/24', + "--apic-multi-ext-nets", ] verifylist = [ ('name', self._network.name), @@ -109,6 +111,7 @@ class TestNetworkCreate(test_network.TestNetwork, test_cli20.CLITestV20Base): ('apic_extra_consumed_contracts', 'contest1'), ('apic_policy_enforcement_pref', 'enforced'), ('apic_no_nat_cidrs', '10.10.10.0/24'), + ('apic_multi_ext_nets', True) ] create_ext = network_ext.CreateNetworkExtension(self.app) parsed_args = self.check_parser_ext( @@ -137,6 +140,7 @@ class TestNetworkCreate(test_network.TestNetwork, test_cli20.CLITestV20Base): 'apic:nested_domain_service_vlan': '3', 'apic:policy_enforcement_pref': 'enforced', 'apic:no_nat_cidrs': ['10.10.10.0/24'], + 'apic:multi_ext_nets': True, }) def test_create_empty_contracts(self):