blob: 4fc5578cd36b9152addf3cea329bf74a7aed9294 [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
Thangavelu K S8e413082017-07-13 20:02:14 +00008from IGMP import *
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00009from random import randint
10from threading import Timer
Thangavelu K S36edb012017-07-05 18:24:12 +000011from threadPool import ThreadPool
A R Karthick35495c32017-05-11 14:58:32 -070012from nose.tools import *
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000013from nose.twistedtools import reactor, deferred
14from twisted.internet import defer
A R Karthick9dc6e922017-07-12 14:40:16 -070015from CordTestConfig import setup_module, teardown_module
A R Karthick35495c32017-05-11 14:58:32 -070016from CordTestUtils import log_test
17from VolthaCtrl import VolthaCtrl
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000018from CordTestUtils import log_test, get_controller
19from portmaps import g_subscriber_port_map
20from OltConfig import *
21from EapTLS import TLSAuthTest
Thangavelu K S8e413082017-07-13 20:02:14 +000022from Channels import Channels, IgmpChannel
23from Stats import Stats
Thangavelu K Sa1c71b42017-06-14 18:13:21 +000024from DHCP import DHCPTest
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000025from OnosCtrl import OnosCtrl
26from CordLogger import CordLogger
27from scapy.all import *
28from scapy_ssl_tls.ssl_tls import *
29from scapy_ssl_tls.ssl_tls_crypto import *
30from CordTestServer import cord_test_onos_restart, cord_test_shell, cord_test_radius_restart
A.R Karthickb9eab5a2017-06-07 16:03:51 -070031from CordContainer import Onos
A R Karthick35495c32017-05-11 14:58:32 -070032
Thangavelu K S36edb012017-07-05 18:24:12 +000033
Thangavelu K S8e413082017-07-13 20:02:14 +000034class Voltha_olt_subscribers(Channels):
Thangavelu K S36edb012017-07-05 18:24:12 +000035
Thangavelu K S8e413082017-07-13 20:02:14 +000036 STATS_JOIN = 2
37 STATS_LEAVE = 3
38
39
40 def __init__(self, tx_port, rx_port, num_channels =1, channel_start = 0, src_list = None):
41 self.tx_port = tx_port
42 self.rx_port = rx_port
43 self.src_list = src_list
Thangavelu K S36edb012017-07-05 18:24:12 +000044 try:
Thangavelu K S8e413082017-07-13 20:02:14 +000045 self.tx_intf = tx_port
46 self.rx_intf = rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +000047 except:
48 self.tx_intf = self.INTF_TX_DEFAULT
49 self.rx_intf = self.INTF_RX_DEFAULT
Thangavelu K S8e413082017-07-13 20:02:14 +000050# num = 1
51# channel_start = 0
Thangavelu K S36edb012017-07-05 18:24:12 +000052 mcast_cb = None
Thangavelu K S8e413082017-07-13 20:02:14 +000053 Channels.__init__(self, num_channels, channel_start = channel_start, src_list = src_list,
Thangavelu K S36edb012017-07-05 18:24:12 +000054 iface = self.rx_intf, iface_mcast = self.tx_intf, mcast_cb = mcast_cb)
55
Thangavelu K S8e413082017-07-13 20:02:14 +000056 self.loginType = 'wireless'
Thangavelu K S36edb012017-07-05 18:24:12 +000057 ##start streaming channels
58 self.join_map = {}
59 ##accumulated join recv stats
60 self.join_rx_stats = Stats()
61 self.recv_timeout = False
62
63
64 def channel_join_update(self, chan, join_time):
65 self.join_map[chan] = ( Stats(), Stats(), Stats(), Stats() )
66 self.channel_update(chan, self.STATS_JOIN, 1, t = join_time)
67
Thangavelu K S8e413082017-07-13 20:02:14 +000068 def channel_join(self, chan = 0, delay = 2, src_list = None, record_type = None):
Thangavelu K S36edb012017-07-05 18:24:12 +000069 '''Join a channel and create a send/recv stats map'''
70 if self.join_map.has_key(chan):
71 del self.join_map[chan]
72 self.delay = delay
Thangavelu K S8e413082017-07-13 20:02:14 +000073 chan, join_time = self.join(chan, src_list = src_list, record_type = record_type)
74 #chan, join_time = self.join(chan)
Thangavelu K S36edb012017-07-05 18:24:12 +000075 self.channel_join_update(chan, join_time)
76 return chan
77
78 def channel_join_next(self, delay = 2, leave_flag = True):
79 '''Joins the next channel leaving the last channel'''
80 if self.last_chan:
81 if self.join_map.has_key(self.last_chan):
82 del self.join_map[self.last_chan]
83 self.delay = delay
84 chan, join_time = self.join_next(leave_flag = leave_flag)
85 self.channel_join_update(chan, join_time)
86 return chan
87
88 def channel_jump(self, delay = 2):
89 '''Jumps randomly to the next channel leaving the last channel'''
90 if self.last_chan is not None:
91 if self.join_map.has_key(self.last_chan):
92 del self.join_map[self.last_chan]
93 self.delay = delay
94 chan, join_time = self.jump()
95 self.channel_join_update(chan, join_time)
96 return chan
97
Thangavelu K S8e413082017-07-13 20:02:14 +000098 def channel_leave(self, chan = 0, force = False, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +000099 if self.join_map.has_key(chan):
100 del self.join_map[chan]
Thangavelu K S8e413082017-07-13 20:02:14 +0000101 self.leave(chan, force = force, src_list = src_list)
Thangavelu K S36edb012017-07-05 18:24:12 +0000102
103 def channel_update(self, chan, stats_type, packets, t=0):
104 if type(chan) == type(0):
105 chan_list = (chan,)
106 else:
107 chan_list = chan
108 for c in chan_list:
109 if self.join_map.has_key(c):
110 self.join_map[c][stats_type].update(packets = packets, t = t)
111
Thangavelu K S8e413082017-07-13 20:02:14 +0000112 def channel_receive(self, chan, cb = None, count = 1, timeout = 5, src_list = None):
113 log_test.info('Subscriber on port %s receiving from group %s, channel %d' %
114 (self.rx_intf, self.gaddr(chan), chan))
115 r = self.recv(chan, cb = cb, count = count, timeout = timeout, src_list = src_list)
Thangavelu K S36edb012017-07-05 18:24:12 +0000116 if len(r) == 0:
Thangavelu K S8e413082017-07-13 20:02:14 +0000117 log_test.info('Subscriber on port %s timed out' %( self.rx_intf))
118 self.test_status = False
Thangavelu K S36edb012017-07-05 18:24:12 +0000119 else:
Thangavelu K S8e413082017-07-13 20:02:14 +0000120 log_test.info('Subscriber on port %s received %d packets' %(self.rx_intf, len(r)))
Thangavelu K S36edb012017-07-05 18:24:12 +0000121 if self.recv_timeout:
122 ##Negative test case is disabled for now
123 assert_equal(len(r), 0)
Thangavelu K S8e413082017-07-13 20:02:14 +0000124 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +0000125
Thangavelu K S8e413082017-07-13 20:02:14 +0000126 def recv_channel_cb(self, pkt, src_list = None):
127
Thangavelu K S36edb012017-07-05 18:24:12 +0000128 ##First verify that we have received the packet for the joined instance
Thangavelu K S8e413082017-07-13 20:02:14 +0000129 log_test.info('Packet received for group %s, subscriber, port %s' %
130 (pkt[IP].dst, self.rx_intf))
Thangavelu K S36edb012017-07-05 18:24:12 +0000131 if self.recv_timeout:
132 return
133 chan = self.caddr(pkt[IP].dst)
134 assert_equal(chan in self.join_map.keys(), True)
135 recv_time = monotonic.monotonic() * 1000000
136 join_time = self.join_map[chan][self.STATS_JOIN].start
137 delta = recv_time - join_time
138 self.join_rx_stats.update(packets=1, t = delta, usecs = True)
139 self.channel_update(chan, self.STATS_RX, 1, t = delta)
140 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
141
Thangavelu K S36edb012017-07-05 18:24:12 +0000142class voltha_subscriber_pool:
143
144 def __init__(self, subscriber, test_cbs):
145 self.subscriber = subscriber
146 self.test_cbs = test_cbs
147
148 def pool_cb(self):
149 for cb in self.test_cbs:
150 if cb:
Thangavelu K S8e413082017-07-13 20:02:14 +0000151 self.test_status = cb(self.subscriber, multiple_sub = True)
Thangavelu K S36edb012017-07-05 18:24:12 +0000152 if self.test_status is not True:
153 ## This is chaning for other sub status has to check again
154 self.test_status = True
155 log_test.info('This service is failed and other services will not run for this subscriber')
156 break
157 log_test.info('This Subscriber is tested for multiple service eligibility ')
158 self.test_status = True
159
A R Karthick35495c32017-05-11 14:58:32 -0700160class voltha_exchange(unittest.TestCase):
161
162 OLT_TYPE = 'tibit_olt'
163 OLT_MAC = '00:0c:e2:31:12:00'
164 VOLTHA_HOST = 'localhost'
165 VOLTHA_REST_PORT = 8881
Thangavelu K S36edb012017-07-05 18:24:12 +0000166 VOLTHA_OLT_TYPE = 'ponsim_olt'
167 VOLTHA_OLT_MAC = '00:0c:e2:31:12:00'
168 VOLTHA_IGMP_ITERATIONS = 100
A R Karthick35495c32017-05-11 14:58:32 -0700169 voltha = None
Thangavelu K S9648eed2017-06-13 20:15:25 +0000170 success = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000171 olt_device_id = None
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000172 apps = ('org.opencord.aaa', 'org.onosproject.dhcp')
173 olt_apps = () #'org.opencord.cordmcast')
174 vtn_app = 'org.opencord.vtn'
175 table_app = 'org.ciena.cordigmp'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000176 test_path = os.path.dirname(os.path.realpath(__file__))
177 table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700178 app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000179 olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar')
A.R Karthick3493a572017-06-07 18:28:10 -0700180 olt_app_name = 'org.onosproject.olt'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000181 #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
182 olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
183 onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
A R Karthick9dc6e922017-07-12 14:40:16 -0700184 VOLTHA_AUTO_CONFIGURE = False
Thangavelu K S8e413082017-07-13 20:02:14 +0000185 num_joins = 0
186
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000187 VOLTHA_ENABLED = True
188 INTF_TX_DEFAULT = 'veth2'
189 INTF_RX_DEFAULT = 'veth0'
Thangavelu K S9648eed2017-06-13 20:15:25 +0000190 INTF_2_RX_DEFAULT = 'veth6'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000191 TESTCASE_TIMEOUT = 300
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000192# VOLTHA_CONFIG_FAKE = True
193 VOLTHA_CONFIG_FAKE = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000194 VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
195 VOLTHA_ONU_UNI_PORT = 'veth0'
196
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000197 dhcp_server_config = {
198 "ip": "10.1.11.50",
199 "mac": "ca:fe:ca:fe:ca:fe",
200 "subnet": "255.255.252.0",
201 "broadcast": "10.1.11.255",
202 "router": "10.1.8.1",
203 "domain": "8.8.8.8",
204 "ttl": "63",
205 "delay": "2",
206 "startip": "10.1.11.51",
207 "endip": "10.1.11.100"
208 }
209
210
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000211 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
212MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
213CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
214IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
215RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
216MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
217BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
218hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
219gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
220+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
221rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
222VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
223eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
2246tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
225PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
226nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
227-----END CERTIFICATE-----"""
228
229 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
230MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
231CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
232IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
233RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
234MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
235BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
236hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
237AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
2385An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
239tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
240OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
241qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
2422Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
243BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
244eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
245MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
246VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
247RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
248dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
249T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
250yg==
251-----END CERTIFICATE-----'''
A R Karthick35495c32017-05-11 14:58:32 -0700252
A.R Karthick3493a572017-06-07 18:28:10 -0700253 @classmethod
254 def update_apps_version(cls):
255 version = Onos.getVersion()
256 major = int(version.split('.')[0])
257 minor = int(version.split('.')[1])
258 cordigmp_app_version = '2.0-SNAPSHOT'
259 olt_app_version = '1.2-SNAPSHOT'
260 if major > 1:
261 cordigmp_app_version = '3.0-SNAPSHOT'
262 olt_app_version = '2.0-SNAPSHOT'
263 elif major == 1:
264 if minor > 10:
265 cordigmp_app_version = '3.0-SNAPSHOT'
266 olt_app_version = '2.0-SNAPSHOT'
267 elif minor <= 8:
268 olt_app_version = '1.1-SNAPSHOT'
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700269 cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version))
270 cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version))
271 cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
272
A R Karthick35495c32017-05-11 14:58:32 -0700273 @classmethod
A.R Karthickf874d032017-06-07 18:47:51 -0700274 def onos_load_config(cls, app, config):
275 status, code = OnosCtrl.config(config)
276 if status is False:
277 log_test.info('JSON config request for app %s returned status %d' %(app, code))
278 assert_equal(status, True)
279 time.sleep(2)
280
281 @classmethod
282 def onos_aaa_load(cls):
283 aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
284 'radiusIp': '172.17.0.2' } } } }
285 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
286 aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip
287 cls.onos_load_config('org.opencord.aaa', aaa_dict)
288
289 @classmethod
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000290 def onos_dhcp_table_load(self, config = None):
291 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
292 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
293 if config:
294 for k in config.keys():
295 if dhcp_config.has_key(k):
296 dhcp_config[k] = config[k]
297 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
298
Thangavelu K S36edb012017-07-05 18:24:12 +0000299 def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = None):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000300 if validation:
Thangavelu K S735a6662017-06-15 18:08:23 +0000301 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
302 assert_not_equal(cip, None)
303 assert_not_equal(sip, None)
304 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
305 (cip, sip, dhcp.get_mac(cip)[0]))
306 if validation == False:
307 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
308 assert_equal(cip, None)
309 assert_equal(sip, None)
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000310 log_test.info('Dhcp client did not get IP from server')
Thangavelu K S735a6662017-06-15 18:08:23 +0000311
Thangavelu K S36edb012017-07-05 18:24:12 +0000312 if validation == 'skip':
313 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
314
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000315 return cip,sip
316
Thangavelu K S36edb012017-07-05 18:24:12 +0000317 def dhcp_request(self, onu_iface = None, seed_ip = '10.10.10.1', update_seed = False, validation = None, startip = '10.10.10.20', mac = None):
318 config = {'startip':startip, 'endip':'10.10.10.200',
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000319 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
320 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
321 self.onos_dhcp_table_load(config)
322 dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface)
Thangavelu K S36edb012017-07-05 18:24:12 +0000323 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed, validation = validation, mac = mac)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000324 return cip, sip
325
326 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700327 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700328 cls.update_apps_version()
A R Karthick35495c32017-05-11 14:58:32 -0700329 cls.voltha = VolthaCtrl(cls.VOLTHA_HOST, rest_port = cls.VOLTHA_REST_PORT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000330 cls.install_app_table()
331 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
332 cls.port_map, cls.port_list = cls.olt.olt_port_map()
333 cls.switches = cls.port_map['switches']
Thangavelu K S36edb012017-07-05 18:24:12 +0000334 cls.ponsim_ports = cls.port_map['ponsim']
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000335 cls.num_ports = cls.port_map['num_ports']
336 if cls.num_ports > 1:
337 cls.num_ports -= 1 ##account for the tx port
338 cls.activate_apps(cls.apps + cls.olt_apps)
A.R Karthickf874d032017-06-07 18:47:51 -0700339 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000340
A.R Karthick3493a572017-06-07 18:28:10 -0700341 @classmethod
342 def tearDownClass(cls):
343 '''Deactivate the olt apps and restart OVS back'''
344 apps = cls.olt_apps + ( cls.table_app,)
345 for app in apps:
346 onos_ctrl = OnosCtrl(app)
347 onos_ctrl.deactivate()
348 cls.install_app_igmp()
A.R Karthick3493a572017-06-07 18:28:10 -0700349 @classmethod
350 def install_app_igmp(cls):
351 ##Uninstall the table app on class exit
352 OnosCtrl.uninstall_app(cls.table_app)
353 time.sleep(2)
354 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
355 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700356
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000357 def remove_olt(self, switch_map):
358 controller = get_controller()
359 auth = ('karaf', 'karaf')
360 #remove subscriber for every port on all the voltha devices
361 for device, device_map in switch_map.iteritems():
362 uni_ports = device_map['ports']
363 uplink_vlan = device_map['uplink_vlan']
364 for port in uni_ports:
365 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
366 device,
367 port)
368 resp = requests.delete(rest_url, auth = auth)
369 if resp.status_code not in [204, 202, 200]:
370 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
371 else:
372 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
373 OnosCtrl.uninstall_app(self.olt_app_file)
374
375 def config_olt(self, switch_map):
376 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000377 auth = ('karaf', 'karaf')
378 #configure subscriber for every port on all the voltha devices
379 for device, device_map in switch_map.iteritems():
380 uni_ports = device_map['ports']
381 uplink_vlan = device_map['uplink_vlan']
382 for port in uni_ports:
383 vlan = port
384 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
385 device,
386 port,
387 vlan)
388 resp = requests.post(rest_url, auth = auth)
389 #assert_equal(resp.ok, True)
390
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000391 def voltha_uni_port_toggle(self, uni_port = None):
392 ## Admin state of port is down and up
393 if not uni_port:
394 uni_port = self.INTF_RX_DEFAULT
395 cmd = 'ifconfig {} down'.format(uni_port)
396 os.system(cmd)
397 log_test.info('Admin state of uni_port is down')
398 time.sleep(30)
399 cmd = 'ifconfig {} up'.format(uni_port)
400 os.system(cmd)
401 log_test.info('Admin state of uni_port is up now')
402 time.sleep(30)
403 return
404
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000405 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000406 def install_app_table(cls):
407 ##Uninstall the existing app if any
408 OnosCtrl.uninstall_app(cls.table_app)
409 time.sleep(2)
410 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
411 OnosCtrl.install_app(cls.table_app_file)
412 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000413
414 @classmethod
415 def activate_apps(cls, apps):
416 for app in apps:
417 onos_ctrl = OnosCtrl(app)
418 status, _ = onos_ctrl.activate()
419 assert_equal(status, True)
420 time.sleep(2)
421
Thangavelu K S735a6662017-06-15 18:08:23 +0000422 @classmethod
423 def deactivate_apps(cls, apps):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000424 cls.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000425 for app in apps:
426 onos_ctrl = OnosCtrl(app)
427 status, _ = onos_ctrl.deactivate()
428 if status is False:
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000429 cls.success = False
430 # assert_equal(status, True)
Thangavelu K S735a6662017-06-15 18:08:23 +0000431 time.sleep(2)
432
Thangavelu K S36edb012017-07-05 18:24:12 +0000433 def random_ip(self,start_ip = '10.10.10.20', end_ip = '10.10.10.65'):
434 start = list(map(int, start_ip.split(".")))
435 end = list(map(int, end_ip.split(".")))
436 temp = start
437 ip_range = []
438 ip_range.append(start_ip)
439 while temp != end:
440 start[3] += 1
441 for i in (3, 2, 1):
442 if temp[i] == 255:
443 temp[i] = 0
444 temp[i-1] += 1
445 ip_range.append(".".join(map(str, temp)))
446 return random.choice(ip_range)
447
Thangavelu K S8e413082017-07-13 20:02:14 +0000448 def random_mcast_ip(self,start_ip = '224.0.1.0', end_ip = '224.0.1.100'):
449 start = list(map(int, start_ip.split(".")))
450 end = list(map(int, end_ip.split(".")))
451 temp = start
452 ip_range = []
453 ip_range.append(start_ip)
454 while temp != end:
455 start[3] += 1
456 for i in (3, 2, 1):
457 if temp[i] == 255:
458 temp[i] = 0
459 temp[i-1] += 1
460 ip_range.append(".".join(map(str, temp)))
461 return random.choice(ip_range)
462
463 def tls_flow_check(self, olt_ports, cert_info = None, multiple_sub = False):
464 if multiple_sub is True:
465 olt_nni_port = olt_ports.tx_port
466 olt_uni_port = olt_ports.rx_port
467 else:
Thangavelu K S36edb012017-07-05 18:24:12 +0000468 olt_uni_port = olt_ports
469
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000470 def tls_fail_cb():
471 log_test.info('TLS verification failed')
472 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700473 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000474 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
475 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000476 if tls.failTest is True:
477 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000478 assert_equal(tls.failTest, False)
479 if cert_info == "no_cert":
480 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
481 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
482 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000483 if tls.failTest is False:
484 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000485 assert_equal(tls.failTest, True)
486 if cert_info == "invalid_cert":
487 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
488 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
489 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000490 if tls.failTest is False:
491 self.success = False
492 assert_equal(tls.failTest, True)
493 if cert_info == "same_cert":
494 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
495 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
496 tls.runTest()
497 if tls.failTest is False:
498 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000499 assert_equal(tls.failTest, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000500 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 +0000501 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 +0000502 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
503 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
504 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000505 if tls.failTest is False:
506 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000507 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000508 self.test_status = True
509 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700510
Thangavelu K S8e413082017-07-13 20:02:14 +0000511 def dhcp_flow_check(self, olt_ports, negative_test = None, multiple_sub = False):
512 if multiple_sub is True:
513 olt_nni_port = olt_ports.tx_port
514 onu_iface = olt_ports.rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +0000515 dhcp_server_startip = self.random_ip()
516 random_mac = '00:00:00:0a:0a:' + hex(random.randrange(50,254)).split('x')[1]
Thangavelu K S8e413082017-07-13 20:02:14 +0000517 else:
518 onu_iface = olt_ports
519 dhcp_server_startip = '10.10.10.20'
520 random_mac = None
Thangavelu K S735a6662017-06-15 18:08:23 +0000521 self.success = True
522
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000523 if negative_test is None:
Thangavelu K S36edb012017-07-05 18:24:12 +0000524 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = 'skip', startip = dhcp_server_startip, mac = random_mac)
525 if cip == None or sip == None:
Thangavelu K S735a6662017-06-15 18:08:23 +0000526 self.success = False
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000527 self.test_status = False
528 assert_not_equal(cip,None)
529 assert_not_equal(sip,None)
530 else:
531 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
532 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000533
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000534 if negative_test == "interrupting_dhcp_flows":
535 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
Thangavelu K S735a6662017-06-15 18:08:23 +0000536 if cip is not None:
537 self.success = False
538 assert_equal(cip,None)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000539 log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000540 self.test_status = True
541
542 if negative_test == "invalid_src_mac_broadcast":
543 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
544 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
545 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
546 self.onos_dhcp_table_load(config)
547 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
548 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000549
550 if cip is not None:
551 self.success = False
552 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 +0000553 assert_equal(cip,None)
554 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
555 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000556
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000557 if negative_test == "invalid_src_mac_multicast":
558 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
559 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
560 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
561 self.onos_dhcp_table_load(config)
562 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
563 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000564 if cip is not None:
565 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000566 assert_equal(cip,None)
567 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
568 self.test_status = True
569
570 if negative_test == "invalid_src_mac_junk":
571 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
572 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
573 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
574 self.onos_dhcp_table_load(config)
575 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
576 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000577 if cip is not None:
578 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000579 assert_equal(cip,None)
580 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
581 self.test_status = True
582
583 if negative_test == "request_release":
584 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
585 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
586 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
587 self.onos_dhcp_table_load(config)
588 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
589 cip, sip = self.dhcp_sndrcv(self.dhcp)
590 log_test.info('Releasing ip %s to server %s' %(cip, sip))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000591 if not self.dhcp.release(cip):
592 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000593 assert_equal(self.dhcp.release(cip), True)
594 log_test.info('Triggering DHCP discover again after release')
595 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
596 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000597 if not cip == cip2:
Thangavelu K S735a6662017-06-15 18:08:23 +0000598 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000599 assert_equal(cip, cip2)
600 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
601 assert_equal(self.dhcp.release(cip2), True)
602 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000603
Thangavelu K S735a6662017-06-15 18:08:23 +0000604 if negative_test == "starvation_positive":
605 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
606 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
607 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
608 self.onos_dhcp_table_load(config)
609 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
610 ip_map = {}
611 for i in range(10):
612 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
613 if ip_map.has_key(cip):
614 self.success = False
615 log_test.info('IP %s given out multiple times' %cip)
616 assert_equal(False, ip_map.has_key(cip))
617 ip_map[cip] = sip
618 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000619
Thangavelu K S735a6662017-06-15 18:08:23 +0000620 if negative_test == "starvation_negative":
621 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
622 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
623 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
624 self.onos_dhcp_table_load(config)
625 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
626 log_test.info('Verifying passitive case')
627 for x in xrange(50):
628 mac = RandMAC()._fix()
629 self.dhcp_sndrcv(self.dhcp,mac = mac)
630 log_test.info('Verifying negative case')
631 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000632 if cip or sip is not None:
633 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000634 assert_equal(cip, None)
635 assert_equal(sip, None)
636 self.test_status = True
637 self.success = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000638
Thangavelu K S735a6662017-06-15 18:08:23 +0000639 if negative_test == "multiple_discover":
640 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
641 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
642 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
643 self.onos_dhcp_table_load(config)
644 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
645 cip, sip, mac, _ = self.dhcp.only_discover()
646 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
647 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000648 if cip is None:
649 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000650 assert_not_equal(cip, None)
651 log_test.info('Triggering DHCP discover again.')
652 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000653 if not new_cip == cip:
654 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000655 assert_equal(new_cip, cip)
656 log_test.info('client got same IP as expected when sent 2nd discovery')
657 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000658 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000659 if negative_test == "multiple_requests":
660 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
661 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
662 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
663 self.onos_dhcp_table_load(config)
664 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
665 log_test.info('Sending DHCP discover and DHCP request.')
666 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
667 mac = self.dhcp.get_mac(cip)[0]
668 log_test.info("Sending DHCP request again.")
669 new_cip, new_sip = self.dhcp.only_request(cip, mac)
670 assert_equal(new_cip,cip)
671 log_test.info('server offered same IP to clain for multiple requests, as expected')
672 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000673# self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000674 if negative_test == "desired_ip_address":
675 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
676 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
677 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
678 self.onos_dhcp_table_load(config)
679 self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface)
680 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000681 if cip or sip is None:
682 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000683 assert_not_equal(cip, None)
684 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
685 (cip, sip, mac))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000686 if not self.dhcp.seed_ip == cip:
687 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000688 assert_equal(cip,self.dhcp.seed_ip)
689 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
690 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000691 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000692 if negative_test == "desired_out_of_pool_ip_address":
693 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
694 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
695 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
696 self.onos_dhcp_table_load(config)
697 self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface)
698 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000699 if cip or sip is None:
700 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000701 assert_not_equal(cip, None)
702 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
703 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000704 if self.dhcp.seed_ip == cip:
705 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000706 assert_not_equal(cip,self.dhcp.seed_ip)
707 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
708 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000709 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000710 if negative_test == "dhcp_renew":
711 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
712 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
713 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
714 self.onos_dhcp_table_load(config)
715 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
716 cip, sip, mac, _ = self.dhcp.only_discover()
717 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
718 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000719 if cip or sip is None:
720 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000721 assert_not_equal(cip, None)
722 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
723 log_test.info('waiting renew time %d seconds to send next request packet'%lval)
724 time.sleep(lval)
725 latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000726 if not latest_cip == cip:
727 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000728 assert_equal(latest_cip,cip)
729 log_test.info('client got same IP after renew time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +0000730 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000731 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000732 if negative_test == "dhcp_rebind":
733 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
734 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
735 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
736 self.onos_dhcp_table_load(config)
737 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
738 cip, sip, mac, _ = self.dhcp.only_discover()
739 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
740 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000741 if cip or sip is None:
742 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000743 assert_not_equal(cip, None)
744 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
745 log_test.info('waiting rebind time %d seconds to send next request packet'%lval)
746 time.sleep(lval)
747 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000748 if not latest_cip == cip:
749 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000750 assert_equal(latest_cip,cip)
751 log_test.info('client got same IP after rebind time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +0000752 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000753 # self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000754 return self.test_status
755
Thangavelu K S8e413082017-07-13 20:02:14 +0000756 def recv_channel_cb(self, pkt):
757 ##First verify that we have received the packet for the joined instance
758 chan = self.subscriber.caddr(pkt[IP].dst)
759 assert_equal(chan in self.subscriber.join_map.keys(), True)
760 recv_time = monotonic.monotonic() * 1000000
761 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
762 delta = recv_time - join_time
763 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
764 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
765 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
766 self.test_status = True
Thangavelu K S36edb012017-07-05 18:24:12 +0000767
Thangavelu K S8e413082017-07-13 20:02:14 +0000768 def traffic_verify(self, subscriber):
769 # if subscriber.has_service('TRAFFIC'):
770 url = 'http://www.google.com'
771 resp = requests.get(url)
772 self.test_status = resp.ok
773 if resp.ok == False:
774 log_test.info('Subscriber %s failed get from url %s with status code %d'
775 %(subscriber.name, url, resp.status_code))
776 else:
777 log_test.info('GET request from %s succeeded for subscriber %s'
778 %(url, subscriber.name))
779 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +0000780
Thangavelu K S8e413082017-07-13 20:02:14 +0000781 def igmp_flow_check(self, subscriber, multiple_sub = False):
782 chan = 0
783 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
784 self.num_joins += 1
785 while self.num_joins < self.num_subscribers:
786 time.sleep(5)
787 log_test.info('All subscribers have joined the channel')
788 for i in range(10):
789 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
790 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
791 subscriber.channel_leave(chan, src_list = subscriber.src_list)
792 time.sleep(5)
793 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
794 #Should not receive packets for this subscriber
795 self.recv_timeout = True
796 subscriber.recv_timeout = True
797 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
798 subscriber.recv_timeout = False
799 self.recv_timeout = False
800 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
801 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
802# self.test_status = True
803 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +0000804
Thangavelu K S8e413082017-07-13 20:02:14 +0000805 def igmp_flow_check_join_change_to_exclude(self, subscriber, multiple_sub = False):
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000806 chan = 2
807 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
808 self.num_joins += 1
809 while self.num_joins < self.num_subscribers:
810 time.sleep(5)
811 log_test.info('All subscribers have joined the channel')
812 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
813 time.sleep(5)
814 chan = 1
815 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
816 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
817 time.sleep(5)
818 self.recv_timeout = True
819 subscriber.recv_timeout = True
820 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
821 if self.test_status is True:
822 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
823 if self.test_status is True:
824 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
825 self.test_status = False
826 subscriber.recv_timeout = False
827 self.recv_timeout = False
828 chan = 0
829 subscriber.channel_leave(chan, src_list = subscriber.src_list)
830# self.test_status = True
831 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +0000832
Thangavelu K S8e413082017-07-13 20:02:14 +0000833 def igmp_flow_check_join_change_to_exclude_again_include_back(self, subscriber, multiple_sub = False):
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000834 chan = 2
Thangavelu K S8e413082017-07-13 20:02:14 +0000835 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
836 self.num_joins += 1
837 while self.num_joins < self.num_subscribers:
838 time.sleep(5)
839 log_test.info('All subscribers have joined the channel')
840 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
841 time.sleep(5)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000842 chan = 1
843 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port,))
Thangavelu K S8e413082017-07-13 20:02:14 +0000844 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
845 time.sleep(5)
846 self.recv_timeout = True
847 subscriber.recv_timeout = True
848 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
849 if self.test_status is True:
850 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
851 if self.test_status is True:
852 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
853 self.test_status = False
854 subscriber.recv_timeout = False
855 self.recv_timeout = False
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000856 chan = 1
857 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
858 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_INCLUDE)
Thangavelu K S8e413082017-07-13 20:02:14 +0000859 time.sleep(5)
860 self.recv_timeout = True
861 subscriber.recv_timeout = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000862 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
Thangavelu K S8e413082017-07-13 20:02:14 +0000863 subscriber.recv_timeout = False
864 self.recv_timeout = False
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000865 chan = 2
Thangavelu K S8e413082017-07-13 20:02:14 +0000866 subscriber.channel_leave(chan, src_list = subscriber.src_list)
867# self.test_status = True
868 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +0000869
Thangavelu K S8e413082017-07-13 20:02:14 +0000870 def igmp_flow_check_join_change_to_block(self, subscriber, multiple_sub = False):
871 chan = 0
872 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
873 self.num_joins += 1
874 while self.num_joins < self.num_subscribers:
875 time.sleep(5)
876 log_test.info('All subscribers have joined the channel')
877 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
878 time.sleep(5)
879 log_test.info('Leaving channel %d for subscriber on port %s from specific source ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
880 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_BLOCK_OLD)
881 time.sleep(5)
882 self.recv_timeout = True
883 subscriber.recv_timeout = True
884 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
885 if self.test_status is True:
886 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
887 if self.test_status is True:
888 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
889 self.test_status = False
890 subscriber.recv_timeout = False
891 self.recv_timeout = False
892 subscriber.channel_leave(chan, src_list = subscriber.src_list)
893 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +0000894
Thangavelu K S8e413082017-07-13 20:02:14 +0000895 def igmp_flow_check_join_change_to_block_again_allow_back(self, subscriber, multiple_sub = False):
896 chan = 0
897 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
898 self.num_joins += 1
899 while self.num_joins < self.num_subscribers:
900 time.sleep(5)
901 log_test.info('All subscribers have joined the channel')
902 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
903 time.sleep(5)
904 log_test.info('Leaving channel %d for subscriber on port %s from specific source ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
905 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
906 time.sleep(5)
907 self.recv_timeout = True
908 subscriber.recv_timeout = True
909 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
910 if self.test_status is True:
911 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
912 if self.test_status is True:
913 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
914 self.test_status = False
915 subscriber.recv_timeout = False
916 self.recv_timeout = False
917 log_test.info('Again include the source list in the group %s souce ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
918 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_ALLOW_NEW)
919 time.sleep(5)
920 self.recv_timeout = True
921 subscriber.recv_timeout = True
922 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
923 subscriber.recv_timeout = False
924 self.recv_timeout = False
925 subscriber.channel_leave(chan, src_list = subscriber.src_list)
926 return self.test_status
927
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000928 def igmp_flow_check_group_include_source_empty_list(self, subscriber, multiple_sub = False):
929 chan = 0
930 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
931 self.num_joins += 1
932 while self.num_joins < self.num_subscribers:
933 time.sleep(5)
934 log_test.info('All subscribers have joined the channel')
935 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
936 if self.test_status is True:
937 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
938 self.test_status = False
939 else:
940 log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port))
941 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
942 subscriber.channel_leave(chan, src_list = subscriber.src_list)
943 time.sleep(5)
944 subscriber.recv_timeout = False
945 self.recv_timeout = False
946 return self.test_status
947
948 def igmp_flow_check_group_exclude_source_empty_list(self, subscriber, multiple_sub = False):
949 chan = 0
950 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list,record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
951 self.num_joins += 1
952 while self.num_joins < self.num_subscribers:
953 time.sleep(5)
954 log_test.info('All subscribers have joined the channel')
955 for i in range(10):
956 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
957 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
958 subscriber.channel_leave(chan, src_list = subscriber.src_list)
959 time.sleep(5)
960 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
961 #Should not receive packets for this subscriber
962 self.recv_timeout = True
963 subscriber.recv_timeout = True
964 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
965 subscriber.recv_timeout = False
966 self.recv_timeout = False
967 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
968 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
969# self.test_status = True
970 return self.test_status
971
972 def igmp_flow_check_during_olt_onu_operational_issues(self, subscriber, multiple_sub = False):
973 chan = 0
974 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
975 self.num_joins += 1
976 while self.num_joins < self.num_subscribers:
977 time.sleep(5)
978 log_test.info('All subscribers have joined the channel')
979 for i in range(2):
980 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
981 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
982 subscriber.channel_leave(chan, src_list = subscriber.src_list)
983 time.sleep(5)
984 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
985 #Should not receive packets for this subscriber
986 self.recv_timeout = True
987 subscriber.recv_timeout = True
988 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
989 subscriber.recv_timeout = False
990 self.recv_timeout = False
991 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
992 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
993# self.test_status = True
994 return self.test_status
995
996
997
Thangavelu K S8e413082017-07-13 20:02:14 +0000998 def voltha_igmp_jump_verify(self, subscriber):
999 if subscriber.has_service('IGMP'):
1000 for i in xrange(subscriber.num):
1001 log_test.info('Subscriber %s jumping channel' %subscriber.name)
1002 chan = subscriber.channel_jump(delay=0)
1003 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
1004 log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1005 time.sleep(3)
1006 log_test.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats))
1007 self.test_status = True
1008 return self.test_status
1009
1010 def voltha_igmp_next_verify(self, subscriber):
1011 for c in xrange(self.VOLTHA_IGMP_ITERATIONS):
1012 for i in xrange(subscriber.num):
1013 if i:
1014 chan = subscriber.channel_join_next(delay=0, leave_flag = self.leave_flag)
1015 time.sleep(0.2)
1016 else:
1017 chan = subscriber.channel_join(i, delay=0)
1018 time.sleep(0.2)
1019 if subscriber.num == 1:
1020 subscriber.channel_leave(chan)
1021 log_test.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
1022 #subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
1023 #log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1024 self.test_status = True
1025 return self.test_status
1026
1027 def voltha_subscribers(self, services, cbs = None, num_subscribers = 1, num_channels = 1, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +00001028 """Test subscriber join next for channel surfing"""
1029 voltha = VolthaCtrl(self.VOLTHA_HOST,
1030 rest_port = self.VOLTHA_REST_PORT,
1031 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1032 if self.VOLTHA_OLT_TYPE.startswith('ponsim'):
1033 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1034 log_test.info('Enabling ponsim olt')
1035 device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001036 if device_id != '':
1037 self.olt_device_id = device_id
Thangavelu K S36edb012017-07-05 18:24:12 +00001038 else:
1039 log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution')
1040 assert_equal(False, True)
1041
1042 assert_not_equal(device_id, None)
1043 if status == False:
1044 voltha.disable_device(device_id, delete = True)
1045 assert_equal(status, True)
1046 time.sleep(10)
1047 switch_map = None
1048 olt_configured = False
1049 try:
1050 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1051 if not switch_map:
1052 log_test.info('No voltha devices found')
1053 return
1054 log_test.info('Installing OLT app')
1055 OnosCtrl.install_app(self.olt_app_file)
1056 time.sleep(5)
1057 log_test.info('Adding subscribers through OLT app')
1058 self.config_olt(switch_map)
1059 olt_configured = True
1060 time.sleep(5)
1061 self.num_subscribers = num_subscribers
1062 self.num_channels = num_channels
1063 test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers,
1064 num_channels = self.num_channels,
1065 cbs = cbs,
1066 port_list = self.generate_port_list(self.num_subscribers,
1067 self.num_channels),
Thangavelu K S8e413082017-07-13 20:02:14 +00001068 src_list = src_list, services = services)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001069 if test_status is False:
1070 self.success = False
Thangavelu K S36edb012017-07-05 18:24:12 +00001071 assert_equal(test_status, True)
1072 finally:
1073 if switch_map is not None:
1074 if olt_configured is True:
1075 self.remove_olt(switch_map)
1076 voltha.disable_device(device_id, delete = True)
1077 time.sleep(10)
1078 log_test.info('Uninstalling OLT app')
1079 OnosCtrl.uninstall_app(self.olt_app_name)
1080
Thangavelu K S8e413082017-07-13 20:02:14 +00001081 def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1,
1082 channel_start = 0, cbs = None, port_list = [], src_list = None,
Thangavelu K S36edb012017-07-05 18:24:12 +00001083 services = None, negative_subscriber_auth = None):
1084 self.test_status = False
1085 self.ovs_cleanup()
1086 subscribers_count = num_subscribers
1087 sub_loop_count = num_subscribers
1088 if not port_list:
1089 port_list = self.generate_port_list(num_subscribers, num_channels)
1090 subscriber_tx_rx_ports = []
1091 for i in range(num_subscribers):
Thangavelu K S8e413082017-07-13 20:02:14 +00001092 #subscriber_tx_rx_ports.append((self.port_map['ports'][port_list[i][0]], self.port_map['ports'][port_list[i][1]]))
1093 subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map['ports'][port_list[i][0]],
1094 rx_port = self.port_map['ports'][port_list[i][1]],
1095 num_channels = num_channels,src_list = src_list,))
Thangavelu K S36edb012017-07-05 18:24:12 +00001096 self.onos_aaa_load()
Thangavelu K S8e413082017-07-13 20:02:14 +00001097 #load the ssm list for all subscriber channels
1098 igmpChannel = IgmpChannel(src_list = src_list)
1099 ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports)
1100 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
1101 igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list)
1102
Thangavelu K S36edb012017-07-05 18:24:12 +00001103 self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1)
1104
1105 chan_leave = False #for single channel, multiple subscribers
1106 if cbs is None:
1107 cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check)
1108 chan_leave = True
1109 for subscriber in subscriber_tx_rx_ports:
1110 sub_loop_count = sub_loop_count - 1
1111 pool_object = voltha_subscriber_pool(subscriber, cbs)
1112 self.thread_pool.addTask(pool_object.pool_cb)
1113 self.thread_pool.cleanUpThreads()
1114 subscribers_count = 0
1115 return self.test_status
1116
1117
1118 def generate_port_list(self, subscribers, channels):
1119 return self.port_list[:subscribers]
1120
Thangavelu K S36edb012017-07-05 18:24:12 +00001121 @classmethod
1122 def ovs_cleanup(cls):
1123 ##For every test case, delete all the OVS groups
1124 cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1'
1125 try:
1126 cord_test_shell(cmd)
1127 ##Since olt config is used for this test, we just fire a careless local cmd as well
1128 os.system(cmd)
1129 finally:
1130 return
1131
A.R Karthick8a507cf2017-06-02 18:44:49 -07001132 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -07001133 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -07001134 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
1135 assert_not_equal(device_id, None)
1136 try:
1137 assert_equal(status, True)
1138 time.sleep(10)
1139 finally:
1140 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001141
A.R Karthick8a507cf2017-06-02 18:44:49 -07001142 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001143 log_test.info('Enabling ponsim_olt')
1144 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -07001145 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1146 assert_not_equal(device_id, None)
1147 try:
1148 assert_equal(status, True)
1149 time.sleep(10)
1150 finally:
1151 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001152
Thangavelu K S008f38e2017-05-15 19:36:55 +00001153 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
1154 """
1155 Test Method:
1156 0. Make sure that voltha is up and running on CORD-POD setup.
1157 1. OLT and ONU is detected and validated.
1158 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1159 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
1160 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
1161 5. Verify that subscriber is authenticated successfully.
1162 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001163 log_test.info('Enabling ponsim_olt')
1164 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1165 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1166 assert_not_equal(device_id, None)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001167 if status == False:
1168 self.voltha.disable_device(device_id, delete = True)
1169 assert_equal(status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001170 time.sleep(10)
1171 switch_map = None
1172 olt_configured = False
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001173 voltha = VolthaCtrl(self.VOLTHA_HOST,
1174 rest_port = self.VOLTHA_REST_PORT,
1175 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001176 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001177 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1178 if not switch_map:
1179 log_test.info('No voltha devices found')
1180 return
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 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001189 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001190 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001191 if switch_map is not None:
1192 if olt_configured is True:
1193 self.remove_olt(switch_map)
1194 self.voltha.disable_device(device_id, delete = True)
1195 time.sleep(10)
1196 OnosCtrl.uninstall_app(self.olt_app_name)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001197
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001198 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001199 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
1200 """
1201 Test Method:
1202 0. Make sure that voltha is up and running on CORD-POD setup.
1203 1. OLT and ONU is detected and validated.
1204 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1205 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1206 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
1207 5. Verify that subscriber authentication is unsuccessful..
1208 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001209 df = defer.Deferred()
1210 def tls_flow_check_with_no_cert_scenario(df):
1211 log_test.info('Enabling ponsim_olt')
1212 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1213 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1214 assert_not_equal(device_id, None)
1215 voltha = VolthaCtrl(self.VOLTHA_HOST,
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001216 rest_port = self.VOLTHA_REST_PORT,
1217 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001218 time.sleep(10)
1219 switch_map = None
1220 olt_configured = False
1221 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1222 log_test.info('Installing OLT app')
1223 OnosCtrl.install_app(self.olt_app_file)
1224 time.sleep(5)
1225 log_test.info('Adding subscribers through OLT app')
1226 self.config_olt(switch_map)
1227 olt_configured = True
1228 time.sleep(5)
1229 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1230 try:
1231 assert_equal(auth_status, True)
1232 assert_equal(status, True)
1233 time.sleep(10)
1234 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001235 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001236 self.voltha.disable_device(device_id, delete = True)
1237 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001238
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001239 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1240 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001241
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001242 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001243 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
1244 """
1245 Test Method:
1246 0. Make sure that voltha is up and running on CORD-POD setup.
1247 1. OLT and ONU is detected and validated.
1248 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1249 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
1250 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1251 5. Verify that subscriber authentication is unsuccessful..
1252 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001253 df = defer.Deferred()
1254 def tls_flow_check_with_invalid_cert_scenario(df):
1255 log_test.info('Enabling ponsim_olt')
1256 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1257 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1258 assert_not_equal(device_id, None)
1259 voltha = VolthaCtrl(self.VOLTHA_HOST,
1260 rest_port = self.VOLTHA_REST_PORT,
1261 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1262 time.sleep(10)
1263 switch_map = None
1264 olt_configured = False
1265 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1266 log_test.info('Installing OLT app')
1267 OnosCtrl.install_app(self.olt_app_file)
1268 time.sleep(5)
1269 log_test.info('Adding subscribers through OLT app')
1270 self.config_olt(switch_map)
1271 olt_configured = True
1272 time.sleep(5)
1273 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1274 try:
1275 assert_equal(auth_status, True)
1276 assert_equal(status, True)
1277 time.sleep(10)
1278 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001279 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001280 self.voltha.disable_device(device_id, delete = True)
1281 df.callback(0)
1282 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
1283 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001284
Thangavelu K S0d745c82017-06-09 21:56:08 +00001285 @deferred(TESTCASE_TIMEOUT)
1286 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
1287 """
1288 Test Method:
1289 0. Make sure that voltha is up and running on CORD-POD setup.
1290 1. OLT and ONU is detected and validated.
1291 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1292 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
1293 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1294 5. Verify that subscriber authentication is unsuccessful..
1295 """
1296 df = defer.Deferred()
1297 def tls_flow_check_with_no_cert_scenario(df):
1298 log_test.info('Enabling ponsim_olt')
1299 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1300 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1301 assert_not_equal(device_id, None)
1302 voltha = VolthaCtrl(self.VOLTHA_HOST,
1303 rest_port = self.VOLTHA_REST_PORT,
1304 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1305 time.sleep(10)
1306 switch_map = None
1307 olt_configured = False
1308 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1309 log_test.info('Installing OLT app')
1310 OnosCtrl.install_app(self.olt_app_file)
1311 time.sleep(5)
1312 log_test.info('Adding subscribers through OLT app')
1313 self.config_olt(switch_map)
1314 olt_configured = True
1315 time.sleep(5)
1316 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1317 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1318 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1319 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1320 try:
1321 assert_equal(auth_status, True)
1322 assert_equal(status, True)
1323 time.sleep(10)
1324 finally:
1325 self.voltha.disable_device(device_id, delete = True)
1326 df.callback(0)
1327 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1328 return df
1329
1330 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001331 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
1332 """
1333 Test Method:
1334 0. Make sure that voltha is up and running on CORD-POD setup.
1335 1. OLT and ONU is detected and validated.
1336 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1337 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1338 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
1339 5. Verify that subscriber authentication is unsuccessful..
1340 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001341 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001342 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001343 aaa_app = ["org.opencord.aaa"]
1344 log_test.info('Enabling ponsim_olt')
1345 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1346 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1347 assert_not_equal(device_id, None)
1348 voltha = VolthaCtrl(self.VOLTHA_HOST,
1349 rest_port = self.VOLTHA_REST_PORT,
1350 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1351 time.sleep(10)
1352 switch_map = None
1353 olt_configured = False
1354 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1355 log_test.info('Installing OLT app')
1356 OnosCtrl.install_app(self.olt_app_file)
1357 time.sleep(5)
1358 log_test.info('Adding subscribers through OLT app')
1359 self.config_olt(switch_map)
1360 olt_configured = True
1361 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001362
Thangavelu K S0d745c82017-06-09 21:56:08 +00001363 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
1364 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
1365 thread1.start()
1366 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001367 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001368 thread2.start()
1369 time.sleep(10)
1370 thread1.join()
1371 thread2.join()
1372 try:
1373 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001374 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001375 time.sleep(10)
1376 finally:
1377 self.voltha.disable_device(device_id, delete = True)
1378 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001379 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001380 return df
1381
1382 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001383 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
1384 """
1385 Test Method:
1386 0. Make sure that voltha is up and running on CORD-POD setup.
1387 1. OLT and ONU is detected and validated.
1388 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1389 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1390 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
1391 5. Verify that subscriber authentication is unsuccessful..
1392 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001393 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001394 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001395 aaa_app = ["org.opencord.aaa"]
1396 log_test.info('Enabling ponsim_olt')
1397 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1398 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1399 assert_not_equal(device_id, None)
1400 voltha = VolthaCtrl(self.VOLTHA_HOST,
1401 rest_port = self.VOLTHA_REST_PORT,
1402 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1403 time.sleep(10)
1404 switch_map = None
1405 olt_configured = False
1406 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1407 log_test.info('Installing OLT app')
1408 OnosCtrl.install_app(self.olt_app_file)
1409 time.sleep(5)
1410 log_test.info('Adding subscribers through OLT app')
1411 self.config_olt(switch_map)
1412 olt_configured = True
1413 time.sleep(5)
1414
1415 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
1416 thread2 = threading.Thread(target = cord_test_radius_restart)
1417 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001418 time.sleep(randint(1,2))
1419 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001420 thread2.start()
1421 time.sleep(10)
1422 thread1.join()
1423 thread2.join()
1424 try:
1425 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001426 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001427 time.sleep(10)
1428 finally:
1429 self.voltha.disable_device(device_id, delete = True)
1430 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001431 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001432 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001433
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001434 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001435 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
1436 """
1437 Test Method:
1438 0. Make sure that voltha is up and running on CORD-POD setup.
1439 1. OLT and ONU is detected and validated.
1440 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1441 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1442 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1443 6. Verify that subscriber authenticated successfully.
1444 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
1445 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1446 9. Verify that subscriber authentication is unsuccessful..
1447 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001448 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001449 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001450 aaa_app = ["org.opencord.aaa"]
1451 log_test.info('Enabling ponsim_olt')
1452 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1453 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1454 assert_not_equal(device_id, None)
1455 voltha = VolthaCtrl(self.VOLTHA_HOST,
1456 rest_port = self.VOLTHA_REST_PORT,
1457 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1458 time.sleep(10)
1459 switch_map = None
1460 olt_configured = False
1461 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1462 log_test.info('Installing OLT app')
1463 OnosCtrl.install_app(self.olt_app_file)
1464 time.sleep(5)
1465 log_test.info('Adding subscribers through OLT app')
1466 self.config_olt(switch_map)
1467 olt_configured = True
1468 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001469
Thangavelu K S0d745c82017-06-09 21:56:08 +00001470 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001471 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +00001472 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001473 time.sleep(randint(1,2))
1474 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001475 thread2.start()
1476 time.sleep(10)
1477 thread1.join()
1478 thread2.join()
1479 try:
1480 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001481 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001482 time.sleep(10)
1483 finally:
1484 self.voltha.disable_device(device_id, delete = True)
1485 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001486 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001487 return df
1488
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001489 @deferred(TESTCASE_TIMEOUT)
1490 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001491 """
1492 Test Method:
1493 0. Make sure that voltha is up and running on CORD-POD setup.
1494 1. OLT and ONU is detected and validated.
1495 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1496 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1497 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1498 6. Verify that subscriber authenticated successfully.
1499 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1500 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1501 9. Verify that subscriber authentication is unsuccessful..
1502 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001503 df = defer.Deferred()
1504 def tls_flow_check_operating_olt_state(df):
1505 aaa_app = ["org.opencord.aaa"]
1506 log_test.info('Enabling ponsim_olt')
1507 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1508 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1509 assert_not_equal(device_id, None)
1510 voltha = VolthaCtrl(self.VOLTHA_HOST,
1511 rest_port = self.VOLTHA_REST_PORT,
1512 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1513 time.sleep(10)
1514 switch_map = None
1515 olt_configured = False
1516 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1517 log_test.info('Installing OLT app')
1518 OnosCtrl.install_app(self.olt_app_file)
1519 time.sleep(5)
1520 log_test.info('Adding subscribers through OLT app')
1521 self.config_olt(switch_map)
1522 olt_configured = True
1523 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001524
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001525 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1526 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
1527 thread1.start()
1528 time.sleep(randint(1,2))
1529 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1530 thread2.start()
1531 time.sleep(10)
1532 thread1.join()
1533 thread2.join()
1534 try:
1535 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001536 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001537 time.sleep(10)
1538 finally:
1539 self.voltha.disable_device(device_id, delete = True)
1540 df.callback(0)
1541 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1542 return df
1543
1544 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001545 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self):
1546 """
1547 Test Method:
1548 0. Make sure that voltha is up and running on CORD-POD setup.
1549 1. OLT and ONU is detected and validated.
1550 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1551 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1552 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1553 6. Verify that subscriber authenticated successfully.
1554 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1555 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1556 9. Verify that subscriber authentication is unsuccessful..
1557 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1558
1559 """
1560 df = defer.Deferred()
1561 no_iterations = 10
1562 def tls_flow_check_with_disable_olt_device_scenario(df):
1563 aaa_app = ["org.opencord.aaa"]
1564 log_test.info('Enabling ponsim_olt')
1565 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1566 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1567 assert_not_equal(device_id, None)
1568 voltha = VolthaCtrl(self.VOLTHA_HOST,
1569 rest_port = self.VOLTHA_REST_PORT,
1570 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1571 time.sleep(10)
1572 switch_map = None
1573 olt_configured = False
1574 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1575 log_test.info('Installing OLT app')
1576 OnosCtrl.install_app(self.olt_app_file)
1577 time.sleep(5)
1578 log_test.info('Adding subscribers through OLT app')
1579 self.config_olt(switch_map)
1580 olt_configured = True
1581 time.sleep(5)
1582 for i in range(no_iterations):
1583 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1584 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
1585 thread1.start()
1586 time.sleep(randint(1,2))
1587 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1588 thread2.start()
1589 time.sleep(10)
1590 thread1.join()
1591 thread2.join()
1592 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
1593 try:
1594 # assert_equal(status, True)
1595 assert_equal(auth_status, True)
1596 assert_equal(self.success, True)
1597 time.sleep(10)
1598 finally:
1599 self.voltha.disable_device(device_id, delete = True)
1600 df.callback(0)
1601 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
1602 return df
1603
1604 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001605 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
1606 """
1607 Test Method:
1608 0. Make sure that voltha is up and running on CORD-POD setup.
1609 1. OLT and ONU is detected and validated.
1610 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1611 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1612 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1613 6. Verify that subscriber authenticated successfully.
1614 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
1615 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1616 9. Verify that subscriber authentication is unsuccessful..
1617 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001618 df = defer.Deferred()
1619 def tls_flow_check_operating_olt_state(df):
1620 aaa_app = ["org.opencord.aaa"]
1621 log_test.info('Enabling ponsim_olt')
1622 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1623 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1624 assert_not_equal(device_id, None)
1625 voltha = VolthaCtrl(self.VOLTHA_HOST,
1626 rest_port = self.VOLTHA_REST_PORT,
1627 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1628 time.sleep(10)
1629 switch_map = None
1630 olt_configured = False
1631 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1632 log_test.info('Installing OLT app')
1633 OnosCtrl.install_app(self.olt_app_file)
1634 time.sleep(5)
1635 log_test.info('Adding subscribers through OLT app')
1636 self.config_olt(switch_map)
1637 olt_configured = True
1638 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001639
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001640 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
1641 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
1642 thread1.start()
1643 time.sleep(randint(1,2))
1644 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
1645 thread2.start()
1646 time.sleep(10)
1647 thread1.join()
1648 thread2.join()
1649 try:
1650 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001651 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001652 time.sleep(10)
1653 finally:
1654 self.voltha.disable_device(device_id, delete = True)
1655 df.callback(0)
1656 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1657 return df
1658
1659 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00001660 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self):
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001661 """
1662 Test Method:
1663 0. Make sure that voltha is up and running on CORD-POD setup.
1664 1. OLT and ONU is detected and validated.
1665 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1666 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1667 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1668 6. Verify that subscriber authenticated successfully.
1669 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
1670 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1671 9. Verify that subscriber authentication is unsuccessful..
1672 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1673 """
1674 df = defer.Deferred()
1675 no_iterations = 10
1676 def tls_flow_check_with_disable_olt_device_scenario(df):
1677 aaa_app = ["org.opencord.aaa"]
1678 log_test.info('Enabling ponsim_olt')
1679 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1680 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1681 assert_not_equal(device_id, None)
1682 voltha = VolthaCtrl(self.VOLTHA_HOST,
1683 rest_port = self.VOLTHA_REST_PORT,
1684 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1685 time.sleep(10)
1686 switch_map = None
1687 olt_configured = False
1688 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1689 log_test.info('Installing OLT app')
1690 OnosCtrl.install_app(self.olt_app_file)
1691 time.sleep(5)
1692 log_test.info('Adding subscribers through OLT app')
1693 self.config_olt(switch_map)
1694 olt_configured = True
1695 time.sleep(5)
1696 for i in range(no_iterations):
1697 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
1698 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
1699 thread1.start()
1700 time.sleep(randint(1,2))
1701 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
1702 thread2.start()
1703 time.sleep(10)
1704 thread1.join()
1705 thread2.join()
1706 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
1707 try:
1708 # assert_equal(status, True)
1709 assert_equal(auth_status, True)
1710 assert_equal(self.success, True)
1711 time.sleep(10)
1712 finally:
1713 self.voltha.disable_device(device_id, delete = True)
1714 df.callback(0)
1715 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
1716 return df
1717
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001718 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001719 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
1720 """
1721 Test Method:
1722 0. Make sure that voltha is up and running on CORD-POD setup.
1723 1. OLT and ONU is detected and validated.
1724 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1725 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1726 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1727 6. Verify that subscriber authenticated successfully.
1728 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
1729 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1730 9. Verify that subscriber authentication is unsuccessful..
1731 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001732 df = defer.Deferred()
1733 def tls_flow_check_operating_olt_state(df):
1734 aaa_app = ["org.opencord.aaa"]
1735 log_test.info('Enabling ponsim_olt')
1736 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1737 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1738 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00001739 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1740
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001741 onu_device_id = devices_list['items'][1]['id']
1742 assert_not_equal(device_id, None)
1743 voltha = VolthaCtrl(self.VOLTHA_HOST,
1744 rest_port = self.VOLTHA_REST_PORT,
1745 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1746 time.sleep(10)
1747 switch_map = None
1748 olt_configured = False
1749 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1750 log_test.info('Installing OLT app')
1751 OnosCtrl.install_app(self.olt_app_file)
1752 time.sleep(5)
1753 log_test.info('Adding subscribers through OLT app')
1754 self.config_olt(switch_map)
1755 olt_configured = True
1756 time.sleep(5)
1757 devices_list = self.voltha.get_devices()
1758 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
1759 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
1760 thread1.start()
1761 time.sleep(randint(1,2))
1762 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
1763 thread2.start()
1764 time.sleep(10)
1765 thread1.join()
1766 thread2.join()
1767 try:
1768 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001769 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001770 time.sleep(10)
1771 finally:
1772 self.voltha.disable_device(device_id, delete = True)
1773 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001774 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001775 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001776
Thangavelu K S9648eed2017-06-13 20:15:25 +00001777 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001778 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
1779 """
1780 Test Method:
1781 0. Make sure that voltha is up and running on CORD-POD setup.
1782 1. OLT and ONU is detected and validated.
1783 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1784 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1785 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1786 6. Verify that subscriber authenticated successfully.
1787 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
1788 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1789 9. Verify that subscriber authentication is unsuccessful..
1790 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1791 """
1792 df = defer.Deferred()
1793 no_iterations = 10
1794 def tls_flow_check_operating_olt_state(df):
1795 aaa_app = ["org.opencord.aaa"]
1796 log_test.info('Enabling ponsim_olt')
1797 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1798 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1799 devices_list = self.voltha.get_devices()
1800 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1801
1802 onu_device_id = devices_list['items'][1]['id']
1803 assert_not_equal(device_id, None)
1804 voltha = VolthaCtrl(self.VOLTHA_HOST,
1805 rest_port = self.VOLTHA_REST_PORT,
1806 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1807 time.sleep(10)
1808 switch_map = None
1809 olt_configured = False
1810 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1811 log_test.info('Installing OLT app')
1812 OnosCtrl.install_app(self.olt_app_file)
1813 time.sleep(5)
1814 log_test.info('Adding subscribers through OLT app')
1815 self.config_olt(switch_map)
1816 olt_configured = True
1817 time.sleep(5)
1818 devices_list = self.voltha.get_devices()
1819 for i in range(no_iterations):
1820 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
1821 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
1822 thread1.start()
1823 time.sleep(randint(1,2))
1824 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
1825 thread2.start()
1826 time.sleep(10)
1827 thread1.join()
1828 thread2.join()
1829 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
1830 try:
1831 # assert_equal(status, True)
1832 assert_equal(auth_status, True)
1833 assert_equal(self.success, True)
1834 time.sleep(10)
1835 finally:
1836 self.voltha.disable_device(device_id, delete = True)
1837 df.callback(0)
1838 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1839 return df
1840
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001841 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00001842 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001843 """
1844 Test Method:
1845 0. Make sure that voltha is up and running on CORD-POD setup.
1846 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1847 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1848 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1849 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
1850 5. Verify that two subscribers are authenticated successfully.
1851 """
1852
Thangavelu K S9648eed2017-06-13 20:15:25 +00001853 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001854 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00001855 aaa_app = ["org.opencord.aaa"]
1856 log_test.info('Enabling ponsim_olt')
1857 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1858 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1859 devices_list = self.voltha.get_devices()
1860 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1861
1862 onu_device_id = devices_list['items'][1]['id']
1863 assert_not_equal(device_id, None)
1864 voltha = VolthaCtrl(self.VOLTHA_HOST,
1865 rest_port = self.VOLTHA_REST_PORT,
1866 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1867 time.sleep(10)
1868 switch_map = None
1869 olt_configured = False
1870 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1871 log_test.info('Installing OLT app')
1872 OnosCtrl.install_app(self.olt_app_file)
1873 time.sleep(5)
1874 log_test.info('Adding subscribers through OLT app')
1875 self.config_olt(switch_map)
1876 olt_configured = True
1877 time.sleep(5)
1878 devices_list = self.voltha.get_devices()
1879 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1880 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
1881 thread1.start()
1882 time.sleep(randint(1,2))
1883 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1884 thread2.start()
1885 time.sleep(10)
1886 thread1.join()
1887 thread2.join()
1888 try:
1889 # assert_equal(status, True)
1890 assert_equal(self.success, True)
1891 time.sleep(10)
1892 finally:
1893 self.voltha.disable_device(device_id, delete = True)
1894 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001895 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001896 return df
1897
1898 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00001899 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001900 """
1901 Test Method:
1902 0. Make sure that voltha is up and running on CORD-POD setup.
1903 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1904 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1905 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1906 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
1907 5. Verify that two subscribers are not authenticated.
1908 """
1909
Thangavelu K S9648eed2017-06-13 20:15:25 +00001910 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001911 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00001912 aaa_app = ["org.opencord.aaa"]
1913 log_test.info('Enabling ponsim_olt')
1914 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1915 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1916 devices_list = self.voltha.get_devices()
1917 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1918
1919 onu_device_id = devices_list['items'][1]['id']
1920 assert_not_equal(device_id, None)
1921 voltha = VolthaCtrl(self.VOLTHA_HOST,
1922 rest_port = self.VOLTHA_REST_PORT,
1923 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1924 time.sleep(10)
1925 switch_map = None
1926 olt_configured = False
1927 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1928 log_test.info('Installing OLT app')
1929 OnosCtrl.install_app(self.olt_app_file)
1930 time.sleep(5)
1931 log_test.info('Adding subscribers through OLT app')
1932 self.config_olt(switch_map)
1933 olt_configured = True
1934 time.sleep(5)
1935 devices_list = self.voltha.get_devices()
1936 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1937 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
1938 thread1.start()
1939 time.sleep(randint(1,2))
1940 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
1941 thread2.start()
1942 time.sleep(10)
1943 thread1.join()
1944 thread2.join()
1945 try:
1946 # assert_equal(status, True)
1947 assert_equal(self.success, True)
1948 time.sleep(10)
1949 finally:
1950 self.voltha.disable_device(device_id, delete = True)
1951 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001952 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001953 return df
1954
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001955 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00001956 def test_two_subscribers_with_voltha_for_eap_tls_authentication_initiating_invalid_tls_packets_for_one_subscriber(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001957 """
1958 Test Method:
1959 0. Make sure that voltha is up and running on CORD-POD setup.
1960 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
1961 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1962 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1963 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
1964 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
1965 6. Verify that valid subscriber authenticated successfully.
1966 7. Verify that invalid subscriber are not authenticated successfully.
1967 """
1968
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001969 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001970 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00001971 aaa_app = ["org.opencord.aaa"]
1972 log_test.info('Enabling ponsim_olt')
1973 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1974 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1975 devices_list = self.voltha.get_devices()
1976 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1977
1978 onu_device_id = devices_list['items'][1]['id']
1979 assert_not_equal(device_id, None)
1980 voltha = VolthaCtrl(self.VOLTHA_HOST,
1981 rest_port = self.VOLTHA_REST_PORT,
1982 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1983 time.sleep(10)
1984 switch_map = None
1985 olt_configured = False
1986 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1987 log_test.info('Installing OLT app')
1988 OnosCtrl.install_app(self.olt_app_file)
1989 time.sleep(5)
1990 log_test.info('Adding subscribers through OLT app')
1991 self.config_olt(switch_map)
1992 olt_configured = True
1993 time.sleep(5)
1994 devices_list = self.voltha.get_devices()
1995 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
1996 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
1997 thread1.start()
1998 time.sleep(randint(1,2))
1999 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2000 thread2.start()
2001 time.sleep(10)
2002 thread1.join()
2003 thread2.join()
2004 try:
2005 # assert_equal(status, True)
2006 assert_equal(self.success, True)
2007 time.sleep(10)
2008 finally:
2009 self.voltha.disable_device(device_id, delete = True)
2010 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002011 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002012 return df
2013
2014 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002015 def test_two_subscribers_with_voltha_for_eap_tls_authentication_initiating_invalid_cert_for_one_subscriber(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002016 """
2017 Test Method:
2018 0. Make sure that voltha is up and running on CORD-POD setup.
2019 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2020 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2021 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2022 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2023 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
2024 6. Verify that valid subscriber authenticated successfully.
2025 7. Verify that invalid subscriber are not authenticated successfully.
2026 """
2027
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002028 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002029 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002030 aaa_app = ["org.opencord.aaa"]
2031 log_test.info('Enabling ponsim_olt')
2032 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2033 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2034 devices_list = self.voltha.get_devices()
2035 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2036
2037 onu_device_id = devices_list['items'][1]['id']
2038 assert_not_equal(device_id, None)
2039 voltha = VolthaCtrl(self.VOLTHA_HOST,
2040 rest_port = self.VOLTHA_REST_PORT,
2041 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2042 time.sleep(10)
2043 switch_map = None
2044 olt_configured = False
2045 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2046 log_test.info('Installing OLT app')
2047 OnosCtrl.install_app(self.olt_app_file)
2048 time.sleep(5)
2049 log_test.info('Adding subscribers through OLT app')
2050 self.config_olt(switch_map)
2051 olt_configured = True
2052 time.sleep(5)
2053 devices_list = self.voltha.get_devices()
2054 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2055 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
2056 thread1.start()
2057 time.sleep(randint(1,2))
2058 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2059 thread2.start()
2060 time.sleep(10)
2061 thread1.join()
2062 thread2.join()
2063 try:
2064 # assert_equal(status, True)
2065 assert_equal(self.success, True)
2066 time.sleep(10)
2067 finally:
2068 self.voltha.disable_device(device_id, delete = True)
2069 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002070 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002071 return df
2072
2073 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002074 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002075 """
2076 Test Method:
2077 0. Make sure that voltha is up and running on CORD-POD setup.
2078 1. OLT and ONU is detected and validated.
2079 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2080 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2081 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
2082 6. Verify that subscriber authenticated successfully.
2083 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
2084 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
2085 9. Verify that subscriber authentication is unsuccessful..
2086 10. Verify that other subscriber authenticated successfully.
2087 """
2088
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002089 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002090 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002091 aaa_app = ["org.opencord.aaa"]
2092 log_test.info('Enabling ponsim_olt')
2093 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2094 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2095 devices_list = self.voltha.get_devices()
2096 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2097
2098 onu_device_id = devices_list['items'][1]['id']
2099 assert_not_equal(device_id, None)
2100 voltha = VolthaCtrl(self.VOLTHA_HOST,
2101 rest_port = self.VOLTHA_REST_PORT,
2102 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2103 time.sleep(10)
2104 switch_map = None
2105 olt_configured = False
2106 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2107 log_test.info('Installing OLT app')
2108 OnosCtrl.install_app(self.olt_app_file)
2109 time.sleep(5)
2110 log_test.info('Adding subscribers through OLT app')
2111 self.config_olt(switch_map)
2112 olt_configured = True
2113 time.sleep(5)
2114 devices_list = self.voltha.get_devices()
2115 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2116 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
2117 thread1.start()
2118 time.sleep(randint(1,2))
2119 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2120 thread2.start()
2121 time.sleep(10)
2122 thread1.join()
2123 thread2.join()
2124 try:
2125 # assert_equal(status, True)
2126 assert_equal(self.success, True)
2127 time.sleep(10)
2128 finally:
2129 self.voltha.disable_device(device_id, delete = True)
2130 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002131 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002132 return df
2133
Thangavelu K S36edb012017-07-05 18:24:12 +00002134 def test_3_subscribers_with_voltha_for_eap_tls_authentication(self):
2135 """
2136 Test Method:
2137 0. Make sure that voltha is up and running on CORD-POD setup.
2138 1. OLT and ONU is detected and validated.
2139 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2140 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers)
2141 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2142 5. Verify that subscriber is authenticated successfully.
2143 """
2144 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2145 num_subscribers = 3
2146 num_channels = 1
2147 services = ('TLS')
2148 cbs = (self.tls_flow_check, None, None)
2149 self.voltha_subscribers(services, cbs = cbs,
2150 num_subscribers = num_subscribers,
2151 num_channels = num_channels)
2152
2153 def test_5_subscribers_with_voltha_for_eap_tls_authentication(self):
2154 """
2155 Test Method:
2156 0. Make sure that voltha is up and running on CORD-POD setup.
2157 1. OLT and ONU is detected and validated.
2158 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2159 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber)
2160 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2161 5. Verify that subscriber is authenticated successfully.
2162 """
2163 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2164 num_subscribers = 5
2165 num_channels = 1
2166 services = ('TLS')
2167 cbs = (self.tls_flow_check, None, None)
2168 self.voltha_subscribers(services, cbs = cbs,
2169 num_subscribers = num_subscribers,
2170 num_channels = num_channels)
2171
2172 def test_9_subscribers_with_voltha_for_eap_tls_authentication(self):
2173 """
2174 Test Method:
2175 0. Make sure that voltha is up and running on CORD-POD setup.
2176 1. OLT and ONU is detected and validated.
2177 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2178 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber)
2179 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2180 5. Verify that subscriber is authenticated successfully.
2181 """
2182 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2183 num_subscribers = 9
2184 num_channels = 1
2185 services = ('TLS')
2186 cbs = (self.tls_flow_check, None, None)
2187 self.voltha_subscribers(services, cbs = cbs,
2188 num_subscribers = num_subscribers,
2189 num_channels = num_channels)
2190
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002191 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002192 def test_subscriber_with_voltha_for_dhcp_request(self):
2193 """
2194 Test Method:
2195 0. Make sure that voltha is up and running on CORD-POD setup.
2196 1. OLT and ONU is detected and validated.
2197 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2198 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2199 4. Verify that subscriber get ip from dhcp server successfully.
2200 """
2201
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002202 df = defer.Deferred()
2203 def dhcp_flow_check_scenario(df):
2204 log_test.info('Enabling ponsim_olt')
2205 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2206 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2207 assert_not_equal(device_id, None)
2208 voltha = VolthaCtrl(self.VOLTHA_HOST,
2209 rest_port = self.VOLTHA_REST_PORT,
2210 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2211 time.sleep(10)
2212 switch_map = None
2213 olt_configured = False
2214 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2215 log_test.info('Installing OLT app')
2216 OnosCtrl.install_app(self.olt_app_file)
2217 time.sleep(5)
2218 log_test.info('Adding subscribers through OLT app')
2219 self.config_olt(switch_map)
2220 olt_configured = True
2221 time.sleep(5)
2222 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2223 try:
2224 assert_equal(dhcp_status, True)
2225 #assert_equal(status, True)
2226 time.sleep(10)
2227 finally:
2228 self.remove_olt(switch_map)
2229 self.voltha.disable_device(device_id, delete = True)
2230 df.callback(0)
2231
2232 reactor.callLater(0, dhcp_flow_check_scenario, df)
2233 return df
2234
2235 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002236 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
2237 """
2238 Test Method:
2239 0. Make sure that voltha is up and running on CORD-POD setup.
2240 1. OLT and ONU is detected and validated.
2241 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2242 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
2243 4. Verify that subscriber should not get ip from dhcp server.
2244 """
2245
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002246 df = defer.Deferred()
2247 def dhcp_flow_check_scenario(df):
2248 log_test.info('Enabling ponsim_olt')
2249 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2250 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2251 assert_not_equal(device_id, None)
2252 voltha = VolthaCtrl(self.VOLTHA_HOST,
2253 rest_port = self.VOLTHA_REST_PORT,
2254 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2255 time.sleep(10)
2256 switch_map = None
2257 olt_configured = False
2258 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2259 log_test.info('Installing OLT app')
2260 OnosCtrl.install_app(self.olt_app_file)
2261 time.sleep(5)
2262 log_test.info('Adding subscribers through OLT app')
2263 self.config_olt(switch_map)
2264 olt_configured = True
2265 time.sleep(5)
2266 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
2267 try:
2268 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002269 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002270 #assert_equal(status, True)
2271 time.sleep(10)
2272 finally:
2273 self.voltha.disable_device(device_id, delete = True)
2274 self.remove_olt(switch_map)
2275 df.callback(0)
2276
2277 reactor.callLater(0, dhcp_flow_check_scenario, df)
2278 return df
2279
2280
2281 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002282 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
2283 """
2284 Test Method:
2285 0. Make sure that voltha is up and running on CORD-POD setup.
2286 1. OLT and ONU is detected and validated.
2287 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2288 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
2289 4. Verify that subscriber should not get ip from dhcp server.
2290 """
2291
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002292 df = defer.Deferred()
2293 def dhcp_flow_check_scenario(df):
2294 log_test.info('Enabling ponsim_olt')
2295 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2296 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2297 assert_not_equal(device_id, None)
2298 voltha = VolthaCtrl(self.VOLTHA_HOST,
2299 rest_port = self.VOLTHA_REST_PORT,
2300 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2301 time.sleep(10)
2302 switch_map = None
2303 olt_configured = False
2304 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2305 log_test.info('Installing OLT app')
2306 OnosCtrl.install_app(self.olt_app_file)
2307 time.sleep(5)
2308 log_test.info('Adding subscribers through OLT app')
2309 self.config_olt(switch_map)
2310 olt_configured = True
2311 time.sleep(5)
2312 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
2313 try:
2314 assert_equal(dhcp_status, True)
2315 #assert_equal(status, True)
2316 time.sleep(10)
2317 finally:
2318 self.voltha.disable_device(device_id, delete = True)
2319 self.remove_olt(switch_map)
2320 df.callback(0)
2321
2322 reactor.callLater(0, dhcp_flow_check_scenario, df)
2323 return df
2324
2325 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002326 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
2327 """
2328 Test Method:
2329 0. Make sure that voltha is up and running on CORD-POD setup.
2330 1. OLT and ONU is detected and validated.
2331 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2332 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
2333 4. Verify that subscriber should not get ip from dhcp server.
2334 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002335 df = defer.Deferred()
2336 def dhcp_flow_check_scenario(df):
2337 log_test.info('Enabling ponsim_olt')
2338 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2339 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2340 assert_not_equal(device_id, None)
2341 voltha = VolthaCtrl(self.VOLTHA_HOST,
2342 rest_port = self.VOLTHA_REST_PORT,
2343 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2344 time.sleep(10)
2345 switch_map = None
2346 olt_configured = False
2347 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2348 log_test.info('Installing OLT app')
2349 OnosCtrl.install_app(self.olt_app_file)
2350 time.sleep(5)
2351 log_test.info('Adding subscribers through OLT app')
2352 self.config_olt(switch_map)
2353 olt_configured = True
2354 time.sleep(5)
2355 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
2356 try:
2357 assert_equal(dhcp_status, True)
2358 #assert_equal(status, True)
2359 time.sleep(10)
2360 finally:
2361 self.voltha.disable_device(device_id, delete = True)
2362 self.remove_olt(switch_map)
2363 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002364
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002365 reactor.callLater(0, dhcp_flow_check_scenario, df)
2366 return df
2367
2368 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002369 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
2370 """
2371 Test Method:
2372 0. Make sure that voltha is up and running on CORD-POD setup.
2373 1. OLT and ONU is detected and validated.
2374 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2375 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2376 4. Verify that subscriber get ip from dhcp server successfully.
2377 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
2378 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
2379 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002380 df = defer.Deferred()
2381 def dhcp_flow_check_scenario(df):
2382 log_test.info('Enabling ponsim_olt')
2383 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2384 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2385 assert_not_equal(device_id, None)
2386 voltha = VolthaCtrl(self.VOLTHA_HOST,
2387 rest_port = self.VOLTHA_REST_PORT,
2388 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2389 time.sleep(10)
2390 switch_map = None
2391 olt_configured = False
2392 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2393 log_test.info('Installing OLT app')
2394 OnosCtrl.install_app(self.olt_app_file)
2395 time.sleep(5)
2396 log_test.info('Adding subscribers through OLT app')
2397 self.config_olt(switch_map)
2398 olt_configured = True
2399 time.sleep(5)
2400 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
2401 try:
2402 assert_equal(dhcp_status, True)
2403 #assert_equal(status, True)
2404 time.sleep(10)
2405 finally:
2406 self.voltha.disable_device(device_id, delete = True)
2407 self.remove_olt(switch_map)
2408 df.callback(0)
2409
2410 reactor.callLater(0, dhcp_flow_check_scenario, df)
2411 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002412
Thangavelu K S735a6662017-06-15 18:08:23 +00002413
2414 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07002415 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002416 """
2417 Test Method:
2418 0. Make sure that voltha is up and running on CORD-POD setup.
2419 1. OLT and ONU is detected and validated.
2420 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2421 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2422 4. Verify that subscriber get ip from dhcp server successfully.
2423 5. Repeat step 3 and 4 for 10 times.
2424 6 Verify that subscriber should get ip from dhcp server.
2425 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002426 df = defer.Deferred()
2427 def dhcp_flow_check_scenario(df):
2428 log_test.info('Enabling ponsim_olt')
2429 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2430 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2431 assert_not_equal(device_id, None)
2432 voltha = VolthaCtrl(self.VOLTHA_HOST,
2433 rest_port = self.VOLTHA_REST_PORT,
2434 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2435 time.sleep(10)
2436 switch_map = None
2437 olt_configured = False
2438 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2439 log_test.info('Installing OLT app')
2440 OnosCtrl.install_app(self.olt_app_file)
2441 time.sleep(5)
2442 log_test.info('Adding subscribers through OLT app')
2443 self.config_olt(switch_map)
2444 olt_configured = True
2445 time.sleep(5)
2446 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
2447 try:
2448 assert_equal(dhcp_status, True)
2449 #assert_equal(status, True)
2450 time.sleep(10)
2451 finally:
2452 self.voltha.disable_device(device_id, delete = True)
2453 self.remove_olt(switch_map)
2454 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002455
Thangavelu K S735a6662017-06-15 18:08:23 +00002456 reactor.callLater(0, dhcp_flow_check_scenario, df)
2457 return df
2458
Thangavelu K S735a6662017-06-15 18:08:23 +00002459 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002460 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
2461 """
2462 Test Method:
2463 0. Make sure that voltha is up and running on CORD-POD setup.
2464 1. OLT and ONU is detected and validated.
2465 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2466 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
2467 4. Verify that subscriber should not get ip from dhcp server.
2468 5. Repeat steps 3 and 4 for 10 times.
2469 6 Verify that subscriber should not get ip from dhcp server.
2470 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002471 df = defer.Deferred()
2472 def dhcp_flow_check_scenario(df):
2473 log_test.info('Enabling ponsim_olt')
2474 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2475 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2476 assert_not_equal(device_id, None)
2477 voltha = VolthaCtrl(self.VOLTHA_HOST,
2478 rest_port = self.VOLTHA_REST_PORT,
2479 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2480 time.sleep(10)
2481 switch_map = None
2482 olt_configured = False
2483 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2484 log_test.info('Installing OLT app')
2485 OnosCtrl.install_app(self.olt_app_file)
2486 time.sleep(5)
2487 log_test.info('Adding subscribers through OLT app')
2488 self.config_olt(switch_map)
2489 olt_configured = True
2490 time.sleep(5)
2491 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
2492 try:
2493 assert_equal(dhcp_status, True)
2494 #assert_equal(status, True)
2495 time.sleep(10)
2496 finally:
2497 self.voltha.disable_device(device_id, delete = True)
2498 self.remove_olt(switch_map)
2499 df.callback(0)
2500
2501 reactor.callLater(0, dhcp_flow_check_scenario, df)
2502 return df
2503
Thangavelu K S735a6662017-06-15 18:08:23 +00002504 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002505 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
2506 """
2507 Test Method:
2508 0. Make sure that voltha is up and running on CORD-POD setup.
2509 1. OLT and ONU is detected and validated.
2510 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2511 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2512 4. Verify that subscriber get ip from dhcp server successfully.
2513 5. Repeat step 3 for 50 times.
2514 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2515 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002516 df = defer.Deferred()
2517 def dhcp_flow_check_scenario(df):
2518 log_test.info('Enabling ponsim_olt')
2519 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2520 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2521 assert_not_equal(device_id, None)
2522 voltha = VolthaCtrl(self.VOLTHA_HOST,
2523 rest_port = self.VOLTHA_REST_PORT,
2524 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2525 time.sleep(10)
2526 switch_map = None
2527 olt_configured = False
2528 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2529 log_test.info('Installing OLT app')
2530 OnosCtrl.install_app(self.olt_app_file)
2531 time.sleep(5)
2532 log_test.info('Adding subscribers through OLT app')
2533 self.config_olt(switch_map)
2534 olt_configured = True
2535 time.sleep(5)
2536 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
2537 try:
2538 assert_equal(dhcp_status, True)
2539 #assert_equal(status, True)
2540 time.sleep(10)
2541 finally:
2542 self.voltha.disable_device(device_id, delete = True)
2543 self.remove_olt(switch_map)
2544 df.callback(0)
2545
2546 reactor.callLater(0, dhcp_flow_check_scenario, df)
2547 return df
2548
Thangavelu K S735a6662017-06-15 18:08:23 +00002549 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002550 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
2551 """
2552 Test Method:
2553 0. Make sure that voltha is up and running on CORD-POD setup.
2554 1. OLT and ONU is detected and validated.
2555 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2556 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2557 4. Verify that subscriber get ip from dhcp server successfully.
2558 5. Send DHCP request to dhcp server which is running as onos app.
2559 6. Repeat step 5 for 50 times.
2560 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2561 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002562 df = defer.Deferred()
2563 def dhcp_flow_check_scenario(df):
2564 log_test.info('Enabling ponsim_olt')
2565 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2566 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2567 assert_not_equal(device_id, None)
2568 voltha = VolthaCtrl(self.VOLTHA_HOST,
2569 rest_port = self.VOLTHA_REST_PORT,
2570 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2571 time.sleep(10)
2572 switch_map = None
2573 olt_configured = False
2574 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2575 log_test.info('Installing OLT app')
2576 OnosCtrl.install_app(self.olt_app_file)
2577 time.sleep(5)
2578 log_test.info('Adding subscribers through OLT app')
2579 self.config_olt(switch_map)
2580 olt_configured = True
2581 time.sleep(5)
2582 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
2583 try:
2584 assert_equal(dhcp_status, True)
2585 #assert_equal(status, True)
2586 time.sleep(10)
2587 finally:
2588 self.voltha.disable_device(device_id, delete = True)
2589 self.remove_olt(switch_map)
2590 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002591
Thangavelu K S735a6662017-06-15 18:08:23 +00002592 reactor.callLater(0, dhcp_flow_check_scenario, df)
2593 return df
2594
Thangavelu K S735a6662017-06-15 18:08:23 +00002595 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002596 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
2597 """
2598 Test Method:
2599 0. Make sure that voltha is up and running on CORD-POD setup.
2600 1. OLT and ONU is detected and validated.
2601 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2602 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
2603 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
2604 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002605 df = defer.Deferred()
2606 def dhcp_flow_check_scenario(df):
2607 log_test.info('Enabling ponsim_olt')
2608 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2609 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2610 assert_not_equal(device_id, None)
2611 voltha = VolthaCtrl(self.VOLTHA_HOST,
2612 rest_port = self.VOLTHA_REST_PORT,
2613 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2614 time.sleep(10)
2615 switch_map = None
2616 olt_configured = False
2617 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2618 log_test.info('Installing OLT app')
2619 OnosCtrl.install_app(self.olt_app_file)
2620 time.sleep(5)
2621 log_test.info('Adding subscribers through OLT app')
2622 self.config_olt(switch_map)
2623 olt_configured = True
2624 time.sleep(5)
2625 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
2626 try:
2627 assert_equal(dhcp_status, True)
2628 #assert_equal(status, True)
2629 time.sleep(10)
2630 finally:
2631 self.voltha.disable_device(device_id, delete = True)
2632 self.remove_olt(switch_map)
2633 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002634
Thangavelu K S735a6662017-06-15 18:08:23 +00002635 reactor.callLater(0, dhcp_flow_check_scenario, df)
2636 return df
2637
2638 @deferred(TESTCASE_TIMEOUT)
2639 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002640 """
2641 Test Method:
2642 0. Make sure that voltha is up and running on CORD-POD setup.
2643 1. OLT and ONU is detected and validated.
2644 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2645 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
2646 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.
2647 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002648 df = defer.Deferred()
2649 def dhcp_flow_check_scenario(df):
2650 log_test.info('Enabling ponsim_olt')
2651 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2652 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2653 assert_not_equal(device_id, None)
2654 voltha = VolthaCtrl(self.VOLTHA_HOST,
2655 rest_port = self.VOLTHA_REST_PORT,
2656 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2657 time.sleep(10)
2658 switch_map = None
2659 olt_configured = False
2660 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2661 log_test.info('Installing OLT app')
2662 OnosCtrl.install_app(self.olt_app_file)
2663 time.sleep(5)
2664 log_test.info('Adding subscribers through OLT app')
2665 self.config_olt(switch_map)
2666 olt_configured = True
2667 time.sleep(5)
2668 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
2669 try:
2670 assert_equal(dhcp_status, True)
2671 #assert_equal(status, True)
2672 time.sleep(10)
2673 finally:
2674 self.voltha.disable_device(device_id, delete = True)
2675 self.remove_olt(switch_map)
2676 df.callback(0)
2677
2678 reactor.callLater(0, dhcp_flow_check_scenario, df)
2679 return df
2680
Thangavelu K S735a6662017-06-15 18:08:23 +00002681 @deferred(TESTCASE_TIMEOUT)
2682 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002683 """
2684 Test Method:
2685 0. Make sure that voltha is up and running on CORD-POD setup.
2686 1. OLT and ONU is detected and validated.
2687 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2688 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2689 4. Verify that subscriber get ip from dhcp server successfully.
2690 5. Deactivate dhcp server app in onos.
2691 6. Repeat step 3.
2692 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2693 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002694 df = defer.Deferred()
2695 dhcp_app = 'org.onosproject.dhcp'
2696 def dhcp_flow_check_scenario(df):
2697 log_test.info('Enabling ponsim_olt')
2698 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2699 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2700 assert_not_equal(device_id, None)
2701 voltha = VolthaCtrl(self.VOLTHA_HOST,
2702 rest_port = self.VOLTHA_REST_PORT,
2703 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2704 time.sleep(10)
2705 switch_map = None
2706 olt_configured = False
2707 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2708 log_test.info('Installing OLT app')
2709 OnosCtrl.install_app(self.olt_app_file)
2710 time.sleep(5)
2711 log_test.info('Adding subscribers through OLT app')
2712 self.config_olt(switch_map)
2713 olt_configured = True
2714 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002715 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00002716 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
2717 log_test.info('Restart dhcp app in onos during client send discover to voltha')
2718 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00002719 thread1.start()
2720 time.sleep(10)
2721 thread1.join()
2722 thread2.join()
2723 try:
2724 assert_equal(self.success, True)
2725 #assert_equal(status, True)
2726 time.sleep(10)
2727 finally:
2728 self.voltha.disable_device(device_id, delete = True)
2729 self.remove_olt(switch_map)
2730 df.callback(0)
2731
2732 reactor.callLater(0, dhcp_flow_check_scenario, df)
2733 return df
2734
2735 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002736 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
2737 """
2738 Test Method:
2739 0. Make sure that voltha is up and running on CORD-POD setup.
2740 1. OLT and ONU is detected and validated.
2741 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2742 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2743 4. Verify that subscriber get ip from dhcp server successfully.
2744 5. Send dhcp renew packet to dhcp server which is running as onos app.
2745 6. Repeat step 4.
2746 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002747
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002748 df = defer.Deferred()
2749 def dhcp_flow_check_scenario(df):
2750 log_test.info('Enabling ponsim_olt')
2751 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2752 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2753 assert_not_equal(device_id, None)
2754 voltha = VolthaCtrl(self.VOLTHA_HOST,
2755 rest_port = self.VOLTHA_REST_PORT,
2756 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2757 time.sleep(10)
2758 switch_map = None
2759 olt_configured = False
2760 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2761 log_test.info('Installing OLT app')
2762 OnosCtrl.install_app(self.olt_app_file)
2763 time.sleep(5)
2764 log_test.info('Adding subscribers through OLT app')
2765 self.config_olt(switch_map)
2766 olt_configured = True
2767 time.sleep(5)
2768 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
2769 try:
2770 assert_equal(dhcp_status, True)
2771 #assert_equal(status, True)
2772 time.sleep(10)
2773 finally:
2774 self.voltha.disable_device(device_id, delete = True)
2775 self.remove_olt(switch_map)
2776 df.callback(0)
2777
2778 reactor.callLater(0, dhcp_flow_check_scenario, df)
2779 return df
2780
2781 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002782 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
2783 """
2784 Test Method:
2785 0. Make sure that voltha is up and running on CORD-POD setup.
2786 1. OLT and ONU is detected and validated.
2787 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2788 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2789 4. Verify that subscriber get ip from dhcp server successfully.
2790 5. Send dhcp rebind packet to dhcp server which is running as onos app.
2791 6. Repeat step 4.
2792 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002793 df = defer.Deferred()
2794 def dhcp_flow_check_scenario(df):
2795 log_test.info('Enabling ponsim_olt')
2796 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2797 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2798 assert_not_equal(device_id, None)
2799 voltha = VolthaCtrl(self.VOLTHA_HOST,
2800 rest_port = self.VOLTHA_REST_PORT,
2801 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2802 time.sleep(10)
2803 switch_map = None
2804 olt_configured = False
2805 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2806 log_test.info('Installing OLT app')
2807 OnosCtrl.install_app(self.olt_app_file)
2808 time.sleep(5)
2809 log_test.info('Adding subscribers through OLT app')
2810 self.config_olt(switch_map)
2811 olt_configured = True
2812 time.sleep(5)
2813 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
2814 try:
2815 assert_equal(dhcp_status, True)
2816 #assert_equal(status, True)
2817 time.sleep(10)
2818 finally:
2819 self.voltha.disable_device(device_id, delete = True)
2820 self.remove_olt(switch_map)
2821 df.callback(0)
2822
2823 reactor.callLater(0, dhcp_flow_check_scenario, df)
2824 return df
2825
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002826 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002827 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002828 """
2829 Test Method:
2830 0. Make sure that voltha is up and running on CORD-POD setup.
2831 1. OLT and ONU is detected and validated.
2832 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2833 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2834 4. Verify that subscriber get ip from dhcp server successfully.
2835 5. Disable olt devices which is being detected in voltha CLI.
2836 6. Repeat step 3.
2837 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2838 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002839 df = defer.Deferred()
2840 dhcp_app = 'org.onosproject.dhcp'
2841 def dhcp_flow_check_scenario(df):
2842 log_test.info('Enabling ponsim_olt')
2843 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2844 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2845 assert_not_equal(device_id, None)
2846 voltha = VolthaCtrl(self.VOLTHA_HOST,
2847 rest_port = self.VOLTHA_REST_PORT,
2848 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2849 time.sleep(10)
2850 switch_map = None
2851 olt_configured = False
2852 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2853 log_test.info('Installing OLT app')
2854 OnosCtrl.install_app(self.olt_app_file)
2855 time.sleep(5)
2856 log_test.info('Adding subscribers through OLT app')
2857 self.config_olt(switch_map)
2858 olt_configured = True
2859 time.sleep(5)
2860 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2861 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
2862 log_test.info('Disable the olt device in during client send discover to voltha')
2863 thread2.start()
2864# time.sleep(randint(0,1))
2865 thread1.start()
2866 time.sleep(10)
2867 thread1.join()
2868 thread2.join()
2869 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00002870 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002871 #assert_equal(status, True)
2872 time.sleep(10)
2873 finally:
2874 self.voltha.disable_device(device_id, delete = True)
2875 self.remove_olt(switch_map)
2876 df.callback(0)
2877
2878 reactor.callLater(0, dhcp_flow_check_scenario, df)
2879 return df
2880
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002881 @deferred(TESTCASE_TIMEOUT)
2882 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
2883 """
2884 Test Method:
2885 0. Make sure that voltha is up and running on CORD-POD setup.
2886 1. OLT and ONU is detected and validated.
2887 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2888 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2889 4. Verify that subscriber get ip from dhcp server successfully.
2890 5. Disable olt devices which is being detected in voltha CLI.
2891 6. Repeat step 3.
2892 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2893 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
2894 """
2895 df = defer.Deferred()
2896 no_iterations = 10
2897 dhcp_app = 'org.onosproject.dhcp'
2898 def dhcp_flow_check_scenario(df):
2899 log_test.info('Enabling ponsim_olt')
2900 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2901 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2902 assert_not_equal(device_id, None)
2903 voltha = VolthaCtrl(self.VOLTHA_HOST,
2904 rest_port = self.VOLTHA_REST_PORT,
2905 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2906 time.sleep(10)
2907 switch_map = None
2908 olt_configured = False
2909 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2910 log_test.info('Installing OLT app')
2911 OnosCtrl.install_app(self.olt_app_file)
2912 time.sleep(5)
2913 log_test.info('Adding subscribers through OLT app')
2914 self.config_olt(switch_map)
2915 olt_configured = True
2916 time.sleep(5)
2917 for i in range(no_iterations):
2918 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2919 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
2920 log_test.info('Disable the olt device in during client send discover to voltha')
2921 thread2.start()
2922# time.sleep(randint(0,1))
2923 thread1.start()
2924 time.sleep(10)
2925 thread1.join()
2926 thread2.join()
2927 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2928 try:
2929 assert_equal(self.success, True)
2930 assert_equal(dhcp_status, True)
2931 #assert_equal(status, True)
2932 time.sleep(10)
2933 finally:
2934 self.voltha.disable_device(device_id, delete = True)
2935 self.remove_olt(switch_map)
2936 df.callback(0)
2937
2938 reactor.callLater(0, dhcp_flow_check_scenario, df)
2939 return df
2940
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002941 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00002942 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002943 """
2944 Test Method:
2945 0. Make sure that voltha is up and running on CORD-POD setup.
2946 1. OLT and ONU is detected and validated.
2947 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2948 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2949 4. Verify that subscriber get ip from dhcp server successfully.
2950 5. Disable olt devices which is being detected in voltha CLI.
2951 6. Repeat step 3.
2952 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2953 8. Enable olt devices which is being detected in voltha CLI.
2954 9. Repeat steps 3 and 4.
2955 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002956 df = defer.Deferred()
2957 dhcp_app = 'org.onosproject.dhcp'
2958 def dhcp_flow_check_scenario(df):
2959 log_test.info('Enabling ponsim_olt')
2960 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2961 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2962 assert_not_equal(device_id, None)
2963 voltha = VolthaCtrl(self.VOLTHA_HOST,
2964 rest_port = self.VOLTHA_REST_PORT,
2965 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2966 time.sleep(10)
2967 switch_map = None
2968 olt_configured = False
2969 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2970 log_test.info('Installing OLT app')
2971 OnosCtrl.install_app(self.olt_app_file)
2972 time.sleep(5)
2973 log_test.info('Adding subscribers through OLT app')
2974 self.config_olt(switch_map)
2975 olt_configured = True
2976 time.sleep(5)
2977 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
2978 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2979 thread2.start()
2980 thread1.start()
2981 time.sleep(10)
2982 thread1.join()
2983 thread2.join()
2984 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00002985 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002986 #assert_equal(status, True)
2987 time.sleep(10)
2988 finally:
2989 self.voltha.disable_device(device_id, delete = True)
2990 self.remove_olt(switch_map)
2991 df.callback(0)
2992
2993 reactor.callLater(0, dhcp_flow_check_scenario, df)
2994 return df
2995
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002996 @deferred(TESTCASE_TIMEOUT)
2997 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
2998 """
2999 Test Method:
3000 0. Make sure that voltha is up and running on CORD-POD setup.
3001 1. OLT and ONU is detected and validated.
3002 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3003 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3004 4. Verify that subscriber get ip from dhcp server successfully.
3005 5. Disable olt devices which is being detected in voltha CLI.
3006 6. Repeat step 3.
3007 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3008 8. Enable olt devices which is being detected in voltha CLI.
3009 9. Repeat steps 3 and 4.
3010 """
3011
3012 df = defer.Deferred()
3013 no_iterations = 10
3014 dhcp_app = 'org.onosproject.dhcp'
3015 def dhcp_flow_check_scenario(df):
3016 log_test.info('Enabling ponsim_olt')
3017 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3018 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3019 assert_not_equal(device_id, None)
3020 voltha = VolthaCtrl(self.VOLTHA_HOST,
3021 rest_port = self.VOLTHA_REST_PORT,
3022 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3023 time.sleep(10)
3024 switch_map = None
3025 olt_configured = False
3026 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3027 log_test.info('Installing OLT app')
3028 OnosCtrl.install_app(self.olt_app_file)
3029 time.sleep(5)
3030 log_test.info('Adding subscribers through OLT app')
3031 self.config_olt(switch_map)
3032 olt_configured = True
3033 time.sleep(5)
3034 for i in range(no_iterations):
3035 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3036 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3037 thread2.start()
3038 thread1.start()
3039 time.sleep(10)
3040 thread1.join()
3041 thread2.join()
3042 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3043 try:
3044 assert_equal(dhcp_status, True)
3045 #assert_equal(status, True)
3046 assert_equal(self.success, True)
3047 time.sleep(10)
3048 finally:
3049 self.voltha.disable_device(device_id, delete = True)
3050 self.remove_olt(switch_map)
3051 df.callback(0)
3052
3053 reactor.callLater(0, dhcp_flow_check_scenario, df)
3054 return df
3055
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003056 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003057 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003058 """
3059 Test Method:
3060 0. Make sure that voltha is up and running on CORD-POD setup.
3061 1. OLT and ONU is detected and validated.
3062 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3063 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3064 4. Verify that subscriber get ip from dhcp server successfully.
3065 5. Disable onu port which is being detected in voltha CLI.
3066 6. Repeat step 3.
3067 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3068 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003069 df = defer.Deferred()
3070 dhcp_app = 'org.onosproject.dhcp'
3071 def dhcp_flow_check_scenario(df):
3072 log_test.info('Enabling ponsim_olt')
3073 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3074 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3075 assert_not_equal(device_id, None)
3076 voltha = VolthaCtrl(self.VOLTHA_HOST,
3077 rest_port = self.VOLTHA_REST_PORT,
3078 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3079 time.sleep(10)
3080 switch_map = None
3081 olt_configured = False
3082 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3083 log_test.info('Installing OLT app')
3084 OnosCtrl.install_app(self.olt_app_file)
3085 time.sleep(5)
3086 log_test.info('Adding subscribers through OLT app')
3087 self.config_olt(switch_map)
3088 olt_configured = True
3089 time.sleep(5)
3090 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3091 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3092 thread1.start()
3093 thread2.start()
3094 time.sleep(10)
3095 thread1.join()
3096 thread2.join()
3097 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003098 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003099 #assert_equal(status, True)
3100 time.sleep(10)
3101 finally:
3102 self.voltha.disable_device(device_id, delete = True)
3103 self.remove_olt(switch_map)
3104 df.callback(0)
3105
3106 reactor.callLater(0, dhcp_flow_check_scenario, df)
3107 return df
3108
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003109 @deferred(TESTCASE_TIMEOUT)
3110 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
3111 """
3112 Test Method:
3113 0. Make sure that voltha is up and running on CORD-POD setup.
3114 1. OLT and ONU is detected and validated.
3115 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3116 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3117 4. Verify that subscriber get ip from dhcp server successfully.
3118 5. Disable onu port which is being detected in voltha CLI.
3119 6. Repeat step 3.
3120 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3121 """
3122 df = defer.Deferred()
3123 no_iterations = 10
3124 dhcp_app = 'org.onosproject.dhcp'
3125 def dhcp_flow_check_scenario(df):
3126 log_test.info('Enabling ponsim_olt')
3127 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3128 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3129 assert_not_equal(device_id, None)
3130 voltha = VolthaCtrl(self.VOLTHA_HOST,
3131 rest_port = self.VOLTHA_REST_PORT,
3132 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3133 time.sleep(10)
3134 switch_map = None
3135 olt_configured = False
3136 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3137 log_test.info('Installing OLT app')
3138 OnosCtrl.install_app(self.olt_app_file)
3139 time.sleep(5)
3140 log_test.info('Adding subscribers through OLT app')
3141 self.config_olt(switch_map)
3142 olt_configured = True
3143 time.sleep(5)
3144 for i in range(no_iterations):
3145 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3146 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3147 thread1.start()
3148 thread2.start()
3149 time.sleep(10)
3150 thread1.join()
3151 thread2.join()
3152 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3153 try:
3154 #assert_equal(status, True)
3155 assert_equal(dhcp_status, True)
3156 assert_equal(self.success, True)
3157 time.sleep(10)
3158 finally:
3159 self.voltha.disable_device(device_id, delete = True)
3160 self.remove_olt(switch_map)
3161 df.callback(0)
3162
3163 reactor.callLater(0, dhcp_flow_check_scenario, df)
3164 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003165
3166 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003167 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003168 """
3169 Test Method:
3170 0. Make sure that voltha is up and running on CORD-POD setup.
3171 1. OLT and ONU is detected and validated.
3172 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3173 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3174 4. Verify that subscriber get ip from dhcp server successfully.
3175 5. Disable onu port which is being detected in voltha CLI.
3176 6. Repeat step 3.
3177 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3178 8. Enable onu port which is being detected in voltha CLI.
3179 9. Repeat steps 3 and 4.
3180 """
3181
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003182 df = defer.Deferred()
3183 dhcp_app = 'org.onosproject.dhcp'
3184 def dhcp_flow_check_scenario(df):
3185 log_test.info('Enabling ponsim_olt')
3186 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3187 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3188 assert_not_equal(device_id, None)
3189 voltha = VolthaCtrl(self.VOLTHA_HOST,
3190 rest_port = self.VOLTHA_REST_PORT,
3191 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3192 time.sleep(10)
3193 switch_map = None
3194 olt_configured = False
3195 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3196 log_test.info('Installing OLT app')
3197 OnosCtrl.install_app(self.olt_app_file)
3198 time.sleep(5)
3199 log_test.info('Adding subscribers through OLT app')
3200 self.config_olt(switch_map)
3201 olt_configured = True
3202 time.sleep(5)
3203 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3204 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3205 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3206 thread2.start()
3207 time.sleep(randint(0,1))
3208 thread1.start()
3209 time.sleep(10)
3210 thread1.join()
3211 thread2.join()
3212 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3213 assert_equal(dhcp_status, True)
3214 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003215 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003216 #assert_equal(status, True)
3217 time.sleep(10)
3218 finally:
3219 self.voltha.disable_device(device_id, delete = True)
3220 self.remove_olt(switch_map)
3221 df.callback(0)
3222
3223 reactor.callLater(0, dhcp_flow_check_scenario, df)
3224 return df
3225
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003226 @deferred(TESTCASE_TIMEOUT)
3227 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
3228 """
3229 Test Method:
3230 0. Make sure that voltha is up and running on CORD-POD setup.
3231 1. OLT and ONU is detected and validated.
3232 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3233 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3234 4. Verify that subscriber get ip from dhcp server successfully.
3235 5. Disable onu port which is being detected in voltha CLI.
3236 6. Repeat step 3.
3237 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3238 8. Enable onu port which is being detected in voltha CLI.
3239 9. Repeat steps 3 and 4.
3240 """
3241
3242 df = defer.Deferred()
3243 no_iterations = 10
3244 dhcp_app = 'org.onosproject.dhcp'
3245 def dhcp_flow_check_scenario(df):
3246 log_test.info('Enabling ponsim_olt')
3247 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3248 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3249 assert_not_equal(device_id, None)
3250 voltha = VolthaCtrl(self.VOLTHA_HOST,
3251 rest_port = self.VOLTHA_REST_PORT,
3252 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3253 time.sleep(10)
3254 switch_map = None
3255 olt_configured = False
3256 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3257 log_test.info('Installing OLT app')
3258 OnosCtrl.install_app(self.olt_app_file)
3259 time.sleep(5)
3260 log_test.info('Adding subscribers through OLT app')
3261 self.config_olt(switch_map)
3262 olt_configured = True
3263 time.sleep(5)
3264 for i in range(no_iterations):
3265 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3266 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3267 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3268 thread2.start()
3269 time.sleep(randint(0,1))
3270 thread1.start()
3271 time.sleep(10)
3272 thread1.join()
3273 thread2.join()
3274 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3275 assert_equal(dhcp_status, True)
3276 try:
3277 assert_equal(self.success, True)
3278 #assert_equal(status, True)
3279 time.sleep(10)
3280 finally:
3281 self.voltha.disable_device(device_id, delete = True)
3282 self.remove_olt(switch_map)
3283 df.callback(0)
3284
3285 reactor.callLater(0, dhcp_flow_check_scenario, df)
3286 return df
3287
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003288 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003289 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003290 """
3291 Test Method:
3292 0. Make sure that voltha is up and running on CORD-POD setup.
3293 1. OLT and ONU is detected and validated.
3294 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3295 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3296 4. Verify that subscribers had got different ips from dhcp server successfully.
3297 """
3298
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003299 df = defer.Deferred()
3300 self.success = True
3301 dhcp_app = 'org.onosproject.dhcp'
3302 def dhcp_flow_check_scenario(df):
3303 log_test.info('Enabling ponsim_olt')
3304 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3305 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3306 assert_not_equal(device_id, None)
3307 voltha = VolthaCtrl(self.VOLTHA_HOST,
3308 rest_port = self.VOLTHA_REST_PORT,
3309 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3310 time.sleep(10)
3311 switch_map = None
3312 olt_configured = False
3313 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3314 log_test.info('Installing OLT app')
3315 OnosCtrl.install_app(self.olt_app_file)
3316 time.sleep(5)
3317 log_test.info('Adding subscribers through OLT app')
3318 self.config_olt(switch_map)
3319 olt_configured = True
3320 time.sleep(5)
3321 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3322 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3323 thread1.start()
3324 thread2.start()
3325 time.sleep(10)
3326 thread1.join()
3327 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003328 dhcp_flow_status = self.success
3329 try:
3330# if self.success is not True:
3331 assert_equal(dhcp_flow_status, True)
3332 #assert_equal(status, True)
3333 time.sleep(10)
3334 finally:
3335 self.voltha.disable_device(device_id, delete = True)
3336 self.remove_olt(switch_map)
3337 df.callback(0)
3338
3339 reactor.callLater(0, dhcp_flow_check_scenario, df)
3340 return df
3341
3342 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003343 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003344 """
3345 Test Method:
3346 0. Make sure that voltha is up and running on CORD-POD setup.
3347 1. OLT and ONU is detected and validated.
3348 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3349 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3350 4. Verify that subscribers had got ip from dhcp server successfully.
3351 5. Repeat step 3 and 4 for 10 times for both subscribers.
3352 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
3353 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003354
3355
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003356 df = defer.Deferred()
3357 self.success = True
3358 dhcp_app = 'org.onosproject.dhcp'
3359 def dhcp_flow_check_scenario(df):
3360 log_test.info('Enabling ponsim_olt')
3361 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3362 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3363 assert_not_equal(device_id, None)
3364 voltha = VolthaCtrl(self.VOLTHA_HOST,
3365 rest_port = self.VOLTHA_REST_PORT,
3366 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3367 time.sleep(10)
3368 switch_map = None
3369 olt_configured = False
3370 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3371 log_test.info('Installing OLT app')
3372 OnosCtrl.install_app(self.olt_app_file)
3373 time.sleep(5)
3374 log_test.info('Adding subscribers through OLT app')
3375 self.config_olt(switch_map)
3376 olt_configured = True
3377 time.sleep(5)
3378 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3379 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
3380 thread1.start()
3381 thread2.start()
3382 time.sleep(10)
3383 thread1.join()
3384 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003385 dhcp_flow_status = self.success
3386 try:
3387# if self.success is not True:
3388 assert_equal(dhcp_flow_status, True)
3389 #assert_equal(status, True)
3390 time.sleep(10)
3391 finally:
3392 self.voltha.disable_device(device_id, delete = True)
3393 self.remove_olt(switch_map)
3394 df.callback(0)
3395
3396 reactor.callLater(0, dhcp_flow_check_scenario, df)
3397 return df
3398
3399 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003400 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003401 """
3402 Test Method:
3403 0. Make sure that voltha is up and running on CORD-POD setup.
3404 1. OLT and ONU is detected and validated.
3405 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3406 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3407 4. Verify that subscribers had got ip from dhcp server successfully.
3408 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3409 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
3410 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003411
3412 df = defer.Deferred()
3413 self.success = True
3414 dhcp_app = 'org.onosproject.dhcp'
3415 def dhcp_flow_check_scenario(df):
3416 log_test.info('Enabling ponsim_olt')
3417 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3418 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3419 assert_not_equal(device_id, None)
3420 voltha = VolthaCtrl(self.VOLTHA_HOST,
3421 rest_port = self.VOLTHA_REST_PORT,
3422 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3423 time.sleep(10)
3424 switch_map = None
3425 olt_configured = False
3426 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3427 log_test.info('Installing OLT app')
3428 OnosCtrl.install_app(self.olt_app_file)
3429 time.sleep(5)
3430 log_test.info('Adding subscribers through OLT app')
3431 self.config_olt(switch_map)
3432 olt_configured = True
3433 time.sleep(5)
3434 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3435 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3436 thread1.start()
3437 thread2.start()
3438 time.sleep(10)
3439 thread1.join()
3440 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003441 dhcp_flow_status = self.success
3442 try:
3443# if self.success is not True:
3444 assert_equal(dhcp_flow_status, True)
3445 #assert_equal(status, True)
3446 time.sleep(10)
3447 finally:
3448 self.voltha.disable_device(device_id, delete = True)
3449 self.remove_olt(switch_map)
3450 df.callback(0)
3451
3452 reactor.callLater(0, dhcp_flow_check_scenario, df)
3453 return df
3454
3455 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003456 def test_two_subscribers_with_voltha_for_dhcp_discover_and_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003457 """
3458 Test Method:
3459 0. Make sure that voltha is up and running on CORD-POD setup.
3460 1. OLT and ONU is detected and validated.
3461 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3462 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
3463 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
3464 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
3465 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003466
3467 df = defer.Deferred()
3468 self.success = True
3469 dhcp_app = 'org.onosproject.dhcp'
3470 def dhcp_flow_check_scenario(df):
3471 log_test.info('Enabling ponsim_olt')
3472 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3473 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3474 assert_not_equal(device_id, None)
3475 voltha = VolthaCtrl(self.VOLTHA_HOST,
3476 rest_port = self.VOLTHA_REST_PORT,
3477 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3478 time.sleep(10)
3479 switch_map = None
3480 olt_configured = False
3481 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3482 log_test.info('Installing OLT app')
3483 OnosCtrl.install_app(self.olt_app_file)
3484 time.sleep(5)
3485 log_test.info('Adding subscribers through OLT app')
3486 self.config_olt(switch_map)
3487 olt_configured = True
3488 time.sleep(5)
3489 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3490 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
3491 thread1.start()
3492 thread2.start()
3493 time.sleep(10)
3494 thread1.join()
3495 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003496 dhcp_flow_status = self.success
3497 try:
3498# if self.success is not True:
3499 assert_equal(dhcp_flow_status, True)
3500 #assert_equal(status, True)
3501 time.sleep(10)
3502 finally:
3503 self.voltha.disable_device(device_id, delete = True)
3504 self.remove_olt(switch_map)
3505 df.callback(0)
3506
3507 reactor.callLater(0, dhcp_flow_check_scenario, df)
3508 return df
3509
3510 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003511 def test_two_subscribers_with_voltha_for_dhcp_discover_within_and_without_dhcp_pool_ip_addresses(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003512 """
3513 Test Method:
3514 0. Make sure that voltha is up and running on CORD-POD setup.
3515 1. OLT and ONU is detected and validated.
3516 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3517 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
3518 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
3519 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
3520 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003521 df = defer.Deferred()
3522 self.success = True
3523 dhcp_app = 'org.onosproject.dhcp'
3524 def dhcp_flow_check_scenario(df):
3525 log_test.info('Enabling ponsim_olt')
3526 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3527 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3528 assert_not_equal(device_id, None)
3529 voltha = VolthaCtrl(self.VOLTHA_HOST,
3530 rest_port = self.VOLTHA_REST_PORT,
3531 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3532 time.sleep(10)
3533 switch_map = None
3534 olt_configured = False
3535 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3536 log_test.info('Installing OLT app')
3537 OnosCtrl.install_app(self.olt_app_file)
3538 time.sleep(5)
3539 log_test.info('Adding subscribers through OLT app')
3540 self.config_olt(switch_map)
3541 olt_configured = True
3542 time.sleep(5)
3543 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3544 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3545 thread1.start()
3546 thread2.start()
3547 time.sleep(10)
3548 thread1.join()
3549 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003550 dhcp_flow_status = self.success
3551 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003552 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003553 time.sleep(10)
3554 finally:
3555 self.voltha.disable_device(device_id, delete = True)
3556 self.remove_olt(switch_map)
3557 df.callback(0)
3558
3559 reactor.callLater(0, dhcp_flow_check_scenario, df)
3560 return df
3561
3562 @deferred(TESTCASE_TIMEOUT)
3563 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003564 """
3565 Test Method:
3566 0. Make sure that voltha is up and running on CORD-POD setup.
3567 1. OLT and ONU is detected and validated.
3568 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3569 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3570 4. Verify that subscribers had got ip from dhcp server successfully.
3571 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3572 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3573 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3574 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003575 df = defer.Deferred()
3576 self.success = True
3577 dhcp_app = 'org.onosproject.dhcp'
3578 def dhcp_flow_check_scenario(df):
3579 log_test.info('Enabling ponsim_olt')
3580 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3581 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3582 assert_not_equal(device_id, None)
3583 voltha = VolthaCtrl(self.VOLTHA_HOST,
3584 rest_port = self.VOLTHA_REST_PORT,
3585 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3586 time.sleep(10)
3587 switch_map = None
3588 olt_configured = False
3589 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3590 log_test.info('Installing OLT app')
3591 OnosCtrl.install_app(self.olt_app_file)
3592 time.sleep(5)
3593 log_test.info('Adding subscribers through OLT app')
3594 self.config_olt(switch_map)
3595 olt_configured = True
3596 time.sleep(5)
3597 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3598 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3599 thread1.start()
3600 thread2.start()
3601 time.sleep(10)
3602 thread1.join()
3603 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003604 dhcp_flow_status = self.success
3605 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003606 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003607 time.sleep(10)
3608 finally:
3609 self.voltha.disable_device(device_id, delete = True)
3610 self.remove_olt(switch_map)
3611 df.callback(0)
3612
3613 reactor.callLater(0, dhcp_flow_check_scenario, df)
3614 return df
3615
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003616 @deferred(TESTCASE_TIMEOUT)
3617 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003618 """
3619 Test Method:
3620 0. Make sure that voltha is up and running on CORD-POD setup.
3621 1. OLT and ONU is detected and validated.
3622 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3623 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3624 4. Verify that subscribers had got ip from dhcp server successfully.
3625 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3626 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3627 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3628 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
3629 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
3630 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
3631 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003632 df = defer.Deferred()
3633 self.success = True
3634 dhcp_app = 'org.onosproject.dhcp'
3635 def dhcp_flow_check_scenario(df):
3636 log_test.info('Enabling ponsim_olt')
3637 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3638 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3639 assert_not_equal(device_id, None)
3640 voltha = VolthaCtrl(self.VOLTHA_HOST,
3641 rest_port = self.VOLTHA_REST_PORT,
3642 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3643 time.sleep(10)
3644 switch_map = None
3645 olt_configured = False
3646 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3647 log_test.info('Installing OLT app')
3648 OnosCtrl.install_app(self.olt_app_file)
3649 time.sleep(5)
3650 log_test.info('Adding subscribers through OLT app')
3651 self.config_olt(switch_map)
3652 olt_configured = True
3653 time.sleep(5)
3654 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3655 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3656 thread3 = threading.Thread(target = self.voltha_uni_port_down_up, args = (self.INTF_2_RX_DEFAULT,))
3657 thread1.start()
3658 thread2.start()
3659 thread3.start()
3660 time.sleep(10)
3661 thread1.join()
3662 thread2.join()
3663 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003664 dhcp_flow_status = self.success
3665 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003666 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003667 time.sleep(10)
3668 finally:
3669 self.voltha.disable_device(device_id, delete = True)
3670 self.remove_olt(switch_map)
3671 df.callback(0)
3672
3673 reactor.callLater(0, dhcp_flow_check_scenario, df)
3674 return df
3675
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003676 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003677 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003678 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003679 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00003680 0. Make sure that voltha is up and running on CORD-POD setup.
3681 1. OLT and ONU is detected and validated.
3682 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3683 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3684 4. Verify that subscribers had got ip from dhcp server successfully.
3685 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3686 6. Disable the olt device which is detected in voltha.
3687 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3688 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003689 df = defer.Deferred()
3690 self.success = True
3691 dhcp_app = 'org.onosproject.dhcp'
3692 def dhcp_flow_check_scenario(df):
3693 log_test.info('Enabling ponsim_olt')
3694 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3695 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3696 assert_not_equal(device_id, None)
3697 voltha = VolthaCtrl(self.VOLTHA_HOST,
3698 rest_port = self.VOLTHA_REST_PORT,
3699 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3700 time.sleep(10)
3701 switch_map = None
3702 olt_configured = False
3703 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3704 log_test.info('Installing OLT app')
3705 OnosCtrl.install_app(self.olt_app_file)
3706 time.sleep(5)
3707 log_test.info('Adding subscribers through OLT app')
3708 self.config_olt(switch_map)
3709 olt_configured = True
3710 time.sleep(5)
3711 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3712 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3713 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3714
3715 thread1.start()
3716 thread2.start()
3717 thread3.start()
3718 time.sleep(10)
3719 thread1.join()
3720 thread2.join()
3721 thread3.join()
3722 dhcp_flow_status = self.success
3723 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003724 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003725 time.sleep(10)
3726 finally:
3727 self.voltha.disable_device(device_id, delete = True)
3728 self.remove_olt(switch_map)
3729 df.callback(0)
3730
3731 reactor.callLater(0, dhcp_flow_check_scenario, df)
3732 return df
3733
3734 @deferred(TESTCASE_TIMEOUT)
3735 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003736 """
3737 Test Method:
3738 0. Make sure that voltha is up and running on CORD-POD setup.
3739 1. OLT and ONU is detected and validated.
3740 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3741 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3742 4. Verify that subscribers had got ip from dhcp server successfully.
3743 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3744 6. Disable the olt device which is detected in voltha.
3745 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3746 8. Enable the olt device which is detected in voltha.
3747 9. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003748
Thangavelu K S057b7d22017-05-16 22:03:22 +00003749 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003750 df = defer.Deferred()
3751 self.success = True
3752 dhcp_app = 'org.onosproject.dhcp'
3753 def dhcp_flow_check_scenario(df):
3754 log_test.info('Enabling ponsim_olt')
3755 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3756 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3757 assert_not_equal(device_id, None)
3758 voltha = VolthaCtrl(self.VOLTHA_HOST,
3759 rest_port = self.VOLTHA_REST_PORT,
3760 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3761 time.sleep(10)
3762 switch_map = None
3763 olt_configured = False
3764 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3765 log_test.info('Installing OLT app')
3766 OnosCtrl.install_app(self.olt_app_file)
3767 time.sleep(5)
3768 log_test.info('Adding subscribers through OLT app')
3769 self.config_olt(switch_map)
3770 olt_configured = True
3771 time.sleep(5)
3772 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3773 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3774 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3775 thread1.start()
3776 thread2.start()
3777 thread3.start()
3778 time.sleep(10)
3779 thread1.join()
3780 thread2.join()
3781 thread3.join()
3782 dhcp_flow_status = self.success
3783 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003784 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003785 time.sleep(10)
3786 finally:
3787 self.voltha.disable_device(device_id, delete = True)
3788 self.remove_olt(switch_map)
3789 df.callback(0)
3790
3791 reactor.callLater(0, dhcp_flow_check_scenario, df)
3792 return df
3793
3794 @deferred(TESTCASE_TIMEOUT)
3795 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003796 """
3797 Test Method:
3798 0. Make sure that voltha is up and running on CORD-POD setup.
3799 1. OLT and ONU is detected and validated.
3800 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3801 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3802 4. Verify that subscribers had got ip from dhcp server successfully.
3803 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3804 6. Pause the olt device which is detected in voltha.
3805 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3806 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003807 df = defer.Deferred()
3808 self.success = True
3809 dhcp_app = 'org.onosproject.dhcp'
3810 def dhcp_flow_check_scenario(df):
3811 log_test.info('Enabling ponsim_olt')
3812 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3813 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3814 assert_not_equal(device_id, None)
3815 voltha = VolthaCtrl(self.VOLTHA_HOST,
3816 rest_port = self.VOLTHA_REST_PORT,
3817 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3818 time.sleep(10)
3819 switch_map = None
3820 olt_configured = False
3821 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3822 log_test.info('Installing OLT app')
3823 OnosCtrl.install_app(self.olt_app_file)
3824 time.sleep(5)
3825 log_test.info('Adding subscribers through OLT app')
3826 self.config_olt(switch_map)
3827 olt_configured = True
3828 time.sleep(5)
3829 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3830 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3831 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
3832 thread1.start()
3833 thread2.start()
3834 thread3.start()
3835 time.sleep(10)
3836 thread1.join()
3837 thread2.join()
3838 thread3.join()
3839 dhcp_flow_status = self.success
3840 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003841 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003842 time.sleep(10)
3843 finally:
3844 self.voltha.disable_device(device_id, delete = True)
3845 self.remove_olt(switch_map)
3846 df.callback(0)
3847
3848 reactor.callLater(0, dhcp_flow_check_scenario, df)
3849 return df
3850
Thangavelu K S36edb012017-07-05 18:24:12 +00003851 def test_3_subscribers_with_voltha_for_dhcp_discover_requests(self):
3852 """
3853 Test Method:
3854 0. Make sure that voltha is up and running on CORD-POD setup.
3855 1. OLT and ONU is detected and validated.
3856 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
3857 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
3858 4. Verify that subscriber get ip from dhcp server successfully.
3859 """
3860 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
3861 num_subscribers = 3
3862 num_channels = 1
3863 services = ('DHCP')
3864 cbs = (self.dhcp_flow_check, None, None)
3865 self.voltha_subscribers(services, cbs = cbs,
3866 num_subscribers = num_subscribers,
3867 num_channels = num_channels)
3868
3869 def test_5_subscribers_with_voltha_for_dhcp_discover_requests(self):
3870 """
3871 Test Method:
3872 0. Make sure that voltha is up and running on CORD-POD setup.
3873 1. OLT and ONU is detected and validated.
3874 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
3875 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
3876 4. Verify that subscriber get ip from dhcp server successfully.
3877 """
3878 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
3879 num_subscribers = 5
3880 num_channels = 1
3881 services = ('DHCP')
3882 cbs = (self.dhcp_flow_check, None, None)
3883 self.voltha_subscribers(services, cbs = cbs,
3884 num_subscribers = num_subscribers,
3885 num_channels = num_channels)
3886
3887 def test_9_subscribers_with_voltha_for_dhcp_discover_requests(self):
3888 """
3889 Test Method:
3890 0. Make sure that voltha is up and running on CORD-POD setup.
3891 1. OLT and ONU is detected and validated.
3892 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
3893 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
3894 4. Verify that subscriber get ip from dhcp server successfully.
3895 """
3896 """Test subscriber join next for channel surfing with 9 subscribers browsing 1 channels each"""
3897 num_subscribers = 9
3898 num_channels = 1
3899 services = ('DHCP')
3900 cbs = (self.dhcp_flow_check, None, None)
3901 self.voltha_subscribers(services, cbs = cbs,
3902 num_subscribers = num_subscribers,
3903 num_channels = num_channels)
3904
3905 def test_3_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
3906 """
3907 Test Method:
3908 0. Make sure that voltha is up and running on CORD-POD setup.
3909 1. OLT and ONU is detected and validated.
3910 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
3911 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
3912 4. Verify that subscriber get ip from dhcp server successfully.
3913 """
3914 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
3915 num_subscribers = 3
3916 num_channels = 1
3917 services = ('TLS','DHCP')
3918 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
3919 self.voltha_subscribers(services, cbs = cbs,
3920 num_subscribers = num_subscribers,
3921 num_channels = num_channels)
3922
3923 def test_5_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
3924 """
3925 Test Method:
3926 0. Make sure that voltha is up and running on CORD-POD setup.
3927 1. OLT and ONU is detected and validated.
3928 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
3929 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
3930 4. Verify that subscriber get ip from dhcp server successfully.
3931 """
3932 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
3933 num_subscribers = 5
3934 num_channels = 1
3935 services = ('TLS','DHCP')
3936 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
3937 self.voltha_subscribers(services, cbs = cbs,
3938 num_subscribers = num_subscribers,
3939 num_channels = num_channels)
3940
3941 def test_9_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
3942 """
3943 Test Method:
3944 0. Make sure that voltha is up and running on CORD-POD setup.
3945 1. OLT and ONU is detected and validated.
3946 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
3947 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
3948 4. Verify that subscriber get ip from dhcp server successfully.
3949 """
3950 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
3951 num_subscribers = 9
3952 num_channels = 1
3953 services = ('TLS','DHCP')
3954 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
3955 self.voltha_subscribers(services, cbs = cbs,
3956 num_subscribers = num_subscribers,
3957 num_channels = num_channels)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003958
3959 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00003960 def test_subscriber_with_voltha_for_dhcprelay_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003961 """
3962 Test Method:
3963 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3964 1. OLT and ONU is detected and validated.
3965 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3966 3. Send dhcp request from residential subscrber to external dhcp server.
3967 4. Verify that subscriber get ip from external dhcp server successfully.
3968 """
3969
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003970 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00003971 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003972 """
3973 Test Method:
3974 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
3975 1. OLT and ONU is detected and validated.
3976 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3977 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
3978 4. Verify that subscriber should not get ip from external dhcp server.
3979 """
3980
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003981 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00003982 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003983 """
3984 Test Method:
3985 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
3986 1. OLT and ONU is detected and validated.
3987 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3988 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
3989 4. Verify that subscriber should not get ip from external dhcp server.
3990 """
3991
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00003992 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003993 """
3994 Test Method:
3995 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
3996 1. OLT and ONU is detected and validated.
3997 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3998 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
3999 4. Verify that subscriber should not get ip from external dhcp server.
4000 """
4001
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004002 def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004003 """
4004 Test Method:
4005 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4006 1. OLT and ONU is detected and validated.
4007 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4008 3. Send dhcp request from residential subscrber to external dhcp server.
4009 4. Verify that subscriber get ip from external dhcp server successfully.
4010 5. Send dhcp release from residential subscrber to external dhcp server.
4011 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
4012 """
4013
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004014 def test_subscriber_with_voltha_for_dhcprelay_starvation(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004015 """
4016 Test Method:
4017 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4018 1. OLT and ONU is detected and validated.
4019 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4020 3. Send dhcp request from residential subscriber to external dhcp server.
4021 4. Verify that subscriber get ip from external dhcp server. successfully.
4022 5. Repeat step 3 and 4 for 10 times.
4023 6 Verify that subscriber should get ip from external dhcp server..
4024 """
4025
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004026 def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004027 """
4028 Test Method:
4029 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4030 1. OLT and ONU is detected and validated.
4031 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4032 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
4033 4. Verify that subscriber should not get ip from external dhcp server..
4034 5. Repeat steps 3 and 4 for 10 times.
4035 6 Verify that subscriber should not get ip from external dhcp server..
4036 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004037 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004038 """
4039 Test Method:
4040 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4041 1. OLT and ONU is detected and validated.
4042 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4043 3. Send dhcp request from residential subscriber to external dhcp server.
4044 4. Verify that subscriber get ip from external dhcp server. successfully.
4045 5. Repeat step 3 for 50 times.
4046 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4047 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004048 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004049 """
4050 Test Method:
4051 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4052 1. OLT and ONU is detected and validated.
4053 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4054 3. Send dhcp request from residential subscriber to external dhcp server.
4055 4. Verify that subscriber get ip from external dhcp server. successfully.
4056 5. Send DHCP request to external dhcp server.
4057 6. Repeat step 5 for 50 times.
4058 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4059 """
4060
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004061 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004062 """
4063 Test Method:
4064 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4065 1. OLT and ONU is detected and validated.
4066 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4067 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
4068 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
4069 """
4070
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004071 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004072 """
4073 Test Method:
4074 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4075 1. OLT and ONU is detected and validated.
4076 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4077 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
4078 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.
4079 """
4080
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004081 def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004082 """
4083 Test Method:
4084 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4085 1. OLT and ONU is detected and validated.
4086 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4087 3. Send dhcp request from residential subscriber to external dhcp server.
4088 4. Verify that subscriber get ip from external dhcp server. successfully.
4089 5. Deactivate dhcp server app in onos.
4090 6. Repeat step 3.
4091 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4092 """
4093
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004094 def test_subscriber_with_voltha_for_dhcprelay_renew_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004095 """
4096 Test Method:
4097 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4098 1. OLT and ONU is detected and validated.
4099 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4100 3. Send dhcp request from residential subscriber to external dhcp server.
4101 4. Verify that subscriber get ip from external dhcp server. successfully.
4102 5. Send dhcp renew packet to external dhcp server.
4103 6. Repeat step 4.
4104 """
4105
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004106 def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004107 """
4108 Test Method:
4109 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4110 1. OLT and ONU is detected and validated.
4111 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4112 3. Send dhcp request from residential subscriber to external dhcp server.
4113 4. Verify that subscriber get ip from external dhcp server. successfully.
4114 5. Send dhcp rebind packet to external dhcp server.
4115 6. Repeat step 4.
4116 """
4117
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004118 def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004119 """
4120 Test Method:
4121 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4122 1. OLT and ONU is detected and validated.
4123 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4124 3. Send dhcp request from residential subscriber to external dhcp server.
4125 4. Verify that subscriber get ip from external dhcp server. successfully.
4126 5. Disable olt devices which is being detected in voltha CLI.
4127 6. Repeat step 3.
4128 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4129 """
4130
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004131 def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004132 """
4133 Test Method:
4134 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4135 1. OLT and ONU is detected and validated.
4136 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4137 3. Send dhcp request from residential subscriber to external dhcp server.
4138 4. Verify that subscriber get ip from external dhcp server. successfully.
4139 5. Disable olt devices which is being detected in voltha CLI.
4140 6. Repeat step 3.
4141 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4142 8. Enable olt devices which is being detected in voltha CLI.
4143 9. Repeat steps 3 and 4.
4144 """
4145
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004146 def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004147 """
4148 Test Method:
4149 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4150 1. OLT and ONU is detected and validated.
4151 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4152 3. Send dhcp request from residential subscriber to external dhcp server.
4153 4. Verify that subscriber get ip from external dhcp server. successfully.
4154 5. Disable onu port which is being detected in voltha CLI.
4155 6. Repeat step 3.
4156 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4157 """
4158
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004159 def test_subscriber_with_voltha_for_dhcprelay_disable_enable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004160 """
4161 Test Method:
4162 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4163 1. OLT and ONU is detected and validated.
4164 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4165 3. Send dhcp request from residential subscriber to external dhcp server.
4166 4. Verify that subscriber get ip from external dhcp server. successfully.
4167 5. Disable onu port which is being detected in voltha CLI.
4168 6. Repeat step 3.
4169 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4170 8. Enable onu port which is being detected in voltha CLI.
4171 9. Repeat steps 3 and 4.
4172 """
4173
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004174 def test_two_subscribers_with_voltha_for_dhcprelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004175 """
4176 Test Method:
4177 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4178 1. OLT and ONU is detected and validated.
4179 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4180 3. Send dhcp request from two residential subscribers to external dhcp server.
4181 4. Verify that subscribers had got different ips from external dhcp server. successfully.
4182 """
4183
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004184 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004185 """
4186 Test Method:
4187 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4188 1. OLT and ONU is detected and validated.
4189 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4190 3. Send dhcp request from two residential subscribers to external dhcp server.
4191 4. Verify that subscribers had got ip from external dhcp server. successfully.
4192 5. Repeat step 3 and 4 for 10 times for both subscribers.
4193 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
4194 """
4195
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004196 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004197 """
4198 Test Method:
4199 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4200 1. OLT and ONU is detected and validated.
4201 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4202 3. Send dhcp request from two residential subscribers to external dhcp server.
4203 4. Verify that subscribers had got ip from external dhcp server. successfully.
4204 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
4205 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
4206 """
4207
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004208 def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004209 """
4210 Test Method:
4211 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4212 1. OLT and ONU is detected and validated.
4213 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4214 3. Send dhcp request from one residential subscriber to external dhcp server.
4215 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
4216 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
4217 """
4218
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004219 def test_two_subscribers_with_voltha_for_dhcprelay_discover_for_in_range_and_out_of_range_from_dhcp_pool_ip_addresses(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004220 """
4221 Test Method:
4222 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4223 1. OLT and ONU is detected and validated.
4224 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4225 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
4226 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
4227 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
4228 """
4229
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004230 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004231 """
4232 Test Method:
4233 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4234 1. OLT and ONU is detected and validated.
4235 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4236 3. Send dhcp request from two residential subscribers to external dhcp server.
4237 4. Verify that subscribers had got ip from external dhcp server. successfully.
4238 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4239 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4240 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4241 """
4242
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004243 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004244 """
4245 Test Method:
4246 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4247 1. OLT and ONU is detected and validated.
4248 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4249 3. Send dhcp request from two residential subscribers to external dhcp server.
4250 4. Verify that subscribers had got ip from external dhcp server. successfully.
4251 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4252 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4253 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4254 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
4255 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
4256 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4257 """
4258
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004259 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004260 """
4261 Test Method:
4262 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4263 1. OLT and ONU is detected and validated.
4264 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4265 3. Send dhcp request from two residential subscribers to external dhcp server.
4266 4. Verify that subscribers had got ip from external dhcp server. successfully.
4267 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4268 6. Disable the olt device which is detected in voltha.
4269 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4270 """
4271
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004272 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004273 """
4274 Test Method:
4275 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4276 1. OLT and ONU is detected and validated.
4277 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4278 3. Send dhcp request from two residential subscribers to external dhcp server.
4279 4. Verify that subscribers had got ip from external dhcp server. successfully.
4280 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4281 6. Disable the olt device which is detected in voltha.
4282 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4283 8. Enable the olt device which is detected in voltha.
4284 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4285 """
4286
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004287 def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004288 """
4289 Test Method:
4290 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4291 1. OLT and ONU is detected and validated.
4292 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4293 3. Send dhcp request from two residential subscribers to external dhcp server.
4294 4. Verify that subscribers had got ip from external dhcp server. successfully.
4295 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4296 6. Pause the olt device which is detected in voltha.
4297 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4298 """
Thangavelu K S36edb012017-07-05 18:24:12 +00004299
4300 def test_subscriber_with_voltha_for_igmp_join_verify_traffic(self):
4301 """
4302 Test Method:
4303 0. Make sure that voltha is up and running on CORD-POD setup.
4304 1. OLT and ONU is detected and validated.
4305 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4306 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4307 4. Send igmp joins for a multicast group address multi-group-addressA.
4308 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4309 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4310 """
4311
Thangavelu K S8e413082017-07-13 20:02:14 +00004312 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4313 num_subscribers = 1
4314 num_channels = 1
4315 services = ('IGMP')
4316 cbs = (self.igmp_flow_check, None, None)
4317 self.voltha_subscribers(services, cbs = cbs,
4318 num_subscribers = num_subscribers,
4319 num_channels = num_channels)
4320
Thangavelu K S36edb012017-07-05 18:24:12 +00004321 def test_subscriber_with_voltha_for_igmp_leave_verify_traffic(self):
4322 """
4323 Test Method:
4324 0. Make sure that voltha is up and running on CORD-POD setup.
4325 1. OLT and ONU is detected and validated.
4326 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4327 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4328 4. Send igmp joins for a multicast group address multi-group-addressA.
4329 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4330 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4331 7. Send igmp leave for a multicast group address multi-group-addressA.
4332 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4333 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004334 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4335 num_subscribers = 1
4336 num_channels = 1
4337 services = ('IGMP')
4338 cbs = (self.igmp_flow_check, None, None)
4339 self.voltha_subscribers(services, cbs = cbs,
4340 num_subscribers = num_subscribers,
4341 num_channels = num_channels)
4342
Thangavelu K S36edb012017-07-05 18:24:12 +00004343 def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verify_traffic(self):
4344 """
4345 Test Method:
4346 0. Make sure that voltha is up and running on CORD-POD setup.
4347 1. OLT and ONU is detected and validated.
4348 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4349 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4350 4. Send igmp joins for a multicast group address multi-group-addressA.
4351 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4352 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4353 7. Send igmp leave for a multicast group address multi-group-addressA.
4354 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4355 9. Repeat steps 4 to 6.
4356 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004357 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4358 num_subscribers = 1
4359 num_channels = 1
4360 services = ('IGMP')
4361 cbs = (self.igmp_flow_check, None, None)
4362 self.voltha_subscribers(services, cbs = cbs,
4363 num_subscribers = num_subscribers,
4364 num_channels = num_channels)
4365
Thangavelu K S36edb012017-07-05 18:24:12 +00004366 def test_subscriber_with_voltha_for_igmp_2_groups_joins_verify_traffic(self):
4367 """
4368 Test Method:
4369 0. Make sure that voltha is up and running on CORD-POD setup.
4370 1. OLT and ONU is detected and validated.
4371 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4372 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4373 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4374 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4375 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4376 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004377 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4378 num_subscribers = 1
4379 num_channels = 2
4380 services = ('IGMP')
4381 cbs = (self.igmp_flow_check, None, None)
4382 self.voltha_subscribers(services, cbs = cbs,
4383 num_subscribers = num_subscribers,
4384 num_channels = num_channels)
4385
Thangavelu K S36edb012017-07-05 18:24:12 +00004386 def test_subscriber_with_voltha_for_igmp_2_groups_joins_and_leave_for_one_group_verify_traffic(self):
4387 """
4388 Test Method:
4389 0. Make sure that voltha is up and running on CORD-POD setup.
4390 1. OLT and ONU is detected and validated.
4391 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4392 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4393 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4394 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4395 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4396 7. Send igmp leave for a multicast group address multi-group-addressA.
4397 8. Verify that multicast data packets of group(multi-group-addressA) are not being recieved on leave sent uni port on ONU to cord-tester.
4398 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester.
4399 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004400 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4401 num_subscribers = 1
4402 num_channels = 2
4403 services = ('IGMP')
4404 cbs = (self.igmp_flow_check, None, None)
4405 self.voltha_subscribers(services, cbs = cbs,
4406 num_subscribers = num_subscribers,
4407 num_channels = num_channels)
4408
Thangavelu K S36edb012017-07-05 18:24:12 +00004409 def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verify_traffic(self):
4410 """
4411 Test Method:
4412 0. Make sure that voltha is up and running on CORD-POD setup.
4413 1. OLT and ONU is detected and validated.
4414 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4415 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4416 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4417 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4418 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4419 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4420 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4421 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004422 num_subscribers = 1
4423 num_channels = 1
4424 services = ('IGMP')
4425 cbs = (self.igmp_flow_check, None, None)
4426 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4427 num_subscribers = num_subscribers,
4428 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004429
Thangavelu K S8e413082017-07-13 20:02:14 +00004430 def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verify_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004431 """
4432 Test Method:
4433 0. Make sure that voltha is up and running on CORD-POD setup.
4434 1. OLT and ONU is detected and validated.
4435 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4436 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4437 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4438 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4439 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4440 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA
4441 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4442 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4443 """
4444
Thangavelu K S8e413082017-07-13 20:02:14 +00004445 num_subscribers = 1
4446 num_channels = 2
4447 services = ('IGMP')
4448 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4449 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4450 num_subscribers = num_subscribers,
4451 num_channels = num_channels)
4452
Thangavelu K S8e413082017-07-13 20:02:14 +00004453 def test_subscriber_with_voltha_for_igmp_change_to_include_back_from_exclude_mcast_group_verify_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004454 """
4455 Test Method:
4456 0. Make sure that voltha is up and running on CORD-POD setup.
4457 1. OLT and ONU is detected and validated.
4458 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4459 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4460 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4461 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4462 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4463 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA
4464 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4465 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4466 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004467 num_subscribers = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004468 num_channels = 2
Thangavelu K S8e413082017-07-13 20:02:14 +00004469 services = ('IGMP')
4470 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4471 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4472 num_subscribers = num_subscribers,
4473 num_channels = num_channels)
4474
Thangavelu K S36edb012017-07-05 18:24:12 +00004475 def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verify_traffic(self):
4476 """
4477 Test Method:
4478 0. Make sure that voltha is up and running on CORD-POD setup.
4479 1. OLT and ONU is detected and validated.
4480 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4481 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4482 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4483 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4484 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4485 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA
4486 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4487 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4488 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004489
4490 num_subscribers = 1
4491 num_channels = 1
4492 services = ('IGMP')
4493 cbs = (self.igmp_flow_check_join_change_to_block, None, None)
4494 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4495 num_subscribers = num_subscribers,
4496 num_channels = num_channels)
4497
Thangavelu K S36edb012017-07-05 18:24:12 +00004498 def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verify_traffic(self):
4499 """
4500 Test Method:
4501 0. Make sure that voltha is up and running on CORD-POD setup.
4502 1. OLT and ONU is detected and validated.
4503 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4504 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4505 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4506 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4507 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4508 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB
4509 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4510 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4511 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004512
4513 num_subscribers = 1
4514 num_channels = 1
4515 services = ('IGMP')
4516 cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None)
4517 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4518 num_subscribers = num_subscribers,
4519 num_channels = num_channels)
4520
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004521 def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verify_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004522 """
4523 Test Method:
4524 0. Make sure that voltha is up and running on CORD-POD setup.
4525 1. OLT and ONU is detected and validated.
4526 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4527 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4528 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4529 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4530 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4531 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4532 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4533 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004534
4535 num_subscribers = 1
4536 num_channels = 1
4537 services = ('IGMP')
4538 cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None)
4539 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4540 num_subscribers = num_subscribers,
4541 num_channels = num_channels)
4542
4543 def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_and_verify_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004544 """
4545 Test Method:
4546 0. Make sure that voltha is up and running on CORD-POD setup.
4547 1. OLT and ONU is detected and validated.
4548 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4549 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4550 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4551 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4552 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4553 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4554 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4555 """
4556
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004557 num_subscribers = 1
4558 num_channels = 1
4559 services = ('IGMP')
4560 cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None)
4561 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4562 num_subscribers = num_subscribers,
4563 num_channels = num_channels)
4564
Thangavelu K S36edb012017-07-05 18:24:12 +00004565 def test_two_subscribers_with_voltha_for_igmp_join_and_verifying_traffic(self):
4566 """
4567 Test Method:
4568 0. Make sure that voltha is up and running on CORD-POD setup.
4569 1. OLT and ONU is detected and validated.
4570 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4571 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4572 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4573 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4574 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4575 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4576 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4577 """
4578
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004579 num_subscribers = 2
4580 num_channels = 1
4581 services = ('IGMP')
4582 cbs = (self.igmp_flow_check, None, None)
4583 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'],
4584 num_subscribers = num_subscribers,
4585 num_channels = num_channels)
4586
Thangavelu K S36edb012017-07-05 18:24:12 +00004587 def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self):
4588 """
4589 Test Method:
4590 0. Make sure that voltha is up and running on CORD-POD setup.
4591 1. OLT and ONU is detected and validated.
4592 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4593 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4594 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4595 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4596 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4597 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4598 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4599 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4600 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4601 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4602 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004603 num_subscribers = 2
4604 num_channels = 2
4605 services = ('IGMP')
4606 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4607 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'],
4608 num_subscribers = num_subscribers,
4609 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004610
4611 def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_and_verifying_traffic(self):
4612 """
4613 Test Method:
4614 0. Make sure that voltha is up and running on CORD-POD setup.
4615 1. OLT and ONU is detected and validated.
4616 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4617 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4618 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4619 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4620 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4621 7. Verify that multicast group adress (multi-group-addressA) data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4622 8. Verify that multicast group adress (multi-group-addressB) data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4623 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4624 10. Verify that multicast of group (multi-group-addressA) data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4625 11. Verify that multicast of group (multi-group-addressA) data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4626 12. Verify that multicast of group (multi-group-addressB) data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4627 """
4628
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004629 num_subscribers = 2
4630 num_channels = 2
4631 services = ('IGMP')
4632 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4633 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'],
4634 num_subscribers = num_subscribers,
4635 num_channels = num_channels)
4636
4637 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00004638 def test_two_subscribers_with_voltha_for_igmp_with_uni_port_down_for_one_subscriber_and_verifying_traffic(self):
4639 """
4640 Test Method:
4641 0. Make sure that voltha is up and running on CORD-POD setup.
4642 1. OLT and ONU is detected and validated.
4643 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4644 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4645 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4646 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4647 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4648 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4649 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4650 9. Disable uni_2 port which is being shown on voltha CLI.
4651 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4652 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4653 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004654 #rx_port = self.port_map['ports'][port_list[i][1]]
4655 df = defer.Deferred()
4656 def igmp_flow_check_operating_onu_admin_state(df):
4657 num_subscribers = 2
4658 num_channels = 2
4659 services = ('IGMP')
4660 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
4661 port_list = self.generate_port_list(num_subscribers, num_channels)
4662
4663 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4664 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
4665 thread1.start()
4666 time.sleep(randint(40,50))
4667 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
4668 thread2.start()
4669 time.sleep(10)
4670 thread1.join()
4671 thread2.join()
4672 try:
4673 assert_equal(self.success, False)
4674 log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check')
4675 time.sleep(10)
4676 finally:
4677 pass
4678 df.callback(0)
4679 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
4680 return df
4681
4682 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00004683 def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self):
4684 """
4685 Test Method:
4686 0. Make sure that voltha is up and running on CORD-POD setup.
4687 1. OLT and ONU is detected and validated.
4688 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4689 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4690 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4691 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4692 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4693 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4694 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4695 9. Disable uni_2 port which is being shown on voltha CLI.
4696 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4697 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4698 12. Enable uni_2 port which we disable at step 9.
4699 13. Repeat step 5,6 and 8.
4700 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004701 df = defer.Deferred()
4702 def igmp_flow_check_operating_onu_admin_state(df):
4703 num_subscribers = 2
4704 num_channels = 2
4705 services = ('IGMP')
4706 cbs = (self.igmp_flow_check, None, None)
4707 port_list = self.generate_port_list(num_subscribers, num_channels)
4708
4709 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4710 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
4711 thread1.start()
4712 time.sleep(randint(50,60))
4713 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
4714 thread2.start()
4715 time.sleep(10)
4716 thread1.join()
4717 thread2.join()
4718 try:
4719 assert_equal(self.success, True)
4720 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be success')
4721 time.sleep(10)
4722 finally:
4723 pass
4724 df.callback(0)
4725 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
4726 return df
4727
4728 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00004729 def test_two_subscribers_with_voltha_for_igmp_disabling_olt_and_verifying_traffic(self):
4730 """
4731 Test Method:
4732 0. Make sure that voltha is up and running on CORD-POD setup.
4733 1. OLT and ONU is detected and validated.
4734 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4735 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4736 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4737 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4738 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4739 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4740 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4741 9. Disable olt device which is being shown on voltha CLI.
4742 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4743 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4744 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004745 df = defer.Deferred()
4746 def igmp_flow_check_operating_olt_admin_disble(df):
4747 num_subscribers = 2
4748 num_channels = 2
4749 services = ('IGMP')
4750 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
4751 port_list = self.generate_port_list(num_subscribers, num_channels)
4752
4753 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4754 thread1.start()
4755 time.sleep(randint(50,60))
4756 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
4757 thread2.start()
4758 time.sleep(10)
4759 thread1.join()
4760 thread2.join()
4761 try:
4762 assert_equal(self.success, False)
4763 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
4764 time.sleep(10)
4765 finally:
4766 pass
4767 df.callback(0)
4768 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
4769 return df
4770
4771 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00004772 def test_two_subscribers_with_voltha_for_igmp_pausing_olt_and_verifying_traffic(self):
4773 """
4774 Test Method:
4775 0. Make sure that voltha is up and running on CORD-POD setup.
4776 1. OLT and ONU is detected and validated.
4777 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4778 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4779 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4780 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4781 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4782 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4783 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4784 9. Pause olt device which is being shown on voltha CLI.
4785 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4786 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4787 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004788 df = defer.Deferred()
4789 def igmp_flow_check_operating_olt_admin_pause(df):
4790 num_subscribers = 2
4791 num_channels = 2
4792 services = ('IGMP')
4793 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
4794 port_list = self.generate_port_list(num_subscribers, num_channels)
4795
4796 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4797 thread1.start()
4798 time.sleep(randint(50,60))
4799 thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,))
4800 thread2.start()
4801 time.sleep(10)
4802 thread1.join()
4803 thread2.join()
4804 try:
4805 assert_equal(self.success, False)
4806 log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test')
4807 time.sleep(10)
4808 finally:
4809 pass
4810 df.callback(0)
4811 reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df)
4812 return df
4813
4814 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00004815 def test_two_subscribers_with_voltha_for_igmp_toggling_olt_and_verify_traffic(self):
4816 """
4817 Test Method:
4818 0. Make sure that voltha is up and running on CORD-POD setup.
4819 1. OLT and ONU is detected and validated.
4820 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4821 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4822 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4823 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4824 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4825 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4826 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4827 9. Disable olt device which is being shown on voltha CLI.
4828 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4829 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4830 12. Enable olt device which is disable at step 9.
4831 13. Repeat steps 4,5, 7 and 8.
4832 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004833 df = defer.Deferred()
4834 def igmp_flow_check_operating_olt_admin_restart(df):
4835 num_subscribers = 2
4836 num_channels = 2
4837 services = ('IGMP')
4838 cbs = (self.igmp_flow_check, None, None)
4839 port_list = self.generate_port_list(num_subscribers, num_channels)
4840
4841 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4842 thread1.start()
4843 time.sleep(randint(50,60))
4844 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
4845 thread2.start()
4846 time.sleep(10)
4847 thread1.join()
4848 thread2.join()
4849 try:
4850 assert_equal(self.success, True)
4851 log_test.info('Igmp flow check expected to fail during olt device is restarted, After OLT device is up, it should be success')
4852 time.sleep(10)
4853 finally:
4854 pass
4855 df.callback(0)
4856 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
4857 return df