Implement ONOS shutdown.
If a node is specified, then ONOS running in cluster is shutdown.
Also move quaggashutdown wrappers to CordContainer.
Change-Id: I766a01bccd97f0ce033b533a6478556c1134942f
diff --git a/src/test/utils/CordTestServer.py b/src/test/utils/CordTestServer.py
index e236008..cf280f6 100644
--- a/src/test/utils/CordTestServer.py
+++ b/src/test/utils/CordTestServer.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-from CordContainer import Container, Onos, OnosCord, Quagga, Radius, reinitContainerClients
+from CordContainer import Container, Onos, OnosStopWrapper, OnosCord, OnosCordStopWrapper, Quagga, QuaggaStopWrapper, Radius, reinitContainerClients
from nose.tools import nottest
from SimpleXMLRPCServer import SimpleXMLRPCServer
import daemon
@@ -30,12 +30,6 @@
CORD_TEST_HOST = '172.17.0.1'
CORD_TEST_PORT = 25000
-class QuaggaStopWrapper(Container):
- def __init__(self, name = Quagga.NAME, image = Quagga.IMAGE, tag = 'candidate'):
- super(QuaggaStopWrapper, self).__init__(name, image, prefix = Container.IMAGE_PREFIX, tag = tag)
- if self.exists():
- self.kill()
-
class CordTestServer(object):
onos_cord = None
@@ -60,6 +54,15 @@
def restart_onos(self, kwargs):
return self.__restart_onos(**kwargs)
+ def __shutdown_onos(self, node = None):
+ if node is None:
+ node = Onos.NAME
+ OnosStopWrapper(node)
+ return 'DONE'
+
+ def shutdown_onos(self, kwargs):
+ return self.__shutdown_onos(**kwargs)
+
def __restart_quagga(self, config = None, boot_delay = 30 ):
config_file = Quagga.quagga_config_file
if config is not None:
@@ -161,6 +164,17 @@
return False
@nottest
+def __cord_test_onos_shutdown(**kwargs):
+ return rpc_server_instance().shutdown_onos(kwargs)
+
+@nottest
+def cord_test_onos_shutdown(node = None):
+ data = __cord_test_onos_shutdown(node = node)
+ if data == 'DONE':
+ return True
+ return False
+
+@nottest
def __cord_test_quagga_restart(**kwargs):
return rpc_server_instance().restart_quagga(kwargs)