Install the right ONOS and cord-tester apps based on ONOS version.
Install a 1.1 olt app for ONOS 1.8 versions.
Change-Id: Id6255b897a95474f41ddf39fa067413c43731684
diff --git a/src/test/apps/olt-app-1.1-SNAPSHOT.oar b/src/test/apps/olt-app-1.1-SNAPSHOT.oar
new file mode 100644
index 0000000..09e73f1
--- /dev/null
+++ b/src/test/apps/olt-app-1.1-SNAPSHOT.oar
Binary files differ
diff --git a/src/test/cordSubscriber/cordSubscriberTest.py b/src/test/cordSubscriber/cordSubscriberTest.py
index 1cffe67..f4f5df8 100644
--- a/src/test/cordSubscriber/cordSubscriberTest.py
+++ b/src/test/cordSubscriber/cordSubscriberTest.py
@@ -39,6 +39,7 @@
from CordTestUtils import log_test, get_controller
from CordLogger import CordLogger
from CordTestConfig import setup_module
+from CordContainer import Onos
log_test.setLevel('INFO')
@@ -275,6 +276,26 @@
VOLTHA_ENABLED = bool(int(os.getenv('VOLTHA_ENABLED', 0)))
@classmethod
+ def update_apps_version(cls):
+ version = Onos.getVersion()
+ major = int(version.split('.')[0])
+ minor = int(version.split('.')[1])
+ cordigmp_app_version = '2.0-SNAPSHOT'
+ olt_app_version = '1.2-SNAPSHOT'
+ if major > 1:
+ cordigmp_app_version = '3.0-SNAPSHOT'
+ olt_app_version = '2.0-SNAPSHOT'
+ elif major == 1:
+ if minor > 10:
+ cordigmp_app_version = '3.0-SNAPSHOT'
+ olt_app_version = '2.0-SNAPSHOT'
+ elif minor <= 8:
+ olt_app_version = '1.1-SNAPSHOT'
+ cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version))
+ cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version))
+ cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
+
+ @classmethod
def load_device_id(cls):
'''Configure the device id'''
did = OnosCtrl.get_device_id()
@@ -293,6 +314,7 @@
@classmethod
def setUpClass(cls):
'''Load the OLT config and activate relevant apps'''
+ cls.update_apps_version()
dids = OnosCtrl.get_device_ids()
device_map = {}
for did in dids:
diff --git a/src/test/setup/cord-test.py b/src/test/setup/cord-test.py
index f2b331b..773d155 100755
--- a/src/test/setup/cord-test.py
+++ b/src/test/setup/cord-test.py
@@ -445,7 +445,7 @@
onos_image_default='onosproject/onos:latest'
nose_image_default= '{}:candidate'.format(CordTester.IMAGE)
test_type_default='dhcp'
-onos_app_version = '2.0-SNAPSHOT'
+onos_app_version = '3.0-SNAPSHOT'
cord_tester_base = os.path.dirname(os.path.realpath(__file__))
olt_config_default = os.path.join(cord_tester_base, 'olt_config.json')
onos_app_file = os.path.abspath('{0}/../apps/ciena-cordigmp-'.format(cord_tester_base) + onos_app_version + '.oar')
diff --git a/src/test/utils/CordContainer.py b/src/test/utils/CordContainer.py
index f84da49..4f65fda 100644
--- a/src/test/utils/CordContainer.py
+++ b/src/test/utils/CordContainer.py
@@ -581,10 +581,11 @@
JAVA_OPTS_DEFAULT = JAVA_OPTS_FORMAT.format(*SYSTEM_MEMORY) #-XX:+PrintGCDetails -XX:+PrintGCTimeStamps'
JAVA_OPTS_CLUSTER_DEFAULT = JAVA_OPTS_FORMAT.format(*INSTANCE_MEMORY)
env = { 'ONOS_APPS' : 'drivers,openflow,proxyarp,vrouter', 'JAVA_OPTS' : JAVA_OPTS_DEFAULT }
- onos_cord_apps = ( ('cord-config', '1.2-SNAPSHOT'),
- ('aaa', '1.2-SNAPSHOT'),
- ('igmp', '1.2-SNAPSHOT'),
+ onos_cord_apps = ( ['cord-config', '1.2-SNAPSHOT'],
+ ['aaa', '1.2-SNAPSHOT'],
+ ['igmp', '1.2-SNAPSHOT'],
)
+ cord_apps_version_updated = False
ports = [] #[ 8181, 8101, 9876, 6653, 6633, 2000, 2620, 5005 ]
setup_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'setup')
host_config_dir = os.path.join(setup_dir, 'onos-config')
@@ -916,7 +917,53 @@
onos.install_cord_apps(onos.ipaddr)
@classmethod
+ def cliEnter(cls, onos_ip = None):
+ retries = 0
+ while retries < 10:
+ cli = OnosCliDriver(controller = onos_ip, connect = True)
+ if cli.handle:
+ return cli
+ else:
+ retries += 1
+ time.sleep(3)
+
+ return None
+
+ @classmethod
+ def cliExit(cls, cli):
+ if cli:
+ cli.disconnect()
+
+ @classmethod
+ def getVersion(cls, onos_ip = None):
+ cli = cls.cliEnter(onos_ip = onos_ip)
+ try:
+ summary = json.loads(cli.summary(jsonFormat = True))
+ except:
+ cls.cliExit(cli)
+ return '1.8.0'
+ cls.cliExit(cli)
+ return summary['version']
+
+ @classmethod
+ def update_cord_apps_version(cls, onos_ip = None):
+ if cls.cord_apps_version_updated == True:
+ return
+ version = cls.getVersion(onos_ip = onos_ip)
+ major = int(version.split('.')[0])
+ minor = int(version.split('.')[1])
+ app_version = '1.2-SNAPSHOT'
+ if major > 1:
+ app_version = '2.0-SNAPSHOT'
+ elif major == 1 and minor > 10:
+ app_version = '2.0-SNAPSHOT'
+ for apps in cls.onos_cord_apps:
+ apps[1] = app_version
+ cls.cord_apps_version_updated = True
+
+ @classmethod
def install_cord_apps(cls, onos_ip = None):
+ cls.update_cord_apps_version(onos_ip = onos_ip)
for app, version in cls.onos_cord_apps:
app_file = '{}/{}-{}.oar'.format(cls.cord_apps_dir, app, version)
ok, code = OnosCtrl.install_app(app_file, onos_ip = onos_ip)
diff --git a/src/test/vsg/vsgTest.py b/src/test/vsg/vsgTest.py
index edcd41a..75a8e82 100644
--- a/src/test/vsg/vsgTest.py
+++ b/src/test/vsg/vsgTest.py
@@ -29,7 +29,7 @@
from CordTestUtils import log_test as log
from CordTestConfig import setup_module, running_on_ciab
from OnosCtrl import OnosCtrl
-
+from CordContainer import Onos
log.setLevel('INFO')
class vsg_exchange(CordLogger):
@@ -182,6 +182,15 @@
The access is opened for generated subscriber info which should not overlap.
We target the fabric onos instance on head node.
"""
+ version = Onos.getVersion(onos_ip = cls.HEAD_NODE)
+ app_version = '1.0-SNAPSHOT'
+ major = int(version.split('.')[0])
+ minor = int(version.split('.')[1])
+ if major > 1:
+ app_version = '2.0-SNAPSHOT'
+ elif major == 1 and minor > 10:
+ app_version = '2.0-SNAPSHOT'
+ cls.APP_FILE = os.path.join(cls.test_path, '..', 'apps/xconnect-{}.oar'.format(app_version))
OnosCtrl.install_app(cls.APP_FILE, onos_ip = cls.HEAD_NODE)
time.sleep(2)
s_tags = map(lambda tenant: int(tenant['voltTenant']['s_tag']), volt_subscriber_info)
@@ -250,29 +259,16 @@
if cls.on_pod is True:
cls.closeVCPEAccess(cls.volt_subscriber_info)
- def cliEnter(self, controller = None):
- retries = 0
- while retries < 30:
- self.cli = OnosCliDriver(controller = controller, connect = True)
- if self.cli.handle:
- break
- else:
- retries += 1
- time.sleep(2)
-
- def cliExit(self):
- self.cli.disconnect()
-
def onos_shutdown(self, controller = None):
status = True
- self.cliEnter(controller = controller)
+ cli = Onos.cliEnter(onos_ip = controller)
try:
- self.cli.shutdown(timeout = 10)
+ cli.shutdown(timeout = 10)
except:
log.info('Graceful shutdown of ONOS failed for controller: %s' %controller)
status = False
- self.cliExit()
+ Onos.cliExit(cli)
return status
def log_set(self, level = None, app = 'org.onosproject'):