Ejemplo n.º 1
0
 def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
     """
     Creates a port on the specified Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.create_port() called")
     port = db.port_create(net_id, port_state,
                             op_status=OperationalStatus.DOWN)
     unique_port_id_string = port[const.UUID]
     new_port_dict = cutil.make_port_dict(port)
     return new_port_dict
Ejemplo n.º 2
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
Ejemplo n.º 3
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")
     network = db.network_get(net_id)
     port = db.port_get(port_id, net_id)
     new_port_dict = cutil.make_port_dict(port)
     return new_port_dict
Ejemplo n.º 4
0
 def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
     """
     Creates a port on the specified Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.create_port() called")
     db.validate_network_ownership(tenant_id, net_id)
     port = db.port_create(net_id, port_state,
                           op_status=OperationalStatus.DOWN)
     new_port_dict = cutil.make_port_dict(port)
     return new_port_dict
Ejemplo n.º 5
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")
        network = db.network_get(net_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
Ejemplo n.º 6
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
Ejemplo n.º 7
0
 def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
     """
     Creates a port on the specified Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.create_port() called")
     db.validate_network_ownership(tenant_id, net_id)
     port = db.port_create(net_id,
                           port_state,
                           op_status=OperationalStatus.DOWN)
     new_port_dict = cutil.make_port_dict(port)
     return new_port_dict
Ejemplo n.º 8
0
    def get_all_ports(self, tenant_id, net_id, **kwargs):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        """
        LOG.debug("LinuxBridgePlugin.get_all_ports() called")
        network = db.network_get(net_id)
        ports_list = db.port_list(net_id)
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port)
            ports_on_net.append(new_port)

        # This plugin does not perform filtering at the moment
        return ports_on_net
Ejemplo n.º 9
0
    def get_all_ports(self, tenant_id, net_id, **kwargs):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        """
        LOG.debug("LinuxBridgePlugin.get_all_ports() called")
        db.validate_network_ownership(tenant_id, net_id)
        ports_list = db.port_list(net_id)
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port)
            ports_on_net.append(new_port)

        # This plugin does not perform filtering at the moment
        return ports_on_net
Ejemplo n.º 10
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")
     network = db.network_get(net_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)
Ejemplo n.º 11
0
    def get_network_details(self, tenant_id, net_id):
        """
        retrieved a list of all the remote vifs that
        are attached to the network
        """
        LOG.debug("LinuxBridgePlugin.get_network_details() called")
        network = db.network_get(net_id)
        ports_list = db.port_list(net_id)
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port)
            ports_on_net.append(new_port)

        new_network = cutil.make_net_dict(network[const.UUID],
                                          network[const.NETWORKNAME],
                                          ports_on_net,
                                          network[const.OPSTATUS])

        return new_network
Ejemplo n.º 12
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)
Ejemplo n.º 13
0
    def get_network_details(self, tenant_id, net_id):
        """
        retrieved a list of all the remote vifs that
        are attached to the network
        """
        LOG.debug("LinuxBridgePlugin.get_network_details() called")
        db.validate_network_ownership(tenant_id, net_id)
        network = db.network_get(net_id)
        ports_list = db.port_list(net_id)
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port)
            ports_on_net.append(new_port)

        new_network = cutil.make_net_dict(network[const.UUID],
                                          network[const.NETWORKNAME],
                                          ports_on_net,
                                          network[const.OPSTATUS])

        return new_network