Пример #1
0
 def _get_classification_match(self, child_port_segmentation):
     match = self.parser.OFPMatch()
     match.set_in_port(self._get_ofport(child_port_segmentation))
     segmentation_type = child_port_segmentation.segmentation_type
     if n_const.TYPE_VLAN == segmentation_type:
         self._update_classification_match_vlan(match,
                                                child_port_segmentation)
     else:
         raise exceptions.UnsupportedSegmentationType(
             segmentation_type=segmentation_type)
     return match
Пример #2
0
 def _get_classification_match(self, child_port_segmentation):
     params = {'reg6': child_port_segmentation.parent.unique_key}
     segmentation_type = child_port_segmentation.segmentation_type
     if n_const.TYPE_VLAN == segmentation_type:
         params.update(
             self._get_classification_params_vlan(child_port_segmentation),
         )
     else:
         raise exceptions.UnsupportedSegmentationType(
                 segmentation_type=segmentation_type)
     return self.parser.OFPMatch(**params)
Пример #3
0
 def _get_dispatch_actions(self, child_port_segmentation):
     actions = []
     segmentation_type = child_port_segmentation.segmentation_type
     if n_const.TYPE_VLAN == segmentation_type:
         self._add_dispatch_actions_vlan(actions, child_port_segmentation)
     else:
         raise exceptions.UnsupportedSegmentationType(
             segmentation_type=segmentation_type)
     ofport = self._get_ofport(child_port_segmentation)
     actions.append(
         self.parser.OFPActionOutput(ofport, self.ofproto.OFPCML_NO_BUFFER))
     return actions
Пример #4
0
    def _get_dispatch_actions(self, child_port_segmentation):
        actions = []
        segmentation_type = child_port_segmentation.segmentation_type
        if n_const.TYPE_VLAN == segmentation_type:
            self._add_dispatch_actions_vlan(actions, child_port_segmentation)
        else:
            raise exceptions.UnsupportedSegmentationType(
                segmentation_type=segmentation_type
            )

        parent_port_key = child_port_segmentation.parent.unique_key

        actions += [
            self.parser.OFPActionSetField(reg7=parent_port_key),
            self.parser.NXActionResubmit(),
        ]
        return actions
Пример #5
0
 def _get_classification_actions(self, child_port_segmentation):
     segmentation_type = child_port_segmentation.segmentation_type
     lport = child_port_segmentation.port.get_object()
     if not lport:
         lport = self.nb_api.get(child_port_segmentation.port)
     network_id = lport.lswitch.unique_key
     unique_key = lport.unique_key
     # TODO(oanson) This code is very similar to classifier app.
     actions = [
         self.parser.OFPActionSetField(reg6=unique_key),
         self.parser.OFPActionSetField(metadata=network_id),
     ]
     if n_const.TYPE_VLAN == segmentation_type:
         self._add_classification_actions_vlan(actions,
                                               child_port_segmentation)
     else:
         raise exceptions.UnsupportedSegmentationType(
             segmentation_type=segmentation_type)
     return actions