Test: Implement setup --cord mode for cord-tester.
This would make the cord-tester listen for ONOS restart requests on the cord.
The restart is implemented using docker-compose when running the test agent on the ONOS compute node.
This is required because the tests restart ONOS with different configurations and the cord-tester agent
restarts bind the config volume to the xos/onos container before restarting ONOS.
Also implement fetching the device id properly when running tester under OLT configuration.
One can also override with OLT_DEVICE_ID env in the test container when multiple devices are connected to ONOS.
This is used by the subscriber test to override the pmc-olt driver for the device id when running
single-channel N subscriber tests.
Change-Id: I1fa27dd21ccacec35f38030443ad298b59718f4b
diff --git a/src/test/setup/cord-test.py b/src/test/setup/cord-test.py
index 5dabe1c..ac81fa7 100755
--- a/src/test/setup/cord-test.py
+++ b/src/test/setup/cord-test.py
@@ -363,6 +363,15 @@
onos_ip = None
radius_ip = None
+ onos_cord_loc = args.onos_cord
+ if onos_cord_loc:
+ if onos_cord_loc.find(os.path.sep) < 0:
+ onos_cord_loc = os.path.join(os.getenv('HOME'), onos_cord_loc)
+ if not os.access(onos_cord_loc, os.F_OK):
+ print('ONOS cord config location %s is not accessible' %onos_cord_loc)
+ sys.exit(1)
+ #Disable test container provisioning on the ONOS compute node
+ args.dont_provision = True
##If onos/radius was already started
if args.test_controller:
@@ -373,6 +382,14 @@
else:
radius_ip = None
+ onos_cord = None
+ if onos_cord_loc:
+ if not args.test_controller:
+ ##Unexpected case. Specify the external controller ip when running on cord node
+ print('Specify ONOS ip using \"-e\" option when running the cord-tester on cord node')
+ sys.exit(1)
+ onos_cord = OnosCord(onos_cord_loc)
+
#don't spawn onos if the user had started it externally
onos_cnt['image'] = args.onos.split(':')[0]
if args.onos.find(':') >= 0:
@@ -385,7 +402,6 @@
print('Onos IP %s' %onos_ip)
print('Installing ONOS cord apps')
Onos.install_cord_apps(onos_ip = onos_ip)
-
print('Installing cord tester ONOS app %s' %onos_app_file)
OnosCtrl.install_app(args.app, onos_ip = onos_ip)
@@ -435,7 +451,8 @@
print('Test container %s started and provisioned to run tests using nosetests' %(test_cnt.name))
#Finally start the test server and daemonize
- cord_test_server_start(daemonize = True, cord_test_host = ip, cord_test_port = port)
+ cord_test_server_start(daemonize = True, cord_test_host = ip, cord_test_port = port,
+ onos_cord = onos_cord)
def cleanupTests(args):
test_container = '{}:latest'.format(CordTester.IMAGE)
@@ -499,6 +516,8 @@
parser_setup.add_argument('-d', '--dont-provision', action='store_true', help='Dont start test container.')
parser_setup.add_argument('-p', '--olt', action='store_true', help='Use OLT config')
parser_setup.add_argument('-s', '--start-switch', action='store_true', help='Start OVS when running under OLT config')
+ parser_setup.add_argument('-c', '--onos-cord', default='', type=str,
+ help='Specify cord location for ONOS cord when running on podd')
parser_setup.set_defaults(func=setupCordTester)
parser_list = subparser.add_parser('list', help='List test cases')