fix sol005 client so that delete_cmd output is processed in the caller function
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 16 May 2018 13:29:46 +0000 (15:29 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 16 May 2018 13:29:46 +0000 (15:29 +0200)
Change-Id: I0311de2bfafd86bf26ac79f762d76cec9e7a065e
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/sol005/http.py
osmclient/sol005/ns.py
osmclient/sol005/nsd.py
osmclient/sol005/sdncontroller.py
osmclient/sol005/vim.py
osmclient/sol005/vnfd.py

index 8e80ba9..5311ca8 100644 (file)
@@ -50,7 +50,7 @@ class Http(http.Http):
         curl_cmd.close()
         # TODO 202 accepted should be returned somehow
         if data.getvalue():
-            return http_code, json.loads(data.getvalue().decode())
+            return http_code, data.getvalue().decode()
         else:
             return http_code, None
 
index 30bbe02..ebb779c 100644 (file)
@@ -77,6 +77,8 @@ class Ns(object):
     def delete(self, name):
         ns = self.get(name)
         http_code, resp = self._http.delete_cmd('{}/{}'.format(self._apiBase,ns['_id']))
+        if resp:
+            resp = json.loads(resp)
         #print 'RESP: {}'.format(resp)
         if http_code == 202:
             print 'Deletion in progress'
index 4ae755b..055d2e5 100644 (file)
@@ -93,6 +93,8 @@ class Nsd(object):
     def delete(self, name):
         nsd = self.get(name)
         http_code, resp = self._http.delete_cmd('{}/{}'.format(self._apiBase, nsd['_id']))
+        if resp:
+            resp = json.loads(resp)
         #print 'RESP: {}'.format(resp)
         if http_code == 202:
             print 'Deletion in progress'
index 0639559..7833fbd 100644 (file)
@@ -62,6 +62,8 @@ class SdnController(object):
     def delete(self, name):
         sdn_controller = self.get(name)
         http_code, resp = self._http.delete_cmd('{}/{}'.format(self._apiBase,sdn_controller['_id']))
+        if resp:
+            resp = json.loads(resp)
         #print 'RESP: {}'.format(resp)
         if http_code == 202:
             print 'Deletion in progress'
index 8aee453..dca8444 100644 (file)
@@ -95,6 +95,8 @@ class Vim(object):
         if not utils.validate_uuid4(vim_name):
             vim_id = self.get_id(vim_name)
         http_code, resp = self._http.delete_cmd('{}/{}'.format(self._apiBase,vim_id))
+        if resp:
+            resp = json.loads(resp)
         #print 'RESP: {}'.format(resp)
         if http_code == 202:
             print 'Deletion in progress'
index cc5f04a..dd12096 100644 (file)
@@ -92,6 +92,8 @@ class Vnfd(object):
     def delete(self, name):
         vnfd = self.get(name)
         http_code, resp = self._http.delete_cmd('{}/{}'.format(self._apiBase,vnfd['_id']))
+        if resp:
+            resp = json.loads(resp)
         #print 'RESP: {}'.format(resp)
         if http_code == 202:
             print 'Deletion in progress'