Fix bug #677 osm nsi-op-list name' and 'osm nsi-op-show id' returns null
[osm/LW-UI.git] / lib / osm / osmclient / clientv2.py
index 79092b7..95b4b97 100644 (file)
@@ -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': ''}
@@ -49,7 +49,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
 
         result['data'] = Util.json_loads_byteified(r.text)
@@ -66,13 +66,104 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
 
         result['data'] = Util.json_loads_byteified(r.text)
 
         return result
 
+    def role_list(self, token):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/json", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+
+        _url = "{0}/admin/v1/roles".format(self._base_path)
+        try:
+            r = requests.get(_url, params=None, verify=False, stream=True, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+
+        return result
+
+    def role_create(self, token, role_data):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/json", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/admin/v1/roles".format(self._base_path)
+
+        try:
+            r = requests.post(_url, json=role_data, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
+    def role_update(self, token, role_id, role_data):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/json", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/admin/v1/roles/{1}".format(self._base_path, role_id)
+        
+        try:
+            r = requests.patch(_url, json=role_data, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        else:
+            result['data'] = Util.json_loads_byteified(r.text)
+        return result
+    
+    def role_delete(self, token, id, force=None):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/json", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        query_path = ''
+        if force:
+            query_path = '?FORCE=true'
+        _url = "{0}/admin/v1/roles/{1}{2}".format(self._base_path, id, query_path)
+        try:
+            r = requests.delete(_url, params=None, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        else:
+            result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
+    def role_get(self, token, id):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/json", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        
+        _url = "{0}/admin/v1/roles/{1}".format(self._base_path, id)
+        try:
+            r = requests.delete(_url, params=None, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        else:
+            result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
     def user_list(self, token):
         result = {'error': True, 'data': ''}
         headers = {"Content-Type": "application/json", "accept": "application/json",
@@ -85,7 +176,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
 
@@ -104,7 +195,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.created:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -121,7 +212,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.no_content:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         else:
             result['data'] = Util.json_loads_byteified(r.text)
@@ -139,7 +230,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.no_content:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         else:
             result['data'] = Util.json_loads_byteified(r.text)
@@ -156,7 +247,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -173,7 +264,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
 
@@ -190,7 +281,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -209,7 +300,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.created:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -228,9 +319,8 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.no_content:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
-        result['data'] = Util.json_loads_byteified(r.text)
         return result
 
     def project_delete(self, token, id):
@@ -245,48 +335,121 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.no_content:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         else:
             result['data'] = Util.json_loads_byteified(r.text)
         return result
 
-    def nsd_list(self, token):
+    def nst_details(self, token, id):
         result = {'error': True, 'data': ''}
-        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+        headers = {"Content-Type": "application/json", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/nst/v1/netslice_templates/{1}".format(self._base_path,id)
+        try:
+            r = requests.get(_url, params=None, verify=False, stream=True, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+
+        return result
+
+    def nst_content(self, token, id):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/json", "accept": "text/plain",
                    'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/nst/v1/netslice_templates/{1}/nst".format(self._base_path,id)
+        try:
+            r = requests.get(_url, params=None, verify=False, stream=True, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data']  = Util.json2yaml(yaml.load(str(r.text)))
 
-        _url = "{0}/nsd/v1/ns_descriptors_content".format(self._base_path)
+        return result
+
+    def nst_list(self, token):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        
+        _url = "{0}/nst/v1/netslice_templates".format(self._base_path)
         try:
             r = requests.get(_url, params=None, verify=False, stream=True, headers=headers)
         except Exception as e:
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
 
         return result
 
-    def vnfd_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'])}
+        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:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
 
-        _url = "{0}/vnfpkgm/v1/vnf_packages_content".format(self._base_path)
+        return result
+
+    def vnfd_list(self, token, filter=None):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        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:
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
 
         return result
 
+    def nsi_list(self, token):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/nsilcm/v1/netslice_instances".format(self._base_path)
+        try:
+            r = requests.get(_url, params=None, verify=False, stream=True, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+
+        return result
+    
     def ns_list(self, token):
         result = {'error': True, 'data': ''}
         headers = {"Content-Type": "application/yaml", "accept": "application/json",
@@ -298,7 +461,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
 
@@ -315,12 +478,46 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+
+        return result
+
+    def pdu_list(self, token):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/pdu/v1/pdu_descriptors".format(self._base_path)
+        try:
+            r = requests.get(_url, params=None, verify=False, stream=True, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
 
         return result
 
+    def nst_delete(self, token, id):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+
+        _url = "{0}/nst/v1/netslice_templates/{1}?FORCE=True".format(self._base_path, id)
+        try:
+            r = requests.delete(_url, params=None, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        
+        return result
+
     def nsd_delete(self, token, id):
         result = {'error': True, 'data': ''}
         headers = {"Content-Type": "application/yaml", "accept": "application/json",
@@ -333,9 +530,10 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r:
             result['error'] = False
-        result['data'] = Util.json_loads_byteified(r.text)
+        if r.status_code != requests.codes.no_content:
+            result['data'] = Util.json_loads_byteified(r.text)
         return result
 
     def vnfd_delete(self, token, id):
@@ -356,6 +554,27 @@ class Client(object):
             result['data'] = Util.json_loads_byteified(r.text)
         return result
 
+    def nst_onboard(self, token, template):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/gzip", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/nst/v1/netslice_templates_content".format(self._base_path)
+        try:
+            fileName, fileExtension = os.path.splitext(template.name)
+            if fileExtension == '.gz':
+                headers["Content-Type"] = "application/gzip"
+            else:
+                headers["Content-Type"] = "application/yaml"
+            r = requests.post(_url, data=template, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
     def nsd_onboard(self, token, package):
         result = {'error': True, 'data': ''}
         headers = {"Content-Type": "application/gzip", "accept": "application/json",
@@ -371,7 +590,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.created:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -391,7 +610,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.created:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -411,7 +630,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.created:
+        if r.status_code in (200, 201, 202, 204):
             result['data'] = r.json()
             result['error'] = False
         if r.status_code == requests.codes.conflict:
@@ -432,7 +651,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.created:
+        if r.status_code in (200, 201, 202, 204):
             result['data'] = r.json()
             result['error'] = False
         if r.status_code == requests.codes.conflict:
@@ -459,7 +678,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.created:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         if r.status_code == requests.codes.conflict:
             result['data'] = "Invalid ID."
@@ -487,13 +706,28 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.created:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         if r.status_code == requests.codes.conflict:
             result['data'] = "Invalid ID."
 
         return result
 
+    def nst_content_update(self, token, id, template):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/nst/v1/netslice_templates/{1}/nst_content".format(self._base_path,id)
+        try:
+            r = requests.put(_url, data=template, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        return result
+
     def nsd_update(self, token, id, data):
         result = {'error': True, 'data': ''}
         headers = {"Content-Type": "application/gzip", "accept": "application/json",
@@ -515,7 +749,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.no_content:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         else:
             try:
@@ -546,7 +780,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.no_content:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         else:
             try:
@@ -568,7 +802,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
             tarf = StringIO.StringIO(r.content)
             return tarf
@@ -585,7 +819,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
             tarf = StringIO.StringIO(r.content)
             return tarf
@@ -707,7 +941,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
             return yaml.load(r.text)
         else:
@@ -728,7 +962,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
             return yaml.load(r.text)
         else:
@@ -749,7 +983,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
             result['data'] = r.text
         else:
@@ -771,7 +1005,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
             result['data'] = r.text
         else:
@@ -782,6 +1016,24 @@ class Client(object):
 
         return result
 
+    def nsi_create(self, token, nsi_data):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+
+        _url = "{0}/nsilcm/v1/netslice_instances_content".format(self._base_path)
+
+        try:
+            r = requests.post(_url, json=nsi_data, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
     def ns_create(self, token, ns_data):
         result = {'error': True, 'data': ''}
         headers = {"Content-Type": "application/yaml", "accept": "application/json",
@@ -795,7 +1047,25 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
+    def pdu_create(self, token, pdu_data):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+
+        _url = "{0}/pdu/v1/pdu_descriptors".format(self._base_path)
+
+        try:
+            r = requests.post(_url, json=pdu_data, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -812,7 +1082,25 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+
+        return result
+
+    def nsi_op_list(self, token, id):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/json", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/nsilcm/v1/nsi_lcm_op_occs/?netsliceInstanceId={1}".format(self._base_path, id)
+
+        try:
+            r = requests.get(_url, params=None, verify=False, stream=True, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
 
@@ -830,7 +1118,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
 
@@ -849,11 +1137,31 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.created:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
 
+    def nsi_delete(self, token, id, force=None):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        query_path = ''
+        if force:
+            query_path = '?FORCE=true'
+        _url = "{0}/nsilcm/v1/netslice_instances_content/{1}{2}".format(self._base_path, id, query_path)
+        try:
+            r = requests.delete(_url, params=None, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r:
+            result['error'] = False
+        if r.status_code != requests.codes.no_content:
+            result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
     def ns_delete(self, token, id, force=None):
         result = {'error': True, 'data': ''}
         headers = {"Content-Type": "application/yaml", "accept": "application/json",
@@ -874,6 +1182,40 @@ class Client(object):
             result['data'] = Util.json_loads_byteified(r.text)
         return result
 
+    def pdu_delete(self, token, id):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/pdu/v1/pdu_descriptors/{1}".format(self._base_path, id)
+        try:
+            r = requests.delete(_url, params=None, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r:
+            result['error'] = False
+        if r.status_code != requests.codes.no_content:
+            result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
+    def nsi_get(self, token, id):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/json", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/nsilcm/v1/netslice_instances/{1}".format(self._base_path, id)
+
+        try:
+            r = requests.get(_url, params=None, verify=False, stream=True, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
     def ns_get(self, token, id):
         result = {'error': True, 'data': ''}
         headers = {"Content-Type": "application/json", "accept": "application/json",
@@ -886,7 +1228,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -903,7 +1245,24 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
+    def pdu_get(self, token, id):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/json", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/pdu/v1/pdu_descriptors/{1}".format(self._base_path, id)
+
+        try:
+            r = requests.get(_url, params=None, verify=False, stream=True, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -919,7 +1278,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         # result['data'] = Util.json_loads_byteified(r.text)
         result['data'] = r.text
@@ -936,12 +1295,29 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         # result['data'] = Util.json_loads_byteified(r.text)
         result['data'] = r.text
         return result
 
+    def wim_list(self, token):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/admin/v1/wim_accounts".format(self._base_path)
+        try:
+            r = requests.get(_url, params=None, verify=False, stream=True, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+
+        return result
+
     def vim_list(self, token):
         result = {'error': True, 'data': ''}
         headers = {"Content-Type": "application/yaml", "accept": "application/json",
@@ -953,12 +1329,29 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
 
         return result
 
+    def wim_delete(self, token, id):
+        result = {'error': True, 'data': ''}
+        headers = {"accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/admin/v1/wim_accounts/{1}".format(self._base_path, id)
+        try:
+            r = requests.delete(_url, params=None, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        else:
+            result['data'] = r.text
+        return result
+
     def vim_delete(self, token, id):
         result = {'error': True, 'data': ''}
         headers = {"accept": "application/json",
@@ -970,12 +1363,30 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.accepted:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         else:
             result['data'] = r.text
         return result
 
+    def wim_get(self, token, id):
+
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/json", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/admin/v1/wim_accounts/{1}".format(self._base_path, id)
+
+        try:
+            r = requests.get(_url, params=None, verify=False, stream=True, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
     def vim_get(self, token, id):
 
         result = {'error': True, 'data': ''}
@@ -989,7 +1400,25 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
+    def wim_create(self, token, wim_data):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/json", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+
+        _url = "{0}/admin/v1/wim_accounts".format(self._base_path)
+
+        try:
+            r = requests.post(_url, json=wim_data, verify=False, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -1008,7 +1437,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.created:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -1024,7 +1453,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -1040,7 +1469,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.accepted:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         else:
             result['data'] = r.text
@@ -1058,7 +1487,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.ok:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result
@@ -1076,7 +1505,7 @@ class Client(object):
             log.exception(e)
             result['data'] = str(e)
             return result
-        if r.status_code == requests.codes.created:
+        if r.status_code in (200, 201, 202, 204):
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
         return result