Changes to support cord-tester to test restarts with existing ONOS cord instance.
This wraps the existing configuration of ONOS cord instances already running, namely:
a) onoscord
b) onosfabric
on Cord and provides cord-tester restart test cases to work through the cord-tester agent running on CORD.
A cleanup should restore back to the ONOS cord instance by restoring back the saved running config.
Change-Id: Ic4d52cb7886a958a69c18b27bf010f99863ffdd5
diff --git a/src/test/utils/OnosCtrl.py b/src/test/utils/OnosCtrl.py
index 6401a18..bd931a7 100644
--- a/src/test/utils/OnosCtrl.py
+++ b/src/test/utils/OnosCtrl.py
@@ -60,16 +60,24 @@
if config is not None:
json_data = json.dumps(config)
if controller is None:
- print('default Onos config url is %s'%cls.cfg_url)
resp = requests.post(cls.cfg_url, auth = cls.auth, data = json_data)
else:
cfg_url = 'http://%s:8181/onos/v1/network/configuration/' %(controller)
- print('non-default Onos config url is %s'%cfg_url)
resp = requests.post(cfg_url, auth = cls.auth, data = json_data)
return resp.ok, resp.status_code
return False, 400
@classmethod
+ def get_config(cls, controller=None):
+ if controller is None:
+ controller = cls.controller
+ cfg_url = 'http://%s:8181/onos/v1/network/configuration/' %(controller)
+ resp = requests.get(cfg_url, auth = cls.auth)
+ if resp.ok:
+ return resp.json()
+ return None
+
+ @classmethod
def delete(cls, config, controller=None):
if config:
json_data = json.dumps(config)
@@ -78,7 +86,6 @@
resp = requests.delete(cls.cfg_url, auth = cls.auth, data = json_data)
else:
cfg_url = 'http://%s:8181/onos/v1/network/configuration/' %(controller)
- print('non-default Onos config url is %s'%cfg_url)
resp = requests.delete(cfg_url, auth = cls.auth, data = json_data)
return resp.ok, resp.status_code
return False, 400