Ejemplo n.º 1
0
 def get_port_details(self, tenant_id, net_id, port_id, **kwargs):
     """
     This method allows the user to retrieve a remote interface
     that is attached to this particular port.
     """
     LOG.debug("UCSVICPlugin:get_port_details() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     port_binding = udb.get_portbinding(port_id)
     return port_binding
Ejemplo n.º 2
0
 def get_port_details(self, tenant_id, net_id, port_id, **kwargs):
     """
     This method allows the user to retrieve a remote interface
     that is attached to this particular port.
     """
     LOG.debug("UCSVICPlugin:get_port_details() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     port_binding = udb.get_portbinding(port_id)
     return port_binding
Ejemplo n.º 3
0
    def get_all_ports(self, tenant_id, net_id, **kwargs):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        """
        LOG.debug("UCSVICPlugin:get_all_ports() 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:
            port_binding = udb.get_portbinding(port[const.UUID])
            ports_on_net.append(port_binding)

        return ports_on_net
Ejemplo n.º 4
0
    def get_all_ports(self, tenant_id, net_id, **kwargs):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        """
        LOG.debug("UCSVICPlugin:get_all_ports() 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:
            port_binding = udb.get_portbinding(port[const.UUID])
            ports_on_net.append(port_binding)

        return ports_on_net
Ejemplo n.º 5
0
 def unplug_interface(self, tenant_id, net_id, port_id, **kwargs):
     """
     Detaches a remote interface from the specified port on the
     specified Virtual Network.
     """
     LOG.debug("UCSVICPlugin:unplug_interface() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     port_binding = udb.get_portbinding(port_id)
     profile_name = port_binding[const.PORTPROFILENAME]
     old_vlan_name = port_binding[const.VLANNAME]
     new_vlan_name = conf.DEFAULT_VLAN_NAME
     self._driver.change_vlan_in_profile(profile_name, old_vlan_name,
                                         new_vlan_name, self._ucsm_ip,
                                         self._ucsm_username,
                                         self._ucsm_password)
     return udb.update_portbinding(port_id, vlan_name=new_vlan_name,
                                   vlan_id=conf.DEFAULT_VLAN_ID)
Ejemplo n.º 6
0
 def unplug_interface(self, tenant_id, net_id, port_id, **kwargs):
     """
     Detaches a remote interface from the specified port on the
     specified Virtual Network.
     """
     LOG.debug("UCSVICPlugin:unplug_interface() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     port_binding = udb.get_portbinding(port_id)
     profile_name = port_binding[const.PORTPROFILENAME]
     old_vlan_name = port_binding[const.VLANNAME]
     new_vlan_name = conf.DEFAULT_VLAN_NAME
     self._driver.change_vlan_in_profile(profile_name, old_vlan_name,
                                         new_vlan_name, self._ucsm_ip,
                                         self._ucsm_username,
                                         self._ucsm_password)
     return udb.update_portbinding(port_id,
                                   vlan_name=new_vlan_name,
                                   vlan_id=conf.DEFAULT_VLAN_ID)
Ejemplo n.º 7
0
 def delete_port(self, tenant_id, net_id, port_id, **kwargs):
     """
     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("UCSVICPlugin:delete_port() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     ucs_inventory = kwargs[const.UCS_INVENTORY]
     chassis_id = kwargs[const.CHASSIS_ID]
     blade_id = kwargs[const.BLADE_ID]
     interface_dn = kwargs[const.BLADE_INTF_DN]
     port_binding = udb.get_portbinding(port_id)
     profile_name = port_binding[const.PORTPROFILENAME]
     self._delete_port_profile(port_id, profile_name)
     ucs_inventory.unreserve_blade_interface(self._ucsm_ip, chassis_id,
                                             blade_id, interface_dn)
     return udb.remove_portbinding(port_id)
Ejemplo n.º 8
0
 def delete_port(self, tenant_id, net_id, port_id, **kwargs):
     """
     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("UCSVICPlugin:delete_port() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     ucs_inventory = kwargs[const.UCS_INVENTORY]
     chassis_id = kwargs[const.CHASSIS_ID]
     blade_id = kwargs[const.BLADE_ID]
     interface_dn = kwargs[const.BLADE_INTF_DN]
     port_binding = udb.get_portbinding(port_id)
     profile_name = port_binding[const.PORTPROFILENAME]
     self._delete_port_profile(port_id, profile_name)
     ucs_inventory.unreserve_blade_interface(self._ucsm_ip, chassis_id,
                                             blade_id, interface_dn)
     return udb.remove_portbinding(port_id)
Ejemplo n.º 9
0
 def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id,
                    **kwargs):
     """
     Attaches a remote interface to the specified port on the
     specified Virtual Network.
     """
     LOG.debug(_("UCSVICPlugin:plug_interface() called"))
     self._set_ucsm(kwargs[const.DEVICE_IP])
     port_binding = udb.get_portbinding(port_id)
     profile_name = port_binding[const.PORTPROFILENAME]
     old_vlan_name = port_binding[const.VLANNAME]
     new_vlan_name = self._get_vlan_name_for_network(tenant_id, net_id)
     new_vlan_id = self._get_vlan_id_for_network(tenant_id, net_id)
     self._driver.change_vlan_in_profile(profile_name, old_vlan_name,
                                         new_vlan_name, self._ucsm_ip,
                                         self._ucsm_username,
                                         self._ucsm_password)
     return udb.update_portbinding(port_id, vlan_name=new_vlan_name,
                                   vlan_id=new_vlan_id)