fix update vnfd and nsd 27/7027/3
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 3 Dec 2018 17:31:51 +0000 (18:31 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 3 Dec 2018 17:55:29 +0000 (18:55 +0100)
Change-Id: Ib38af258d4980f76880a40db0fdac29fe478be57
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/sol005/nsd.py
osmclient/sol005/vnfd.py

index 6a18828..b134461 100644 (file)
@@ -166,6 +166,8 @@ class Nsd(object):
                 raise ClientException('unexpected response from server - {}'.format(
                                       resp))
             print(resp['id'])
+        elif http_code == 204:
+            print('Updated')
         else:
             msg = "Error {}".format(http_code)
             if resp:
index e939efc..965b999 100644 (file)
@@ -158,13 +158,15 @@ class Vnfd(object):
             http_code, resp = self._http.post_cmd(endpoint=endpoint, filename=filename)
         #print 'HTTP CODE: {}'.format(http_code)
         #print 'RESP: {}'.format(resp)
-        if http_code in (200, 201, 202, 204):
+        if http_code in (200, 201, 202):
             if resp:
                 resp = json.loads(resp)
             if not resp or 'id' not in resp:
                 raise ClientException('unexpected response from server: '.format(
                                       resp))
             print(resp['id'])
+        elif http_code == 204:
+            print('Updated')
         else:
             msg = "Error {}".format(http_code)
             if resp:
@@ -176,6 +178,6 @@ class Vnfd(object):
 
     def update(self, name, filename):
         vnfd = self.get(name)
-        endpoint = '{}/{}/vnfd_content'.format(self._apiBase, vnfd['_id'])
+        endpoint = '{}/{}/package_content'.format(self._apiBase, vnfd['_id'])
         self.create(filename=filename, update_endpoint=endpoint)