Exemplo 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
Exemplo 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
Exemplo 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
Exemplo 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
Exemplo 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)
Exemplo n.º 6
0
 def get_port_binding(self, port_id):
     """get port binding"""
     port_binding = []
     try:
         for bind in ucs_db.get_portbinding(port_id):
             LOG.debug("Getting port binding for port: %s" % bind.port_id)
             port_bind_dict = {}
             port_bind_dict["port-id"] = bind.port_id
             port_bind_dict["blade-intf-dn"] = str(bind.blade_intf_dn)
             port_bind_dict["portprofile-name"] = bind.portprofile_name
             port_bind_dict["vlan-name"] = bind.vlan_name
             port_bind_dict["vlan-id"] = str(bind.vlan_id)
             port_bind_dict["qos"] = bind.qos
             port_binding.append(port_bind_dict)
     except Exception, exc:
         LOG.error("Failed to get port binding: %s" % str(exc))
Exemplo n.º 7
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)
Exemplo 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)
Exemplo n.º 9
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)