X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=lib%2Fosm%2Fosmclient%2Fclientv2.py;h=6307198488acb543f6532f5ba19d9acac79f2099;hb=refs%2Fchanges%2F76%2F7076%2F2;hp=79092b7dd20173562719d8ea6d441d468ea53257;hpb=e19f16b989fbb7ef068d6ddfd222a9d0cd1bacb2;p=osm%2FLW-UI.git diff --git a/lib/osm/osmclient/clientv2.py b/lib/osm/osmclient/clientv2.py index 79092b7..6307198 100644 --- a/lib/osm/osmclient/clientv2.py +++ b/lib/osm/osmclient/clientv2.py @@ -37,7 +37,7 @@ class Client(object): self._user_endpoint = 'admin/v1/users' self._host = os.getenv('OSM_SERVER', "localhost") self._so_port = 9999 - self._base_path = "https://{0}:{1}/osm".format(self._host, self._so_port) + self._base_path = 'https://{0}:{1}/osm'.format(self._host, self._so_port) def auth(self, args): result = {'error': True, 'data': ''} @@ -251,12 +251,14 @@ class Client(object): result['data'] = Util.json_loads_byteified(r.text) return result - def nsd_list(self, token): + def nsd_list(self, token, filter=None): result = {'error': True, 'data': ''} headers = {"Content-Type": "application/yaml", "accept": "application/json", 'Authorization': 'Bearer {}'.format(token['id'])} - - _url = "{0}/nsd/v1/ns_descriptors_content".format(self._base_path) + query_path = '' + if filter: + query_path = '?_admin.type='+filter + _url = "{0}/nsd/v1/ns_descriptors_content{1}".format(self._base_path, query_path) try: r = requests.get(_url, params=None, verify=False, stream=True, headers=headers) except Exception as e: @@ -269,12 +271,14 @@ class Client(object): return result - def vnfd_list(self, token): + def vnfd_list(self, token, filter=None): result = {'error': True, 'data': ''} headers = {"Content-Type": "application/yaml", "accept": "application/json", 'Authorization': 'Bearer {}'.format(token['id'])} - - _url = "{0}/vnfpkgm/v1/vnf_packages_content".format(self._base_path) + query_path = '' + if filter: + query_path = '?_admin.type='+filter + _url = "{0}/vnfpkgm/v1/vnf_packages_content{1}".format(self._base_path, query_path) try: r = requests.get(_url, params=None, verify=False, stream=True, headers=headers) except Exception as e: