projects
/
osm
/
osmclient.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improvement: Return more states in the 'detailed-status' field - client side
[osm/osmclient.git]
/
osmclient
/
sol005
/
sdncontroller.py
diff --git
a/osmclient/sol005/sdncontroller.py
b/osmclient/sol005/sdncontroller.py
index
6a6c1c1
..
6f63a9a
100644
(file)
--- a/
osmclient/sol005/sdncontroller.py
+++ b/
osmclient/sol005/sdncontroller.py
@@
-51,11
+51,11
@@
class SdnController(object):
def _get_id_for_wait(self, name):
# Returns id of name, or the id itself if given as argument
for sdnc in self.list():
def _get_id_for_wait(self, name):
# Returns id of name, or the id itself if given as argument
for sdnc in self.list():
- if name == sdnc['name']:
- return sdnc['_id']
- for wim in self.list():
if name == sdnc['_id']:
return sdnc['_id']
if name == sdnc['_id']:
return sdnc['_id']
+ for sdnc in self.list():
+ if name == sdnc['name']:
+ return sdnc['_id']
return ''
def create(self, name, sdn_controller, wait=False):
return ''
def create(self, name, sdn_controller, wait=False):
@@
-87,18
+87,17
@@
class SdnController(object):
sdnc_id_for_wait = self._get_id_for_wait(name)
http_code, resp = self._http.put_cmd(endpoint='{}/{}'.format(self._apiBase,sdnc['_id']),
postfields_dict=sdn_controller)
sdnc_id_for_wait = self._get_id_for_wait(name)
http_code, resp = self._http.put_cmd(endpoint='{}/{}'.format(self._apiBase,sdnc['_id']),
postfields_dict=sdn_controller)
- #print 'HTTP CODE: {}'.format(http_code)
- #print 'RESP: {}'.format(resp)
+ #
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, 204):
- if resp:
- resp = json.loads(resp)
- if not resp or 'id' not in resp:
- raise ClientException('unexpected response from server - {}'.format(
- resp))
if wait:
if wait:
- # Wait for status for SDNC instance update
- self._wait(sdnc_id_for_wait)
- print(resp['id'])
+ # In this case, 'resp' always returns None, so 'resp['id']' cannot be used.
+ # Use the previously obtained id instead.
+ wait_id = sdnc_id_for_wait
+ # Wait for status for VI instance update
+ self._wait(wait_id)
+ else:
+ pass
else:
msg = ""
if resp:
else:
msg = ""
if resp: