Skip forming cluster if ONOS cluster was already formed.
Change-Id: I60b18cc4dd756e94d934641b99ee524dff9d7d1e
diff --git a/src/test/cluster/clusterTest.py b/src/test/cluster/clusterTest.py
index 080f547..11a398f 100644
--- a/src/test/cluster/clusterTest.py
+++ b/src/test/cluster/clusterTest.py
@@ -363,7 +363,7 @@
index = num % ctlr_len
#index = random.randrange(0, ctlr_len)
controller = onos_map[controllers[index]] if next_controller is None else next_controller
- log.info('Restarting Controller %s' %controller)
+ log.info('ITERATION: %d. Restarting Controller %s' %(num + 1, controller))
try:
cord_test_onos_restart(node = controller)
time.sleep(30)
diff --git a/src/test/setup/cord-test.py b/src/test/setup/cord-test.py
index 5b21c2b..adfebad 100755
--- a/src/test/setup/cord-test.py
+++ b/src/test/setup/cord-test.py
@@ -389,6 +389,8 @@
Container.IMAGE_PREFIX = args.prefix
cluster_mode = True if args.onos_instances > 1 else False
+ existing_list = [ c['Names'][0][1:] for c in Container.dckr.containers() if c['Image'] == args.onos ]
+ setup_cluster = False if len(existing_list) == args.onos_instances else True
if onos_ip is None:
image_names = args.onos.rsplit(':', 1)
onos_cnt['image'] = image_names[0]
@@ -423,7 +425,10 @@
print('Installing cord tester ONOS app %s in ONOS instance %s' %(args.app,ip))
OnosCtrl.install_app(args.app, onos_ip = ip)
except: pass
- Onos.setup_cluster(onos_instances)
+ if setup_cluster is True:
+ Onos.setup_cluster(onos_instances)
+ else:
+ print('ONOS instances already running. Skipping ONOS form cluster for %d instances' %num_onos_instances)
ctlr_addr = ','.join(onos_ips)
print('Onos IP %s, Test type %s' %(onos_ip, args.test_type))