X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fsol005%2Fnsi.py;h=0fcfe1d979288b65440f34e15d5c72e68cb37783;hb=a2999a460707408e636d81fe8e735a7625def0d4;hp=cf88114a227a54d832eb78e6c3af3b72f1bc58ff;hpb=dd006fac5cefcff43d83bdd0ab1660d2bf2ef891;p=osm%2Fosmclient.git diff --git a/osmclient/sol005/nsi.py b/osmclient/sol005/nsi.py index cf88114..0fcfe1d 100644 --- a/osmclient/sol005/nsi.py +++ b/osmclient/sol005/nsi.py @@ -39,6 +39,7 @@ class Nsi(object): # NSI '--wait' option def _wait(self, id, deleteFlag=False): + self._client.get_token() # Endpoint to get operation status apiUrlStatus = '{}{}{}'.format(self._apiName, self._apiVersion, '/nsi_lcm_op_occs') # Wait for status for NSI instance creation/update/deletion @@ -53,6 +54,7 @@ class Nsi(object): def list(self, filter=None): """Returns a list of NSI """ + self._client.get_token() filter_string = '' if filter: filter_string = '?{}'.format(filter) @@ -64,6 +66,7 @@ class Nsi(object): def get(self, name): """Returns an NSI based on name or id """ + self._client.get_token() if utils.validate_uuid4(name): for nsi in self.list(): if name == nsi['_id']: @@ -76,6 +79,7 @@ class Nsi(object): def get_individual(self, name): nsi_id = name + self._client.get_token() if not utils.validate_uuid4(name): for nsi in self.list(): if name == nsi['name']: @@ -120,6 +124,7 @@ class Nsi(object): ssh_keys=None, description='default description', admin_status='ENABLED', wait=False): + self._client.get_token() nst = self._client.nst.get(nst_name) vim_account_id = {} @@ -235,7 +240,7 @@ class Nsi(object): message="failed to create nsi: {} nst: {}\nerror:\n{}".format( nsi_name, nst_name, - exc.message) + str(exc)) raise ClientException(message) def list_op(self, name, filter=None): @@ -272,12 +277,13 @@ class Nsi(object): except ClientException as exc: message="failed to get operation list of NSI {}:\nerror:\n{}".format( name, - exc.message) + str(exc)) raise ClientException(message) def get_op(self, operationId): """Returns the status of an operation """ + self._client.get_token() try: self._apiResource = '/nsi_lcm_op_occs' self._apiBase = '{}{}{}'.format(self._apiName, @@ -303,7 +309,7 @@ class Nsi(object): except ClientException as exc: message="failed to get status of operation {}:\nerror:\n{}".format( operationId, - exc.message) + str(exc)) raise ClientException(message) def exec_op(self, name, op_name, op_data=None): @@ -338,6 +344,6 @@ class Nsi(object): except ClientException as exc: message="failed to exec operation {}:\nerror:\n{}".format( name, - exc.message) + str(exc)) raise ClientException(message)