Support for ponsim tests for igmp and aaa
Change-Id: Id97a012c7403f236b72624a6509a032163aacea5
diff --git a/src/test/cordSubscriber/cordSubscriberTest.json b/src/test/cordSubscriber/cordSubscriberTest.json
index 539e0cd..e630b20 100644
--- a/src/test/cordSubscriber/cordSubscriberTest.json
+++ b/src/test/cordSubscriber/cordSubscriberTest.json
@@ -3,6 +3,6 @@
"VOLTHA_REST_PORT" : 8881,
"VOLTHA_IGMP_ITERATIONS" : 150,
"VOLTHA_CONFIG_FAKE" : true,
- "VOLTHA_OLT_TYPE" : "simulated_olt",
+ "VOLTHA_OLT_TYPE" : "ponsim_olt",
"VOLTHA_OLT_MAC" : "00:0c:e2:31:12:00"
}
diff --git a/src/test/cordSubscriber/cordSubscriberTest.py b/src/test/cordSubscriber/cordSubscriberTest.py
index da4f758..1cffe67 100644
--- a/src/test/cordSubscriber/cordSubscriberTest.py
+++ b/src/test/cordSubscriber/cordSubscriberTest.py
@@ -2609,8 +2609,14 @@
voltha = VolthaCtrl(self.VOLTHA_HOST,
rest_port = self.VOLTHA_REST_PORT,
uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
- log_test.info('Enabling OLT instance for %s with mac %s' %(self.VOLTHA_OLT_TYPE, self.VOLTHA_OLT_MAC))
- status = voltha.enable_device(self.VOLTHA_OLT_TYPE, self.VOLTHA_OLT_MAC)
+ if self.VOLTHA_OLT_TYPE.startswith('ponsim'):
+ ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
+ log_test.info('Enabling ponsim olt')
+ status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
+ else:
+ log_test.info('Enabling OLT instance for %s with mac %s' %(self.VOLTHA_OLT_TYPE, self.VOLTHA_OLT_MAC))
+ status = voltha.enable_device(self.VOLTHA_OLT_TYPE, self.VOLTHA_OLT_MAC)
+
assert_equal(status, True)
time.sleep(10)
switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
diff --git a/src/test/utils/VolthaCtrl.py b/src/test/utils/VolthaCtrl.py
index c550020..86d17e9 100644
--- a/src/test/utils/VolthaCtrl.py
+++ b/src/test/utils/VolthaCtrl.py
@@ -188,11 +188,20 @@
return None
return resp.json()
- def enable_device(self, olt_type, olt_mac):
+ def enable_device(self, olt_type, olt_mac = None, address = None):
url = '{}/local/devices'.format(self.rest_url)
- device_config = { 'type' : olt_type, 'mac_address' : olt_mac }
+ if olt_mac is None and address is None:
+ log.error('Either olt mac or address needs to be specified')
+ return False
+ if olt_mac is not None:
+ device_config = { 'type' : olt_type, 'mac_address' : olt_mac }
+ else:
+ device_config = { 'type' : olt_type, 'host_and_port' : address }
#pre-provision
- log.info('Pre-provisioning %s with mac %s' %(olt_type, olt_mac))
+ if olt_mac is not None:
+ log.info('Pre-provisioning %s with mac %s' %(olt_type, olt_mac))
+ else:
+ log.info('Pre-provisioning %s with address %s' %(olt_type, address))
resp = requests.post(url, data = json.dumps(device_config))
if resp.ok is not True or resp.status_code != 200:
return False
diff --git a/src/test/voltha/volthaTest.py b/src/test/voltha/volthaTest.py
index 0620e4b..db65d69 100644
--- a/src/test/voltha/volthaTest.py
+++ b/src/test/voltha/volthaTest.py
@@ -23,6 +23,12 @@
status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
assert_equal(status, True)
+ def test_ponsim_enable(self):
+ log_test.info('Enabling ponsim_olt')
+ ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
+ status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
+ assert_equal(status, True)
+
def test_subscriber_with_voltha_for_eap_tls_authentication(self):
"""
Test Method: