Example #1
0
    def update_port(self, tenant_id, net_id, port_id, **kwargs):
        """
        Updates the state of a port on the specified Virtual Network.
        """
        LOG.debug("update_port() called\n")
        network = db.network_get(net_id)
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id, kwargs])
        self._validate_port_state(kwargs["state"])
        db.port_update(port_id, net_id, **kwargs)

        new_port_dict = cutil.make_port_dict(port_id, kwargs["state"], net_id, None)
        return new_port_dict
Example #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("get_port_details() called\n")
     network = db.network_get(net_id)
     self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id])
     port = db.port_get(net_id, port_id)
     new_port_dict = cutil.make_port_dict(
         port[const.UUID], port[const.PORTSTATE], port[const.NETWORKID], port[const.INTERFACEID]
     )
     return new_port_dict
Example #3
0
    def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
        """
        Creates a port on the specified Virtual Network.
        """
        LOG.debug("create_port() called\n")

        port = db.port_create(net_id, port_state)
        unique_port_id_string = port[const.UUID]
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_state, unique_port_id_string])
        new_port_dict = cutil.make_port_dict(
            port[const.UUID], port[const.PORTSTATE], port[const.NETWORKID], port[const.INTERFACEID]
        )
        return new_port_dict
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.
        """
        LOG.debug("update_port() called\n")
        network = db.network_get(net_id)
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id,
                                        port_id, kwargs])
        self._validate_port_state(kwargs["state"])
        db.port_update(port_id, net_id, **kwargs)

        new_port_dict = cutil.make_port_dict(port_id, kwargs["state"], net_id,
                                             None)
        return new_port_dict
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("get_port_details() called\n")
     network = db.network_get(net_id)
     self._invoke_device_plugins(self._func_name(), [tenant_id, net_id,
                                                  port_id])
     port = db.port_get(net_id, port_id)
     new_port_dict = cutil.make_port_dict(port[const.UUID],
                                          port[const.PORTSTATE],
                                          port[const.NETWORKID],
                                          port[const.INTERFACEID])
     return new_port_dict
Example #6
0
    def create_port(self, tenant_id, net_id, port_state=None, **kwargs):
        """
        Creates a port on the specified Virtual Network.
        """
        LOG.debug("create_port() called\n")

        port = db.port_create(net_id, port_state)
        unique_port_id_string = port[const.UUID]
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id,
                                                     port_state,
                                                     unique_port_id_string])
        new_port_dict = cutil.make_port_dict(port[const.UUID],
                                             port[const.PORTSTATE],
                                             port[const.NETWORKID],
                                             port[const.INTERFACEID])
        return new_port_dict
Example #7
0
    def get_all_ports(self, tenant_id, net_id):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        """
        LOG.debug("get_all_ports() called\n")
        network = db.network_get(net_id)
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id])
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(
                port[const.UUID], port[const.PORTSTATE], port[const.NETWORKID], port[const.INTERFACEID]
            )
            ports_on_net.append(new_port)

        return ports_on_net
Example #8
0
    def get_all_ports(self, tenant_id, net_id):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        """
        LOG.debug("get_all_ports() called\n")
        network = db.network_get(net_id)
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id])
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port[const.UUID],
                                            port[const.PORTSTATE],
                                            port[const.NETWORKID],
                                            port[const.INTERFACEID])
            ports_on_net.append(new_port)

        return ports_on_net
Example #9
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 should first be un-plugged and
     then the port can be deleted.
     """
     LOG.debug("delete_port() called\n")
     network = db.network_get(net_id)
     port = db.port_get(net_id, port_id)
     attachment_id = port[const.INTERFACEID]
     if not attachment_id:
         self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id])
         db.port_destroy(net_id, port_id)
         new_port_dict = cutil.make_port_dict(port_id, None, None, None)
         return new_port_dict
     else:
         raise exc.PortInUse(port_id=port_id, net_id=net_id, att_id=attachment_id)
Example #10
0
    def get_network_details(self, tenant_id, net_id):
        """
        Gets the details of a particular network
        """
        LOG.debug("get_network_details() called\n")
        network = db.network_get(net_id)
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id])
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(
                port[const.UUID], port[const.PORTSTATE], port[const.NETWORKID], port[const.INTERFACEID]
            )
            ports_on_net.append(new_port)

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

        return new_network
Example #11
0
    def get_network_details(self, tenant_id, net_id, **kwargs):
        """
        Deletes the Virtual Network belonging to a the
        spec
        """
        LOG.debug("UCSVICPlugin:get_network_details() called\n")
        self._set_ucsm(kwargs[const.DEVICE_IP])
        network = db.network_get(net_id)
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(
                port[const.UUID], port[const.PORTSTATE], port[const.NETWORKID], port[const.INTERFACEID]
            )
            ports_on_net.append(new_port)

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

        return new_network
Example #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 should first be un-plugged and
     then the port can be deleted.
     """
     LOG.debug("delete_port() called\n")
     network = db.network_get(net_id)
     port = db.port_get(net_id, port_id)
     attachment_id = port[const.INTERFACEID]
     if not attachment_id:
         self._invoke_device_plugins(self._func_name(), [tenant_id,
                                                         net_id,
                                                         port_id])
         db.port_destroy(net_id, port_id)
         new_port_dict = cutil.make_port_dict(port_id, None, None, None)
         return new_port_dict
     else:
         raise exc.PortInUse(port_id=port_id, net_id=net_id,
                             att_id=attachment_id)
Example #13
0
    def get_network_details(self, tenant_id, net_id):
        """
        Gets the details of a particular network
        """
        LOG.debug("get_network_details() called\n")
        network = db.network_get(net_id)
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id])
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port[const.UUID],
                                            port[const.PORTSTATE],
                                            port[const.NETWORKID],
                                            port[const.INTERFACEID])
            ports_on_net.append(new_port)

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

        return new_network
Example #14
0
    def get_network_details(self, tenant_id, net_id, **kwargs):
        """
        Deletes the Virtual Network belonging to a the
        spec
        """
        LOG.debug("UCSVICPlugin:get_network_details() called\n")
        self._set_ucsm(kwargs[const.DEVICE_IP])
        network = db.network_get(net_id)
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(port[const.UUID],
                                            port[const.PORTSTATE],
                                            port[const.NETWORKID],
                                            port[const.INTERFACEID])
            ports_on_net.append(new_port)

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

        return new_network