Exemple #1
0
 def add_known_arguments(self, parser):
     parser.add_argument(
         'name',
         metavar='NAME',
         help=_('Name of the Port Pair.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Port Pair.'))
     parser.add_argument(
         '--ingress',
         required=True,
         help=_('ID or name of the ingress neutron port.'))
     parser.add_argument(
         '--egress',
         required=True,
         help=_('ID or name of the egress neutron port.'))
     parser.add_argument(
         '--service-function-parameters',
         metavar=(
             'type=TYPE[,correlation=CORRELATION_TYPE,weight=WEIGHT]'),
         type=utils.str2dict,
         help=_('Dictionary of Service function parameters. '
                'Currently, only correlation=None and weight '
                'is supported. Weight is an integer that influences '
                'the selection of a port pair within a port pair group '
                'for a flow. The higher the weight, the more flows will '
                'hash to the port pair. The default weight is 1.'))
Exemple #2
0
 def add_known_arguments(self, parser):
     parser.add_argument(
         'name',
         metavar='NAME',
         help=_('Name of the Port Chain.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Port Chain.'))
     parser.add_argument(
         '--port-pair-group',
         metavar='PORT-PAIR-GROUP',
         dest='port_pair_groups',
         default=[], required=True,
         action='append',
         help=_('ID or name of the Port Pair Group. '
                'This option can be repeated.'))
     parser.add_argument(
         '--flow-classifier',
         default=[],
         metavar='FLOW-CLASSIFIER',
         dest='flow_classifiers',
         action='append',
         help=_('ID or name of the Flow Classifier.'
                'This option can be repeated.'))
     parser.add_argument(
         '--chain-parameters',
         metavar='type=TYPE[,correlation=CORRELATION_TYPE]',
         type=utils.str2dict,
         help=_('Dictionary of chain parameters. Currently, only '
                'correlation=mpls is supported by default.'))
def _build_group_expr_str(group_dict, cmd):
    group_expr_arr = []
    buckets = None
    groupId = None

    if cmd != 'del':
        if "group_id" not in group_dict:
            msg = _("Must specify one group Id on group addition"
                    " or modification")
            raise exceptions.InvalidInput(error_message=msg)
        groupId = "group_id=%s" % group_dict.pop('group_id')

        if "buckets" not in group_dict:
            msg = _("Must specify one or more buckets on group addition"
                    " or modification")
            raise exceptions.InvalidInput(error_message=msg)
        buckets = "%s" % group_dict.pop('buckets')

    if groupId:
        group_expr_arr.append(groupId)

    for key, value in six.iteritems(group_dict):
        group_expr_arr.append("%s=%s" % (key, value))

    if buckets:
        group_expr_arr.append(buckets)

    return ','.join(group_expr_arr)
 def add_known_arguments(self, parser):
     parser.add_argument(
         'name',
         metavar='NAME',
         help=_('Name of the Port Chain.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Port Chain.'))
     parser.add_argument(
         '--port-pair-group',
         metavar='PORT-PAIR-GROUP',
         dest='port_pair_groups',
         default=[], required=True,
         action='append',
         help=_('ID or name of the Port Pair Group. '
                'This option can be repeated.'))
     parser.add_argument(
         '--flow-classifier',
         default=[],
         metavar='FLOW-CLASSIFIER',
         dest='flow_classifiers',
         action='append',
         help=_('ID or name of the Flow Classifier.'
                'This option can be repeated.'))
     parser.add_argument(
         '--chain-parameters',
         metavar='[correlation=CORRELATION_TYPE, symmetric=BOOLEAN_TYPE]',
         type=utils.str2dict_type(optional_keys=['correlation',
                                                 'symmetric']),
         help=_('Dictionary of chain parameters. Supports '
                'correlation=mpls and symmetric=true|false.'))
Exemple #5
0
 def add_known_arguments(self, parser):
     parser.add_argument('name',
                         metavar='NAME',
                         help=_('Name of the Port Chain.'))
     parser.add_argument('--description',
                         help=_('Description for the Port Chain.'))
     parser.add_argument('--port-pair-group',
                         metavar='PORT-PAIR-GROUP',
                         dest='port_pair_groups',
                         default=[],
                         required=True,
                         action='append',
                         help=_('ID or name of the Port Pair Group. '
                                'This option can be repeated.'))
     parser.add_argument('--flow-classifier',
                         default=[],
                         metavar='FLOW-CLASSIFIER',
                         dest='flow_classifiers',
                         action='append',
                         help=_('ID or name of the Flow Classifier.'
                                'This option can be repeated.'))
     parser.add_argument(
         '--chain-parameters',
         metavar='type=TYPE[,correlation=CORRELATION_TYPE]',
         type=utils.str2dict,
         help=_('Dictionary of chain parameters. Currently, only '
                'correlation=mpls is supported by default.'))
Exemple #6
0
 def add_known_arguments(self, parser):
     parser.add_argument('name',
                         metavar='NAME',
                         help=_('Name of the Port Chain.'))
     parser.add_argument('--description',
                         help=_('Description for the Port Chain.'))
     parser.add_argument('--port-pair-group',
                         metavar='PORT-PAIR-GROUP',
                         dest='port_pair_groups',
                         default=[],
                         required=True,
                         action='append',
                         help=_('ID or name of the Port Pair Group. '
                                'This option can be repeated.'))
     parser.add_argument('--flow-classifier',
                         default=[],
                         metavar='FLOW-CLASSIFIER',
                         dest='flow_classifiers',
                         action='append',
                         help=_('ID or name of the Flow Classifier.'
                                'This option can be repeated.'))
     parser.add_argument(
         '--chain-parameters',
         metavar='[correlation=CORRELATION_TYPE, symmetric=BOOLEAN_TYPE]',
         type=utils.str2dict_type(
             optional_keys=['correlation', 'symmetric']),
         help=_('Dictionary of chain parameters. Supports '
                'correlation=nsh and symmetric=true|false.'))
 def add_known_arguments(self, parser):
     parser.add_argument(
         '--name',
         metavar='NAME',
         help=_('Name of the Port Chain.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Port Chain.'))
     fw_args = parser.add_mutually_exclusive_group()
     fw_args.add_argument(
         '--flow-classifier',
         metavar='FLOW-CLASSIFIER',
         dest='flow_classifiers',
         action='append',
         help=_('ID or name of the Flow Classifier. '
                'This option can be repeated.'))
     fw_args.add_argument(
         '--no-flow-classifier',
         action='store_true',
         help=_('Associate no Flow Classifier with the Port Chain.'))
     parser.add_argument(
         '--port-pair-group',
         metavar='PORT-PAIR-GROUP',
         dest='port_pair_groups',
         action='append',
         help=_('ID or name of the port pair group. '
                 'This option can be repeated.'))
 def add_known_arguments(self, parser):
     parser.add_argument(
         'name',
         metavar='NAME',
         help=_('Name of the Port Pair.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Port Pair.'))
     parser.add_argument(
         '--ingress',
         required=True,
         help=_('ID or name of the ingress neutron port.'))
     parser.add_argument(
         '--egress',
         required=True,
         help=_('ID or name of the egress neutron port.'))
     parser.add_argument(
         '--service-function-parameters',
         metavar='[correlation=CORRELATION_TYPE, weight=WEIGHT]',
         type=utils.str2dict_type(optional_keys=['correlation',
                                                 'weight']),
         help=_('Dictionary of Service function parameters. '
                'Currently, only correlation=None and weight '
                'is supported. Weight is an integer that influences '
                'the selection of a port pair within a port pair group '
                'for a flow. The higher the weight, the more flows will '
                'hash to the port pair. The default weight is 1.'))
def _build_group_expr_str(group_dict, cmd):
    group_expr_arr = []
    buckets = None
    group_id = None

    if cmd != 'del':
        if "group_id" not in group_dict:
            msg = _("Must specify one group Id on group addition"
                    " or modification")
            raise exceptions.InvalidInput(error_message=msg)
        group_id = "group_id=%s" % group_dict.pop('group_id')

        if "buckets" not in group_dict:
            msg = _("Must specify one or more buckets on group addition"
                    " or modification")
            raise exceptions.InvalidInput(error_message=msg)
        buckets = "%s" % group_dict.pop('buckets')

    if group_id:
        group_expr_arr.append(group_id)

    for key, value in group_dict.items():
        group_expr_arr.append("%s=%s" % (key, value))

    if buckets:
        group_expr_arr.append(buckets)

    return ','.join(group_expr_arr)
Exemple #10
0
 def add_known_arguments(self, parser):
     parser.add_argument(
         '--name',
         metavar='NAME',
         help=_('Name of the Port Pair.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Port Pair.'))
Exemple #11
0
 def add_known_arguments(self, parser):
     parser.add_argument(
         '--name',
         metavar='NAME',
         help=_('Name of the Port Pair.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Port Pair.'))
Exemple #12
0
def validate_list_of_allowed_values(data, allowed_values=None):
    if not isinstance(data, list):
        msg = _("'%s' is not a list") % data
        return msg

    illegal_values = set(data) - set(allowed_values)
    if illegal_values:
        msg = _("Illegal values in a list: %s") % ', '.join(illegal_values)
        return msg
Exemple #13
0
def validate_list_of_allowed_values(data, allowed_values=None):
    if not isinstance(data, list):
        msg = _("'%s' is not a list") % data
        return msg

    illegal_values = set(data) - set(allowed_values)
    if illegal_values:
        msg = _("Illegal values in a list: %s") % ", ".join(illegal_values)
        return msg
def add_common_arguments(parser):
    parser.add_argument('--description',
                        help=_('Description for the Port Pair Group.'))
    parser.add_argument('--port-pair',
                        metavar='PORT-PAIR',
                        dest='port_pairs',
                        default=[],
                        action='append',
                        help=_('ID or name of the Port Pair. '
                               'This option can be repeated.'))
def add_common_arguments(parser):
    parser.add_argument(
        '--description',
        help=_('Description for the Port Pair Group.'))
    parser.add_argument(
        '--port-pair',
        metavar='PORT-PAIR',
        dest='port_pairs',
        default=[],
        action='append',
        help=_('ID or name of the Port Pair. '
               'This option can be repeated.'))
Exemple #16
0
 def add_known_arguments(self, parser):
     parser.add_argument('name',
                         metavar='NAME',
                         help=_('Name of the Port Pair Group.'))
     add_common_arguments(parser)
     parser.add_argument(
         '--port-pair-group-parameters',
         metavar='[lb_fields=LB_FIELDS]',
         type=utils.str2dict_type(optional_keys=['lb_fields']),
         help=_('Dictionary of Port pair group parameters. '
                'Currently, only \'&\' separated string of the lb_fields '
                'are supported.'))
Exemple #17
0
 def get_parser(self, prog_name):
     parser = super(UpdateFlowClassifier, self).get_parser(prog_name)
     parser.add_argument('--name',
                         metavar='NAME',
                         help=_('Name of the Flow Classifier.'))
     parser.add_argument('--description',
                         help=_('Description for the Flow Classifier.'))
     parser.add_argument(
         'flow_classifier',
         metavar="FLOW_CLASSIFIER",
         help=_("ID or name of the Flow Classifier to update."))
     return parser
 def add_known_arguments(self, parser):
     parser.add_argument('name',
                         metavar='NAME',
                         help=_('Name of the Port Pair Group.'))
     add_common_arguments(parser)
     parser.add_argument('--port-pair-group-parameters',
                         metavar=('type=TYPE[,service_type=SERVICE_TYPE'
                                  ',lb_fields=LB_FIELDS]'),
                         type=utils.str2dict,
                         help=_('Dictionary of Port pair group parameters. '
                                'Currently, only service_type=[l2,l3] and '
                                '\'&\' separated string of the lb_fields '
                                'are supported.'))
 def add_known_arguments(self, parser):
     parser.add_argument(
         'name',
         metavar='NAME',
         help=_('Name of the Port Pair Group.'))
     add_common_arguments(parser)
     parser.add_argument(
         '--port-pair-group-parameters',
         metavar='[lb_fields=LB_FIELDS]',
         type=utils.str2dict_type(optional_keys=['lb_fields']),
         help=_('Dictionary of Port pair group parameters. '
                'Currently, only \'&\' separated string of the lb_fields '
                'are supported.'))
 def get_parser(self, prog_name):
     parser = super(UpdateFlowClassifier, self).get_parser(prog_name)
     parser.add_argument(
         '--name',
         metavar='NAME',
         help=_('Name of the Flow Classifier.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Flow Classifier.'))
     parser.add_argument(
         'flow_classifier',
         metavar="FLOW_CLASSIFIER",
         help=_("ID or name of the Flow Classifier to update.")
     )
     return parser
Exemple #21
0
class FlowClassifierInvalidL7Parameter(neutron_exc.InvalidInput):
    message = _(
        "Invalid Flow Classifier parameters: %%(error_message)s. "
        "Supported flow classifier parameters are %(supported_parameters)s."
    ) % {
        'supported_parameters': SUPPORTED_L7_PARAMETERS
    }
Exemple #22
0
class InvalidServiceFunctionParameter(neutron_exc.InvalidInput):
    message = _(
        "Service function parameter does not support (%%(key)s, %%(value)s). "
        "Supported service function parameters are %(supported_paramters)s."
    ) % {
        'supported_paramters': SUPPORTED_SF_PARAMETERS
    }
Exemple #23
0
 def get_parser(self, prog_name):
     parser = super(ShowFlowClassifier, self).get_parser(prog_name)
     parser.add_argument(
         'flow_classifier',
         metavar="FLOW_CLASSIFIER",
         help=_(" ID or name of the Flow Classifier to display."))
     return parser
 def add_known_arguments(self, parser):
     parser.add_argument(
         'name',
         metavar='NAME',
         help=_('Name of the Port Pair Group.'))
     add_common_arguments(parser)
     parser.add_argument(
         '--port-pair-group-parameters',
         metavar=(
             'type=TYPE[,service_type=SERVICE_TYPE'
             ',lb_fields=LB_FIELDS]'),
         type=utils.str2dict,
         help=_('Dictionary of Port pair group parameters. '
                'Currently, only service_type=[l2,l3] and '
                '\'&\' separated string of the lb_fields '
                'are supported.'))
 def get_parser(self, prog_name):
     parser = super(ShowFlowClassifier, self).get_parser(prog_name)
     parser.add_argument(
         'flow_classifier',
         metavar="FLOW_CLASSIFIER",
         help=_(" ID or name of the Flow Classifier to display.")
     )
     return parser
Exemple #26
0
 def add_known_arguments(self, parser):
     parser.add_argument('--name',
                         metavar='NAME',
                         help=_('Name of the Port Chain.'))
     parser.add_argument('--description',
                         help=_('Description for the Port Chain.'))
     fw_args = parser.add_mutually_exclusive_group()
     fw_args.add_argument('--flow-classifier',
                          metavar='FLOW-CLASSIFIER',
                          dest='flow_classifiers',
                          action='append',
                          help=_('ID or name of the Flow Classifier. '
                                 'This option can be repeated.'))
     fw_args.add_argument(
         '--no-flow-classifier',
         action='store_true',
         help=_('Associate no Flow Classifier with the Port Chain.'))
 def do_action_groups(self, action, kwargs_list):
     group_strs = [_build_group_expr_str(kw, action) for kw in kwargs_list]
     if action == 'add' or action == 'del':
         self.run_ofctl('%s-groups' % action, ['-'], '\n'.join(group_strs))
     elif action == 'mod':
         self.run_ofctl('%s-group' % action, ['-'], '\n'.join(group_strs))
     else:
         msg = _("Action is illegal")
         raise exceptions.InvalidInput(error_message=msg)
Exemple #28
0
 def do_action_groups(self, action, kwargs_list):
     group_strs = [_build_group_expr_str(kw, action) for kw in kwargs_list]
     if action == 'add' or action == 'del':
         self.run_ofctl('%s-groups' % action, ['-'], '\n'.join(group_strs))
     elif action == 'mod':
         self.run_ofctl('%s-group' % action, ['-'], '\n'.join(group_strs))
     else:
         msg = _("Action is illegal")
         raise exceptions.InvalidInput(error_message=msg)
 def add_known_arguments(self, parser):
     parser.add_argument('name',
                         metavar='NAME',
                         help=_('Name of the Port Pair Group.'))
     add_common_arguments(parser)
     parser.add_argument(
         '--port-pair-group-parameters',
         metavar='[lb_fields=LB_FIELDS, ppg_n_tuple_mapping=TUPLE_VALUES]',
         type=utils.str2dict_type(
             optional_keys=['lb_fields', 'ppg_n_tuple_mapping']),
         help=_('Dictionary of Port pair group parameters. '
                'Currently, only \'&\' separated string of the lb_fields '
                'and ppg_n_tuple_mapping are supported. For '
                'ppg_n_tuple_mapping the supported command is '
                '\'key=value\' separated by \'&\'. Support '
                'ppg_n_tuple_mapping keys are: source_ip_prefix_ingress, '
                'source_ip_prefix_egress, destination_ip_prefix_ingress, '
                'destination_ip_prefix_egress, source_port_ingress, '
                'source_port_egress, destination_port_ingress, '
                'destination_port_egress.'))
Exemple #30
0
 def add_known_arguments(self, parser):
     parser.add_argument(
         'name',
         metavar='NAME',
         help=_('Name of the Port Pair.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Port Pair.'))
     parser.add_argument(
         '--ingress',
         required=True,
         help=_('ID or name of the ingress neutron port.'))
     parser.add_argument(
         '--egress',
         required=True,
         help=_('ID or name of the egress neutron port.'))
     parser.add_argument(
         '--service-function-parameters',
         metavar='type=TYPE[,correlation=CORRELATION_TYPE]',
         type=utils.str2dict,
         help=_('Dictionary of Service function parameters. '
                'Currently, only correlation=None is supported.'))
def get_port_mask(min_port, max_port):
    """get port/mask serial by port range."""
    if min_port < 1 or max_port > 0xffff or min_port > max_port:
        msg = _("the port range is invalid")
        raise exceptions.InvalidInput(error_message=msg)
    masks = []
    while min_port <= max_port:
        mask = 0xffff
        while mask != 0:
            next_mask = (mask << 1) & 0xffff
            port_start = min_port & next_mask
            port_end = min_port + (next_mask ^ 0xffff)
            if port_start == min_port and port_end <= max_port:
                mask = next_mask
            else:
                break
        masks.append('0x%x/0x%x' % (min_port, mask))
        min_port = min_port + (mask ^ 0xffff) + 1

    return masks
Exemple #32
0
def get_port_mask(min_port, max_port):
    """get port/mask serial by port range."""
    if min_port < 1 or max_port > 0xffff or min_port > max_port:
        msg = _("the port range is invalid")
        raise exceptions.InvalidInput(error_message=msg)
    masks = []
    while min_port <= max_port:
        mask = 0xffff
        while mask != 0:
            next_mask = (mask << 1) & 0xffff
            port_start = min_port & next_mask
            port_end = min_port + (next_mask ^ 0xffff)
            if port_start == min_port and port_end <= max_port:
                mask = next_mask
            else:
                break
        masks.append('0x%x/0x%x' % (min_port, mask))
        min_port = min_port + (mask ^ 0xffff) + 1

    return masks
Exemple #33
0
class FlowClassifierInvalidPortValue(neutron_exc.InvalidInput):
    message = _("Flow Classifier has invalid port value %(port)s.")
Exemple #34
0
class FlowClassiferDuplicateInformation(neutron_exc.InvalidInput):
    message = _("Flow Classifier has duplicate information: "
                "Neutron Port id %(port_id)s and ip prefix %(ip_prefix)s.")
Exemple #35
0
class FlowClassifierPortNotFound(neutron_exc.NotFound):
    message = _("Flow Classifier Neutron Port %(id)s not found.")
Exemple #36
0
class FlowClassifierInvalidPortRange(neutron_exc.InvalidInput):
    message = _("Invalid IP protocol port range. min_port_range="
                "%(port_range_min)s must be lesser or equal to "
                "max_port_range=%(port_range_max)s.")
            'allow_post': True, 'allow_put': False,
            'is_visible': True,
            'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE},
            'required_by_policy': True},
        'port_chains': {
            'allow_post': True, 'allow_put': False,
            'is_visible': True,
            'validate': {'type:dict': None},
            'convert_to': normalize_service_graph}
    }
}

service_graph_quota_opts = [
    cfg.IntOpt('quota_service_graphs',
               default=10,
               help=_('maximum number of Service Graphs per project. '
                      'a negative value means unlimited.'))
]

cfg.CONF.register_opts(service_graph_quota_opts, 'QUOTAS')


class Servicegraph(extensions.ExtensionDescriptor):
    """Service Graph extension."""

    @classmethod
    def get_name(cls):
        return "Service Graph"

    @classmethod
    def get_alias(cls):
        return SG_EXT
Exemple #38
0
            'allow_post': True,
            'allow_put': False,
            'is_visible': True,
            'default': None,
            'validate': {
                'type:dict': None
            },
            'convert_to': normalize_l7parameters
        },
    },
}

flow_classifier_quota_opts = [
    cfg.IntOpt('quota_flow_classifier',
               default=100,
               help=_('Maximum number of Flow Classifiers per tenant. '
                      'A negative value means unlimited.')),
]
cfg.CONF.register_opts(flow_classifier_quota_opts, 'QUOTAS')


class Flowclassifier(extensions.ExtensionDescriptor):
    """Flow Classifier extension."""
    @classmethod
    def get_name(cls):
        return "Flow Classifier"

    @classmethod
    def get_alias(cls):
        return FLOW_CLASSIFIER_EXT

    @classmethod
 def add_known_arguments(self, parser):
     parser.add_argument("name", metavar="NAME", help=_("Name of the Flow Classifier."))
     parser.add_argument("--description", help=_("Description for the Flow Classifier."))
     parser.add_argument("--protocol", help=_("IP protocol name. Protocol name should be as per " "IANA standard."))
     parser.add_argument(
         "--ethertype", default="IPv4", choices=["IPv4", "IPv6"], help=_("L2 ethertype, default is IPv4.")
     )
     parser.add_argument(
         "--source-port",
         help=_(
             "Source protocol port (allowed range [1,65535]. Must be "
             "specified as a:b, where a=min-port and b=max-port.)"
         ),
     )
     parser.add_argument(
         "--destination-port",
         help=_(
             "Destination protocol port (allowed range [1,65535]. Must "
             "be specified as a:b, where a=min-port and b=max-port.)"
         ),
     )
     parser.add_argument("--source-ip-prefix", help=_("Source IP prefix or subnet."))
     parser.add_argument("--destination-ip-prefix", help=_("Destination IP prefix or subnet."))
     parser.add_argument("--logical-source-port", help=_("ID or name of the neutron source port."))
     parser.add_argument("--logical-destination-port", help=_("ID or name of the neutron destination port."))
     parser.add_argument(
         "--l7-parameters",
         metavar="type=TYPE[,url=URL_PATH]",
         type=utils.str2dict,
         help=_("Dictionary of L7-parameters. Currently, no value is " "supported for this option."),
     )
Exemple #40
0
class FlowClassifierInvalidProtocol(neutron_exc.InvalidInput):
    message = _("Flow Classifier does not support protocol %(protocol)s. "
                "Supported protocol values are %(values)s.")
 def add_known_arguments(self, parser):
     parser.add_argument('--name',
                         metavar='NAME',
                         help=_('Name of the Port Pair Group.'))
     add_common_arguments(parser)
Exemple #42
0
# Copyright 2015 Futurewei. All rights reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from oslo_config import cfg

from networking_sfc._i18n import _

FLOWCLASSIFIER_DRIVER_OPTS = [
    cfg.ListOpt('drivers',
                default=['dummy'],
                help=_("An ordered list of flow classifier drivers "
                       "entrypoints to be loaded from the "
                       "networking_sfc.flowclassifier.drivers namespace.")),
]


cfg.CONF.register_opts(FLOWCLASSIFIER_DRIVER_OPTS, "flowclassifier")
 def add_known_arguments(self, parser):
     parser.add_argument(
         '--name',
         metavar='NAME',
         help=_('Name of the Port Pair Group.'))
     add_common_arguments(parser)
Exemple #44
0
            'allow_post': True, 'allow_put': True,
            'is_visible': True, 'default': None,
            'validate': {'type:uuid_list': None},
            'convert_to': lib_converters.convert_none_to_empty_list},
        'port_pair_group_parameters': {
            'allow_post': True, 'allow_put': False,
            'is_visible': True, 'default': None,
            'validate': {'type:dict': None},
            'convert_to': normalize_ppg_parameters},
    },
}

sfc_quota_opts = [
    cfg.IntOpt('quota_port_chain',
               default=10,
               help=_('Maximum number of port chains per tenant. '
                      'A negative value means unlimited.')),
    cfg.IntOpt('quota_port_pair_group',
               default=10,
               help=_('maximum number of port pair group per tenant. '
                      'a negative value means unlimited.')),
    cfg.IntOpt('quota_port_pair',
               default=100,
               help=_('maximum number of port pair per tenant. '
                      'a negative value means unlimited.'))
]

cfg.CONF.register_opts(sfc_quota_opts, 'QUOTAS')


class Sfc(neutron_ext.ExtensionDescriptor):
    """Service Function Chain extension."""
Exemple #45
0
class FlowClassifierProtocolRequiredWithPorts(neutron_exc.InvalidInput):
    message = _("IP protocol must be TCP or UDP, if port range is given.")
Exemple #46
0
class FlowClassifierInUse(neutron_exc.InUse):
    message = _("Flow Classifier %(id)s in use.")
 def add_known_arguments(self, parser):
     parser.add_argument("--name", metavar="NAME", help=_("Name of the Flow Classifier."))
     parser.add_argument("--description", help=_("Description for the Flow Classifier."))
Exemple #48
0
class FlowClassifierInConflict(neutron_exc.InvalidInput):
    message = _("Flow Classifier conflicts with "
                "another Flow Classifier %(id)s.")
Exemple #49
0
                    "lb_fields": {
                        "default": DEFAULT_PPG_PARAMETERS["lb_fields"],
                        "type:list_of_allowed_values": SUPPORTED_LB_FIELDS,
                    }
                }
            },
            "convert_to": normalize_ppg_parameters,
        },
    },
}

sfc_quota_opts = [
    cfg.IntOpt(
        "quota_port_chain",
        default=10,
        help=_("Maximum number of port chains per tenant. " "A negative value means unlimited."),
    ),
    cfg.IntOpt(
        "quota_port_pair_group",
        default=10,
        help=_("maximum number of port pair group per tenant. " "a negative value means unlimited."),
    ),
    cfg.IntOpt(
        "quota_port_pair",
        default=100,
        help=_("maximum number of port pair per tenant. " "a negative value means unlimited."),
    ),
]

cfg.CONF.register_opts(sfc_quota_opts, "QUOTAS")
Exemple #50
0
class FlowClassifierInvalidEthertype(neutron_exc.InvalidInput):
    message = _("Flow Classifier does not support ethertype %(ethertype)s. "
                "Supported ethertype values are %(values)s.")
        "l7_parameters": {
            "allow_post": True,
            "allow_put": False,
            "is_visible": True,
            "default": None,
            "validate": {"type:dict": None},
            "convert_to": normalize_l7parameters,
        },
    }
}

flow_classifier_quota_opts = [
    cfg.IntOpt(
        "quota_flow_classifier",
        default=100,
        help=_("Maximum number of Flow Classifiers per tenant. " "A negative value means unlimited."),
    )
]
cfg.CONF.register_opts(flow_classifier_quota_opts, "QUOTAS")


class Flowclassifier(extensions.ExtensionDescriptor):
    """Flow Classifier extension."""

    @classmethod
    def get_name(cls):
        return "Flow Classifier"

    @classmethod
    def get_alias(cls):
        return FLOW_CLASSIFIER_EXT
Exemple #52
0
class FlowClassifierIpPrefixFormatConflictWithEthertype(
        neutron_exc.InvalidInput):
    message = _("IP prefix %(ip_prefix)s format conflicts with "
                "ethertype %(ethertype)s.")
        'logical_destination_port': {
            'allow_post': True, 'allow_put': False,
            'is_visible': True, 'default': None,
            'validate': {'type:uuid_or_none': None}},
        'l7_parameters': {
            'allow_post': True, 'allow_put': False,
            'is_visible': True, 'default': None,
            'validate': {'type:dict': None},
            'convert_to': normalize_l7parameters},
    },
}

flow_classifier_quota_opts = [
    cfg.IntOpt('quota_flow_classifier',
               default=100,
               help=_('Maximum number of Flow Classifiers per tenant. '
                      'A negative value means unlimited.')),
]
cfg.CONF.register_opts(flow_classifier_quota_opts, 'QUOTAS')


class Flowclassifier(neutron_ext.ExtensionDescriptor):
    """Flow Classifier extension."""

    @classmethod
    def get_name(cls):
        return "Flow Classifier"

    @classmethod
    def get_alias(cls):
        return FLOW_CLASSIFIER_EXT
Exemple #54
0
# Copyright 2015 Futurewei. All rights reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from oslo_config import cfg

from networking_sfc._i18n import _

SFC_DRIVER_OPTS = [
    cfg.ListOpt('drivers',
                default=['dummy'],
                help=_("An ordered list of service chain drivers "
                       "entrypoints to be loaded from the "
                       "networking_sfc.sfc.drivers namespace.")),
]


cfg.CONF.register_opts(SFC_DRIVER_OPTS, "sfc")
 def add_known_arguments(self, parser):
     parser.add_argument(
         'name',
         metavar='NAME',
         help=_('Name of the Flow Classifier.'))
     parser.add_argument(
         '--description',
         help=_('Description for the Flow Classifier.'))
     parser.add_argument(
         '--protocol',
         help=_('IP protocol name. Protocol name should be as per '
                'IANA standard.'))
     parser.add_argument(
         '--ethertype',
         default='IPv4', choices=['IPv4', 'IPv6'],
         help=_('L2 ethertype, default is IPv4.'))
     parser.add_argument(
         '--source-port',
         help=_('Source protocol port (allowed range [1,65535]. Must be '
                'specified as a:b, where a=min-port and b=max-port.)'))
     parser.add_argument(
         '--destination-port',
         help=_('Destination protocol port (allowed range [1,65535]. Must '
                'be specified as a:b, where a=min-port and b=max-port.)'))
     parser.add_argument(
         '--source-ip-prefix',
         help=_('Source IP prefix or subnet.'))
     parser.add_argument(
         '--destination-ip-prefix',
         help=_('Destination IP prefix or subnet.'))
     parser.add_argument(
         '--logical-source-port',
         help=_('ID or name of the neutron source port.'))
     parser.add_argument(
         '--logical-destination-port',
         help=_('ID or name of the neutron destination port.'))
     parser.add_argument(
         '--l7-parameters',
         metavar='type=TYPE[,url=URL_PATH]',
         type=utils.str2dict,
         help=_('Dictionary of L7-parameters. Currently, no value is '
                'supported for this option.'))