blob: eb29c666fbbe38b77dfef940710094f3097aa6a6 [file] [log] [blame]
A R Karthick35495c32017-05-11 14:58:32 -07001import os
2import sys
3import unittest
A.R Karthick8a507cf2017-06-02 18:44:49 -07004import time
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00005import json
6import requests
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00007import threading
8from random import randint
9from threading import Timer
A R Karthick35495c32017-05-11 14:58:32 -070010from nose.tools import *
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000011from nose.twistedtools import reactor, deferred
12from twisted.internet import defer
A R Karthick35495c32017-05-11 14:58:32 -070013from CordTestConfig import setup_module
14from CordTestUtils import log_test
15from VolthaCtrl import VolthaCtrl
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000016from CordTestUtils import log_test, get_controller
17from portmaps import g_subscriber_port_map
18from OltConfig import *
19from EapTLS import TLSAuthTest
Thangavelu K Sa1c71b42017-06-14 18:13:21 +000020from DHCP import DHCPTest
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000021from OnosCtrl import OnosCtrl
22from CordLogger import CordLogger
23from scapy.all import *
24from scapy_ssl_tls.ssl_tls import *
25from scapy_ssl_tls.ssl_tls_crypto import *
26from CordTestServer import cord_test_onos_restart, cord_test_shell, cord_test_radius_restart
A.R Karthickb9eab5a2017-06-07 16:03:51 -070027from CordContainer import Onos
A R Karthick35495c32017-05-11 14:58:32 -070028
29class voltha_exchange(unittest.TestCase):
30
31 OLT_TYPE = 'tibit_olt'
32 OLT_MAC = '00:0c:e2:31:12:00'
33 VOLTHA_HOST = 'localhost'
34 VOLTHA_REST_PORT = 8881
35 voltha = None
Thangavelu K S9648eed2017-06-13 20:15:25 +000036 success = True
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000037 apps = ('org.opencord.aaa', 'org.onosproject.dhcp')
38 olt_apps = () #'org.opencord.cordmcast')
39 vtn_app = 'org.opencord.vtn'
40 table_app = 'org.ciena.cordigmp'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000041 test_path = os.path.dirname(os.path.realpath(__file__))
42 table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
A.R Karthickb9eab5a2017-06-07 16:03:51 -070043 app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000044 olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar')
A.R Karthick3493a572017-06-07 18:28:10 -070045 olt_app_name = 'org.onosproject.olt'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000046 #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
47 olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
48 onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
49 VOLTHA_ENABLED = True
50 INTF_TX_DEFAULT = 'veth2'
51 INTF_RX_DEFAULT = 'veth0'
Thangavelu K S9648eed2017-06-13 20:15:25 +000052 INTF_2_RX_DEFAULT = 'veth6'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000053 TESTCASE_TIMEOUT = 300
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +000054# VOLTHA_CONFIG_FAKE = True
55 VOLTHA_CONFIG_FAKE = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000056 VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
57 VOLTHA_ONU_UNI_PORT = 'veth0'
58
Thangavelu K Sa1c71b42017-06-14 18:13:21 +000059 dhcp_server_config = {
60 "ip": "10.1.11.50",
61 "mac": "ca:fe:ca:fe:ca:fe",
62 "subnet": "255.255.252.0",
63 "broadcast": "10.1.11.255",
64 "router": "10.1.8.1",
65 "domain": "8.8.8.8",
66 "ttl": "63",
67 "delay": "2",
68 "startip": "10.1.11.51",
69 "endip": "10.1.11.100"
70 }
71
72
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000073 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
74MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
75CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
76IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
77RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
78MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
79BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
80hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
81gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
82+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
83rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
84VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
85eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
866tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
87PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
88nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
89-----END CERTIFICATE-----"""
90
91 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
92MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
93CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
94IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
95RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
96MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
97BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
98hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
99AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
1005An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
101tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
102OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
103qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
1042Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
105BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
106eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
107MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
108VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
109RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
110dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
111T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
112yg==
113-----END CERTIFICATE-----'''
A R Karthick35495c32017-05-11 14:58:32 -0700114
A.R Karthick3493a572017-06-07 18:28:10 -0700115 @classmethod
116 def update_apps_version(cls):
117 version = Onos.getVersion()
118 major = int(version.split('.')[0])
119 minor = int(version.split('.')[1])
120 cordigmp_app_version = '2.0-SNAPSHOT'
121 olt_app_version = '1.2-SNAPSHOT'
122 if major > 1:
123 cordigmp_app_version = '3.0-SNAPSHOT'
124 olt_app_version = '2.0-SNAPSHOT'
125 elif major == 1:
126 if minor > 10:
127 cordigmp_app_version = '3.0-SNAPSHOT'
128 olt_app_version = '2.0-SNAPSHOT'
129 elif minor <= 8:
130 olt_app_version = '1.1-SNAPSHOT'
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700131 cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version))
132 cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version))
133 cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
134
A R Karthick35495c32017-05-11 14:58:32 -0700135 @classmethod
A.R Karthickf874d032017-06-07 18:47:51 -0700136 def onos_load_config(cls, app, config):
137 status, code = OnosCtrl.config(config)
138 if status is False:
139 log_test.info('JSON config request for app %s returned status %d' %(app, code))
140 assert_equal(status, True)
141 time.sleep(2)
142
143 @classmethod
144 def onos_aaa_load(cls):
145 aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
146 'radiusIp': '172.17.0.2' } } } }
147 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
148 aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip
149 cls.onos_load_config('org.opencord.aaa', aaa_dict)
150
151 @classmethod
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000152 def onos_dhcp_table_load(self, config = None):
153 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
154 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
155 if config:
156 for k in config.keys():
157 if dhcp_config.has_key(k):
158 dhcp_config[k] = config[k]
159 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
160
Thangavelu K S735a6662017-06-15 18:08:23 +0000161 def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = True):
162 if validation :
163 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
164 assert_not_equal(cip, None)
165 assert_not_equal(sip, None)
166 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
167 (cip, sip, dhcp.get_mac(cip)[0]))
168 if validation == False:
169 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
170 assert_equal(cip, None)
171 assert_equal(sip, None)
172 log_test.info('Dhcp client did not get IP from server %s for mac %s' %
173 (cip, sip, dhcp.get_mac(cip)[0]))
174
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000175 return cip,sip
176
177 def dhcp_request(self, onu_iface = None, seed_ip = '10.10.10.1', update_seed = False):
178 config = {'startip':'10.10.10.20', 'endip':'10.10.10.200',
179 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
180 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
181 self.onos_dhcp_table_load(config)
182 dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000183 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed, validation = validation)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000184 return cip, sip
185
186 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700187 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700188 cls.update_apps_version()
A R Karthick35495c32017-05-11 14:58:32 -0700189 cls.voltha = VolthaCtrl(cls.VOLTHA_HOST, rest_port = cls.VOLTHA_REST_PORT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000190 cls.install_app_table()
191 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
192 cls.port_map, cls.port_list = cls.olt.olt_port_map()
193 cls.switches = cls.port_map['switches']
194 cls.num_ports = cls.port_map['num_ports']
195 if cls.num_ports > 1:
196 cls.num_ports -= 1 ##account for the tx port
197 cls.activate_apps(cls.apps + cls.olt_apps)
A.R Karthickf874d032017-06-07 18:47:51 -0700198 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000199
A.R Karthick3493a572017-06-07 18:28:10 -0700200 @classmethod
201 def tearDownClass(cls):
202 '''Deactivate the olt apps and restart OVS back'''
203 apps = cls.olt_apps + ( cls.table_app,)
204 for app in apps:
205 onos_ctrl = OnosCtrl(app)
206 onos_ctrl.deactivate()
207 cls.install_app_igmp()
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700208
A.R Karthick3493a572017-06-07 18:28:10 -0700209 @classmethod
210 def install_app_igmp(cls):
211 ##Uninstall the table app on class exit
212 OnosCtrl.uninstall_app(cls.table_app)
213 time.sleep(2)
214 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
215 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700216
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000217 def remove_olt(self, switch_map):
218 controller = get_controller()
219 auth = ('karaf', 'karaf')
220 #remove subscriber for every port on all the voltha devices
221 for device, device_map in switch_map.iteritems():
222 uni_ports = device_map['ports']
223 uplink_vlan = device_map['uplink_vlan']
224 for port in uni_ports:
225 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
226 device,
227 port)
228 resp = requests.delete(rest_url, auth = auth)
229 if resp.status_code not in [204, 202, 200]:
230 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
231 else:
232 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
233 OnosCtrl.uninstall_app(self.olt_app_file)
234
235 def config_olt(self, switch_map):
236 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000237 auth = ('karaf', 'karaf')
238 #configure subscriber for every port on all the voltha devices
239 for device, device_map in switch_map.iteritems():
240 uni_ports = device_map['ports']
241 uplink_vlan = device_map['uplink_vlan']
242 for port in uni_ports:
243 vlan = port
244 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
245 device,
246 port,
247 vlan)
248 resp = requests.post(rest_url, auth = auth)
249 #assert_equal(resp.ok, True)
250
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000251 def voltha_uni_port_toggle(self, uni_port = None):
252 ## Admin state of port is down and up
253 if not uni_port:
254 uni_port = self.INTF_RX_DEFAULT
255 cmd = 'ifconfig {} down'.format(uni_port)
256 os.system(cmd)
257 log_test.info('Admin state of uni_port is down')
258 time.sleep(30)
259 cmd = 'ifconfig {} up'.format(uni_port)
260 os.system(cmd)
261 log_test.info('Admin state of uni_port is up now')
262 time.sleep(30)
263 return
264
265
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000266 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000267 def install_app_table(cls):
268 ##Uninstall the existing app if any
269 OnosCtrl.uninstall_app(cls.table_app)
270 time.sleep(2)
271 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
272 OnosCtrl.install_app(cls.table_app_file)
273 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000274
275 @classmethod
276 def activate_apps(cls, apps):
277 for app in apps:
278 onos_ctrl = OnosCtrl(app)
279 status, _ = onos_ctrl.activate()
280 assert_equal(status, True)
281 time.sleep(2)
282
Thangavelu K S735a6662017-06-15 18:08:23 +0000283 @classmethod
284 def deactivate_apps(cls, apps):
285 self.success = True
286 for app in apps:
287 onos_ctrl = OnosCtrl(app)
288 status, _ = onos_ctrl.deactivate()
289 if status is False:
290 self.success = False
291 assert_equal(status, True)
292 time.sleep(2)
293
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000294 def tls_flow_check(self, olt_uni_port, cert_info = None):
295 def tls_fail_cb():
296 log_test.info('TLS verification failed')
297 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700298 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000299 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
300 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000301 if tls.failTest is True:
302 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000303 assert_equal(tls.failTest, False)
304 if cert_info == "no_cert":
305 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
306 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
307 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000308 if tls.failTest is False:
309 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000310 assert_equal(tls.failTest, True)
311 if cert_info == "invalid_cert":
312 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
313 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
314 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000315 if tls.failTest is False:
316 self.success = False
317 assert_equal(tls.failTest, True)
318 if cert_info == "same_cert":
319 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
320 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
321 tls.runTest()
322 if tls.failTest is False:
323 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000324 assert_equal(tls.failTest, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000325 if cert_info == "app_deactivate" or cert_info == "restart_radius" or cert_info == "disable_olt_device" or \
Thangavelu K S9648eed2017-06-13 20:15:25 +0000326 cert_info == "uni_port_admin_down" or cert_info == "restart_olt_device" or cert_info == "restart_onu_device":
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000327 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
328 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
329 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000330 if tls.failTest is False:
331 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000332 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000333 self.test_status = True
334 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700335
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000336 def dhcp_flow_check(self, onu_iface =None, negative_test = None):
Thangavelu K S735a6662017-06-15 18:08:23 +0000337 self.success = True
338
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000339 if negative_test is None:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000340 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
341 if not cip or sip:
Thangavelu K S735a6662017-06-15 18:08:23 +0000342 self.success = False
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000343 self.test_status = False
344 assert_not_equal(cip,None)
345 assert_not_equal(sip,None)
346 else:
347 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
348 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000349
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000350 if negative_test == "interrupting_dhcp_flows":
351 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
Thangavelu K S735a6662017-06-15 18:08:23 +0000352 if cip is not None:
353 self.success = False
354 assert_equal(cip,None)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000355 log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000356 self.test_status = True
357
358 if negative_test == "invalid_src_mac_broadcast":
359 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
360 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
361 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
362 self.onos_dhcp_table_load(config)
363 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
364 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000365
366 if cip is not None:
367 self.success = False
368 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 +0000369 assert_equal(cip,None)
370 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
371 self.test_status = True
372 if negative_test == "invalid_src_mac_multicast":
373 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
374 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
375 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
376 self.onos_dhcp_table_load(config)
377 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
378 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000379 if cip is not None:
380 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000381 assert_equal(cip,None)
382 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
383 self.test_status = True
384
385 if negative_test == "invalid_src_mac_junk":
386 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
387 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
388 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
389 self.onos_dhcp_table_load(config)
390 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
391 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000392 if cip is not None:
393 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000394 assert_equal(cip,None)
395 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
396 self.test_status = True
397
398 if negative_test == "request_release":
399 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
400 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
401 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
402 self.onos_dhcp_table_load(config)
403 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
404 cip, sip = self.dhcp_sndrcv(self.dhcp)
405 log_test.info('Releasing ip %s to server %s' %(cip, sip))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000406 if not self.dhcp.release(cip):
407 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000408 assert_equal(self.dhcp.release(cip), True)
409 log_test.info('Triggering DHCP discover again after release')
410 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
411 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000412 if not cip == cip2:
Thangavelu K S735a6662017-06-15 18:08:23 +0000413 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000414 assert_equal(cip, cip2)
415 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
416 assert_equal(self.dhcp.release(cip2), True)
417 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000418 if negative_test == "starvation_positive":
419 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
420 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
421 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
422 self.onos_dhcp_table_load(config)
423 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
424 ip_map = {}
425 for i in range(10):
426 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
427 if ip_map.has_key(cip):
428 self.success = False
429 log_test.info('IP %s given out multiple times' %cip)
430 assert_equal(False, ip_map.has_key(cip))
431 ip_map[cip] = sip
432 self.test_status = True
433 if negative_test == "starvation_negative":
434 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
435 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
436 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
437 self.onos_dhcp_table_load(config)
438 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
439 log_test.info('Verifying passitive case')
440 for x in xrange(50):
441 mac = RandMAC()._fix()
442 self.dhcp_sndrcv(self.dhcp,mac = mac)
443 log_test.info('Verifying negative case')
444 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000445 if cip or sip is not None:
446 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000447 assert_equal(cip, None)
448 assert_equal(sip, None)
449 self.test_status = True
450 self.success = True
451 if negative_test == "multiple_discover":
452 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
453 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
454 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
455 self.onos_dhcp_table_load(config)
456 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
457 cip, sip, mac, _ = self.dhcp.only_discover()
458 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
459 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000460 if cip is None:
461 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000462 assert_not_equal(cip, None)
463 log_test.info('Triggering DHCP discover again.')
464 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000465 if not new_cip == cip:
466 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000467 assert_equal(new_cip, cip)
468 log_test.info('client got same IP as expected when sent 2nd discovery')
469 self.test_status = True
470 self.success = True
471 if negative_test == "multiple_requests":
472 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
473 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
474 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
475 self.onos_dhcp_table_load(config)
476 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
477 log_test.info('Sending DHCP discover and DHCP request.')
478 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
479 mac = self.dhcp.get_mac(cip)[0]
480 log_test.info("Sending DHCP request again.")
481 new_cip, new_sip = self.dhcp.only_request(cip, mac)
482 assert_equal(new_cip,cip)
483 log_test.info('server offered same IP to clain for multiple requests, as expected')
484 self.test_status = True
485 self.success = True
486 if negative_test == "desired_ip_address":
487 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
488 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
489 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
490 self.onos_dhcp_table_load(config)
491 self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface)
492 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000493 if cip or sip is None:
494 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000495 assert_not_equal(cip, None)
496 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
497 (cip, sip, mac))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000498 if not self.dhcp.seed_ip == cip:
499 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000500 assert_equal(cip,self.dhcp.seed_ip)
501 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
502 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000503 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000504 if negative_test == "desired_out_of_pool_ip_address":
505 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
506 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
507 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
508 self.onos_dhcp_table_load(config)
509 self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface)
510 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000511 if cip or sip is None:
512 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000513 assert_not_equal(cip, None)
514 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
515 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000516 if self.dhcp.seed_ip == cip:
517 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000518 assert_not_equal(cip,self.dhcp.seed_ip)
519 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
520 self.test_status = True
Chetan Gaonkercf37f262017-06-19 19:11:11 +0000521 self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000522 if negative_test == "dhcp_renew":
523 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
524 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
525 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
526 self.onos_dhcp_table_load(config)
527 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
528 cip, sip, mac, _ = self.dhcp.only_discover()
529 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
530 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000531 if cip or sip is None:
532 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000533 assert_not_equal(cip, None)
534 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
535 log_test.info('waiting renew time %d seconds to send next request packet'%lval)
536 time.sleep(lval)
537 latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000538 if not latest_cip == cip:
539 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000540 assert_equal(latest_cip,cip)
541 log_test.info('client got same IP after renew time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +0000542 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000543 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000544 if negative_test == "dhcp_rebind":
545 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
546 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
547 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
548 self.onos_dhcp_table_load(config)
549 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
550 cip, sip, mac, _ = self.dhcp.only_discover()
551 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
552 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000553 if cip or sip is None:
554 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000555 assert_not_equal(cip, None)
556 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
557 log_test.info('waiting rebind time %d seconds to send next request packet'%lval)
558 time.sleep(lval)
559 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000560 if not latest_cip == cip:
561 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000562 assert_equal(latest_cip,cip)
563 log_test.info('client got same IP after rebind time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +0000564 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000565 # self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000566 return self.test_status
567
A.R Karthick8a507cf2017-06-02 18:44:49 -0700568 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -0700569 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -0700570 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
571 assert_not_equal(device_id, None)
572 try:
573 assert_equal(status, True)
574 time.sleep(10)
575 finally:
576 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000577
A.R Karthick8a507cf2017-06-02 18:44:49 -0700578 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -0700579 log_test.info('Enabling ponsim_olt')
580 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -0700581 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
582 assert_not_equal(device_id, None)
583 try:
584 assert_equal(status, True)
585 time.sleep(10)
586 finally:
587 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -0700588
Thangavelu K S008f38e2017-05-15 19:36:55 +0000589 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
590 """
591 Test Method:
592 0. Make sure that voltha is up and running on CORD-POD setup.
593 1. OLT and ONU is detected and validated.
594 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
595 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
596 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
597 5. Verify that subscriber is authenticated successfully.
598 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000599 log_test.info('Enabling ponsim_olt')
600 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
601 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
602 assert_not_equal(device_id, None)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700603 if status == False:
604 self.voltha.disable_device(device_id, delete = True)
605 assert_equal(status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000606 time.sleep(10)
607 switch_map = None
608 olt_configured = False
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700609 voltha = VolthaCtrl(self.VOLTHA_HOST,
610 rest_port = self.VOLTHA_REST_PORT,
611 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000612 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700613 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
614 if not switch_map:
615 log_test.info('No voltha devices found')
616 return
617 log_test.info('Installing OLT app')
618 OnosCtrl.install_app(self.olt_app_file)
619 time.sleep(5)
620 log_test.info('Adding subscribers through OLT app')
621 self.config_olt(switch_map)
622 olt_configured = True
623 time.sleep(5)
624 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000625 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000626 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700627 if switch_map is not None:
628 if olt_configured is True:
629 self.remove_olt(switch_map)
630 self.voltha.disable_device(device_id, delete = True)
631 time.sleep(10)
632 OnosCtrl.uninstall_app(self.olt_app_name)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000633
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000634 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000635 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
636 """
637 Test Method:
638 0. Make sure that voltha is up and running on CORD-POD setup.
639 1. OLT and ONU is detected and validated.
640 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
641 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
642 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
643 5. Verify that subscriber authentication is unsuccessful..
644 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000645 df = defer.Deferred()
646 def tls_flow_check_with_no_cert_scenario(df):
647 log_test.info('Enabling ponsim_olt')
648 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
649 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
650 assert_not_equal(device_id, None)
651 voltha = VolthaCtrl(self.VOLTHA_HOST,
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700652 rest_port = self.VOLTHA_REST_PORT,
653 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000654 time.sleep(10)
655 switch_map = None
656 olt_configured = False
657 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
658 log_test.info('Installing OLT app')
659 OnosCtrl.install_app(self.olt_app_file)
660 time.sleep(5)
661 log_test.info('Adding subscribers through OLT app')
662 self.config_olt(switch_map)
663 olt_configured = True
664 time.sleep(5)
665 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
666 try:
667 assert_equal(auth_status, True)
668 assert_equal(status, True)
669 time.sleep(10)
670 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700671 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000672 self.voltha.disable_device(device_id, delete = True)
673 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700674
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000675 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
676 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000677
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000678 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000679 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
680 """
681 Test Method:
682 0. Make sure that voltha is up and running on CORD-POD setup.
683 1. OLT and ONU is detected and validated.
684 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
685 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
686 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
687 5. Verify that subscriber authentication is unsuccessful..
688 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000689 df = defer.Deferred()
690 def tls_flow_check_with_invalid_cert_scenario(df):
691 log_test.info('Enabling ponsim_olt')
692 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
693 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
694 assert_not_equal(device_id, None)
695 voltha = VolthaCtrl(self.VOLTHA_HOST,
696 rest_port = self.VOLTHA_REST_PORT,
697 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
698 time.sleep(10)
699 switch_map = None
700 olt_configured = False
701 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
702 log_test.info('Installing OLT app')
703 OnosCtrl.install_app(self.olt_app_file)
704 time.sleep(5)
705 log_test.info('Adding subscribers through OLT app')
706 self.config_olt(switch_map)
707 olt_configured = True
708 time.sleep(5)
709 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
710 try:
711 assert_equal(auth_status, True)
712 assert_equal(status, True)
713 time.sleep(10)
714 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700715 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000716 self.voltha.disable_device(device_id, delete = True)
717 df.callback(0)
718 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
719 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000720
Thangavelu K S0d745c82017-06-09 21:56:08 +0000721 @deferred(TESTCASE_TIMEOUT)
722 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
723 """
724 Test Method:
725 0. Make sure that voltha is up and running on CORD-POD setup.
726 1. OLT and ONU is detected and validated.
727 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
728 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
729 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
730 5. Verify that subscriber authentication is unsuccessful..
731 """
732 df = defer.Deferred()
733 def tls_flow_check_with_no_cert_scenario(df):
734 log_test.info('Enabling ponsim_olt')
735 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
736 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
737 assert_not_equal(device_id, None)
738 voltha = VolthaCtrl(self.VOLTHA_HOST,
739 rest_port = self.VOLTHA_REST_PORT,
740 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
741 time.sleep(10)
742 switch_map = None
743 olt_configured = False
744 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
745 log_test.info('Installing OLT app')
746 OnosCtrl.install_app(self.olt_app_file)
747 time.sleep(5)
748 log_test.info('Adding subscribers through OLT app')
749 self.config_olt(switch_map)
750 olt_configured = True
751 time.sleep(5)
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 = "invalid_cert")
754 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
755 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
756 try:
757 assert_equal(auth_status, True)
758 assert_equal(status, True)
759 time.sleep(10)
760 finally:
761 self.voltha.disable_device(device_id, delete = True)
762 df.callback(0)
763 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
764 return df
765
766 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000767 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
768 """
769 Test Method:
770 0. Make sure that voltha is up and running on CORD-POD setup.
771 1. OLT and ONU is detected and validated.
772 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
773 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
774 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
775 5. Verify that subscriber authentication is unsuccessful..
776 """
Thangavelu K S0d745c82017-06-09 21:56:08 +0000777 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000778 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +0000779 aaa_app = ["org.opencord.aaa"]
780 log_test.info('Enabling ponsim_olt')
781 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
782 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
783 assert_not_equal(device_id, None)
784 voltha = VolthaCtrl(self.VOLTHA_HOST,
785 rest_port = self.VOLTHA_REST_PORT,
786 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
787 time.sleep(10)
788 switch_map = None
789 olt_configured = False
790 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
791 log_test.info('Installing OLT app')
792 OnosCtrl.install_app(self.olt_app_file)
793 time.sleep(5)
794 log_test.info('Adding subscribers through OLT app')
795 self.config_olt(switch_map)
796 olt_configured = True
797 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000798
Thangavelu K S0d745c82017-06-09 21:56:08 +0000799 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
800 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
801 thread1.start()
802 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000803 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +0000804 thread2.start()
805 time.sleep(10)
806 thread1.join()
807 thread2.join()
808 try:
809 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000810 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000811 time.sleep(10)
812 finally:
813 self.voltha.disable_device(device_id, delete = True)
814 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000815 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000816 return df
817
818 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000819 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
820 """
821 Test Method:
822 0. Make sure that voltha is up and running on CORD-POD setup.
823 1. OLT and ONU is detected and validated.
824 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
825 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
826 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
827 5. Verify that subscriber authentication is unsuccessful..
828 """
Thangavelu K S0d745c82017-06-09 21:56:08 +0000829 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000830 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +0000831 aaa_app = ["org.opencord.aaa"]
832 log_test.info('Enabling ponsim_olt')
833 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
834 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
835 assert_not_equal(device_id, None)
836 voltha = VolthaCtrl(self.VOLTHA_HOST,
837 rest_port = self.VOLTHA_REST_PORT,
838 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
839 time.sleep(10)
840 switch_map = None
841 olt_configured = False
842 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
843 log_test.info('Installing OLT app')
844 OnosCtrl.install_app(self.olt_app_file)
845 time.sleep(5)
846 log_test.info('Adding subscribers through OLT app')
847 self.config_olt(switch_map)
848 olt_configured = True
849 time.sleep(5)
850
851 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
852 thread2 = threading.Thread(target = cord_test_radius_restart)
853 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000854 time.sleep(randint(1,2))
855 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +0000856 thread2.start()
857 time.sleep(10)
858 thread1.join()
859 thread2.join()
860 try:
861 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000862 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000863 time.sleep(10)
864 finally:
865 self.voltha.disable_device(device_id, delete = True)
866 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000867 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000868 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +0000869
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000870 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000871 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
872 """
873 Test Method:
874 0. Make sure that voltha is up and running on CORD-POD setup.
875 1. OLT and ONU is detected and validated.
876 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
877 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
878 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
879 6. Verify that subscriber authenticated successfully.
880 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
881 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
882 9. Verify that subscriber authentication is unsuccessful..
883 """
Thangavelu K S0d745c82017-06-09 21:56:08 +0000884 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000885 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +0000886 aaa_app = ["org.opencord.aaa"]
887 log_test.info('Enabling ponsim_olt')
888 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
889 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
890 assert_not_equal(device_id, None)
891 voltha = VolthaCtrl(self.VOLTHA_HOST,
892 rest_port = self.VOLTHA_REST_PORT,
893 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
894 time.sleep(10)
895 switch_map = None
896 olt_configured = False
897 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
898 log_test.info('Installing OLT app')
899 OnosCtrl.install_app(self.olt_app_file)
900 time.sleep(5)
901 log_test.info('Adding subscribers through OLT app')
902 self.config_olt(switch_map)
903 olt_configured = True
904 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000905
Thangavelu K S0d745c82017-06-09 21:56:08 +0000906 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
907 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,))
908 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000909 time.sleep(randint(1,2))
910 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +0000911 thread2.start()
912 time.sleep(10)
913 thread1.join()
914 thread2.join()
915 try:
916 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000917 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000918 time.sleep(10)
919 finally:
920 self.voltha.disable_device(device_id, delete = True)
921 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000922 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +0000923 return df
924
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000925 @deferred(TESTCASE_TIMEOUT)
926 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +0000927 """
928 Test Method:
929 0. Make sure that voltha is up and running on CORD-POD setup.
930 1. OLT and ONU is detected and validated.
931 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
932 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
933 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
934 6. Verify that subscriber authenticated successfully.
935 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
936 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
937 9. Verify that subscriber authentication is unsuccessful..
938 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000939 df = defer.Deferred()
940 def tls_flow_check_operating_olt_state(df):
941 aaa_app = ["org.opencord.aaa"]
942 log_test.info('Enabling ponsim_olt')
943 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
944 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
945 assert_not_equal(device_id, None)
946 voltha = VolthaCtrl(self.VOLTHA_HOST,
947 rest_port = self.VOLTHA_REST_PORT,
948 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
949 time.sleep(10)
950 switch_map = None
951 olt_configured = False
952 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
953 log_test.info('Installing OLT app')
954 OnosCtrl.install_app(self.olt_app_file)
955 time.sleep(5)
956 log_test.info('Adding subscribers through OLT app')
957 self.config_olt(switch_map)
958 olt_configured = True
959 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000960
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000961 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
962 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
963 thread1.start()
964 time.sleep(randint(1,2))
965 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
966 thread2.start()
967 time.sleep(10)
968 thread1.join()
969 thread2.join()
970 try:
971 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000972 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000973 time.sleep(10)
974 finally:
975 self.voltha.disable_device(device_id, delete = True)
976 df.callback(0)
977 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
978 return df
979
980 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +0000981 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
982 """
983 Test Method:
984 0. Make sure that voltha is up and running on CORD-POD setup.
985 1. OLT and ONU is detected and validated.
986 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
987 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
988 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
989 6. Verify that subscriber authenticated successfully.
990 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
991 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
992 9. Verify that subscriber authentication is unsuccessful..
993 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000994 df = defer.Deferred()
995 def tls_flow_check_operating_olt_state(df):
996 aaa_app = ["org.opencord.aaa"]
997 log_test.info('Enabling ponsim_olt')
998 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
999 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1000 assert_not_equal(device_id, None)
1001 voltha = VolthaCtrl(self.VOLTHA_HOST,
1002 rest_port = self.VOLTHA_REST_PORT,
1003 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1004 time.sleep(10)
1005 switch_map = None
1006 olt_configured = False
1007 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1008 log_test.info('Installing OLT app')
1009 OnosCtrl.install_app(self.olt_app_file)
1010 time.sleep(5)
1011 log_test.info('Adding subscribers through OLT app')
1012 self.config_olt(switch_map)
1013 olt_configured = True
1014 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001015
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001016 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
1017 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
1018 thread1.start()
1019 time.sleep(randint(1,2))
1020 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
1021 thread2.start()
1022 time.sleep(10)
1023 thread1.join()
1024 thread2.join()
1025 try:
1026 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001027 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001028 time.sleep(10)
1029 finally:
1030 self.voltha.disable_device(device_id, delete = True)
1031 df.callback(0)
1032 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1033 return df
1034
1035 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001036 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
1037 """
1038 Test Method:
1039 0. Make sure that voltha is up and running on CORD-POD setup.
1040 1. OLT and ONU is detected and validated.
1041 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1042 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1043 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1044 6. Verify that subscriber authenticated successfully.
1045 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
1046 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1047 9. Verify that subscriber authentication is unsuccessful..
1048 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001049 df = defer.Deferred()
1050 def tls_flow_check_operating_olt_state(df):
1051 aaa_app = ["org.opencord.aaa"]
1052 log_test.info('Enabling ponsim_olt')
1053 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1054 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1055 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00001056 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1057
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001058 onu_device_id = devices_list['items'][1]['id']
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)
1074 devices_list = self.voltha.get_devices()
1075 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
1076 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
1077 thread1.start()
1078 time.sleep(randint(1,2))
1079 log_test.info('Restart the ponsim oon 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
Thangavelu K S008f38e2017-05-15 19:36:55 +00001093
Thangavelu K S9648eed2017-06-13 20:15:25 +00001094 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001095 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
1096 """
1097 Test Method:
1098 0. Make sure that voltha is up and running on CORD-POD setup.
1099 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1100 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1101 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1102 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
1103 5. Verify that two subscribers are authenticated successfully.
1104 """
1105
Thangavelu K S9648eed2017-06-13 20:15:25 +00001106 df = defer.Deferred()
1107 def tls_flow_check_on_two_subscriber_same_olt_device(df):
1108 aaa_app = ["org.opencord.aaa"]
1109 log_test.info('Enabling ponsim_olt')
1110 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1111 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1112 devices_list = self.voltha.get_devices()
1113 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1114
1115 onu_device_id = devices_list['items'][1]['id']
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 devices_list = self.voltha.get_devices()
1132 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1133 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
1134 thread1.start()
1135 time.sleep(randint(1,2))
1136 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1137 thread2.start()
1138 time.sleep(10)
1139 thread1.join()
1140 thread2.join()
1141 try:
1142 # assert_equal(status, True)
1143 assert_equal(self.success, True)
1144 time.sleep(10)
1145 finally:
1146 self.voltha.disable_device(device_id, delete = True)
1147 df.callback(0)
1148 reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df)
1149 return df
1150
1151 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001152 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
1153 """
1154 Test Method:
1155 0. Make sure that voltha is up and running on CORD-POD setup.
1156 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1157 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1158 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1159 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
1160 5. Verify that two subscribers are not authenticated.
1161 """
1162
Thangavelu K S9648eed2017-06-13 20:15:25 +00001163 df = defer.Deferred()
1164 def tls_flow_check_on_two_subscriber_same_olt_device(df):
1165 aaa_app = ["org.opencord.aaa"]
1166 log_test.info('Enabling ponsim_olt')
1167 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1168 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1169 devices_list = self.voltha.get_devices()
1170 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1171
1172 onu_device_id = devices_list['items'][1]['id']
1173 assert_not_equal(device_id, None)
1174 voltha = VolthaCtrl(self.VOLTHA_HOST,
1175 rest_port = self.VOLTHA_REST_PORT,
1176 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1177 time.sleep(10)
1178 switch_map = None
1179 olt_configured = False
1180 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1181 log_test.info('Installing OLT app')
1182 OnosCtrl.install_app(self.olt_app_file)
1183 time.sleep(5)
1184 log_test.info('Adding subscribers through OLT app')
1185 self.config_olt(switch_map)
1186 olt_configured = True
1187 time.sleep(5)
1188 devices_list = self.voltha.get_devices()
1189 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1190 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
1191 thread1.start()
1192 time.sleep(randint(1,2))
1193 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1194 thread2.start()
1195 time.sleep(10)
1196 thread1.join()
1197 thread2.join()
1198 try:
1199 # assert_equal(status, True)
1200 assert_equal(self.success, True)
1201 time.sleep(10)
1202 finally:
1203 self.voltha.disable_device(device_id, delete = True)
1204 df.callback(0)
1205 reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df)
1206 return df
1207
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001208 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001209 def test_two_subscribers_with_voltha_for_eap_tls_authentication_initiating_invalid_tls_packets_for_one_subscriber(self):
1210 """
1211 Test Method:
1212 0. Make sure that voltha is up and running on CORD-POD setup.
1213 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1214 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1215 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1216 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
1217 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
1218 6. Verify that valid subscriber authenticated successfully.
1219 7. Verify that invalid subscriber are not authenticated successfully.
1220 """
1221
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001222 df = defer.Deferred()
1223 def tls_flow_check_on_two_subscriber_same_olt_device(df):
1224 aaa_app = ["org.opencord.aaa"]
1225 log_test.info('Enabling ponsim_olt')
1226 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1227 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1228 devices_list = self.voltha.get_devices()
1229 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1230
1231 onu_device_id = devices_list['items'][1]['id']
1232 assert_not_equal(device_id, None)
1233 voltha = VolthaCtrl(self.VOLTHA_HOST,
1234 rest_port = self.VOLTHA_REST_PORT,
1235 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1236 time.sleep(10)
1237 switch_map = None
1238 olt_configured = False
1239 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1240 log_test.info('Installing OLT app')
1241 OnosCtrl.install_app(self.olt_app_file)
1242 time.sleep(5)
1243 log_test.info('Adding subscribers through OLT app')
1244 self.config_olt(switch_map)
1245 olt_configured = True
1246 time.sleep(5)
1247 devices_list = self.voltha.get_devices()
1248 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1249 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
1250 thread1.start()
1251 time.sleep(randint(1,2))
1252 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1253 thread2.start()
1254 time.sleep(10)
1255 thread1.join()
1256 thread2.join()
1257 try:
1258 # assert_equal(status, True)
1259 assert_equal(self.success, True)
1260 time.sleep(10)
1261 finally:
1262 self.voltha.disable_device(device_id, delete = True)
1263 df.callback(0)
1264 reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df)
1265 return df
1266
1267 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001268 def test_two_subscribers_with_voltha_for_eap_tls_authentication_initiating_invalid_cert_for_one_subscriber(self):
1269 """
1270 Test Method:
1271 0. Make sure that voltha is up and running on CORD-POD setup.
1272 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1273 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1274 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1275 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
1276 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
1277 6. Verify that valid subscriber authenticated successfully.
1278 7. Verify that invalid subscriber are not authenticated successfully.
1279 """
1280
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001281 df = defer.Deferred()
1282 def tls_flow_check_on_two_subscriber_same_olt_device(df):
1283 aaa_app = ["org.opencord.aaa"]
1284 log_test.info('Enabling ponsim_olt')
1285 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1286 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1287 devices_list = self.voltha.get_devices()
1288 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1289
1290 onu_device_id = devices_list['items'][1]['id']
1291 assert_not_equal(device_id, None)
1292 voltha = VolthaCtrl(self.VOLTHA_HOST,
1293 rest_port = self.VOLTHA_REST_PORT,
1294 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1295 time.sleep(10)
1296 switch_map = None
1297 olt_configured = False
1298 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1299 log_test.info('Installing OLT app')
1300 OnosCtrl.install_app(self.olt_app_file)
1301 time.sleep(5)
1302 log_test.info('Adding subscribers through OLT app')
1303 self.config_olt(switch_map)
1304 olt_configured = True
1305 time.sleep(5)
1306 devices_list = self.voltha.get_devices()
1307 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1308 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
1309 thread1.start()
1310 time.sleep(randint(1,2))
1311 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1312 thread2.start()
1313 time.sleep(10)
1314 thread1.join()
1315 thread2.join()
1316 try:
1317 # assert_equal(status, True)
1318 assert_equal(self.success, True)
1319 time.sleep(10)
1320 finally:
1321 self.voltha.disable_device(device_id, delete = True)
1322 df.callback(0)
1323 reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df)
1324 return df
1325
1326 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001327 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
1328 """
1329 Test Method:
1330 0. Make sure that voltha is up and running on CORD-POD setup.
1331 1. OLT and ONU is detected and validated.
1332 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1333 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1334 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
1335 6. Verify that subscriber authenticated successfully.
1336 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
1337 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
1338 9. Verify that subscriber authentication is unsuccessful..
1339 10. Verify that other subscriber authenticated successfully.
1340 """
1341
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001342 df = defer.Deferred()
1343 def tls_flow_check_on_two_subscriber_same_olt_device(df):
1344 aaa_app = ["org.opencord.aaa"]
1345 log_test.info('Enabling ponsim_olt')
1346 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1347 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1348 devices_list = self.voltha.get_devices()
1349 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1350
1351 onu_device_id = devices_list['items'][1]['id']
1352 assert_not_equal(device_id, None)
1353 voltha = VolthaCtrl(self.VOLTHA_HOST,
1354 rest_port = self.VOLTHA_REST_PORT,
1355 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1356 time.sleep(10)
1357 switch_map = None
1358 olt_configured = False
1359 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1360 log_test.info('Installing OLT app')
1361 OnosCtrl.install_app(self.olt_app_file)
1362 time.sleep(5)
1363 log_test.info('Adding subscribers through OLT app')
1364 self.config_olt(switch_map)
1365 olt_configured = True
1366 time.sleep(5)
1367 devices_list = self.voltha.get_devices()
1368 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1369 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
1370 thread1.start()
1371 time.sleep(randint(1,2))
1372 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1373 thread2.start()
1374 time.sleep(10)
1375 thread1.join()
1376 thread2.join()
1377 try:
1378 # assert_equal(status, True)
1379 assert_equal(self.success, True)
1380 time.sleep(10)
1381 finally:
1382 self.voltha.disable_device(device_id, delete = True)
1383 df.callback(0)
1384 reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df)
1385 return df
1386
1387 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001388 def test_subscriber_with_voltha_for_dhcp_request(self):
1389 """
1390 Test Method:
1391 0. Make sure that voltha is up and running on CORD-POD setup.
1392 1. OLT and ONU is detected and validated.
1393 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1394 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
1395 4. Verify that subscriber get ip from dhcp server successfully.
1396 """
1397
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001398 df = defer.Deferred()
1399 def dhcp_flow_check_scenario(df):
1400 log_test.info('Enabling ponsim_olt')
1401 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1402 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1403 assert_not_equal(device_id, None)
1404 voltha = VolthaCtrl(self.VOLTHA_HOST,
1405 rest_port = self.VOLTHA_REST_PORT,
1406 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1407 time.sleep(10)
1408 switch_map = None
1409 olt_configured = False
1410 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1411 log_test.info('Installing OLT app')
1412 OnosCtrl.install_app(self.olt_app_file)
1413 time.sleep(5)
1414 log_test.info('Adding subscribers through OLT app')
1415 self.config_olt(switch_map)
1416 olt_configured = True
1417 time.sleep(5)
1418 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
1419 try:
1420 assert_equal(dhcp_status, True)
1421 #assert_equal(status, True)
1422 time.sleep(10)
1423 finally:
1424 self.remove_olt(switch_map)
1425 self.voltha.disable_device(device_id, delete = True)
1426 df.callback(0)
1427
1428 reactor.callLater(0, dhcp_flow_check_scenario, df)
1429 return df
1430
1431 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001432 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
1433 """
1434 Test Method:
1435 0. Make sure that voltha is up and running on CORD-POD setup.
1436 1. OLT and ONU is detected and validated.
1437 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1438 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
1439 4. Verify that subscriber should not get ip from dhcp server.
1440 """
1441
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001442 df = defer.Deferred()
1443 def dhcp_flow_check_scenario(df):
1444 log_test.info('Enabling ponsim_olt')
1445 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1446 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1447 assert_not_equal(device_id, None)
1448 voltha = VolthaCtrl(self.VOLTHA_HOST,
1449 rest_port = self.VOLTHA_REST_PORT,
1450 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1451 time.sleep(10)
1452 switch_map = None
1453 olt_configured = False
1454 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1455 log_test.info('Installing OLT app')
1456 OnosCtrl.install_app(self.olt_app_file)
1457 time.sleep(5)
1458 log_test.info('Adding subscribers through OLT app')
1459 self.config_olt(switch_map)
1460 olt_configured = True
1461 time.sleep(5)
1462 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
1463 try:
1464 assert_equal(dhcp_status, True)
1465 #assert_equal(status, True)
1466 time.sleep(10)
1467 finally:
1468 self.voltha.disable_device(device_id, delete = True)
1469 self.remove_olt(switch_map)
1470 df.callback(0)
1471
1472 reactor.callLater(0, dhcp_flow_check_scenario, df)
1473 return df
1474
1475
1476 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001477 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
1478 """
1479 Test Method:
1480 0. Make sure that voltha is up and running on CORD-POD setup.
1481 1. OLT and ONU is detected and validated.
1482 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1483 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
1484 4. Verify that subscriber should not get ip from dhcp server.
1485 """
1486
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001487 df = defer.Deferred()
1488 def dhcp_flow_check_scenario(df):
1489 log_test.info('Enabling ponsim_olt')
1490 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1491 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1492 assert_not_equal(device_id, None)
1493 voltha = VolthaCtrl(self.VOLTHA_HOST,
1494 rest_port = self.VOLTHA_REST_PORT,
1495 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1496 time.sleep(10)
1497 switch_map = None
1498 olt_configured = False
1499 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1500 log_test.info('Installing OLT app')
1501 OnosCtrl.install_app(self.olt_app_file)
1502 time.sleep(5)
1503 log_test.info('Adding subscribers through OLT app')
1504 self.config_olt(switch_map)
1505 olt_configured = True
1506 time.sleep(5)
1507 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
1508 try:
1509 assert_equal(dhcp_status, True)
1510 #assert_equal(status, True)
1511 time.sleep(10)
1512 finally:
1513 self.voltha.disable_device(device_id, delete = True)
1514 self.remove_olt(switch_map)
1515 df.callback(0)
1516
1517 reactor.callLater(0, dhcp_flow_check_scenario, df)
1518 return df
1519
1520 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001521 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
1522 """
1523 Test Method:
1524 0. Make sure that voltha is up and running on CORD-POD setup.
1525 1. OLT and ONU is detected and validated.
1526 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1527 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
1528 4. Verify that subscriber should not get ip from dhcp server.
1529 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001530 df = defer.Deferred()
1531 def dhcp_flow_check_scenario(df):
1532 log_test.info('Enabling ponsim_olt')
1533 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1534 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1535 assert_not_equal(device_id, None)
1536 voltha = VolthaCtrl(self.VOLTHA_HOST,
1537 rest_port = self.VOLTHA_REST_PORT,
1538 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1539 time.sleep(10)
1540 switch_map = None
1541 olt_configured = False
1542 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1543 log_test.info('Installing OLT app')
1544 OnosCtrl.install_app(self.olt_app_file)
1545 time.sleep(5)
1546 log_test.info('Adding subscribers through OLT app')
1547 self.config_olt(switch_map)
1548 olt_configured = True
1549 time.sleep(5)
1550 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
1551 try:
1552 assert_equal(dhcp_status, True)
1553 #assert_equal(status, True)
1554 time.sleep(10)
1555 finally:
1556 self.voltha.disable_device(device_id, delete = True)
1557 self.remove_olt(switch_map)
1558 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001559
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001560 reactor.callLater(0, dhcp_flow_check_scenario, df)
1561 return df
1562
1563 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001564 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
1565 """
1566 Test Method:
1567 0. Make sure that voltha is up and running on CORD-POD setup.
1568 1. OLT and ONU is detected and validated.
1569 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1570 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
1571 4. Verify that subscriber get ip from dhcp server successfully.
1572 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
1573 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
1574 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001575 df = defer.Deferred()
1576 def dhcp_flow_check_scenario(df):
1577 log_test.info('Enabling ponsim_olt')
1578 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1579 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1580 assert_not_equal(device_id, None)
1581 voltha = VolthaCtrl(self.VOLTHA_HOST,
1582 rest_port = self.VOLTHA_REST_PORT,
1583 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1584 time.sleep(10)
1585 switch_map = None
1586 olt_configured = False
1587 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1588 log_test.info('Installing OLT app')
1589 OnosCtrl.install_app(self.olt_app_file)
1590 time.sleep(5)
1591 log_test.info('Adding subscribers through OLT app')
1592 self.config_olt(switch_map)
1593 olt_configured = True
1594 time.sleep(5)
1595 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
1596 try:
1597 assert_equal(dhcp_status, True)
1598 #assert_equal(status, True)
1599 time.sleep(10)
1600 finally:
1601 self.voltha.disable_device(device_id, delete = True)
1602 self.remove_olt(switch_map)
1603 df.callback(0)
1604
1605 reactor.callLater(0, dhcp_flow_check_scenario, df)
1606 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001607
Thangavelu K S735a6662017-06-15 18:08:23 +00001608
1609 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07001610 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00001611 """
1612 Test Method:
1613 0. Make sure that voltha is up and running on CORD-POD setup.
1614 1. OLT and ONU is detected and validated.
1615 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1616 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1617 4. Verify that subscriber get ip from dhcp server successfully.
1618 5. Repeat step 3 and 4 for 10 times.
1619 6 Verify that subscriber should get ip from dhcp server.
1620 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001621 df = defer.Deferred()
1622 def dhcp_flow_check_scenario(df):
1623 log_test.info('Enabling ponsim_olt')
1624 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1625 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1626 assert_not_equal(device_id, None)
1627 voltha = VolthaCtrl(self.VOLTHA_HOST,
1628 rest_port = self.VOLTHA_REST_PORT,
1629 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1630 time.sleep(10)
1631 switch_map = None
1632 olt_configured = False
1633 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1634 log_test.info('Installing OLT app')
1635 OnosCtrl.install_app(self.olt_app_file)
1636 time.sleep(5)
1637 log_test.info('Adding subscribers through OLT app')
1638 self.config_olt(switch_map)
1639 olt_configured = True
1640 time.sleep(5)
1641 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
1642 try:
1643 assert_equal(dhcp_status, True)
1644 #assert_equal(status, True)
1645 time.sleep(10)
1646 finally:
1647 self.voltha.disable_device(device_id, delete = True)
1648 self.remove_olt(switch_map)
1649 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001650
Thangavelu K S735a6662017-06-15 18:08:23 +00001651 reactor.callLater(0, dhcp_flow_check_scenario, df)
1652 return df
1653
1654
1655
1656 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001657 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
1658 """
1659 Test Method:
1660 0. Make sure that voltha is up and running on CORD-POD setup.
1661 1. OLT and ONU is detected and validated.
1662 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1663 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
1664 4. Verify that subscriber should not get ip from dhcp server.
1665 5. Repeat steps 3 and 4 for 10 times.
1666 6 Verify that subscriber should not get ip from dhcp server.
1667 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001668 df = defer.Deferred()
1669 def dhcp_flow_check_scenario(df):
1670 log_test.info('Enabling ponsim_olt')
1671 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1672 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1673 assert_not_equal(device_id, None)
1674 voltha = VolthaCtrl(self.VOLTHA_HOST,
1675 rest_port = self.VOLTHA_REST_PORT,
1676 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1677 time.sleep(10)
1678 switch_map = None
1679 olt_configured = False
1680 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1681 log_test.info('Installing OLT app')
1682 OnosCtrl.install_app(self.olt_app_file)
1683 time.sleep(5)
1684 log_test.info('Adding subscribers through OLT app')
1685 self.config_olt(switch_map)
1686 olt_configured = True
1687 time.sleep(5)
1688 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
1689 try:
1690 assert_equal(dhcp_status, True)
1691 #assert_equal(status, True)
1692 time.sleep(10)
1693 finally:
1694 self.voltha.disable_device(device_id, delete = True)
1695 self.remove_olt(switch_map)
1696 df.callback(0)
1697
1698 reactor.callLater(0, dhcp_flow_check_scenario, df)
1699 return df
1700
1701
1702 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001703 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
1704 """
1705 Test Method:
1706 0. Make sure that voltha is up and running on CORD-POD setup.
1707 1. OLT and ONU is detected and validated.
1708 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1709 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1710 4. Verify that subscriber get ip from dhcp server successfully.
1711 5. Repeat step 3 for 50 times.
1712 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
1713 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001714 df = defer.Deferred()
1715 def dhcp_flow_check_scenario(df):
1716 log_test.info('Enabling ponsim_olt')
1717 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1718 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1719 assert_not_equal(device_id, None)
1720 voltha = VolthaCtrl(self.VOLTHA_HOST,
1721 rest_port = self.VOLTHA_REST_PORT,
1722 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1723 time.sleep(10)
1724 switch_map = None
1725 olt_configured = False
1726 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1727 log_test.info('Installing OLT app')
1728 OnosCtrl.install_app(self.olt_app_file)
1729 time.sleep(5)
1730 log_test.info('Adding subscribers through OLT app')
1731 self.config_olt(switch_map)
1732 olt_configured = True
1733 time.sleep(5)
1734 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
1735 try:
1736 assert_equal(dhcp_status, True)
1737 #assert_equal(status, True)
1738 time.sleep(10)
1739 finally:
1740 self.voltha.disable_device(device_id, delete = True)
1741 self.remove_olt(switch_map)
1742 df.callback(0)
1743
1744 reactor.callLater(0, dhcp_flow_check_scenario, df)
1745 return df
1746
1747
1748
1749 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001750 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(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 subscriber to dhcp server which is running as onos app.
1757 4. Verify that subscriber get ip from dhcp server successfully.
1758 5. Send DHCP request to dhcp server which is running as onos app.
1759 6. Repeat step 5 for 50 times.
1760 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
1761 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001762 df = defer.Deferred()
1763 def dhcp_flow_check_scenario(df):
1764 log_test.info('Enabling ponsim_olt')
1765 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1766 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1767 assert_not_equal(device_id, None)
1768 voltha = VolthaCtrl(self.VOLTHA_HOST,
1769 rest_port = self.VOLTHA_REST_PORT,
1770 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1771 time.sleep(10)
1772 switch_map = None
1773 olt_configured = False
1774 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1775 log_test.info('Installing OLT app')
1776 OnosCtrl.install_app(self.olt_app_file)
1777 time.sleep(5)
1778 log_test.info('Adding subscribers through OLT app')
1779 self.config_olt(switch_map)
1780 olt_configured = True
1781 time.sleep(5)
1782 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
1783 try:
1784 assert_equal(dhcp_status, True)
1785 #assert_equal(status, True)
1786 time.sleep(10)
1787 finally:
1788 self.voltha.disable_device(device_id, delete = True)
1789 self.remove_olt(switch_map)
1790 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001791
Thangavelu K S735a6662017-06-15 18:08:23 +00001792 reactor.callLater(0, dhcp_flow_check_scenario, df)
1793 return df
1794
1795
1796 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001797 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
1798 """
1799 Test Method:
1800 0. Make sure that voltha is up and running on CORD-POD setup.
1801 1. OLT and ONU is detected and validated.
1802 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1803 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
1804 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
1805 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001806 df = defer.Deferred()
1807 def dhcp_flow_check_scenario(df):
1808 log_test.info('Enabling ponsim_olt')
1809 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1810 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1811 assert_not_equal(device_id, None)
1812 voltha = VolthaCtrl(self.VOLTHA_HOST,
1813 rest_port = self.VOLTHA_REST_PORT,
1814 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1815 time.sleep(10)
1816 switch_map = None
1817 olt_configured = False
1818 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1819 log_test.info('Installing OLT app')
1820 OnosCtrl.install_app(self.olt_app_file)
1821 time.sleep(5)
1822 log_test.info('Adding subscribers through OLT app')
1823 self.config_olt(switch_map)
1824 olt_configured = True
1825 time.sleep(5)
1826 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
1827 try:
1828 assert_equal(dhcp_status, True)
1829 #assert_equal(status, True)
1830 time.sleep(10)
1831 finally:
1832 self.voltha.disable_device(device_id, delete = True)
1833 self.remove_olt(switch_map)
1834 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001835
Thangavelu K S735a6662017-06-15 18:08:23 +00001836 reactor.callLater(0, dhcp_flow_check_scenario, df)
1837 return df
1838
1839 @deferred(TESTCASE_TIMEOUT)
1840 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00001841 """
1842 Test Method:
1843 0. Make sure that voltha is up and running on CORD-POD setup.
1844 1. OLT and ONU is detected and validated.
1845 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1846 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
1847 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.
1848 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001849 df = defer.Deferred()
1850 def dhcp_flow_check_scenario(df):
1851 log_test.info('Enabling ponsim_olt')
1852 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1853 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1854 assert_not_equal(device_id, None)
1855 voltha = VolthaCtrl(self.VOLTHA_HOST,
1856 rest_port = self.VOLTHA_REST_PORT,
1857 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1858 time.sleep(10)
1859 switch_map = None
1860 olt_configured = False
1861 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1862 log_test.info('Installing OLT app')
1863 OnosCtrl.install_app(self.olt_app_file)
1864 time.sleep(5)
1865 log_test.info('Adding subscribers through OLT app')
1866 self.config_olt(switch_map)
1867 olt_configured = True
1868 time.sleep(5)
1869 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
1870 try:
1871 assert_equal(dhcp_status, True)
1872 #assert_equal(status, True)
1873 time.sleep(10)
1874 finally:
1875 self.voltha.disable_device(device_id, delete = True)
1876 self.remove_olt(switch_map)
1877 df.callback(0)
1878
1879 reactor.callLater(0, dhcp_flow_check_scenario, df)
1880 return df
1881
1882
1883 @deferred(TESTCASE_TIMEOUT)
1884 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00001885 """
1886 Test Method:
1887 0. Make sure that voltha is up and running on CORD-POD setup.
1888 1. OLT and ONU is detected and validated.
1889 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1890 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1891 4. Verify that subscriber get ip from dhcp server successfully.
1892 5. Deactivate dhcp server app in onos.
1893 6. Repeat step 3.
1894 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
1895 """
Thangavelu K S735a6662017-06-15 18:08:23 +00001896 df = defer.Deferred()
1897 dhcp_app = 'org.onosproject.dhcp'
1898 def dhcp_flow_check_scenario(df):
1899 log_test.info('Enabling ponsim_olt')
1900 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1901 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1902 assert_not_equal(device_id, None)
1903 voltha = VolthaCtrl(self.VOLTHA_HOST,
1904 rest_port = self.VOLTHA_REST_PORT,
1905 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1906 time.sleep(10)
1907 switch_map = None
1908 olt_configured = False
1909 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1910 log_test.info('Installing OLT app')
1911 OnosCtrl.install_app(self.olt_app_file)
1912 time.sleep(5)
1913 log_test.info('Adding subscribers through OLT app')
1914 self.config_olt(switch_map)
1915 olt_configured = True
1916 time.sleep(5)
1917# dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
1918 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "app_deactivation",))
1919 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
1920 log_test.info('Restart dhcp app in onos during client send discover to voltha')
1921 thread2.start()
1922 time.sleep(randint(0,1))
1923 thread1.start()
1924 time.sleep(10)
1925 thread1.join()
1926 thread2.join()
1927 try:
1928 assert_equal(self.success, True)
1929 #assert_equal(status, True)
1930 time.sleep(10)
1931 finally:
1932 self.voltha.disable_device(device_id, delete = True)
1933 self.remove_olt(switch_map)
1934 df.callback(0)
1935
1936 reactor.callLater(0, dhcp_flow_check_scenario, df)
1937 return df
1938
1939 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001940 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
1941 """
1942 Test Method:
1943 0. Make sure that voltha is up and running on CORD-POD setup.
1944 1. OLT and ONU is detected and validated.
1945 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1946 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1947 4. Verify that subscriber get ip from dhcp server successfully.
1948 5. Send dhcp renew packet to dhcp server which is running as onos app.
1949 6. Repeat step 4.
1950 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001951 df = defer.Deferred()
1952 def dhcp_flow_check_scenario(df):
1953 log_test.info('Enabling ponsim_olt')
1954 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1955 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1956 assert_not_equal(device_id, None)
1957 voltha = VolthaCtrl(self.VOLTHA_HOST,
1958 rest_port = self.VOLTHA_REST_PORT,
1959 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1960 time.sleep(10)
1961 switch_map = None
1962 olt_configured = False
1963 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1964 log_test.info('Installing OLT app')
1965 OnosCtrl.install_app(self.olt_app_file)
1966 time.sleep(5)
1967 log_test.info('Adding subscribers through OLT app')
1968 self.config_olt(switch_map)
1969 olt_configured = True
1970 time.sleep(5)
1971 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
1972 try:
1973 assert_equal(dhcp_status, True)
1974 #assert_equal(status, True)
1975 time.sleep(10)
1976 finally:
1977 self.voltha.disable_device(device_id, delete = True)
1978 self.remove_olt(switch_map)
1979 df.callback(0)
1980
1981 reactor.callLater(0, dhcp_flow_check_scenario, df)
1982 return df
1983
1984 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00001985 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
1986 """
1987 Test Method:
1988 0. Make sure that voltha is up and running on CORD-POD setup.
1989 1. OLT and ONU is detected and validated.
1990 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1991 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
1992 4. Verify that subscriber get ip from dhcp server successfully.
1993 5. Send dhcp rebind packet to dhcp server which is running as onos app.
1994 6. Repeat step 4.
1995 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001996 df = defer.Deferred()
1997 def dhcp_flow_check_scenario(df):
1998 log_test.info('Enabling ponsim_olt')
1999 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2000 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2001 assert_not_equal(device_id, None)
2002 voltha = VolthaCtrl(self.VOLTHA_HOST,
2003 rest_port = self.VOLTHA_REST_PORT,
2004 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2005 time.sleep(10)
2006 switch_map = None
2007 olt_configured = False
2008 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2009 log_test.info('Installing OLT app')
2010 OnosCtrl.install_app(self.olt_app_file)
2011 time.sleep(5)
2012 log_test.info('Adding subscribers through OLT app')
2013 self.config_olt(switch_map)
2014 olt_configured = True
2015 time.sleep(5)
2016 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
2017 try:
2018 assert_equal(dhcp_status, True)
2019 #assert_equal(status, True)
2020 time.sleep(10)
2021 finally:
2022 self.voltha.disable_device(device_id, delete = True)
2023 self.remove_olt(switch_map)
2024 df.callback(0)
2025
2026 reactor.callLater(0, dhcp_flow_check_scenario, df)
2027 return df
2028
2029
2030
2031
2032 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002033 def test_subscriber_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002034 """
2035 Test Method:
2036 0. Make sure that voltha is up and running on CORD-POD setup.
2037 1. OLT and ONU is detected and validated.
2038 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2039 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2040 4. Verify that subscriber get ip from dhcp server successfully.
2041 5. Disable olt devices which is being detected in voltha CLI.
2042 6. Repeat step 3.
2043 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2044 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002045 df = defer.Deferred()
2046 dhcp_app = 'org.onosproject.dhcp'
2047 def dhcp_flow_check_scenario(df):
2048 log_test.info('Enabling ponsim_olt')
2049 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2050 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2051 assert_not_equal(device_id, None)
2052 voltha = VolthaCtrl(self.VOLTHA_HOST,
2053 rest_port = self.VOLTHA_REST_PORT,
2054 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2055 time.sleep(10)
2056 switch_map = None
2057 olt_configured = False
2058 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2059 log_test.info('Installing OLT app')
2060 OnosCtrl.install_app(self.olt_app_file)
2061 time.sleep(5)
2062 log_test.info('Adding subscribers through OLT app')
2063 self.config_olt(switch_map)
2064 olt_configured = True
2065 time.sleep(5)
2066 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2067 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
2068 log_test.info('Disable the olt device in during client send discover to voltha')
2069 thread2.start()
2070# time.sleep(randint(0,1))
2071 thread1.start()
2072 time.sleep(10)
2073 thread1.join()
2074 thread2.join()
2075 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00002076 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002077 #assert_equal(status, True)
2078 time.sleep(10)
2079 finally:
2080 self.voltha.disable_device(device_id, delete = True)
2081 self.remove_olt(switch_map)
2082 df.callback(0)
2083
2084 reactor.callLater(0, dhcp_flow_check_scenario, df)
2085 return df
2086
2087
2088 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002089 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002090 """
2091 Test Method:
2092 0. Make sure that voltha is up and running on CORD-POD setup.
2093 1. OLT and ONU is detected and validated.
2094 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2095 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2096 4. Verify that subscriber get ip from dhcp server successfully.
2097 5. Disable olt devices which is being detected in voltha CLI.
2098 6. Repeat step 3.
2099 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2100 8. Enable olt devices which is being detected in voltha CLI.
2101 9. Repeat steps 3 and 4.
2102 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002103 df = defer.Deferred()
2104 dhcp_app = 'org.onosproject.dhcp'
2105 def dhcp_flow_check_scenario(df):
2106 log_test.info('Enabling ponsim_olt')
2107 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2108 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2109 assert_not_equal(device_id, None)
2110 voltha = VolthaCtrl(self.VOLTHA_HOST,
2111 rest_port = self.VOLTHA_REST_PORT,
2112 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2113 time.sleep(10)
2114 switch_map = None
2115 olt_configured = False
2116 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2117 log_test.info('Installing OLT app')
2118 OnosCtrl.install_app(self.olt_app_file)
2119 time.sleep(5)
2120 log_test.info('Adding subscribers through OLT app')
2121 self.config_olt(switch_map)
2122 olt_configured = True
2123 time.sleep(5)
2124 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2125 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2126 thread2.start()
2127 thread1.start()
2128 time.sleep(10)
2129 thread1.join()
2130 thread2.join()
2131 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00002132 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002133 #assert_equal(status, True)
2134 time.sleep(10)
2135 finally:
2136 self.voltha.disable_device(device_id, delete = True)
2137 self.remove_olt(switch_map)
2138 df.callback(0)
2139
2140 reactor.callLater(0, dhcp_flow_check_scenario, df)
2141 return df
2142
2143
2144 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002145 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002146 """
2147 Test Method:
2148 0. Make sure that voltha is up and running on CORD-POD setup.
2149 1. OLT and ONU is detected and validated.
2150 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2151 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2152 4. Verify that subscriber get ip from dhcp server successfully.
2153 5. Disable onu port which is being detected in voltha CLI.
2154 6. Repeat step 3.
2155 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2156 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002157 df = defer.Deferred()
2158 dhcp_app = 'org.onosproject.dhcp'
2159 def dhcp_flow_check_scenario(df):
2160 log_test.info('Enabling ponsim_olt')
2161 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2162 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2163 assert_not_equal(device_id, None)
2164 voltha = VolthaCtrl(self.VOLTHA_HOST,
2165 rest_port = self.VOLTHA_REST_PORT,
2166 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2167 time.sleep(10)
2168 switch_map = None
2169 olt_configured = False
2170 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2171 log_test.info('Installing OLT app')
2172 OnosCtrl.install_app(self.olt_app_file)
2173 time.sleep(5)
2174 log_test.info('Adding subscribers through OLT app')
2175 self.config_olt(switch_map)
2176 olt_configured = True
2177 time.sleep(5)
2178 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2179 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
2180 thread1.start()
2181 thread2.start()
2182 time.sleep(10)
2183 thread1.join()
2184 thread2.join()
2185 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00002186 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002187 #assert_equal(status, True)
2188 time.sleep(10)
2189 finally:
2190 self.voltha.disable_device(device_id, delete = True)
2191 self.remove_olt(switch_map)
2192 df.callback(0)
2193
2194 reactor.callLater(0, dhcp_flow_check_scenario, df)
2195 return df
2196
2197
2198 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002199 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002200 """
2201 Test Method:
2202 0. Make sure that voltha is up and running on CORD-POD setup.
2203 1. OLT and ONU is detected and validated.
2204 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2205 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2206 4. Verify that subscriber get ip from dhcp server successfully.
2207 5. Disable onu port which is being detected in voltha CLI.
2208 6. Repeat step 3.
2209 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2210 8. Enable onu port which is being detected in voltha CLI.
2211 9. Repeat steps 3 and 4.
2212 """
2213
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002214 df = defer.Deferred()
2215 dhcp_app = 'org.onosproject.dhcp'
2216 def dhcp_flow_check_scenario(df):
2217 log_test.info('Enabling ponsim_olt')
2218 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2219 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2220 assert_not_equal(device_id, None)
2221 voltha = VolthaCtrl(self.VOLTHA_HOST,
2222 rest_port = self.VOLTHA_REST_PORT,
2223 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2224 time.sleep(10)
2225 switch_map = None
2226 olt_configured = False
2227 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2228 log_test.info('Installing OLT app')
2229 OnosCtrl.install_app(self.olt_app_file)
2230 time.sleep(5)
2231 log_test.info('Adding subscribers through OLT app')
2232 self.config_olt(switch_map)
2233 olt_configured = True
2234 time.sleep(5)
2235 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2236 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
2237 log_test.info('Restart dhcp app in onos during client send discover to voltha')
2238 thread2.start()
2239 time.sleep(randint(0,1))
2240 thread1.start()
2241 time.sleep(10)
2242 thread1.join()
2243 thread2.join()
2244 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2245 assert_equal(dhcp_status, True)
2246 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00002247 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002248 #assert_equal(status, True)
2249 time.sleep(10)
2250 finally:
2251 self.voltha.disable_device(device_id, delete = True)
2252 self.remove_olt(switch_map)
2253 df.callback(0)
2254
2255 reactor.callLater(0, dhcp_flow_check_scenario, df)
2256 return df
2257
2258
2259 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002260 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002261 """
2262 Test Method:
2263 0. Make sure that voltha is up and running on CORD-POD setup.
2264 1. OLT and ONU is detected and validated.
2265 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2266 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2267 4. Verify that subscribers had got different ips from dhcp server successfully.
2268 """
2269
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002270 df = defer.Deferred()
2271 self.success = True
2272 dhcp_app = 'org.onosproject.dhcp'
2273 def dhcp_flow_check_scenario(df):
2274 log_test.info('Enabling ponsim_olt')
2275 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2276 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2277 assert_not_equal(device_id, None)
2278 voltha = VolthaCtrl(self.VOLTHA_HOST,
2279 rest_port = self.VOLTHA_REST_PORT,
2280 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2281 time.sleep(10)
2282 switch_map = None
2283 olt_configured = False
2284 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2285 log_test.info('Installing OLT app')
2286 OnosCtrl.install_app(self.olt_app_file)
2287 time.sleep(5)
2288 log_test.info('Adding subscribers through OLT app')
2289 self.config_olt(switch_map)
2290 olt_configured = True
2291 time.sleep(5)
2292 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
2293 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2294 thread1.start()
2295 thread2.start()
2296 time.sleep(10)
2297 thread1.join()
2298 thread2.join()
2299
2300 log_test.info('Adding subscribers through OLT app THANGAV SUCCESS = %s'%self.success)
2301 dhcp_flow_status = self.success
2302 try:
2303# if self.success is not True:
2304 assert_equal(dhcp_flow_status, True)
2305 #assert_equal(status, True)
2306 time.sleep(10)
2307 finally:
2308 self.voltha.disable_device(device_id, delete = True)
2309 self.remove_olt(switch_map)
2310 df.callback(0)
2311
2312 reactor.callLater(0, dhcp_flow_check_scenario, df)
2313 return df
2314
2315 @deferred(TESTCASE_TIMEOUT)
2316 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover_messages(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002317 """
2318 Test Method:
2319 0. Make sure that voltha is up and running on CORD-POD setup.
2320 1. OLT and ONU is detected and validated.
2321 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2322 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2323 4. Verify that subscribers had got ip from dhcp server successfully.
2324 5. Repeat step 3 and 4 for 10 times for both subscribers.
2325 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
2326 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002327 df = defer.Deferred()
2328 self.success = True
2329 dhcp_app = 'org.onosproject.dhcp'
2330 def dhcp_flow_check_scenario(df):
2331 log_test.info('Enabling ponsim_olt')
2332 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2333 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2334 assert_not_equal(device_id, None)
2335 voltha = VolthaCtrl(self.VOLTHA_HOST,
2336 rest_port = self.VOLTHA_REST_PORT,
2337 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2338 time.sleep(10)
2339 switch_map = None
2340 olt_configured = False
2341 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2342 log_test.info('Installing OLT app')
2343 OnosCtrl.install_app(self.olt_app_file)
2344 time.sleep(5)
2345 log_test.info('Adding subscribers through OLT app')
2346 self.config_olt(switch_map)
2347 olt_configured = True
2348 time.sleep(5)
2349 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
2350 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
2351 thread1.start()
2352 thread2.start()
2353 time.sleep(10)
2354 thread1.join()
2355 thread2.join()
2356
2357 log_test.info('Adding subscribers through OLT app THANGAV SUCCESS = %s'%self.success)
2358 dhcp_flow_status = self.success
2359 try:
2360# if self.success is not True:
2361 assert_equal(dhcp_flow_status, True)
2362 #assert_equal(status, True)
2363 time.sleep(10)
2364 finally:
2365 self.voltha.disable_device(device_id, delete = True)
2366 self.remove_olt(switch_map)
2367 df.callback(0)
2368
2369 reactor.callLater(0, dhcp_flow_check_scenario, df)
2370 return df
2371
2372 @deferred(TESTCASE_TIMEOUT)
2373 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover_messages_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002374 """
2375 Test Method:
2376 0. Make sure that voltha is up and running on CORD-POD setup.
2377 1. OLT and ONU is detected and validated.
2378 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2379 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2380 4. Verify that subscribers had got ip from dhcp server successfully.
2381 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
2382 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
2383 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002384
2385 df = defer.Deferred()
2386 self.success = True
2387 dhcp_app = 'org.onosproject.dhcp'
2388 def dhcp_flow_check_scenario(df):
2389 log_test.info('Enabling ponsim_olt')
2390 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2391 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2392 assert_not_equal(device_id, None)
2393 voltha = VolthaCtrl(self.VOLTHA_HOST,
2394 rest_port = self.VOLTHA_REST_PORT,
2395 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2396 time.sleep(10)
2397 switch_map = None
2398 olt_configured = False
2399 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2400 log_test.info('Installing OLT app')
2401 OnosCtrl.install_app(self.olt_app_file)
2402 time.sleep(5)
2403 log_test.info('Adding subscribers through OLT app')
2404 self.config_olt(switch_map)
2405 olt_configured = True
2406 time.sleep(5)
2407 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
2408 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2409 thread1.start()
2410 thread2.start()
2411 time.sleep(10)
2412 thread1.join()
2413 thread2.join()
2414
2415 log_test.info('Adding subscribers through OLT app THANGAV SUCCESS = %s'%self.success)
2416 dhcp_flow_status = self.success
2417 try:
2418# if self.success is not True:
2419 assert_equal(dhcp_flow_status, True)
2420 #assert_equal(status, True)
2421 time.sleep(10)
2422 finally:
2423 self.voltha.disable_device(device_id, delete = True)
2424 self.remove_olt(switch_map)
2425 df.callback(0)
2426
2427 reactor.callLater(0, dhcp_flow_check_scenario, df)
2428 return df
2429
2430 @deferred(TESTCASE_TIMEOUT)
2431 def test_two_subscribers_with_voltha_for_dhcp_discover_message_with_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002432 """
2433 Test Method:
2434 0. Make sure that voltha is up and running on CORD-POD setup.
2435 1. OLT and ONU is detected and validated.
2436 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2437 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
2438 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
2439 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
2440 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002441
2442 df = defer.Deferred()
2443 self.success = True
2444 dhcp_app = 'org.onosproject.dhcp'
2445 def dhcp_flow_check_scenario(df):
2446 log_test.info('Enabling ponsim_olt')
2447 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2448 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2449 assert_not_equal(device_id, None)
2450 voltha = VolthaCtrl(self.VOLTHA_HOST,
2451 rest_port = self.VOLTHA_REST_PORT,
2452 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2453 time.sleep(10)
2454 switch_map = None
2455 olt_configured = False
2456 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2457 log_test.info('Installing OLT app')
2458 OnosCtrl.install_app(self.olt_app_file)
2459 time.sleep(5)
2460 log_test.info('Adding subscribers through OLT app')
2461 self.config_olt(switch_map)
2462 olt_configured = True
2463 time.sleep(5)
2464 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
2465 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
2466 thread1.start()
2467 thread2.start()
2468 time.sleep(10)
2469 thread1.join()
2470 thread2.join()
2471 log_test.info('Adding subscribers through OLT app THANGAV SUCCESS = %s'%self.success)
2472 dhcp_flow_status = self.success
2473 try:
2474# if self.success is not True:
2475 assert_equal(dhcp_flow_status, True)
2476 #assert_equal(status, True)
2477 time.sleep(10)
2478 finally:
2479 self.voltha.disable_device(device_id, delete = True)
2480 self.remove_olt(switch_map)
2481 df.callback(0)
2482
2483 reactor.callLater(0, dhcp_flow_check_scenario, df)
2484 return df
2485
2486 @deferred(TESTCASE_TIMEOUT)
2487 def test_two_subscribers_with_voltha_for_dhcp_discover_with_and_without_dhcp_pool_ip_addresses(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002488 """
2489 Test Method:
2490 0. Make sure that voltha is up and running on CORD-POD setup.
2491 1. OLT and ONU is detected and validated.
2492 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2493 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
2494 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
2495 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
2496 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002497 df = defer.Deferred()
2498 self.success = True
2499 dhcp_app = 'org.onosproject.dhcp'
2500 def dhcp_flow_check_scenario(df):
2501 log_test.info('Enabling ponsim_olt')
2502 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2503 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2504 assert_not_equal(device_id, None)
2505 voltha = VolthaCtrl(self.VOLTHA_HOST,
2506 rest_port = self.VOLTHA_REST_PORT,
2507 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2508 time.sleep(10)
2509 switch_map = None
2510 olt_configured = False
2511 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2512 log_test.info('Installing OLT app')
2513 OnosCtrl.install_app(self.olt_app_file)
2514 time.sleep(5)
2515 log_test.info('Adding subscribers through OLT app')
2516 self.config_olt(switch_map)
2517 olt_configured = True
2518 time.sleep(5)
2519 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
2520 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
2521 thread1.start()
2522 thread2.start()
2523 time.sleep(10)
2524 thread1.join()
2525 thread2.join()
2526 log_test.info('Adding subscribers through OLT app THANGAV SUCCESS = %s'%self.success)
2527 dhcp_flow_status = self.success
2528 try:
2529# if self.success is not True:
2530 assert_equal(dhcp_flow_status, True)
2531 #assert_equal(status, True)
2532 time.sleep(10)
2533 finally:
2534 self.voltha.disable_device(device_id, delete = True)
2535 self.remove_olt(switch_map)
2536 df.callback(0)
2537
2538 reactor.callLater(0, dhcp_flow_check_scenario, df)
2539 return df
2540
2541 @deferred(TESTCASE_TIMEOUT)
2542 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002543 """
2544 Test Method:
2545 0. Make sure that voltha is up and running on CORD-POD setup.
2546 1. OLT and ONU is detected and validated.
2547 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2548 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2549 4. Verify that subscribers had got ip from dhcp server successfully.
2550 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
2551 6. Repeat step 3 and 4 for one subscriber where uni port is down.
2552 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
2553 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002554 df = defer.Deferred()
2555 self.success = True
2556 dhcp_app = 'org.onosproject.dhcp'
2557 def dhcp_flow_check_scenario(df):
2558 log_test.info('Enabling ponsim_olt')
2559 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2560 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2561 assert_not_equal(device_id, None)
2562 voltha = VolthaCtrl(self.VOLTHA_HOST,
2563 rest_port = self.VOLTHA_REST_PORT,
2564 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2565 time.sleep(10)
2566 switch_map = None
2567 olt_configured = False
2568 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2569 log_test.info('Installing OLT app')
2570 OnosCtrl.install_app(self.olt_app_file)
2571 time.sleep(5)
2572 log_test.info('Adding subscribers through OLT app')
2573 self.config_olt(switch_map)
2574 olt_configured = True
2575 time.sleep(5)
2576 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
2577 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
2578 thread1.start()
2579 thread2.start()
2580 time.sleep(10)
2581 thread1.join()
2582 thread2.join()
2583 log_test.info('Adding subscribers through OLT app THANGAV SUCCESS = %s'%self.success)
2584 dhcp_flow_status = self.success
2585 try:
2586# if self.success is not True:
2587 assert_equal(dhcp_flow_status, True)
2588 #assert_equal(status, True)
2589 time.sleep(10)
2590 finally:
2591 self.voltha.disable_device(device_id, delete = True)
2592 self.remove_olt(switch_map)
2593 df.callback(0)
2594
2595 reactor.callLater(0, dhcp_flow_check_scenario, df)
2596 return df
2597
2598
2599
2600 @deferred(TESTCASE_TIMEOUT)
2601 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002602 """
2603 Test Method:
2604 0. Make sure that voltha is up and running on CORD-POD setup.
2605 1. OLT and ONU is detected and validated.
2606 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2607 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2608 4. Verify that subscribers had got ip from dhcp server successfully.
2609 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
2610 6. Repeat step 3 and 4 for one subscriber where uni port is down.
2611 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
2612 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
2613 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
2614 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
2615 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002616 df = defer.Deferred()
2617 self.success = True
2618 dhcp_app = 'org.onosproject.dhcp'
2619 def dhcp_flow_check_scenario(df):
2620 log_test.info('Enabling ponsim_olt')
2621 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2622 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2623 assert_not_equal(device_id, None)
2624 voltha = VolthaCtrl(self.VOLTHA_HOST,
2625 rest_port = self.VOLTHA_REST_PORT,
2626 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2627 time.sleep(10)
2628 switch_map = None
2629 olt_configured = False
2630 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2631 log_test.info('Installing OLT app')
2632 OnosCtrl.install_app(self.olt_app_file)
2633 time.sleep(5)
2634 log_test.info('Adding subscribers through OLT app')
2635 self.config_olt(switch_map)
2636 olt_configured = True
2637 time.sleep(5)
2638 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
2639 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2640 thread3 = threading.Thread(target = self.voltha_uni_port_down_up, args = (self.INTF_2_RX_DEFAULT,))
2641 thread1.start()
2642 thread2.start()
2643 thread3.start()
2644 time.sleep(10)
2645 thread1.join()
2646 thread2.join()
2647 thread3.join()
2648 log_test.info('Adding subscribers through OLT app THANGAV SUCCESS = %s'%self.success)
2649 dhcp_flow_status = self.success
2650 try:
2651# if self.success is not True:
2652 assert_equal(dhcp_flow_status, True)
2653 #assert_equal(status, True)
2654 time.sleep(10)
2655 finally:
2656 self.voltha.disable_device(device_id, delete = True)
2657 self.remove_olt(switch_map)
2658 df.callback(0)
2659
2660 reactor.callLater(0, dhcp_flow_check_scenario, df)
2661 return df
2662
2663
2664 @deferred(TESTCASE_TIMEOUT)
2665 def test_two_subscribers_with_voltha_for_dhcp_disable_olt_detected_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002666 """
2667 Test Method:
2668 0. Make sure that voltha is up and running on CORD-POD setup.
2669 1. OLT and ONU is detected and validated.
2670 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2671 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2672 4. Verify that subscribers had got ip from dhcp server successfully.
2673 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
2674 6. Disable the olt device which is detected in voltha.
2675 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
2676 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002677 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt_detected_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002678 """
2679 Test Method:
2680 0. Make sure that voltha is up and running on CORD-POD setup.
2681 1. OLT and ONU is detected and validated.
2682 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2683 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2684 4. Verify that subscribers had got ip from dhcp server successfully.
2685 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
2686 6. Disable the olt device which is detected in voltha.
2687 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
2688 8. Enable the olt device which is detected in voltha.
2689 9. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
2690 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002691 def test_two_subscribers_with_voltha_for_dhcp_pause_olt_detected_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002692 """
2693 Test Method:
2694 0. Make sure that voltha is up and running on CORD-POD setup.
2695 1. OLT and ONU is detected and validated.
2696 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2697 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
2698 4. Verify that subscribers had got ip from dhcp server successfully.
2699 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
2700 6. Pause the olt device which is detected in voltha.
2701 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
2702 """
2703 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request(self):
2704 """
2705 Test Method:
2706 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2707 1. OLT and ONU is detected and validated.
2708 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2709 3. Send dhcp request from residential subscrber to external dhcp server.
2710 4. Verify that subscriber get ip from external dhcp server successfully.
2711 """
2712
2713 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_broadcast_source_mac(self):
2714 """
2715 Test Method:
2716 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
2717 1. OLT and ONU is detected and validated.
2718 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2719 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
2720 4. Verify that subscriber should not get ip from external dhcp server.
2721 """
2722
2723 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_multicast_source_mac(self):
2724 """
2725 Test Method:
2726 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
2727 1. OLT and ONU is detected and validated.
2728 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2729 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
2730 4. Verify that subscriber should not get ip from external dhcp server.
2731 """
2732
2733 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_source_mac(self):
2734 """
2735 Test Method:
2736 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2737 1. OLT and ONU is detected and validated.
2738 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2739 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
2740 4. Verify that subscriber should not get ip from external dhcp server.
2741 """
2742
2743 def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_and_release(self):
2744 """
2745 Test Method:
2746 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2747 1. OLT and ONU is detected and validated.
2748 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2749 3. Send dhcp request from residential subscrber to external dhcp server.
2750 4. Verify that subscriber get ip from external dhcp server successfully.
2751 5. Send dhcp release from residential subscrber to external dhcp server.
2752 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
2753 """
2754
2755 def test_subscriber_with_voltha_for_dhcpRelay_starvation(self):
2756 """
2757 Test Method:
2758 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2759 1. OLT and ONU is detected and validated.
2760 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2761 3. Send dhcp request from residential subscriber to external dhcp server.
2762 4. Verify that subscriber get ip from external dhcp server. successfully.
2763 5. Repeat step 3 and 4 for 10 times.
2764 6 Verify that subscriber should get ip from external dhcp server..
2765 """
2766
2767 def test_subscriber_with_voltha_for_dhcpRelay_starvation_negative_scenario(self):
2768 """
2769 Test Method:
2770 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2771 1. OLT and ONU is detected and validated.
2772 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2773 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
2774 4. Verify that subscriber should not get ip from external dhcp server..
2775 5. Repeat steps 3 and 4 for 10 times.
2776 6 Verify that subscriber should not get ip from external dhcp server..
2777 """
2778 def test_subscriber_with_voltha_for_dhcpRelay_sending_multiple_discover(self):
2779 """
2780 Test Method:
2781 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2782 1. OLT and ONU is detected and validated.
2783 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2784 3. Send dhcp request from residential subscriber to external dhcp server.
2785 4. Verify that subscriber get ip from external dhcp server. successfully.
2786 5. Repeat step 3 for 50 times.
2787 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
2788 """
2789 def test_subscriber_with_voltha_for_dhcpRelay_sending_multiple_request(self):
2790 """
2791 Test Method:
2792 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2793 1. OLT and ONU is detected and validated.
2794 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2795 3. Send dhcp request from residential subscriber to external dhcp server.
2796 4. Verify that subscriber get ip from external dhcp server. successfully.
2797 5. Send DHCP request to external dhcp server.
2798 6. Repeat step 5 for 50 times.
2799 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
2800 """
2801
2802 def test_subscriber_with_voltha_for_dhcpRelay_requesting_desired_ip_address(self):
2803 """
2804 Test Method:
2805 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2806 1. OLT and ONU is detected and validated.
2807 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2808 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
2809 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
2810 """
2811
2812 def test_subscriber_with_voltha_for_dhcpRelay_requesting_desired_out_of_pool_ip_address(self):
2813 """
2814 Test Method:
2815 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2816 1. OLT and ONU is detected and validated.
2817 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2818 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
2819 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.
2820 """
2821
2822 def test_subscriber_with_voltha_for_dhcpRelay_deactivating_dhcpRelay_app_in_onos(self):
2823 """
2824 Test Method:
2825 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2826 1. OLT and ONU is detected and validated.
2827 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2828 3. Send dhcp request from residential subscriber to external dhcp server.
2829 4. Verify that subscriber get ip from external dhcp server. successfully.
2830 5. Deactivate dhcp server app in onos.
2831 6. Repeat step 3.
2832 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
2833 """
2834
2835 def test_subscriber_with_voltha_for_dhcpRelay_renew_time(self):
2836 """
2837 Test Method:
2838 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2839 1. OLT and ONU is detected and validated.
2840 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2841 3. Send dhcp request from residential subscriber to external dhcp server.
2842 4. Verify that subscriber get ip from external dhcp server. successfully.
2843 5. Send dhcp renew packet to external dhcp server.
2844 6. Repeat step 4.
2845 """
2846
2847 def test_subscriber_with_voltha_for_dhcpRelay_rebind_time(self):
2848 """
2849 Test Method:
2850 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2851 1. OLT and ONU is detected and validated.
2852 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2853 3. Send dhcp request from residential subscriber to external dhcp server.
2854 4. Verify that subscriber get ip from external dhcp server. successfully.
2855 5. Send dhcp rebind packet to external dhcp server.
2856 6. Repeat step 4.
2857 """
2858
2859 def test_subscriber_with_voltha_for_dhcpRelay_disable_olt_in_voltha(self):
2860 """
2861 Test Method:
2862 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2863 1. OLT and ONU is detected and validated.
2864 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2865 3. Send dhcp request from residential subscriber to external dhcp server.
2866 4. Verify that subscriber get ip from external dhcp server. successfully.
2867 5. Disable olt devices which is being detected in voltha CLI.
2868 6. Repeat step 3.
2869 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
2870 """
2871
2872 def test_subscriber_with_voltha_for_dhcpRelay_toggling_olt_in_voltha(self):
2873 """
2874 Test Method:
2875 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2876 1. OLT and ONU is detected and validated.
2877 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2878 3. Send dhcp request from residential subscriber to external dhcp server.
2879 4. Verify that subscriber get ip from external dhcp server. successfully.
2880 5. Disable olt devices which is being detected in voltha CLI.
2881 6. Repeat step 3.
2882 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
2883 8. Enable olt devices which is being detected in voltha CLI.
2884 9. Repeat steps 3 and 4.
2885 """
2886
2887 def test_subscriber_with_voltha_for_dhcpRelay_disable_onu_port_in_voltha(self):
2888 """
2889 Test Method:
2890 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2891 1. OLT and ONU is detected and validated.
2892 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2893 3. Send dhcp request from residential subscriber to external dhcp server.
2894 4. Verify that subscriber get ip from external dhcp server. successfully.
2895 5. Disable onu port which is being detected in voltha CLI.
2896 6. Repeat step 3.
2897 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
2898 """
2899
Chetan Gaonkercf37f262017-06-19 19:11:11 +00002900 def test_subscriber_with_voltha_for_dhcpRelay_toggling_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002901 """
2902 Test Method:
2903 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2904 1. OLT and ONU is detected and validated.
2905 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2906 3. Send dhcp request from residential subscriber to external dhcp server.
2907 4. Verify that subscriber get ip from external dhcp server. successfully.
2908 5. Disable onu port which is being detected in voltha CLI.
2909 6. Repeat step 3.
2910 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
2911 8. Enable onu port which is being detected in voltha CLI.
2912 9. Repeat steps 3 and 4.
2913 """
2914
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002915 def test_two_subscribers_with_voltha_for_dhcpRelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002916 """
2917 Test Method:
2918 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2919 1. OLT and ONU is detected and validated.
2920 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2921 3. Send dhcp request from two residential subscribers to external dhcp server.
2922 4. Verify that subscribers had got different ips from external dhcp server. successfully.
2923 """
2924
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002925 def test_two_subscribers_with_voltha_for_dhcpRelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002926 """
2927 Test Method:
2928 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2929 1. OLT and ONU is detected and validated.
2930 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2931 3. Send dhcp request from two residential subscribers to external dhcp server.
2932 4. Verify that subscribers had got ip from external dhcp server. successfully.
2933 5. Repeat step 3 and 4 for 10 times for both subscribers.
2934 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
2935 """
2936
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002937 def test_two_subscribers_with_voltha_for_dhcpRelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002938 """
2939 Test Method:
2940 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2941 1. OLT and ONU is detected and validated.
2942 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2943 3. Send dhcp request from two residential subscribers to external dhcp server.
2944 4. Verify that subscribers had got ip from external dhcp server. successfully.
2945 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
2946 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
2947 """
2948
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002949 def test_two_subscribers_with_voltha_for_dhcpRelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002950 """
2951 Test Method:
2952 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2953 1. OLT and ONU is detected and validated.
2954 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2955 3. Send dhcp request from one residential subscriber to external dhcp server.
2956 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
2957 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
2958 """
2959
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002960 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 +00002961 """
2962 Test Method:
2963 0. Make sure that voltha and external dhcp server are 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 with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
2967 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
2968 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
2969 """
2970
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002971 def test_two_subscribers_with_voltha_for_dhcpRelay_disable_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002972 """
2973 Test Method:
2974 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2975 1. OLT and ONU is detected and validated.
2976 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2977 3. Send dhcp request from two residential subscribers to external dhcp server.
2978 4. Verify that subscribers had got ip from external dhcp server. successfully.
2979 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
2980 6. Repeat step 3 and 4 for one subscriber where uni port is down.
2981 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
2982 """
2983
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002984 def test_two_subscribers_with_voltha_for_dhcpRelay_toggle_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002985 """
2986 Test Method:
2987 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
2988 1. OLT and ONU is detected and validated.
2989 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2990 3. Send dhcp request from two residential subscribers to external dhcp server.
2991 4. Verify that subscribers had got ip from external dhcp server. successfully.
2992 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
2993 6. Repeat step 3 and 4 for one subscriber where uni port is down.
2994 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
2995 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
2996 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
2997 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
2998 """
2999
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003000 def test_two_subscribers_with_voltha_for_dhcpRelay_disable_olt_detected_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003001 """
3002 Test Method:
3003 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3004 1. OLT and ONU is detected and validated.
3005 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3006 3. Send dhcp request from two residential subscribers to external dhcp server.
3007 4. Verify that subscribers had got ip from external dhcp server. successfully.
3008 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3009 6. Disable the olt device which is detected in voltha.
3010 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
3011 """
3012
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003013 def test_two_subscribers_with_voltha_for_dhcpRelay_toggle_olt_detected_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003014 """
3015 Test Method:
3016 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3017 1. OLT and ONU is detected and validated.
3018 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3019 3. Send dhcp request from two residential subscribers to external dhcp server.
3020 4. Verify that subscribers had got ip from external dhcp server. successfully.
3021 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3022 6. Disable the olt device which is detected in voltha.
3023 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
3024 8. Enable the olt device which is detected in voltha.
3025 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
3026 """
3027
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003028 def test_two_subscribers_with_voltha_for_dhcpRelay_pause_olt_detected_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003029 """
3030 Test Method:
3031 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3032 1. OLT and ONU is detected and validated.
3033 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3034 3. Send dhcp request from two residential subscribers to external dhcp server.
3035 4. Verify that subscribers had got ip from external dhcp server. successfully.
3036 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3037 6. Pause the olt device which is detected in voltha.
3038 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
3039 """