projects
/
osm
/
osmclient.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix sol005 client so that delete_cmd output is processed in the caller function
[osm/osmclient.git]
/
osmclient
/
sol005
/
sdncontroller.py
diff --git
a/osmclient/sol005/sdncontroller.py
b/osmclient/sol005/sdncontroller.py
index
36605eb
..
7833fbd
100644
(file)
--- 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
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):
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):
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)
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(
#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)
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)
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(
print 'RESP: {}'.format(resp)
if not resp or 'id' not in resp:
raise ClientException('failed to update SDN controller: '.format(
@@
-57,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']))
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'
#print 'RESP: {}'.format(resp)
if http_code == 202:
print 'Deletion in progress'