New (remote) api to add nodes/members to the existing ONOS cluster
Change-Id: Ie09a13f80e5436416dc4d7bb3481ac9e50cfac3f
diff --git a/src/test/utils/CordContainer.py b/src/test/utils/CordContainer.py
index 2ab077b..28a733c 100644
--- a/src/test/utils/CordContainer.py
+++ b/src/test/utils/CordContainer.py
@@ -465,6 +465,18 @@
onos.install_cord_apps(onos.ipaddr)
@classmethod
+ def add_cluster(cls, count = 1, network_cfg = None):
+ if not cls.cluster_instances or Onos.cluster_mode is False:
+ return
+ for i in range(count):
+ name = '{}-{}'.format(Onos.NAME, len(cls.cluster_instances)+1)
+ onos = cls(name = name, image = Onos.IMAGE, tag = Onos.TAG, prefix = Container.IMAGE_PREFIX,
+ cluster = True, network_cfg = network_cfg)
+ cls.cluster_instances.append(onos)
+
+ cls.setup_cluster(cls.cluster_instances)
+
+ @classmethod
def restart_cluster(cls, network_cfg = None):
if cls.cluster_mode is False:
return
diff --git a/src/test/utils/CordTestServer.py b/src/test/utils/CordTestServer.py
index cf280f6..954ca10 100644
--- a/src/test/utils/CordTestServer.py
+++ b/src/test/utils/CordTestServer.py
@@ -63,6 +63,13 @@
def shutdown_onos(self, kwargs):
return self.__shutdown_onos(**kwargs)
+ def __add_cluster_onos(self, count = 1, config = None):
+ Onos.add_cluster(count = count, network_cfg = config)
+ return 'DONE'
+
+ def add_cluster_onos(self, kwargs):
+ return self.__add_cluster_onos(self, **kwargs)
+
def __restart_quagga(self, config = None, boot_delay = 30 ):
config_file = Quagga.quagga_config_file
if config is not None:
@@ -175,6 +182,17 @@
return False
@nottest
+def __cord_test_onos_add_cluster(**kwargs):
+ return rpc_server_instance().add_cluster_onos(kwargs)
+
+@nottest
+def cord_test_onos_add_cluster(count = 1, config = None):
+ data = __cord_test_onos_add_cluster(count = count, config = config)
+ if data == 'DONE':
+ return True
+ return False
+
+@nottest
def __cord_test_quagga_restart(**kwargs):
return rpc_server_instance().restart_quagga(kwargs)