Beispiel #1
0
    def _child_port_segmentation_deleted(self, child_port_segmentation):
        parent_port = child_port_segmentation.parent
        parent_binding = port_locator.get_port_binding(parent_port)
        if parent_binding is None:
            return

        if parent_binding.is_local:
            self._uninstall_local_cps(child_port_segmentation)
        else:
            self._uninstall_remote_cps(child_port_segmentation)
Beispiel #2
0
    def _child_port_segmentation_created(self, child_port_segmentation):
        parent_port = child_port_segmentation.parent
        parent_binding = port_locator.get_port_binding(parent_port)
        if parent_binding is None:
            LOG.error('Could not find parent binding for CPS: %s',
                      child_port_segmentation)
            return

        if parent_binding.is_local:
            self._install_local_cps(child_port_segmentation)
        else:
            self._install_remote_cps(child_port_segmentation)
Beispiel #3
0
 def _make_bum_flow_actions(self, network_id, segmentation_id):
     remote_ports = self.local_networks.get_remote_ports(
             network_id=network_id)
     actions = []
     peer_ip_list = set()
     for port_id in remote_ports:
         lport = self.db_store.get_one(l2.LogicalPort(id=port_id))
         if not lport:
             continue
         binding = port_locator.get_port_binding(lport)
         peer_ip = binding.ip
         if peer_ip in peer_ip_list:
             continue
         peer_ip_list.add(peer_ip)
         port_num = self._get_lport_tunnel_ofport(lport)
         ofpact_set_field = self.parser.OFPActionSetField
         actions += [
                 ofpact_set_field(tun_ipv4_dst=peer_ip),
                 ofpact_set_field(tunnel_id_nxm=segmentation_id),
                 self.parser.OFPActionOutput(port=port_num)]
     return actions
Beispiel #4
0
    def _add_egress_dispatch_flow(self, lport, segmentation_id):
        binding = port_locator.get_port_binding(lport)
        remote_ip = binding.ip
        port_num = self._get_lport_tunnel_ofport(lport)
        LOG.debug("set egress dispatch flow %(seg)s peer %(remote_ip)s",
                  {'seg': segmentation_id,
                   'remote_ip': remote_ip})

        match = self.parser.OFPMatch(reg7=lport.unique_key)
        actions = [
                self.parser.OFPActionSetField(tun_ipv4_dst=remote_ip),
                self.parser.OFPActionSetField(tunnel_id_nxm=segmentation_id),
                self.parser.OFPActionOutput(port=port_num)]
        ofproto = self.ofproto
        action_inst = self.parser.OFPInstructionActions(
            ofproto.OFPIT_APPLY_ACTIONS, actions)
        inst = [action_inst]
        self.mod_flow(
            inst=inst,
            table_id=const.EGRESS_TABLE,
            priority=const.PRIORITY_MEDIUM,
            match=match)