예제 #1
0
    def create_flow_classifier_precommit(self, context):
        """Validate the flow classifier data before committing the transaction

        The NSX-v redirect rules does not support:
        - logical ports
        - l7 parameters
        - source ports range / destination port range with more than 15 ports
        """
        flow_classifier = context.current

        # Logical source port
        logical_source_port = flow_classifier['logical_source_port']
        if logical_source_port is not None:
            msg = _('The NSXv driver does not support setting '
                    'logical source port in FlowClassifier')
            raise exc.FlowClassifierBadRequest(message=msg)

        # Logical destination port
        logical_destination_port = flow_classifier['logical_destination_port']
        if logical_destination_port is not None:
            msg = _('The NSXv driver does not support setting '
                    'logical destination port in FlowClassifier')
            raise exc.FlowClassifierBadRequest(message=msg)

        # L7 parameters
        l7_params = flow_classifier['l7_parameters']
        if l7_params is not None and len(l7_params.keys()) > 0:
            msg = _('The NSXv driver does not support setting '
                    'L7 parameters in FlowClassifier')
            raise exc.FlowClassifierBadRequest(message=msg)
예제 #2
0
    def create_flow_classifier_precommit(self, context):
        flow_classifier = context.current
        source_port = flow_classifier.get('logical_source_port')
        dest_port = flow_classifier.get('logical_destination_port')

        if source_port is None and dest_port is None:
            raise fc_exc.FlowClassifierBadRequest(message=_(
                'Either logical_source_port or logical_destination_port '
                'have to be specified'), )
        if source_port is not None and dest_port is not None:
            raise fc_exc.FlowClassifierBadRequest(message=_(
                'Both logical_source_port and logical_destination_port '
                'cannot be specified'), )
예제 #3
0
    def create_flow_classifier_precommit(self, context):
        """Validate the flow classifier data before committing the transaction

        The NSX-v redirect rules does not support:
        - logical ports
        - l7 parameters
        - source ports range / destination port range with more than 15 ports
        """
        flow_classifier = context.current

        # Logical source port
        logical_source_port = flow_classifier['logical_source_port']
        if logical_source_port is not None:
            msg = _('The NSXv driver does not support setting '
                    'logical source port in FlowClassifier')
            raise exc.FlowClassifierBadRequest(message=msg)

        # Logical destination port
        logical_destination_port = flow_classifier['logical_destination_port']
        if logical_destination_port is not None:
            msg = _('The NSXv driver does not support setting '
                    'logical destination port in FlowClassifier')
            raise exc.FlowClassifierBadRequest(message=msg)

        # L7 parameters
        l7_params = flow_classifier['l7_parameters']
        if l7_params is not None and len(l7_params.keys()) > 0:
            msg = _('The NSXv driver does not support setting '
                    'L7 parameters in FlowClassifier')
            raise exc.FlowClassifierBadRequest(message=msg)

        # Source ports range - up to 15 ports.
        sport_min = flow_classifier['source_port_range_min']
        sport_max = flow_classifier['source_port_range_max']
        if (sport_min is not None and sport_max is not None
                and (sport_max + 1 - sport_min) > MAX_PORTS_IN_RANGE):
            msg = _('The NSXv driver does not support setting '
                    'more than %d source ports in a '
                    'FlowClassifier') % MAX_PORTS_IN_RANGE
            raise exc.FlowClassifierBadRequest(message=msg)

        # Destination ports range - up to 15 ports.
        dport_min = flow_classifier['destination_port_range_min']
        dport_max = flow_classifier['destination_port_range_max']
        if (dport_min is not None and dport_max is not None
                and (dport_max + 1 - dport_min) > MAX_PORTS_IN_RANGE):
            msg = _('The NSXv driver does not support setting '
                    'more than %d destination ports in a '
                    'FlowClassifier') % MAX_PORTS_IN_RANGE
            raise exc.FlowClassifierBadRequest(message=msg)
예제 #4
0
    def create_flow_classifier_precommit(self, context):
        """OVN Driver precommit before transaction committed.

        Make sure the logical_source_port is not None.
        Make sure the logical_destination_port is not None.
        """
        flow_classifier = context.current
        logical_source_port = flow_classifier['logical_source_port']
        if logical_source_port is None:
            raise exc.FlowClassifierBadRequest(message=(
                'FlowClassifier %s does not set '
                'logical source port in ovn driver' % flow_classifier['id']))
        logical_destination_port = flow_classifier['logical_destination_port']
        if logical_destination_port is None:
            raise exc.FlowClassifierBadRequest(message=(
                'FlowClassifier %s does not set logical destination'
                ' port in ovn driver' % flow_classifier['id']))