Add subnet extensions for scope attributes
Add extensions: 'apic_advertised_externally' and 'apic_shared_between_vrfs' for subnet scope attributes Change-Id: I8a22da67e6d613de071a6848b9907a3080ee40df (cherry picked from commit e10a97fbbb8ca3025c22ed267acae94fef95954b)
This commit is contained in:
parent
5396935adc
commit
4501640c86
gbpclient
@ -45,6 +45,14 @@ def _get_attrs_subnet_extension(client_manager, parsed_args, is_create=True):
|
||||
if ('apic_epg_subnet' in parsed_args and
|
||||
parsed_args.apic_epg_subnet):
|
||||
attrs['apic:epg_subnet'] = True
|
||||
if parsed_args.apic_advertised_externally_enable:
|
||||
attrs['apic:advertised_externally'] = True
|
||||
if parsed_args.apic_advertised_externally_disable:
|
||||
attrs['apic:advertised_externally'] = False
|
||||
if parsed_args.apic_shared_between_vrfs_enable:
|
||||
attrs['apic:shared_between_vrfs'] = True
|
||||
if parsed_args.apic_shared_between_vrfs_disable:
|
||||
attrs['apic:shared_between_vrfs'] = False
|
||||
|
||||
return attrs
|
||||
|
||||
@ -63,6 +71,10 @@ subnet_sdk.Subnet.apic_snat_subnet_only = resource.Body(
|
||||
'apic:snat_subnet_only')
|
||||
subnet_sdk.Subnet.apic_epg_subnet = resource.Body(
|
||||
'apic:epg_subnet')
|
||||
subnet_sdk.Subnet.apic_advertised_externally = resource.Body(
|
||||
'apic:advertised_externally')
|
||||
subnet_sdk.Subnet.apic_shared_between_vrfs = resource.Body(
|
||||
'apic:shared_between_vrfs')
|
||||
|
||||
|
||||
class CreateSubnetExtension(hooks.CommandHook):
|
||||
@ -121,6 +133,36 @@ class CreateSubnetExtension(hooks.CommandHook):
|
||||
help=_("Set APIC epg subnet to true\n"
|
||||
"Default value for apic_epg_subnet is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-advertised-externally-enable',
|
||||
action='store_true',
|
||||
dest='apic_advertised_externally_enable',
|
||||
help=_("Set APIC advertised externally to true\n"
|
||||
"Default value for apic_advertised_externally is True ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-advertised-externally-disable',
|
||||
action='store_true',
|
||||
default=None,
|
||||
dest='apic_advertised_externally_disable',
|
||||
help=_("Set APIC advertised externally to false\n"
|
||||
"Default value for apic_advertised_externally is True ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-shared-between-vrfs-enable',
|
||||
action='store_true',
|
||||
default=None,
|
||||
dest='apic_shared_between_vrfs_enable',
|
||||
help=_("Set APIC shared between vrfs to true\n"
|
||||
"Default value for apic_shared_between_vrfs is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-shared-between-vrfs-disable',
|
||||
action='store_true',
|
||||
dest='apic_shared_between_vrfs_disable',
|
||||
help=_("Set APIC shared between vrfs to false\n"
|
||||
"Default value for apic_shared_between_vrfs is False ")
|
||||
)
|
||||
return parser
|
||||
|
||||
def get_epilog(self):
|
||||
@ -166,6 +208,36 @@ class SetSubnetExtension(hooks.CommandHook):
|
||||
help=_("Set APIC snat subnet only to false\n"
|
||||
"Default value for apic_snat_subnet_only is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-advertised-externally-enable',
|
||||
action='store_true',
|
||||
dest='apic_advertised_externally_enable',
|
||||
help=_("Set APIC advertised externally to true\n"
|
||||
"Default value for apic_advertised_externally is True ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-advertised-externally-disable',
|
||||
action='store_true',
|
||||
default=None,
|
||||
dest='apic_advertised_externally_disable',
|
||||
help=_("Set APIC advertised externally to false\n"
|
||||
"Default value for apic_advertised_externally is True ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-shared-between-vrfs-enable',
|
||||
action='store_true',
|
||||
default=None,
|
||||
dest='apic_shared_between_vrfs_enable',
|
||||
help=_("Set APIC shared between vrfs to true\n"
|
||||
"Default value for apic_shared_between_vrfs is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-shared-between-vrfs-disable',
|
||||
action='store_true',
|
||||
dest='apic_shared_between_vrfs_disable',
|
||||
help=_("Set APIC shared between vrfs to false\n"
|
||||
"Default value for apic_shared_between_vrfs is False ")
|
||||
)
|
||||
return parser
|
||||
|
||||
def get_epilog(self):
|
||||
|
@ -52,7 +52,9 @@ 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)
|
||||
('apic_epg_subnet', False),
|
||||
('apic_advertised_externally_disable', None),
|
||||
('apic_shared_between_vrfs_enable', None)
|
||||
]
|
||||
create_ext = subnet_ext.CreateSubnetExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
@ -74,7 +76,9 @@ 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"
|
||||
"--apic-epg-subnet",
|
||||
"--apic-advertised-externally-enable",
|
||||
"--apic-shared-between-vrfs-enable"
|
||||
]
|
||||
verifylist = [
|
||||
('name', self._subnet.name),
|
||||
@ -82,7 +86,9 @@ 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)
|
||||
('apic_epg_subnet', True),
|
||||
('apic_advertised_externally_enable', True),
|
||||
('apic_shared_between_vrfs_enable', True)
|
||||
]
|
||||
create_ext = subnet_ext.CreateSubnetExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
@ -97,7 +103,9 @@ 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
|
||||
'apic:epg_subnet': True,
|
||||
'apic:advertised_externally': True,
|
||||
'apic:shared_between_vrfs': True
|
||||
})
|
||||
|
||||
|
||||
@ -135,11 +143,15 @@ class TestSubnetSet(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
|
||||
self._subnet.name,
|
||||
"--apic-snat-host-pool-disable",
|
||||
"--apic-snat-subnet-only-disable",
|
||||
"--apic-advertised-externally-enable",
|
||||
"--apic-shared-between-vrfs-enable",
|
||||
]
|
||||
verifylist = [
|
||||
('subnet', self._subnet.name),
|
||||
('apic_snat_host_pool_disable', True),
|
||||
('apic_snat_subnet_only_disable', True),
|
||||
('apic_advertised_externally_enable', True),
|
||||
('apic_shared_between_vrfs_enable', True),
|
||||
]
|
||||
set_ext = subnet_ext.SetSubnetExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
@ -149,6 +161,8 @@ class TestSubnetSet(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
|
||||
attrs = {
|
||||
'apic:snat_host_pool': False,
|
||||
'apic:snat_subnet_only': False,
|
||||
'apic:advertised_externally': True,
|
||||
'apic:shared_between_vrfs': True,
|
||||
}
|
||||
self.network.update_subnet.assert_called_with(self._subnet, **attrs)
|
||||
self.assertIsNone(result)
|
||||
|
Loading…
x
Reference in New Issue
Block a user