blob: 78a84a99a73db6d6a2b7fc1d7e5c11b7de75f199 [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):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000162 if validation:
Thangavelu K S735a6662017-06-15 18:08:23 +0000163 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)
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000172 log_test.info('Dhcp client did not get IP from server')
Thangavelu K S735a6662017-06-15 18:08:23 +0000173
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000174 return cip,sip
175
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000176 def dhcp_request(self, onu_iface = None, seed_ip = '10.10.10.1', update_seed = False, validation = True):
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000177 config = {'startip':'10.10.10.20', 'endip':'10.10.10.200',
178 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
179 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
180 self.onos_dhcp_table_load(config)
181 dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000182 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed, validation = validation)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000183 return cip, sip
184
185 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700186 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700187 cls.update_apps_version()
A R Karthick35495c32017-05-11 14:58:32 -0700188 cls.voltha = VolthaCtrl(cls.VOLTHA_HOST, rest_port = cls.VOLTHA_REST_PORT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000189 cls.install_app_table()
190 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
191 cls.port_map, cls.port_list = cls.olt.olt_port_map()
192 cls.switches = cls.port_map['switches']
193 cls.num_ports = cls.port_map['num_ports']
194 if cls.num_ports > 1:
195 cls.num_ports -= 1 ##account for the tx port
196 cls.activate_apps(cls.apps + cls.olt_apps)
A.R Karthickf874d032017-06-07 18:47:51 -0700197 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000198
A.R Karthick3493a572017-06-07 18:28:10 -0700199 @classmethod
200 def tearDownClass(cls):
201 '''Deactivate the olt apps and restart OVS back'''
202 apps = cls.olt_apps + ( cls.table_app,)
203 for app in apps:
204 onos_ctrl = OnosCtrl(app)
205 onos_ctrl.deactivate()
206 cls.install_app_igmp()
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700207
A.R Karthick3493a572017-06-07 18:28:10 -0700208 @classmethod
209 def install_app_igmp(cls):
210 ##Uninstall the table app on class exit
211 OnosCtrl.uninstall_app(cls.table_app)
212 time.sleep(2)
213 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
214 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700215
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000216 def remove_olt(self, switch_map):
217 controller = get_controller()
218 auth = ('karaf', 'karaf')
219 #remove subscriber for every port on all the voltha devices
220 for device, device_map in switch_map.iteritems():
221 uni_ports = device_map['ports']
222 uplink_vlan = device_map['uplink_vlan']
223 for port in uni_ports:
224 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
225 device,
226 port)
227 resp = requests.delete(rest_url, auth = auth)
228 if resp.status_code not in [204, 202, 200]:
229 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
230 else:
231 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
232 OnosCtrl.uninstall_app(self.olt_app_file)
233
234 def config_olt(self, switch_map):
235 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000236 auth = ('karaf', 'karaf')
237 #configure subscriber for every port on all the voltha devices
238 for device, device_map in switch_map.iteritems():
239 uni_ports = device_map['ports']
240 uplink_vlan = device_map['uplink_vlan']
241 for port in uni_ports:
242 vlan = port
243 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
244 device,
245 port,
246 vlan)
247 resp = requests.post(rest_url, auth = auth)
248 #assert_equal(resp.ok, True)
249
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000250 def voltha_uni_port_toggle(self, uni_port = None):
251 ## Admin state of port is down and up
252 if not uni_port:
253 uni_port = self.INTF_RX_DEFAULT
254 cmd = 'ifconfig {} down'.format(uni_port)
255 os.system(cmd)
256 log_test.info('Admin state of uni_port is down')
257 time.sleep(30)
258 cmd = 'ifconfig {} up'.format(uni_port)
259 os.system(cmd)
260 log_test.info('Admin state of uni_port is up now')
261 time.sleep(30)
262 return
263
264
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000265 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000266 def install_app_table(cls):
267 ##Uninstall the existing app if any
268 OnosCtrl.uninstall_app(cls.table_app)
269 time.sleep(2)
270 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
271 OnosCtrl.install_app(cls.table_app_file)
272 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000273
274 @classmethod
275 def activate_apps(cls, apps):
276 for app in apps:
277 onos_ctrl = OnosCtrl(app)
278 status, _ = onos_ctrl.activate()
279 assert_equal(status, True)
280 time.sleep(2)
281
Thangavelu K S735a6662017-06-15 18:08:23 +0000282 @classmethod
283 def deactivate_apps(cls, apps):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000284 cls.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000285 for app in apps:
286 onos_ctrl = OnosCtrl(app)
287 status, _ = onos_ctrl.deactivate()
288 if status is False:
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000289 cls.success = False
290 # assert_equal(status, True)
Thangavelu K S735a6662017-06-15 18:08:23 +0000291 time.sleep(2)
292
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000293 def tls_flow_check(self, olt_uni_port, cert_info = None):
294 def tls_fail_cb():
295 log_test.info('TLS verification failed')
296 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700297 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000298 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
299 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000300 if tls.failTest is True:
301 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000302 assert_equal(tls.failTest, False)
303 if cert_info == "no_cert":
304 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
305 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
306 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000307 if tls.failTest is False:
308 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000309 assert_equal(tls.failTest, True)
310 if cert_info == "invalid_cert":
311 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
312 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
313 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000314 if tls.failTest is False:
315 self.success = False
316 assert_equal(tls.failTest, True)
317 if cert_info == "same_cert":
318 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
319 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
320 tls.runTest()
321 if tls.failTest is False:
322 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000323 assert_equal(tls.failTest, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000324 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 +0000325 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 +0000326 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
327 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
328 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000329 if tls.failTest is False:
330 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000331 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000332 self.test_status = True
333 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700334
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000335 def dhcp_flow_check(self, onu_iface =None, negative_test = None):
Thangavelu K S735a6662017-06-15 18:08:23 +0000336 self.success = True
337
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000338 if negative_test is None:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000339 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
340 if not cip or sip:
Thangavelu K S735a6662017-06-15 18:08:23 +0000341 self.success = False
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000342 self.test_status = False
343 assert_not_equal(cip,None)
344 assert_not_equal(sip,None)
345 else:
346 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
347 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000348
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000349 if negative_test == "interrupting_dhcp_flows":
350 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
Thangavelu K S735a6662017-06-15 18:08:23 +0000351 if cip is not None:
352 self.success = False
353 assert_equal(cip,None)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000354 log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000355 self.test_status = True
356
357 if negative_test == "invalid_src_mac_broadcast":
358 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
359 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
360 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
361 self.onos_dhcp_table_load(config)
362 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
363 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000364
365 if cip is not None:
366 self.success = False
367 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 +0000368 assert_equal(cip,None)
369 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
370 self.test_status = True
371 if negative_test == "invalid_src_mac_multicast":
372 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
373 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
374 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
375 self.onos_dhcp_table_load(config)
376 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
377 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000378 if cip is not None:
379 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000380 assert_equal(cip,None)
381 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
382 self.test_status = True
383
384 if negative_test == "invalid_src_mac_junk":
385 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
386 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
387 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
388 self.onos_dhcp_table_load(config)
389 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
390 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000391 if cip is not None:
392 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000393 assert_equal(cip,None)
394 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
395 self.test_status = True
396
397 if negative_test == "request_release":
398 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
399 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
400 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
401 self.onos_dhcp_table_load(config)
402 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
403 cip, sip = self.dhcp_sndrcv(self.dhcp)
404 log_test.info('Releasing ip %s to server %s' %(cip, sip))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000405 if not self.dhcp.release(cip):
406 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000407 assert_equal(self.dhcp.release(cip), True)
408 log_test.info('Triggering DHCP discover again after release')
409 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
410 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000411 if not cip == cip2:
Thangavelu K S735a6662017-06-15 18:08:23 +0000412 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000413 assert_equal(cip, cip2)
414 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
415 assert_equal(self.dhcp.release(cip2), True)
416 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000417 if negative_test == "starvation_positive":
418 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
419 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
420 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
421 self.onos_dhcp_table_load(config)
422 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
423 ip_map = {}
424 for i in range(10):
425 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
426 if ip_map.has_key(cip):
427 self.success = False
428 log_test.info('IP %s given out multiple times' %cip)
429 assert_equal(False, ip_map.has_key(cip))
430 ip_map[cip] = sip
431 self.test_status = True
432 if negative_test == "starvation_negative":
433 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
434 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
435 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
436 self.onos_dhcp_table_load(config)
437 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
438 log_test.info('Verifying passitive case')
439 for x in xrange(50):
440 mac = RandMAC()._fix()
441 self.dhcp_sndrcv(self.dhcp,mac = mac)
442 log_test.info('Verifying negative case')
443 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000444 if cip or sip is not None:
445 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000446 assert_equal(cip, None)
447 assert_equal(sip, None)
448 self.test_status = True
449 self.success = True
450 if negative_test == "multiple_discover":
451 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
452 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
453 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
454 self.onos_dhcp_table_load(config)
455 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
456 cip, sip, mac, _ = self.dhcp.only_discover()
457 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
458 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000459 if cip is None:
460 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000461 assert_not_equal(cip, None)
462 log_test.info('Triggering DHCP discover again.')
463 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000464 if not new_cip == cip:
465 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000466 assert_equal(new_cip, cip)
467 log_test.info('client got same IP as expected when sent 2nd discovery')
468 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000469 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000470 if negative_test == "multiple_requests":
471 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
472 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
473 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
474 self.onos_dhcp_table_load(config)
475 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
476 log_test.info('Sending DHCP discover and DHCP request.')
477 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
478 mac = self.dhcp.get_mac(cip)[0]
479 log_test.info("Sending DHCP request again.")
480 new_cip, new_sip = self.dhcp.only_request(cip, mac)
481 assert_equal(new_cip,cip)
482 log_test.info('server offered same IP to clain for multiple requests, as expected')
483 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000484# self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000485 if negative_test == "desired_ip_address":
486 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
487 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
488 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
489 self.onos_dhcp_table_load(config)
490 self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface)
491 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000492 if cip or sip is None:
493 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000494 assert_not_equal(cip, None)
495 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
496 (cip, sip, mac))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000497 if not self.dhcp.seed_ip == cip:
498 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000499 assert_equal(cip,self.dhcp.seed_ip)
500 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
501 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000502 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000503 if negative_test == "desired_out_of_pool_ip_address":
504 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
505 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
506 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
507 self.onos_dhcp_table_load(config)
508 self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface)
509 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000510 if cip or sip is None:
511 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000512 assert_not_equal(cip, None)
513 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
514 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000515 if self.dhcp.seed_ip == cip:
516 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000517 assert_not_equal(cip,self.dhcp.seed_ip)
518 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
519 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000520 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000521 if negative_test == "dhcp_renew":
522 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
523 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
524 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
525 self.onos_dhcp_table_load(config)
526 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
527 cip, sip, mac, _ = self.dhcp.only_discover()
528 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
529 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000530 if cip or sip is None:
531 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000532 assert_not_equal(cip, None)
533 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
534 log_test.info('waiting renew time %d seconds to send next request packet'%lval)
535 time.sleep(lval)
536 latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000537 if not latest_cip == cip:
538 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000539 assert_equal(latest_cip,cip)
540 log_test.info('client got same IP after renew time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +0000541 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000542 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000543 if negative_test == "dhcp_rebind":
544 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
545 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
546 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
547 self.onos_dhcp_table_load(config)
548 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
549 cip, sip, mac, _ = self.dhcp.only_discover()
550 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
551 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000552 if cip or sip is None:
553 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000554 assert_not_equal(cip, None)
555 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
556 log_test.info('waiting rebind time %d seconds to send next request packet'%lval)
557 time.sleep(lval)
558 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000559 if not latest_cip == cip:
560 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000561 assert_equal(latest_cip,cip)
562 log_test.info('client got same IP after rebind time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +0000563 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000564 # self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000565 return self.test_status
566
A.R Karthick8a507cf2017-06-02 18:44:49 -0700567 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -0700568 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -0700569 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
570 assert_not_equal(device_id, None)
571 try:
572 assert_equal(status, True)
573 time.sleep(10)
574 finally:
575 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000576
A.R Karthick8a507cf2017-06-02 18:44:49 -0700577 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -0700578 log_test.info('Enabling ponsim_olt')
579 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -0700580 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
581 assert_not_equal(device_id, None)
582 try:
583 assert_equal(status, True)
584 time.sleep(10)
585 finally:
586 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -0700587
Thangavelu K S008f38e2017-05-15 19:36:55 +0000588 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
589 """
590 Test Method:
591 0. Make sure that voltha is up and running on CORD-POD setup.
592 1. OLT and ONU is detected and validated.
593 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
594 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
595 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
596 5. Verify that subscriber is authenticated successfully.
597 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000598 log_test.info('Enabling ponsim_olt')
599 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
600 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
601 assert_not_equal(device_id, None)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700602 if status == False:
603 self.voltha.disable_device(device_id, delete = True)
604 assert_equal(status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000605 time.sleep(10)
606 switch_map = None
607 olt_configured = False
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700608 voltha = VolthaCtrl(self.VOLTHA_HOST,
609 rest_port = self.VOLTHA_REST_PORT,
610 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000611 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700612 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
613 if not switch_map:
614 log_test.info('No voltha devices found')
615 return
616 log_test.info('Installing OLT app')
617 OnosCtrl.install_app(self.olt_app_file)
618 time.sleep(5)
619 log_test.info('Adding subscribers through OLT app')
620 self.config_olt(switch_map)
621 olt_configured = True
622 time.sleep(5)
623 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000624 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000625 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700626 if switch_map is not None:
627 if olt_configured is True:
628 self.remove_olt(switch_map)
629 self.voltha.disable_device(device_id, delete = True)
630 time.sleep(10)
631 OnosCtrl.uninstall_app(self.olt_app_name)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000632
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000633 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000634 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
635 """
636 Test Method:
637 0. Make sure that voltha is up and running on CORD-POD setup.
638 1. OLT and ONU is detected and validated.
639 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
640 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
641 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
642 5. Verify that subscriber authentication is unsuccessful..
643 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000644 df = defer.Deferred()
645 def tls_flow_check_with_no_cert_scenario(df):
646 log_test.info('Enabling ponsim_olt')
647 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
648 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
649 assert_not_equal(device_id, None)
650 voltha = VolthaCtrl(self.VOLTHA_HOST,
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700651 rest_port = self.VOLTHA_REST_PORT,
652 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000653 time.sleep(10)
654 switch_map = None
655 olt_configured = False
656 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
657 log_test.info('Installing OLT app')
658 OnosCtrl.install_app(self.olt_app_file)
659 time.sleep(5)
660 log_test.info('Adding subscribers through OLT app')
661 self.config_olt(switch_map)
662 olt_configured = True
663 time.sleep(5)
664 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
665 try:
666 assert_equal(auth_status, True)
667 assert_equal(status, True)
668 time.sleep(10)
669 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700670 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000671 self.voltha.disable_device(device_id, delete = True)
672 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700673
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000674 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
675 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000676
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000677 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000678 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
679 """
680 Test Method:
681 0. Make sure that voltha is up and running on CORD-POD setup.
682 1. OLT and ONU is detected and validated.
683 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
684 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
685 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
686 5. Verify that subscriber authentication is unsuccessful..
687 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000688 df = defer.Deferred()
689 def tls_flow_check_with_invalid_cert_scenario(df):
690 log_test.info('Enabling ponsim_olt')
691 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
692 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
693 assert_not_equal(device_id, None)
694 voltha = VolthaCtrl(self.VOLTHA_HOST,
695 rest_port = self.VOLTHA_REST_PORT,
696 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
697 time.sleep(10)
698 switch_map = None
699 olt_configured = False
700 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
701 log_test.info('Installing OLT app')
702 OnosCtrl.install_app(self.olt_app_file)
703 time.sleep(5)
704 log_test.info('Adding subscribers through OLT app')
705 self.config_olt(switch_map)
706 olt_configured = True
707 time.sleep(5)
708 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
709 try:
710 assert_equal(auth_status, True)
711 assert_equal(status, True)
712 time.sleep(10)
713 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700714 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000715 self.voltha.disable_device(device_id, delete = True)
716 df.callback(0)
717 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
718 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000719
Thangavelu K S0d745c82017-06-09 21:56:08 +0000720 @deferred(TESTCASE_TIMEOUT)
721 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
722 """
723 Test Method:
724 0. Make sure that voltha is up and running on CORD-POD setup.
725 1. OLT and ONU is detected and validated.
726 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
727 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
728 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
729 5. Verify that subscriber authentication is unsuccessful..
730 """
731 df = defer.Deferred()
732 def tls_flow_check_with_no_cert_scenario(df):
733 log_test.info('Enabling ponsim_olt')
734 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
735 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
736 assert_not_equal(device_id, None)
737 voltha = VolthaCtrl(self.VOLTHA_HOST,
738 rest_port = self.VOLTHA_REST_PORT,
739 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
740 time.sleep(10)
741 switch_map = None
742 olt_configured = False
743 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
744 log_test.info('Installing OLT app')
745 OnosCtrl.install_app(self.olt_app_file)
746 time.sleep(5)
747 log_test.info('Adding subscribers through OLT app')
748 self.config_olt(switch_map)
749 olt_configured = True
750 time.sleep(5)
751 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
752 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
753 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
754 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
755 try:
756 assert_equal(auth_status, True)
757 assert_equal(status, True)
758 time.sleep(10)
759 finally:
760 self.voltha.disable_device(device_id, delete = True)
761 df.callback(0)
762 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
763 return df
764
765 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000766 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
767 """
768 Test Method:
769 0. Make sure that voltha is up and running on CORD-POD setup.
770 1. OLT and ONU is detected and validated.
771 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
772 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
773 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
774 5. Verify that subscriber authentication is unsuccessful..
775 """
Thangavelu K S0d745c82017-06-09 21:56:08 +0000776 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000777 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +0000778 aaa_app = ["org.opencord.aaa"]
779 log_test.info('Enabling ponsim_olt')
780 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
781 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
782 assert_not_equal(device_id, None)
783 voltha = VolthaCtrl(self.VOLTHA_HOST,
784 rest_port = self.VOLTHA_REST_PORT,
785 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
786 time.sleep(10)
787 switch_map = None
788 olt_configured = False
789 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
790 log_test.info('Installing OLT app')
791 OnosCtrl.install_app(self.olt_app_file)
792 time.sleep(5)
793 log_test.info('Adding subscribers through OLT app')
794 self.config_olt(switch_map)
795 olt_configured = True
796 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000797
Thangavelu K S0d745c82017-06-09 21:56:08 +0000798 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
799 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
800 thread1.start()
801 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000802 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +0000803 thread2.start()
804 time.sleep(10)
805 thread1.join()
806 thread2.join()
807 try:
808 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000809 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000810 time.sleep(10)
811 finally:
812 self.voltha.disable_device(device_id, delete = True)
813 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000814 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000815 return df
816
817 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000818 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
819 """
820 Test Method:
821 0. Make sure that voltha is up and running on CORD-POD setup.
822 1. OLT and ONU is detected and validated.
823 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
824 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
825 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
826 5. 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_restarting_radius(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)
849
850 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
851 thread2 = threading.Thread(target = cord_test_radius_restart)
852 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000853 time.sleep(randint(1,2))
854 log_test.info('Restart radius server 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_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000867 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000868
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000869 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000870 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
871 """
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 olt 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 S0d745c82017-06-09 21:56:08 +0000883 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000884 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +0000885 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 S0d745c82017-06-09 21:56:08 +0000905 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000906 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +0000907 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000908 time.sleep(randint(1,2))
909 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +0000910 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 S0d745c82017-06-09 21:56:08 +0000917 time.sleep(10)
918 finally:
919 self.voltha.disable_device(device_id, delete = True)
920 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000921 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000922 return df
923
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000924 @deferred(TESTCASE_TIMEOUT)
925 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +0000926 """
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. Disable uni port 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, "uni_port_admin_down",))
961 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
962 thread1.start()
963 time.sleep(randint(1,2))
964 log_test.info('Admin state of uni port is down and up after delay of 30 sec 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 Se6c77c72017-06-23 21:28:48 +0000980 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(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. Disable uni port 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 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
993
994 """
995 df = defer.Deferred()
996 no_iterations = 10
997 def tls_flow_check_with_disable_olt_device_scenario(df):
998 aaa_app = ["org.opencord.aaa"]
999 log_test.info('Enabling ponsim_olt')
1000 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1001 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1002 assert_not_equal(device_id, None)
1003 voltha = VolthaCtrl(self.VOLTHA_HOST,
1004 rest_port = self.VOLTHA_REST_PORT,
1005 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1006 time.sleep(10)
1007 switch_map = None
1008 olt_configured = False
1009 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1010 log_test.info('Installing OLT app')
1011 OnosCtrl.install_app(self.olt_app_file)
1012 time.sleep(5)
1013 log_test.info('Adding subscribers through OLT app')
1014 self.config_olt(switch_map)
1015 olt_configured = True
1016 time.sleep(5)
1017 for i in range(no_iterations):
1018 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1019 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
1020 thread1.start()
1021 time.sleep(randint(1,2))
1022 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1023 thread2.start()
1024 time.sleep(10)
1025 thread1.join()
1026 thread2.join()
1027 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
1028 try:
1029 # assert_equal(status, True)
1030 assert_equal(auth_status, True)
1031 assert_equal(self.success, True)
1032 time.sleep(10)
1033 finally:
1034 self.voltha.disable_device(device_id, delete = True)
1035 df.callback(0)
1036 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
1037 return df
1038
1039 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001040 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
1041 """
1042 Test Method:
1043 0. Make sure that voltha is up and running on CORD-POD setup.
1044 1. OLT and ONU is detected and validated.
1045 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1046 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1047 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1048 6. Verify that subscriber authenticated successfully.
1049 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
1050 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1051 9. Verify that subscriber authentication is unsuccessful..
1052 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001053 df = defer.Deferred()
1054 def tls_flow_check_operating_olt_state(df):
1055 aaa_app = ["org.opencord.aaa"]
1056 log_test.info('Enabling ponsim_olt')
1057 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1058 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1059 assert_not_equal(device_id, None)
1060 voltha = VolthaCtrl(self.VOLTHA_HOST,
1061 rest_port = self.VOLTHA_REST_PORT,
1062 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1063 time.sleep(10)
1064 switch_map = None
1065 olt_configured = False
1066 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1067 log_test.info('Installing OLT app')
1068 OnosCtrl.install_app(self.olt_app_file)
1069 time.sleep(5)
1070 log_test.info('Adding subscribers through OLT app')
1071 self.config_olt(switch_map)
1072 olt_configured = True
1073 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001074
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001075 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
1076 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
1077 thread1.start()
1078 time.sleep(randint(1,2))
1079 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
1080 thread2.start()
1081 time.sleep(10)
1082 thread1.join()
1083 thread2.join()
1084 try:
1085 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001086 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001087 time.sleep(10)
1088 finally:
1089 self.voltha.disable_device(device_id, delete = True)
1090 df.callback(0)
1091 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1092 return df
1093
1094 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001095 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restarting_olt(self):
1096 """
1097 Test Method:
1098 0. Make sure that voltha is up and running on CORD-POD setup.
1099 1. OLT and ONU is detected and validated.
1100 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1101 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1102 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1103 6. Verify that subscriber authenticated successfully.
1104 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
1105 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1106 9. Verify that subscriber authentication is unsuccessful..
1107 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1108 """
1109 df = defer.Deferred()
1110 no_iterations = 10
1111 def tls_flow_check_with_disable_olt_device_scenario(df):
1112 aaa_app = ["org.opencord.aaa"]
1113 log_test.info('Enabling ponsim_olt')
1114 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1115 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1116 assert_not_equal(device_id, None)
1117 voltha = VolthaCtrl(self.VOLTHA_HOST,
1118 rest_port = self.VOLTHA_REST_PORT,
1119 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1120 time.sleep(10)
1121 switch_map = None
1122 olt_configured = False
1123 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1124 log_test.info('Installing OLT app')
1125 OnosCtrl.install_app(self.olt_app_file)
1126 time.sleep(5)
1127 log_test.info('Adding subscribers through OLT app')
1128 self.config_olt(switch_map)
1129 olt_configured = True
1130 time.sleep(5)
1131 for i in range(no_iterations):
1132 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
1133 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
1134 thread1.start()
1135 time.sleep(randint(1,2))
1136 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
1137 thread2.start()
1138 time.sleep(10)
1139 thread1.join()
1140 thread2.join()
1141 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
1142 try:
1143 # assert_equal(status, True)
1144 assert_equal(auth_status, True)
1145 assert_equal(self.success, True)
1146 time.sleep(10)
1147 finally:
1148 self.voltha.disable_device(device_id, delete = True)
1149 df.callback(0)
1150 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
1151 return df
1152
1153
1154 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001155 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
1156 """
1157 Test Method:
1158 0. Make sure that voltha is up and running on CORD-POD setup.
1159 1. OLT and ONU is detected and validated.
1160 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1161 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1162 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1163 6. Verify that subscriber authenticated successfully.
1164 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
1165 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1166 9. Verify that subscriber authentication is unsuccessful..
1167 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001168 df = defer.Deferred()
1169 def tls_flow_check_operating_olt_state(df):
1170 aaa_app = ["org.opencord.aaa"]
1171 log_test.info('Enabling ponsim_olt')
1172 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1173 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1174 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00001175 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1176
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001177 onu_device_id = devices_list['items'][1]['id']
1178 assert_not_equal(device_id, None)
1179 voltha = VolthaCtrl(self.VOLTHA_HOST,
1180 rest_port = self.VOLTHA_REST_PORT,
1181 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1182 time.sleep(10)
1183 switch_map = None
1184 olt_configured = False
1185 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1186 log_test.info('Installing OLT app')
1187 OnosCtrl.install_app(self.olt_app_file)
1188 time.sleep(5)
1189 log_test.info('Adding subscribers through OLT app')
1190 self.config_olt(switch_map)
1191 olt_configured = True
1192 time.sleep(5)
1193 devices_list = self.voltha.get_devices()
1194 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
1195 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
1196 thread1.start()
1197 time.sleep(randint(1,2))
1198 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
1199 thread2.start()
1200 time.sleep(10)
1201 thread1.join()
1202 thread2.join()
1203 try:
1204 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001205 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001206 time.sleep(10)
1207 finally:
1208 self.voltha.disable_device(device_id, delete = True)
1209 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001210 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001211 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001212
Thangavelu K S9648eed2017-06-13 20:15:25 +00001213 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001214 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
1215 """
1216 Test Method:
1217 0. Make sure that voltha is up and running on CORD-POD setup.
1218 1. OLT and ONU is detected and validated.
1219 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1220 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1221 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1222 6. Verify that subscriber authenticated successfully.
1223 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
1224 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1225 9. Verify that subscriber authentication is unsuccessful..
1226 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1227 """
1228 df = defer.Deferred()
1229 no_iterations = 10
1230 def tls_flow_check_operating_olt_state(df):
1231 aaa_app = ["org.opencord.aaa"]
1232 log_test.info('Enabling ponsim_olt')
1233 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1234 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1235 devices_list = self.voltha.get_devices()
1236 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1237
1238 onu_device_id = devices_list['items'][1]['id']
1239 assert_not_equal(device_id, None)
1240 voltha = VolthaCtrl(self.VOLTHA_HOST,
1241 rest_port = self.VOLTHA_REST_PORT,
1242 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1243 time.sleep(10)
1244 switch_map = None
1245 olt_configured = False
1246 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1247 log_test.info('Installing OLT app')
1248 OnosCtrl.install_app(self.olt_app_file)
1249 time.sleep(5)
1250 log_test.info('Adding subscribers through OLT app')
1251 self.config_olt(switch_map)
1252 olt_configured = True
1253 time.sleep(5)
1254 devices_list = self.voltha.get_devices()
1255 for i in range(no_iterations):
1256 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
1257 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
1258 thread1.start()
1259 time.sleep(randint(1,2))
1260 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
1261 thread2.start()
1262 time.sleep(10)
1263 thread1.join()
1264 thread2.join()
1265 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
1266 try:
1267 # assert_equal(status, True)
1268 assert_equal(auth_status, True)
1269 assert_equal(self.success, True)
1270 time.sleep(10)
1271 finally:
1272 self.voltha.disable_device(device_id, delete = True)
1273 df.callback(0)
1274 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1275 return df
1276
1277
1278 @deferred(TESTCASE_TIMEOUT)
1279 def test_two_subscriberss_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001280 """
1281 Test Method:
1282 0. Make sure that voltha is up and running on CORD-POD setup.
1283 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1284 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1285 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1286 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
1287 5. Verify that two subscribers are authenticated successfully.
1288 """
1289
Thangavelu K S9648eed2017-06-13 20:15:25 +00001290 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001291 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00001292 aaa_app = ["org.opencord.aaa"]
1293 log_test.info('Enabling ponsim_olt')
1294 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1295 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1296 devices_list = self.voltha.get_devices()
1297 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1298
1299 onu_device_id = devices_list['items'][1]['id']
1300 assert_not_equal(device_id, None)
1301 voltha = VolthaCtrl(self.VOLTHA_HOST,
1302 rest_port = self.VOLTHA_REST_PORT,
1303 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1304 time.sleep(10)
1305 switch_map = None
1306 olt_configured = False
1307 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1308 log_test.info('Installing OLT app')
1309 OnosCtrl.install_app(self.olt_app_file)
1310 time.sleep(5)
1311 log_test.info('Adding subscribers through OLT app')
1312 self.config_olt(switch_map)
1313 olt_configured = True
1314 time.sleep(5)
1315 devices_list = self.voltha.get_devices()
1316 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1317 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
1318 thread1.start()
1319 time.sleep(randint(1,2))
1320 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1321 thread2.start()
1322 time.sleep(10)
1323 thread1.join()
1324 thread2.join()
1325 try:
1326 # assert_equal(status, True)
1327 assert_equal(self.success, True)
1328 time.sleep(10)
1329 finally:
1330 self.voltha.disable_device(device_id, delete = True)
1331 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001332 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001333 return df
1334
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001335
Thangavelu K S9648eed2017-06-13 20:15:25 +00001336 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001337 def test_two_subscriberss_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001338 """
1339 Test Method:
1340 0. Make sure that voltha is up and running on CORD-POD setup.
1341 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1342 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1343 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1344 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
1345 5. Verify that two subscribers are not authenticated.
1346 """
1347
Thangavelu K S9648eed2017-06-13 20:15:25 +00001348 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001349 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00001350 aaa_app = ["org.opencord.aaa"]
1351 log_test.info('Enabling ponsim_olt')
1352 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1353 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1354 devices_list = self.voltha.get_devices()
1355 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1356
1357 onu_device_id = devices_list['items'][1]['id']
1358 assert_not_equal(device_id, None)
1359 voltha = VolthaCtrl(self.VOLTHA_HOST,
1360 rest_port = self.VOLTHA_REST_PORT,
1361 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1362 time.sleep(10)
1363 switch_map = None
1364 olt_configured = False
1365 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1366 log_test.info('Installing OLT app')
1367 OnosCtrl.install_app(self.olt_app_file)
1368 time.sleep(5)
1369 log_test.info('Adding subscribers through OLT app')
1370 self.config_olt(switch_map)
1371 olt_configured = True
1372 time.sleep(5)
1373 devices_list = self.voltha.get_devices()
1374 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1375 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
1376 thread1.start()
1377 time.sleep(randint(1,2))
1378 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1379 thread2.start()
1380 time.sleep(10)
1381 thread1.join()
1382 thread2.join()
1383 try:
1384 # assert_equal(status, True)
1385 assert_equal(self.success, True)
1386 time.sleep(10)
1387 finally:
1388 self.voltha.disable_device(device_id, delete = True)
1389 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001390 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001391 return df
1392
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001393 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001394 def test_two_subscriberss_with_voltha_for_eap_tls_authentication_initiating_invalid_tls_packets_for_one_subscriber(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001395 """
1396 Test Method:
1397 0. Make sure that voltha is up and running on CORD-POD setup.
1398 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1399 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1400 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1401 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
1402 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
1403 6. Verify that valid subscriber authenticated successfully.
1404 7. Verify that invalid subscriber are not authenticated successfully.
1405 """
1406
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001407 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001408 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001409 aaa_app = ["org.opencord.aaa"]
1410 log_test.info('Enabling ponsim_olt')
1411 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1412 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1413 devices_list = self.voltha.get_devices()
1414 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1415
1416 onu_device_id = devices_list['items'][1]['id']
1417 assert_not_equal(device_id, None)
1418 voltha = VolthaCtrl(self.VOLTHA_HOST,
1419 rest_port = self.VOLTHA_REST_PORT,
1420 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1421 time.sleep(10)
1422 switch_map = None
1423 olt_configured = False
1424 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1425 log_test.info('Installing OLT app')
1426 OnosCtrl.install_app(self.olt_app_file)
1427 time.sleep(5)
1428 log_test.info('Adding subscribers through OLT app')
1429 self.config_olt(switch_map)
1430 olt_configured = True
1431 time.sleep(5)
1432 devices_list = self.voltha.get_devices()
1433 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1434 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
1435 thread1.start()
1436 time.sleep(randint(1,2))
1437 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1438 thread2.start()
1439 time.sleep(10)
1440 thread1.join()
1441 thread2.join()
1442 try:
1443 # assert_equal(status, True)
1444 assert_equal(self.success, True)
1445 time.sleep(10)
1446 finally:
1447 self.voltha.disable_device(device_id, delete = True)
1448 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001449 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001450 return df
1451
1452 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001453 def test_two_subscriberss_with_voltha_for_eap_tls_authentication_initiating_invalid_cert_for_one_subscriber(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001454 """
1455 Test Method:
1456 0. Make sure that voltha is up and running on CORD-POD setup.
1457 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1458 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1459 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1460 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
1461 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
1462 6. Verify that valid subscriber authenticated successfully.
1463 7. Verify that invalid subscriber are not authenticated successfully.
1464 """
1465
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001466 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001467 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001468 aaa_app = ["org.opencord.aaa"]
1469 log_test.info('Enabling ponsim_olt')
1470 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1471 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1472 devices_list = self.voltha.get_devices()
1473 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1474
1475 onu_device_id = devices_list['items'][1]['id']
1476 assert_not_equal(device_id, None)
1477 voltha = VolthaCtrl(self.VOLTHA_HOST,
1478 rest_port = self.VOLTHA_REST_PORT,
1479 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1480 time.sleep(10)
1481 switch_map = None
1482 olt_configured = False
1483 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1484 log_test.info('Installing OLT app')
1485 OnosCtrl.install_app(self.olt_app_file)
1486 time.sleep(5)
1487 log_test.info('Adding subscribers through OLT app')
1488 self.config_olt(switch_map)
1489 olt_configured = True
1490 time.sleep(5)
1491 devices_list = self.voltha.get_devices()
1492 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1493 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
1494 thread1.start()
1495 time.sleep(randint(1,2))
1496 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1497 thread2.start()
1498 time.sleep(10)
1499 thread1.join()
1500 thread2.join()
1501 try:
1502 # assert_equal(status, True)
1503 assert_equal(self.success, True)
1504 time.sleep(10)
1505 finally:
1506 self.voltha.disable_device(device_id, delete = True)
1507 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001508 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001509 return df
1510
1511 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001512 def test_two_subscriberss_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001513 """
1514 Test Method:
1515 0. Make sure that voltha is up and running on CORD-POD setup.
1516 1. OLT and ONU is detected and validated.
1517 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1518 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1519 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
1520 6. Verify that subscriber authenticated successfully.
1521 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
1522 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
1523 9. Verify that subscriber authentication is unsuccessful..
1524 10. Verify that other subscriber authenticated successfully.
1525 """
1526
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001527 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001528 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001529 aaa_app = ["org.opencord.aaa"]
1530 log_test.info('Enabling ponsim_olt')
1531 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1532 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1533 devices_list = self.voltha.get_devices()
1534 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1535
1536 onu_device_id = devices_list['items'][1]['id']
1537 assert_not_equal(device_id, None)
1538 voltha = VolthaCtrl(self.VOLTHA_HOST,
1539 rest_port = self.VOLTHA_REST_PORT,
1540 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1541 time.sleep(10)
1542 switch_map = None
1543 olt_configured = False
1544 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1545 log_test.info('Installing OLT app')
1546 OnosCtrl.install_app(self.olt_app_file)
1547 time.sleep(5)
1548 log_test.info('Adding subscribers through OLT app')
1549 self.config_olt(switch_map)
1550 olt_configured = True
1551 time.sleep(5)
1552 devices_list = self.voltha.get_devices()
1553 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1554 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
1555 thread1.start()
1556 time.sleep(randint(1,2))
1557 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1558 thread2.start()
1559 time.sleep(10)
1560 thread1.join()
1561 thread2.join()
1562 try:
1563 # assert_equal(status, True)
1564 assert_equal(self.success, True)
1565 time.sleep(10)
1566 finally:
1567 self.voltha.disable_device(device_id, delete = True)
1568 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001569 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001570 return df
1571
1572 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001573 def test_subscriber_with_voltha_for_dhcp_request(self):
1574 """
1575 Test Method:
1576 0. Make sure that voltha is up and running on CORD-POD setup.
1577 1. OLT and ONU is detected and validated.
1578 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1579 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
1580 4. Verify that subscriber get ip from dhcp server successfully.
1581 """
1582
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001583 df = defer.Deferred()
1584 def dhcp_flow_check_scenario(df):
1585 log_test.info('Enabling ponsim_olt')
1586 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1587 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1588 assert_not_equal(device_id, None)
1589 voltha = VolthaCtrl(self.VOLTHA_HOST,
1590 rest_port = self.VOLTHA_REST_PORT,
1591 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1592 time.sleep(10)
1593 switch_map = None
1594 olt_configured = False
1595 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1596 log_test.info('Installing OLT app')
1597 OnosCtrl.install_app(self.olt_app_file)
1598 time.sleep(5)
1599 log_test.info('Adding subscribers through OLT app')
1600 self.config_olt(switch_map)
1601 olt_configured = True
1602 time.sleep(5)
1603 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
1604 try:
1605 assert_equal(dhcp_status, True)
1606 #assert_equal(status, True)
1607 time.sleep(10)
1608 finally:
1609 self.remove_olt(switch_map)
1610 self.voltha.disable_device(device_id, delete = True)
1611 df.callback(0)
1612
1613 reactor.callLater(0, dhcp_flow_check_scenario, df)
1614 return df
1615
1616 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001617 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
1618 """
1619 Test Method:
1620 0. Make sure that voltha is up and running on CORD-POD setup.
1621 1. OLT and ONU is detected and validated.
1622 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1623 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
1624 4. Verify that subscriber should not get ip from dhcp server.
1625 """
1626
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001627 df = defer.Deferred()
1628 def dhcp_flow_check_scenario(df):
1629 log_test.info('Enabling ponsim_olt')
1630 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1631 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1632 assert_not_equal(device_id, None)
1633 voltha = VolthaCtrl(self.VOLTHA_HOST,
1634 rest_port = self.VOLTHA_REST_PORT,
1635 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1636 time.sleep(10)
1637 switch_map = None
1638 olt_configured = False
1639 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1640 log_test.info('Installing OLT app')
1641 OnosCtrl.install_app(self.olt_app_file)
1642 time.sleep(5)
1643 log_test.info('Adding subscribers through OLT app')
1644 self.config_olt(switch_map)
1645 olt_configured = True
1646 time.sleep(5)
1647 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
1648 try:
1649 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001650 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001651 #assert_equal(status, True)
1652 time.sleep(10)
1653 finally:
1654 self.voltha.disable_device(device_id, delete = True)
1655 self.remove_olt(switch_map)
1656 df.callback(0)
1657
1658 reactor.callLater(0, dhcp_flow_check_scenario, df)
1659 return df
1660
1661
1662 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001663 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
1664 """
1665 Test Method:
1666 0. Make sure that voltha is up and running on CORD-POD setup.
1667 1. OLT and ONU is detected and validated.
1668 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1669 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
1670 4. Verify that subscriber should not get ip from dhcp server.
1671 """
1672
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001673 df = defer.Deferred()
1674 def dhcp_flow_check_scenario(df):
1675 log_test.info('Enabling ponsim_olt')
1676 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1677 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1678 assert_not_equal(device_id, None)
1679 voltha = VolthaCtrl(self.VOLTHA_HOST,
1680 rest_port = self.VOLTHA_REST_PORT,
1681 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1682 time.sleep(10)
1683 switch_map = None
1684 olt_configured = False
1685 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1686 log_test.info('Installing OLT app')
1687 OnosCtrl.install_app(self.olt_app_file)
1688 time.sleep(5)
1689 log_test.info('Adding subscribers through OLT app')
1690 self.config_olt(switch_map)
1691 olt_configured = True
1692 time.sleep(5)
1693 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
1694 try:
1695 assert_equal(dhcp_status, True)
1696 #assert_equal(status, True)
1697 time.sleep(10)
1698 finally:
1699 self.voltha.disable_device(device_id, delete = True)
1700 self.remove_olt(switch_map)
1701 df.callback(0)
1702
1703 reactor.callLater(0, dhcp_flow_check_scenario, df)
1704 return df
1705
1706 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001707 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
1708 """
1709 Test Method:
1710 0. Make sure that voltha is up and running on CORD-POD setup.
1711 1. OLT and ONU is detected and validated.
1712 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1713 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
1714 4. Verify that subscriber should not get ip from dhcp server.
1715 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001716 df = defer.Deferred()
1717 def dhcp_flow_check_scenario(df):
1718 log_test.info('Enabling ponsim_olt')
1719 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1720 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1721 assert_not_equal(device_id, None)
1722 voltha = VolthaCtrl(self.VOLTHA_HOST,
1723 rest_port = self.VOLTHA_REST_PORT,
1724 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1725 time.sleep(10)
1726 switch_map = None
1727 olt_configured = False
1728 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1729 log_test.info('Installing OLT app')
1730 OnosCtrl.install_app(self.olt_app_file)
1731 time.sleep(5)
1732 log_test.info('Adding subscribers through OLT app')
1733 self.config_olt(switch_map)
1734 olt_configured = True
1735 time.sleep(5)
1736 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
1737 try:
1738 assert_equal(dhcp_status, True)
1739 #assert_equal(status, True)
1740 time.sleep(10)
1741 finally:
1742 self.voltha.disable_device(device_id, delete = True)
1743 self.remove_olt(switch_map)
1744 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001745
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001746 reactor.callLater(0, dhcp_flow_check_scenario, df)
1747 return df
1748
1749 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001750 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
1751 """
1752 Test Method:
1753 0. Make sure that voltha is up and running on CORD-POD setup.
1754 1. OLT and ONU is detected and validated.
1755 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1756 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
1757 4. Verify that subscriber get ip from dhcp server successfully.
1758 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
1759 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
1760 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001761 df = defer.Deferred()
1762 def dhcp_flow_check_scenario(df):
1763 log_test.info('Enabling ponsim_olt')
1764 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1765 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1766 assert_not_equal(device_id, None)
1767 voltha = VolthaCtrl(self.VOLTHA_HOST,
1768 rest_port = self.VOLTHA_REST_PORT,
1769 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1770 time.sleep(10)
1771 switch_map = None
1772 olt_configured = False
1773 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1774 log_test.info('Installing OLT app')
1775 OnosCtrl.install_app(self.olt_app_file)
1776 time.sleep(5)
1777 log_test.info('Adding subscribers through OLT app')
1778 self.config_olt(switch_map)
1779 olt_configured = True
1780 time.sleep(5)
1781 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
1782 try:
1783 assert_equal(dhcp_status, True)
1784 #assert_equal(status, True)
1785 time.sleep(10)
1786 finally:
1787 self.voltha.disable_device(device_id, delete = True)
1788 self.remove_olt(switch_map)
1789 df.callback(0)
1790
1791 reactor.callLater(0, dhcp_flow_check_scenario, df)
1792 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001793
Thangavelu K S735a6662017-06-15 18:08:23 +00001794
1795 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07001796 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00001797 """
1798 Test Method:
1799 0. Make sure that voltha is up and running on CORD-POD setup.
1800 1. OLT and ONU is detected and validated.
1801 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1802 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1803 4. Verify that subscriber get ip from dhcp server successfully.
1804 5. Repeat step 3 and 4 for 10 times.
1805 6 Verify that subscriber should get ip from dhcp server.
1806 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001807 df = defer.Deferred()
1808 def dhcp_flow_check_scenario(df):
1809 log_test.info('Enabling ponsim_olt')
1810 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1811 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1812 assert_not_equal(device_id, None)
1813 voltha = VolthaCtrl(self.VOLTHA_HOST,
1814 rest_port = self.VOLTHA_REST_PORT,
1815 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1816 time.sleep(10)
1817 switch_map = None
1818 olt_configured = False
1819 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1820 log_test.info('Installing OLT app')
1821 OnosCtrl.install_app(self.olt_app_file)
1822 time.sleep(5)
1823 log_test.info('Adding subscribers through OLT app')
1824 self.config_olt(switch_map)
1825 olt_configured = True
1826 time.sleep(5)
1827 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
1828 try:
1829 assert_equal(dhcp_status, True)
1830 #assert_equal(status, True)
1831 time.sleep(10)
1832 finally:
1833 self.voltha.disable_device(device_id, delete = True)
1834 self.remove_olt(switch_map)
1835 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001836
Thangavelu K S735a6662017-06-15 18:08:23 +00001837 reactor.callLater(0, dhcp_flow_check_scenario, df)
1838 return df
1839
1840
1841
1842 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001843 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
1844 """
1845 Test Method:
1846 0. Make sure that voltha is up and running on CORD-POD setup.
1847 1. OLT and ONU is detected and validated.
1848 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1849 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
1850 4. Verify that subscriber should not get ip from dhcp server.
1851 5. Repeat steps 3 and 4 for 10 times.
1852 6 Verify that subscriber should not get ip from dhcp server.
1853 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001854 df = defer.Deferred()
1855 def dhcp_flow_check_scenario(df):
1856 log_test.info('Enabling ponsim_olt')
1857 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1858 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1859 assert_not_equal(device_id, None)
1860 voltha = VolthaCtrl(self.VOLTHA_HOST,
1861 rest_port = self.VOLTHA_REST_PORT,
1862 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1863 time.sleep(10)
1864 switch_map = None
1865 olt_configured = False
1866 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1867 log_test.info('Installing OLT app')
1868 OnosCtrl.install_app(self.olt_app_file)
1869 time.sleep(5)
1870 log_test.info('Adding subscribers through OLT app')
1871 self.config_olt(switch_map)
1872 olt_configured = True
1873 time.sleep(5)
1874 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
1875 try:
1876 assert_equal(dhcp_status, True)
1877 #assert_equal(status, True)
1878 time.sleep(10)
1879 finally:
1880 self.voltha.disable_device(device_id, delete = True)
1881 self.remove_olt(switch_map)
1882 df.callback(0)
1883
1884 reactor.callLater(0, dhcp_flow_check_scenario, df)
1885 return df
1886
1887
1888 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001889 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
1890 """
1891 Test Method:
1892 0. Make sure that voltha is up and running on CORD-POD setup.
1893 1. OLT and ONU is detected and validated.
1894 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1895 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1896 4. Verify that subscriber get ip from dhcp server successfully.
1897 5. Repeat step 3 for 50 times.
1898 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
1899 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001900 df = defer.Deferred()
1901 def dhcp_flow_check_scenario(df):
1902 log_test.info('Enabling ponsim_olt')
1903 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1904 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1905 assert_not_equal(device_id, None)
1906 voltha = VolthaCtrl(self.VOLTHA_HOST,
1907 rest_port = self.VOLTHA_REST_PORT,
1908 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1909 time.sleep(10)
1910 switch_map = None
1911 olt_configured = False
1912 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1913 log_test.info('Installing OLT app')
1914 OnosCtrl.install_app(self.olt_app_file)
1915 time.sleep(5)
1916 log_test.info('Adding subscribers through OLT app')
1917 self.config_olt(switch_map)
1918 olt_configured = True
1919 time.sleep(5)
1920 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
1921 try:
1922 assert_equal(dhcp_status, True)
1923 #assert_equal(status, True)
1924 time.sleep(10)
1925 finally:
1926 self.voltha.disable_device(device_id, delete = True)
1927 self.remove_olt(switch_map)
1928 df.callback(0)
1929
1930 reactor.callLater(0, dhcp_flow_check_scenario, df)
1931 return df
1932
1933
1934
1935 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001936 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
1937 """
1938 Test Method:
1939 0. Make sure that voltha is up and running on CORD-POD setup.
1940 1. OLT and ONU is detected and validated.
1941 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1942 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1943 4. Verify that subscriber get ip from dhcp server successfully.
1944 5. Send DHCP request to dhcp server which is running as onos app.
1945 6. Repeat step 5 for 50 times.
1946 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
1947 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001948 df = defer.Deferred()
1949 def dhcp_flow_check_scenario(df):
1950 log_test.info('Enabling ponsim_olt')
1951 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1952 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1953 assert_not_equal(device_id, None)
1954 voltha = VolthaCtrl(self.VOLTHA_HOST,
1955 rest_port = self.VOLTHA_REST_PORT,
1956 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1957 time.sleep(10)
1958 switch_map = None
1959 olt_configured = False
1960 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1961 log_test.info('Installing OLT app')
1962 OnosCtrl.install_app(self.olt_app_file)
1963 time.sleep(5)
1964 log_test.info('Adding subscribers through OLT app')
1965 self.config_olt(switch_map)
1966 olt_configured = True
1967 time.sleep(5)
1968 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
1969 try:
1970 assert_equal(dhcp_status, True)
1971 #assert_equal(status, True)
1972 time.sleep(10)
1973 finally:
1974 self.voltha.disable_device(device_id, delete = True)
1975 self.remove_olt(switch_map)
1976 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001977
Thangavelu K S735a6662017-06-15 18:08:23 +00001978 reactor.callLater(0, dhcp_flow_check_scenario, df)
1979 return df
1980
1981
1982 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001983 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
1984 """
1985 Test Method:
1986 0. Make sure that voltha is up and running on CORD-POD setup.
1987 1. OLT and ONU is detected and validated.
1988 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1989 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
1990 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
1991 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001992 df = defer.Deferred()
1993 def dhcp_flow_check_scenario(df):
1994 log_test.info('Enabling ponsim_olt')
1995 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1996 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1997 assert_not_equal(device_id, None)
1998 voltha = VolthaCtrl(self.VOLTHA_HOST,
1999 rest_port = self.VOLTHA_REST_PORT,
2000 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2001 time.sleep(10)
2002 switch_map = None
2003 olt_configured = False
2004 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2005 log_test.info('Installing OLT app')
2006 OnosCtrl.install_app(self.olt_app_file)
2007 time.sleep(5)
2008 log_test.info('Adding subscribers through OLT app')
2009 self.config_olt(switch_map)
2010 olt_configured = True
2011 time.sleep(5)
2012 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
2013 try:
2014 assert_equal(dhcp_status, True)
2015 #assert_equal(status, True)
2016 time.sleep(10)
2017 finally:
2018 self.voltha.disable_device(device_id, delete = True)
2019 self.remove_olt(switch_map)
2020 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002021
Thangavelu K S735a6662017-06-15 18:08:23 +00002022 reactor.callLater(0, dhcp_flow_check_scenario, df)
2023 return df
2024
2025 @deferred(TESTCASE_TIMEOUT)
2026 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002027 """
2028 Test Method:
2029 0. Make sure that voltha is up and running on CORD-POD setup.
2030 1. OLT and ONU is detected and validated.
2031 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2032 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
2033 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.
2034 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002035 df = defer.Deferred()
2036 def dhcp_flow_check_scenario(df):
2037 log_test.info('Enabling ponsim_olt')
2038 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2039 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2040 assert_not_equal(device_id, None)
2041 voltha = VolthaCtrl(self.VOLTHA_HOST,
2042 rest_port = self.VOLTHA_REST_PORT,
2043 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2044 time.sleep(10)
2045 switch_map = None
2046 olt_configured = False
2047 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2048 log_test.info('Installing OLT app')
2049 OnosCtrl.install_app(self.olt_app_file)
2050 time.sleep(5)
2051 log_test.info('Adding subscribers through OLT app')
2052 self.config_olt(switch_map)
2053 olt_configured = True
2054 time.sleep(5)
2055 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
2056 try:
2057 assert_equal(dhcp_status, True)
2058 #assert_equal(status, True)
2059 time.sleep(10)
2060 finally:
2061 self.voltha.disable_device(device_id, delete = True)
2062 self.remove_olt(switch_map)
2063 df.callback(0)
2064
2065 reactor.callLater(0, dhcp_flow_check_scenario, df)
2066 return df
2067
2068
2069 @deferred(TESTCASE_TIMEOUT)
2070 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002071 """
2072 Test Method:
2073 0. Make sure that voltha is up and running on CORD-POD setup.
2074 1. OLT and ONU is detected and validated.
2075 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2076 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2077 4. Verify that subscriber get ip from dhcp server successfully.
2078 5. Deactivate dhcp server app in onos.
2079 6. Repeat step 3.
2080 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2081 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002082 df = defer.Deferred()
2083 dhcp_app = 'org.onosproject.dhcp'
2084 def dhcp_flow_check_scenario(df):
2085 log_test.info('Enabling ponsim_olt')
2086 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2087 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2088 assert_not_equal(device_id, None)
2089 voltha = VolthaCtrl(self.VOLTHA_HOST,
2090 rest_port = self.VOLTHA_REST_PORT,
2091 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2092 time.sleep(10)
2093 switch_map = None
2094 olt_configured = False
2095 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2096 log_test.info('Installing OLT app')
2097 OnosCtrl.install_app(self.olt_app_file)
2098 time.sleep(5)
2099 log_test.info('Adding subscribers through OLT app')
2100 self.config_olt(switch_map)
2101 olt_configured = True
2102 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002103 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00002104 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
2105 log_test.info('Restart dhcp app in onos during client send discover to voltha')
2106 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00002107 thread1.start()
2108 time.sleep(10)
2109 thread1.join()
2110 thread2.join()
2111 try:
2112 assert_equal(self.success, True)
2113 #assert_equal(status, True)
2114 time.sleep(10)
2115 finally:
2116 self.voltha.disable_device(device_id, delete = True)
2117 self.remove_olt(switch_map)
2118 df.callback(0)
2119
2120 reactor.callLater(0, dhcp_flow_check_scenario, df)
2121 return df
2122
2123 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002124 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
2125 """
2126 Test Method:
2127 0. Make sure that voltha is up and running on CORD-POD setup.
2128 1. OLT and ONU is detected and validated.
2129 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2130 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2131 4. Verify that subscriber get ip from dhcp server successfully.
2132 5. Send dhcp renew packet to dhcp server which is running as onos app.
2133 6. Repeat step 4.
2134 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002135
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002136 df = defer.Deferred()
2137 def dhcp_flow_check_scenario(df):
2138 log_test.info('Enabling ponsim_olt')
2139 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2140 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2141 assert_not_equal(device_id, None)
2142 voltha = VolthaCtrl(self.VOLTHA_HOST,
2143 rest_port = self.VOLTHA_REST_PORT,
2144 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2145 time.sleep(10)
2146 switch_map = None
2147 olt_configured = False
2148 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2149 log_test.info('Installing OLT app')
2150 OnosCtrl.install_app(self.olt_app_file)
2151 time.sleep(5)
2152 log_test.info('Adding subscribers through OLT app')
2153 self.config_olt(switch_map)
2154 olt_configured = True
2155 time.sleep(5)
2156 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
2157 try:
2158 assert_equal(dhcp_status, True)
2159 #assert_equal(status, True)
2160 time.sleep(10)
2161 finally:
2162 self.voltha.disable_device(device_id, delete = True)
2163 self.remove_olt(switch_map)
2164 df.callback(0)
2165
2166 reactor.callLater(0, dhcp_flow_check_scenario, df)
2167 return df
2168
2169 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002170 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
2171 """
2172 Test Method:
2173 0. Make sure that voltha is up and running on CORD-POD setup.
2174 1. OLT and ONU is detected and validated.
2175 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2176 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2177 4. Verify that subscriber get ip from dhcp server successfully.
2178 5. Send dhcp rebind packet to dhcp server which is running as onos app.
2179 6. Repeat step 4.
2180 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002181 df = defer.Deferred()
2182 def dhcp_flow_check_scenario(df):
2183 log_test.info('Enabling ponsim_olt')
2184 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2185 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2186 assert_not_equal(device_id, None)
2187 voltha = VolthaCtrl(self.VOLTHA_HOST,
2188 rest_port = self.VOLTHA_REST_PORT,
2189 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2190 time.sleep(10)
2191 switch_map = None
2192 olt_configured = False
2193 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2194 log_test.info('Installing OLT app')
2195 OnosCtrl.install_app(self.olt_app_file)
2196 time.sleep(5)
2197 log_test.info('Adding subscribers through OLT app')
2198 self.config_olt(switch_map)
2199 olt_configured = True
2200 time.sleep(5)
2201 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
2202 try:
2203 assert_equal(dhcp_status, True)
2204 #assert_equal(status, True)
2205 time.sleep(10)
2206 finally:
2207 self.voltha.disable_device(device_id, delete = True)
2208 self.remove_olt(switch_map)
2209 df.callback(0)
2210
2211 reactor.callLater(0, dhcp_flow_check_scenario, df)
2212 return df
2213
2214
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002215 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002216 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002217 """
2218 Test Method:
2219 0. Make sure that voltha is up and running on CORD-POD setup.
2220 1. OLT and ONU is detected and validated.
2221 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2222 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2223 4. Verify that subscriber get ip from dhcp server successfully.
2224 5. Disable olt devices which is being detected in voltha CLI.
2225 6. Repeat step 3.
2226 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2227 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002228 df = defer.Deferred()
2229 dhcp_app = 'org.onosproject.dhcp'
2230 def dhcp_flow_check_scenario(df):
2231 log_test.info('Enabling ponsim_olt')
2232 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2233 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2234 assert_not_equal(device_id, None)
2235 voltha = VolthaCtrl(self.VOLTHA_HOST,
2236 rest_port = self.VOLTHA_REST_PORT,
2237 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2238 time.sleep(10)
2239 switch_map = None
2240 olt_configured = False
2241 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2242 log_test.info('Installing OLT app')
2243 OnosCtrl.install_app(self.olt_app_file)
2244 time.sleep(5)
2245 log_test.info('Adding subscribers through OLT app')
2246 self.config_olt(switch_map)
2247 olt_configured = True
2248 time.sleep(5)
2249 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2250 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
2251 log_test.info('Disable the olt device in during client send discover to voltha')
2252 thread2.start()
2253# time.sleep(randint(0,1))
2254 thread1.start()
2255 time.sleep(10)
2256 thread1.join()
2257 thread2.join()
2258 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00002259 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002260 #assert_equal(status, True)
2261 time.sleep(10)
2262 finally:
2263 self.voltha.disable_device(device_id, delete = True)
2264 self.remove_olt(switch_map)
2265 df.callback(0)
2266
2267 reactor.callLater(0, dhcp_flow_check_scenario, df)
2268 return df
2269
2270
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002271
2272 @deferred(TESTCASE_TIMEOUT)
2273 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
2274 """
2275 Test Method:
2276 0. Make sure that voltha is 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 dhcp server which is running as onos app.
2280 4. Verify that subscriber get ip from dhcp server successfully.
2281 5. Disable olt devices which is being detected in voltha CLI.
2282 6. Repeat step 3.
2283 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2284 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
2285 """
2286 df = defer.Deferred()
2287 no_iterations = 10
2288 dhcp_app = 'org.onosproject.dhcp'
2289 def dhcp_flow_check_scenario(df):
2290 log_test.info('Enabling ponsim_olt')
2291 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2292 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2293 assert_not_equal(device_id, None)
2294 voltha = VolthaCtrl(self.VOLTHA_HOST,
2295 rest_port = self.VOLTHA_REST_PORT,
2296 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2297 time.sleep(10)
2298 switch_map = None
2299 olt_configured = False
2300 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2301 log_test.info('Installing OLT app')
2302 OnosCtrl.install_app(self.olt_app_file)
2303 time.sleep(5)
2304 log_test.info('Adding subscribers through OLT app')
2305 self.config_olt(switch_map)
2306 olt_configured = True
2307 time.sleep(5)
2308 for i in range(no_iterations):
2309 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2310 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
2311 log_test.info('Disable the olt device in during client send discover to voltha')
2312 thread2.start()
2313# time.sleep(randint(0,1))
2314 thread1.start()
2315 time.sleep(10)
2316 thread1.join()
2317 thread2.join()
2318 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2319 try:
2320 assert_equal(self.success, True)
2321 assert_equal(dhcp_status, True)
2322 #assert_equal(status, True)
2323 time.sleep(10)
2324 finally:
2325 self.voltha.disable_device(device_id, delete = True)
2326 self.remove_olt(switch_map)
2327 df.callback(0)
2328
2329 reactor.callLater(0, dhcp_flow_check_scenario, df)
2330 return df
2331
2332
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002333 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002334 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002335 """
2336 Test Method:
2337 0. Make sure that voltha is up and running on CORD-POD setup.
2338 1. OLT and ONU is detected and validated.
2339 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2340 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2341 4. Verify that subscriber get ip from dhcp server successfully.
2342 5. Disable olt devices which is being detected in voltha CLI.
2343 6. Repeat step 3.
2344 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2345 8. Enable olt devices which is being detected in voltha CLI.
2346 9. Repeat steps 3 and 4.
2347 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002348 df = defer.Deferred()
2349 dhcp_app = 'org.onosproject.dhcp'
2350 def dhcp_flow_check_scenario(df):
2351 log_test.info('Enabling ponsim_olt')
2352 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2353 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2354 assert_not_equal(device_id, None)
2355 voltha = VolthaCtrl(self.VOLTHA_HOST,
2356 rest_port = self.VOLTHA_REST_PORT,
2357 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2358 time.sleep(10)
2359 switch_map = None
2360 olt_configured = False
2361 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2362 log_test.info('Installing OLT app')
2363 OnosCtrl.install_app(self.olt_app_file)
2364 time.sleep(5)
2365 log_test.info('Adding subscribers through OLT app')
2366 self.config_olt(switch_map)
2367 olt_configured = True
2368 time.sleep(5)
2369 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2370 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2371 thread2.start()
2372 thread1.start()
2373 time.sleep(10)
2374 thread1.join()
2375 thread2.join()
2376 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00002377 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002378 #assert_equal(status, True)
2379 time.sleep(10)
2380 finally:
2381 self.voltha.disable_device(device_id, delete = True)
2382 self.remove_olt(switch_map)
2383 df.callback(0)
2384
2385 reactor.callLater(0, dhcp_flow_check_scenario, df)
2386 return df
2387
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002388 @deferred(TESTCASE_TIMEOUT)
2389 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
2390 """
2391 Test Method:
2392 0. Make sure that voltha is up and running on CORD-POD setup.
2393 1. OLT and ONU is detected and validated.
2394 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2395 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2396 4. Verify that subscriber get ip from dhcp server successfully.
2397 5. Disable olt devices which is being detected in voltha CLI.
2398 6. Repeat step 3.
2399 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2400 8. Enable olt devices which is being detected in voltha CLI.
2401 9. Repeat steps 3 and 4.
2402 """
2403
2404 df = defer.Deferred()
2405 no_iterations = 10
2406 dhcp_app = 'org.onosproject.dhcp'
2407 def dhcp_flow_check_scenario(df):
2408 log_test.info('Enabling ponsim_olt')
2409 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2410 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2411 assert_not_equal(device_id, None)
2412 voltha = VolthaCtrl(self.VOLTHA_HOST,
2413 rest_port = self.VOLTHA_REST_PORT,
2414 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2415 time.sleep(10)
2416 switch_map = None
2417 olt_configured = False
2418 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2419 log_test.info('Installing OLT app')
2420 OnosCtrl.install_app(self.olt_app_file)
2421 time.sleep(5)
2422 log_test.info('Adding subscribers through OLT app')
2423 self.config_olt(switch_map)
2424 olt_configured = True
2425 time.sleep(5)
2426 for i in range(no_iterations):
2427 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2428 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2429 thread2.start()
2430 thread1.start()
2431 time.sleep(10)
2432 thread1.join()
2433 thread2.join()
2434 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2435 try:
2436 assert_equal(dhcp_status, True)
2437 #assert_equal(status, True)
2438 assert_equal(self.success, True)
2439 time.sleep(10)
2440 finally:
2441 self.voltha.disable_device(device_id, delete = True)
2442 self.remove_olt(switch_map)
2443 df.callback(0)
2444
2445 reactor.callLater(0, dhcp_flow_check_scenario, df)
2446 return df
2447
2448
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002449
2450 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002451 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002452 """
2453 Test Method:
2454 0. Make sure that voltha is up and running on CORD-POD setup.
2455 1. OLT and ONU is detected and validated.
2456 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2457 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2458 4. Verify that subscriber get ip from dhcp server successfully.
2459 5. Disable onu port which is being detected in voltha CLI.
2460 6. Repeat step 3.
2461 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2462 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002463 df = defer.Deferred()
2464 dhcp_app = 'org.onosproject.dhcp'
2465 def dhcp_flow_check_scenario(df):
2466 log_test.info('Enabling ponsim_olt')
2467 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2468 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2469 assert_not_equal(device_id, None)
2470 voltha = VolthaCtrl(self.VOLTHA_HOST,
2471 rest_port = self.VOLTHA_REST_PORT,
2472 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2473 time.sleep(10)
2474 switch_map = None
2475 olt_configured = False
2476 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2477 log_test.info('Installing OLT app')
2478 OnosCtrl.install_app(self.olt_app_file)
2479 time.sleep(5)
2480 log_test.info('Adding subscribers through OLT app')
2481 self.config_olt(switch_map)
2482 olt_configured = True
2483 time.sleep(5)
2484 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2485 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
2486 thread1.start()
2487 thread2.start()
2488 time.sleep(10)
2489 thread1.join()
2490 thread2.join()
2491 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00002492 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002493 #assert_equal(status, True)
2494 time.sleep(10)
2495 finally:
2496 self.voltha.disable_device(device_id, delete = True)
2497 self.remove_olt(switch_map)
2498 df.callback(0)
2499
2500 reactor.callLater(0, dhcp_flow_check_scenario, df)
2501 return df
2502
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002503 @deferred(TESTCASE_TIMEOUT)
2504 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
2505 """
2506 Test Method:
2507 0. Make sure that voltha is up and running on CORD-POD setup.
2508 1. OLT and ONU is detected and validated.
2509 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2510 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2511 4. Verify that subscriber get ip from dhcp server successfully.
2512 5. Disable onu port which is being detected in voltha CLI.
2513 6. Repeat step 3.
2514 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2515 """
2516 df = defer.Deferred()
2517 no_iterations = 10
2518 dhcp_app = 'org.onosproject.dhcp'
2519 def dhcp_flow_check_scenario(df):
2520 log_test.info('Enabling ponsim_olt')
2521 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2522 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2523 assert_not_equal(device_id, None)
2524 voltha = VolthaCtrl(self.VOLTHA_HOST,
2525 rest_port = self.VOLTHA_REST_PORT,
2526 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2527 time.sleep(10)
2528 switch_map = None
2529 olt_configured = False
2530 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2531 log_test.info('Installing OLT app')
2532 OnosCtrl.install_app(self.olt_app_file)
2533 time.sleep(5)
2534 log_test.info('Adding subscribers through OLT app')
2535 self.config_olt(switch_map)
2536 olt_configured = True
2537 time.sleep(5)
2538 for i in range(no_iterations):
2539 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2540 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
2541 thread1.start()
2542 thread2.start()
2543 time.sleep(10)
2544 thread1.join()
2545 thread2.join()
2546 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2547 try:
2548 #assert_equal(status, True)
2549 assert_equal(dhcp_status, True)
2550 assert_equal(self.success, True)
2551 time.sleep(10)
2552 finally:
2553 self.voltha.disable_device(device_id, delete = True)
2554 self.remove_olt(switch_map)
2555 df.callback(0)
2556
2557 reactor.callLater(0, dhcp_flow_check_scenario, df)
2558 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002559
2560 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002561 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002562 """
2563 Test Method:
2564 0. Make sure that voltha is up and running on CORD-POD setup.
2565 1. OLT and ONU is detected and validated.
2566 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2567 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2568 4. Verify that subscriber get ip from dhcp server successfully.
2569 5. Disable onu port which is being detected in voltha CLI.
2570 6. Repeat step 3.
2571 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2572 8. Enable onu port which is being detected in voltha CLI.
2573 9. Repeat steps 3 and 4.
2574 """
2575
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002576 df = defer.Deferred()
2577 dhcp_app = 'org.onosproject.dhcp'
2578 def dhcp_flow_check_scenario(df):
2579 log_test.info('Enabling ponsim_olt')
2580 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2581 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2582 assert_not_equal(device_id, None)
2583 voltha = VolthaCtrl(self.VOLTHA_HOST,
2584 rest_port = self.VOLTHA_REST_PORT,
2585 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2586 time.sleep(10)
2587 switch_map = None
2588 olt_configured = False
2589 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2590 log_test.info('Installing OLT app')
2591 OnosCtrl.install_app(self.olt_app_file)
2592 time.sleep(5)
2593 log_test.info('Adding subscribers through OLT app')
2594 self.config_olt(switch_map)
2595 olt_configured = True
2596 time.sleep(5)
2597 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2598 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
2599 log_test.info('Restart dhcp app in onos during client send discover to voltha')
2600 thread2.start()
2601 time.sleep(randint(0,1))
2602 thread1.start()
2603 time.sleep(10)
2604 thread1.join()
2605 thread2.join()
2606 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2607 assert_equal(dhcp_status, True)
2608 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00002609 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002610 #assert_equal(status, True)
2611 time.sleep(10)
2612 finally:
2613 self.voltha.disable_device(device_id, delete = True)
2614 self.remove_olt(switch_map)
2615 df.callback(0)
2616
2617 reactor.callLater(0, dhcp_flow_check_scenario, df)
2618 return df
2619
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002620 @deferred(TESTCASE_TIMEOUT)
2621 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
2622 """
2623 Test Method:
2624 0. Make sure that voltha is up and running on CORD-POD setup.
2625 1. OLT and ONU is detected and validated.
2626 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2627 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2628 4. Verify that subscriber get ip from dhcp server successfully.
2629 5. Disable onu port which is being detected in voltha CLI.
2630 6. Repeat step 3.
2631 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2632 8. Enable onu port which is being detected in voltha CLI.
2633 9. Repeat steps 3 and 4.
2634 """
2635
2636 df = defer.Deferred()
2637 no_iterations = 10
2638 dhcp_app = 'org.onosproject.dhcp'
2639 def dhcp_flow_check_scenario(df):
2640 log_test.info('Enabling ponsim_olt')
2641 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2642 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2643 assert_not_equal(device_id, None)
2644 voltha = VolthaCtrl(self.VOLTHA_HOST,
2645 rest_port = self.VOLTHA_REST_PORT,
2646 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2647 time.sleep(10)
2648 switch_map = None
2649 olt_configured = False
2650 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2651 log_test.info('Installing OLT app')
2652 OnosCtrl.install_app(self.olt_app_file)
2653 time.sleep(5)
2654 log_test.info('Adding subscribers through OLT app')
2655 self.config_olt(switch_map)
2656 olt_configured = True
2657 time.sleep(5)
2658 for i in range(no_iterations):
2659 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2660 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
2661 log_test.info('Restart dhcp app in onos during client send discover to voltha')
2662 thread2.start()
2663 time.sleep(randint(0,1))
2664 thread1.start()
2665 time.sleep(10)
2666 thread1.join()
2667 thread2.join()
2668 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2669 assert_equal(dhcp_status, True)
2670 try:
2671 assert_equal(self.success, True)
2672 #assert_equal(status, True)
2673 time.sleep(10)
2674 finally:
2675 self.voltha.disable_device(device_id, delete = True)
2676 self.remove_olt(switch_map)
2677 df.callback(0)
2678
2679 reactor.callLater(0, dhcp_flow_check_scenario, df)
2680 return df
2681
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002682
2683 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002684 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002685 """
2686 Test Method:
2687 0. Make sure that voltha is up and running on CORD-POD setup.
2688 1. OLT and ONU is detected and validated.
2689 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2690 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2691 4. Verify that subscribers had got different ips from dhcp server successfully.
2692 """
2693
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002694 df = defer.Deferred()
2695 self.success = True
2696 dhcp_app = 'org.onosproject.dhcp'
2697 def dhcp_flow_check_scenario(df):
2698 log_test.info('Enabling ponsim_olt')
2699 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2700 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2701 assert_not_equal(device_id, None)
2702 voltha = VolthaCtrl(self.VOLTHA_HOST,
2703 rest_port = self.VOLTHA_REST_PORT,
2704 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2705 time.sleep(10)
2706 switch_map = None
2707 olt_configured = False
2708 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2709 log_test.info('Installing OLT app')
2710 OnosCtrl.install_app(self.olt_app_file)
2711 time.sleep(5)
2712 log_test.info('Adding subscribers through OLT app')
2713 self.config_olt(switch_map)
2714 olt_configured = True
2715 time.sleep(5)
2716 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
2717 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2718 thread1.start()
2719 thread2.start()
2720 time.sleep(10)
2721 thread1.join()
2722 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002723 dhcp_flow_status = self.success
2724 try:
2725# if self.success is not True:
2726 assert_equal(dhcp_flow_status, True)
2727 #assert_equal(status, True)
2728 time.sleep(10)
2729 finally:
2730 self.voltha.disable_device(device_id, delete = True)
2731 self.remove_olt(switch_map)
2732 df.callback(0)
2733
2734 reactor.callLater(0, dhcp_flow_check_scenario, df)
2735 return df
2736
2737 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002738 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002739 """
2740 Test Method:
2741 0. Make sure that voltha is up and running on CORD-POD setup.
2742 1. OLT and ONU is detected and validated.
2743 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2744 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2745 4. Verify that subscribers had got ip from dhcp server successfully.
2746 5. Repeat step 3 and 4 for 10 times for both subscribers.
2747 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
2748 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002749
2750
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002751 df = defer.Deferred()
2752 self.success = True
2753 dhcp_app = 'org.onosproject.dhcp'
2754 def dhcp_flow_check_scenario(df):
2755 log_test.info('Enabling ponsim_olt')
2756 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2757 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2758 assert_not_equal(device_id, None)
2759 voltha = VolthaCtrl(self.VOLTHA_HOST,
2760 rest_port = self.VOLTHA_REST_PORT,
2761 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2762 time.sleep(10)
2763 switch_map = None
2764 olt_configured = False
2765 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2766 log_test.info('Installing OLT app')
2767 OnosCtrl.install_app(self.olt_app_file)
2768 time.sleep(5)
2769 log_test.info('Adding subscribers through OLT app')
2770 self.config_olt(switch_map)
2771 olt_configured = True
2772 time.sleep(5)
2773 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
2774 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
2775 thread1.start()
2776 thread2.start()
2777 time.sleep(10)
2778 thread1.join()
2779 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002780 dhcp_flow_status = self.success
2781 try:
2782# if self.success is not True:
2783 assert_equal(dhcp_flow_status, True)
2784 #assert_equal(status, True)
2785 time.sleep(10)
2786 finally:
2787 self.voltha.disable_device(device_id, delete = True)
2788 self.remove_olt(switch_map)
2789 df.callback(0)
2790
2791 reactor.callLater(0, dhcp_flow_check_scenario, df)
2792 return df
2793
2794 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002795 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002796 """
2797 Test Method:
2798 0. Make sure that voltha is up and running on CORD-POD setup.
2799 1. OLT and ONU is detected and validated.
2800 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2801 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2802 4. Verify that subscribers had got ip from dhcp server successfully.
2803 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
2804 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
2805 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002806
2807 df = defer.Deferred()
2808 self.success = True
2809 dhcp_app = 'org.onosproject.dhcp'
2810 def dhcp_flow_check_scenario(df):
2811 log_test.info('Enabling ponsim_olt')
2812 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2813 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2814 assert_not_equal(device_id, None)
2815 voltha = VolthaCtrl(self.VOLTHA_HOST,
2816 rest_port = self.VOLTHA_REST_PORT,
2817 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2818 time.sleep(10)
2819 switch_map = None
2820 olt_configured = False
2821 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2822 log_test.info('Installing OLT app')
2823 OnosCtrl.install_app(self.olt_app_file)
2824 time.sleep(5)
2825 log_test.info('Adding subscribers through OLT app')
2826 self.config_olt(switch_map)
2827 olt_configured = True
2828 time.sleep(5)
2829 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
2830 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2831 thread1.start()
2832 thread2.start()
2833 time.sleep(10)
2834 thread1.join()
2835 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002836 dhcp_flow_status = self.success
2837 try:
2838# if self.success is not True:
2839 assert_equal(dhcp_flow_status, True)
2840 #assert_equal(status, True)
2841 time.sleep(10)
2842 finally:
2843 self.voltha.disable_device(device_id, delete = True)
2844 self.remove_olt(switch_map)
2845 df.callback(0)
2846
2847 reactor.callLater(0, dhcp_flow_check_scenario, df)
2848 return df
2849
2850 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002851 def test_two_subscribers_with_voltha_for_dhcp_discover_and_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002852 """
2853 Test Method:
2854 0. Make sure that voltha is up and running on CORD-POD setup.
2855 1. OLT and ONU is detected and validated.
2856 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2857 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
2858 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
2859 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
2860 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002861
2862 df = defer.Deferred()
2863 self.success = True
2864 dhcp_app = 'org.onosproject.dhcp'
2865 def dhcp_flow_check_scenario(df):
2866 log_test.info('Enabling ponsim_olt')
2867 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2868 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2869 assert_not_equal(device_id, None)
2870 voltha = VolthaCtrl(self.VOLTHA_HOST,
2871 rest_port = self.VOLTHA_REST_PORT,
2872 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2873 time.sleep(10)
2874 switch_map = None
2875 olt_configured = False
2876 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2877 log_test.info('Installing OLT app')
2878 OnosCtrl.install_app(self.olt_app_file)
2879 time.sleep(5)
2880 log_test.info('Adding subscribers through OLT app')
2881 self.config_olt(switch_map)
2882 olt_configured = True
2883 time.sleep(5)
2884 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
2885 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
2886 thread1.start()
2887 thread2.start()
2888 time.sleep(10)
2889 thread1.join()
2890 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002891 dhcp_flow_status = self.success
2892 try:
2893# if self.success is not True:
2894 assert_equal(dhcp_flow_status, True)
2895 #assert_equal(status, True)
2896 time.sleep(10)
2897 finally:
2898 self.voltha.disable_device(device_id, delete = True)
2899 self.remove_olt(switch_map)
2900 df.callback(0)
2901
2902 reactor.callLater(0, dhcp_flow_check_scenario, df)
2903 return df
2904
2905 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002906 def test_two_subscribers_with_voltha_for_dhcp_discover_within_and_without_dhcp_pool_ip_addresses(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002907 """
2908 Test Method:
2909 0. Make sure that voltha is up and running on CORD-POD setup.
2910 1. OLT and ONU is detected and validated.
2911 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2912 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
2913 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
2914 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
2915 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002916 df = defer.Deferred()
2917 self.success = True
2918 dhcp_app = 'org.onosproject.dhcp'
2919 def dhcp_flow_check_scenario(df):
2920 log_test.info('Enabling ponsim_olt')
2921 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2922 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2923 assert_not_equal(device_id, None)
2924 voltha = VolthaCtrl(self.VOLTHA_HOST,
2925 rest_port = self.VOLTHA_REST_PORT,
2926 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2927 time.sleep(10)
2928 switch_map = None
2929 olt_configured = False
2930 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2931 log_test.info('Installing OLT app')
2932 OnosCtrl.install_app(self.olt_app_file)
2933 time.sleep(5)
2934 log_test.info('Adding subscribers through OLT app')
2935 self.config_olt(switch_map)
2936 olt_configured = True
2937 time.sleep(5)
2938 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
2939 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
2940 thread1.start()
2941 thread2.start()
2942 time.sleep(10)
2943 thread1.join()
2944 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002945 dhcp_flow_status = self.success
2946 try:
2947# if self.success is not True:
2948 assert_equal(dhcp_flow_status, True)
2949 #assert_equal(status, True)
2950 time.sleep(10)
2951 finally:
2952 self.voltha.disable_device(device_id, delete = True)
2953 self.remove_olt(switch_map)
2954 df.callback(0)
2955
2956 reactor.callLater(0, dhcp_flow_check_scenario, df)
2957 return df
2958
2959 @deferred(TESTCASE_TIMEOUT)
2960 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002961 """
2962 Test Method:
2963 0. Make sure that voltha is up and running on CORD-POD setup.
2964 1. OLT and ONU is detected and validated.
2965 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2966 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2967 4. Verify that subscribers had got ip from dhcp server successfully.
2968 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
2969 6. Repeat step 3 and 4 for one subscriber where uni port is down.
2970 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
2971 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002972 df = defer.Deferred()
2973 self.success = True
2974 dhcp_app = 'org.onosproject.dhcp'
2975 def dhcp_flow_check_scenario(df):
2976 log_test.info('Enabling ponsim_olt')
2977 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2978 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2979 assert_not_equal(device_id, None)
2980 voltha = VolthaCtrl(self.VOLTHA_HOST,
2981 rest_port = self.VOLTHA_REST_PORT,
2982 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2983 time.sleep(10)
2984 switch_map = None
2985 olt_configured = False
2986 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2987 log_test.info('Installing OLT app')
2988 OnosCtrl.install_app(self.olt_app_file)
2989 time.sleep(5)
2990 log_test.info('Adding subscribers through OLT app')
2991 self.config_olt(switch_map)
2992 olt_configured = True
2993 time.sleep(5)
2994 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
2995 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
2996 thread1.start()
2997 thread2.start()
2998 time.sleep(10)
2999 thread1.join()
3000 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003001 dhcp_flow_status = self.success
3002 try:
3003# if self.success is not True:
3004 assert_equal(dhcp_flow_status, True)
3005 #assert_equal(status, True)
3006 time.sleep(10)
3007 finally:
3008 self.voltha.disable_device(device_id, delete = True)
3009 self.remove_olt(switch_map)
3010 df.callback(0)
3011
3012 reactor.callLater(0, dhcp_flow_check_scenario, df)
3013 return df
3014
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003015 @deferred(TESTCASE_TIMEOUT)
3016 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003017 """
3018 Test Method:
3019 0. Make sure that voltha is up and running on CORD-POD setup.
3020 1. OLT and ONU is detected and validated.
3021 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3022 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3023 4. Verify that subscribers had got ip from dhcp server successfully.
3024 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3025 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3026 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3027 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
3028 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
3029 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
3030 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003031 df = defer.Deferred()
3032 self.success = True
3033 dhcp_app = 'org.onosproject.dhcp'
3034 def dhcp_flow_check_scenario(df):
3035 log_test.info('Enabling ponsim_olt')
3036 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3037 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3038 assert_not_equal(device_id, None)
3039 voltha = VolthaCtrl(self.VOLTHA_HOST,
3040 rest_port = self.VOLTHA_REST_PORT,
3041 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3042 time.sleep(10)
3043 switch_map = None
3044 olt_configured = False
3045 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3046 log_test.info('Installing OLT app')
3047 OnosCtrl.install_app(self.olt_app_file)
3048 time.sleep(5)
3049 log_test.info('Adding subscribers through OLT app')
3050 self.config_olt(switch_map)
3051 olt_configured = True
3052 time.sleep(5)
3053 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3054 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3055 thread3 = threading.Thread(target = self.voltha_uni_port_down_up, args = (self.INTF_2_RX_DEFAULT,))
3056 thread1.start()
3057 thread2.start()
3058 thread3.start()
3059 time.sleep(10)
3060 thread1.join()
3061 thread2.join()
3062 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003063 dhcp_flow_status = self.success
3064 try:
3065# if self.success is not True:
3066 assert_equal(dhcp_flow_status, True)
3067 #assert_equal(status, True)
3068 time.sleep(10)
3069 finally:
3070 self.voltha.disable_device(device_id, delete = True)
3071 self.remove_olt(switch_map)
3072 df.callback(0)
3073
3074 reactor.callLater(0, dhcp_flow_check_scenario, df)
3075 return df
3076
3077
3078 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003079 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003080 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003081 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00003082 0. Make sure that voltha is up and running on CORD-POD setup.
3083 1. OLT and ONU is detected and validated.
3084 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3085 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3086 4. Verify that subscribers had got ip from dhcp server successfully.
3087 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3088 6. Disable the olt device which is detected in voltha.
3089 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3090 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003091 df = defer.Deferred()
3092 self.success = True
3093 dhcp_app = 'org.onosproject.dhcp'
3094 def dhcp_flow_check_scenario(df):
3095 log_test.info('Enabling ponsim_olt')
3096 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3097 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3098 assert_not_equal(device_id, None)
3099 voltha = VolthaCtrl(self.VOLTHA_HOST,
3100 rest_port = self.VOLTHA_REST_PORT,
3101 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3102 time.sleep(10)
3103 switch_map = None
3104 olt_configured = False
3105 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3106 log_test.info('Installing OLT app')
3107 OnosCtrl.install_app(self.olt_app_file)
3108 time.sleep(5)
3109 log_test.info('Adding subscribers through OLT app')
3110 self.config_olt(switch_map)
3111 olt_configured = True
3112 time.sleep(5)
3113 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3114 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3115 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3116
3117 thread1.start()
3118 thread2.start()
3119 thread3.start()
3120 time.sleep(10)
3121 thread1.join()
3122 thread2.join()
3123 thread3.join()
3124 dhcp_flow_status = self.success
3125 try:
3126# if self.success is not True:
3127 assert_equal(dhcp_flow_status, True)
3128 #assert_equal(status, True)
3129 time.sleep(10)
3130 finally:
3131 self.voltha.disable_device(device_id, delete = True)
3132 self.remove_olt(switch_map)
3133 df.callback(0)
3134
3135 reactor.callLater(0, dhcp_flow_check_scenario, df)
3136 return df
3137
3138 @deferred(TESTCASE_TIMEOUT)
3139 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003140 """
3141 Test Method:
3142 0. Make sure that voltha is up and running on CORD-POD setup.
3143 1. OLT and ONU is detected and validated.
3144 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3145 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3146 4. Verify that subscribers had got ip from dhcp server successfully.
3147 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3148 6. Disable the olt device which is detected in voltha.
3149 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3150 8. Enable the olt device which is detected in voltha.
3151 9. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003152
Thangavelu K S057b7d22017-05-16 22:03:22 +00003153 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003154 df = defer.Deferred()
3155 self.success = True
3156 dhcp_app = 'org.onosproject.dhcp'
3157 def dhcp_flow_check_scenario(df):
3158 log_test.info('Enabling ponsim_olt')
3159 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3160 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3161 assert_not_equal(device_id, None)
3162 voltha = VolthaCtrl(self.VOLTHA_HOST,
3163 rest_port = self.VOLTHA_REST_PORT,
3164 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3165 time.sleep(10)
3166 switch_map = None
3167 olt_configured = False
3168 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3169 log_test.info('Installing OLT app')
3170 OnosCtrl.install_app(self.olt_app_file)
3171 time.sleep(5)
3172 log_test.info('Adding subscribers through OLT app')
3173 self.config_olt(switch_map)
3174 olt_configured = True
3175 time.sleep(5)
3176 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3177 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3178 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3179 thread1.start()
3180 thread2.start()
3181 thread3.start()
3182 time.sleep(10)
3183 thread1.join()
3184 thread2.join()
3185 thread3.join()
3186 dhcp_flow_status = self.success
3187 try:
3188# if self.success is not True:
3189 assert_equal(dhcp_flow_status, True)
3190 #assert_equal(status, True)
3191 time.sleep(10)
3192 finally:
3193 self.voltha.disable_device(device_id, delete = True)
3194 self.remove_olt(switch_map)
3195 df.callback(0)
3196
3197 reactor.callLater(0, dhcp_flow_check_scenario, df)
3198 return df
3199
3200 @deferred(TESTCASE_TIMEOUT)
3201 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003202 """
3203 Test Method:
3204 0. Make sure that voltha is up and running on CORD-POD setup.
3205 1. OLT and ONU is detected and validated.
3206 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3207 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3208 4. Verify that subscribers had got ip from dhcp server successfully.
3209 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3210 6. Pause the olt device which is detected in voltha.
3211 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3212 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003213 df = defer.Deferred()
3214 self.success = True
3215 dhcp_app = 'org.onosproject.dhcp'
3216 def dhcp_flow_check_scenario(df):
3217 log_test.info('Enabling ponsim_olt')
3218 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3219 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3220 assert_not_equal(device_id, None)
3221 voltha = VolthaCtrl(self.VOLTHA_HOST,
3222 rest_port = self.VOLTHA_REST_PORT,
3223 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3224 time.sleep(10)
3225 switch_map = None
3226 olt_configured = False
3227 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3228 log_test.info('Installing OLT app')
3229 OnosCtrl.install_app(self.olt_app_file)
3230 time.sleep(5)
3231 log_test.info('Adding subscribers through OLT app')
3232 self.config_olt(switch_map)
3233 olt_configured = True
3234 time.sleep(5)
3235 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3236 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3237 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
3238 thread1.start()
3239 thread2.start()
3240 thread3.start()
3241 time.sleep(10)
3242 thread1.join()
3243 thread2.join()
3244 thread3.join()
3245 dhcp_flow_status = self.success
3246 try:
3247# if self.success is not True:
3248 assert_equal(dhcp_flow_status, True)
3249 #assert_equal(status, True)
3250 time.sleep(10)
3251 finally:
3252 self.voltha.disable_device(device_id, delete = True)
3253 self.remove_olt(switch_map)
3254 df.callback(0)
3255
3256 reactor.callLater(0, dhcp_flow_check_scenario, df)
3257 return df
3258
3259
3260 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003261 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request(self):
3262 """
3263 Test Method:
3264 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3265 1. OLT and ONU is detected and validated.
3266 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3267 3. Send dhcp request from residential subscrber to external dhcp server.
3268 4. Verify that subscriber get ip from external dhcp server successfully.
3269 """
3270
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003271 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003272 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_broadcast_source_mac(self):
3273 """
3274 Test Method:
3275 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
3276 1. OLT and ONU is detected and validated.
3277 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3278 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
3279 4. Verify that subscriber should not get ip from external dhcp server.
3280 """
3281
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003282 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003283 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_multicast_source_mac(self):
3284 """
3285 Test Method:
3286 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
3287 1. OLT and ONU is detected and validated.
3288 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3289 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
3290 4. Verify that subscriber should not get ip from external dhcp server.
3291 """
3292
3293 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_source_mac(self):
3294 """
3295 Test Method:
3296 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3297 1. OLT and ONU is detected and validated.
3298 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3299 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
3300 4. Verify that subscriber should not get ip from external dhcp server.
3301 """
3302
3303 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_and_release(self):
3304 """
3305 Test Method:
3306 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3307 1. OLT and ONU is detected and validated.
3308 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3309 3. Send dhcp request from residential subscrber to external dhcp server.
3310 4. Verify that subscriber get ip from external dhcp server successfully.
3311 5. Send dhcp release from residential subscrber to external dhcp server.
3312 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
3313 """
3314
3315 def test_subscriber_with_voltha_for_dhcpRelay_starvation(self):
3316 """
3317 Test Method:
3318 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3319 1. OLT and ONU is detected and validated.
3320 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3321 3. Send dhcp request from residential subscriber to external dhcp server.
3322 4. Verify that subscriber get ip from external dhcp server. successfully.
3323 5. Repeat step 3 and 4 for 10 times.
3324 6 Verify that subscriber should get ip from external dhcp server..
3325 """
3326
3327 def test_subscriber_with_voltha_for_dhcpRelay_starvation_negative_scenario(self):
3328 """
3329 Test Method:
3330 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3331 1. OLT and ONU is detected and validated.
3332 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3333 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
3334 4. Verify that subscriber should not get ip from external dhcp server..
3335 5. Repeat steps 3 and 4 for 10 times.
3336 6 Verify that subscriber should not get ip from external dhcp server..
3337 """
3338 def test_subscriber_with_voltha_for_dhcpRelay_sending_multiple_discover(self):
3339 """
3340 Test Method:
3341 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3342 1. OLT and ONU is detected and validated.
3343 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3344 3. Send dhcp request from residential subscriber to external dhcp server.
3345 4. Verify that subscriber get ip from external dhcp server. successfully.
3346 5. Repeat step 3 for 50 times.
3347 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
3348 """
3349 def test_subscriber_with_voltha_for_dhcpRelay_sending_multiple_request(self):
3350 """
3351 Test Method:
3352 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3353 1. OLT and ONU is detected and validated.
3354 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3355 3. Send dhcp request from residential subscriber to external dhcp server.
3356 4. Verify that subscriber get ip from external dhcp server. successfully.
3357 5. Send DHCP request to external dhcp server.
3358 6. Repeat step 5 for 50 times.
3359 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
3360 """
3361
3362 def test_subscriber_with_voltha_for_dhcpRelay_requesting_desired_ip_address(self):
3363 """
3364 Test Method:
3365 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3366 1. OLT and ONU is detected and validated.
3367 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3368 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
3369 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
3370 """
3371
3372 def test_subscriber_with_voltha_for_dhcpRelay_requesting_desired_out_of_pool_ip_address(self):
3373 """
3374 Test Method:
3375 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3376 1. OLT and ONU is detected and validated.
3377 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3378 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
3379 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.
3380 """
3381
3382 def test_subscriber_with_voltha_for_dhcpRelay_deactivating_dhcpRelay_app_in_onos(self):
3383 """
3384 Test Method:
3385 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3386 1. OLT and ONU is detected and validated.
3387 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3388 3. Send dhcp request from residential subscriber to external dhcp server.
3389 4. Verify that subscriber get ip from external dhcp server. successfully.
3390 5. Deactivate dhcp server app in onos.
3391 6. Repeat step 3.
3392 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
3393 """
3394
3395 def test_subscriber_with_voltha_for_dhcpRelay_renew_time(self):
3396 """
3397 Test Method:
3398 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3399 1. OLT and ONU is detected and validated.
3400 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3401 3. Send dhcp request from residential subscriber to external dhcp server.
3402 4. Verify that subscriber get ip from external dhcp server. successfully.
3403 5. Send dhcp renew packet to external dhcp server.
3404 6. Repeat step 4.
3405 """
3406
3407 def test_subscriber_with_voltha_for_dhcpRelay_rebind_time(self):
3408 """
3409 Test Method:
3410 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3411 1. OLT and ONU is detected and validated.
3412 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3413 3. Send dhcp request from residential subscriber to external dhcp server.
3414 4. Verify that subscriber get ip from external dhcp server. successfully.
3415 5. Send dhcp rebind packet to external dhcp server.
3416 6. Repeat step 4.
3417 """
3418
3419 def test_subscriber_with_voltha_for_dhcpRelay_disable_olt_in_voltha(self):
3420 """
3421 Test Method:
3422 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3423 1. OLT and ONU is detected and validated.
3424 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3425 3. Send dhcp request from residential subscriber to external dhcp server.
3426 4. Verify that subscriber get ip from external dhcp server. successfully.
3427 5. Disable olt devices which is being detected in voltha CLI.
3428 6. Repeat step 3.
3429 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
3430 """
3431
3432 def test_subscriber_with_voltha_for_dhcpRelay_toggling_olt_in_voltha(self):
3433 """
3434 Test Method:
3435 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3436 1. OLT and ONU is detected and validated.
3437 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3438 3. Send dhcp request from residential subscriber to external dhcp server.
3439 4. Verify that subscriber get ip from external dhcp server. successfully.
3440 5. Disable olt devices which is being detected in voltha CLI.
3441 6. Repeat step 3.
3442 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
3443 8. Enable olt devices which is being detected in voltha CLI.
3444 9. Repeat steps 3 and 4.
3445 """
3446
3447 def test_subscriber_with_voltha_for_dhcpRelay_disable_onu_port_in_voltha(self):
3448 """
3449 Test Method:
3450 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3451 1. OLT and ONU is detected and validated.
3452 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3453 3. Send dhcp request from residential subscriber to external dhcp server.
3454 4. Verify that subscriber get ip from external dhcp server. successfully.
3455 5. Disable onu port which is being detected in voltha CLI.
3456 6. Repeat step 3.
3457 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
3458 """
3459
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003460 def test_subscriber_with_voltha_for_dhcpRelay_disable_enable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003461 """
3462 Test Method:
3463 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3464 1. OLT and ONU is detected and validated.
3465 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3466 3. Send dhcp request from residential subscriber to external dhcp server.
3467 4. Verify that subscriber get ip from external dhcp server. successfully.
3468 5. Disable onu port which is being detected in voltha CLI.
3469 6. Repeat step 3.
3470 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
3471 8. Enable onu port which is being detected in voltha CLI.
3472 9. Repeat steps 3 and 4.
3473 """
3474
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003475 def test_two_subscribers_with_voltha_for_dhcpRelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003476 """
3477 Test Method:
3478 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3479 1. OLT and ONU is detected and validated.
3480 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3481 3. Send dhcp request from two residential subscribers to external dhcp server.
3482 4. Verify that subscribers had got different ips from external dhcp server. successfully.
3483 """
3484
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003485 def test_two_subscribers_with_voltha_for_dhcpRelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003486 """
3487 Test Method:
3488 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3489 1. OLT and ONU is detected and validated.
3490 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3491 3. Send dhcp request from two residential subscribers to external dhcp server.
3492 4. Verify that subscribers had got ip from external dhcp server. successfully.
3493 5. Repeat step 3 and 4 for 10 times for both subscribers.
3494 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
3495 """
3496
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003497 def test_two_subscribers_with_voltha_for_dhcpRelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003498 """
3499 Test Method:
3500 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3501 1. OLT and ONU is detected and validated.
3502 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3503 3. Send dhcp request from two residential subscribers to external dhcp server.
3504 4. Verify that subscribers had got ip from external dhcp server. successfully.
3505 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3506 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
3507 """
3508
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003509 def test_two_subscribers_with_voltha_for_dhcpRelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003510 """
3511 Test Method:
3512 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3513 1. OLT and ONU is detected and validated.
3514 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3515 3. Send dhcp request from one residential subscriber to external dhcp server.
3516 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
3517 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
3518 """
3519
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003520 def test_two_subscribers_with_voltha_for_dhcpRelay_discover_in_range_and_out_of_range_from_dhcp_pool_ip_addresses(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003521 """
3522 Test Method:
3523 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3524 1. OLT and ONU is detected and validated.
3525 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3526 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
3527 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
3528 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
3529 """
3530
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003531 def test_two_subscribers_with_voltha_for_dhcpRelay_disable_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003532 """
3533 Test Method:
3534 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3535 1. OLT and ONU is detected and validated.
3536 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3537 3. Send dhcp request from two residential subscribers to external dhcp server.
3538 4. Verify that subscribers had got ip from external dhcp server. successfully.
3539 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3540 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3541 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
3542 """
3543
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003544 def test_two_subscribers_with_voltha_for_dhcpRelay_toggle_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003545 """
3546 Test Method:
3547 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3548 1. OLT and ONU is detected and validated.
3549 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3550 3. Send dhcp request from two residential subscribers to external dhcp server.
3551 4. Verify that subscribers had got ip from external dhcp server. successfully.
3552 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3553 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3554 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
3555 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
3556 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
3557 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
3558 """
3559
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003560 def test_two_subscribers_with_voltha_for_dhcpRelay_disable_olt_detected_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003561 """
3562 Test Method:
3563 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3564 1. OLT and ONU is detected and validated.
3565 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3566 3. Send dhcp request from two residential subscribers to external dhcp server.
3567 4. Verify that subscribers had got ip from external dhcp server. successfully.
3568 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3569 6. Disable the olt device which is detected in voltha.
3570 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
3571 """
3572
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003573 def test_two_subscribers_with_voltha_for_dhcpRelay_toggle_olt_detected_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003574 """
3575 Test Method:
3576 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3577 1. OLT and ONU is detected and validated.
3578 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3579 3. Send dhcp request from two residential subscribers to external dhcp server.
3580 4. Verify that subscribers had got ip from external dhcp server. successfully.
3581 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3582 6. Disable the olt device which is detected in voltha.
3583 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
3584 8. Enable the olt device which is detected in voltha.
3585 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
3586 """
3587
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003588 def test_two_subscribers_with_voltha_for_dhcpRelay_pause_olt_detected_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003589 """
3590 Test Method:
3591 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3592 1. OLT and ONU is detected and validated.
3593 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3594 3. Send dhcp request from two residential subscribers to external dhcp server.
3595 4. Verify that subscribers had got ip from external dhcp server. successfully.
3596 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3597 6. Pause the olt device which is detected in voltha.
3598 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
3599 """