Accept olt_config file as a separate argument to cord-tester or to manifest.
Change all tests to use OLT_CONFIG_FILE environment as appropriate.
Add a manifest file for voltha scenario that can test AAA/TLS with voltha and access side ONOS.
Change-Id: I6af70cd38d9b14187790dea7011839b8ba614432
diff --git a/src/test/cordSubscriber/cordSubscriberTest.py b/src/test/cordSubscriber/cordSubscriberTest.py
index 6039ebd..4d6c7e2 100644
--- a/src/test/cordSubscriber/cordSubscriberTest.py
+++ b/src/test/cordSubscriber/cordSubscriberTest.py
@@ -204,7 +204,7 @@
table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
- olt_conf_file = os.path.join(test_path, '..', 'setup/olt_config.json')
+ olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
cpqd_path = os.path.join(test_path, '..', 'setup')
ovs_path = cpqd_path
test_services = ('IGMP', 'TRAFFIC')
diff --git a/src/test/dhcprelay/dhcprelayTest.py b/src/test/dhcprelay/dhcprelayTest.py
index 20d3097..c034888 100644
--- a/src/test/dhcprelay/dhcprelayTest.py
+++ b/src/test/dhcprelay/dhcprelayTest.py
@@ -39,7 +39,7 @@
host_ip_map = {}
test_path = os.path.dirname(os.path.realpath(__file__))
dhcp_data_dir = os.path.join(test_path, '..', 'setup')
- olt_conf_file = os.path.join(test_path, '..', 'setup/olt_config.json')
+ olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
default_config = { 'default-lease-time' : 600, 'max-lease-time' : 7200, }
default_options = [ ('subnet-mask', '255.255.255.0'),
('broadcast-address', '192.168.1.255'),
diff --git a/src/test/igmp/igmpTest.py b/src/test/igmp/igmpTest.py
index 8b2cc11..7b1cda4 100644
--- a/src/test/igmp/igmpTest.py
+++ b/src/test/igmp/igmpTest.py
@@ -78,7 +78,7 @@
PORT_RX_DEFAULT = 1
max_packets = 100
app = 'org.opencord.igmp'
- olt_conf_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../setup/olt_config.json')
+ olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(os.path.dirname(os.path.realpath(__file__)), '../setup/olt_config.json'))
ROVER_TEST_TIMEOUT = 300 #3600*86
ROVER_TIMEOUT = (ROVER_TEST_TIMEOUT - 100)
ROVER_JOIN_TIMEOUT = 60
diff --git a/src/test/netCondition/netConditionTest.py b/src/test/netCondition/netConditionTest.py
index 93a811d..0a4ca94 100644
--- a/src/test/netCondition/netConditionTest.py
+++ b/src/test/netCondition/netConditionTest.py
@@ -102,7 +102,7 @@
PORT_RX_DEFAULT = 1
max_packets = 100
app_igmp = 'org.opencord.igmp'
- olt_conf_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../setup/olt_config.json')
+ olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(os.path.dirname(os.path.realpath(__file__)), '../setup/olt_config.json'))
ROVER_TEST_TIMEOUT = 10 #3600*86
ROVER_TIMEOUT = (ROVER_TEST_TIMEOUT - 100)
ROVER_JOIN_TIMEOUT = 60
diff --git a/src/test/setup/cord-test.py b/src/test/setup/cord-test.py
index fb4c662..960e35f 100755
--- a/src/test/setup/cord-test.py
+++ b/src/test/setup/cord-test.py
@@ -80,9 +80,14 @@
self.create = False
self.rm = False
self.olt = False
- if env is not None and env.has_key('OLT_CONFIG'):
- self.olt = True
- olt_conf_file = os.path.join(self.tester_base, 'olt_config.json')
+ olt_config_file = 'olt_config.json'
+ if env is not None:
+ if env.has_key('OLT_CONFIG'):
+ self.olt = True
+ if env.has_key('OLT_CONFIG_FILE'):
+ olt_config_file = os.path.basename(env['OLT_CONFIG_FILE'])
+
+ olt_conf_file = os.path.join(self.tester_base, olt_config_file)
olt_config = OltConfig(olt_conf_file)
self.port_map, _ = olt_config.olt_port_map()
self.vcpes = olt_config.get_vcpes()
@@ -201,8 +206,8 @@
if os.access('/sys/class/net/{}'.format(port), os.F_OK):
guest_port = 'vcpe{}'.format(port_num)
port_num += 1
- print('Provisioning port %s for %s with s_tag: %d, c_tag: %d\n'
- %(guest_port, self.name, s_tag, c_tag))
+ print('Provisioning guest port %s for %s with host port: %s, s_tag: %d, c_tag: %d\n'
+ %(guest_port, self.name, port, s_tag, c_tag))
cmd = 'pipework {} -i {} -l {} {} 0.0.0.0/24'.format(port, guest_port, guest_port, self.name)
res = os.system(cmd)
if res == 0:
@@ -285,8 +290,9 @@
return intf_type
@classmethod
- def cleanup_intfs(cls):
- olt_conf_file = os.path.join(cls.tester_base, 'olt_config.json')
+ def cleanup_intfs(cls, olt_conf_file):
+ if not os.access(olt_conf_file, os.F_OK):
+ olt_conf_file = os.path.join(cls.tester_base, os.path.basename(olt_conf_file))
olt_config = OltConfig(olt_conf_file)
port_map, _ = olt_config.olt_port_map()
vcpes = olt_config.get_vcpes()
@@ -440,6 +446,7 @@
test_type_default='dhcp'
onos_app_version = '2.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')
cord_test_server_address = '{}:{}'.format(CORD_TEST_HOST, CORD_TEST_PORT)
identity_file_default = '/etc/maas/ansible/id_rsa'
@@ -537,6 +544,17 @@
onos_cord_loc = test_manifest.onos_cord
service_profile = test_manifest.service_profile
synchronizer = test_manifest.synchronizer
+ olt_config_file = test_manifest.olt_config
+ if not os.access(olt_config_file, os.F_OK):
+ olt_config_file = os.path.join(CordTester.tester_base, 'olt_config.json')
+ else:
+ dest = os.path.join(CordTester.tester_base,
+ os.path.basename(olt_config_file))
+ if os.path.abspath(olt_config_file) != dest:
+ try:
+ shutil.copy(olt_config_file, dest)
+ except: pass
+
onos_cord = None
Onos.update_data_dir(test_manifest.karaf_version)
@@ -677,14 +695,16 @@
if ssh_key_file:
test_cnt_env['SSH_KEY_FILE'] = ssh_key_file
+ olt_conf_test_loc = os.path.join(CordTester.sandbox_setup, os.path.basename(olt_config_file))
+ test_cnt_env['OLT_CONFIG_FILE'] = olt_conf_test_loc
if test_manifest.olt:
- olt_conf_test_loc = os.path.join(CordTester.sandbox_setup, 'olt_config.json')
test_cnt_env['OLT_CONFIG'] = olt_conf_test_loc
if use_manifest:
test_cnt_env['MANIFEST'] = os.path.join(CordTester.sandbox_setup,
os.path.basename(args.manifest))
+
if iterations is not None:
test_cnt_env['ITERATIONS'] = iterations
@@ -805,6 +825,16 @@
onos_cord = None
onos_cord_loc = test_manifest.onos_cord
Onos.update_data_dir(test_manifest.karaf_version)
+ olt_config_file = test_manifest.olt_config
+ if not os.access(olt_config_file, os.F_OK):
+ olt_config_file = os.path.join(CordTester.tester_base, 'olt_config.json')
+ else:
+ dest = os.path.join(CordTester.tester_base,
+ os.path.basename(olt_config_file))
+ if os.path.abspath(olt_config_file) != dest:
+ try:
+ shutil.copy(olt_config_file, dest)
+ except: pass
if onos_cord_loc:
if onos_cord_loc.find(os.path.sep) < 0:
@@ -942,8 +972,9 @@
if ssh_key_file:
test_cnt_env['SSH_KEY_FILE'] = ssh_key_file
+ olt_conf_test_loc = os.path.join(CordTester.sandbox_setup, os.path.basename(olt_config_file))
+ test_cnt_env['OLT_CONFIG_FILE'] = olt_conf_test_loc
if test_manifest.olt:
- olt_conf_test_loc = os.path.join(CordTester.sandbox_setup, 'olt_config.json')
test_cnt_env['OLT_CONFIG'] = olt_conf_test_loc
if test_manifest.iterations is not None:
test_cnt_env['ITERATIONS'] = iterations
@@ -984,6 +1015,7 @@
manifest = TestManifest(manifest = args.manifest)
args.prefix = manifest.image_prefix
args.olt = manifest.olt
+ args.olt_config = manifest.olt_config
args.onos = manifest.onos_image
args.server = manifest.server
args.onos_ip = manifest.onos_ip
@@ -1009,7 +1041,7 @@
Container.cleanup(test_container)
if args.olt:
print('Cleaning up test container OLT configuration')
- CordTester.cleanup_intfs()
+ CordTester.cleanup_intfs(args.olt_config)
onos_list = [ c['Names'][0][1:] for c in Container.dckr.containers() if c['Image'] == image_name ]
if len(onos_list) > 1:
@@ -1208,6 +1240,7 @@
parser_run.add_argument('-q', '--quagga',action='store_true',help='Provision quagga container for vrouter')
parser_run.add_argument('-a', '--app', default=onos_app_file, type=str, help='Cord ONOS app filename')
parser_run.add_argument('-l', '--olt', action='store_true', help='Use OLT config')
+ parser_run.add_argument('-olt-config', '--olt-config', default=olt_config_default, type=str, help='Provide OLT configuration')
parser_run.add_argument('-e', '--test-controller', default='', type=str, help='External test controller ip for Onos and/or radius server. '
'Eg: 10.0.0.2/10.0.0.3 to specify ONOS and Radius ip to connect')
parser_run.add_argument('-r', '--server', default=cord_test_server_address, type=str,
@@ -1263,6 +1296,7 @@
' --update=all to rebuild all cord tester images.')
parser_setup.add_argument('-d', '--dont-provision', action='store_true', help='Dont start test container.')
parser_setup.add_argument('-l', '--olt', action='store_true', help='Use OLT config')
+ parser_setup.add_argument('-olt-config', '--olt-config', default=olt_config_default, type=str, help='Provide OLT configuration')
parser_setup.add_argument('-log', '--log-level', default=onos_log_level, type=str,
choices=['DEBUG','TRACE','ERROR','WARN','INFO'],
help='Specify the log level for the test cases')
@@ -1321,6 +1355,7 @@
parser_cleanup = subparser.add_parser('cleanup', help='Cleanup test containers')
parser_cleanup.add_argument('-p', '--prefix', default='', type=str, help='Provide container image prefix')
parser_cleanup.add_argument('-l', '--olt', action = 'store_true', help = 'Cleanup OLT config')
+ parser_cleanup.add_argument('-olt-config', '--olt-config', default=olt_config_default, type=str, help='Provide OLT configuration')
parser_cleanup.add_argument('-o', '--onos', default=onos_image_default, type=str,
help='ONOS container image to cleanup')
parser_cleanup.add_argument('-x', '--xos', action='store_true',
diff --git a/src/test/setup/manifest-olt-voltha.json b/src/test/setup/manifest-olt-voltha.json
new file mode 100644
index 0000000..276e480
--- /dev/null
+++ b/src/test/setup/manifest-olt-voltha.json
@@ -0,0 +1,12 @@
+{
+ "onos_instances": 1,
+ "olt": true,
+ "olt_config" : "olt_config_voltha.json",
+ "start_switch": false,
+ "onos" : "10.70.46.93",
+ "radius" : "172.23.0.3",
+ "onos_image": "onosproject/onos:latest",
+ "log_level" : "INFO",
+ "jvm_heap_size" : "1G",
+ "karaf_version" : "3.0.5"
+}
diff --git a/src/test/setup/olt_config_voltha.json b/src/test/setup/olt_config_voltha.json
new file mode 100644
index 0000000..75f942c
--- /dev/null
+++ b/src/test/setup/olt_config_voltha.json
@@ -0,0 +1,35 @@
+{ "olt" : false,
+ "uplink" : 2,
+ "vlan" : 0,
+ "port_map" : { "ports": [ "veth0", "veth2", "veth4", "veth6", "veth8", "veth10", "veth12", "veth14", "veth16", "veth18", "veth20", "veth22" ], "start_vlan" : 0, "host": "enp1s0f1" },
+ "vcpe" :
+ [
+ {
+ "port" : "fabric", "type" : "reserved", "s_tag" : 222, "c_tag" : 111
+ },
+ {
+ "port" : "fabric", "type" : "dhcp", "s_tag" : 304, "c_tag" : 304
+ },
+ {
+ "port" : "fabric", "type" : "dhcp", "s_tag" : 304, "c_tag" : 305
+ },
+ {
+ "port" : "fabric", "type" : "dhcp", "s_tag" : 304, "c_tag" : 306
+ },
+ {
+ "port" : "fabric", "type" : "dhcp", "s_tag" : 304, "c_tag" : 307
+ },
+ {
+ "port" : "fabric", "type" : "dhcp", "s_tag" : 304, "c_tag" : 308
+ },
+ {
+ "port" : "fabric", "type" : "dhcp", "s_tag" : 304, "c_tag" : 309
+ },
+ {
+ "port" : "fabric", "type" : "dhcp", "s_tag" : 304, "c_tag" : 310
+ },
+ {
+ "port" : "fabric", "type" : "dhcp", "s_tag" : 304, "c_tag" : 311
+ }
+ ]
+}
diff --git a/src/test/utils/Cluster.py b/src/test/utils/Cluster.py
index 5e248ec..75dd270 100644
--- a/src/test/utils/Cluster.py
+++ b/src/test/utils/Cluster.py
@@ -59,7 +59,7 @@
PORT_RX_DEFAULT = 1
max_packets = 100
app = 'org.opencord.igmp'
- olt_conf_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../setup/olt_config.json')
+ olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(os.path.dirname(os.path.realpath(__file__)), '../setup/olt_config.json'))
ROVER_TEST_TIMEOUT = 300 #3600*86
ROVER_TIMEOUT = (ROVER_TEST_TIMEOUT - 100)
ROVER_JOIN_TIMEOUT = 60
@@ -444,7 +444,7 @@
MAX_PORTS = 100
hosts_list = [ ('192.168.10.1', '00:00:00:00:00:01'), ('192.168.11.1', '00:00:00:00:02:01'), ]
- olt_conf_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../setup/olt_config.json')
+ olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(os.path.dirname(os.path.realpath(__file__)), '../setup/olt_config.json'))
@classmethod
def setUpClass(cls):
@@ -1174,7 +1174,7 @@
host_ip_map = {}
test_path = os.path.dirname(os.path.realpath(__file__))
dhcp_data_dir = os.path.join(test_path, '..', 'setup')
- olt_conf_file = os.path.join(test_path, '..', 'setup/olt_config.json')
+ olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
default_config = { 'default-lease-time' : 600, 'max-lease-time' : 7200, }
default_options = [ ('subnet-mask', '255.255.255.0'),
('broadcast-address', '192.168.1.255'),
@@ -1618,7 +1618,7 @@
table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
- olt_conf_file = os.path.join(test_path, '..', 'setup/olt_config.json')
+ olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
cpqd_path = os.path.join(test_path, '..', 'setup')
ovs_path = cpqd_path
test_services = ('IGMP', 'TRAFFIC')
diff --git a/src/test/utils/TestManifest.py b/src/test/utils/TestManifest.py
index 88f9a67..bdd66c7 100644
--- a/src/test/utils/TestManifest.py
+++ b/src/test/utils/TestManifest.py
@@ -32,6 +32,7 @@
self.async_mode = args.async_mode
self.shared_volume = args.shared_volume
self.olt = args.olt
+ self.olt_config = args.olt_config
self.start_switch = args.start_switch
self.image_prefix = args.prefix
self.onos_image = args.onos
@@ -66,6 +67,7 @@
self.shared_volume = data.get('shared_volume', True)
self.async_mode = True if self.onos_instances > 1 else False
self.olt = data.get('olt', True)
+ self.olt_config = data.get('olt_config', 'olt_config.json')
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')
diff --git a/src/test/vsg/vsgTest.py b/src/test/vsg/vsgTest.py
index 2c1c05d..919a5ae 100644
--- a/src/test/vsg/vsgTest.py
+++ b/src/test/vsg/vsgTest.py
@@ -43,7 +43,7 @@
head_node = os.getenv('HEAD_NODE', 'prod')
HEAD_NODE = head_node + '.cord.lab' if len(head_node.split('.')) == 1 else head_node
test_path = os.path.dirname(os.path.realpath(__file__))
- olt_conf_file = os.path.join(test_path, '..', 'setup/olt_config.json')
+ olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
restApiXos = None
subscriber_account_num = 200
subscriber_s_tag = 304