blob: e5b7c6dd60908001fc9e22b86c5fffa95c10bfaa [file] [log] [blame]
A R Karthick35495c32017-05-11 14:58:32 -07001import os
2import sys
3import unittest
A.R Karthick8a507cf2017-06-02 18:44:49 -07004import time
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00005import json
6import requests
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00007import threading
8from random import randint
9from threading import Timer
A R Karthick35495c32017-05-11 14:58:32 -070010from nose.tools import *
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000011from nose.twistedtools import reactor, deferred
12from twisted.internet import defer
A R Karthick35495c32017-05-11 14:58:32 -070013from CordTestConfig import setup_module
14from CordTestUtils import log_test
15from VolthaCtrl import VolthaCtrl
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000016from CordTestUtils import log_test, get_controller
17from portmaps import g_subscriber_port_map
18from OltConfig import *
19from EapTLS import TLSAuthTest
20from OnosCtrl import OnosCtrl
21from CordLogger import CordLogger
22from scapy.all import *
23from scapy_ssl_tls.ssl_tls import *
24from scapy_ssl_tls.ssl_tls_crypto import *
25from CordTestServer import cord_test_onos_restart, cord_test_shell, cord_test_radius_restart
A.R Karthickb9eab5a2017-06-07 16:03:51 -070026from CordContainer import Onos
A R Karthick35495c32017-05-11 14:58:32 -070027
28class voltha_exchange(unittest.TestCase):
29
30 OLT_TYPE = 'tibit_olt'
31 OLT_MAC = '00:0c:e2:31:12:00'
32 VOLTHA_HOST = 'localhost'
33 VOLTHA_REST_PORT = 8881
34 voltha = None
Thangavelu K S9648eed2017-06-13 20:15:25 +000035 success = True
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000036 apps = ('org.opencord.aaa', 'org.onosproject.dhcp')
37 olt_apps = () #'org.opencord.cordmcast')
38 vtn_app = 'org.opencord.vtn'
39 table_app = 'org.ciena.cordigmp'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000040 test_path = os.path.dirname(os.path.realpath(__file__))
41 table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
A.R Karthickb9eab5a2017-06-07 16:03:51 -070042 app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000043 olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar')
A.R Karthick3493a572017-06-07 18:28:10 -070044 olt_app_name = 'org.onosproject.olt'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000045 #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
46 olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
47 onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
48 VOLTHA_ENABLED = True
49 INTF_TX_DEFAULT = 'veth2'
50 INTF_RX_DEFAULT = 'veth0'
Thangavelu K S9648eed2017-06-13 20:15:25 +000051 INTF_2_RX_DEFAULT = 'veth6'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000052 TESTCASE_TIMEOUT = 300
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +000053# VOLTHA_CONFIG_FAKE = True
54 VOLTHA_CONFIG_FAKE = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000055 VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
56 VOLTHA_ONU_UNI_PORT = 'veth0'
57
58 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
59MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
60CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
61IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
62RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
63MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
64BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
65hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
66gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
67+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
68rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
69VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
70eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
716tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
72PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
73nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
74-----END CERTIFICATE-----"""
75
76 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
77MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
78CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
79IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
80RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
81MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
82BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
83hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
84AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
855An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
86tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
87OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
88qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
892Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
90BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
91eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
92MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
93VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
94RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
95dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
96T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
97yg==
98-----END CERTIFICATE-----'''
A R Karthick35495c32017-05-11 14:58:32 -070099
A.R Karthick3493a572017-06-07 18:28:10 -0700100 @classmethod
101 def update_apps_version(cls):
102 version = Onos.getVersion()
103 major = int(version.split('.')[0])
104 minor = int(version.split('.')[1])
105 cordigmp_app_version = '2.0-SNAPSHOT'
106 olt_app_version = '1.2-SNAPSHOT'
107 if major > 1:
108 cordigmp_app_version = '3.0-SNAPSHOT'
109 olt_app_version = '2.0-SNAPSHOT'
110 elif major == 1:
111 if minor > 10:
112 cordigmp_app_version = '3.0-SNAPSHOT'
113 olt_app_version = '2.0-SNAPSHOT'
114 elif minor <= 8:
115 olt_app_version = '1.1-SNAPSHOT'
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700116 cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version))
117 cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version))
118 cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
119
A R Karthick35495c32017-05-11 14:58:32 -0700120 @classmethod
A.R Karthickf874d032017-06-07 18:47:51 -0700121 def onos_load_config(cls, app, config):
122 status, code = OnosCtrl.config(config)
123 if status is False:
124 log_test.info('JSON config request for app %s returned status %d' %(app, code))
125 assert_equal(status, True)
126 time.sleep(2)
127
128 @classmethod
129 def onos_aaa_load(cls):
130 aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
131 'radiusIp': '172.17.0.2' } } } }
132 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
133 aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip
134 cls.onos_load_config('org.opencord.aaa', aaa_dict)
135
136 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700137 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700138 cls.update_apps_version()
A R Karthick35495c32017-05-11 14:58:32 -0700139 cls.voltha = VolthaCtrl(cls.VOLTHA_HOST, rest_port = cls.VOLTHA_REST_PORT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000140 cls.install_app_table()
141 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
142 cls.port_map, cls.port_list = cls.olt.olt_port_map()
143 cls.switches = cls.port_map['switches']
144 cls.num_ports = cls.port_map['num_ports']
145 if cls.num_ports > 1:
146 cls.num_ports -= 1 ##account for the tx port
147 cls.activate_apps(cls.apps + cls.olt_apps)
A.R Karthickf874d032017-06-07 18:47:51 -0700148 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000149
A.R Karthick3493a572017-06-07 18:28:10 -0700150 @classmethod
151 def tearDownClass(cls):
152 '''Deactivate the olt apps and restart OVS back'''
153 apps = cls.olt_apps + ( cls.table_app,)
154 for app in apps:
155 onos_ctrl = OnosCtrl(app)
156 onos_ctrl.deactivate()
157 cls.install_app_igmp()
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700158
A.R Karthick3493a572017-06-07 18:28:10 -0700159 @classmethod
160 def install_app_igmp(cls):
161 ##Uninstall the table app on class exit
162 OnosCtrl.uninstall_app(cls.table_app)
163 time.sleep(2)
164 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
165 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700166
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000167 def remove_olt(self, switch_map):
168 controller = get_controller()
169 auth = ('karaf', 'karaf')
170 #remove subscriber for every port on all the voltha devices
171 for device, device_map in switch_map.iteritems():
172 uni_ports = device_map['ports']
173 uplink_vlan = device_map['uplink_vlan']
174 for port in uni_ports:
175 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
176 device,
177 port)
178 resp = requests.delete(rest_url, auth = auth)
179 if resp.status_code not in [204, 202, 200]:
180 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
181 else:
182 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
183 OnosCtrl.uninstall_app(self.olt_app_file)
184
185 def config_olt(self, switch_map):
186 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000187 auth = ('karaf', 'karaf')
188 #configure subscriber for every port on all the voltha devices
189 for device, device_map in switch_map.iteritems():
190 uni_ports = device_map['ports']
191 uplink_vlan = device_map['uplink_vlan']
192 for port in uni_ports:
193 vlan = port
194 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
195 device,
196 port,
197 vlan)
198 resp = requests.post(rest_url, auth = auth)
199 #assert_equal(resp.ok, True)
200
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000201 def voltha_uni_port_toggle(self, uni_port = None):
202 ## Admin state of port is down and up
203 if not uni_port:
204 uni_port = self.INTF_RX_DEFAULT
205 cmd = 'ifconfig {} down'.format(uni_port)
206 os.system(cmd)
207 log_test.info('Admin state of uni_port is down')
208 time.sleep(30)
209 cmd = 'ifconfig {} up'.format(uni_port)
210 os.system(cmd)
211 log_test.info('Admin state of uni_port is up now')
212 time.sleep(30)
213 return
214
215
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000216 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000217 def install_app_table(cls):
218 ##Uninstall the existing app if any
219 OnosCtrl.uninstall_app(cls.table_app)
220 time.sleep(2)
221 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
222 OnosCtrl.install_app(cls.table_app_file)
223 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000224
225 @classmethod
226 def activate_apps(cls, apps):
227 for app in apps:
228 onos_ctrl = OnosCtrl(app)
229 status, _ = onos_ctrl.activate()
230 assert_equal(status, True)
231 time.sleep(2)
232
233 def tls_flow_check(self, olt_uni_port, cert_info = None):
234 def tls_fail_cb():
235 log_test.info('TLS verification failed')
236 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700237 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000238 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
239 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000240 if tls.failTest is True:
241 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000242 assert_equal(tls.failTest, False)
243 if cert_info == "no_cert":
244 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
245 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
246 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000247 if tls.failTest is False:
248 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000249 assert_equal(tls.failTest, True)
250 if cert_info == "invalid_cert":
251 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
252 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
253 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000254 if tls.failTest is False:
255 self.success = False
256 assert_equal(tls.failTest, True)
257 if cert_info == "same_cert":
258 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
259 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
260 tls.runTest()
261 if tls.failTest is False:
262 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000263 assert_equal(tls.failTest, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000264 if cert_info == "app_deactivate" or cert_info == "restart_radius" or cert_info == "disable_olt_device" or \
Thangavelu K S9648eed2017-06-13 20:15:25 +0000265 cert_info == "uni_port_admin_down" or cert_info == "restart_olt_device" or cert_info == "restart_onu_device":
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000266 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
267 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
268 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000269 if tls.failTest is False:
270 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000271 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000272 self.test_status = True
273 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700274
A.R Karthick8a507cf2017-06-02 18:44:49 -0700275 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -0700276 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -0700277 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
278 assert_not_equal(device_id, None)
279 try:
280 assert_equal(status, True)
281 time.sleep(10)
282 finally:
283 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000284
A.R Karthick8a507cf2017-06-02 18:44:49 -0700285 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -0700286 log_test.info('Enabling ponsim_olt')
287 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -0700288 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
289 assert_not_equal(device_id, None)
290 try:
291 assert_equal(status, True)
292 time.sleep(10)
293 finally:
294 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -0700295
Thangavelu K S008f38e2017-05-15 19:36:55 +0000296 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
297 """
298 Test Method:
299 0. Make sure that voltha is up and running on CORD-POD setup.
300 1. OLT and ONU is detected and validated.
301 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
302 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
303 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
304 5. Verify that subscriber is authenticated successfully.
305 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000306 log_test.info('Enabling ponsim_olt')
307 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
308 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
309 assert_not_equal(device_id, None)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700310 if status == False:
311 self.voltha.disable_device(device_id, delete = True)
312 assert_equal(status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000313 time.sleep(10)
314 switch_map = None
315 olt_configured = False
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700316 voltha = VolthaCtrl(self.VOLTHA_HOST,
317 rest_port = self.VOLTHA_REST_PORT,
318 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000319 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700320 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
321 if not switch_map:
322 log_test.info('No voltha devices found')
323 return
324 log_test.info('Installing OLT app')
325 OnosCtrl.install_app(self.olt_app_file)
326 time.sleep(5)
327 log_test.info('Adding subscribers through OLT app')
328 self.config_olt(switch_map)
329 olt_configured = True
330 time.sleep(5)
331 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000332 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000333 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700334 if switch_map is not None:
335 if olt_configured is True:
336 self.remove_olt(switch_map)
337 self.voltha.disable_device(device_id, delete = True)
338 time.sleep(10)
339 OnosCtrl.uninstall_app(self.olt_app_name)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000340
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000341 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000342 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
343 """
344 Test Method:
345 0. Make sure that voltha is up and running on CORD-POD setup.
346 1. OLT and ONU is detected and validated.
347 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
348 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
349 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
350 5. Verify that subscriber authentication is unsuccessful..
351 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000352 df = defer.Deferred()
353 def tls_flow_check_with_no_cert_scenario(df):
354 log_test.info('Enabling ponsim_olt')
355 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
356 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
357 assert_not_equal(device_id, None)
358 voltha = VolthaCtrl(self.VOLTHA_HOST,
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700359 rest_port = self.VOLTHA_REST_PORT,
360 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000361 time.sleep(10)
362 switch_map = None
363 olt_configured = False
364 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
365 log_test.info('Installing OLT app')
366 OnosCtrl.install_app(self.olt_app_file)
367 time.sleep(5)
368 log_test.info('Adding subscribers through OLT app')
369 self.config_olt(switch_map)
370 olt_configured = True
371 time.sleep(5)
372 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
373 try:
374 assert_equal(auth_status, True)
375 assert_equal(status, True)
376 time.sleep(10)
377 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700378 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000379 self.voltha.disable_device(device_id, delete = True)
380 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700381
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000382 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
383 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000384
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000385 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000386 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
387 """
388 Test Method:
389 0. Make sure that voltha is up and running on CORD-POD setup.
390 1. OLT and ONU is detected and validated.
391 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
392 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
393 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
394 5. Verify that subscriber authentication is unsuccessful..
395 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000396 df = defer.Deferred()
397 def tls_flow_check_with_invalid_cert_scenario(df):
398 log_test.info('Enabling ponsim_olt')
399 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
400 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
401 assert_not_equal(device_id, None)
402 voltha = VolthaCtrl(self.VOLTHA_HOST,
403 rest_port = self.VOLTHA_REST_PORT,
404 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
405 time.sleep(10)
406 switch_map = None
407 olt_configured = False
408 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
409 log_test.info('Installing OLT app')
410 OnosCtrl.install_app(self.olt_app_file)
411 time.sleep(5)
412 log_test.info('Adding subscribers through OLT app')
413 self.config_olt(switch_map)
414 olt_configured = True
415 time.sleep(5)
416 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
417 try:
418 assert_equal(auth_status, True)
419 assert_equal(status, True)
420 time.sleep(10)
421 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700422 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000423 self.voltha.disable_device(device_id, delete = True)
424 df.callback(0)
425 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
426 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000427
Thangavelu K S0d745c82017-06-09 21:56:08 +0000428 @deferred(TESTCASE_TIMEOUT)
429 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
430 """
431 Test Method:
432 0. Make sure that voltha is up and running on CORD-POD setup.
433 1. OLT and ONU is detected and validated.
434 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
435 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
436 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
437 5. Verify that subscriber authentication is unsuccessful..
438 """
439 df = defer.Deferred()
440 def tls_flow_check_with_no_cert_scenario(df):
441 log_test.info('Enabling ponsim_olt')
442 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
443 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
444 assert_not_equal(device_id, None)
445 voltha = VolthaCtrl(self.VOLTHA_HOST,
446 rest_port = self.VOLTHA_REST_PORT,
447 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
448 time.sleep(10)
449 switch_map = None
450 olt_configured = False
451 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
452 log_test.info('Installing OLT app')
453 OnosCtrl.install_app(self.olt_app_file)
454 time.sleep(5)
455 log_test.info('Adding subscribers through OLT app')
456 self.config_olt(switch_map)
457 olt_configured = True
458 time.sleep(5)
459 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
460 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
461 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
462 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
463 try:
464 assert_equal(auth_status, True)
465 assert_equal(status, True)
466 time.sleep(10)
467 finally:
468 self.voltha.disable_device(device_id, delete = True)
469 df.callback(0)
470 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
471 return df
472
473 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000474 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
475 """
476 Test Method:
477 0. Make sure that voltha is up and running on CORD-POD setup.
478 1. OLT and ONU is detected and validated.
479 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
480 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
481 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
482 5. Verify that subscriber authentication is unsuccessful..
483 """
Thangavelu K S0d745c82017-06-09 21:56:08 +0000484 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000485 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +0000486 aaa_app = ["org.opencord.aaa"]
487 log_test.info('Enabling ponsim_olt')
488 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
489 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
490 assert_not_equal(device_id, None)
491 voltha = VolthaCtrl(self.VOLTHA_HOST,
492 rest_port = self.VOLTHA_REST_PORT,
493 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
494 time.sleep(10)
495 switch_map = None
496 olt_configured = False
497 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
498 log_test.info('Installing OLT app')
499 OnosCtrl.install_app(self.olt_app_file)
500 time.sleep(5)
501 log_test.info('Adding subscribers through OLT app')
502 self.config_olt(switch_map)
503 olt_configured = True
504 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000505
Thangavelu K S0d745c82017-06-09 21:56:08 +0000506 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
507 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
508 thread1.start()
509 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000510 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +0000511 thread2.start()
512 time.sleep(10)
513 thread1.join()
514 thread2.join()
515 try:
516 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000517 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000518 time.sleep(10)
519 finally:
520 self.voltha.disable_device(device_id, delete = True)
521 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000522 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000523 return df
524
525 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000526 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
527 """
528 Test Method:
529 0. Make sure that voltha is up and running on CORD-POD setup.
530 1. OLT and ONU is detected and validated.
531 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
532 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
533 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
534 5. Verify that subscriber authentication is unsuccessful..
535 """
Thangavelu K S0d745c82017-06-09 21:56:08 +0000536 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000537 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +0000538 aaa_app = ["org.opencord.aaa"]
539 log_test.info('Enabling ponsim_olt')
540 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
541 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
542 assert_not_equal(device_id, None)
543 voltha = VolthaCtrl(self.VOLTHA_HOST,
544 rest_port = self.VOLTHA_REST_PORT,
545 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
546 time.sleep(10)
547 switch_map = None
548 olt_configured = False
549 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
550 log_test.info('Installing OLT app')
551 OnosCtrl.install_app(self.olt_app_file)
552 time.sleep(5)
553 log_test.info('Adding subscribers through OLT app')
554 self.config_olt(switch_map)
555 olt_configured = True
556 time.sleep(5)
557
558 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
559 thread2 = threading.Thread(target = cord_test_radius_restart)
560 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000561 time.sleep(randint(1,2))
562 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +0000563 thread2.start()
564 time.sleep(10)
565 thread1.join()
566 thread2.join()
567 try:
568 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000569 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000570 time.sleep(10)
571 finally:
572 self.voltha.disable_device(device_id, delete = True)
573 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000574 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000575 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000576
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000577 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000578 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
579 """
580 Test Method:
581 0. Make sure that voltha is up and running on CORD-POD setup.
582 1. OLT and ONU is detected and validated.
583 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
584 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
585 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
586 6. Verify that subscriber authenticated successfully.
587 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
588 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
589 9. Verify that subscriber authentication is unsuccessful..
590 """
Thangavelu K S0d745c82017-06-09 21:56:08 +0000591 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000592 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +0000593 aaa_app = ["org.opencord.aaa"]
594 log_test.info('Enabling ponsim_olt')
595 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
596 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
597 assert_not_equal(device_id, None)
598 voltha = VolthaCtrl(self.VOLTHA_HOST,
599 rest_port = self.VOLTHA_REST_PORT,
600 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
601 time.sleep(10)
602 switch_map = None
603 olt_configured = False
604 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
605 log_test.info('Installing OLT app')
606 OnosCtrl.install_app(self.olt_app_file)
607 time.sleep(5)
608 log_test.info('Adding subscribers through OLT app')
609 self.config_olt(switch_map)
610 olt_configured = True
611 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000612
Thangavelu K S0d745c82017-06-09 21:56:08 +0000613 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
614 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,))
615 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000616 time.sleep(randint(1,2))
617 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +0000618 thread2.start()
619 time.sleep(10)
620 thread1.join()
621 thread2.join()
622 try:
623 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000624 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000625 time.sleep(10)
626 finally:
627 self.voltha.disable_device(device_id, delete = True)
628 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000629 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000630 return df
631
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000632 @deferred(TESTCASE_TIMEOUT)
633 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +0000634 """
635 Test Method:
636 0. Make sure that voltha is up and running on CORD-POD setup.
637 1. OLT and ONU is detected and validated.
638 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
639 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
640 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
641 6. Verify that subscriber authenticated successfully.
642 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
643 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
644 9. Verify that subscriber authentication is unsuccessful..
645 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000646 df = defer.Deferred()
647 def tls_flow_check_operating_olt_state(df):
648 aaa_app = ["org.opencord.aaa"]
649 log_test.info('Enabling ponsim_olt')
650 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
651 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
652 assert_not_equal(device_id, None)
653 voltha = VolthaCtrl(self.VOLTHA_HOST,
654 rest_port = self.VOLTHA_REST_PORT,
655 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
656 time.sleep(10)
657 switch_map = None
658 olt_configured = False
659 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
660 log_test.info('Installing OLT app')
661 OnosCtrl.install_app(self.olt_app_file)
662 time.sleep(5)
663 log_test.info('Adding subscribers through OLT app')
664 self.config_olt(switch_map)
665 olt_configured = True
666 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000667
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000668 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
669 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
670 thread1.start()
671 time.sleep(randint(1,2))
672 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
673 thread2.start()
674 time.sleep(10)
675 thread1.join()
676 thread2.join()
677 try:
678 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000679 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000680 time.sleep(10)
681 finally:
682 self.voltha.disable_device(device_id, delete = True)
683 df.callback(0)
684 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
685 return df
686
687 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000688 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
689 """
690 Test Method:
691 0. Make sure that voltha is up and running on CORD-POD setup.
692 1. OLT and ONU is detected and validated.
693 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
694 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
695 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
696 6. Verify that subscriber authenticated successfully.
697 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
698 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
699 9. Verify that subscriber authentication is unsuccessful..
700 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000701 df = defer.Deferred()
702 def tls_flow_check_operating_olt_state(df):
703 aaa_app = ["org.opencord.aaa"]
704 log_test.info('Enabling ponsim_olt')
705 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
706 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
707 assert_not_equal(device_id, None)
708 voltha = VolthaCtrl(self.VOLTHA_HOST,
709 rest_port = self.VOLTHA_REST_PORT,
710 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
711 time.sleep(10)
712 switch_map = None
713 olt_configured = False
714 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
715 log_test.info('Installing OLT app')
716 OnosCtrl.install_app(self.olt_app_file)
717 time.sleep(5)
718 log_test.info('Adding subscribers through OLT app')
719 self.config_olt(switch_map)
720 olt_configured = True
721 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000722
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000723 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
724 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
725 thread1.start()
726 time.sleep(randint(1,2))
727 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
728 thread2.start()
729 time.sleep(10)
730 thread1.join()
731 thread2.join()
732 try:
733 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000734 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000735 time.sleep(10)
736 finally:
737 self.voltha.disable_device(device_id, delete = True)
738 df.callback(0)
739 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
740 return df
741
742 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000743 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
744 """
745 Test Method:
746 0. Make sure that voltha is up and running on CORD-POD setup.
747 1. OLT and ONU is detected and validated.
748 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
749 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
750 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
751 6. Verify that subscriber authenticated successfully.
752 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
753 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
754 9. Verify that subscriber authentication is unsuccessful..
755 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000756 df = defer.Deferred()
757 def tls_flow_check_operating_olt_state(df):
758 aaa_app = ["org.opencord.aaa"]
759 log_test.info('Enabling ponsim_olt')
760 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
761 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
762 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000763 log_test.info('All available devices on voltha = %s'%devices_list['items'])
764
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000765 onu_device_id = devices_list['items'][1]['id']
766 assert_not_equal(device_id, None)
767 voltha = VolthaCtrl(self.VOLTHA_HOST,
768 rest_port = self.VOLTHA_REST_PORT,
769 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
770 time.sleep(10)
771 switch_map = None
772 olt_configured = False
773 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
774 log_test.info('Installing OLT app')
775 OnosCtrl.install_app(self.olt_app_file)
776 time.sleep(5)
777 log_test.info('Adding subscribers through OLT app')
778 self.config_olt(switch_map)
779 olt_configured = True
780 time.sleep(5)
781 devices_list = self.voltha.get_devices()
782 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
783 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
784 thread1.start()
785 time.sleep(randint(1,2))
786 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
787 thread2.start()
788 time.sleep(10)
789 thread1.join()
790 thread2.join()
791 try:
792 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000793 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000794 time.sleep(10)
795 finally:
796 self.voltha.disable_device(device_id, delete = True)
797 df.callback(0)
798 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
799 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000800
Thangavelu K S9648eed2017-06-13 20:15:25 +0000801 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000802 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
803 """
804 Test Method:
805 0. Make sure that voltha is up and running on CORD-POD setup.
806 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
807 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
808 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
809 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
810 5. Verify that two subscribers are authenticated successfully.
811 """
812
Thangavelu K S9648eed2017-06-13 20:15:25 +0000813 df = defer.Deferred()
814 def tls_flow_check_on_two_subscriber_same_olt_device(df):
815 aaa_app = ["org.opencord.aaa"]
816 log_test.info('Enabling ponsim_olt')
817 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
818 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
819 devices_list = self.voltha.get_devices()
820 log_test.info('All available devices on voltha = %s'%devices_list['items'])
821
822 onu_device_id = devices_list['items'][1]['id']
823 assert_not_equal(device_id, None)
824 voltha = VolthaCtrl(self.VOLTHA_HOST,
825 rest_port = self.VOLTHA_REST_PORT,
826 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
827 time.sleep(10)
828 switch_map = None
829 olt_configured = False
830 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
831 log_test.info('Installing OLT app')
832 OnosCtrl.install_app(self.olt_app_file)
833 time.sleep(5)
834 log_test.info('Adding subscribers through OLT app')
835 self.config_olt(switch_map)
836 olt_configured = True
837 time.sleep(5)
838 devices_list = self.voltha.get_devices()
839 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
840 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
841 thread1.start()
842 time.sleep(randint(1,2))
843 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
844 thread2.start()
845 time.sleep(10)
846 thread1.join()
847 thread2.join()
848 try:
849 # assert_equal(status, True)
850 assert_equal(self.success, True)
851 time.sleep(10)
852 finally:
853 self.voltha.disable_device(device_id, delete = True)
854 df.callback(0)
855 reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df)
856 return df
857
858 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000859 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
860 """
861 Test Method:
862 0. Make sure that voltha is up and running on CORD-POD setup.
863 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
864 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
865 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
866 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
867 5. Verify that two subscribers are not authenticated.
868 """
869
Thangavelu K S9648eed2017-06-13 20:15:25 +0000870 df = defer.Deferred()
871 def tls_flow_check_on_two_subscriber_same_olt_device(df):
872 aaa_app = ["org.opencord.aaa"]
873 log_test.info('Enabling ponsim_olt')
874 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
875 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
876 devices_list = self.voltha.get_devices()
877 log_test.info('All available devices on voltha = %s'%devices_list['items'])
878
879 onu_device_id = devices_list['items'][1]['id']
880 assert_not_equal(device_id, None)
881 voltha = VolthaCtrl(self.VOLTHA_HOST,
882 rest_port = self.VOLTHA_REST_PORT,
883 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
884 time.sleep(10)
885 switch_map = None
886 olt_configured = False
887 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
888 log_test.info('Installing OLT app')
889 OnosCtrl.install_app(self.olt_app_file)
890 time.sleep(5)
891 log_test.info('Adding subscribers through OLT app')
892 self.config_olt(switch_map)
893 olt_configured = True
894 time.sleep(5)
895 devices_list = self.voltha.get_devices()
896 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
897 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
898 thread1.start()
899 time.sleep(randint(1,2))
900 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
901 thread2.start()
902 time.sleep(10)
903 thread1.join()
904 thread2.join()
905 try:
906 # assert_equal(status, True)
907 assert_equal(self.success, True)
908 time.sleep(10)
909 finally:
910 self.voltha.disable_device(device_id, delete = True)
911 df.callback(0)
912 reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df)
913 return df
914
Thangavelu K S008f38e2017-05-15 19:36:55 +0000915 def test_two_subscribers_with_voltha_for_eap_tls_authentication_initiating_invalid_tls_packets_for_one_subscriber(self):
916 """
917 Test Method:
918 0. Make sure that voltha is up and running on CORD-POD setup.
919 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
920 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
921 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
922 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
923 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
924 6. Verify that valid subscriber authenticated successfully.
925 7. Verify that invalid subscriber are not authenticated successfully.
926 """
927
928 def test_two_subscribers_with_voltha_for_eap_tls_authentication_initiating_invalid_cert_for_one_subscriber(self):
929 """
930 Test Method:
931 0. Make sure that voltha is up and running on CORD-POD setup.
932 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
933 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
934 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
935 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
936 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
937 6. Verify that valid subscriber authenticated successfully.
938 7. Verify that invalid subscriber are not authenticated successfully.
939 """
940
941 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
942 """
943 Test Method:
944 0. Make sure that voltha is up and running on CORD-POD setup.
945 1. OLT and ONU is detected and validated.
946 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
947 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
948 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
949 6. Verify that subscriber authenticated successfully.
950 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
951 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
952 9. Verify that subscriber authentication is unsuccessful..
953 10. Verify that other subscriber authenticated successfully.
954 """
955
956 def test_subscriber_with_voltha_for_dhcp_request(self):
957 """
958 Test Method:
959 0. Make sure that voltha is up and running on CORD-POD setup.
960 1. OLT and ONU is detected and validated.
961 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
962 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
963 4. Verify that subscriber get ip from dhcp server successfully.
964 """
965
966 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
967 """
968 Test Method:
969 0. Make sure that voltha is up and running on CORD-POD setup.
970 1. OLT and ONU is detected and validated.
971 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
972 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
973 4. Verify that subscriber should not get ip from dhcp server.
974 """
975
976 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
977 """
978 Test Method:
979 0. Make sure that voltha is up and running on CORD-POD setup.
980 1. OLT and ONU is detected and validated.
981 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
982 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
983 4. Verify that subscriber should not get ip from dhcp server.
984 """
985
986 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
987 """
988 Test Method:
989 0. Make sure that voltha is up and running on CORD-POD setup.
990 1. OLT and ONU is detected and validated.
991 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
992 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
993 4. Verify that subscriber should not get ip from dhcp server.
994 """
995
996 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
997 """
998 Test Method:
999 0. Make sure that voltha is up and running on CORD-POD setup.
1000 1. OLT and ONU is detected and validated.
1001 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1002 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
1003 4. Verify that subscriber get ip from dhcp server successfully.
1004 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
1005 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
1006 """
1007
A.R Karthick57fa9372017-05-24 12:47:03 -07001008 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00001009 """
1010 Test Method:
1011 0. Make sure that voltha is up and running on CORD-POD setup.
1012 1. OLT and ONU is detected and validated.
1013 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1014 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1015 4. Verify that subscriber get ip from dhcp server successfully.
1016 5. Repeat step 3 and 4 for 10 times.
1017 6 Verify that subscriber should get ip from dhcp server.
1018 """
1019
1020 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
1021 """
1022 Test Method:
1023 0. Make sure that voltha is up and running on CORD-POD setup.
1024 1. OLT and ONU is detected and validated.
1025 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1026 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
1027 4. Verify that subscriber should not get ip from dhcp server.
1028 5. Repeat steps 3 and 4 for 10 times.
1029 6 Verify that subscriber should not get ip from dhcp server.
1030 """
1031 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
1032 """
1033 Test Method:
1034 0. Make sure that voltha is up and running on CORD-POD setup.
1035 1. OLT and ONU is detected and validated.
1036 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1037 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1038 4. Verify that subscriber get ip from dhcp server successfully.
1039 5. Repeat step 3 for 50 times.
1040 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
1041 """
1042 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
1043 """
1044 Test Method:
1045 0. Make sure that voltha is up and running on CORD-POD setup.
1046 1. OLT and ONU is detected and validated.
1047 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1048 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1049 4. Verify that subscriber get ip from dhcp server successfully.
1050 5. Send DHCP request to dhcp server which is running as onos app.
1051 6. Repeat step 5 for 50 times.
1052 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
1053 """
1054
1055 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
1056 """
1057 Test Method:
1058 0. Make sure that voltha is up and running on CORD-POD setup.
1059 1. OLT and ONU is detected and validated.
1060 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1061 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
1062 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
1063 """
1064
1065 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_pool_ip_address(self):
1066 """
1067 Test Method:
1068 0. Make sure that voltha is up and running on CORD-POD setup.
1069 1. OLT and ONU is detected and validated.
1070 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1071 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
1072 4. Verify that subscriber should not get ip which was requested in step 3 from dhcp server, and its offered only within dhcp pool of ip.
1073 """
1074 def test_subscriber_with_voltha_for_dhcp_deactivate_dhcp_app_in_onos(self):
1075 """
1076 Test Method:
1077 0. Make sure that voltha is up and running on CORD-POD setup.
1078 1. OLT and ONU is detected and validated.
1079 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1080 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1081 4. Verify that subscriber get ip from dhcp server successfully.
1082 5. Deactivate dhcp server app in onos.
1083 6. Repeat step 3.
1084 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
1085 """
1086 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
1087 """
1088 Test Method:
1089 0. Make sure that voltha is up and running on CORD-POD setup.
1090 1. OLT and ONU is detected and validated.
1091 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1092 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1093 4. Verify that subscriber get ip from dhcp server successfully.
1094 5. Send dhcp renew packet to dhcp server which is running as onos app.
1095 6. Repeat step 4.
1096 """
1097 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
1098 """
1099 Test Method:
1100 0. Make sure that voltha is up and running on CORD-POD setup.
1101 1. OLT and ONU is detected and validated.
1102 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1103 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1104 4. Verify that subscriber get ip from dhcp server successfully.
1105 5. Send dhcp rebind packet to dhcp server which is running as onos app.
1106 6. Repeat step 4.
1107 """
1108 def test_subscriber_with_voltha_for_dhcp_disable_olt_in_voltha(self):
1109 """
1110 Test Method:
1111 0. Make sure that voltha is up and running on CORD-POD setup.
1112 1. OLT and ONU is detected and validated.
1113 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1114 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1115 4. Verify that subscriber get ip from dhcp server successfully.
1116 5. Disable olt devices which is being detected in voltha CLI.
1117 6. Repeat step 3.
1118 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
1119 """
1120 def test_subscriber_with_voltha_for_dhcp_disable_enable_olt_in_voltha(self):
1121 """
1122 Test Method:
1123 0. Make sure that voltha is up and running on CORD-POD setup.
1124 1. OLT and ONU is detected and validated.
1125 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1126 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1127 4. Verify that subscriber get ip from dhcp server successfully.
1128 5. Disable olt devices which is being detected in voltha CLI.
1129 6. Repeat step 3.
1130 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
1131 8. Enable olt devices which is being detected in voltha CLI.
1132 9. Repeat steps 3 and 4.
1133 """
1134 def test_subscriber_with_voltha_for_dhcp_disable_onu_port_in_voltha(self):
1135 """
1136 Test Method:
1137 0. Make sure that voltha is up and running on CORD-POD setup.
1138 1. OLT and ONU is detected and validated.
1139 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1140 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1141 4. Verify that subscriber get ip from dhcp server successfully.
1142 5. Disable onu port which is being detected in voltha CLI.
1143 6. Repeat step 3.
1144 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
1145 """
1146 def test_subscriber_with_voltha_for_dhcp_disable_enable_onu_port_in_voltha(self):
1147 """
1148 Test Method:
1149 0. Make sure that voltha is up and running on CORD-POD setup.
1150 1. OLT and ONU is detected and validated.
1151 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1152 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1153 4. Verify that subscriber get ip from dhcp server successfully.
1154 5. Disable onu port which is being detected in voltha CLI.
1155 6. Repeat step 3.
1156 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
1157 8. Enable onu port which is being detected in voltha CLI.
1158 9. Repeat steps 3 and 4.
1159 """
1160
1161 def test_two_subscriber_with_voltha_for_dhcp_discover(self):
1162 """
1163 Test Method:
1164 0. Make sure that voltha is up and running on CORD-POD setup.
1165 1. OLT and ONU is detected and validated.
1166 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1167 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
1168 4. Verify that subscribers had got different ips from dhcp server successfully.
1169 """
1170
1171 def test_two_subscriber_with_voltha_for_dhcp_multiple_discover(self):
1172 """
1173 Test Method:
1174 0. Make sure that voltha is up and running on CORD-POD setup.
1175 1. OLT and ONU is detected and validated.
1176 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1177 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
1178 4. Verify that subscribers had got ip from dhcp server successfully.
1179 5. Repeat step 3 and 4 for 10 times for both subscribers.
1180 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
1181 """
1182 def test_two_subscriber_with_voltha_for_dhcp_multiple_discover_for_one_subscriber(self):
1183 """
1184 Test Method:
1185 0. Make sure that voltha is up and running on CORD-POD setup.
1186 1. OLT and ONU is detected and validated.
1187 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1188 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
1189 4. Verify that subscribers had got ip from dhcp server successfully.
1190 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
1191 6 Verify that subscriber should get same ip which is offered the first time from dhcp server and other subscriber ping to gateway should not failed
1192 """
1193 def test_two_subscriber_with_voltha_for_dhcp_discover_desired_ip_address_for_one_subscriber(self):
1194 """
1195 Test Method:
1196 0. Make sure that voltha is up and running on CORD-POD setup.
1197 1. OLT and ONU is detected and validated.
1198 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1199 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
1200 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
1201 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
1202 """
1203 def test_two_subscriber_with_voltha_for_dhcp_discover_within_and_wothout_dhcp_pool_ip_addresses(self):
1204 """
1205 Test Method:
1206 0. Make sure that voltha is up and running on CORD-POD setup.
1207 1. OLT and ONU is detected and validated.
1208 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1209 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
1210 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
1211 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
1212 """
1213 def test_two_subscriber_with_voltha_for_dhcp_disable_onu_port_for_one_subscriber(self):
1214 """
1215 Test Method:
1216 0. Make sure that voltha is up and running on CORD-POD setup.
1217 1. OLT and ONU is detected and validated.
1218 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1219 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
1220 4. Verify that subscribers had got ip from dhcp server successfully.
1221 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
1222 6. Repeat step 3 and 4 for one subscriber where uni port is down.
1223 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
1224 """
1225 def test_two_subscriber_with_voltha_for_dhcp_disable_enable_onu_port_for_one_subscriber(self):
1226 """
1227 Test Method:
1228 0. Make sure that voltha is up and running on CORD-POD setup.
1229 1. OLT and ONU is detected and validated.
1230 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1231 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
1232 4. Verify that subscribers had got ip from dhcp server successfully.
1233 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
1234 6. Repeat step 3 and 4 for one subscriber where uni port is down.
1235 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
1236 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
1237 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
1238 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
1239 """
1240 def test_two_subscriber_with_voltha_for_dhcp_disable_olt_detected_in_voltha(self):
1241 """
1242 Test Method:
1243 0. Make sure that voltha is up and running on CORD-POD setup.
1244 1. OLT and ONU is detected and validated.
1245 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1246 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
1247 4. Verify that subscribers had got ip from dhcp server successfully.
1248 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
1249 6. Disable the olt device which is detected in voltha.
1250 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
1251 """
1252 def test_two_subscriber_with_voltha_for_dhcp_disable_enable_olt_detected_in_voltha(self):
1253 """
1254 Test Method:
1255 0. Make sure that voltha is up and running on CORD-POD setup.
1256 1. OLT and ONU is detected and validated.
1257 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1258 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
1259 4. Verify that subscribers had got ip from dhcp server successfully.
1260 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
1261 6. Disable the olt device which is detected in voltha.
1262 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
1263 8. Enable the olt device which is detected in voltha.
1264 9. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
1265 """
1266 def test_two_subscriber_with_voltha_for_dhcp_pause_olt_detected_in_voltha(self):
1267 """
1268 Test Method:
1269 0. Make sure that voltha is up and running on CORD-POD setup.
1270 1. OLT and ONU is detected and validated.
1271 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1272 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
1273 4. Verify that subscribers had got ip from dhcp server successfully.
1274 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
1275 6. Pause the olt device which is detected in voltha.
1276 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
1277 """
1278 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request(self):
1279 """
1280 Test Method:
1281 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1282 1. OLT and ONU is detected and validated.
1283 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1284 3. Send dhcp request from residential subscrber to external dhcp server.
1285 4. Verify that subscriber get ip from external dhcp server successfully.
1286 """
1287
1288 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_broadcast_source_mac(self):
1289 """
1290 Test Method:
1291 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
1292 1. OLT and ONU is detected and validated.
1293 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1294 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
1295 4. Verify that subscriber should not get ip from external dhcp server.
1296 """
1297
1298 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_multicast_source_mac(self):
1299 """
1300 Test Method:
1301 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
1302 1. OLT and ONU is detected and validated.
1303 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1304 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
1305 4. Verify that subscriber should not get ip from external dhcp server.
1306 """
1307
1308 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_source_mac(self):
1309 """
1310 Test Method:
1311 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1312 1. OLT and ONU is detected and validated.
1313 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1314 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
1315 4. Verify that subscriber should not get ip from external dhcp server.
1316 """
1317
1318 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_and_release(self):
1319 """
1320 Test Method:
1321 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1322 1. OLT and ONU is detected and validated.
1323 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1324 3. Send dhcp request from residential subscrber to external dhcp server.
1325 4. Verify that subscriber get ip from external dhcp server successfully.
1326 5. Send dhcp release from residential subscrber to external dhcp server.
1327 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
1328 """
1329
1330 def test_subscriber_with_voltha_for_dhcpRelay_starvation(self):
1331 """
1332 Test Method:
1333 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1334 1. OLT and ONU is detected and validated.
1335 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1336 3. Send dhcp request from residential subscriber to external dhcp server.
1337 4. Verify that subscriber get ip from external dhcp server. successfully.
1338 5. Repeat step 3 and 4 for 10 times.
1339 6 Verify that subscriber should get ip from external dhcp server..
1340 """
1341
1342 def test_subscriber_with_voltha_for_dhcpRelay_starvation_negative_scenario(self):
1343 """
1344 Test Method:
1345 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1346 1. OLT and ONU is detected and validated.
1347 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1348 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
1349 4. Verify that subscriber should not get ip from external dhcp server..
1350 5. Repeat steps 3 and 4 for 10 times.
1351 6 Verify that subscriber should not get ip from external dhcp server..
1352 """
1353 def test_subscriber_with_voltha_for_dhcpRelay_sending_multiple_discover(self):
1354 """
1355 Test Method:
1356 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1357 1. OLT and ONU is detected and validated.
1358 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1359 3. Send dhcp request from residential subscriber to external dhcp server.
1360 4. Verify that subscriber get ip from external dhcp server. successfully.
1361 5. Repeat step 3 for 50 times.
1362 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
1363 """
1364 def test_subscriber_with_voltha_for_dhcpRelay_sending_multiple_request(self):
1365 """
1366 Test Method:
1367 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1368 1. OLT and ONU is detected and validated.
1369 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1370 3. Send dhcp request from residential subscriber to external dhcp server.
1371 4. Verify that subscriber get ip from external dhcp server. successfully.
1372 5. Send DHCP request to external dhcp server.
1373 6. Repeat step 5 for 50 times.
1374 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
1375 """
1376
1377 def test_subscriber_with_voltha_for_dhcpRelay_requesting_desired_ip_address(self):
1378 """
1379 Test Method:
1380 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1381 1. OLT and ONU is detected and validated.
1382 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1383 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
1384 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
1385 """
1386
1387 def test_subscriber_with_voltha_for_dhcpRelay_requesting_desired_out_of_pool_ip_address(self):
1388 """
1389 Test Method:
1390 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1391 1. OLT and ONU is detected and validated.
1392 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1393 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
1394 4. Verify that subscriber should not get ip which was requested in step 3 from external dhcp server., and its offered only within dhcp pool of ip.
1395 """
1396
1397 def test_subscriber_with_voltha_for_dhcpRelay_deactivating_dhcpRelay_app_in_onos(self):
1398 """
1399 Test Method:
1400 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1401 1. OLT and ONU is detected and validated.
1402 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1403 3. Send dhcp request from residential subscriber to external dhcp server.
1404 4. Verify that subscriber get ip from external dhcp server. successfully.
1405 5. Deactivate dhcp server app in onos.
1406 6. Repeat step 3.
1407 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
1408 """
1409
1410 def test_subscriber_with_voltha_for_dhcpRelay_renew_time(self):
1411 """
1412 Test Method:
1413 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1414 1. OLT and ONU is detected and validated.
1415 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1416 3. Send dhcp request from residential subscriber to external dhcp server.
1417 4. Verify that subscriber get ip from external dhcp server. successfully.
1418 5. Send dhcp renew packet to external dhcp server.
1419 6. Repeat step 4.
1420 """
1421
1422 def test_subscriber_with_voltha_for_dhcpRelay_rebind_time(self):
1423 """
1424 Test Method:
1425 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1426 1. OLT and ONU is detected and validated.
1427 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1428 3. Send dhcp request from residential subscriber to external dhcp server.
1429 4. Verify that subscriber get ip from external dhcp server. successfully.
1430 5. Send dhcp rebind packet to external dhcp server.
1431 6. Repeat step 4.
1432 """
1433
1434 def test_subscriber_with_voltha_for_dhcpRelay_disable_olt_in_voltha(self):
1435 """
1436 Test Method:
1437 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1438 1. OLT and ONU is detected and validated.
1439 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1440 3. Send dhcp request from residential subscriber to external dhcp server.
1441 4. Verify that subscriber get ip from external dhcp server. successfully.
1442 5. Disable olt devices which is being detected in voltha CLI.
1443 6. Repeat step 3.
1444 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
1445 """
1446
1447 def test_subscriber_with_voltha_for_dhcpRelay_toggling_olt_in_voltha(self):
1448 """
1449 Test Method:
1450 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1451 1. OLT and ONU is detected and validated.
1452 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1453 3. Send dhcp request from residential subscriber to external dhcp server.
1454 4. Verify that subscriber get ip from external dhcp server. successfully.
1455 5. Disable olt devices which is being detected in voltha CLI.
1456 6. Repeat step 3.
1457 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
1458 8. Enable olt devices which is being detected in voltha CLI.
1459 9. Repeat steps 3 and 4.
1460 """
1461
1462 def test_subscriber_with_voltha_for_dhcpRelay_disable_onu_port_in_voltha(self):
1463 """
1464 Test Method:
1465 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1466 1. OLT and ONU is detected and validated.
1467 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1468 3. Send dhcp request from residential subscriber to external dhcp server.
1469 4. Verify that subscriber get ip from external dhcp server. successfully.
1470 5. Disable onu port which is being detected in voltha CLI.
1471 6. Repeat step 3.
1472 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
1473 """
1474
1475 def test_subscriber_with_voltha_for_dhcpRelay_disable_enable_onu_port_in_voltha(self):
1476 """
1477 Test Method:
1478 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1479 1. OLT and ONU is detected and validated.
1480 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1481 3. Send dhcp request from residential subscriber to external dhcp server.
1482 4. Verify that subscriber get ip from external dhcp server. successfully.
1483 5. Disable onu port which is being detected in voltha CLI.
1484 6. Repeat step 3.
1485 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
1486 8. Enable onu port which is being detected in voltha CLI.
1487 9. Repeat steps 3 and 4.
1488 """
1489
1490 def test_two_subscriber_with_voltha_for_dhcpRelay_discover(self):
1491 """
1492 Test Method:
1493 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1494 1. OLT and ONU is detected and validated.
1495 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1496 3. Send dhcp request from two residential subscribers to external dhcp server.
1497 4. Verify that subscribers had got different ips from external dhcp server. successfully.
1498 """
1499
1500 def test_two_subscriber_with_voltha_for_dhcpRelay_multiple_discover(self):
1501 """
1502 Test Method:
1503 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1504 1. OLT and ONU is detected and validated.
1505 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1506 3. Send dhcp request from two residential subscribers to external dhcp server.
1507 4. Verify that subscribers had got ip from external dhcp server. successfully.
1508 5. Repeat step 3 and 4 for 10 times for both subscribers.
1509 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
1510 """
1511
1512 def test_two_subscriber_with_voltha_for_dhcpRelay_multiple_discover_for_one_subscriber(self):
1513 """
1514 Test Method:
1515 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1516 1. OLT and ONU is detected and validated.
1517 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1518 3. Send dhcp request from two residential subscribers to external dhcp server.
1519 4. Verify that subscribers had got ip from external dhcp server. successfully.
1520 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
1521 6 Verify that subscriber should get same ip which is offered the first time from external dhcp server. and other subscriber ping to gateway should not failed
1522 """
1523
1524 def test_two_subscriber_with_voltha_for_dhcpRelay_discover_desired_ip_address_for_one_subscriber(self):
1525 """
1526 Test Method:
1527 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1528 1. OLT and ONU is detected and validated.
1529 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1530 3. Send dhcp request from one residential subscriber to external dhcp server.
1531 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
1532 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
1533 """
1534
1535 def test_two_subscriber_with_voltha_for_dhcpRelay_discover_in_range_and_out_of_range_from_dhcp_pool_ip_addresses(self):
1536 """
1537 Test Method:
1538 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1539 1. OLT and ONU is detected and validated.
1540 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1541 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
1542 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
1543 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
1544 """
1545
1546 def test_two_subscriber_with_voltha_for_dhcpRelay_disable_onu_port_for_one_subscriber(self):
1547 """
1548 Test Method:
1549 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1550 1. OLT and ONU is detected and validated.
1551 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1552 3. Send dhcp request from two residential subscribers to external dhcp server.
1553 4. Verify that subscribers had got ip from external dhcp server. successfully.
1554 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
1555 6. Repeat step 3 and 4 for one subscriber where uni port is down.
1556 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
1557 """
1558
1559 def test_two_subscriber_with_voltha_for_dhcpRelay_toggle_onu_port_for_one_subscriber(self):
1560 """
1561 Test Method:
1562 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1563 1. OLT and ONU is detected and validated.
1564 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1565 3. Send dhcp request from two residential subscribers to external dhcp server.
1566 4. Verify that subscribers had got ip from external dhcp server. successfully.
1567 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
1568 6. Repeat step 3 and 4 for one subscriber where uni port is down.
1569 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
1570 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
1571 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
1572 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
1573 """
1574
1575 def test_two_subscriber_with_voltha_for_dhcpRelay_disable_olt_detected_in_voltha(self):
1576 """
1577 Test Method:
1578 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1579 1. OLT and ONU is detected and validated.
1580 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1581 3. Send dhcp request from two residential subscribers to external dhcp server.
1582 4. Verify that subscribers had got ip from external dhcp server. successfully.
1583 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
1584 6. Disable the olt device which is detected in voltha.
1585 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
1586 """
1587
1588 def test_two_subscriber_with_voltha_for_dhcpRelay_toggle_olt_detected_in_voltha(self):
1589 """
1590 Test Method:
1591 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1592 1. OLT and ONU is detected and validated.
1593 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1594 3. Send dhcp request from two residential subscribers to external dhcp server.
1595 4. Verify that subscribers had got ip from external dhcp server. successfully.
1596 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
1597 6. Disable the olt device which is detected in voltha.
1598 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
1599 8. Enable the olt device which is detected in voltha.
1600 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
1601 """
1602
1603 def test_two_subscriber_with_voltha_for_dhcpRelay_pause_olt_detected_in_voltha(self):
1604 """
1605 Test Method:
1606 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
1607 1. OLT and ONU is detected and validated.
1608 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1609 3. Send dhcp request from two residential subscribers to external dhcp server.
1610 4. Verify that subscribers had got ip from external dhcp server. successfully.
1611 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
1612 6. Pause the olt device which is detected in voltha.
1613 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
1614 """