def update_port(self, port_dict): """update_port. This call makes the REST request to VSD for (un)provision VLAN/VPort on gateway port where bare metal is connected. """ LOG.debug("update_port with port dict %(port)s", {'port': port_dict}) vport = utils.get_nuage_vport(self.vsdclient, port_dict, False) # gridinv: will be called typically when ironic will # update instance port in tenant network with proper binding # at this point we will have a VM vport existing in VSD which # needs to be cleaned up if vport and vport['type'] == const.VM_VPORT: try: self.vsdclient.delete_nuage_vport( vport['ID']) return None except Exception as e: LOG.error("Failed to delete vport from vsd {vport id: %s}", vport['ID']) raise e else: return vport
def delete_port(self, port_dict): """delete_port. This call makes the REST request to VSD for un provision VLAN/VPort for the gateway port where bare metal is connected. """ port = port_dict['port'] LOG.debug("delete_port with port_id %(port_id)s", {'port_id': port['id']}) vport = utils.get_nuage_vport(self.vsdclient, port_dict, required=False) if not vport: LOG.debug("couldn't find a vport") else: LOG.debug("Deleting vport %(vport)s", {'vport': vport}) self.vsdclient.delete_nuage_gateway_vport_no_usergroup( port['tenant_id'], vport) if vport.get('VLANID'): LOG.debug("Deleting vlan %(vlan)s", {'vlan': vport['VLANID']}) self.vsdclient.delete_gateway_port_vlan(vport['VLANID'])