def lsn_port_dhcp_setup(self, context, network_id, port_id, port_data, subnet_config=None): """Connect network to LSN via specified port and port_data.""" try: lsn_id = None lswitch_port_id = nsxlib.get_port_by_neutron_tag( self.cluster, network_id, port_id)['uuid'] lsn_id = self.lsn_get(context, network_id) lsn_port_id = self.lsn_port_create(context, lsn_id, port_data) except (n_exc.NotFound, p_exc.NvpPluginException): raise p_exc.PortConfigurationError(net_id=network_id, lsn_id=lsn_id, port_id=port_id) else: try: lsn_api.lsn_port_plug_network(self.cluster, lsn_id, lsn_port_id, lswitch_port_id) except p_exc.LsnConfigurationConflict: self.lsn_port_delete(context, lsn_id, lsn_port_id) raise p_exc.PortConfigurationError(net_id=network_id, lsn_id=lsn_id, port_id=port_id) if subnet_config: self.lsn_port_dhcp_configure(context, lsn_id, lsn_port_id, subnet_config) else: return (lsn_id, lsn_port_id)
def lsn_port_dhcp_setup( self, context, network_id, port_id, port_data, subnet_config=None): """Connect network to LSN via specified port and port_data.""" try: lsn_id = None lswitch_port_id = nsxlib.get_port_by_neutron_tag( self.cluster, network_id, port_id)['uuid'] lsn_id = self.lsn_get(context, network_id) lsn_port_id = self.lsn_port_create(context, lsn_id, port_data) except (n_exc.NotFound, p_exc.NvpPluginException): raise p_exc.PortConfigurationError( net_id=network_id, lsn_id=lsn_id, port_id=port_id) else: try: lsn_api.lsn_port_plug_network( self.cluster, lsn_id, lsn_port_id, lswitch_port_id) except p_exc.LsnConfigurationConflict: self.lsn_port_delete(context, lsn_id, lsn_port_id) raise p_exc.PortConfigurationError( net_id=network_id, lsn_id=lsn_id, port_id=port_id) if subnet_config: self.lsn_port_dhcp_configure( context, lsn_id, lsn_port_id, subnet_config) else: return (lsn_id, lsn_port_id)
def lsn_port_dispose(self, context, network_id, mac_address): """Delete a LSN port given the network and the mac address.""" # NOTE(armando-migliaccio): dispose and delete are functionally # equivalent, but they use different paraments to identify LSN # and LSN port resources. lsn_id, lsn_port_id = self.lsn_port_get_by_mac( context, network_id, mac_address, raise_on_err=False) if lsn_port_id: self.lsn_port_delete(context, lsn_id, lsn_port_id) if mac_address == METADATA_MAC: try: lswitch_port = nvplib.get_port_by_neutron_tag( self.cluster, network_id, METADATA_PORT_ID) if lswitch_port: lswitch_port_id = lswitch_port['uuid'] nvplib.delete_port( self.cluster, network_id, lswitch_port_id) else: LOG.warn(_("Metadata port not found while attempting " "to delete it from network %s"), network_id) except (n_exc.PortNotFoundOnNetwork, nvplib.NvpApiClient.NvpApiException): LOG.warn(_("Metadata port not found while attempting " "to delete it from network %s"), network_id) else: LOG.warn(_("Unable to find Logical Services Node " "Port with MAC %s"), mac_address)
def lsn_port_dispose(self, context, network_id, mac_address): """Delete a LSN port given the network and the mac address.""" lsn_id, lsn_port_id = self.lsn_port_get_by_mac( context, network_id, mac_address, raise_on_err=False) if lsn_port_id: self.lsn_port_delete(context, lsn_id, lsn_port_id) if mac_address == const.METADATA_MAC: try: lswitch_port_id = nsxlib.get_port_by_neutron_tag( self.cluster, network_id, const.METADATA_PORT_ID)['uuid'] nsxlib.delete_port( self.cluster, network_id, lswitch_port_id) except (n_exc.PortNotFoundOnNetwork, nsxlib.NvpApiClient.NvpApiException): LOG.warn(_("Metadata port not found while attempting " "to delete it from network %s"), network_id) else: LOG.warn(_("Unable to find Logical Services Node " "Port with MAC %s"), mac_address)
def lsn_port_dispose(self, context, network_id, mac_address): """Delete a LSN port given the network and the mac address.""" lsn_id, lsn_port_id = self.lsn_port_get_by_mac(context, network_id, mac_address, raise_on_err=False) if lsn_port_id: self.lsn_port_delete(context, lsn_id, lsn_port_id) if mac_address == const.METADATA_MAC: try: lswitch_port_id = nsxlib.get_port_by_neutron_tag( self.cluster, network_id, const.METADATA_PORT_ID)['uuid'] nsxlib.delete_port(self.cluster, network_id, lswitch_port_id) except (n_exc.PortNotFoundOnNetwork, nsxlib.NvpApiClient.NvpApiException): LOG.warn( _("Metadata port not found while attempting " "to delete it from network %s"), network_id) else: LOG.warn( _("Unable to find Logical Services Node " "Port with MAC %s"), mac_address)