def delete_port(self, tenant_id, net_id, port_id):
        db.validate_port_ownership(tenant_id, net_id, port_id)
        port = db.port_destroy(port_id, net_id)

        #delete from port_properties
        neuca_db.remove_port_properties(port_id)

        return self._make_port_dict(port)
    def unplug_interface(self, tenant_id, net_id, port_id):
        db.validate_port_ownership(tenant_id, net_id, port_id)
        db.port_set_attachment(port_id, net_id, "")
        db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN)

        #unplug in port_properties
        vm_id = None
        neuca_db.update_port_properties_iface(port_id, vm_id, None)
Example #3
0
 def update_port(self, tenant_id, net_id, port_id, **kwargs):
     """
     Updates the state of a port on the specified Virtual Network.
     """
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     db.port_update(port_id, net_id, **kwargs)
     return self._make_port_dict(port)
Example #4
0
 def update_port(self, tenant_id, net_id, port_id, **kwargs):
     """
     Updates the state of a port on the specified Virtual Network.
     """
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     db.port_update(port_id, net_id, **kwargs)
     return self._make_port_dict(port)
Example #5
0
 def get_port_details(self, tenant_id, net_id, port_id):
     """
     This method allows the user to retrieve a remote interface
     that is attached to this particular port.
     """
     LOG.debug("LinuxBridgePlugin.get_port_details() called")
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     new_port_dict = cutil.make_port_dict(port)
     return new_port_dict
Example #6
0
 def get_port_details(self, tenant_id, net_id, port_id):
     """
     This method allows the user to retrieve a remote interface
     that is attached to this particular port.
     """
     LOG.debug("LinuxBridgePlugin.get_port_details() called")
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     new_port_dict = cutil.make_port_dict(port)
     return new_port_dict
Example #7
0
    def update_port(self, tenant_id, net_id, port_id, **kwargs):
        """
        Updates the attributes of a port on the specified Virtual Network.
        """
        LOG.debug("LinuxBridgePlugin.update_port() called")
        db.validate_port_ownership(tenant_id, net_id, port_id)
        self._validate_port_state(kwargs["state"])
        port = db.port_update(port_id, net_id, **kwargs)

        new_port_dict = cutil.make_port_dict(port)
        return new_port_dict
Example #8
0
    def update_port(self, tenant_id, net_id, port_id, **kwargs):
        """
        Updates the attributes of a port on the specified Virtual Network.
        """
        LOG.debug("LinuxBridgePlugin.update_port() called")
        db.validate_port_ownership(tenant_id, net_id, port_id)
        self._validate_port_state(kwargs["state"])
        port = db.port_update(port_id, net_id, **kwargs)

        new_port_dict = cutil.make_port_dict(port)
        return new_port_dict
Example #9
0
    def get_port(self, tenant_id, network_id, port_id):
        db.validate_port_ownership(tenant_id, network_id, port_id)
        net = self.get_network(tenant_id, network_id)
        try:
            port = db.port_get(port_id, network_id)
        except:
            raise exc.PortNotFound(net_id=network_id, port_id=port_id)

        # Port must exist and belong to the appropriate network.
        if port['network_id'] != net['uuid']:
            raise exc.PortNotFound(net_id=network_id, port_id=port_id)
        return port
Example #10
0
 def unplug_interface(self, tenant_id, net_id, port_id):
     """
     Detaches a remote interface from the specified port on the
     specified Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.unplug_interface() called")
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     attachment_id = port[const.INTERFACEID]
     if attachment_id is None:
         return
     db.port_unset_attachment(port_id, net_id)
     db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN)
Example #11
0
 def unplug_interface(self, tenant_id, net_id, port_id):
     """
     Detaches a remote interface from the specified port on the
     specified Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.unplug_interface() called")
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     attachment_id = port[const.INTERFACEID]
     if attachment_id is None:
         return
     db.port_unset_attachment(port_id, net_id)
     db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN)
Example #12
0
 def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id):
     """
     Attaches a remote interface to the specified port on the
     specified Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.plug_interface() called")
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     attachment_id = port[const.INTERFACEID]
     if attachment_id:
         raise exc.PortInUse(port_id=port_id, net_id=net_id,
                             att_id=attachment_id)
     db.port_set_attachment(port_id, net_id, remote_interface_id)
Example #13
0
 def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id):
     """
     Attaches a remote interface to the specified port on the
     specified Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.plug_interface() called")
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     attachment_id = port[const.INTERFACEID]
     if attachment_id:
         raise exc.PortInUse(port_id=port_id,
                             net_id=net_id,
                             att_id=attachment_id)
     db.port_set_attachment(port_id, net_id, remote_interface_id)
    def plug_interface(self, tenant_id, net_id, port_id, remote_iface_id):
        db.validate_port_ownership(tenant_id, net_id, port_id)
        db.port_set_attachment(port_id, net_id, remote_iface_id)

        iface_properties = remote_iface_id.split('.')

        LOG.debug("PRUTH: len(iface_properties) = %d" % (len(iface_properties)))
        if len(iface_properties) >= 2 and tenant_id == self.config.get("NEUCA", "neuca_tenant_id"):
            #  vm_id.vm_iface 
            vm_id = iface_properties[0]
            vm_mac = iface_properties[1]
            #vm_mac = str(quantum.common.utils.generate_mac())
        else:
            LOG.debug("PRUTH: not enough iface properites or not neuca: len(iface_properties) = %d, %s" % (len(iface_properties),remote_iface_id))
            vm_id = None
            vm_mac = None

        neuca_db.update_port_properties_iface(port_id, vm_id, vm_mac)
Example #15
0
 def delete_port(self, tenant_id, net_id, port_id):
     """
     Deletes a port on a specified Virtual Network,
     if the port contains a remote interface attachment,
     the remote interface is first un-plugged and then the port
     is deleted.
     """
     LOG.debug("LinuxBridgePlugin.delete_port() called")
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     attachment_id = port[const.INTERFACEID]
     if not attachment_id:
         db.port_destroy(port_id, net_id)
         new_port_dict = cutil.make_port_dict(port)
         return new_port_dict
     else:
         raise exc.PortInUse(port_id=port_id, net_id=net_id,
                             att_id=attachment_id)
Example #16
0
 def delete_port(self, tenant_id, net_id, port_id):
     """
     Deletes a port on a specified Virtual Network,
     if the port contains a remote interface attachment,
     the remote interface is first un-plugged and then the port
     is deleted.
     """
     LOG.debug("LinuxBridgePlugin.delete_port() called")
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     attachment_id = port[const.INTERFACEID]
     if not attachment_id:
         db.port_destroy(port_id, net_id)
         new_port_dict = cutil.make_port_dict(port)
         return new_port_dict
     else:
         raise exc.PortInUse(port_id=port_id,
                             net_id=net_id,
                             att_id=attachment_id)
Example #17
0
 def delete_port(self, tenant_id, net_id, port_id):
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_destroy(port_id, net_id)
     return self._make_port_dict(port)
Example #18
0
 def get_interface_details(self, tenant_id, net_id, port_id):
     db.validate_port_ownership(tenant_id, net_id, port_id)
     res = db.port_get(port_id, net_id)
     return res.interface_id
Example #19
0
 def plug_interface(self, tenant_id, net_id, port_id, remote_iface_id):
     db.validate_port_ownership(tenant_id, net_id, port_id)
     db.port_set_attachment(port_id, net_id, remote_iface_id)
Example #20
0
 def unplug_interface(self, tenant_id, net_id, port_id):
     db.validate_port_ownership(tenant_id, net_id, port_id)
     db.port_set_attachment(port_id, net_id, "")
     db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN)
Example #21
0
 def delete_port(self, tenant_id, net_id, port_id):
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_destroy(port_id, net_id)
     return self._make_port_dict(port)
Example #22
0
 def get_port_details(self, tenant_id, net_id, port_id):
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     return self._make_port_dict(port)
Example #23
0
 def plug_interface(self, tenant_id, net_id, port_id, remote_iface_id):
     db.validate_port_ownership(tenant_id, net_id, port_id)
     db.port_set_attachment(port_id, net_id, remote_iface_id)
Example #24
0
 def unplug_interface(self, tenant_id, net_id, port_id):
     db.validate_port_ownership(tenant_id, net_id, port_id)
     db.port_set_attachment(port_id, net_id, "")
     db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN)
Example #25
0
 def get_interface_details(self, tenant_id, net_id, port_id):
     db.validate_port_ownership(tenant_id, net_id, port_id)
     res = db.port_get(port_id, net_id)
     return res.interface_id
Example #26
0
 def get_port_details(self, tenant_id, net_id, port_id):
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     return self._make_port_dict(port)