proper handling of http_codes in http.post_cmd

Change-Id: I7526522f11f2c7c991c61e0a8bbe99393bddbc85
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/osmclient/sol005/sdncontroller.py b/osmclient/sol005/sdncontroller.py
index 36605eb..0639559 100644
--- a/osmclient/sol005/sdncontroller.py
+++ b/osmclient/sol005/sdncontroller.py
@@ -21,7 +21,8 @@
 from osmclient.common import utils
 from osmclient.common.exceptions import ClientException
 from osmclient.common.exceptions import NotFound
-import yaml 
+import yaml
+import json
 
 
 class SdnController(object):
@@ -34,8 +35,10 @@
         self._apiBase = '{}{}{}'.format(self._apiName,
                                         self._apiVersion, self._apiResource)
     def create(self, name, sdn_controller):
-        resp = self._http.post_cmd(endpoint=self._apiBase,
+        http_code, resp = self._http.post_cmd(endpoint=self._apiBase,
                                        postfields_dict=sdn_controller)
+        if resp:
+            resp = json.loads(resp)
         #print 'RESP: {}'.format(resp)
         if not resp or 'id' not in resp:
             raise ClientException('failed to create SDN controller: '.format(
@@ -45,8 +48,10 @@
 
     def update(self, name, sdn_controller):
         sdnc = self.get(name)
-        resp = self._http.patch_cmd(endpoint='{}/{}'.format(self._apiBase,sdnc['_id']),
+        http_code, resp = self._http.patch_cmd(endpoint='{}/{}'.format(self._apiBase,sdnc['_id']),
                                        postfields_dict=sdn_controller)
+        if resp:
+            resp = json.loads(resp)
         print 'RESP: {}'.format(resp)
         if not resp or 'id' not in resp:
             raise ClientException('failed to update SDN controller: '.format(