X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fsol005%2Fclient.py;h=b8627b94bf315e819944a632178ddc73bb33d8b5;hb=f157128052e59df5c37489926f7d5755714c3cbf;hp=ac35d2f07e39b9ff7533e68814802a49e4009bb9;hpb=017c4fb032ab1f63e1ce474e12787204f33fce96;p=osm%2Fosmclient.git diff --git a/osmclient/sol005/client.py b/osmclient/sol005/client.py index ac35d2f..b8627b9 100644 --- a/osmclient/sol005/client.py +++ b/osmclient/sol005/client.py @@ -19,8 +19,6 @@ OSM SOL005 client API """ #from osmclient.v1 import vnf -#from osmclient.v1 import ns -#from osmclient.v1 import vim #from osmclient.v1 import vca from osmclient.sol005 import vnfd from osmclient.sol005 import nsd @@ -28,7 +26,9 @@ from osmclient.sol005 import ns from osmclient.sol005 import vim from osmclient.sol005 import package from osmclient.sol005 import http +from osmclient.sol005 import sdncontroller from osmclient.common.exceptions import ClientException +import json class Client(object): @@ -84,6 +84,7 @@ class Client(object): self.package = package.Package(self._http_client, client=self) self.ns = ns.Ns(self._http_client, client=self) self.vim = vim.Vim(self._http_client, client=self) + self.sdnc = sdncontroller.SdnController(self._http_client, client=self) ''' self.vnf = vnf.Vnf(http_client, client=self, **kwargs) self.vca = vca.Vca(http_client, client=self, **kwargs) @@ -94,8 +95,11 @@ class Client(object): postfields_dict = {'username': self._user, 'password': self._password, 'project-id': self._project} - token = self._http_client.post_cmd(endpoint=self._auth_endpoint, + http_code, resp = self._http_client.post_cmd(endpoint=self._auth_endpoint, postfields_dict=postfields_dict) + if http_code not in (200, 201, 202, 204): + raise ClientException(resp) + token = json.loads(resp) if resp else None if token is not None: return token['_id'] return None