X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fsol005%2Fclient.py;h=a106c49a11c610d98b097095fc909dc81053d0c0;hb=bc9d075ba034d69b6b4647c06261852aacec407e;hp=b05dbcc63ddc845117c85896aea4e40718461f91;hpb=d1ccf0e88aeacb065b97a6c5cb82e6de53537b94;p=osm%2Fosmclient.git diff --git a/osmclient/sol005/client.py b/osmclient/sol005/client.py index b05dbcc..a106c49 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 = {