Add manifest option to cord-tester cleanup
Change-Id: I7b1a2aac2fd272b277ec72354626661fbb3b2de2
diff --git a/src/test/setup/cord-test.py b/src/test/setup/cord-test.py
index 896e78a..4fa409e 100755
--- a/src/test/setup/cord-test.py
+++ b/src/test/setup/cord-test.py
@@ -795,6 +795,13 @@
return 0
def cleanupTests(args):
+ if args.manifest and os.access(args.manifest, os.F_OK):
+ manifest = TestManifest(manifest = args.manifest)
+ args.prefix = manifest.image_prefix
+ args.olt = manifest.olt
+ args.onos = manifest.onos_image
+ args.server = manifest.server
+
image_name = args.onos
prefix = args.prefix
if prefix:
@@ -1091,6 +1098,7 @@
help='Cleanup XOS containers')
parser_cleanup.add_argument('-r', '--server', default=cord_test_server_address, type=str,
help='ip:port address for cord test server to cleanup')
+ parser_cleanup.add_argument('-m', '--manifest', default='', type=str, help='Provide test manifest')
parser_cleanup.set_defaults(func=cleanupTests)
c = Client(**(kwargs_from_env()))
diff --git a/src/test/utils/TestManifest.py b/src/test/utils/TestManifest.py
index de7c72a..b8ca881 100644
--- a/src/test/utils/TestManifest.py
+++ b/src/test/utils/TestManifest.py
@@ -17,6 +17,7 @@
import os
import shutil
import platform
+from CordTestServer import CORD_TEST_HOST, CORD_TEST_PORT
class TestManifest(object):
@@ -34,6 +35,7 @@
self.start_switch = args.start_switch
self.image_prefix = args.prefix
self.onos_image = args.onos
+ self.server = '{}:{}'.format(CORD_TEST_HOST, CORD_TEST_PORT)
else:
with open(self.manifest, 'r') as fd:
data = json.load(fd)
@@ -48,3 +50,4 @@
self.start_switch = data.get('start_switch', self.olt)
self.image_prefix = data.get('image_prefix', '')
self.onos_image = data.get('onos_image', 'onosproject/onos:latest')
+ self.server = data.get('test_server', '{}:{}'.format(CORD_TEST_HOST, CORD_TEST_PORT))