Improvements for APIC fields in Openstack CLI
Below are some of the improvements madein this patch for the Openstack APIC fields in Network, Subnet, Router and Address Scope: 1. Added more descriptive help messages for the apic fields. 2. More user friendly approach to handle dictionary and list elements. 3. Removal of some fields from the set commands. Change-Id: I50ef5bc56241d0036f2fba3e650c63a7d3539808
This commit is contained in:
parent
f13e3d5764
commit
ed8d9e8206
@ -15,12 +15,11 @@
|
||||
Address Scope extension implementations
|
||||
"""
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from cliff import hooks
|
||||
from openstack.network.v2 import address_scope as address_scope_sdk
|
||||
from openstack import resource
|
||||
from openstackclient.network.v2 import address_scope
|
||||
from osc_lib.cli import parseractions
|
||||
|
||||
from openstackclient.i18n import _
|
||||
|
||||
@ -30,12 +29,12 @@ _get_attrs_address_scope_new = address_scope._get_attrs
|
||||
|
||||
def _get_attrs_address_scope_extension(client_manager, parsed_args):
|
||||
attrs = _get_attrs_address_scope_new(client_manager, parsed_args)
|
||||
if parsed_args.apic_distinguished_names:
|
||||
attrs['apic:distinguished_names'
|
||||
] = jsonutils.loads(parsed_args.apic_distinguished_names)
|
||||
if parsed_args.apic_synchronization_state:
|
||||
attrs['apic:synchronization_state'
|
||||
] = parsed_args.apic_synchronization_state
|
||||
if 'apic_distinguished_names' in parsed_args and \
|
||||
parsed_args.apic_distinguished_names:
|
||||
result = {}
|
||||
for element in parsed_args.apic_distinguished_names:
|
||||
result.update(element)
|
||||
attrs['apic:distinguished_names'] = result
|
||||
return attrs
|
||||
|
||||
|
||||
@ -47,20 +46,20 @@ address_scope_sdk.AddressScope.apic_synchronization_state = resource.Body(
|
||||
'apic:synchronization_state')
|
||||
|
||||
|
||||
class CreateAndSetAddressScopeExtension(hooks.CommandHook):
|
||||
class CreateAddressScopeExtension(hooks.CommandHook):
|
||||
|
||||
def get_parser(self, parser):
|
||||
parser.add_argument(
|
||||
'--apic-distinguished-names',
|
||||
metavar="<apic_distinguished_names>",
|
||||
metavar="<VRF=aaa>",
|
||||
dest='apic_distinguished_names',
|
||||
help=_("Apic distinguished names")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-synchronization-state',
|
||||
metavar="<apic_synchronization_state>",
|
||||
dest='apic_synchronization_state',
|
||||
help=_("Apic synchronization state")
|
||||
action=parseractions.MultiKeyValueAction,
|
||||
optional_keys=['VRF'],
|
||||
help=_("APIC distinguished names\n"
|
||||
"Custom data to be passed as apic:distinguished_names\n"
|
||||
"Data is passed as <key>=<value>, where "
|
||||
"valid key is 'VRF'\n"
|
||||
"Syntax Example: VRF=aaa ")
|
||||
)
|
||||
return parser
|
||||
|
||||
|
@ -15,14 +15,11 @@
|
||||
Network extension implementations
|
||||
"""
|
||||
|
||||
import ast
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from cliff import hooks
|
||||
from openstack.network.v2 import network as network_sdk
|
||||
from openstack import resource
|
||||
from openstackclient.network.v2 import network
|
||||
from osc_lib.cli import parseractions
|
||||
|
||||
from openstackclient.i18n import _
|
||||
|
||||
@ -32,12 +29,11 @@ _get_attrs_network_new = network._get_attrs_network
|
||||
|
||||
def _get_attrs_network_extension(client_manager, parsed_args):
|
||||
attrs = _get_attrs_network_new(client_manager, parsed_args)
|
||||
if parsed_args.apic_synchronization_state:
|
||||
attrs['apic:synchronization_state'
|
||||
] = parsed_args.apic_synchronization_state
|
||||
if parsed_args.apic_svi_enable:
|
||||
if 'apic_svi_enable' in parsed_args and \
|
||||
parsed_args.apic_svi_enable:
|
||||
attrs['apic:svi'] = True
|
||||
if parsed_args.apic_svi_disable:
|
||||
if 'apic_svi_disable' in parsed_args and \
|
||||
parsed_args.apic_svi_disable:
|
||||
attrs['apic:svi'] = False
|
||||
if parsed_args.apic_bgp_enable:
|
||||
attrs['apic:bgp_enable'] = True
|
||||
@ -64,26 +60,31 @@ def _get_attrs_network_extension(client_manager, parsed_args):
|
||||
] = parsed_args.apic_nested_domain_node_network_vlan
|
||||
if parsed_args.apic_nested_domain_allowed_vlans:
|
||||
attrs['apic:nested_domain_allowed_vlans'
|
||||
] = ast.literal_eval(
|
||||
parsed_args.apic_nested_domain_allowed_vlans)
|
||||
] = list(map(int,
|
||||
parsed_args.apic_nested_domain_allowed_vlans.split(
|
||||
",")))
|
||||
if parsed_args.apic_extra_provided_contracts:
|
||||
attrs['apic:extra_provided_contracts'
|
||||
] = ast.literal_eval(parsed_args.apic_extra_provided_contracts)
|
||||
] = parsed_args.apic_extra_provided_contracts.split(",")
|
||||
if parsed_args.apic_extra_consumed_contracts:
|
||||
attrs['apic:extra_consumed_contracts'
|
||||
] = ast.literal_eval(parsed_args.apic_extra_consumed_contracts)
|
||||
] = parsed_args.apic_extra_consumed_contracts.split(",")
|
||||
if parsed_args.apic_epg_contract_masters:
|
||||
attrs['apic:epg_contract_masters'
|
||||
] = ast.literal_eval(parsed_args.apic_epg_contract_masters)
|
||||
if parsed_args.apic_distinguished_names:
|
||||
attrs['apic:distinguished_names'
|
||||
] = jsonutils.loads(parsed_args.apic_distinguished_names)
|
||||
] = parsed_args.apic_epg_contract_masters.split(",")
|
||||
if 'apic_distinguished_names' in parsed_args and \
|
||||
parsed_args.apic_distinguished_names:
|
||||
result = {}
|
||||
for element in parsed_args.apic_distinguished_names:
|
||||
result.update(element)
|
||||
attrs['apic:distinguished_names'] = result
|
||||
if parsed_args.external:
|
||||
if parsed_args.apic_nat_type:
|
||||
if 'apic_nat_type' in parsed_args and \
|
||||
parsed_args.apic_nat_type:
|
||||
attrs['apic:nat_type'] = parsed_args.apic_nat_type
|
||||
if parsed_args.apic_external_cidrs:
|
||||
attrs['apic:external_cidrs'
|
||||
] = ast.literal_eval(parsed_args.apic_external_cidrs)
|
||||
] = parsed_args.apic_external_cidrs.split(",")
|
||||
return attrs
|
||||
|
||||
|
||||
@ -119,124 +120,291 @@ network_sdk.Network.apic_nat_type = resource.Body('apic:nat_type')
|
||||
network_sdk.Network.apic_external_cidrs = resource.Body('apic:external_cidrs')
|
||||
|
||||
|
||||
class CreateAndSetNetworkExtension(hooks.CommandHook):
|
||||
class CreateNetworkExtension(hooks.CommandHook):
|
||||
|
||||
def get_parser(self, parser):
|
||||
parser.add_argument(
|
||||
'--apic-synchronization-state',
|
||||
metavar="<apic_synchronization_state>",
|
||||
dest='apic_synchronization_state',
|
||||
help=_("Apic synchronization state")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-svi-enable',
|
||||
action='store_true',
|
||||
default=None,
|
||||
dest='apic_svi_enable',
|
||||
help=_("Set Apic SVI to true")
|
||||
help=_("Set APIC SVI to true\n"
|
||||
"Default value for apic_svi is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-svi-disable',
|
||||
action='store_true',
|
||||
dest='apic_svi_disable',
|
||||
help=_("Set Apic SVI to false")
|
||||
help=_("Set APIC SVI to false\n"
|
||||
"Default value for apic_svi is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-bgp-enable',
|
||||
action='store_true',
|
||||
default=None,
|
||||
dest='apic_bgp_enable',
|
||||
help=_("Set Apic BGP to true")
|
||||
help=_("Set APIC BGP to true\n"
|
||||
"Default value for apic_bgp is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-bgp-disable',
|
||||
action='store_true',
|
||||
dest='apic_bgp_disable',
|
||||
help=_("Set Apic BGP to false")
|
||||
help=_("Set APIC BGP to false\n"
|
||||
"Default value for apic_bgp is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-bgp-type',
|
||||
metavar="<apic_bgp_type>",
|
||||
metavar="<string>",
|
||||
dest='apic_bgp_type',
|
||||
help=_("Apic BGP Type")
|
||||
help=_("APIC BGP Type\n"
|
||||
"Default value is 'default_export'\n"
|
||||
"Valid values: default_export, '' ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-bgp-asn',
|
||||
metavar="<apic_bgp_asn>",
|
||||
metavar="<integer>",
|
||||
dest='apic_bgp_asn',
|
||||
help=_("Apic BGP ASN")
|
||||
help=_("APIC BGP ASN\n"
|
||||
"Default value is 0\n"
|
||||
"Valid values: non negative integer ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nested-domain-name',
|
||||
metavar="<apic_nested_domain_name>",
|
||||
metavar="<string>",
|
||||
dest='apic_nested_domain_name',
|
||||
help=_("Apic nested domain name")
|
||||
help=_("APIC nested domain name\n"
|
||||
"Default value is '' ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nested-domain-type',
|
||||
metavar="<apic_nested_domain_type>",
|
||||
metavar="<string>",
|
||||
dest='apic_nested_domain_type',
|
||||
help=_("Apic nested domain type")
|
||||
help=_("APIC nested domain type\n"
|
||||
"Default value is '' ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nested-domain-infra-vlan',
|
||||
metavar="<apic_nested_domain_infra_vlan>",
|
||||
metavar="<integer>",
|
||||
dest='apic_nested_domain_infra_vlan',
|
||||
help=_("Apic nested domain infra vlan")
|
||||
help=_("APIC nested domain infra vlan\n"
|
||||
"Valid values: integer between 1 and 4093 ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nested-domain-service-vlan',
|
||||
metavar="<apic_nested_domain_service_vlan>",
|
||||
metavar="<integer>",
|
||||
dest='apic_nested_domain_service_vlan',
|
||||
help=_("Apic nested domain service vlan")
|
||||
help=_("APIC nested domain service vlan\n"
|
||||
"Valid values: integer between 1 and 4093 ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nested-domain-node-network-vlan',
|
||||
metavar="<apic_nested_domain_node_network_vlan>",
|
||||
metavar="<integer>",
|
||||
dest='apic_nested_domain_node_network_vlan',
|
||||
help=_("Apic nested domain node network vlan")
|
||||
help=_("APIC nested domain node network vlan\n"
|
||||
"Valid values: integer between 1 and 4093 ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nested-domain-allowed-vlans',
|
||||
metavar="<apic_nested_domain_allowed_vlans>",
|
||||
metavar="<int,int>",
|
||||
dest='apic_nested_domain_allowed_vlans',
|
||||
help=_("Apic nested domain allowed vlans")
|
||||
help=_("APIC nested domain allowed vlans\n"
|
||||
"Data is passed as comma separated integers\n"
|
||||
"Valid values: integers between 1 and 4093\n"
|
||||
"Syntax Example: 1 or 1,2 ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-extra-provided-contracts',
|
||||
metavar="<apic_extra_provided_contracts>",
|
||||
metavar="<aaa,bbb>",
|
||||
dest='apic_extra_provided_contracts',
|
||||
help=_("Apic extra provided contracts")
|
||||
help=_("APIC extra provided contracts\n"
|
||||
"Data is passed as comma separated strings\n"
|
||||
"Default value is []\n"
|
||||
"Valid values: list of unique strings\n"
|
||||
"Syntax Example: foo or foo,bar ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-extra-consumed-contracts',
|
||||
metavar="<apic_extra_consumed_contracts>",
|
||||
metavar="<aaa,bbb>",
|
||||
dest='apic_extra_consumed_contracts',
|
||||
help=_("Apic extra consumed contracts")
|
||||
help=_("APIC extra consumed contracts\n"
|
||||
"Data is passed as comma separated strings\n"
|
||||
"Default value is []\n"
|
||||
"Valid values: list of unique strings\n"
|
||||
"Syntax Example: foo or foo,bar ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-epg-contract-masters',
|
||||
metavar="<apic_epg_contract_masters>",
|
||||
metavar="<aaa,bbb>",
|
||||
dest='apic_epg_contract_masters',
|
||||
help=_("Apic epg contract masters")
|
||||
help=_("APIC epg contract masters\n"
|
||||
"Data is passed as comma separated strings\n"
|
||||
"Default value is []\n"
|
||||
"Syntax Example: foo or foo,bar ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-distinguished-names',
|
||||
metavar="<apic_distinguished_names>",
|
||||
metavar="<ExternalNetwork=aaa,BridgeDomain=bbb>",
|
||||
dest='apic_distinguished_names',
|
||||
help=_("Apic distinguished names")
|
||||
action=parseractions.MultiKeyValueAction,
|
||||
optional_keys=['ExternalNetwork', 'BridgeDomain'],
|
||||
help=_("APIC distinguished names\n"
|
||||
"Custom data to be passed as apic:distinguished_names\n"
|
||||
"Data is passed as <key>=<value>, where "
|
||||
"valid keys are 'ExternalNetwork' and 'BridgeDomain'\n"
|
||||
"Both the keys are optional\n"
|
||||
"Syntax Example: BridgeDomain=aaa or ExternalNetwork=bbb "
|
||||
"or ExternalNetwork=aaa,BridgeDomain=bbb ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nat-type',
|
||||
metavar="<apic_nat_type>",
|
||||
metavar="<string>",
|
||||
dest='apic_nat_type',
|
||||
help=_("Apic nat type for external network")
|
||||
help=_("APIC nat type for external network\n"
|
||||
"For external type networks only\n"
|
||||
"Default value is 'distributed'\n"
|
||||
"Valid values: distributed, edge, '' ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-external-cidrs',
|
||||
metavar="<apic_external_cidrs>",
|
||||
metavar="<subnet1,subnet2>",
|
||||
dest='apic_external_cidrs',
|
||||
help=_("Apic external CIDRS for external network")
|
||||
help=_("APIC external CIDRS for external network\n"
|
||||
"For external type networks only\n"
|
||||
"Data is passed as comma separated valid ip subnets\n"
|
||||
"Default value is ['0.0.0.0/0']\n"
|
||||
"Syntax Example: 10.10.10.0/24 "
|
||||
"or 10.10.10.0/24,20.20.20.0/24 ")
|
||||
)
|
||||
return parser
|
||||
|
||||
def get_epilog(self):
|
||||
return ''
|
||||
|
||||
def before(self, parsed_args):
|
||||
return parsed_args
|
||||
|
||||
def after(self, parsed_args, return_code):
|
||||
return return_code
|
||||
|
||||
|
||||
class SetNetworkExtension(hooks.CommandHook):
|
||||
|
||||
def get_parser(self, parser):
|
||||
parser.add_argument(
|
||||
'--apic-bgp-enable',
|
||||
action='store_true',
|
||||
default=None,
|
||||
dest='apic_bgp_enable',
|
||||
help=_("Set APIC BGP to true\n"
|
||||
"Default value for apic_bgp is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-bgp-disable',
|
||||
action='store_true',
|
||||
dest='apic_bgp_disable',
|
||||
help=_("Set APIC BGP to false\n"
|
||||
"Default value for apic_bgp is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-bgp-type',
|
||||
metavar="<string>",
|
||||
dest='apic_bgp_type',
|
||||
help=_("APIC BGP Type\n"
|
||||
"Default value is 'default_export'\n"
|
||||
"Valid values: default_export, '' ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-bgp-asn',
|
||||
metavar="<integer>",
|
||||
dest='apic_bgp_asn',
|
||||
help=_("APIC BGP ASN\n"
|
||||
"Default value is 0\n"
|
||||
"Valid values: non negative integer ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nested-domain-name',
|
||||
metavar="<string>",
|
||||
dest='apic_nested_domain_name',
|
||||
help=_("APIC nested domain name\n"
|
||||
"Default value is '' ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nested-domain-type',
|
||||
metavar="<string>",
|
||||
dest='apic_nested_domain_type',
|
||||
help=_("APIC nested domain type\n"
|
||||
"Default value is '' ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nested-domain-infra-vlan',
|
||||
metavar="<integer>",
|
||||
dest='apic_nested_domain_infra_vlan',
|
||||
help=_("APIC nested domain infra vlan\n"
|
||||
"Valid values: integer between 1 and 4093 ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nested-domain-service-vlan',
|
||||
metavar="<integer>",
|
||||
dest='apic_nested_domain_service_vlan',
|
||||
help=_("APIC nested domain service vlan\n"
|
||||
"Valid values: integer between 1 and 4093 ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nested-domain-node-network-vlan',
|
||||
metavar="<integer>",
|
||||
dest='apic_nested_domain_node_network_vlan',
|
||||
help=_("APIC nested domain node network vlan\n"
|
||||
"Valid values: integer between 1 and 4093 ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-nested-domain-allowed-vlans',
|
||||
metavar="<int,int>",
|
||||
dest='apic_nested_domain_allowed_vlans',
|
||||
help=_("APIC nested domain allowed vlans. "
|
||||
"Data is passed as comma separated integers\n"
|
||||
"Valid values: integers between 1 and 4093\n"
|
||||
"Syntax Example: 1 or 1,2 ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-extra-provided-contracts',
|
||||
metavar="<aaa,bbb>",
|
||||
dest='apic_extra_provided_contracts',
|
||||
help=_("APIC extra provided contracts\n"
|
||||
"Data is passed as comma separated of strings.\n"
|
||||
"Default value is []\n"
|
||||
"Valid values: list of unique strings\n"
|
||||
"Syntax Example: foo or foo,bar ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-extra-consumed-contracts',
|
||||
metavar="<aaa,bbb>",
|
||||
dest='apic_extra_consumed_contracts',
|
||||
help=_("APIC extra consumed contracts\n"
|
||||
"Data is passed as comma separated strings\n"
|
||||
"Default value is []\n"
|
||||
"Valid values: list of unique strings\n"
|
||||
"Syntax Example: foo or foo,bar ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-epg-contract-masters',
|
||||
metavar="<aaa,bbb,ccc>",
|
||||
dest='apic_epg_contract_masters',
|
||||
help=_("APIC epg contract masters\n"
|
||||
"Data is passed as comma separated strings\n"
|
||||
"Default value is []\n"
|
||||
"Syntax Example: foo or foo,bar ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-external-cidrs',
|
||||
metavar="<subnet1,subnet2>",
|
||||
dest='apic_external_cidrs',
|
||||
help=_("APIC external CIDRS for external network\n"
|
||||
"For external type networks only\n"
|
||||
"Data is passed as comma separated valid ip subnets\n"
|
||||
"Default value is ['0.0.0.0/0']\n"
|
||||
"Syntax Example: 10.10.10.0/24 "
|
||||
"or 10.10.10.0/24,20.20.20.0/24 ")
|
||||
)
|
||||
return parser
|
||||
|
||||
|
@ -42,9 +42,6 @@ def _convert_erspan_config(parsed_args):
|
||||
|
||||
def _get_attrs_port_extension(client_manager, parsed_args):
|
||||
attrs = _get_attrs_port_new(client_manager, parsed_args)
|
||||
if parsed_args.apic_synchronization_state:
|
||||
attrs['apic:synchronization_state'
|
||||
] = parsed_args.apic_synchronization_state
|
||||
if parsed_args.apic_erspan_config:
|
||||
attrs['apic:erspan_config'
|
||||
] = _convert_erspan_config(parsed_args)
|
||||
@ -63,12 +60,6 @@ port_sdk.Port.apic_erspan_config = resource.Body('apic:erspan_config')
|
||||
class CreateAndSetPortExtension(hooks.CommandHook):
|
||||
|
||||
def get_parser(self, parser):
|
||||
parser.add_argument(
|
||||
'--apic-synchronization-state',
|
||||
metavar="<apic_synchronization_state>",
|
||||
dest='apic_synchronization_state',
|
||||
help=_("Apic synchronization state")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-erspan-config',
|
||||
metavar="<apic_erspan_config>",
|
||||
@ -76,13 +67,21 @@ class CreateAndSetPortExtension(hooks.CommandHook):
|
||||
action=parseractions.MultiKeyValueAction,
|
||||
required_keys=['flow-id', 'dest-ip'],
|
||||
optional_keys=['direction'],
|
||||
help=_("Apic ERSPAN configuration")
|
||||
help=_("APIC ERSPAN configuration\n"
|
||||
"Custom data to be passed as apic:erspan_config\n"
|
||||
"Data is passed as <key>=<value>, where "
|
||||
"valid keys are 'flow-id', 'dest-ip', and 'direction'\n"
|
||||
"Required keys: flow-id, dest-ip\n"
|
||||
"Optional keys: direction\n"
|
||||
"Syntax Example: dest-ip=10.0.0.0,flow-id=1 "
|
||||
"or dest-ip=10.0.0.0,flow-id=1,direction=in ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--no-apic-erspan-config',
|
||||
dest='no_apic_erspan_config',
|
||||
action='store_true',
|
||||
help=_("Apic ERSPAN configuration")
|
||||
help=_("No APIC ERSPAN configuration\n"
|
||||
"Clear the apic:erspan_config configuration ")
|
||||
)
|
||||
return parser
|
||||
|
||||
|
@ -15,10 +15,6 @@
|
||||
Router extension implementations
|
||||
"""
|
||||
|
||||
import ast
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from cliff import hooks
|
||||
from openstack.network.v2 import router as router_sdk
|
||||
from openstack import resource
|
||||
@ -32,20 +28,12 @@ _get_attrs_router_new = router._get_attrs
|
||||
|
||||
def _get_attrs_router_extension(client_manager, parsed_args):
|
||||
attrs = _get_attrs_router_new(client_manager, parsed_args)
|
||||
if parsed_args.apic_distinguished_names:
|
||||
attrs['apic:distinguished_names'
|
||||
] = jsonutils.loads(parsed_args.apic_distinguished_names)
|
||||
if parsed_args.apic_synchronization_state:
|
||||
attrs['apic:synchronization_state'
|
||||
] = parsed_args.apic_synchronization_state
|
||||
if parsed_args.apic_external_provided_contracts:
|
||||
attrs['apic:external_provided_contracts'
|
||||
] = ast.literal_eval(
|
||||
parsed_args.apic_external_provided_contracts)
|
||||
] = parsed_args.apic_external_provided_contracts.split(",")
|
||||
if parsed_args.apic_external_consumed_contracts:
|
||||
attrs['apic:external_consumed_contracts'
|
||||
] = ast.literal_eval(
|
||||
parsed_args.apic_external_consumed_contracts)
|
||||
] = parsed_args.apic_external_consumed_contracts.split(",")
|
||||
return attrs
|
||||
|
||||
|
||||
@ -64,29 +52,25 @@ router_sdk.Router.apic_external_consumed_contracts = resource.Body(
|
||||
class CreateAndSetRouterExtension(hooks.CommandHook):
|
||||
|
||||
def get_parser(self, parser):
|
||||
parser.add_argument(
|
||||
'--apic-distinguished-names',
|
||||
metavar="<apic_distinguished_names>",
|
||||
dest='apic_distinguished_names',
|
||||
help=_("Apic distinguished names")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-synchronization-state',
|
||||
metavar="<apic_synchronization_state>",
|
||||
dest='apic_synchronization_state',
|
||||
help=_("Apic synchronization state")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-external-provided-contracts',
|
||||
metavar="<apic_external_provided_contracts>",
|
||||
metavar="<aaa,bbb>",
|
||||
dest='apic_external_provided_contracts',
|
||||
help=_("Apic external provided contracts")
|
||||
help=_("APIC external provided contracts\n"
|
||||
"Data is passed as comma separated strings\n"
|
||||
"Default value is []\n"
|
||||
"Valid values: list of unique strings\n"
|
||||
"Syntax Example: foo or foo,bar ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-external-consumed-contracts',
|
||||
metavar="<apic_external_consumed_contracts>",
|
||||
metavar="<aaa,bbb>",
|
||||
dest='apic_external_consumed_contracts',
|
||||
help=_("Apic external consumed contracts")
|
||||
help=_("APIC external consumed contracts\n"
|
||||
"Data is passed as comma separated strings\n"
|
||||
"Default value is []\n"
|
||||
"Valid values: list of unique strings\n"
|
||||
"Syntax Example: foo or foo,bar ")
|
||||
)
|
||||
return parser
|
||||
|
||||
|
@ -15,8 +15,6 @@
|
||||
Subnet extension implementations
|
||||
"""
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from cliff import hooks
|
||||
from openstack.network.v2 import subnet as subnet_sdk
|
||||
from openstack import resource
|
||||
@ -30,19 +28,15 @@ _get_attrs_subnet_new = subnet._get_attrs
|
||||
|
||||
def _get_attrs_subnet_extension(client_manager, parsed_args, is_create=True):
|
||||
attrs = _get_attrs_subnet_new(client_manager, parsed_args, is_create)
|
||||
if parsed_args.apic_distinguished_names:
|
||||
attrs['apic:distinguished_names'
|
||||
] = jsonutils.loads(parsed_args.apic_distinguished_names)
|
||||
if parsed_args.apic_synchronization_state:
|
||||
attrs['apic:synchronization_state'
|
||||
] = parsed_args.apic_synchronization_state
|
||||
if parsed_args.apic_snat_host_pool_enable:
|
||||
attrs['apic:snat_host_pool'] = True
|
||||
if parsed_args.apic_snat_host_pool_disable:
|
||||
attrs['apic:snat_host_pool'] = False
|
||||
if parsed_args.apic_active_active_aap_enable:
|
||||
if 'apic_active_active_aap_enable' in parsed_args and \
|
||||
parsed_args.apic_active_active_aap_enable:
|
||||
attrs['apic:active_active_aap'] = True
|
||||
if parsed_args.apic_active_active_aap_disable:
|
||||
if 'apic_active_active_aap_disable' in parsed_args and \
|
||||
parsed_args.apic_active_active_aap_disable:
|
||||
attrs['apic:active_active_aap'] = False
|
||||
return attrs
|
||||
|
||||
@ -59,46 +53,68 @@ subnet_sdk.Subnet.apic_active_active_aap = resource.Body(
|
||||
'apic:active_active_aap')
|
||||
|
||||
|
||||
class CreateAndSetSubnetExtension(hooks.CommandHook):
|
||||
class CreateSubnetExtension(hooks.CommandHook):
|
||||
|
||||
def get_parser(self, parser):
|
||||
parser.add_argument(
|
||||
'--apic-distinguished-names',
|
||||
metavar="<apic_distinguished_names>",
|
||||
dest='apic_distinguished_names',
|
||||
help=_("Apic distinguished names")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-synchronization-state',
|
||||
metavar="<apic_synchronization_state>",
|
||||
dest='apic_synchronization_state',
|
||||
help=_("Apic synchronization state")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-snat-host-pool-enable',
|
||||
action='store_true',
|
||||
default=None,
|
||||
dest='apic_snat_host_pool_enable',
|
||||
help=_("Set Apic snat host pool to true")
|
||||
help=_("Set APIC snat host pool to true\n"
|
||||
"Default value for apic_snat_host_pool is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-snat-host-pool-disable',
|
||||
action='store_true',
|
||||
dest='apic_snat_host_pool_disable',
|
||||
help=_("Set Apic snat host pool to false")
|
||||
help=_("Set APIC snat host pool to false\n"
|
||||
"Default value for apic_snat_host_pool is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-active-active-aap-enable',
|
||||
action='store_true',
|
||||
default=None,
|
||||
dest='apic_active_active_aap_enable',
|
||||
help=_("Set Apic active active aap to true")
|
||||
help=_("Set APIC active active aap to true\n"
|
||||
"Default value for apic_active_active_aap is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-active-active-aap-disable',
|
||||
action='store_true',
|
||||
dest='apic_active_active_aap_disable',
|
||||
help=_("Set Apic active active aap to false")
|
||||
help=_("Set APIC active active aap to false\n"
|
||||
"Default value for apic_active_active_aap is False ")
|
||||
)
|
||||
return parser
|
||||
|
||||
def get_epilog(self):
|
||||
return ''
|
||||
|
||||
def before(self, parsed_args):
|
||||
return parsed_args
|
||||
|
||||
def after(self, parsed_args, return_code):
|
||||
return return_code
|
||||
|
||||
|
||||
class SetSubnetExtension(hooks.CommandHook):
|
||||
|
||||
def get_parser(self, parser):
|
||||
parser.add_argument(
|
||||
'--apic-snat-host-pool-enable',
|
||||
action='store_true',
|
||||
default=None,
|
||||
dest='apic_snat_host_pool_enable',
|
||||
help=_("Set APIC snat host pool to true\n"
|
||||
"Default value for apic_snat_host_pool is False ")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--apic-snat-host-pool-disable',
|
||||
action='store_true',
|
||||
dest='apic_snat_host_pool_disable',
|
||||
help=_("Set APIC snat host pool to false\n"
|
||||
"Default value for apic_snat_host_pool is False ")
|
||||
)
|
||||
return parser
|
||||
|
||||
|
@ -40,9 +40,8 @@ class TestAddressScopeCreate(
|
||||
verifylist = [
|
||||
('name', self.new_address_scope.name),
|
||||
('apic_distinguished_names', None),
|
||||
('apic_synchronization_state', None),
|
||||
]
|
||||
create_ext = address_scope_ext.CreateAndSetAddressScopeExtension(
|
||||
create_ext = address_scope_ext.CreateAddressScopeExtension(
|
||||
self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
self.cmd, arglist, verifylist, create_ext)
|
||||
@ -56,14 +55,13 @@ class TestAddressScopeCreate(
|
||||
def test_create_all_options(self):
|
||||
arglist = [
|
||||
self.new_address_scope.name,
|
||||
"--apic-distinguished-names", '{"disttest1": "test1"}',
|
||||
"--apic-distinguished-names", 'VRF=test1',
|
||||
]
|
||||
verifylist = [
|
||||
('name', self.new_address_scope.name),
|
||||
('apic_distinguished_names', '{"disttest1": "test1"}'),
|
||||
('apic_synchronization_state', None),
|
||||
('apic_distinguished_names', [{'VRF': 'test1'}]),
|
||||
]
|
||||
create_ext = address_scope_ext.CreateAndSetAddressScopeExtension(
|
||||
create_ext = address_scope_ext.CreateAddressScopeExtension(
|
||||
self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
self.cmd, arglist, verifylist, create_ext)
|
||||
@ -71,40 +69,6 @@ class TestAddressScopeCreate(
|
||||
|
||||
self.network.create_address_scope.assert_called_once_with(**{
|
||||
'ip_version': self.new_address_scope.ip_version,
|
||||
'apic:distinguished_names': {"disttest1": "test1"},
|
||||
'apic:distinguished_names': {"VRF": "test1"},
|
||||
'name': self.new_address_scope.name,
|
||||
})
|
||||
|
||||
|
||||
# Tests for address scope set for APIC extensions
|
||||
#
|
||||
class TestAddressScopeSet(
|
||||
test_address_scope.TestAddressScope, test_cli20.CLITestV20Base):
|
||||
|
||||
_address_scope = test_address_scope.TestSetAddressScope._address_scope
|
||||
|
||||
def setUp(self):
|
||||
super(TestAddressScopeSet, self).setUp()
|
||||
self.network.update_address_scope = mock.Mock(return_value=None)
|
||||
self.network.find_address_scope = mock.Mock(
|
||||
return_value=self._address_scope)
|
||||
self.cmd = address_scope.SetAddressScope(self.app, self.namespace)
|
||||
|
||||
def test_set_no_options(self):
|
||||
arglist = [
|
||||
self._address_scope.name,
|
||||
]
|
||||
verifylist = [
|
||||
('address_scope', self._address_scope.name),
|
||||
('apic_distinguished_names', None),
|
||||
('apic_synchronization_state', None),
|
||||
]
|
||||
set_ext = address_scope_ext.CreateAndSetAddressScopeExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
self.cmd, arglist, verifylist, set_ext)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
attrs = {}
|
||||
self.network.update_address_scope.assert_called_with(
|
||||
self._address_scope, **attrs)
|
||||
self.assertIsNone(result)
|
||||
|
@ -40,7 +40,6 @@ class TestNetworkCreate(test_network.TestNetwork, test_cli20.CLITestV20Base):
|
||||
('apic_nested_domain_name', None),
|
||||
('apic_nested_domain_type', None),
|
||||
('apic_distinguished_names', None),
|
||||
('apic_synchronization_state', None),
|
||||
('apic_nat_type', None),
|
||||
('apic_external_cidrs', None),
|
||||
('apic_svi_enable', None),
|
||||
@ -54,7 +53,7 @@ class TestNetworkCreate(test_network.TestNetwork, test_cli20.CLITestV20Base):
|
||||
('apic_extra_provided_contracts', None),
|
||||
('apic_extra_consumed_contracts', None),
|
||||
]
|
||||
create_ext = network_ext.CreateAndSetNetworkExtension(self.app)
|
||||
create_ext = network_ext.CreateNetworkExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
self.cmd, arglist, verifylist, create_ext)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
@ -70,41 +69,40 @@ class TestNetworkCreate(test_network.TestNetwork, test_cli20.CLITestV20Base):
|
||||
"--external",
|
||||
"--apic-nested-domain-name", "dntest1",
|
||||
"--apic-nested-domain-type", "dntype1",
|
||||
"--apic-distinguished-names", '{"disttest1": "test1"}',
|
||||
"--apic-distinguished-names", 'ExternalNetwork=test1',
|
||||
"--apic-nat-type", "edge",
|
||||
"--apic-external-cidrs", "['20.20.20.0/8']",
|
||||
"--apic-external-cidrs", '20.20.20.0/8',
|
||||
"--apic-svi-enable",
|
||||
"--apic-bgp-enable",
|
||||
"--apic-bgp-asn", '1',
|
||||
"--apic-bgp-type", "bgptest1",
|
||||
"--apic-nested-domain-infra-vlan", '1',
|
||||
"--apic-nested-domain-allowed-vlans", "[2]",
|
||||
"--apic-nested-domain-allowed-vlans", '2',
|
||||
"--apic-nested-domain-service-vlan", '3',
|
||||
"--apic-nested-domain-node-network-vlan", '4',
|
||||
"--apic-extra-provided-contracts", "['pcontest1']",
|
||||
"--apic-extra-consumed-contracts", "['contest1']",
|
||||
"--apic-extra-provided-contracts", 'pcontest1',
|
||||
"--apic-extra-consumed-contracts", 'contest1',
|
||||
]
|
||||
verifylist = [
|
||||
('name', self._network.name),
|
||||
('external', True),
|
||||
('apic_nested_domain_name', "dntest1"),
|
||||
('apic_nested_domain_type', "dntype1"),
|
||||
('apic_distinguished_names', '{"disttest1": "test1"}'),
|
||||
('apic_synchronization_state', None),
|
||||
('apic_distinguished_names', [{'ExternalNetwork': 'test1'}]),
|
||||
('apic_nat_type', "edge"),
|
||||
('apic_external_cidrs', "['20.20.20.0/8']"),
|
||||
('apic_external_cidrs', '20.20.20.0/8'),
|
||||
('apic_svi_enable', True),
|
||||
('apic_bgp_enable', True),
|
||||
('apic_bgp_asn', '1'),
|
||||
('apic_bgp_type', "bgptest1"),
|
||||
('apic_nested_domain_infra_vlan', '1'),
|
||||
('apic_nested_domain_allowed_vlans', "[2]"),
|
||||
('apic_nested_domain_allowed_vlans', '2'),
|
||||
('apic_nested_domain_service_vlan', '3'),
|
||||
('apic_nested_domain_node_network_vlan', '4'),
|
||||
('apic_extra_provided_contracts', "['pcontest1']"),
|
||||
('apic_extra_consumed_contracts', "['contest1']"),
|
||||
('apic_extra_provided_contracts', 'pcontest1'),
|
||||
('apic_extra_consumed_contracts', 'contest1'),
|
||||
]
|
||||
create_ext = network_ext.CreateAndSetNetworkExtension(self.app)
|
||||
create_ext = network_ext.CreateNetworkExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
self.cmd, arglist, verifylist, create_ext)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
@ -114,7 +112,7 @@ class TestNetworkCreate(test_network.TestNetwork, test_cli20.CLITestV20Base):
|
||||
'name': self._network.name,
|
||||
'router:external': True,
|
||||
'apic:nested_domain_name': 'dntest1',
|
||||
'apic:distinguished_names': {"disttest1": "test1"},
|
||||
'apic:distinguished_names': {"ExternalNetwork": "test1"},
|
||||
'apic:external_cidrs': ['20.20.20.0/8'],
|
||||
'apic:nat_type': 'edge',
|
||||
'apic:nested_domain_name': 'dntest1',
|
||||
@ -152,11 +150,7 @@ class TestNetworkSet(test_network.TestNetwork, test_cli20.CLITestV20Base):
|
||||
('network', self._network.name),
|
||||
('apic_nested_domain_name', None),
|
||||
('apic_nested_domain_type', None),
|
||||
('apic_distinguished_names', None),
|
||||
('apic_synchronization_state', None),
|
||||
('apic_nat_type', None),
|
||||
('apic_external_cidrs', None),
|
||||
('apic_svi_enable', None),
|
||||
('apic_bgp_enable', None),
|
||||
('apic_bgp_asn', None),
|
||||
('apic_bgp_type', None),
|
||||
@ -167,7 +161,7 @@ class TestNetworkSet(test_network.TestNetwork, test_cli20.CLITestV20Base):
|
||||
('apic_extra_provided_contracts', None),
|
||||
('apic_extra_consumed_contracts', None),
|
||||
]
|
||||
set_ext = network_ext.CreateAndSetNetworkExtension(self.app)
|
||||
set_ext = network_ext.SetNetworkExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
self.cmd, arglist, verifylist, set_ext)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
@ -181,39 +175,34 @@ class TestNetworkSet(test_network.TestNetwork, test_cli20.CLITestV20Base):
|
||||
"--external",
|
||||
"--apic-nested-domain-name", "dntest11",
|
||||
"--apic-nested-domain-type", "dntype11",
|
||||
"--apic-nat-type", "distributed",
|
||||
"--apic-external-cidrs", "['30.30.30.0/8']",
|
||||
"--apic-external-cidrs", '30.30.30.0/8',
|
||||
"--apic-bgp-disable",
|
||||
"--apic-bgp-asn", '2',
|
||||
"--apic-bgp-type", "bgptest11",
|
||||
"--apic-nested-domain-infra-vlan", '2',
|
||||
"--apic-nested-domain-allowed-vlans", "[2, 3]",
|
||||
"--apic-nested-domain-allowed-vlans", '2,3',
|
||||
"--apic-nested-domain-service-vlan", '4',
|
||||
"--apic-nested-domain-node-network-vlan", '5',
|
||||
"--apic-extra-provided-contracts", "['pcontest1', 'pcontest11']",
|
||||
"--apic-extra-consumed-contracts", "['contest1', 'contest11']",
|
||||
"--apic-extra-provided-contracts", 'pcontest1,pcontest11',
|
||||
"--apic-extra-consumed-contracts", 'contest1,contest11',
|
||||
]
|
||||
verifylist = [
|
||||
('network', self._network.name),
|
||||
('external', True),
|
||||
('apic_nested_domain_name', "dntest11"),
|
||||
('apic_nested_domain_type', "dntype11"),
|
||||
('apic_distinguished_names', None),
|
||||
('apic_synchronization_state', None),
|
||||
('apic_nat_type', "distributed"),
|
||||
('apic_external_cidrs', "['30.30.30.0/8']"),
|
||||
('apic_svi_enable', None),
|
||||
('apic_external_cidrs', '30.30.30.0/8'),
|
||||
('apic_bgp_disable', True),
|
||||
('apic_bgp_asn', '2'),
|
||||
('apic_bgp_type', "bgptest11"),
|
||||
('apic_nested_domain_infra_vlan', '2'),
|
||||
('apic_nested_domain_allowed_vlans', "[2, 3]"),
|
||||
('apic_nested_domain_allowed_vlans', '2,3'),
|
||||
('apic_nested_domain_service_vlan', '4'),
|
||||
('apic_nested_domain_node_network_vlan', '5'),
|
||||
('apic_extra_provided_contracts', "['pcontest1', 'pcontest11']"),
|
||||
('apic_extra_consumed_contracts', "['contest1', 'contest11']"),
|
||||
('apic_extra_provided_contracts', 'pcontest1,pcontest11'),
|
||||
('apic_extra_consumed_contracts', 'contest1,contest11'),
|
||||
]
|
||||
set_ext = network_ext.CreateAndSetNetworkExtension(self.app)
|
||||
set_ext = network_ext.SetNetworkExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
self.cmd, arglist, verifylist, set_ext)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
@ -222,7 +211,6 @@ class TestNetworkSet(test_network.TestNetwork, test_cli20.CLITestV20Base):
|
||||
'router:external': True,
|
||||
'apic:nested_domain_name': 'dntest11',
|
||||
'apic:external_cidrs': ['30.30.30.0/8'],
|
||||
'apic:nat_type': 'distributed',
|
||||
'apic:nested_domain_name': 'dntest11',
|
||||
'apic:nested_domain_type': 'dntype11',
|
||||
'apic:bgp_enable': False,
|
||||
|
@ -35,8 +35,6 @@ class TestRouterCreate(test_router.TestRouter, test_cli20.CLITestV20Base):
|
||||
]
|
||||
verifylist = [
|
||||
('name', self.new_router.name),
|
||||
('apic_distinguished_names', None),
|
||||
('apic_synchronization_state', None),
|
||||
('apic_external_provided_contracts', None),
|
||||
('apic_external_consumed_contracts', None),
|
||||
]
|
||||
@ -53,16 +51,13 @@ class TestRouterCreate(test_router.TestRouter, test_cli20.CLITestV20Base):
|
||||
def test_create_all_options(self):
|
||||
arglist = [
|
||||
self.new_router.name,
|
||||
"--apic-distinguished-names", '{"disttest1": "test1"}',
|
||||
"--apic-external-provided-contracts", "['ptest1']",
|
||||
"--apic-external-consumed-contracts", "['ctest1']",
|
||||
"--apic-external-provided-contracts", 'ptest1',
|
||||
"--apic-external-consumed-contracts", 'ctest1',
|
||||
]
|
||||
verifylist = [
|
||||
('name', self.new_router.name),
|
||||
('apic_distinguished_names', '{"disttest1": "test1"}'),
|
||||
('apic_synchronization_state', None),
|
||||
('apic_external_provided_contracts', "['ptest1']"),
|
||||
('apic_external_consumed_contracts', "['ctest1']"),
|
||||
('apic_external_provided_contracts', 'ptest1'),
|
||||
('apic_external_consumed_contracts', 'ctest1'),
|
||||
]
|
||||
create_ext = router_ext.CreateAndSetRouterExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
@ -72,7 +67,6 @@ class TestRouterCreate(test_router.TestRouter, test_cli20.CLITestV20Base):
|
||||
self.network.create_router.assert_called_once_with(**{
|
||||
'admin_state_up': True,
|
||||
'name': self.new_router.name,
|
||||
'apic:distinguished_names': {"disttest1": "test1"},
|
||||
'apic:external_provided_contracts': ['ptest1'],
|
||||
'apic:external_consumed_contracts': ['ctest1'],
|
||||
})
|
||||
@ -115,13 +109,13 @@ class TestRouterSet(test_router.TestRouter, test_cli20.CLITestV20Base):
|
||||
def test_set_all_valid_options(self):
|
||||
arglist = [
|
||||
self._router.name,
|
||||
"--apic-external-provided-contracts", "['ptest1', 'ptest11']",
|
||||
"--apic-external-consumed-contracts", "['ctest1', 'ctest11']",
|
||||
"--apic-external-provided-contracts", 'ptest1,ptest11',
|
||||
"--apic-external-consumed-contracts", 'ctest1,ctest11',
|
||||
]
|
||||
verifylist = [
|
||||
('router', self._router.name),
|
||||
('apic_external_provided_contracts', "['ptest1', 'ptest11']"),
|
||||
('apic_external_consumed_contracts', "['ctest1', 'ctest11']"),
|
||||
('apic_external_provided_contracts', 'ptest1,ptest11'),
|
||||
('apic_external_consumed_contracts', 'ctest1,ctest11'),
|
||||
]
|
||||
set_ext = router_ext.CreateAndSetRouterExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
|
@ -49,12 +49,10 @@ class TestSubnetCreate(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
|
||||
verifylist = [
|
||||
('name', self._subnet.name),
|
||||
('network', self._subnet.network_id),
|
||||
('apic_distinguished_names', None),
|
||||
('apic_synchronization_state', None),
|
||||
('apic_snat_host_pool_enable', None),
|
||||
('apic_active_active_aap_enable', None),
|
||||
]
|
||||
create_ext = subnet_ext.CreateAndSetSubnetExtension(self.app)
|
||||
create_ext = subnet_ext.CreateSubnetExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
self.cmd, arglist, verifylist, create_ext)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
@ -71,19 +69,16 @@ class TestSubnetCreate(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
|
||||
"--subnet-range", self._subnet.cidr,
|
||||
"--network", self._subnet.network_id,
|
||||
self._subnet.name,
|
||||
"--apic-distinguished-names", '{"disttest1": "test1"}',
|
||||
"--apic-snat-host-pool-enable",
|
||||
"--apic-active-active-aap-enable",
|
||||
]
|
||||
verifylist = [
|
||||
('name', self._subnet.name),
|
||||
('network', self._subnet.network_id),
|
||||
('apic_distinguished_names', '{"disttest1": "test1"}'),
|
||||
('apic_synchronization_state', None),
|
||||
('apic_snat_host_pool_enable', True),
|
||||
('apic_active_active_aap_enable', True),
|
||||
]
|
||||
create_ext = subnet_ext.CreateAndSetSubnetExtension(self.app)
|
||||
create_ext = subnet_ext.CreateSubnetExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
self.cmd, arglist, verifylist, create_ext)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
@ -94,7 +89,6 @@ class TestSubnetCreate(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
|
||||
'name': self._subnet.name,
|
||||
'network_id': self._subnet.network_id,
|
||||
'apic:active_active_aap': True,
|
||||
'apic:distinguished_names': {"disttest1": "test1"},
|
||||
'apic:snat_host_pool': True,
|
||||
})
|
||||
|
||||
@ -117,12 +111,9 @@ class TestSubnetSet(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
|
||||
]
|
||||
verifylist = [
|
||||
('subnet', self._subnet.name),
|
||||
('apic_distinguished_names', None),
|
||||
('apic_synchronization_state', None),
|
||||
('apic_snat_host_pool_enable', None),
|
||||
('apic_active_active_aap_enable', None),
|
||||
]
|
||||
set_ext = subnet_ext.CreateAndSetSubnetExtension(self.app)
|
||||
set_ext = subnet_ext.SetSubnetExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
self.cmd, arglist, verifylist, set_ext)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
@ -137,12 +128,9 @@ class TestSubnetSet(test_subnet.TestSubnet, test_cli20.CLITestV20Base):
|
||||
]
|
||||
verifylist = [
|
||||
('subnet', self._subnet.name),
|
||||
('apic_distinguished_names', None),
|
||||
('apic_synchronization_state', None),
|
||||
('apic_snat_host_pool_disable', True),
|
||||
('apic_active_active_aap_enable', None),
|
||||
]
|
||||
set_ext = subnet_ext.CreateAndSetSubnetExtension(self.app)
|
||||
set_ext = subnet_ext.SetSubnetExtension(self.app)
|
||||
parsed_args = self.check_parser_ext(
|
||||
self.cmd, arglist, verifylist, set_ext)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
13
setup.cfg
13
setup.cfg
@ -39,32 +39,29 @@ openstack.cli.port_set =
|
||||
port_set_extension = gbpclient.gbp.v2_0.port:CreateAndSetPortExtension
|
||||
|
||||
openstack.cli.network_create =
|
||||
network_create_extension = gbpclient.gbp.v2_0.network:CreateAndSetNetworkExtension
|
||||
network_create_extension = gbpclient.gbp.v2_0.network:CreateNetworkExtension
|
||||
|
||||
openstack.cli.network_show =
|
||||
network_show_extension = gbpclient.gbp.v2_0.network:ShowNetworkExtension
|
||||
|
||||
openstack.cli.network_set =
|
||||
network_set_extension = gbpclient.gbp.v2_0.network:CreateAndSetNetworkExtension
|
||||
network_set_extension = gbpclient.gbp.v2_0.network:SetNetworkExtension
|
||||
|
||||
openstack.cli.subnet_create =
|
||||
subnet_create_extension = gbpclient.gbp.v2_0.subnet:CreateAndSetSubnetExtension
|
||||
subnet_create_extension = gbpclient.gbp.v2_0.subnet:CreateSubnetExtension
|
||||
|
||||
openstack.cli.subnet_show =
|
||||
subnet_show_extension = gbpclient.gbp.v2_0.subnet:ShowSubnetExtension
|
||||
|
||||
openstack.cli.subnet_set =
|
||||
subnet_set_extension = gbpclient.gbp.v2_0.subnet:CreateAndSetSubnetExtension
|
||||
subnet_set_extension = gbpclient.gbp.v2_0.subnet:SetSubnetExtension
|
||||
|
||||
openstack.cli.address_scope_create =
|
||||
address_scope_create_extension = gbpclient.gbp.v2_0.address_scope:CreateAndSetAddressScopeExtension
|
||||
address_scope_create_extension = gbpclient.gbp.v2_0.address_scope:CreateAddressScopeExtension
|
||||
|
||||
openstack.cli.address_scope_show =
|
||||
address_scope_show_extension = gbpclient.gbp.v2_0.address_scope:ShowAddressScopeExtension
|
||||
|
||||
openstack.cli.address_scope_set =
|
||||
address_scope_set_extension = gbpclient.gbp.v2_0.address_scope:CreateAndSetAddressScopeExtension
|
||||
|
||||
openstack.cli.router_create =
|
||||
router_create_extension = gbpclient.gbp.v2_0.router:CreateAndSetRouterExtension
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user