Add subnet extensions for scope attributes
Add extensions: 'apic_advertised_externally' and 'apic_shared_between_vrfs' for subnet scope attributes Change-Id: I8a22da67e6d613de071a6848b9907a3080ee40df
This commit is contained in:
parent
80973f13a6
commit
e10a97fbbb
|
@ -45,6 +45,14 @@ def _get_attrs_subnet_extension(client_manager, parsed_args, is_create=True):
|
||||||
if ('apic_epg_subnet' in parsed_args and
|
if ('apic_epg_subnet' in parsed_args and
|
||||||
parsed_args.apic_epg_subnet):
|
parsed_args.apic_epg_subnet):
|
||||||
attrs['apic:epg_subnet'] = True
|
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
|
return attrs
|
||||||
|
|
||||||
|
@ -63,6 +71,10 @@ subnet_sdk.Subnet.apic_snat_subnet_only = resource.Body(
|
||||||
'apic:snat_subnet_only')
|
'apic:snat_subnet_only')
|
||||||
subnet_sdk.Subnet.apic_epg_subnet = resource.Body(
|
subnet_sdk.Subnet.apic_epg_subnet = resource.Body(
|
||||||
'apic:epg_subnet')
|
'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):
|
class CreateSubnetExtension(hooks.CommandHook):
|
||||||
|
@ -121,6 +133,36 @@ class CreateSubnetExtension(hooks.CommandHook):
|
||||||
help=_("Set APIC epg subnet to true\n"
|
help=_("Set APIC epg subnet to true\n"
|
||||||
"Default value for apic_epg_subnet is False ")
|
"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
|
return parser
|
||||||
|
|
||||||
def get_epilog(self):
|
def get_epilog(self):
|
||||||
|
@ -166,6 +208,36 @@ class SetSubnetExtension(hooks.CommandHook):
|
||||||
help=_("Set APIC snat subnet only to false\n"
|
help=_("Set APIC snat subnet only to false\n"
|
||||||
"Default value for apic_snat_subnet_only is False ")
|
"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
|
return parser
|
||||||
|
|
||||||
def get_epilog(self):
|
def get_epilog(self):
|
||||||
|
|
|
@ -52,7 +52,9 @@ class TestSubnetCreate(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
|
||||||
('apic_snat_host_pool_enable', None),
|
('apic_snat_host_pool_enable', None),
|
||||||
('apic_active_active_aap_enable', None),
|
('apic_active_active_aap_enable', None),
|
||||||
('apic_snat_subnet_only_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)
|
create_ext = subnet_ext.CreateSubnetExtension(self.app)
|
||||||
parsed_args = self.check_parser_ext(
|
parsed_args = self.check_parser_ext(
|
||||||
|
@ -74,7 +76,9 @@ class TestSubnetCreate(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
|
||||||
"--apic-snat-host-pool-enable",
|
"--apic-snat-host-pool-enable",
|
||||||
"--apic-active-active-aap-enable",
|
"--apic-active-active-aap-enable",
|
||||||
"--apic-snat-subnet-only-enable",
|
"--apic-snat-subnet-only-enable",
|
||||||
"--apic-epg-subnet"
|
"--apic-epg-subnet",
|
||||||
|
"--apic-advertised-externally-enable",
|
||||||
|
"--apic-shared-between-vrfs-enable"
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('name', self._subnet.name),
|
('name', self._subnet.name),
|
||||||
|
@ -82,7 +86,9 @@ class TestSubnetCreate(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
|
||||||
('apic_snat_host_pool_enable', True),
|
('apic_snat_host_pool_enable', True),
|
||||||
('apic_active_active_aap_enable', True),
|
('apic_active_active_aap_enable', True),
|
||||||
('apic_snat_subnet_only_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)
|
create_ext = subnet_ext.CreateSubnetExtension(self.app)
|
||||||
parsed_args = self.check_parser_ext(
|
parsed_args = self.check_parser_ext(
|
||||||
|
@ -97,7 +103,9 @@ class TestSubnetCreate(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
|
||||||
'apic:active_active_aap': True,
|
'apic:active_active_aap': True,
|
||||||
'apic:snat_host_pool': True,
|
'apic:snat_host_pool': True,
|
||||||
'apic:snat_subnet_only': 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,
|
self._subnet.name,
|
||||||
"--apic-snat-host-pool-disable",
|
"--apic-snat-host-pool-disable",
|
||||||
"--apic-snat-subnet-only-disable",
|
"--apic-snat-subnet-only-disable",
|
||||||
|
"--apic-advertised-externally-enable",
|
||||||
|
"--apic-shared-between-vrfs-enable",
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('subnet', self._subnet.name),
|
('subnet', self._subnet.name),
|
||||||
('apic_snat_host_pool_disable', True),
|
('apic_snat_host_pool_disable', True),
|
||||||
('apic_snat_subnet_only_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)
|
set_ext = subnet_ext.SetSubnetExtension(self.app)
|
||||||
parsed_args = self.check_parser_ext(
|
parsed_args = self.check_parser_ext(
|
||||||
|
@ -149,6 +161,8 @@ class TestSubnetSet(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
|
||||||
attrs = {
|
attrs = {
|
||||||
'apic:snat_host_pool': False,
|
'apic:snat_host_pool': False,
|
||||||
'apic:snat_subnet_only': 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.network.update_subnet.assert_called_with(self._subnet, **attrs)
|
||||||
self.assertIsNone(result)
|
self.assertIsNone(result)
|
||||||
|
|
Loading…
Reference in New Issue