blob: 58648cadb8b334e6874b837f4bfbe721f5068e63 [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
Thangavelu K Sa1c71b42017-06-14 18:13:21 +000020from DHCP import DHCPTest
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000021from OnosCtrl import OnosCtrl
22from CordLogger import CordLogger
23from scapy.all import *
24from scapy_ssl_tls.ssl_tls import *
25from scapy_ssl_tls.ssl_tls_crypto import *
26from CordTestServer import cord_test_onos_restart, cord_test_shell, cord_test_radius_restart
A.R Karthickb9eab5a2017-06-07 16:03:51 -070027from CordContainer import Onos
A R Karthick35495c32017-05-11 14:58:32 -070028
29class voltha_exchange(unittest.TestCase):
30
31 OLT_TYPE = 'tibit_olt'
32 OLT_MAC = '00:0c:e2:31:12:00'
33 VOLTHA_HOST = 'localhost'
34 VOLTHA_REST_PORT = 8881
35 voltha = None
Thangavelu K S9648eed2017-06-13 20:15:25 +000036 success = True
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000037 apps = ('org.opencord.aaa', 'org.onosproject.dhcp')
38 olt_apps = () #'org.opencord.cordmcast')
39 vtn_app = 'org.opencord.vtn'
40 table_app = 'org.ciena.cordigmp'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000041 test_path = os.path.dirname(os.path.realpath(__file__))
42 table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
A.R Karthickb9eab5a2017-06-07 16:03:51 -070043 app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000044 olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar')
A.R Karthick3493a572017-06-07 18:28:10 -070045 olt_app_name = 'org.onosproject.olt'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000046 #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
47 olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
48 onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
49 VOLTHA_ENABLED = True
50 INTF_TX_DEFAULT = 'veth2'
51 INTF_RX_DEFAULT = 'veth0'
Thangavelu K S9648eed2017-06-13 20:15:25 +000052 INTF_2_RX_DEFAULT = 'veth6'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000053 TESTCASE_TIMEOUT = 300
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +000054# VOLTHA_CONFIG_FAKE = True
55 VOLTHA_CONFIG_FAKE = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000056 VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
57 VOLTHA_ONU_UNI_PORT = 'veth0'
58
Thangavelu K Sa1c71b42017-06-14 18:13:21 +000059 dhcp_server_config = {
60 "ip": "10.1.11.50",
61 "mac": "ca:fe:ca:fe:ca:fe",
62 "subnet": "255.255.252.0",
63 "broadcast": "10.1.11.255",
64 "router": "10.1.8.1",
65 "domain": "8.8.8.8",
66 "ttl": "63",
67 "delay": "2",
68 "startip": "10.1.11.51",
69 "endip": "10.1.11.100"
70 }
71
72
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000073 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
74MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
75CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
76IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
77RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
78MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
79BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
80hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
81gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
82+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
83rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
84VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
85eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
866tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
87PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
88nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
89-----END CERTIFICATE-----"""
90
91 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
92MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
93CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
94IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
95RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
96MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
97BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
98hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
99AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
1005An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
101tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
102OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
103qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
1042Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
105BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
106eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
107MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
108VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
109RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
110dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
111T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
112yg==
113-----END CERTIFICATE-----'''
A R Karthick35495c32017-05-11 14:58:32 -0700114
A.R Karthick3493a572017-06-07 18:28:10 -0700115 @classmethod
116 def update_apps_version(cls):
117 version = Onos.getVersion()
118 major = int(version.split('.')[0])
119 minor = int(version.split('.')[1])
120 cordigmp_app_version = '2.0-SNAPSHOT'
121 olt_app_version = '1.2-SNAPSHOT'
122 if major > 1:
123 cordigmp_app_version = '3.0-SNAPSHOT'
124 olt_app_version = '2.0-SNAPSHOT'
125 elif major == 1:
126 if minor > 10:
127 cordigmp_app_version = '3.0-SNAPSHOT'
128 olt_app_version = '2.0-SNAPSHOT'
129 elif minor <= 8:
130 olt_app_version = '1.1-SNAPSHOT'
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700131 cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version))
132 cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version))
133 cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
134
A R Karthick35495c32017-05-11 14:58:32 -0700135 @classmethod
A.R Karthickf874d032017-06-07 18:47:51 -0700136 def onos_load_config(cls, app, config):
137 status, code = OnosCtrl.config(config)
138 if status is False:
139 log_test.info('JSON config request for app %s returned status %d' %(app, code))
140 assert_equal(status, True)
141 time.sleep(2)
142
143 @classmethod
144 def onos_aaa_load(cls):
145 aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
146 'radiusIp': '172.17.0.2' } } } }
147 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
148 aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip
149 cls.onos_load_config('org.opencord.aaa', aaa_dict)
150
151 @classmethod
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000152 def onos_dhcp_table_load(self, config = None):
153 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
154 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
155 if config:
156 for k in config.keys():
157 if dhcp_config.has_key(k):
158 dhcp_config[k] = config[k]
159 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
160
Thangavelu K S735a6662017-06-15 18:08:23 +0000161 def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = True):
162 if validation :
163 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
164 assert_not_equal(cip, None)
165 assert_not_equal(sip, None)
166 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
167 (cip, sip, dhcp.get_mac(cip)[0]))
168 if validation == False:
169 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
170 assert_equal(cip, None)
171 assert_equal(sip, None)
172 log_test.info('Dhcp client did not get IP from server %s for mac %s' %
173 (cip, sip, dhcp.get_mac(cip)[0]))
174
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000175 return cip,sip
176
177 def dhcp_request(self, onu_iface = None, seed_ip = '10.10.10.1', update_seed = False):
178 config = {'startip':'10.10.10.20', 'endip':'10.10.10.200',
179 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
180 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
181 self.onos_dhcp_table_load(config)
182 dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface)
183 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed)
184 return cip, sip
185
186 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700187 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700188 cls.update_apps_version()
A R Karthick35495c32017-05-11 14:58:32 -0700189 cls.voltha = VolthaCtrl(cls.VOLTHA_HOST, rest_port = cls.VOLTHA_REST_PORT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000190 cls.install_app_table()
191 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
192 cls.port_map, cls.port_list = cls.olt.olt_port_map()
193 cls.switches = cls.port_map['switches']
194 cls.num_ports = cls.port_map['num_ports']
195 if cls.num_ports > 1:
196 cls.num_ports -= 1 ##account for the tx port
197 cls.activate_apps(cls.apps + cls.olt_apps)
A.R Karthickf874d032017-06-07 18:47:51 -0700198 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000199
A.R Karthick3493a572017-06-07 18:28:10 -0700200 @classmethod
201 def tearDownClass(cls):
202 '''Deactivate the olt apps and restart OVS back'''
203 apps = cls.olt_apps + ( cls.table_app,)
204 for app in apps:
205 onos_ctrl = OnosCtrl(app)
206 onos_ctrl.deactivate()
207 cls.install_app_igmp()
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700208
A.R Karthick3493a572017-06-07 18:28:10 -0700209 @classmethod
210 def install_app_igmp(cls):
211 ##Uninstall the table app on class exit
212 OnosCtrl.uninstall_app(cls.table_app)
213 time.sleep(2)
214 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
215 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700216
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000217 def remove_olt(self, switch_map):
218 controller = get_controller()
219 auth = ('karaf', 'karaf')
220 #remove subscriber for every port on all the voltha devices
221 for device, device_map in switch_map.iteritems():
222 uni_ports = device_map['ports']
223 uplink_vlan = device_map['uplink_vlan']
224 for port in uni_ports:
225 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
226 device,
227 port)
228 resp = requests.delete(rest_url, auth = auth)
229 if resp.status_code not in [204, 202, 200]:
230 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
231 else:
232 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
233 OnosCtrl.uninstall_app(self.olt_app_file)
234
235 def config_olt(self, switch_map):
236 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000237 auth = ('karaf', 'karaf')
238 #configure subscriber for every port on all the voltha devices
239 for device, device_map in switch_map.iteritems():
240 uni_ports = device_map['ports']
241 uplink_vlan = device_map['uplink_vlan']
242 for port in uni_ports:
243 vlan = port
244 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
245 device,
246 port,
247 vlan)
248 resp = requests.post(rest_url, auth = auth)
249 #assert_equal(resp.ok, True)
250
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000251 def voltha_uni_port_toggle(self, uni_port = None):
252 ## Admin state of port is down and up
253 if not uni_port:
254 uni_port = self.INTF_RX_DEFAULT
255 cmd = 'ifconfig {} down'.format(uni_port)
256 os.system(cmd)
257 log_test.info('Admin state of uni_port is down')
258 time.sleep(30)
259 cmd = 'ifconfig {} up'.format(uni_port)
260 os.system(cmd)
261 log_test.info('Admin state of uni_port is up now')
262 time.sleep(30)
263 return
264
265
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000266 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000267 def install_app_table(cls):
268 ##Uninstall the existing app if any
269 OnosCtrl.uninstall_app(cls.table_app)
270 time.sleep(2)
271 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
272 OnosCtrl.install_app(cls.table_app_file)
273 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000274
275 @classmethod
276 def activate_apps(cls, apps):
277 for app in apps:
278 onos_ctrl = OnosCtrl(app)
279 status, _ = onos_ctrl.activate()
280 assert_equal(status, True)
281 time.sleep(2)
282
Thangavelu K S735a6662017-06-15 18:08:23 +0000283 @classmethod
284 def deactivate_apps(cls, apps):
285 self.success = True
286 for app in apps:
287 onos_ctrl = OnosCtrl(app)
288 status, _ = onos_ctrl.deactivate()
289 if status is False:
290 self.success = False
291 assert_equal(status, True)
292 time.sleep(2)
293
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000294 def tls_flow_check(self, olt_uni_port, cert_info = None):
295 def tls_fail_cb():
296 log_test.info('TLS verification failed')
297 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700298 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000299 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
300 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000301 if tls.failTest is True:
302 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000303 assert_equal(tls.failTest, False)
304 if cert_info == "no_cert":
305 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
306 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
307 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000308 if tls.failTest is False:
309 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000310 assert_equal(tls.failTest, True)
311 if cert_info == "invalid_cert":
312 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
313 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
314 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000315 if tls.failTest is False:
316 self.success = False
317 assert_equal(tls.failTest, True)
318 if cert_info == "same_cert":
319 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
320 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
321 tls.runTest()
322 if tls.failTest is False:
323 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000324 assert_equal(tls.failTest, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000325 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 +0000326 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 +0000327 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
328 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
329 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000330 if tls.failTest is False:
331 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000332 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000333 self.test_status = True
334 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700335
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000336 def dhcp_flow_check(self, onu_iface =None, negative_test = None):
Thangavelu K S735a6662017-06-15 18:08:23 +0000337 self.success = True
338
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000339 if negative_test is None:
340 cip, sip = self.dhcp_request(onu_iface, update_seed = True)
Thangavelu K S735a6662017-06-15 18:08:23 +0000341 if not cip:
342 self.success = False
343 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
344 self.test_status = True
345
346 if negative_test == "app_deactivation":
347 cip, sip = self.dhcp_request(onu_iface, update_seed = True)
348 if cip is not None:
349 self.success = False
350 assert_equal(cip,None)
351 log_test.info('Subscriber %s not got client ip %s from server %s' %(onu_iface, cip, sip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000352 self.test_status = True
353
354 if negative_test == "invalid_src_mac_broadcast":
355 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
356 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
357 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
358 self.onos_dhcp_table_load(config)
359 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
360 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000361
362 if cip is not None:
363 self.success = False
364 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected self.success = %s '%self.success)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000365 assert_equal(cip,None)
366 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
367 self.test_status = True
368 if negative_test == "invalid_src_mac_multicast":
369 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
370 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
371 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
372 self.onos_dhcp_table_load(config)
373 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
374 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000375 if cip is not None:
376 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000377 assert_equal(cip,None)
378 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
379 self.test_status = True
380
381 if negative_test == "invalid_src_mac_junk":
382 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
383 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
384 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
385 self.onos_dhcp_table_load(config)
386 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
387 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000388 if cip is not None:
389 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000390 assert_equal(cip,None)
391 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
392 self.test_status = True
393
394 if negative_test == "request_release":
395 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
396 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
397 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
398 self.onos_dhcp_table_load(config)
399 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
400 cip, sip = self.dhcp_sndrcv(self.dhcp)
401 log_test.info('Releasing ip %s to server %s' %(cip, sip))
402 assert_equal(self.dhcp.release(cip), True)
403 log_test.info('Triggering DHCP discover again after release')
404 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
405 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S735a6662017-06-15 18:08:23 +0000406 if cip == cip2:
407 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000408 assert_equal(cip, cip2)
409 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
410 assert_equal(self.dhcp.release(cip2), True)
411 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000412 if negative_test == "starvation_positive":
413 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
414 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
415 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
416 self.onos_dhcp_table_load(config)
417 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
418 ip_map = {}
419 for i in range(10):
420 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
421 if ip_map.has_key(cip):
422 self.success = False
423 log_test.info('IP %s given out multiple times' %cip)
424 assert_equal(False, ip_map.has_key(cip))
425 ip_map[cip] = sip
426 self.test_status = True
427 if negative_test == "starvation_negative":
428 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
429 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
430 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
431 self.onos_dhcp_table_load(config)
432 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
433 log_test.info('Verifying passitive case')
434 for x in xrange(50):
435 mac = RandMAC()._fix()
436 self.dhcp_sndrcv(self.dhcp,mac = mac)
437 log_test.info('Verifying negative case')
438 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
439 assert_equal(cip, None)
440 assert_equal(sip, None)
441 self.test_status = True
442 self.success = True
443 if negative_test == "multiple_discover":
444 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
445 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
446 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
447 self.onos_dhcp_table_load(config)
448 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
449 cip, sip, mac, _ = self.dhcp.only_discover()
450 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
451 (cip, sip, mac) )
452 assert_not_equal(cip, None)
453 log_test.info('Triggering DHCP discover again.')
454 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
455 assert_equal(new_cip, cip)
456 log_test.info('client got same IP as expected when sent 2nd discovery')
457 self.test_status = True
458 self.success = True
459 if negative_test == "multiple_requests":
460 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
461 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
462 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
463 self.onos_dhcp_table_load(config)
464 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
465 log_test.info('Sending DHCP discover and DHCP request.')
466 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
467 mac = self.dhcp.get_mac(cip)[0]
468 log_test.info("Sending DHCP request again.")
469 new_cip, new_sip = self.dhcp.only_request(cip, mac)
470 assert_equal(new_cip,cip)
471 log_test.info('server offered same IP to clain for multiple requests, as expected')
472 self.test_status = True
473 self.success = True
474 if negative_test == "desired_ip_address":
475 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
476 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
477 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
478 self.onos_dhcp_table_load(config)
479 self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface)
480 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
481 assert_not_equal(cip, None)
482 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
483 (cip, sip, mac))
484 assert_equal(cip,self.dhcp.seed_ip)
485 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
486 self.test_status = True
487 self.success = True
488 if negative_test == "desired_out_of_pool_ip_address":
489 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
490 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
491 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
492 self.onos_dhcp_table_load(config)
493 self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface)
494 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
495 assert_not_equal(cip, None)
496 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
497 (cip, sip, mac) )
498 assert_not_equal(cip,self.dhcp.seed_ip)
499 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
500 self.test_status = True
501 self.success = True
502 if negative_test == "request_release":
503 self.test_status = True
504 self.success = True
505 if negative_test == "request_release":
506 self.test_status = True
507 self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000508
509
510 return self.test_status
511
A.R Karthick8a507cf2017-06-02 18:44:49 -0700512 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -0700513 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -0700514 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
515 assert_not_equal(device_id, None)
516 try:
517 assert_equal(status, True)
518 time.sleep(10)
519 finally:
520 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000521
A.R Karthick8a507cf2017-06-02 18:44:49 -0700522 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -0700523 log_test.info('Enabling ponsim_olt')
524 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -0700525 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
526 assert_not_equal(device_id, None)
527 try:
528 assert_equal(status, True)
529 time.sleep(10)
530 finally:
531 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -0700532
Thangavelu K S008f38e2017-05-15 19:36:55 +0000533 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
534 """
535 Test Method:
536 0. Make sure that voltha is up and running on CORD-POD setup.
537 1. OLT and ONU is detected and validated.
538 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
539 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
540 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
541 5. Verify that subscriber is authenticated successfully.
542 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000543 log_test.info('Enabling ponsim_olt')
544 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
545 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
546 assert_not_equal(device_id, None)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700547 if status == False:
548 self.voltha.disable_device(device_id, delete = True)
549 assert_equal(status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000550 time.sleep(10)
551 switch_map = None
552 olt_configured = False
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700553 voltha = VolthaCtrl(self.VOLTHA_HOST,
554 rest_port = self.VOLTHA_REST_PORT,
555 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000556 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700557 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
558 if not switch_map:
559 log_test.info('No voltha devices found')
560 return
561 log_test.info('Installing OLT app')
562 OnosCtrl.install_app(self.olt_app_file)
563 time.sleep(5)
564 log_test.info('Adding subscribers through OLT app')
565 self.config_olt(switch_map)
566 olt_configured = True
567 time.sleep(5)
568 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000569 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000570 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700571 if switch_map is not None:
572 if olt_configured is True:
573 self.remove_olt(switch_map)
574 self.voltha.disable_device(device_id, delete = True)
575 time.sleep(10)
576 OnosCtrl.uninstall_app(self.olt_app_name)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000577
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000578 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000579 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
580 """
581 Test Method:
582 0. Make sure that voltha is up and running on CORD-POD setup.
583 1. OLT and ONU is detected and validated.
584 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
585 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
586 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
587 5. Verify that subscriber authentication is unsuccessful..
588 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000589 df = defer.Deferred()
590 def tls_flow_check_with_no_cert_scenario(df):
591 log_test.info('Enabling ponsim_olt')
592 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
593 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
594 assert_not_equal(device_id, None)
595 voltha = VolthaCtrl(self.VOLTHA_HOST,
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700596 rest_port = self.VOLTHA_REST_PORT,
597 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000598 time.sleep(10)
599 switch_map = None
600 olt_configured = False
601 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
602 log_test.info('Installing OLT app')
603 OnosCtrl.install_app(self.olt_app_file)
604 time.sleep(5)
605 log_test.info('Adding subscribers through OLT app')
606 self.config_olt(switch_map)
607 olt_configured = True
608 time.sleep(5)
609 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
610 try:
611 assert_equal(auth_status, True)
612 assert_equal(status, True)
613 time.sleep(10)
614 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700615 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000616 self.voltha.disable_device(device_id, delete = True)
617 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700618
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000619 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
620 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000621
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000622 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000623 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
624 """
625 Test Method:
626 0. Make sure that voltha is up and running on CORD-POD setup.
627 1. OLT and ONU is detected and validated.
628 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
629 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
630 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
631 5. Verify that subscriber authentication is unsuccessful..
632 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000633 df = defer.Deferred()
634 def tls_flow_check_with_invalid_cert_scenario(df):
635 log_test.info('Enabling ponsim_olt')
636 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
637 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
638 assert_not_equal(device_id, None)
639 voltha = VolthaCtrl(self.VOLTHA_HOST,
640 rest_port = self.VOLTHA_REST_PORT,
641 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
642 time.sleep(10)
643 switch_map = None
644 olt_configured = False
645 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
646 log_test.info('Installing OLT app')
647 OnosCtrl.install_app(self.olt_app_file)
648 time.sleep(5)
649 log_test.info('Adding subscribers through OLT app')
650 self.config_olt(switch_map)
651 olt_configured = True
652 time.sleep(5)
653 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
654 try:
655 assert_equal(auth_status, True)
656 assert_equal(status, True)
657 time.sleep(10)
658 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700659 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000660 self.voltha.disable_device(device_id, delete = True)
661 df.callback(0)
662 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
663 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000664
Thangavelu K S0d745c82017-06-09 21:56:08 +0000665 @deferred(TESTCASE_TIMEOUT)
666 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
667 """
668 Test Method:
669 0. Make sure that voltha is up and running on CORD-POD setup.
670 1. OLT and ONU is detected and validated.
671 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
672 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
673 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
674 5. Verify that subscriber authentication is unsuccessful..
675 """
676 df = defer.Deferred()
677 def tls_flow_check_with_no_cert_scenario(df):
678 log_test.info('Enabling ponsim_olt')
679 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
680 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
681 assert_not_equal(device_id, None)
682 voltha = VolthaCtrl(self.VOLTHA_HOST,
683 rest_port = self.VOLTHA_REST_PORT,
684 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
685 time.sleep(10)
686 switch_map = None
687 olt_configured = False
688 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
689 log_test.info('Installing OLT app')
690 OnosCtrl.install_app(self.olt_app_file)
691 time.sleep(5)
692 log_test.info('Adding subscribers through OLT app')
693 self.config_olt(switch_map)
694 olt_configured = True
695 time.sleep(5)
696 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
697 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
698 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
699 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
700 try:
701 assert_equal(auth_status, True)
702 assert_equal(status, True)
703 time.sleep(10)
704 finally:
705 self.voltha.disable_device(device_id, delete = True)
706 df.callback(0)
707 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
708 return df
709
710 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000711 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
712 """
713 Test Method:
714 0. Make sure that voltha is up and running on CORD-POD setup.
715 1. OLT and ONU is detected and validated.
716 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
717 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
718 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
719 5. Verify that subscriber authentication is unsuccessful..
720 """
Thangavelu K S0d745c82017-06-09 21:56:08 +0000721 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000722 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +0000723 aaa_app = ["org.opencord.aaa"]
724 log_test.info('Enabling ponsim_olt')
725 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
726 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
727 assert_not_equal(device_id, None)
728 voltha = VolthaCtrl(self.VOLTHA_HOST,
729 rest_port = self.VOLTHA_REST_PORT,
730 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
731 time.sleep(10)
732 switch_map = None
733 olt_configured = False
734 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
735 log_test.info('Installing OLT app')
736 OnosCtrl.install_app(self.olt_app_file)
737 time.sleep(5)
738 log_test.info('Adding subscribers through OLT app')
739 self.config_olt(switch_map)
740 olt_configured = True
741 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000742
Thangavelu K S0d745c82017-06-09 21:56:08 +0000743 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
744 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
745 thread1.start()
746 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000747 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +0000748 thread2.start()
749 time.sleep(10)
750 thread1.join()
751 thread2.join()
752 try:
753 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000754 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000755 time.sleep(10)
756 finally:
757 self.voltha.disable_device(device_id, delete = True)
758 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000759 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000760 return df
761
762 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000763 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
764 """
765 Test Method:
766 0. Make sure that voltha is up and running on CORD-POD setup.
767 1. OLT and ONU is detected and validated.
768 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
769 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
770 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
771 5. Verify that subscriber authentication is unsuccessful..
772 """
Thangavelu K S0d745c82017-06-09 21:56:08 +0000773 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000774 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +0000775 aaa_app = ["org.opencord.aaa"]
776 log_test.info('Enabling ponsim_olt')
777 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
778 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
779 assert_not_equal(device_id, None)
780 voltha = VolthaCtrl(self.VOLTHA_HOST,
781 rest_port = self.VOLTHA_REST_PORT,
782 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
783 time.sleep(10)
784 switch_map = None
785 olt_configured = False
786 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
787 log_test.info('Installing OLT app')
788 OnosCtrl.install_app(self.olt_app_file)
789 time.sleep(5)
790 log_test.info('Adding subscribers through OLT app')
791 self.config_olt(switch_map)
792 olt_configured = True
793 time.sleep(5)
794
795 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
796 thread2 = threading.Thread(target = cord_test_radius_restart)
797 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000798 time.sleep(randint(1,2))
799 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +0000800 thread2.start()
801 time.sleep(10)
802 thread1.join()
803 thread2.join()
804 try:
805 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000806 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000807 time.sleep(10)
808 finally:
809 self.voltha.disable_device(device_id, delete = True)
810 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000811 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000812 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000813
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000814 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000815 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
816 """
817 Test Method:
818 0. Make sure that voltha is up and running on CORD-POD setup.
819 1. OLT and ONU is detected and validated.
820 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
821 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
822 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
823 6. Verify that subscriber authenticated successfully.
824 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
825 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
826 9. Verify that subscriber authentication is unsuccessful..
827 """
Thangavelu K S0d745c82017-06-09 21:56:08 +0000828 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000829 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +0000830 aaa_app = ["org.opencord.aaa"]
831 log_test.info('Enabling ponsim_olt')
832 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
833 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
834 assert_not_equal(device_id, None)
835 voltha = VolthaCtrl(self.VOLTHA_HOST,
836 rest_port = self.VOLTHA_REST_PORT,
837 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
838 time.sleep(10)
839 switch_map = None
840 olt_configured = False
841 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
842 log_test.info('Installing OLT app')
843 OnosCtrl.install_app(self.olt_app_file)
844 time.sleep(5)
845 log_test.info('Adding subscribers through OLT app')
846 self.config_olt(switch_map)
847 olt_configured = True
848 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000849
Thangavelu K S0d745c82017-06-09 21:56:08 +0000850 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
851 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,))
852 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000853 time.sleep(randint(1,2))
854 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +0000855 thread2.start()
856 time.sleep(10)
857 thread1.join()
858 thread2.join()
859 try:
860 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000861 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000862 time.sleep(10)
863 finally:
864 self.voltha.disable_device(device_id, delete = True)
865 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000866 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000867 return df
868
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000869 @deferred(TESTCASE_TIMEOUT)
870 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +0000871 """
872 Test Method:
873 0. Make sure that voltha is up and running on CORD-POD setup.
874 1. OLT and ONU is detected and validated.
875 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
876 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
877 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
878 6. Verify that subscriber authenticated successfully.
879 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
880 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
881 9. Verify that subscriber authentication is unsuccessful..
882 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000883 df = defer.Deferred()
884 def tls_flow_check_operating_olt_state(df):
885 aaa_app = ["org.opencord.aaa"]
886 log_test.info('Enabling ponsim_olt')
887 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
888 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
889 assert_not_equal(device_id, None)
890 voltha = VolthaCtrl(self.VOLTHA_HOST,
891 rest_port = self.VOLTHA_REST_PORT,
892 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
893 time.sleep(10)
894 switch_map = None
895 olt_configured = False
896 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
897 log_test.info('Installing OLT app')
898 OnosCtrl.install_app(self.olt_app_file)
899 time.sleep(5)
900 log_test.info('Adding subscribers through OLT app')
901 self.config_olt(switch_map)
902 olt_configured = True
903 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000904
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000905 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
906 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
907 thread1.start()
908 time.sleep(randint(1,2))
909 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
910 thread2.start()
911 time.sleep(10)
912 thread1.join()
913 thread2.join()
914 try:
915 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000916 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000917 time.sleep(10)
918 finally:
919 self.voltha.disable_device(device_id, delete = True)
920 df.callback(0)
921 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
922 return df
923
924 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000925 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
926 """
927 Test Method:
928 0. Make sure that voltha is up and running on CORD-POD setup.
929 1. OLT and ONU is detected and validated.
930 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
931 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
932 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
933 6. Verify that subscriber authenticated successfully.
934 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
935 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
936 9. Verify that subscriber authentication is unsuccessful..
937 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000938 df = defer.Deferred()
939 def tls_flow_check_operating_olt_state(df):
940 aaa_app = ["org.opencord.aaa"]
941 log_test.info('Enabling ponsim_olt')
942 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
943 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
944 assert_not_equal(device_id, None)
945 voltha = VolthaCtrl(self.VOLTHA_HOST,
946 rest_port = self.VOLTHA_REST_PORT,
947 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
948 time.sleep(10)
949 switch_map = None
950 olt_configured = False
951 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
952 log_test.info('Installing OLT app')
953 OnosCtrl.install_app(self.olt_app_file)
954 time.sleep(5)
955 log_test.info('Adding subscribers through OLT app')
956 self.config_olt(switch_map)
957 olt_configured = True
958 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000959
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000960 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
961 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
962 thread1.start()
963 time.sleep(randint(1,2))
964 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
965 thread2.start()
966 time.sleep(10)
967 thread1.join()
968 thread2.join()
969 try:
970 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000971 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000972 time.sleep(10)
973 finally:
974 self.voltha.disable_device(device_id, delete = True)
975 df.callback(0)
976 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
977 return df
978
979 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000980 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
981 """
982 Test Method:
983 0. Make sure that voltha is up and running on CORD-POD setup.
984 1. OLT and ONU is detected and validated.
985 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
986 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
987 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
988 6. Verify that subscriber authenticated successfully.
989 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
990 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
991 9. Verify that subscriber authentication is unsuccessful..
992 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000993 df = defer.Deferred()
994 def tls_flow_check_operating_olt_state(df):
995 aaa_app = ["org.opencord.aaa"]
996 log_test.info('Enabling ponsim_olt')
997 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
998 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
999 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00001000 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1001
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001002 onu_device_id = devices_list['items'][1]['id']
1003 assert_not_equal(device_id, None)
1004 voltha = VolthaCtrl(self.VOLTHA_HOST,
1005 rest_port = self.VOLTHA_REST_PORT,
1006 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1007 time.sleep(10)
1008 switch_map = None
1009 olt_configured = False
1010 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1011 log_test.info('Installing OLT app')
1012 OnosCtrl.install_app(self.olt_app_file)
1013 time.sleep(5)
1014 log_test.info('Adding subscribers through OLT app')
1015 self.config_olt(switch_map)
1016 olt_configured = True
1017 time.sleep(5)
1018 devices_list = self.voltha.get_devices()
1019 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
1020 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
1021 thread1.start()
1022 time.sleep(randint(1,2))
1023 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
1024 thread2.start()
1025 time.sleep(10)
1026 thread1.join()
1027 thread2.join()
1028 try:
1029 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001030 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001031 time.sleep(10)
1032 finally:
1033 self.voltha.disable_device(device_id, delete = True)
1034 df.callback(0)
1035 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1036 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001037
Thangavelu K S9648eed2017-06-13 20:15:25 +00001038 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001039 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
1040 """
1041 Test Method:
1042 0. Make sure that voltha is up and running on CORD-POD setup.
1043 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1044 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1045 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1046 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
1047 5. Verify that two subscribers are authenticated successfully.
1048 """
1049
Thangavelu K S9648eed2017-06-13 20:15:25 +00001050 df = defer.Deferred()
1051 def tls_flow_check_on_two_subscriber_same_olt_device(df):
1052 aaa_app = ["org.opencord.aaa"]
1053 log_test.info('Enabling ponsim_olt')
1054 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1055 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1056 devices_list = self.voltha.get_devices()
1057 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1058
1059 onu_device_id = devices_list['items'][1]['id']
1060 assert_not_equal(device_id, None)
1061 voltha = VolthaCtrl(self.VOLTHA_HOST,
1062 rest_port = self.VOLTHA_REST_PORT,
1063 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1064 time.sleep(10)
1065 switch_map = None
1066 olt_configured = False
1067 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1068 log_test.info('Installing OLT app')
1069 OnosCtrl.install_app(self.olt_app_file)
1070 time.sleep(5)
1071 log_test.info('Adding subscribers through OLT app')
1072 self.config_olt(switch_map)
1073 olt_configured = True
1074 time.sleep(5)
1075 devices_list = self.voltha.get_devices()
1076 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1077 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
1078 thread1.start()
1079 time.sleep(randint(1,2))
1080 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1081 thread2.start()
1082 time.sleep(10)
1083 thread1.join()
1084 thread2.join()
1085 try:
1086 # assert_equal(status, True)
1087 assert_equal(self.success, True)
1088 time.sleep(10)
1089 finally:
1090 self.voltha.disable_device(device_id, delete = True)
1091 df.callback(0)
1092 reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df)
1093 return df
1094
1095 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001096 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
1097 """
1098 Test Method:
1099 0. Make sure that voltha is up and running on CORD-POD setup.
1100 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1101 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1102 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1103 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
1104 5. Verify that two subscribers are not authenticated.
1105 """
1106
Thangavelu K S9648eed2017-06-13 20:15:25 +00001107 df = defer.Deferred()
1108 def tls_flow_check_on_two_subscriber_same_olt_device(df):
1109 aaa_app = ["org.opencord.aaa"]
1110 log_test.info('Enabling ponsim_olt')
1111 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1112 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1113 devices_list = self.voltha.get_devices()
1114 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1115
1116 onu_device_id = devices_list['items'][1]['id']
1117 assert_not_equal(device_id, None)
1118 voltha = VolthaCtrl(self.VOLTHA_HOST,
1119 rest_port = self.VOLTHA_REST_PORT,
1120 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1121 time.sleep(10)
1122 switch_map = None
1123 olt_configured = False
1124 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1125 log_test.info('Installing OLT app')
1126 OnosCtrl.install_app(self.olt_app_file)
1127 time.sleep(5)
1128 log_test.info('Adding subscribers through OLT app')
1129 self.config_olt(switch_map)
1130 olt_configured = True
1131 time.sleep(5)
1132 devices_list = self.voltha.get_devices()
1133 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1134 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
1135 thread1.start()
1136 time.sleep(randint(1,2))
1137 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1138 thread2.start()
1139 time.sleep(10)
1140 thread1.join()
1141 thread2.join()
1142 try:
1143 # assert_equal(status, True)
1144 assert_equal(self.success, True)
1145 time.sleep(10)
1146 finally:
1147 self.voltha.disable_device(device_id, delete = True)
1148 df.callback(0)
1149 reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df)
1150 return df
1151
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001152 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001153 def test_two_subscribers_with_voltha_for_eap_tls_authentication_initiating_invalid_tls_packets_for_one_subscriber(self):
1154 """
1155 Test Method:
1156 0. Make sure that voltha is up and running on CORD-POD setup.
1157 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1158 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1159 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1160 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
1161 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
1162 6. Verify that valid subscriber authenticated successfully.
1163 7. Verify that invalid subscriber are not authenticated successfully.
1164 """
1165
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001166 df = defer.Deferred()
1167 def tls_flow_check_on_two_subscriber_same_olt_device(df):
1168 aaa_app = ["org.opencord.aaa"]
1169 log_test.info('Enabling ponsim_olt')
1170 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1171 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1172 devices_list = self.voltha.get_devices()
1173 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1174
1175 onu_device_id = devices_list['items'][1]['id']
1176 assert_not_equal(device_id, None)
1177 voltha = VolthaCtrl(self.VOLTHA_HOST,
1178 rest_port = self.VOLTHA_REST_PORT,
1179 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1180 time.sleep(10)
1181 switch_map = None
1182 olt_configured = False
1183 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1184 log_test.info('Installing OLT app')
1185 OnosCtrl.install_app(self.olt_app_file)
1186 time.sleep(5)
1187 log_test.info('Adding subscribers through OLT app')
1188 self.config_olt(switch_map)
1189 olt_configured = True
1190 time.sleep(5)
1191 devices_list = self.voltha.get_devices()
1192 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1193 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
1194 thread1.start()
1195 time.sleep(randint(1,2))
1196 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1197 thread2.start()
1198 time.sleep(10)
1199 thread1.join()
1200 thread2.join()
1201 try:
1202 # assert_equal(status, True)
1203 assert_equal(self.success, True)
1204 time.sleep(10)
1205 finally:
1206 self.voltha.disable_device(device_id, delete = True)
1207 df.callback(0)
1208 reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df)
1209 return df
1210
1211 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001212 def test_two_subscribers_with_voltha_for_eap_tls_authentication_initiating_invalid_cert_for_one_subscriber(self):
1213 """
1214 Test Method:
1215 0. Make sure that voltha is up and running on CORD-POD setup.
1216 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1217 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1218 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1219 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
1220 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
1221 6. Verify that valid subscriber authenticated successfully.
1222 7. Verify that invalid subscriber are not authenticated successfully.
1223 """
1224
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001225 df = defer.Deferred()
1226 def tls_flow_check_on_two_subscriber_same_olt_device(df):
1227 aaa_app = ["org.opencord.aaa"]
1228 log_test.info('Enabling ponsim_olt')
1229 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1230 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1231 devices_list = self.voltha.get_devices()
1232 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1233
1234 onu_device_id = devices_list['items'][1]['id']
1235 assert_not_equal(device_id, None)
1236 voltha = VolthaCtrl(self.VOLTHA_HOST,
1237 rest_port = self.VOLTHA_REST_PORT,
1238 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1239 time.sleep(10)
1240 switch_map = None
1241 olt_configured = False
1242 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1243 log_test.info('Installing OLT app')
1244 OnosCtrl.install_app(self.olt_app_file)
1245 time.sleep(5)
1246 log_test.info('Adding subscribers through OLT app')
1247 self.config_olt(switch_map)
1248 olt_configured = True
1249 time.sleep(5)
1250 devices_list = self.voltha.get_devices()
1251 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1252 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
1253 thread1.start()
1254 time.sleep(randint(1,2))
1255 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1256 thread2.start()
1257 time.sleep(10)
1258 thread1.join()
1259 thread2.join()
1260 try:
1261 # assert_equal(status, True)
1262 assert_equal(self.success, True)
1263 time.sleep(10)
1264 finally:
1265 self.voltha.disable_device(device_id, delete = True)
1266 df.callback(0)
1267 reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df)
1268 return df
1269
1270 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001271 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
1272 """
1273 Test Method:
1274 0. Make sure that voltha is up and running on CORD-POD setup.
1275 1. OLT and ONU is detected and validated.
1276 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1277 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1278 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
1279 6. Verify that subscriber authenticated successfully.
1280 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
1281 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
1282 9. Verify that subscriber authentication is unsuccessful..
1283 10. Verify that other subscriber authenticated successfully.
1284 """
1285
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001286 df = defer.Deferred()
1287 def tls_flow_check_on_two_subscriber_same_olt_device(df):
1288 aaa_app = ["org.opencord.aaa"]
1289 log_test.info('Enabling ponsim_olt')
1290 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1291 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1292 devices_list = self.voltha.get_devices()
1293 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1294
1295 onu_device_id = devices_list['items'][1]['id']
1296 assert_not_equal(device_id, None)
1297 voltha = VolthaCtrl(self.VOLTHA_HOST,
1298 rest_port = self.VOLTHA_REST_PORT,
1299 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1300 time.sleep(10)
1301 switch_map = None
1302 olt_configured = False
1303 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1304 log_test.info('Installing OLT app')
1305 OnosCtrl.install_app(self.olt_app_file)
1306 time.sleep(5)
1307 log_test.info('Adding subscribers through OLT app')
1308 self.config_olt(switch_map)
1309 olt_configured = True
1310 time.sleep(5)
1311 devices_list = self.voltha.get_devices()
1312 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1313 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
1314 thread1.start()
1315 time.sleep(randint(1,2))
1316 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1317 thread2.start()
1318 time.sleep(10)
1319 thread1.join()
1320 thread2.join()
1321 try:
1322 # assert_equal(status, True)
1323 assert_equal(self.success, True)
1324 time.sleep(10)
1325 finally:
1326 self.voltha.disable_device(device_id, delete = True)
1327 df.callback(0)
1328 reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df)
1329 return df
1330
1331 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001332 def test_subscriber_with_voltha_for_dhcp_request(self):
1333 """
1334 Test Method:
1335 0. Make sure that voltha is up and running on CORD-POD setup.
1336 1. OLT and ONU is detected and validated.
1337 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1338 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
1339 4. Verify that subscriber get ip from dhcp server successfully.
1340 """
1341
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001342 df = defer.Deferred()
1343 def dhcp_flow_check_scenario(df):
1344 log_test.info('Enabling ponsim_olt')
1345 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1346 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1347 assert_not_equal(device_id, None)
1348 voltha = VolthaCtrl(self.VOLTHA_HOST,
1349 rest_port = self.VOLTHA_REST_PORT,
1350 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1351 time.sleep(10)
1352 switch_map = None
1353 olt_configured = False
1354 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1355 log_test.info('Installing OLT app')
1356 OnosCtrl.install_app(self.olt_app_file)
1357 time.sleep(5)
1358 log_test.info('Adding subscribers through OLT app')
1359 self.config_olt(switch_map)
1360 olt_configured = True
1361 time.sleep(5)
1362 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
1363 try:
1364 assert_equal(dhcp_status, True)
1365 #assert_equal(status, True)
1366 time.sleep(10)
1367 finally:
1368 self.remove_olt(switch_map)
1369 self.voltha.disable_device(device_id, delete = True)
1370 df.callback(0)
1371
1372 reactor.callLater(0, dhcp_flow_check_scenario, df)
1373 return df
1374
1375 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001376 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
1377 """
1378 Test Method:
1379 0. Make sure that voltha is up and running on CORD-POD setup.
1380 1. OLT and ONU is detected and validated.
1381 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1382 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
1383 4. Verify that subscriber should not get ip from dhcp server.
1384 """
1385
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001386 df = defer.Deferred()
1387 def dhcp_flow_check_scenario(df):
1388 log_test.info('Enabling ponsim_olt')
1389 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1390 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1391 assert_not_equal(device_id, None)
1392 voltha = VolthaCtrl(self.VOLTHA_HOST,
1393 rest_port = self.VOLTHA_REST_PORT,
1394 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1395 time.sleep(10)
1396 switch_map = None
1397 olt_configured = False
1398 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1399 log_test.info('Installing OLT app')
1400 OnosCtrl.install_app(self.olt_app_file)
1401 time.sleep(5)
1402 log_test.info('Adding subscribers through OLT app')
1403 self.config_olt(switch_map)
1404 olt_configured = True
1405 time.sleep(5)
1406 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
1407 try:
1408 assert_equal(dhcp_status, True)
1409 #assert_equal(status, True)
1410 time.sleep(10)
1411 finally:
1412 self.voltha.disable_device(device_id, delete = True)
1413 self.remove_olt(switch_map)
1414 df.callback(0)
1415
1416 reactor.callLater(0, dhcp_flow_check_scenario, df)
1417 return df
1418
1419
1420 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001421 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
1422 """
1423 Test Method:
1424 0. Make sure that voltha is up and running on CORD-POD setup.
1425 1. OLT and ONU is detected and validated.
1426 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1427 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
1428 4. Verify that subscriber should not get ip from dhcp server.
1429 """
1430
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001431 df = defer.Deferred()
1432 def dhcp_flow_check_scenario(df):
1433 log_test.info('Enabling ponsim_olt')
1434 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1435 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1436 assert_not_equal(device_id, None)
1437 voltha = VolthaCtrl(self.VOLTHA_HOST,
1438 rest_port = self.VOLTHA_REST_PORT,
1439 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1440 time.sleep(10)
1441 switch_map = None
1442 olt_configured = False
1443 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1444 log_test.info('Installing OLT app')
1445 OnosCtrl.install_app(self.olt_app_file)
1446 time.sleep(5)
1447 log_test.info('Adding subscribers through OLT app')
1448 self.config_olt(switch_map)
1449 olt_configured = True
1450 time.sleep(5)
1451 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
1452 try:
1453 assert_equal(dhcp_status, True)
1454 #assert_equal(status, True)
1455 time.sleep(10)
1456 finally:
1457 self.voltha.disable_device(device_id, delete = True)
1458 self.remove_olt(switch_map)
1459 df.callback(0)
1460
1461 reactor.callLater(0, dhcp_flow_check_scenario, df)
1462 return df
1463
1464 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001465 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
1466 """
1467 Test Method:
1468 0. Make sure that voltha is up and running on CORD-POD setup.
1469 1. OLT and ONU is detected and validated.
1470 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1471 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
1472 4. Verify that subscriber should not get ip from dhcp server.
1473 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001474 df = defer.Deferred()
1475 def dhcp_flow_check_scenario(df):
1476 log_test.info('Enabling ponsim_olt')
1477 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1478 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1479 assert_not_equal(device_id, None)
1480 voltha = VolthaCtrl(self.VOLTHA_HOST,
1481 rest_port = self.VOLTHA_REST_PORT,
1482 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1483 time.sleep(10)
1484 switch_map = None
1485 olt_configured = False
1486 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1487 log_test.info('Installing OLT app')
1488 OnosCtrl.install_app(self.olt_app_file)
1489 time.sleep(5)
1490 log_test.info('Adding subscribers through OLT app')
1491 self.config_olt(switch_map)
1492 olt_configured = True
1493 time.sleep(5)
1494 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
1495 try:
1496 assert_equal(dhcp_status, True)
1497 #assert_equal(status, True)
1498 time.sleep(10)
1499 finally:
1500 self.voltha.disable_device(device_id, delete = True)
1501 self.remove_olt(switch_map)
1502 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001503
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001504 reactor.callLater(0, dhcp_flow_check_scenario, df)
1505 return df
1506
1507 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001508 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
1509 """
1510 Test Method:
1511 0. Make sure that voltha is up and running on CORD-POD setup.
1512 1. OLT and ONU is detected and validated.
1513 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1514 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
1515 4. Verify that subscriber get ip from dhcp server successfully.
1516 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
1517 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
1518 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001519 df = defer.Deferred()
1520 def dhcp_flow_check_scenario(df):
1521 log_test.info('Enabling ponsim_olt')
1522 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1523 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1524 assert_not_equal(device_id, None)
1525 voltha = VolthaCtrl(self.VOLTHA_HOST,
1526 rest_port = self.VOLTHA_REST_PORT,
1527 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1528 time.sleep(10)
1529 switch_map = None
1530 olt_configured = False
1531 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1532 log_test.info('Installing OLT app')
1533 OnosCtrl.install_app(self.olt_app_file)
1534 time.sleep(5)
1535 log_test.info('Adding subscribers through OLT app')
1536 self.config_olt(switch_map)
1537 olt_configured = True
1538 time.sleep(5)
1539 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
1540 try:
1541 assert_equal(dhcp_status, True)
1542 #assert_equal(status, True)
1543 time.sleep(10)
1544 finally:
1545 self.voltha.disable_device(device_id, delete = True)
1546 self.remove_olt(switch_map)
1547 df.callback(0)
1548
1549 reactor.callLater(0, dhcp_flow_check_scenario, df)
1550 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001551
Thangavelu K S735a6662017-06-15 18:08:23 +00001552
1553 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07001554 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00001555 """
1556 Test Method:
1557 0. Make sure that voltha is up and running on CORD-POD setup.
1558 1. OLT and ONU is detected and validated.
1559 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1560 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1561 4. Verify that subscriber get ip from dhcp server successfully.
1562 5. Repeat step 3 and 4 for 10 times.
1563 6 Verify that subscriber should get ip from dhcp server.
1564 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001565 df = defer.Deferred()
1566 def dhcp_flow_check_scenario(df):
1567 log_test.info('Enabling ponsim_olt')
1568 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1569 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1570 assert_not_equal(device_id, None)
1571 voltha = VolthaCtrl(self.VOLTHA_HOST,
1572 rest_port = self.VOLTHA_REST_PORT,
1573 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1574 time.sleep(10)
1575 switch_map = None
1576 olt_configured = False
1577 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1578 log_test.info('Installing OLT app')
1579 OnosCtrl.install_app(self.olt_app_file)
1580 time.sleep(5)
1581 log_test.info('Adding subscribers through OLT app')
1582 self.config_olt(switch_map)
1583 olt_configured = True
1584 time.sleep(5)
1585 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
1586 try:
1587 assert_equal(dhcp_status, True)
1588 #assert_equal(status, True)
1589 time.sleep(10)
1590 finally:
1591 self.voltha.disable_device(device_id, delete = True)
1592 self.remove_olt(switch_map)
1593 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001594
Thangavelu K S735a6662017-06-15 18:08:23 +00001595 reactor.callLater(0, dhcp_flow_check_scenario, df)
1596 return df
1597
1598
1599
1600 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001601 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
1602 """
1603 Test Method:
1604 0. Make sure that voltha is up and running on CORD-POD setup.
1605 1. OLT and ONU is detected and validated.
1606 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1607 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
1608 4. Verify that subscriber should not get ip from dhcp server.
1609 5. Repeat steps 3 and 4 for 10 times.
1610 6 Verify that subscriber should not get ip from dhcp server.
1611 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001612 df = defer.Deferred()
1613 def dhcp_flow_check_scenario(df):
1614 log_test.info('Enabling ponsim_olt')
1615 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1616 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1617 assert_not_equal(device_id, None)
1618 voltha = VolthaCtrl(self.VOLTHA_HOST,
1619 rest_port = self.VOLTHA_REST_PORT,
1620 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1621 time.sleep(10)
1622 switch_map = None
1623 olt_configured = False
1624 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1625 log_test.info('Installing OLT app')
1626 OnosCtrl.install_app(self.olt_app_file)
1627 time.sleep(5)
1628 log_test.info('Adding subscribers through OLT app')
1629 self.config_olt(switch_map)
1630 olt_configured = True
1631 time.sleep(5)
1632 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
1633 try:
1634 assert_equal(dhcp_status, True)
1635 #assert_equal(status, True)
1636 time.sleep(10)
1637 finally:
1638 self.voltha.disable_device(device_id, delete = True)
1639 self.remove_olt(switch_map)
1640 df.callback(0)
1641
1642 reactor.callLater(0, dhcp_flow_check_scenario, df)
1643 return df
1644
1645
1646 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001647 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
1648 """
1649 Test Method:
1650 0. Make sure that voltha is up and running on CORD-POD setup.
1651 1. OLT and ONU is detected and validated.
1652 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1653 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1654 4. Verify that subscriber get ip from dhcp server successfully.
1655 5. Repeat step 3 for 50 times.
1656 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
1657 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001658 df = defer.Deferred()
1659 def dhcp_flow_check_scenario(df):
1660 log_test.info('Enabling ponsim_olt')
1661 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1662 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1663 assert_not_equal(device_id, None)
1664 voltha = VolthaCtrl(self.VOLTHA_HOST,
1665 rest_port = self.VOLTHA_REST_PORT,
1666 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1667 time.sleep(10)
1668 switch_map = None
1669 olt_configured = False
1670 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1671 log_test.info('Installing OLT app')
1672 OnosCtrl.install_app(self.olt_app_file)
1673 time.sleep(5)
1674 log_test.info('Adding subscribers through OLT app')
1675 self.config_olt(switch_map)
1676 olt_configured = True
1677 time.sleep(5)
1678 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
1679 try:
1680 assert_equal(dhcp_status, True)
1681 #assert_equal(status, True)
1682 time.sleep(10)
1683 finally:
1684 self.voltha.disable_device(device_id, delete = True)
1685 self.remove_olt(switch_map)
1686 df.callback(0)
1687
1688 reactor.callLater(0, dhcp_flow_check_scenario, df)
1689 return df
1690
1691
1692
1693 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001694 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
1695 """
1696 Test Method:
1697 0. Make sure that voltha is up and running on CORD-POD setup.
1698 1. OLT and ONU is detected and validated.
1699 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1700 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1701 4. Verify that subscriber get ip from dhcp server successfully.
1702 5. Send DHCP request to dhcp server which is running as onos app.
1703 6. Repeat step 5 for 50 times.
1704 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
1705 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001706 df = defer.Deferred()
1707 def dhcp_flow_check_scenario(df):
1708 log_test.info('Enabling ponsim_olt')
1709 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1710 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1711 assert_not_equal(device_id, None)
1712 voltha = VolthaCtrl(self.VOLTHA_HOST,
1713 rest_port = self.VOLTHA_REST_PORT,
1714 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1715 time.sleep(10)
1716 switch_map = None
1717 olt_configured = False
1718 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1719 log_test.info('Installing OLT app')
1720 OnosCtrl.install_app(self.olt_app_file)
1721 time.sleep(5)
1722 log_test.info('Adding subscribers through OLT app')
1723 self.config_olt(switch_map)
1724 olt_configured = True
1725 time.sleep(5)
1726 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
1727 try:
1728 assert_equal(dhcp_status, True)
1729 #assert_equal(status, True)
1730 time.sleep(10)
1731 finally:
1732 self.voltha.disable_device(device_id, delete = True)
1733 self.remove_olt(switch_map)
1734 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001735
Thangavelu K S735a6662017-06-15 18:08:23 +00001736 reactor.callLater(0, dhcp_flow_check_scenario, df)
1737 return df
1738
1739
1740 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001741 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
1742 """
1743 Test Method:
1744 0. Make sure that voltha is up and running on CORD-POD setup.
1745 1. OLT and ONU is detected and validated.
1746 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1747 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
1748 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
1749 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001750 df = defer.Deferred()
1751 def dhcp_flow_check_scenario(df):
1752 log_test.info('Enabling ponsim_olt')
1753 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1754 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1755 assert_not_equal(device_id, None)
1756 voltha = VolthaCtrl(self.VOLTHA_HOST,
1757 rest_port = self.VOLTHA_REST_PORT,
1758 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1759 time.sleep(10)
1760 switch_map = None
1761 olt_configured = False
1762 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1763 log_test.info('Installing OLT app')
1764 OnosCtrl.install_app(self.olt_app_file)
1765 time.sleep(5)
1766 log_test.info('Adding subscribers through OLT app')
1767 self.config_olt(switch_map)
1768 olt_configured = True
1769 time.sleep(5)
1770 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
1771 try:
1772 assert_equal(dhcp_status, True)
1773 #assert_equal(status, True)
1774 time.sleep(10)
1775 finally:
1776 self.voltha.disable_device(device_id, delete = True)
1777 self.remove_olt(switch_map)
1778 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001779
Thangavelu K S735a6662017-06-15 18:08:23 +00001780 reactor.callLater(0, dhcp_flow_check_scenario, df)
1781 return df
1782
1783 @deferred(TESTCASE_TIMEOUT)
1784 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00001785 """
1786 Test Method:
1787 0. Make sure that voltha is up and running on CORD-POD setup.
1788 1. OLT and ONU is detected and validated.
1789 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1790 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
1791 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.
1792 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001793 df = defer.Deferred()
1794 def dhcp_flow_check_scenario(df):
1795 log_test.info('Enabling ponsim_olt')
1796 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1797 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1798 assert_not_equal(device_id, None)
1799 voltha = VolthaCtrl(self.VOLTHA_HOST,
1800 rest_port = self.VOLTHA_REST_PORT,
1801 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1802 time.sleep(10)
1803 switch_map = None
1804 olt_configured = False
1805 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1806 log_test.info('Installing OLT app')
1807 OnosCtrl.install_app(self.olt_app_file)
1808 time.sleep(5)
1809 log_test.info('Adding subscribers through OLT app')
1810 self.config_olt(switch_map)
1811 olt_configured = True
1812 time.sleep(5)
1813 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
1814 try:
1815 assert_equal(dhcp_status, True)
1816 #assert_equal(status, True)
1817 time.sleep(10)
1818 finally:
1819 self.voltha.disable_device(device_id, delete = True)
1820 self.remove_olt(switch_map)
1821 df.callback(0)
1822
1823 reactor.callLater(0, dhcp_flow_check_scenario, df)
1824 return df
1825
1826
1827 @deferred(TESTCASE_TIMEOUT)
1828 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00001829 """
1830 Test Method:
1831 0. Make sure that voltha is up and running on CORD-POD setup.
1832 1. OLT and ONU is detected and validated.
1833 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1834 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1835 4. Verify that subscriber get ip from dhcp server successfully.
1836 5. Deactivate dhcp server app in onos.
1837 6. Repeat step 3.
1838 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
1839 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001840 df = defer.Deferred()
1841 dhcp_app = 'org.onosproject.dhcp'
1842 def dhcp_flow_check_scenario(df):
1843 log_test.info('Enabling ponsim_olt')
1844 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1845 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1846 assert_not_equal(device_id, None)
1847 voltha = VolthaCtrl(self.VOLTHA_HOST,
1848 rest_port = self.VOLTHA_REST_PORT,
1849 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1850 time.sleep(10)
1851 switch_map = None
1852 olt_configured = False
1853 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1854 log_test.info('Installing OLT app')
1855 OnosCtrl.install_app(self.olt_app_file)
1856 time.sleep(5)
1857 log_test.info('Adding subscribers through OLT app')
1858 self.config_olt(switch_map)
1859 olt_configured = True
1860 time.sleep(5)
1861# dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
1862 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "app_deactivation",))
1863 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
1864 log_test.info('Restart dhcp app in onos during client send discover to voltha')
1865 thread2.start()
1866 time.sleep(randint(0,1))
1867 thread1.start()
1868 time.sleep(10)
1869 thread1.join()
1870 thread2.join()
1871 try:
1872 assert_equal(self.success, True)
1873 #assert_equal(status, True)
1874 time.sleep(10)
1875 finally:
1876 self.voltha.disable_device(device_id, delete = True)
1877 self.remove_olt(switch_map)
1878 df.callback(0)
1879
1880 reactor.callLater(0, dhcp_flow_check_scenario, df)
1881 return df
1882
1883 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001884 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
1885 """
1886 Test Method:
1887 0. Make sure that voltha is up and running on CORD-POD setup.
1888 1. OLT and ONU is detected and validated.
1889 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1890 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1891 4. Verify that subscriber get ip from dhcp server successfully.
1892 5. Send dhcp renew packet to dhcp server which is running as onos app.
1893 6. Repeat step 4.
1894 """
1895 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
1896 """
1897 Test Method:
1898 0. Make sure that voltha is up and running on CORD-POD setup.
1899 1. OLT and ONU is detected and validated.
1900 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1901 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1902 4. Verify that subscriber get ip from dhcp server successfully.
1903 5. Send dhcp rebind packet to dhcp server which is running as onos app.
1904 6. Repeat step 4.
1905 """
1906 def test_subscriber_with_voltha_for_dhcp_disable_olt_in_voltha(self):
1907 """
1908 Test Method:
1909 0. Make sure that voltha is up and running on CORD-POD setup.
1910 1. OLT and ONU is detected and validated.
1911 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1912 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1913 4. Verify that subscriber get ip from dhcp server successfully.
1914 5. Disable olt devices which is being detected in voltha CLI.
1915 6. Repeat step 3.
1916 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
1917 """
1918 def test_subscriber_with_voltha_for_dhcp_disable_enable_olt_in_voltha(self):
1919 """
1920 Test Method:
1921 0. Make sure that voltha is up and running on CORD-POD setup.
1922 1. OLT and ONU is detected and validated.
1923 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1924 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1925 4. Verify that subscriber get ip from dhcp server successfully.
1926 5. Disable olt devices which is being detected in voltha CLI.
1927 6. Repeat step 3.
1928 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
1929 8. Enable olt devices which is being detected in voltha CLI.
1930 9. Repeat steps 3 and 4.
1931 """
1932 def test_subscriber_with_voltha_for_dhcp_disable_onu_port_in_voltha(self):
1933 """
1934 Test Method:
1935 0. Make sure that voltha is up and running on CORD-POD setup.
1936 1. OLT and ONU is detected and validated.
1937 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1938 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1939 4. Verify that subscriber get ip from dhcp server successfully.
1940 5. Disable onu port which is being detected in voltha CLI.
1941 6. Repeat step 3.
1942 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
1943 """
1944 def test_subscriber_with_voltha_for_dhcp_disable_enable_onu_port_in_voltha(self):
1945 """
1946 Test Method:
1947 0. Make sure that voltha is up and running on CORD-POD setup.
1948 1. OLT and ONU is detected and validated.
1949 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1950 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1951 4. Verify that subscriber get ip from dhcp server successfully.
1952 5. Disable onu port which is being detected in voltha CLI.
1953 6. Repeat step 3.
1954 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
1955 8. Enable onu port which is being detected in voltha CLI.
1956 9. Repeat steps 3 and 4.
1957 """
1958
1959 def test_two_subscriber_with_voltha_for_dhcp_discover(self):
1960 """
1961 Test Method:
1962 0. Make sure that voltha is up and running on CORD-POD setup.
1963 1. OLT and ONU is detected and validated.
1964 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1965 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
1966 4. Verify that subscribers had got different ips from dhcp server successfully.
1967 """
1968
1969 def test_two_subscriber_with_voltha_for_dhcp_multiple_discover(self):
1970 """
1971 Test Method:
1972 0. Make sure that voltha is up and running on CORD-POD setup.
1973 1. OLT and ONU is detected and validated.
1974 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1975 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
1976 4. Verify that subscribers had got ip from dhcp server successfully.
1977 5. Repeat step 3 and 4 for 10 times for both subscribers.
1978 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
1979 """
1980 def test_two_subscriber_with_voltha_for_dhcp_multiple_discover_for_one_subscriber(self):
1981 """
1982 Test Method:
1983 0. Make sure that voltha is up and running on CORD-POD setup.
1984 1. OLT and ONU is detected and validated.
1985 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1986 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
1987 4. Verify that subscribers had got ip from dhcp server successfully.
1988 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
1989 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
1990 """
1991 def test_two_subscriber_with_voltha_for_dhcp_discover_desired_ip_address_for_one_subscriber(self):
1992 """
1993 Test Method:
1994 0. Make sure that voltha is up and running on CORD-POD setup.
1995 1. OLT and ONU is detected and validated.
1996 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1997 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
1998 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
1999 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
2000 """
2001 def test_two_subscriber_with_voltha_for_dhcp_discover_within_and_wothout_dhcp_pool_ip_addresses(self):
2002 """
2003 Test Method:
2004 0. Make sure that voltha is up and running on CORD-POD setup.
2005 1. OLT and ONU is detected and validated.
2006 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2007 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
2008 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
2009 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
2010 """
2011 def test_two_subscriber_with_voltha_for_dhcp_disable_onu_port_for_one_subscriber(self):
2012 """
2013 Test Method:
2014 0. Make sure that voltha is up and running on CORD-POD setup.
2015 1. OLT and ONU is detected and validated.
2016 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2017 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2018 4. Verify that subscribers had got ip from dhcp server successfully.
2019 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
2020 6. Repeat step 3 and 4 for one subscriber where uni port is down.
2021 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
2022 """
2023 def test_two_subscriber_with_voltha_for_dhcp_disable_enable_onu_port_for_one_subscriber(self):
2024 """
2025 Test Method:
2026 0. Make sure that voltha is up and running on CORD-POD setup.
2027 1. OLT and ONU is detected and validated.
2028 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2029 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2030 4. Verify that subscribers had got ip from dhcp server successfully.
2031 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
2032 6. Repeat step 3 and 4 for one subscriber where uni port is down.
2033 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
2034 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
2035 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
2036 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
2037 """
2038 def test_two_subscriber_with_voltha_for_dhcp_disable_olt_detected_in_voltha(self):
2039 """
2040 Test Method:
2041 0. Make sure that voltha is up and running on CORD-POD setup.
2042 1. OLT and ONU is detected and validated.
2043 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2044 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2045 4. Verify that subscribers had got ip from dhcp server successfully.
2046 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
2047 6. Disable the olt device which is detected in voltha.
2048 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
2049 """
2050 def test_two_subscriber_with_voltha_for_dhcp_disable_enable_olt_detected_in_voltha(self):
2051 """
2052 Test Method:
2053 0. Make sure that voltha is up and running on CORD-POD setup.
2054 1. OLT and ONU is detected and validated.
2055 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2056 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2057 4. Verify that subscribers had got ip from dhcp server successfully.
2058 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
2059 6. Disable the olt device which is detected in voltha.
2060 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
2061 8. Enable the olt device which is detected in voltha.
2062 9. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
2063 """
2064 def test_two_subscriber_with_voltha_for_dhcp_pause_olt_detected_in_voltha(self):
2065 """
2066 Test Method:
2067 0. Make sure that voltha is up and running on CORD-POD setup.
2068 1. OLT and ONU is detected and validated.
2069 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2070 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2071 4. Verify that subscribers had got ip from dhcp server successfully.
2072 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
2073 6. Pause the olt device which is detected in voltha.
2074 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
2075 """
2076 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request(self):
2077 """
2078 Test Method:
2079 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2080 1. OLT and ONU is detected and validated.
2081 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2082 3. Send dhcp request from residential subscrber to external dhcp server.
2083 4. Verify that subscriber get ip from external dhcp server successfully.
2084 """
2085
2086 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_broadcast_source_mac(self):
2087 """
2088 Test Method:
2089 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
2090 1. OLT and ONU is detected and validated.
2091 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2092 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
2093 4. Verify that subscriber should not get ip from external dhcp server.
2094 """
2095
2096 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_multicast_source_mac(self):
2097 """
2098 Test Method:
2099 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
2100 1. OLT and ONU is detected and validated.
2101 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2102 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
2103 4. Verify that subscriber should not get ip from external dhcp server.
2104 """
2105
2106 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_source_mac(self):
2107 """
2108 Test Method:
2109 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2110 1. OLT and ONU is detected and validated.
2111 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2112 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
2113 4. Verify that subscriber should not get ip from external dhcp server.
2114 """
2115
2116 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_and_release(self):
2117 """
2118 Test Method:
2119 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2120 1. OLT and ONU is detected and validated.
2121 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2122 3. Send dhcp request from residential subscrber to external dhcp server.
2123 4. Verify that subscriber get ip from external dhcp server successfully.
2124 5. Send dhcp release from residential subscrber to external dhcp server.
2125 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
2126 """
2127
2128 def test_subscriber_with_voltha_for_dhcpRelay_starvation(self):
2129 """
2130 Test Method:
2131 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2132 1. OLT and ONU is detected and validated.
2133 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2134 3. Send dhcp request from residential subscriber to external dhcp server.
2135 4. Verify that subscriber get ip from external dhcp server. successfully.
2136 5. Repeat step 3 and 4 for 10 times.
2137 6 Verify that subscriber should get ip from external dhcp server..
2138 """
2139
2140 def test_subscriber_with_voltha_for_dhcpRelay_starvation_negative_scenario(self):
2141 """
2142 Test Method:
2143 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2144 1. OLT and ONU is detected and validated.
2145 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2146 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
2147 4. Verify that subscriber should not get ip from external dhcp server..
2148 5. Repeat steps 3 and 4 for 10 times.
2149 6 Verify that subscriber should not get ip from external dhcp server..
2150 """
2151 def test_subscriber_with_voltha_for_dhcpRelay_sending_multiple_discover(self):
2152 """
2153 Test Method:
2154 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2155 1. OLT and ONU is detected and validated.
2156 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2157 3. Send dhcp request from residential subscriber to external dhcp server.
2158 4. Verify that subscriber get ip from external dhcp server. successfully.
2159 5. Repeat step 3 for 50 times.
2160 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
2161 """
2162 def test_subscriber_with_voltha_for_dhcpRelay_sending_multiple_request(self):
2163 """
2164 Test Method:
2165 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2166 1. OLT and ONU is detected and validated.
2167 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2168 3. Send dhcp request from residential subscriber to external dhcp server.
2169 4. Verify that subscriber get ip from external dhcp server. successfully.
2170 5. Send DHCP request to external dhcp server.
2171 6. Repeat step 5 for 50 times.
2172 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
2173 """
2174
2175 def test_subscriber_with_voltha_for_dhcpRelay_requesting_desired_ip_address(self):
2176 """
2177 Test Method:
2178 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2179 1. OLT and ONU is detected and validated.
2180 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2181 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
2182 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
2183 """
2184
2185 def test_subscriber_with_voltha_for_dhcpRelay_requesting_desired_out_of_pool_ip_address(self):
2186 """
2187 Test Method:
2188 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2189 1. OLT and ONU is detected and validated.
2190 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2191 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
2192 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.
2193 """
2194
2195 def test_subscriber_with_voltha_for_dhcpRelay_deactivating_dhcpRelay_app_in_onos(self):
2196 """
2197 Test Method:
2198 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2199 1. OLT and ONU is detected and validated.
2200 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2201 3. Send dhcp request from residential subscriber to external dhcp server.
2202 4. Verify that subscriber get ip from external dhcp server. successfully.
2203 5. Deactivate dhcp server app in onos.
2204 6. Repeat step 3.
2205 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
2206 """
2207
2208 def test_subscriber_with_voltha_for_dhcpRelay_renew_time(self):
2209 """
2210 Test Method:
2211 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2212 1. OLT and ONU is detected and validated.
2213 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2214 3. Send dhcp request from residential subscriber to external dhcp server.
2215 4. Verify that subscriber get ip from external dhcp server. successfully.
2216 5. Send dhcp renew packet to external dhcp server.
2217 6. Repeat step 4.
2218 """
2219
2220 def test_subscriber_with_voltha_for_dhcpRelay_rebind_time(self):
2221 """
2222 Test Method:
2223 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2224 1. OLT and ONU is detected and validated.
2225 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2226 3. Send dhcp request from residential subscriber to external dhcp server.
2227 4. Verify that subscriber get ip from external dhcp server. successfully.
2228 5. Send dhcp rebind packet to external dhcp server.
2229 6. Repeat step 4.
2230 """
2231
2232 def test_subscriber_with_voltha_for_dhcpRelay_disable_olt_in_voltha(self):
2233 """
2234 Test Method:
2235 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2236 1. OLT and ONU is detected and validated.
2237 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2238 3. Send dhcp request from residential subscriber to external dhcp server.
2239 4. Verify that subscriber get ip from external dhcp server. successfully.
2240 5. Disable olt devices which is being detected in voltha CLI.
2241 6. Repeat step 3.
2242 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
2243 """
2244
2245 def test_subscriber_with_voltha_for_dhcpRelay_toggling_olt_in_voltha(self):
2246 """
2247 Test Method:
2248 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2249 1. OLT and ONU is detected and validated.
2250 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2251 3. Send dhcp request from residential subscriber to external dhcp server.
2252 4. Verify that subscriber get ip from external dhcp server. successfully.
2253 5. Disable olt devices which is being detected in voltha CLI.
2254 6. Repeat step 3.
2255 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
2256 8. Enable olt devices which is being detected in voltha CLI.
2257 9. Repeat steps 3 and 4.
2258 """
2259
2260 def test_subscriber_with_voltha_for_dhcpRelay_disable_onu_port_in_voltha(self):
2261 """
2262 Test Method:
2263 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2264 1. OLT and ONU is detected and validated.
2265 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2266 3. Send dhcp request from residential subscriber to external dhcp server.
2267 4. Verify that subscriber get ip from external dhcp server. successfully.
2268 5. Disable onu port which is being detected in voltha CLI.
2269 6. Repeat step 3.
2270 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
2271 """
2272
2273 def test_subscriber_with_voltha_for_dhcpRelay_disable_enable_onu_port_in_voltha(self):
2274 """
2275 Test Method:
2276 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2277 1. OLT and ONU is detected and validated.
2278 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2279 3. Send dhcp request from residential subscriber to external dhcp server.
2280 4. Verify that subscriber get ip from external dhcp server. successfully.
2281 5. Disable onu port which is being detected in voltha CLI.
2282 6. Repeat step 3.
2283 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
2284 8. Enable onu port which is being detected in voltha CLI.
2285 9. Repeat steps 3 and 4.
2286 """
2287
2288 def test_two_subscriber_with_voltha_for_dhcpRelay_discover(self):
2289 """
2290 Test Method:
2291 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2292 1. OLT and ONU is detected and validated.
2293 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2294 3. Send dhcp request from two residential subscribers to external dhcp server.
2295 4. Verify that subscribers had got different ips from external dhcp server. successfully.
2296 """
2297
2298 def test_two_subscriber_with_voltha_for_dhcpRelay_multiple_discover(self):
2299 """
2300 Test Method:
2301 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2302 1. OLT and ONU is detected and validated.
2303 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2304 3. Send dhcp request from two residential subscribers to external dhcp server.
2305 4. Verify that subscribers had got ip from external dhcp server. successfully.
2306 5. Repeat step 3 and 4 for 10 times for both subscribers.
2307 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
2308 """
2309
2310 def test_two_subscriber_with_voltha_for_dhcpRelay_multiple_discover_for_one_subscriber(self):
2311 """
2312 Test Method:
2313 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2314 1. OLT and ONU is detected and validated.
2315 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2316 3. Send dhcp request from two residential subscribers to external dhcp server.
2317 4. Verify that subscribers had got ip from external dhcp server. successfully.
2318 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
2319 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
2320 """
2321
2322 def test_two_subscriber_with_voltha_for_dhcpRelay_discover_desired_ip_address_for_one_subscriber(self):
2323 """
2324 Test Method:
2325 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2326 1. OLT and ONU is detected and validated.
2327 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2328 3. Send dhcp request from one residential subscriber to external dhcp server.
2329 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
2330 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
2331 """
2332
2333 def test_two_subscriber_with_voltha_for_dhcpRelay_discover_in_range_and_out_of_range_from_dhcp_pool_ip_addresses(self):
2334 """
2335 Test Method:
2336 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2337 1. OLT and ONU is detected and validated.
2338 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2339 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
2340 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
2341 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
2342 """
2343
2344 def test_two_subscriber_with_voltha_for_dhcpRelay_disable_onu_port_for_one_subscriber(self):
2345 """
2346 Test Method:
2347 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2348 1. OLT and ONU is detected and validated.
2349 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2350 3. Send dhcp request from two residential subscribers to external dhcp server.
2351 4. Verify that subscribers had got ip from external dhcp server. successfully.
2352 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
2353 6. Repeat step 3 and 4 for one subscriber where uni port is down.
2354 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
2355 """
2356
2357 def test_two_subscriber_with_voltha_for_dhcpRelay_toggle_onu_port_for_one_subscriber(self):
2358 """
2359 Test Method:
2360 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2361 1. OLT and ONU is detected and validated.
2362 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2363 3. Send dhcp request from two residential subscribers to external dhcp server.
2364 4. Verify that subscribers had got ip from external dhcp server. successfully.
2365 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
2366 6. Repeat step 3 and 4 for one subscriber where uni port is down.
2367 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
2368 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
2369 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
2370 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
2371 """
2372
2373 def test_two_subscriber_with_voltha_for_dhcpRelay_disable_olt_detected_in_voltha(self):
2374 """
2375 Test Method:
2376 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2377 1. OLT and ONU is detected and validated.
2378 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2379 3. Send dhcp request from two residential subscribers to external dhcp server.
2380 4. Verify that subscribers had got ip from external dhcp server. successfully.
2381 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
2382 6. Disable the olt device which is detected in voltha.
2383 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
2384 """
2385
2386 def test_two_subscriber_with_voltha_for_dhcpRelay_toggle_olt_detected_in_voltha(self):
2387 """
2388 Test Method:
2389 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2390 1. OLT and ONU is detected and validated.
2391 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2392 3. Send dhcp request from two residential subscribers to external dhcp server.
2393 4. Verify that subscribers had got ip from external dhcp server. successfully.
2394 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
2395 6. Disable the olt device which is detected in voltha.
2396 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
2397 8. Enable the olt device which is detected in voltha.
2398 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
2399 """
2400
2401 def test_two_subscriber_with_voltha_for_dhcpRelay_pause_olt_detected_in_voltha(self):
2402 """
2403 Test Method:
2404 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2405 1. OLT and ONU is detected and validated.
2406 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2407 3. Send dhcp request from two residential subscribers to external dhcp server.
2408 4. Verify that subscribers had got ip from external dhcp server. successfully.
2409 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
2410 6. Pause the olt device which is detected in voltha.
2411 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
2412 """