Beispiel #1
0
def add_nsx_extensions_to_parser(parser, client_manager, for_create=True):
    if 'security-group-logging' in utils.get_extensions(client_manager):
        # logging
        logging_enable_group = parser.add_mutually_exclusive_group()
        logging_enable_group.add_argument(
            '--logging',
            action='store_true',
            help=_("Enable logging")
        )
        logging_enable_group.add_argument(
            '--no-logging',
            action='store_true',
            help=_("Disable logging (default)")
        )
    if ('provider-security-group' in utils.get_extensions(client_manager)
        and for_create):
        # provider
        parser.add_argument(
            '--provider',
            action='store_true',
            help=_("Provider security group")
        )
    if 'security-group-policy' in utils.get_extensions(client_manager):
        # policy
        parser.add_argument(
            '--policy',
            metavar='<policy>',
            help=_("NSX Policy Id")
        )
Beispiel #2
0
def add_nsx_extensions_to_parser(parser, client_manager):
    if 'dhcp-mtu' in utils.get_extensions(client_manager):
        # DHCP MTU
        parser.add_argument('--dhcp-mtu',
                            type=int,
                            metavar='<dhcp-mtu>',
                            help=_("DHCP MTU"))
    if 'dns-search-domain' in utils.get_extensions(client_manager):
        # DNS search domain
        parser.add_argument('--dns-search-domain',
                            metavar='<domain-name>',
                            help=_("DNS search Domain"))
Beispiel #3
0
def add_nsx_extensions_to_parser(parser, client_manager):
    if 'nsxv-router-size' in utils.get_extensions(client_manager):
        # router-size
        parser.add_argument('--router-size',
                            metavar='<router-size>',
                            choices=routersize.VALID_EDGE_SIZES,
                            help=_("Router Size"))
    if 'nsxv-router-type' in utils.get_extensions(client_manager):
        # router-type
        parser.add_argument('--router-type',
                            metavar='<router-type>',
                            choices=routertype.VALID_TYPES,
                            help=_("Router Type"))
Beispiel #4
0
def _get_plugin_attrs(client_manager, parsed_args):
    attrs = super_get_attrs(client_manager, parsed_args)

    if 'nsxv-router-type' in utils.get_extensions(client_manager):
        # Router type
        if parsed_args.router_type is not None:
            attrs['router_type'] = parsed_args.router_type
            parsed_args.router_type = None
    if 'nsxv-router-size' in utils.get_extensions(client_manager):
        # Router size
        if parsed_args.router_size is not None:
            attrs['router_size'] = parsed_args.router_size
            parsed_args.router_size = None

    return attrs
Beispiel #5
0
def _get_plugin_attrs(client_manager, parsed_args):
    attrs = super_get_attrs(client_manager, parsed_args)

    if 'nsxv-router-type' in utils.get_extensions(client_manager):
        # Router type
        if parsed_args.router_type is not None:
            attrs['router_type'] = parsed_args.router_type
            parsed_args.router_type = None
    if 'nsxv-router-size' in utils.get_extensions(client_manager):
        # Router size
        if parsed_args.router_size is not None:
            attrs['router_size'] = parsed_args.router_size
            parsed_args.router_size = None

    return attrs
Beispiel #6
0
def _get_plugin_attrs(client_manager, parsed_args, is_create=True):
    attrs = super_get_attrs(client_manager, parsed_args, is_create)

    if 'dhcp-mtu' in utils.get_extensions(client_manager):
        # DHCP MTU
        if parsed_args.dhcp_mtu is not None:
            attrs['dhcp_mtu'] = int(parsed_args.dhcp_mtu)
            parsed_args.dhcp_mtu = None
    if 'dns-search-domain' in utils.get_extensions(client_manager):
        # DNS search domain
        if parsed_args.dns_search_domain is not None:
            attrs['dns_search_domain'] = parsed_args.dns_search_domain
            parsed_args.dns_search_domain = None

    return attrs
Beispiel #7
0
def _get_plugin_attrs(client_manager, parsed_args):
    allowed_extensions = utils.get_extensions(client_manager)
    attrs = super_get_attrs(client_manager, parsed_args)
    # Provider security groups
    if 'provider-security-group' in allowed_extensions:
        if (hasattr(parsed_args, 'provider_security_groups')
                and parsed_args.provider_security_groups is not None):
            attrs['provider_security_groups'] = [
                client_manager.network.find_security_group(
                    sg, ignore_missing=False).id
                for sg in parsed_args.provider_security_groups
            ]

    if 'vnic-index' in allowed_extensions:
        # Vnic index
        if parsed_args.vnic_index is not None:
            attrs['vnic_index'] = parsed_args.vnic_index
            parsed_args.vnic_index = None
    if 'mac-learning' in allowed_extensions:
        # mac-learning-enabled
        if parsed_args.enable_mac_learning:
            attrs['mac_learning_enabled'] = True
        if parsed_args.disable_mac_learning:
            attrs['mac_learning_enabled'] = False

    return attrs
Beispiel #8
0
def add_nsx_extensions_to_parser(parser, client_manager, is_create=True):
    allowed_extensions = utils.get_extensions(client_manager)
    # Provider security group (only for create action)
    if (is_create and 'provider-security-group' in allowed_extensions):
        parser.add_argument(
            '--provider-security-group',
            metavar='<provider-security-group>',
            action='append',
            dest='provider_security_groups',
            help=_("Provider Security group to associate with this port "
                   "(name or ID) "
                   "(repeat option to set multiple security groups)"))
    if 'vnic-index' in allowed_extensions:
        # vnic index
        parser.add_argument('--vnic-index',
                            type=int,
                            metavar='<vnic-index>',
                            help=_("Vnic index"))
    if 'mac-learning' in allowed_extensions:
        # mac-learning-enabled
        mac_learning_group = parser.add_mutually_exclusive_group()
        mac_learning_group.add_argument('--enable-mac-learning',
                                        action='store_true',
                                        help=_("Enable MAC learning"))
        mac_learning_group.add_argument(
            '--disable-mac-learning',
            action='store_true',
            help=_("Disable MAC learning (Default"))
Beispiel #9
0
def _get_plugin_attrs(client_manager, parsed_args):
    allowed_extensions = utils.get_extensions(client_manager)
    attrs = super_get_attrs(client_manager, parsed_args)
    # Provider security groups
    if 'provider-security-group' in allowed_extensions:
        if (hasattr(parsed_args, 'provider_security_groups') and
            parsed_args.provider_security_groups is not None):
            attrs['provider_security_groups'] = [
                client_manager.network.find_security_group(
                    sg, ignore_missing=False).id
                for sg in parsed_args.provider_security_groups]

    if 'vnic-index' in allowed_extensions:
        # Vnic index
        if parsed_args.vnic_index is not None:
            attrs['vnic_index'] = parsed_args.vnic_index
            parsed_args.vnic_index = None
    if 'mac-learning' in allowed_extensions:
        # mac-learning-enabled
        if parsed_args.enable_mac_learning:
            attrs['mac_learning_enabled'] = True
        if parsed_args.disable_mac_learning:
            attrs['mac_learning_enabled'] = False

    return attrs
Beispiel #10
0
def add_nsx_extensions_to_parser(parser, client_manager, is_create=True):
    allowed_extensions = utils.get_extensions(client_manager)
    # Provider security group (only for create action)
    if (is_create and
        'provider-security-group' in allowed_extensions):
        parser.add_argument(
            '--provider-security-group',
            metavar='<provider-security-group>',
            action='append',
            dest='provider_security_groups',
            help=_("Provider Security group to associate with this port "
                   "(name or ID) "
                   "(repeat option to set multiple security groups)")
        )
    if 'vnic-index' in allowed_extensions:
        # vnic index
        parser.add_argument(
            '--vnic-index',
            type=int,
            metavar='<vnic-index>',
            help=_("Vnic index")
        )
    if 'mac-learning' in allowed_extensions:
        # mac-learning-enabled
        mac_learning_group = parser.add_mutually_exclusive_group()
        mac_learning_group.add_argument(
            '--enable-mac-learning',
            action='store_true',
            help=_("Enable MAC learning")
        )
        mac_learning_group.add_argument(
            '--disable-mac-learning',
            action='store_true',
            help=_("Disable MAC learning (Default")
        )
Beispiel #11
0
def add_nsx_extensions_to_parser(parser, client_manager):
    if 'nsxv-router-size' in utils.get_extensions(client_manager):
        # router-size
        parser.add_argument(
            '--router-size',
            metavar='<router-size>',
            choices=routersize.VALID_EDGE_SIZES,
            help=_("Router Size")
        )
    if 'nsxv-router-type' in utils.get_extensions(client_manager):
        # router-type
        parser.add_argument(
            '--router-type',
            metavar='<router-type>',
            choices=routertype.VALID_TYPES,
            help=_("Router Type")
        )
Beispiel #12
0
def _get_plugin_attrs(attrs, parsed_args, client_manager):
    if 'security-group-logging' in utils.get_extensions(client_manager):
        # logging
        if parsed_args.logging:
            attrs['logging'] = True
        if parsed_args.no_logging:
            attrs['logging'] = False
    if 'provider-security-group' in utils.get_extensions(client_manager):
        # provider
        if hasattr(parsed_args, 'provider') and parsed_args.provider:
            attrs['provider'] = True
    if 'security-group-policy' in utils.get_extensions(client_manager):
        # policy
        if parsed_args.policy is not None:
            attrs['policy'] = parsed_args.policy

    return attrs