X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fsol005%2Fclient.py;h=be11dd19a9ec919ed745585c9adad291bdb52d64;hb=14d776b5aa74a5ef8e6bd010255d4ad87a8cbe93;hp=b05dbcc63ddc845117c85896aea4e40718461f91;hpb=d1ccf0e88aeacb065b97a6c5cb82e6de53537b94;p=osm%2Fosmclient.git diff --git a/osmclient/sol005/client.py b/osmclient/sol005/client.py index b05dbcc..be11dd1 100644 --- a/osmclient/sol005/client.py +++ b/osmclient/sol005/client.py @@ -18,7 +18,6 @@ OSM SOL005 client API """ -# from osmclient.v1 import vca from osmclient.sol005 import vnfd from osmclient.sol005 import nsd from osmclient.sol005 import nst @@ -49,7 +48,7 @@ class Client(object): def __init__( self, host=None, - so_port=9999, + so_port=443, user="admin", password="admin", project="admin", @@ -64,17 +63,17 @@ class Client(object): self._auth_endpoint = "/admin/v1/tokens" self._headers = {} self._token = None - if len(host.split(":")) > 1: - # backwards compatible, port provided as part of host - self._host = host.split(":")[0] - self._so_port = host.split(":")[1] + self._url = None + if host.startswith("http://") or host.startswith("https://"): + self._url = host else: - self._host = host - self._so_port = so_port - - self._http_client = http.Http( - "https://{}:{}/osm".format(self._host, self._so_port), **kwargs - ) + host_fields = host.split(":") + if len(host_fields) > 1: + # backwards compatible, port provided as part of host + host = host_fields[0] + so_port = host_fields[1] + self._url = "https://{}:{}/osm".format(host, so_port) + self._http_client = http.Http(self._url, **kwargs) self._headers["Accept"] = "application/json" self._headers["Content-Type"] = "application/yaml" self._http_client.set_http_header(self._headers) @@ -104,7 +103,7 @@ class Client(object): self.utils = utils.Utils(http_client, **kwargs) """ - def get_token(self, pwd_change=None): + def get_token(self, pwd_change=False): self._logger.debug("") if self._token is None: postfields_dict = { @@ -148,12 +147,3 @@ class Client(object): version = resp.split()[2] date = resp.split()[4] return "{} {}".format(version, date) - - def set_default_params(self, **kwargs): - host = kwargs.pop("host", None) - if host is not None: - self._host = host - port = kwargs.pop("port", None) - if port is not None: - self._so_port = port - self._http_client.set_query_admin(**kwargs)