Merge "Support for epg subnet in gbp client."

This commit is contained in:
Zuul 2022-11-17 12:38:53 +00:00 committed by Gerrit Code Review
commit d7db1d4e08
2 changed files with 17 additions and 0 deletions

View File

@ -42,6 +42,9 @@ def _get_attrs_subnet_extension(client_manager, parsed_args, is_create=True):
attrs['apic:snat_subnet_only'] = True
if parsed_args.apic_snat_subnet_only_disable:
attrs['apic:snat_subnet_only'] = False
if ('apic_epg_subnet' in parsed_args and
parsed_args.apic_epg_subnet):
attrs['apic:epg_subnet'] = True
return attrs
@ -58,6 +61,8 @@ subnet_sdk.Subnet.apic_active_active_aap = resource.Body(
'apic:active_active_aap')
subnet_sdk.Subnet.apic_snat_subnet_only = resource.Body(
'apic:snat_subnet_only')
subnet_sdk.Subnet.apic_epg_subnet = resource.Body(
'apic:epg_subnet')
class CreateSubnetExtension(hooks.CommandHook):
@ -108,6 +113,14 @@ class CreateSubnetExtension(hooks.CommandHook):
help=_("Set APIC snat subnet only to false\n"
"Default value for apic_snat_subnet_only is False ")
)
parser.add_argument(
'--apic-epg-subnet',
action='store_true',
default=False,
dest='apic_epg_subnet',
help=_("Set APIC epg subnet to true\n"
"Default value for apic_epg_subnet is False ")
)
return parser
def get_epilog(self):

View File

@ -52,6 +52,7 @@ class TestSubnetCreate(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
('apic_snat_host_pool_enable', None),
('apic_active_active_aap_enable', None),
('apic_snat_subnet_only_enable', None),
('apic_epg_subnet', False)
]
create_ext = subnet_ext.CreateSubnetExtension(self.app)
parsed_args = self.check_parser_ext(
@ -73,6 +74,7 @@ class TestSubnetCreate(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
"--apic-snat-host-pool-enable",
"--apic-active-active-aap-enable",
"--apic-snat-subnet-only-enable",
"--apic-epg-subnet"
]
verifylist = [
('name', self._subnet.name),
@ -80,6 +82,7 @@ class TestSubnetCreate(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
('apic_snat_host_pool_enable', True),
('apic_active_active_aap_enable', True),
('apic_snat_subnet_only_enable', True),
('apic_epg_subnet', True)
]
create_ext = subnet_ext.CreateSubnetExtension(self.app)
parsed_args = self.check_parser_ext(
@ -94,6 +97,7 @@ class TestSubnetCreate(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
'apic:active_active_aap': True,
'apic:snat_host_pool': True,
'apic:snat_subnet_only': True,
'apic:epg_subnet': True
})