X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fsol005%2Fsdncontroller.py;h=0639559125c1f48c987fd664019f84e1f28c6759;hb=f157128052e59df5c37489926f7d5755714c3cbf;hp=36605eb45409b002dfb9bca9256b7a24a18693eb;hpb=891e201c4ac9dd5a98ab208027d1ddd75b6aed3b;p=osm%2Fosmclient.git 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 @@ OSM SDN controller API handling 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 @@ class SdnController(object): 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 @@ class SdnController(object): 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(