Пример #1
0
 def delete_vifinfo(self, interface_id):
     LOG.debug("delete_vifinfo() called")
     port = dbe.get_plugged_port(interface_id)
     if self._port_attachable(port):
         network = db.network_get(port.network_id)
         self._detach(network.tenant_id, network.uuid, port.uuid)
     ndb.del_vifinfo(interface_id)
Пример #2
0
 def add_vifinfo(self, interface_id, datapath_id, port_no, vlan_id=65535):
     LOG.debug("add_vifinfo() called")
     ndb.add_vifinfo(interface_id, datapath_id, port_no, vlan_id)
     port = dbe.get_plugged_port(interface_id)
     if self._port_attachable(port):
         network = db.network_get(port.network_id)
         self._attach(network.tenant_id, network.uuid, port.uuid,
                      interface_id)
Пример #3
0
    def plug_interface(self, tenant_id, network_id, port_id, interface_id):
        """
        Attaches a remote interface to the specified port on the
        specified Virtual Network.
        """
        LOG.debug("plug_interface() called")
        port = self._get_port(tenant_id, network_id, port_id)

        # Validate attachment
        if port.interface_id:
            raise exc.PortInUse(net_id=network_id,
                                port_id=port_id,
                                att_id=port.interface_id)
        p = dbe.get_plugged_port(interface_id)
        if p:
            raise exc.AlreadyAttached(net_id=network_id,
                                      port_id=port_id,
                                      att_id=interface_id,
                                      att_port_id=p.uuid)

        db.port_set_attachment(port_id, network_id, interface_id)
        if self._port_attachable(port):
            self._attach(tenant_id, network_id, port_id, interface_id)
Пример #4
0
 def test_get_plugged_port(self):
     ret = dbe.get_plugged_port(self.vif_id)
     self.assertTrue(ret.uuid == self.port.uuid)
     ret = dbe.get_plugged_port("vif-none")
     self.assertTrue(ret == None)