def getProviderByNetwork(self, network_id): """ Get the provider urn by specifying network. """ try: return self.networks[network_id] except KeyError: raise error.STPResolutionError( 'Could not resolve a provider for %s' % network_id)
def getProvider(self, nsi_agent_urn): """ Get a provider from a NSI agent identity/urn. """ try: return self.providers[nsi_agent_urn] except KeyError: raise error.STPResolutionError( 'Could not resolve a provider for %s' % nsi_agent_urn)
def getProviderByNetwork(self, network_id): """ Get the provider urn by specifying network. """ for provider, networks in self.provider_networks.items(): if network_id in networks: return provider else: raise error.STPResolutionError( 'Could not resolve a provider for %s' % network_id)
def getProvider(self, network_id): """ Get a provider from a network id """ if network_id.endswith(':nsa'): raise ValueError( 'look like you were trying to a provider via an nsa id') try: return self.providers[network_id] except KeyError: log.msg( 'Cannot provider for network {}, have providers for {}'.format( network_id, ','.join(self.providers.keys())), debug=True, system=LOG_SYSTEM) raise error.STPResolutionError( 'Could not resolve a provider for network %s' % network_id)