Support for multi external networks extention

The multi external networks extention allows multiple external networks
to be associated with a single L3Outside.

Change-Id: Iaf3bbc81ffb5e780c53dcedc106d9e20b50ed128
This commit is contained in:
christides11 2023-05-10 15:26:06 -07:00
parent d7db1d4e08
commit a775debb44
2 changed files with 17 additions and 0 deletions

View File

@ -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):

View File

@ -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):