blob: a6a6103f224c09f939960f573b746cfabf9610e2 [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
Thangavelu K S8e413082017-07-13 20:02:14 +000039 def __init__(self, tx_port, rx_port, num_channels =1, channel_start = 0, src_list = None):
40 self.tx_port = tx_port
41 self.rx_port = rx_port
42 self.src_list = src_list
Thangavelu K S36edb012017-07-05 18:24:12 +000043 try:
Thangavelu K S8e413082017-07-13 20:02:14 +000044 self.tx_intf = tx_port
45 self.rx_intf = rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +000046 except:
47 self.tx_intf = self.INTF_TX_DEFAULT
48 self.rx_intf = self.INTF_RX_DEFAULT
Thangavelu K S8e413082017-07-13 20:02:14 +000049# num = 1
50# channel_start = 0
Thangavelu K S36edb012017-07-05 18:24:12 +000051 mcast_cb = None
Thangavelu K S8e413082017-07-13 20:02:14 +000052 Channels.__init__(self, num_channels, channel_start = channel_start, src_list = src_list,
Thangavelu K S36edb012017-07-05 18:24:12 +000053 iface = self.rx_intf, iface_mcast = self.tx_intf, mcast_cb = mcast_cb)
54
Thangavelu K S8e413082017-07-13 20:02:14 +000055 self.loginType = 'wireless'
Thangavelu K S36edb012017-07-05 18:24:12 +000056 ##start streaming channels
57 self.join_map = {}
58 ##accumulated join recv stats
59 self.join_rx_stats = Stats()
60 self.recv_timeout = False
61
62
63 def channel_join_update(self, chan, join_time):
64 self.join_map[chan] = ( Stats(), Stats(), Stats(), Stats() )
65 self.channel_update(chan, self.STATS_JOIN, 1, t = join_time)
66
Thangavelu K S8e413082017-07-13 20:02:14 +000067 def channel_join(self, chan = 0, delay = 2, src_list = None, record_type = None):
Thangavelu K S36edb012017-07-05 18:24:12 +000068 '''Join a channel and create a send/recv stats map'''
69 if self.join_map.has_key(chan):
70 del self.join_map[chan]
71 self.delay = delay
Thangavelu K S8e413082017-07-13 20:02:14 +000072 chan, join_time = self.join(chan, src_list = src_list, record_type = record_type)
73 #chan, join_time = self.join(chan)
Thangavelu K S36edb012017-07-05 18:24:12 +000074 self.channel_join_update(chan, join_time)
75 return chan
76
77 def channel_join_next(self, delay = 2, leave_flag = True):
78 '''Joins the next channel leaving the last channel'''
79 if self.last_chan:
80 if self.join_map.has_key(self.last_chan):
81 del self.join_map[self.last_chan]
82 self.delay = delay
83 chan, join_time = self.join_next(leave_flag = leave_flag)
84 self.channel_join_update(chan, join_time)
85 return chan
86
87 def channel_jump(self, delay = 2):
88 '''Jumps randomly to the next channel leaving the last channel'''
89 if self.last_chan is not None:
90 if self.join_map.has_key(self.last_chan):
91 del self.join_map[self.last_chan]
92 self.delay = delay
93 chan, join_time = self.jump()
94 self.channel_join_update(chan, join_time)
95 return chan
96
Thangavelu K S8e413082017-07-13 20:02:14 +000097 def channel_leave(self, chan = 0, force = False, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +000098 if self.join_map.has_key(chan):
99 del self.join_map[chan]
Thangavelu K S8e413082017-07-13 20:02:14 +0000100 self.leave(chan, force = force, src_list = src_list)
Thangavelu K S36edb012017-07-05 18:24:12 +0000101
102 def channel_update(self, chan, stats_type, packets, t=0):
103 if type(chan) == type(0):
104 chan_list = (chan,)
105 else:
106 chan_list = chan
107 for c in chan_list:
108 if self.join_map.has_key(c):
109 self.join_map[c][stats_type].update(packets = packets, t = t)
110
Thangavelu K S8e413082017-07-13 20:02:14 +0000111 def channel_receive(self, chan, cb = None, count = 1, timeout = 5, src_list = None):
112 log_test.info('Subscriber on port %s receiving from group %s, channel %d' %
113 (self.rx_intf, self.gaddr(chan), chan))
114 r = self.recv(chan, cb = cb, count = count, timeout = timeout, src_list = src_list)
Thangavelu K S36edb012017-07-05 18:24:12 +0000115 if len(r) == 0:
Thangavelu K S8e413082017-07-13 20:02:14 +0000116 log_test.info('Subscriber on port %s timed out' %( self.rx_intf))
117 self.test_status = False
Thangavelu K S36edb012017-07-05 18:24:12 +0000118 else:
Thangavelu K S8e413082017-07-13 20:02:14 +0000119 log_test.info('Subscriber on port %s received %d packets' %(self.rx_intf, len(r)))
Thangavelu K S36edb012017-07-05 18:24:12 +0000120 if self.recv_timeout:
121 ##Negative test case is disabled for now
122 assert_equal(len(r), 0)
Thangavelu K S8e413082017-07-13 20:02:14 +0000123 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +0000124
Thangavelu K S8e413082017-07-13 20:02:14 +0000125 def recv_channel_cb(self, pkt, src_list = None):
126
Thangavelu K S36edb012017-07-05 18:24:12 +0000127 ##First verify that we have received the packet for the joined instance
Thangavelu K S8e413082017-07-13 20:02:14 +0000128 log_test.info('Packet received for group %s, subscriber, port %s' %
129 (pkt[IP].dst, self.rx_intf))
Thangavelu K S36edb012017-07-05 18:24:12 +0000130 if self.recv_timeout:
131 return
132 chan = self.caddr(pkt[IP].dst)
133 assert_equal(chan in self.join_map.keys(), True)
134 recv_time = monotonic.monotonic() * 1000000
135 join_time = self.join_map[chan][self.STATS_JOIN].start
136 delta = recv_time - join_time
137 self.join_rx_stats.update(packets=1, t = delta, usecs = True)
138 self.channel_update(chan, self.STATS_RX, 1, t = delta)
139 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
140
Thangavelu K S36edb012017-07-05 18:24:12 +0000141class voltha_subscriber_pool:
142
143 def __init__(self, subscriber, test_cbs):
144 self.subscriber = subscriber
145 self.test_cbs = test_cbs
146
147 def pool_cb(self):
148 for cb in self.test_cbs:
149 if cb:
Thangavelu K S8e413082017-07-13 20:02:14 +0000150 self.test_status = cb(self.subscriber, multiple_sub = True)
Thangavelu K S36edb012017-07-05 18:24:12 +0000151 if self.test_status is not True:
Thangavelu K S6432b522017-07-22 00:05:54 +0000152 ## This is chaining for other sub status has to check again
Thangavelu K S36edb012017-07-05 18:24:12 +0000153 self.test_status = True
154 log_test.info('This service is failed and other services will not run for this subscriber')
155 break
156 log_test.info('This Subscriber is tested for multiple service eligibility ')
157 self.test_status = True
158
A R Karthick35495c32017-05-11 14:58:32 -0700159class voltha_exchange(unittest.TestCase):
160
161 OLT_TYPE = 'tibit_olt'
162 OLT_MAC = '00:0c:e2:31:12:00'
163 VOLTHA_HOST = 'localhost'
164 VOLTHA_REST_PORT = 8881
Thangavelu K S36edb012017-07-05 18:24:12 +0000165 VOLTHA_OLT_TYPE = 'ponsim_olt'
166 VOLTHA_OLT_MAC = '00:0c:e2:31:12:00'
167 VOLTHA_IGMP_ITERATIONS = 100
A R Karthick35495c32017-05-11 14:58:32 -0700168 voltha = None
Thangavelu K S9648eed2017-06-13 20:15:25 +0000169 success = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000170 olt_device_id = None
Thangavelu K S6432b522017-07-22 00:05:54 +0000171 apps = ('org.opencord.aaa', 'org.onosproject.dhcp', 'org.onosproject.dhcprelay')
172 app_dhcp = ('org.onosproject.dhcp')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000173 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 S6432b522017-07-22 00:05:54 +0000187 relay_interfaces_last = ()
188 interface_to_mac_map = {}
189 host_ip_map = {}
190 default_config = { 'default-lease-time' : 600, 'max-lease-time' : 7200, }
191 default_options = [ ('subnet-mask', '255.255.255.0'),
192 ('broadcast-address', '192.168.1.255'),
193 ('domain-name-servers', '192.168.1.1'),
194 ('domain-name', '"mydomain.cord-tester"'),
195 ]
196 ##specify the IP for the dhcp interface matching the subnet and subnet config
197 ##this is done for each interface dhcpd server would be listening on
198 default_subnet_config = [ ('192.168.1.2',
199'''
200subnet 192.168.1.0 netmask 255.255.255.0 {
201 range 192.168.1.10 192.168.1.100;
202}
203'''), ]
204
205
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000206 VOLTHA_ENABLED = True
207 INTF_TX_DEFAULT = 'veth2'
208 INTF_RX_DEFAULT = 'veth0'
Thangavelu K S9648eed2017-06-13 20:15:25 +0000209 INTF_2_RX_DEFAULT = 'veth6'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000210 TESTCASE_TIMEOUT = 300
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000211# VOLTHA_CONFIG_FAKE = True
212 VOLTHA_CONFIG_FAKE = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000213 VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
214 VOLTHA_ONU_UNI_PORT = 'veth0'
215
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000216 dhcp_server_config = {
217 "ip": "10.1.11.50",
218 "mac": "ca:fe:ca:fe:ca:fe",
219 "subnet": "255.255.252.0",
220 "broadcast": "10.1.11.255",
221 "router": "10.1.8.1",
222 "domain": "8.8.8.8",
223 "ttl": "63",
224 "delay": "2",
225 "startip": "10.1.11.51",
226 "endip": "10.1.11.100"
227 }
228
229
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000230 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
231MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
232CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
233IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
234RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
235MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
236BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
237hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
238gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
239+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
240rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
241VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
242eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
2436tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
244PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
245nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
246-----END CERTIFICATE-----"""
247
248 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
249MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
250CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
251IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
252RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
253MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
254BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
255hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
256AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
2575An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
258tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
259OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
260qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
2612Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
262BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
263eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
264MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
265VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
266RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
267dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
268T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
269yg==
270-----END CERTIFICATE-----'''
A R Karthick35495c32017-05-11 14:58:32 -0700271
A.R Karthick3493a572017-06-07 18:28:10 -0700272 @classmethod
273 def update_apps_version(cls):
274 version = Onos.getVersion()
275 major = int(version.split('.')[0])
276 minor = int(version.split('.')[1])
277 cordigmp_app_version = '2.0-SNAPSHOT'
278 olt_app_version = '1.2-SNAPSHOT'
279 if major > 1:
280 cordigmp_app_version = '3.0-SNAPSHOT'
281 olt_app_version = '2.0-SNAPSHOT'
282 elif major == 1:
283 if minor > 10:
284 cordigmp_app_version = '3.0-SNAPSHOT'
285 olt_app_version = '2.0-SNAPSHOT'
286 elif minor <= 8:
287 olt_app_version = '1.1-SNAPSHOT'
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700288 cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version))
289 cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version))
290 cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
291
A R Karthick35495c32017-05-11 14:58:32 -0700292 @classmethod
Thangavelu K S6432b522017-07-22 00:05:54 +0000293 def dhcprelay_setUpClass(cls):
294 ''' Activate the dhcprelay app'''
295 OnosCtrl(cls.app_dhcp).deactivate()
296 time.sleep(3)
297 cls.onos_ctrl = OnosCtrl('org.onosproject.dhcprelay')
298 status, _ = cls.onos_ctrl.activate()
299 assert_equal(status, True)
300 time.sleep(3)
301 cls.dhcp_relay_setup()
302 ##start dhcpd initially with default config
303 cls.dhcpd_start()
304
305 @classmethod
306 def dhcprelay_tearDownClass(cls):
307 '''Deactivate the dhcp relay app'''
308 try:
309 os.unlink('{}/dhcpd.conf'.format(cls.dhcp_data_dir))
310 os.unlink('{}/dhcpd.leases'.format(cls.dhcp_data_dir))
311 except: pass
312 cls.onos_ctrl.deactivate()
313 cls.dhcpd_stop()
314 cls.dhcp_relay_cleanup()
315
316 @classmethod
A.R Karthickf874d032017-06-07 18:47:51 -0700317 def onos_load_config(cls, app, config):
318 status, code = OnosCtrl.config(config)
319 if status is False:
320 log_test.info('JSON config request for app %s returned status %d' %(app, code))
321 assert_equal(status, True)
322 time.sleep(2)
323
324 @classmethod
325 def onos_aaa_load(cls):
326 aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
327 'radiusIp': '172.17.0.2' } } } }
328 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
329 aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip
330 cls.onos_load_config('org.opencord.aaa', aaa_dict)
331
332 @classmethod
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000333 def onos_dhcp_table_load(self, config = None):
334 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
335 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
336 if config:
337 for k in config.keys():
338 if dhcp_config.has_key(k):
339 dhcp_config[k] = config[k]
340 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
341
Thangavelu K S36edb012017-07-05 18:24:12 +0000342 def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = None):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000343 if validation:
Thangavelu K S735a6662017-06-15 18:08:23 +0000344 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
345 assert_not_equal(cip, None)
346 assert_not_equal(sip, None)
347 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
348 (cip, sip, dhcp.get_mac(cip)[0]))
349 if validation == False:
350 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
351 assert_equal(cip, None)
352 assert_equal(sip, None)
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000353 log_test.info('Dhcp client did not get IP from server')
Thangavelu K S735a6662017-06-15 18:08:23 +0000354
Thangavelu K S36edb012017-07-05 18:24:12 +0000355 if validation == 'skip':
356 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
357
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000358 return cip,sip
359
Thangavelu K S36edb012017-07-05 18:24:12 +0000360 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):
361 config = {'startip':startip, 'endip':'10.10.10.200',
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000362 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
363 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
364 self.onos_dhcp_table_load(config)
365 dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface)
Thangavelu K S36edb012017-07-05 18:24:12 +0000366 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed, validation = validation, mac = mac)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000367 return cip, sip
368
369 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700370 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700371 cls.update_apps_version()
A R Karthick35495c32017-05-11 14:58:32 -0700372 cls.voltha = VolthaCtrl(cls.VOLTHA_HOST, rest_port = cls.VOLTHA_REST_PORT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000373 cls.install_app_table()
374 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
375 cls.port_map, cls.port_list = cls.olt.olt_port_map()
376 cls.switches = cls.port_map['switches']
Thangavelu K S36edb012017-07-05 18:24:12 +0000377 cls.ponsim_ports = cls.port_map['ponsim']
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000378 cls.num_ports = cls.port_map['num_ports']
379 if cls.num_ports > 1:
380 cls.num_ports -= 1 ##account for the tx port
381 cls.activate_apps(cls.apps + cls.olt_apps)
A.R Karthickf874d032017-06-07 18:47:51 -0700382 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000383
A.R Karthick3493a572017-06-07 18:28:10 -0700384 @classmethod
385 def tearDownClass(cls):
386 '''Deactivate the olt apps and restart OVS back'''
387 apps = cls.olt_apps + ( cls.table_app,)
388 for app in apps:
389 onos_ctrl = OnosCtrl(app)
390 onos_ctrl.deactivate()
391 cls.install_app_igmp()
A.R Karthick3493a572017-06-07 18:28:10 -0700392 @classmethod
393 def install_app_igmp(cls):
394 ##Uninstall the table app on class exit
395 OnosCtrl.uninstall_app(cls.table_app)
396 time.sleep(2)
397 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
398 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700399
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000400 def remove_olt(self, switch_map):
401 controller = get_controller()
402 auth = ('karaf', 'karaf')
403 #remove subscriber for every port on all the voltha devices
404 for device, device_map in switch_map.iteritems():
405 uni_ports = device_map['ports']
406 uplink_vlan = device_map['uplink_vlan']
407 for port in uni_ports:
408 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
409 device,
410 port)
411 resp = requests.delete(rest_url, auth = auth)
412 if resp.status_code not in [204, 202, 200]:
413 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
414 else:
415 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
416 OnosCtrl.uninstall_app(self.olt_app_file)
417
418 def config_olt(self, switch_map):
419 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000420 auth = ('karaf', 'karaf')
421 #configure subscriber for every port on all the voltha devices
422 for device, device_map in switch_map.iteritems():
423 uni_ports = device_map['ports']
424 uplink_vlan = device_map['uplink_vlan']
425 for port in uni_ports:
426 vlan = port
427 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
428 device,
429 port,
430 vlan)
431 resp = requests.post(rest_url, auth = auth)
432 #assert_equal(resp.ok, True)
433
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000434 def voltha_uni_port_toggle(self, uni_port = None):
435 ## Admin state of port is down and up
436 if not uni_port:
437 uni_port = self.INTF_RX_DEFAULT
438 cmd = 'ifconfig {} down'.format(uni_port)
439 os.system(cmd)
440 log_test.info('Admin state of uni_port is down')
441 time.sleep(30)
442 cmd = 'ifconfig {} up'.format(uni_port)
443 os.system(cmd)
444 log_test.info('Admin state of uni_port is up now')
445 time.sleep(30)
446 return
447
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000448 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000449 def install_app_table(cls):
450 ##Uninstall the existing app if any
451 OnosCtrl.uninstall_app(cls.table_app)
452 time.sleep(2)
453 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
454 OnosCtrl.install_app(cls.table_app_file)
455 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000456
457 @classmethod
458 def activate_apps(cls, apps):
459 for app in apps:
460 onos_ctrl = OnosCtrl(app)
461 status, _ = onos_ctrl.activate()
462 assert_equal(status, True)
463 time.sleep(2)
464
Thangavelu K S735a6662017-06-15 18:08:23 +0000465 @classmethod
466 def deactivate_apps(cls, apps):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000467 cls.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000468 for app in apps:
469 onos_ctrl = OnosCtrl(app)
470 status, _ = onos_ctrl.deactivate()
471 if status is False:
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000472 cls.success = False
473 # assert_equal(status, True)
Thangavelu K S735a6662017-06-15 18:08:23 +0000474 time.sleep(2)
475
Thangavelu K S36edb012017-07-05 18:24:12 +0000476 def random_ip(self,start_ip = '10.10.10.20', end_ip = '10.10.10.65'):
477 start = list(map(int, start_ip.split(".")))
478 end = list(map(int, end_ip.split(".")))
479 temp = start
480 ip_range = []
481 ip_range.append(start_ip)
482 while temp != end:
483 start[3] += 1
484 for i in (3, 2, 1):
485 if temp[i] == 255:
486 temp[i] = 0
487 temp[i-1] += 1
488 ip_range.append(".".join(map(str, temp)))
489 return random.choice(ip_range)
490
Thangavelu K S8e413082017-07-13 20:02:14 +0000491 def random_mcast_ip(self,start_ip = '224.0.1.0', end_ip = '224.0.1.100'):
492 start = list(map(int, start_ip.split(".")))
493 end = list(map(int, end_ip.split(".")))
494 temp = start
495 ip_range = []
496 ip_range.append(start_ip)
497 while temp != end:
498 start[3] += 1
499 for i in (3, 2, 1):
500 if temp[i] == 255:
501 temp[i] = 0
502 temp[i-1] += 1
503 ip_range.append(".".join(map(str, temp)))
504 return random.choice(ip_range)
505
Thangavelu K S6432b522017-07-22 00:05:54 +0000506 @classmethod
507 def dhcp_relay_setup(cls):
508 #did = OnosCtrl.get_device_id()
509 #cls.relay_device_id = did
510 #cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
511 #cls.port_map, _ = cls.olt.olt_port_map() self.port_map['ports'][port_list[1][1]]
512 if cls.port_map:
513 ##Per subscriber, we use 1 relay port
514 try:
515 relay_port = cls.port_map['ports']
516 except:
517 relay_port = cls.port_map['uplink']
518 cls.relay_interface_port = relay_port
519 cls.relay_interfaces = (cls.port_map[cls.relay_interface_port],)
520 else:
521# cls.relay_interface_port = 100
522# cls.relay_interfaces = (g_subscriber_port_map[cls.relay_interface_port],)
523 log_test.info('No ONU ports are available, hence returning nothing')
524 cls.relay_interfaces_last = cls.relay_interfaces
525 if cls.port_map:
526 ##generate a ip/mac client virtual interface config for onos
527 interface_list = []
528 for port in cls.port_map['ports']:
529 port_num = cls.port_map[port]
530 if port_num == cls.port_map['uplink']:
531 continue
532 ip = cls.get_host_ip(port_num)
533 mac = cls.get_mac(port)
534 interface_list.append((port_num, ip, mac))
535
536 #configure dhcp server virtual interface on the same subnet as first client interface
537 relay_ip = cls.get_host_ip(interface_list[0][0])
538 relay_mac = cls.get_mac(cls.port_map[cls.relay_interface_port])
539 interface_list.append((cls.relay_interface_port, relay_ip, relay_mac))
540 cls.onos_interface_load(interface_list)
541
542 @classmethod
543 def onos_interface_load(cls, interface_list):
544 interface_dict = { 'ports': {} }
545 for port_num, ip, mac in interface_list:
546 port_map = interface_dict['ports']
547 port = '{}/{}'.format(cls.relay_device_id, port_num)
548 port_map[port] = { 'interfaces': [] }
549 interface_list = port_map[port]['interfaces']
550 interface_map = { 'ips' : [ '{}/{}'.format(ip, 24) ],
551 'mac' : mac,
552 'name': 'vir-{}'.format(port_num)
553 }
554 interface_list.append(interface_map)
555
556 cls.onos_load_config(interface_dict)
557 cls.configs['interface_config'] = interface_dict
558
559 @classmethod
560 def get_host_ip(cls, port):
561 if cls.host_ip_map.has_key(port):
562 return cls.host_ip_map[port]
563 cls.host_ip_map[port] = '192.168.1.{}'.format(port)
564 return cls.host_ip_map[port]
565
566 @classmethod
567 def host_load(cls, iface):
568 '''Have ONOS discover the hosts for dhcp-relay responses'''
569 port = g_subscriber_port_map[iface]
570 host = '173.17.1.{}'.format(port)
571 cmds = ( 'ifconfig {} 0'.format(iface),
572 'ifconfig {0} {1}'.format(iface, host),
573 'arping -I {0} {1} -c 2'.format(iface, host),
574 'ifconfig {} 0'.format(iface), )
575 for c in cmds:
576 os.system(c)
577
578 @classmethod
579 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
580 subnet = default_subnet_config):
581 conf = ''
582 for k, v in config.items():
583 conf += '{} {};\n'.format(k, v)
584
585 opts = ''
586 for k, v in options:
587 opts += 'option {} {};\n'.format(k, v)
588
589 subnet_config = ''
590 for _, v in subnet:
591 subnet_config += '{}\n'.format(v)
592
593 return '{}{}{}'.format(conf, opts, subnet_config)
594
595 @classmethod
596 def dhcpd_start(cls, intf_list = None,
597 config = default_config, options = default_options,
598 subnet = default_subnet_config):
599 '''Start the dhcpd server by generating the conf file'''
600 if intf_list is None:
601 intf_list = cls.relay_interfaces
602 ##stop dhcpd if already running
603 cls.dhcpd_stop()
604 dhcp_conf = cls.dhcpd_conf_generate(config = config, options = options,
605 subnet = subnet)
606 ##first touch dhcpd.leases if it doesn't exist
607 lease_file = '{}/dhcpd.leases'.format(cls.dhcp_data_dir)
608 if os.access(lease_file, os.F_OK) is False:
609 with open(lease_file, 'w') as fd: pass
610
611 conf_file = '{}/dhcpd.conf'.format(cls.dhcp_data_dir)
612 with open(conf_file, 'w') as fd:
613 fd.write(dhcp_conf)
614
615 #now configure the dhcpd interfaces for various subnets
616 index = 0
617 intf_info = []
618 for ip,_ in subnet:
619 intf = intf_list[index]
620 mac = cls.get_mac(intf)
621 intf_info.append((ip, mac))
622 index += 1
623 os.system('ifconfig {} {}'.format(intf, ip))
624
625 intf_str = ','.join(intf_list)
626 dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format(conf_file, lease_file, intf_str)
627 log_test.info('Starting DHCPD server with command: %s' %dhcpd_cmd)
628 ret = os.system(dhcpd_cmd)
629 assert_equal(ret, 0)
630 time.sleep(3)
631 cls.relay_interfaces_last = cls.relay_interfaces
632 cls.relay_interfaces = intf_list
633 cls.onos_dhcp_relay_load(*intf_info[0])
634
635 @classmethod
636 def dhcpd_stop(cls):
637 os.system('pkill -9 dhcpd')
638 for intf in cls.relay_interfaces:
639 os.system('ifconfig {} 0'.format(intf))
640
641 cls.relay_interfaces = cls.relay_interfaces_last
642
643 @classmethod
644 def get_mac(cls, iface):
645 if cls.interface_to_mac_map.has_key(iface):
646 return cls.interface_to_mac_map[iface]
647 mac = get_mac(iface, pad = 0)
648 cls.interface_to_mac_map[iface] = mac
649 return mac
650
651 def send_recv(self, mac=None, update_seed = False, validate = True):
652 cip, sip = self.dhcp.discover(mac = mac, update_seed = update_seed)
653 if validate:
654 assert_not_equal(cip, None)
655 assert_not_equal(sip, None)
656 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
657 (cip, sip, self.dhcp.get_mac(cip)[0]))
658 return cip,sip
659
660 @classmethod
661 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
662 subnet = default_subnet_config):
663 conf = ''
664 for k, v in config.items():
665 conf += '{} {};\n'.format(k, v)
666
667 opts = ''
668 for k, v in options:
669 opts += 'option {} {};\n'.format(k, v)
670
671 subnet_config = ''
672 for _, v in subnet:
673 subnet_config += '{}\n'.format(v)
674
675 return '{}{}{}'.format(conf, opts, subnet_config)
676
677 @classmethod
678 def onos_dhcp_relay_load(cls, server_ip, server_mac):
679 relay_device_map = '{}/{}'.format(cls.relay_device_id, cls.relay_interface_port)
680 dhcp_dict = {'apps':{'org.onosproject.dhcp-relay':{'dhcprelay':
681 {'dhcpserverConnectPoint':relay_device_map,
682 'serverip':server_ip,
683 'servermac':server_mac
684 }
685 }
686 }
687 }
688 cls.onos_load_config(dhcp_dict)
689 cls.configs['relay_config'] = dhcp_dict
690
691 @classmethod
692 def dhcp_relay_cleanup(cls):
693 ##reset the ONOS port configuration back to default
694 for config in cls.configs.items():
695 OnosCtrl.delete(config)
696 # if cls.onos_restartable is True:
697 # log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
698 # return cord_test_onos_restart(config = {})
699
700
Thangavelu K S8e413082017-07-13 20:02:14 +0000701 def tls_flow_check(self, olt_ports, cert_info = None, multiple_sub = False):
702 if multiple_sub is True:
703 olt_nni_port = olt_ports.tx_port
704 olt_uni_port = olt_ports.rx_port
705 else:
Thangavelu K S36edb012017-07-05 18:24:12 +0000706 olt_uni_port = olt_ports
707
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000708 def tls_fail_cb():
709 log_test.info('TLS verification failed')
710 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700711 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000712 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
713 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000714 if tls.failTest is True:
715 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000716 assert_equal(tls.failTest, False)
717 if cert_info == "no_cert":
718 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
719 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
720 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000721 if tls.failTest is False:
722 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000723 assert_equal(tls.failTest, True)
724 if cert_info == "invalid_cert":
725 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
726 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
727 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000728 if tls.failTest is False:
729 self.success = False
730 assert_equal(tls.failTest, True)
731 if cert_info == "same_cert":
732 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
733 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
734 tls.runTest()
735 if tls.failTest is False:
736 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000737 assert_equal(tls.failTest, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000738 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 +0000739 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 +0000740 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
741 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
742 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000743 if tls.failTest is False:
744 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000745 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000746 self.test_status = True
747 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700748
Thangavelu K S8e413082017-07-13 20:02:14 +0000749 def dhcp_flow_check(self, olt_ports, negative_test = None, multiple_sub = False):
750 if multiple_sub is True:
751 olt_nni_port = olt_ports.tx_port
752 onu_iface = olt_ports.rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +0000753 dhcp_server_startip = self.random_ip()
754 random_mac = '00:00:00:0a:0a:' + hex(random.randrange(50,254)).split('x')[1]
Thangavelu K S8e413082017-07-13 20:02:14 +0000755 else:
756 onu_iface = olt_ports
757 dhcp_server_startip = '10.10.10.20'
758 random_mac = None
Thangavelu K S735a6662017-06-15 18:08:23 +0000759 self.success = True
760
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000761 if negative_test is None:
Thangavelu K S36edb012017-07-05 18:24:12 +0000762 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = 'skip', startip = dhcp_server_startip, mac = random_mac)
763 if cip == None or sip == None:
Thangavelu K S735a6662017-06-15 18:08:23 +0000764 self.success = False
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000765 self.test_status = False
766 assert_not_equal(cip,None)
767 assert_not_equal(sip,None)
768 else:
769 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
770 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000771
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000772 if negative_test == "interrupting_dhcp_flows":
773 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
Thangavelu K S735a6662017-06-15 18:08:23 +0000774 if cip is not None:
775 self.success = False
776 assert_equal(cip,None)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000777 log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000778 self.test_status = True
779
780 if negative_test == "invalid_src_mac_broadcast":
781 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
782 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
783 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
784 self.onos_dhcp_table_load(config)
785 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
786 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000787
788 if cip is not None:
789 self.success = False
Thangavelu K S6432b522017-07-22 00:05:54 +0000790 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected = %s '%self.success)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000791 assert_equal(cip,None)
792 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
793 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000794
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000795 if negative_test == "invalid_src_mac_multicast":
796 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
797 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
798 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
799 self.onos_dhcp_table_load(config)
800 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
801 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000802 if cip is not None:
803 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000804 assert_equal(cip,None)
805 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
806 self.test_status = True
807
808 if negative_test == "invalid_src_mac_junk":
809 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
810 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
811 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
812 self.onos_dhcp_table_load(config)
813 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
814 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000815 if cip is not None:
816 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000817 assert_equal(cip,None)
818 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
819 self.test_status = True
820
821 if negative_test == "request_release":
822 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
823 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
824 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
825 self.onos_dhcp_table_load(config)
826 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
827 cip, sip = self.dhcp_sndrcv(self.dhcp)
828 log_test.info('Releasing ip %s to server %s' %(cip, sip))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000829 if not self.dhcp.release(cip):
830 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000831 assert_equal(self.dhcp.release(cip), True)
832 log_test.info('Triggering DHCP discover again after release')
833 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
834 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000835 if not cip == cip2:
Thangavelu K S735a6662017-06-15 18:08:23 +0000836 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000837 assert_equal(cip, cip2)
838 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
839 assert_equal(self.dhcp.release(cip2), True)
840 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000841
Thangavelu K S735a6662017-06-15 18:08:23 +0000842 if negative_test == "starvation_positive":
843 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
844 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
845 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
846 self.onos_dhcp_table_load(config)
847 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
848 ip_map = {}
849 for i in range(10):
850 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
851 if ip_map.has_key(cip):
852 self.success = False
853 log_test.info('IP %s given out multiple times' %cip)
854 assert_equal(False, ip_map.has_key(cip))
855 ip_map[cip] = sip
856 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000857
Thangavelu K S735a6662017-06-15 18:08:23 +0000858 if negative_test == "starvation_negative":
859 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
860 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
861 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
862 self.onos_dhcp_table_load(config)
863 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
864 log_test.info('Verifying passitive case')
865 for x in xrange(50):
866 mac = RandMAC()._fix()
867 self.dhcp_sndrcv(self.dhcp,mac = mac)
868 log_test.info('Verifying negative case')
869 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000870 if cip or sip is not None:
871 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000872 assert_equal(cip, None)
873 assert_equal(sip, None)
874 self.test_status = True
875 self.success = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000876
Thangavelu K S735a6662017-06-15 18:08:23 +0000877 if negative_test == "multiple_discover":
878 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
879 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
880 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
881 self.onos_dhcp_table_load(config)
882 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
883 cip, sip, mac, _ = self.dhcp.only_discover()
884 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
885 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000886 if cip is None:
887 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000888 assert_not_equal(cip, None)
889 log_test.info('Triggering DHCP discover again.')
890 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000891 if not new_cip == cip:
892 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000893 assert_equal(new_cip, cip)
894 log_test.info('client got same IP as expected when sent 2nd discovery')
895 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000896 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000897 if negative_test == "multiple_requests":
898 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
899 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
900 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
901 self.onos_dhcp_table_load(config)
902 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
903 log_test.info('Sending DHCP discover and DHCP request.')
904 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
905 mac = self.dhcp.get_mac(cip)[0]
906 log_test.info("Sending DHCP request again.")
907 new_cip, new_sip = self.dhcp.only_request(cip, mac)
908 assert_equal(new_cip,cip)
909 log_test.info('server offered same IP to clain for multiple requests, as expected')
910 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000911# self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000912 if negative_test == "desired_ip_address":
913 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
914 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
915 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
916 self.onos_dhcp_table_load(config)
917 self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface)
918 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000919 if cip or sip is None:
920 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000921 assert_not_equal(cip, None)
922 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
923 (cip, sip, mac))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000924 if not self.dhcp.seed_ip == cip:
925 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000926 assert_equal(cip,self.dhcp.seed_ip)
927 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
928 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000929 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000930 if negative_test == "desired_out_of_pool_ip_address":
931 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
932 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
933 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
934 self.onos_dhcp_table_load(config)
935 self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface)
936 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000937 if cip or sip is None:
938 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000939 assert_not_equal(cip, None)
940 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
941 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000942 if self.dhcp.seed_ip == cip:
943 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000944 assert_not_equal(cip,self.dhcp.seed_ip)
945 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
946 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000947 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000948 if negative_test == "dhcp_renew":
949 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
950 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
951 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
952 self.onos_dhcp_table_load(config)
953 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
954 cip, sip, mac, _ = self.dhcp.only_discover()
955 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
956 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000957 if cip or sip is None:
958 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000959 assert_not_equal(cip, None)
960 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
961 log_test.info('waiting renew time %d seconds to send next request packet'%lval)
962 time.sleep(lval)
963 latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000964 if not latest_cip == cip:
965 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000966 assert_equal(latest_cip,cip)
967 log_test.info('client got same IP after renew time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +0000968 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000969 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000970 if negative_test == "dhcp_rebind":
971 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
972 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
973 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
974 self.onos_dhcp_table_load(config)
975 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
976 cip, sip, mac, _ = self.dhcp.only_discover()
977 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
978 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000979 if cip or sip is None:
980 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000981 assert_not_equal(cip, None)
982 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
983 log_test.info('waiting rebind time %d seconds to send next request packet'%lval)
984 time.sleep(lval)
985 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000986 if not latest_cip == cip:
987 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000988 assert_equal(latest_cip,cip)
989 log_test.info('client got same IP after rebind time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +0000990 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000991 # self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000992 return self.test_status
993
Thangavelu K S8e413082017-07-13 20:02:14 +0000994 def recv_channel_cb(self, pkt):
995 ##First verify that we have received the packet for the joined instance
996 chan = self.subscriber.caddr(pkt[IP].dst)
997 assert_equal(chan in self.subscriber.join_map.keys(), True)
998 recv_time = monotonic.monotonic() * 1000000
999 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
1000 delta = recv_time - join_time
1001 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
1002 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
1003 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
1004 self.test_status = True
Thangavelu K S36edb012017-07-05 18:24:12 +00001005
Thangavelu K S8e413082017-07-13 20:02:14 +00001006 def traffic_verify(self, subscriber):
1007 # if subscriber.has_service('TRAFFIC'):
1008 url = 'http://www.google.com'
1009 resp = requests.get(url)
1010 self.test_status = resp.ok
1011 if resp.ok == False:
1012 log_test.info('Subscriber %s failed get from url %s with status code %d'
1013 %(subscriber.name, url, resp.status_code))
1014 else:
1015 log_test.info('GET request from %s succeeded for subscriber %s'
1016 %(url, subscriber.name))
1017 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001018
Thangavelu K S8e413082017-07-13 20:02:14 +00001019 def igmp_flow_check(self, subscriber, multiple_sub = False):
1020 chan = 0
1021 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1022 self.num_joins += 1
1023 while self.num_joins < self.num_subscribers:
1024 time.sleep(5)
1025 log_test.info('All subscribers have joined the channel')
1026 for i in range(10):
1027 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1028 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1029 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1030 time.sleep(5)
1031 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1032 #Should not receive packets for this subscriber
1033 self.recv_timeout = True
1034 subscriber.recv_timeout = True
1035 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1036 subscriber.recv_timeout = False
1037 self.recv_timeout = False
1038 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1039 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1040# self.test_status = True
1041 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001042
Thangavelu K S8e413082017-07-13 20:02:14 +00001043 def igmp_flow_check_join_change_to_exclude(self, subscriber, multiple_sub = False):
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001044 chan = 2
1045 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1046 self.num_joins += 1
1047 while self.num_joins < self.num_subscribers:
1048 time.sleep(5)
1049 log_test.info('All subscribers have joined the channel')
1050 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1051 time.sleep(5)
1052 chan = 1
1053 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1054 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1055 time.sleep(5)
1056 self.recv_timeout = True
1057 subscriber.recv_timeout = True
1058 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
1059 if self.test_status is True:
1060 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
1061 if self.test_status is True:
1062 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
1063 self.test_status = False
1064 subscriber.recv_timeout = False
1065 self.recv_timeout = False
1066 chan = 0
1067 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1068# self.test_status = True
1069 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001070
Thangavelu K S8e413082017-07-13 20:02:14 +00001071 def igmp_flow_check_join_change_to_exclude_again_include_back(self, subscriber, multiple_sub = False):
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001072 chan = 2
Thangavelu K S8e413082017-07-13 20:02:14 +00001073 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1074 self.num_joins += 1
1075 while self.num_joins < self.num_subscribers:
1076 time.sleep(5)
1077 log_test.info('All subscribers have joined the channel')
1078 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1079 time.sleep(5)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001080 chan = 1
1081 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port,))
Thangavelu K S8e413082017-07-13 20:02:14 +00001082 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1083 time.sleep(5)
1084 self.recv_timeout = True
1085 subscriber.recv_timeout = True
1086 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
1087 if self.test_status is True:
1088 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
1089 if self.test_status is True:
1090 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
1091 self.test_status = False
1092 subscriber.recv_timeout = False
1093 self.recv_timeout = False
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001094 chan = 1
1095 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1096 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 +00001097 time.sleep(5)
1098 self.recv_timeout = True
1099 subscriber.recv_timeout = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001100 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 +00001101 subscriber.recv_timeout = False
1102 self.recv_timeout = False
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001103 chan = 2
Thangavelu K S8e413082017-07-13 20:02:14 +00001104 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1105# self.test_status = True
1106 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001107
Thangavelu K S8e413082017-07-13 20:02:14 +00001108 def igmp_flow_check_join_change_to_block(self, subscriber, multiple_sub = False):
1109 chan = 0
1110 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1111 self.num_joins += 1
1112 while self.num_joins < self.num_subscribers:
1113 time.sleep(5)
1114 log_test.info('All subscribers have joined the channel')
1115 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1116 time.sleep(5)
1117 log_test.info('Leaving channel %d for subscriber on port %s from specific source ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1118 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_BLOCK_OLD)
1119 time.sleep(5)
1120 self.recv_timeout = True
1121 subscriber.recv_timeout = True
1122 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
1123 if self.test_status is True:
1124 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
1125 if self.test_status is True:
1126 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
1127 self.test_status = False
1128 subscriber.recv_timeout = False
1129 self.recv_timeout = False
1130 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1131 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001132
Thangavelu K S8e413082017-07-13 20:02:14 +00001133 def igmp_flow_check_join_change_to_block_again_allow_back(self, subscriber, multiple_sub = False):
1134 chan = 0
1135 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1136 self.num_joins += 1
1137 while self.num_joins < self.num_subscribers:
1138 time.sleep(5)
1139 log_test.info('All subscribers have joined the channel')
1140 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1141 time.sleep(5)
1142 log_test.info('Leaving channel %d for subscriber on port %s from specific source ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1143 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1144 time.sleep(5)
1145 self.recv_timeout = True
1146 subscriber.recv_timeout = True
1147 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
1148 if self.test_status is True:
1149 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
1150 if self.test_status is True:
1151 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
1152 self.test_status = False
1153 subscriber.recv_timeout = False
1154 self.recv_timeout = False
1155 log_test.info('Again include the source list in the group %s souce ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1156 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_ALLOW_NEW)
1157 time.sleep(5)
1158 self.recv_timeout = True
1159 subscriber.recv_timeout = True
1160 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1161 subscriber.recv_timeout = False
1162 self.recv_timeout = False
1163 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1164 return self.test_status
1165
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001166 def igmp_flow_check_group_include_source_empty_list(self, subscriber, multiple_sub = False):
1167 chan = 0
1168 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1169 self.num_joins += 1
1170 while self.num_joins < self.num_subscribers:
1171 time.sleep(5)
1172 log_test.info('All subscribers have joined the channel')
1173 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1174 if self.test_status is True:
1175 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1176 self.test_status = False
1177 else:
1178 log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port))
1179 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1180 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1181 time.sleep(5)
1182 subscriber.recv_timeout = False
1183 self.recv_timeout = False
1184 return self.test_status
1185
1186 def igmp_flow_check_group_exclude_source_empty_list(self, subscriber, multiple_sub = False):
1187 chan = 0
1188 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list,record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1189 self.num_joins += 1
1190 while self.num_joins < self.num_subscribers:
1191 time.sleep(5)
1192 log_test.info('All subscribers have joined the channel')
1193 for i in range(10):
1194 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1195 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1196 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1197 time.sleep(5)
1198 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1199 #Should not receive packets for this subscriber
1200 self.recv_timeout = True
1201 subscriber.recv_timeout = True
1202 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1203 subscriber.recv_timeout = False
1204 self.recv_timeout = False
1205 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1206 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1207# self.test_status = True
1208 return self.test_status
1209
1210 def igmp_flow_check_during_olt_onu_operational_issues(self, subscriber, multiple_sub = False):
1211 chan = 0
1212 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1213 self.num_joins += 1
1214 while self.num_joins < self.num_subscribers:
1215 time.sleep(5)
1216 log_test.info('All subscribers have joined the channel')
1217 for i in range(2):
1218 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1219 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1220 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1221 time.sleep(5)
1222 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1223 #Should not receive packets for this subscriber
1224 self.recv_timeout = True
1225 subscriber.recv_timeout = True
1226 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1227 subscriber.recv_timeout = False
1228 self.recv_timeout = False
1229 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1230 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1231# self.test_status = True
1232 return self.test_status
1233
Thangavelu K S8e413082017-07-13 20:02:14 +00001234 def voltha_igmp_jump_verify(self, subscriber):
1235 if subscriber.has_service('IGMP'):
1236 for i in xrange(subscriber.num):
1237 log_test.info('Subscriber %s jumping channel' %subscriber.name)
1238 chan = subscriber.channel_jump(delay=0)
1239 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
1240 log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1241 time.sleep(3)
1242 log_test.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats))
1243 self.test_status = True
1244 return self.test_status
1245
1246 def voltha_igmp_next_verify(self, subscriber):
1247 for c in xrange(self.VOLTHA_IGMP_ITERATIONS):
1248 for i in xrange(subscriber.num):
1249 if i:
1250 chan = subscriber.channel_join_next(delay=0, leave_flag = self.leave_flag)
1251 time.sleep(0.2)
1252 else:
1253 chan = subscriber.channel_join(i, delay=0)
1254 time.sleep(0.2)
1255 if subscriber.num == 1:
1256 subscriber.channel_leave(chan)
1257 log_test.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
1258 #subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
1259 #log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1260 self.test_status = True
1261 return self.test_status
1262
1263 def voltha_subscribers(self, services, cbs = None, num_subscribers = 1, num_channels = 1, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +00001264 """Test subscriber join next for channel surfing"""
1265 voltha = VolthaCtrl(self.VOLTHA_HOST,
1266 rest_port = self.VOLTHA_REST_PORT,
1267 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1268 if self.VOLTHA_OLT_TYPE.startswith('ponsim'):
1269 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1270 log_test.info('Enabling ponsim olt')
1271 device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001272 if device_id != '':
1273 self.olt_device_id = device_id
Thangavelu K S36edb012017-07-05 18:24:12 +00001274 else:
1275 log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution')
1276 assert_equal(False, True)
1277
1278 assert_not_equal(device_id, None)
1279 if status == False:
1280 voltha.disable_device(device_id, delete = True)
1281 assert_equal(status, True)
1282 time.sleep(10)
1283 switch_map = None
1284 olt_configured = False
1285 try:
1286 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1287 if not switch_map:
1288 log_test.info('No voltha devices found')
1289 return
1290 log_test.info('Installing OLT app')
1291 OnosCtrl.install_app(self.olt_app_file)
1292 time.sleep(5)
1293 log_test.info('Adding subscribers through OLT app')
1294 self.config_olt(switch_map)
1295 olt_configured = True
1296 time.sleep(5)
1297 self.num_subscribers = num_subscribers
1298 self.num_channels = num_channels
1299 test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers,
1300 num_channels = self.num_channels,
1301 cbs = cbs,
1302 port_list = self.generate_port_list(self.num_subscribers,
1303 self.num_channels),
Thangavelu K S8e413082017-07-13 20:02:14 +00001304 src_list = src_list, services = services)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001305 if test_status is False:
1306 self.success = False
Thangavelu K S36edb012017-07-05 18:24:12 +00001307 assert_equal(test_status, True)
1308 finally:
1309 if switch_map is not None:
1310 if olt_configured is True:
1311 self.remove_olt(switch_map)
1312 voltha.disable_device(device_id, delete = True)
1313 time.sleep(10)
1314 log_test.info('Uninstalling OLT app')
1315 OnosCtrl.uninstall_app(self.olt_app_name)
1316
Thangavelu K S8e413082017-07-13 20:02:14 +00001317 def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1,
1318 channel_start = 0, cbs = None, port_list = [], src_list = None,
Thangavelu K S36edb012017-07-05 18:24:12 +00001319 services = None, negative_subscriber_auth = None):
1320 self.test_status = False
1321 self.ovs_cleanup()
1322 subscribers_count = num_subscribers
1323 sub_loop_count = num_subscribers
1324 if not port_list:
1325 port_list = self.generate_port_list(num_subscribers, num_channels)
1326 subscriber_tx_rx_ports = []
1327 for i in range(num_subscribers):
Thangavelu K S8e413082017-07-13 20:02:14 +00001328 #subscriber_tx_rx_ports.append((self.port_map['ports'][port_list[i][0]], self.port_map['ports'][port_list[i][1]]))
1329 subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map['ports'][port_list[i][0]],
1330 rx_port = self.port_map['ports'][port_list[i][1]],
1331 num_channels = num_channels,src_list = src_list,))
Thangavelu K S36edb012017-07-05 18:24:12 +00001332 self.onos_aaa_load()
Thangavelu K S8e413082017-07-13 20:02:14 +00001333 #load the ssm list for all subscriber channels
1334 igmpChannel = IgmpChannel(src_list = src_list)
1335 ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports)
1336 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
Thangavelu K S6432b522017-07-22 00:05:54 +00001337 if src_list is None:
1338 igmpChannel = IgmpChannel()
1339 igmpChannel.igmp_load_ssm_config(ssm_list)
1340 else:
1341 igmpChannel = IgmpChannel(src_list = src_list)
1342 igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001343
Thangavelu K S36edb012017-07-05 18:24:12 +00001344 self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1)
1345
1346 chan_leave = False #for single channel, multiple subscribers
1347 if cbs is None:
1348 cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check)
1349 chan_leave = True
1350 for subscriber in subscriber_tx_rx_ports:
1351 sub_loop_count = sub_loop_count - 1
1352 pool_object = voltha_subscriber_pool(subscriber, cbs)
1353 self.thread_pool.addTask(pool_object.pool_cb)
1354 self.thread_pool.cleanUpThreads()
1355 subscribers_count = 0
1356 return self.test_status
1357
1358
1359 def generate_port_list(self, subscribers, channels):
1360 return self.port_list[:subscribers]
1361
Thangavelu K S36edb012017-07-05 18:24:12 +00001362 @classmethod
1363 def ovs_cleanup(cls):
1364 ##For every test case, delete all the OVS groups
1365 cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1'
1366 try:
1367 cord_test_shell(cmd)
1368 ##Since olt config is used for this test, we just fire a careless local cmd as well
1369 os.system(cmd)
1370 finally:
1371 return
1372
A.R Karthick8a507cf2017-06-02 18:44:49 -07001373 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -07001374 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -07001375 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
1376 assert_not_equal(device_id, None)
1377 try:
1378 assert_equal(status, True)
1379 time.sleep(10)
1380 finally:
1381 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001382
A.R Karthick8a507cf2017-06-02 18:44:49 -07001383 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001384 log_test.info('Enabling ponsim_olt')
1385 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -07001386 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1387 assert_not_equal(device_id, None)
1388 try:
1389 assert_equal(status, True)
1390 time.sleep(10)
1391 finally:
1392 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001393
Thangavelu K S008f38e2017-05-15 19:36:55 +00001394 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
1395 """
1396 Test Method:
1397 0. Make sure that voltha is up and running on CORD-POD setup.
1398 1. OLT and ONU is detected and validated.
1399 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1400 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
1401 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
1402 5. Verify that subscriber is authenticated successfully.
1403 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001404 log_test.info('Enabling ponsim_olt')
1405 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1406 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1407 assert_not_equal(device_id, None)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001408 if status == False:
1409 self.voltha.disable_device(device_id, delete = True)
1410 assert_equal(status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001411 time.sleep(10)
1412 switch_map = None
1413 olt_configured = False
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001414 voltha = VolthaCtrl(self.VOLTHA_HOST,
1415 rest_port = self.VOLTHA_REST_PORT,
1416 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001417 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001418 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1419 if not switch_map:
1420 log_test.info('No voltha devices found')
1421 return
1422 log_test.info('Installing OLT app')
1423 OnosCtrl.install_app(self.olt_app_file)
1424 time.sleep(5)
1425 log_test.info('Adding subscribers through OLT app')
1426 self.config_olt(switch_map)
1427 olt_configured = True
1428 time.sleep(5)
1429 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001430 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001431 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001432 if switch_map is not None:
1433 if olt_configured is True:
1434 self.remove_olt(switch_map)
1435 self.voltha.disable_device(device_id, delete = True)
1436 time.sleep(10)
1437 OnosCtrl.uninstall_app(self.olt_app_name)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001438
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001439 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001440 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
1441 """
1442 Test Method:
1443 0. Make sure that voltha is up and running on CORD-POD setup.
1444 1. OLT and ONU is detected and validated.
1445 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1446 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1447 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
1448 5. Verify that subscriber authentication is unsuccessful..
1449 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001450 df = defer.Deferred()
1451 def tls_flow_check_with_no_cert_scenario(df):
1452 log_test.info('Enabling ponsim_olt')
1453 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1454 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1455 assert_not_equal(device_id, None)
1456 voltha = VolthaCtrl(self.VOLTHA_HOST,
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001457 rest_port = self.VOLTHA_REST_PORT,
1458 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001459 time.sleep(10)
1460 switch_map = None
1461 olt_configured = False
1462 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1463 log_test.info('Installing OLT app')
1464 OnosCtrl.install_app(self.olt_app_file)
1465 time.sleep(5)
1466 log_test.info('Adding subscribers through OLT app')
1467 self.config_olt(switch_map)
1468 olt_configured = True
1469 time.sleep(5)
1470 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1471 try:
1472 assert_equal(auth_status, True)
1473 assert_equal(status, True)
1474 time.sleep(10)
1475 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001476 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001477 self.voltha.disable_device(device_id, delete = True)
1478 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001479
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001480 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1481 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001482
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001483 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001484 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
1485 """
1486 Test Method:
1487 0. Make sure that voltha is up and running on CORD-POD setup.
1488 1. OLT and ONU is detected and validated.
1489 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1490 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
1491 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1492 5. Verify that subscriber authentication is unsuccessful..
1493 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001494 df = defer.Deferred()
1495 def tls_flow_check_with_invalid_cert_scenario(df):
1496 log_test.info('Enabling ponsim_olt')
1497 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1498 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1499 assert_not_equal(device_id, None)
1500 voltha = VolthaCtrl(self.VOLTHA_HOST,
1501 rest_port = self.VOLTHA_REST_PORT,
1502 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1503 time.sleep(10)
1504 switch_map = None
1505 olt_configured = False
1506 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1507 log_test.info('Installing OLT app')
1508 OnosCtrl.install_app(self.olt_app_file)
1509 time.sleep(5)
1510 log_test.info('Adding subscribers through OLT app')
1511 self.config_olt(switch_map)
1512 olt_configured = True
1513 time.sleep(5)
1514 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1515 try:
1516 assert_equal(auth_status, True)
1517 assert_equal(status, True)
1518 time.sleep(10)
1519 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001520 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001521 self.voltha.disable_device(device_id, delete = True)
1522 df.callback(0)
1523 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
1524 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001525
Thangavelu K S0d745c82017-06-09 21:56:08 +00001526 @deferred(TESTCASE_TIMEOUT)
1527 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
1528 """
1529 Test Method:
1530 0. Make sure that voltha is up and running on CORD-POD setup.
1531 1. OLT and ONU is detected and validated.
1532 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1533 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
1534 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1535 5. Verify that subscriber authentication is unsuccessful..
1536 """
1537 df = defer.Deferred()
1538 def tls_flow_check_with_no_cert_scenario(df):
1539 log_test.info('Enabling ponsim_olt')
1540 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1541 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1542 assert_not_equal(device_id, None)
1543 voltha = VolthaCtrl(self.VOLTHA_HOST,
1544 rest_port = self.VOLTHA_REST_PORT,
1545 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1546 time.sleep(10)
1547 switch_map = None
1548 olt_configured = False
1549 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1550 log_test.info('Installing OLT app')
1551 OnosCtrl.install_app(self.olt_app_file)
1552 time.sleep(5)
1553 log_test.info('Adding subscribers through OLT app')
1554 self.config_olt(switch_map)
1555 olt_configured = True
1556 time.sleep(5)
1557 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1558 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1559 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1560 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1561 try:
1562 assert_equal(auth_status, True)
1563 assert_equal(status, True)
1564 time.sleep(10)
1565 finally:
1566 self.voltha.disable_device(device_id, delete = True)
1567 df.callback(0)
1568 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1569 return df
1570
1571 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001572 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
1573 """
1574 Test Method:
1575 0. Make sure that voltha is up and running on CORD-POD setup.
1576 1. OLT and ONU is detected and validated.
1577 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1578 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1579 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
1580 5. Verify that subscriber authentication is unsuccessful..
1581 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001582 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001583 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001584 aaa_app = ["org.opencord.aaa"]
1585 log_test.info('Enabling ponsim_olt')
1586 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1587 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1588 assert_not_equal(device_id, None)
1589 voltha = VolthaCtrl(self.VOLTHA_HOST,
1590 rest_port = self.VOLTHA_REST_PORT,
1591 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1592 time.sleep(10)
1593 switch_map = None
1594 olt_configured = False
1595 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1596 log_test.info('Installing OLT app')
1597 OnosCtrl.install_app(self.olt_app_file)
1598 time.sleep(5)
1599 log_test.info('Adding subscribers through OLT app')
1600 self.config_olt(switch_map)
1601 olt_configured = True
1602 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001603
Thangavelu K S0d745c82017-06-09 21:56:08 +00001604 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
1605 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
1606 thread1.start()
1607 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001608 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001609 thread2.start()
1610 time.sleep(10)
1611 thread1.join()
1612 thread2.join()
1613 try:
1614 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001615 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001616 time.sleep(10)
1617 finally:
1618 self.voltha.disable_device(device_id, delete = True)
1619 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001620 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001621 return df
1622
1623 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001624 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
1625 """
1626 Test Method:
1627 0. Make sure that voltha is up and running on CORD-POD setup.
1628 1. OLT and ONU is detected and validated.
1629 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1630 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1631 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
1632 5. Verify that subscriber authentication is unsuccessful..
1633 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001634 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001635 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001636 aaa_app = ["org.opencord.aaa"]
1637 log_test.info('Enabling ponsim_olt')
1638 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1639 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1640 assert_not_equal(device_id, None)
1641 voltha = VolthaCtrl(self.VOLTHA_HOST,
1642 rest_port = self.VOLTHA_REST_PORT,
1643 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1644 time.sleep(10)
1645 switch_map = None
1646 olt_configured = False
1647 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1648 log_test.info('Installing OLT app')
1649 OnosCtrl.install_app(self.olt_app_file)
1650 time.sleep(5)
1651 log_test.info('Adding subscribers through OLT app')
1652 self.config_olt(switch_map)
1653 olt_configured = True
1654 time.sleep(5)
1655
1656 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
1657 thread2 = threading.Thread(target = cord_test_radius_restart)
1658 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001659 time.sleep(randint(1,2))
1660 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001661 thread2.start()
1662 time.sleep(10)
1663 thread1.join()
1664 thread2.join()
1665 try:
1666 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001667 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001668 time.sleep(10)
1669 finally:
1670 self.voltha.disable_device(device_id, delete = True)
1671 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001672 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001673 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001674
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001675 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001676 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
1677 """
1678 Test Method:
1679 0. Make sure that voltha is up and running on CORD-POD setup.
1680 1. OLT and ONU is detected and validated.
1681 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1682 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1683 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1684 6. Verify that subscriber authenticated successfully.
1685 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
1686 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1687 9. Verify that subscriber authentication is unsuccessful..
1688 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001689 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001690 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001691 aaa_app = ["org.opencord.aaa"]
1692 log_test.info('Enabling ponsim_olt')
1693 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1694 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1695 assert_not_equal(device_id, None)
1696 voltha = VolthaCtrl(self.VOLTHA_HOST,
1697 rest_port = self.VOLTHA_REST_PORT,
1698 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1699 time.sleep(10)
1700 switch_map = None
1701 olt_configured = False
1702 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1703 log_test.info('Installing OLT app')
1704 OnosCtrl.install_app(self.olt_app_file)
1705 time.sleep(5)
1706 log_test.info('Adding subscribers through OLT app')
1707 self.config_olt(switch_map)
1708 olt_configured = True
1709 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001710
Thangavelu K S0d745c82017-06-09 21:56:08 +00001711 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001712 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +00001713 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001714 time.sleep(randint(1,2))
1715 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001716 thread2.start()
1717 time.sleep(10)
1718 thread1.join()
1719 thread2.join()
1720 try:
1721 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001722 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001723 time.sleep(10)
1724 finally:
1725 self.voltha.disable_device(device_id, delete = True)
1726 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001727 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001728 return df
1729
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001730 @deferred(TESTCASE_TIMEOUT)
1731 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001732 """
1733 Test Method:
1734 0. Make sure that voltha is up and running on CORD-POD setup.
1735 1. OLT and ONU is detected and validated.
1736 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1737 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1738 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1739 6. Verify that subscriber authenticated successfully.
1740 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1741 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1742 9. Verify that subscriber authentication is unsuccessful..
1743 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001744 df = defer.Deferred()
1745 def tls_flow_check_operating_olt_state(df):
1746 aaa_app = ["org.opencord.aaa"]
1747 log_test.info('Enabling ponsim_olt')
1748 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1749 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1750 assert_not_equal(device_id, None)
1751 voltha = VolthaCtrl(self.VOLTHA_HOST,
1752 rest_port = self.VOLTHA_REST_PORT,
1753 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1754 time.sleep(10)
1755 switch_map = None
1756 olt_configured = False
1757 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1758 log_test.info('Installing OLT app')
1759 OnosCtrl.install_app(self.olt_app_file)
1760 time.sleep(5)
1761 log_test.info('Adding subscribers through OLT app')
1762 self.config_olt(switch_map)
1763 olt_configured = True
1764 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001765
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001766 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1767 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
1768 thread1.start()
1769 time.sleep(randint(1,2))
1770 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1771 thread2.start()
1772 time.sleep(10)
1773 thread1.join()
1774 thread2.join()
1775 try:
1776 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001777 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001778 time.sleep(10)
1779 finally:
1780 self.voltha.disable_device(device_id, delete = True)
1781 df.callback(0)
1782 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1783 return df
1784
1785 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001786 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self):
1787 """
1788 Test Method:
1789 0. Make sure that voltha is up and running on CORD-POD setup.
1790 1. OLT and ONU is detected and validated.
1791 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1792 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1793 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1794 6. Verify that subscriber authenticated successfully.
1795 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1796 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1797 9. Verify that subscriber authentication is unsuccessful..
1798 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1799
1800 """
1801 df = defer.Deferred()
1802 no_iterations = 10
1803 def tls_flow_check_with_disable_olt_device_scenario(df):
1804 aaa_app = ["org.opencord.aaa"]
1805 log_test.info('Enabling ponsim_olt')
1806 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1807 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1808 assert_not_equal(device_id, None)
1809 voltha = VolthaCtrl(self.VOLTHA_HOST,
1810 rest_port = self.VOLTHA_REST_PORT,
1811 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1812 time.sleep(10)
1813 switch_map = None
1814 olt_configured = False
1815 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1816 log_test.info('Installing OLT app')
1817 OnosCtrl.install_app(self.olt_app_file)
1818 time.sleep(5)
1819 log_test.info('Adding subscribers through OLT app')
1820 self.config_olt(switch_map)
1821 olt_configured = True
1822 time.sleep(5)
1823 for i in range(no_iterations):
1824 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1825 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
1826 thread1.start()
1827 time.sleep(randint(1,2))
1828 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1829 thread2.start()
1830 time.sleep(10)
1831 thread1.join()
1832 thread2.join()
1833 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
1834 try:
1835 # assert_equal(status, True)
1836 assert_equal(auth_status, True)
1837 assert_equal(self.success, True)
1838 time.sleep(10)
1839 finally:
1840 self.voltha.disable_device(device_id, delete = True)
1841 df.callback(0)
1842 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
1843 return df
1844
1845 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001846 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
1847 """
1848 Test Method:
1849 0. Make sure that voltha is up and running on CORD-POD setup.
1850 1. OLT and ONU is detected and validated.
1851 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1852 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1853 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1854 6. Verify that subscriber authenticated successfully.
1855 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
1856 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1857 9. Verify that subscriber authentication is unsuccessful..
1858 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001859 df = defer.Deferred()
1860 def tls_flow_check_operating_olt_state(df):
1861 aaa_app = ["org.opencord.aaa"]
1862 log_test.info('Enabling ponsim_olt')
1863 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1864 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1865 assert_not_equal(device_id, None)
1866 voltha = VolthaCtrl(self.VOLTHA_HOST,
1867 rest_port = self.VOLTHA_REST_PORT,
1868 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1869 time.sleep(10)
1870 switch_map = None
1871 olt_configured = False
1872 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1873 log_test.info('Installing OLT app')
1874 OnosCtrl.install_app(self.olt_app_file)
1875 time.sleep(5)
1876 log_test.info('Adding subscribers through OLT app')
1877 self.config_olt(switch_map)
1878 olt_configured = True
1879 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001880
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001881 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
1882 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
1883 thread1.start()
1884 time.sleep(randint(1,2))
1885 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
1886 thread2.start()
1887 time.sleep(10)
1888 thread1.join()
1889 thread2.join()
1890 try:
1891 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001892 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001893 time.sleep(10)
1894 finally:
1895 self.voltha.disable_device(device_id, delete = True)
1896 df.callback(0)
1897 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1898 return df
1899
1900 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00001901 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self):
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001902 """
1903 Test Method:
1904 0. Make sure that voltha is up and running on CORD-POD setup.
1905 1. OLT and ONU is detected and validated.
1906 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1907 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1908 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1909 6. Verify that subscriber authenticated successfully.
1910 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
1911 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1912 9. Verify that subscriber authentication is unsuccessful..
1913 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1914 """
1915 df = defer.Deferred()
1916 no_iterations = 10
1917 def tls_flow_check_with_disable_olt_device_scenario(df):
1918 aaa_app = ["org.opencord.aaa"]
1919 log_test.info('Enabling ponsim_olt')
1920 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1921 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1922 assert_not_equal(device_id, None)
1923 voltha = VolthaCtrl(self.VOLTHA_HOST,
1924 rest_port = self.VOLTHA_REST_PORT,
1925 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1926 time.sleep(10)
1927 switch_map = None
1928 olt_configured = False
1929 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1930 log_test.info('Installing OLT app')
1931 OnosCtrl.install_app(self.olt_app_file)
1932 time.sleep(5)
1933 log_test.info('Adding subscribers through OLT app')
1934 self.config_olt(switch_map)
1935 olt_configured = True
1936 time.sleep(5)
1937 for i in range(no_iterations):
1938 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
1939 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
1940 thread1.start()
1941 time.sleep(randint(1,2))
1942 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
1943 thread2.start()
1944 time.sleep(10)
1945 thread1.join()
1946 thread2.join()
1947 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
1948 try:
1949 # assert_equal(status, True)
1950 assert_equal(auth_status, True)
1951 assert_equal(self.success, True)
1952 time.sleep(10)
1953 finally:
1954 self.voltha.disable_device(device_id, delete = True)
1955 df.callback(0)
1956 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
1957 return df
1958
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001959 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001960 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
1961 """
1962 Test Method:
1963 0. Make sure that voltha is up and running on CORD-POD setup.
1964 1. OLT and ONU is detected and validated.
1965 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1966 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1967 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1968 6. Verify that subscriber authenticated successfully.
1969 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
1970 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1971 9. Verify that subscriber authentication is unsuccessful..
1972 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001973 df = defer.Deferred()
1974 def tls_flow_check_operating_olt_state(df):
1975 aaa_app = ["org.opencord.aaa"]
1976 log_test.info('Enabling ponsim_olt')
1977 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1978 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1979 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00001980 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1981
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001982 onu_device_id = devices_list['items'][1]['id']
1983 assert_not_equal(device_id, None)
1984 voltha = VolthaCtrl(self.VOLTHA_HOST,
1985 rest_port = self.VOLTHA_REST_PORT,
1986 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
1987 time.sleep(10)
1988 switch_map = None
1989 olt_configured = False
1990 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1991 log_test.info('Installing OLT app')
1992 OnosCtrl.install_app(self.olt_app_file)
1993 time.sleep(5)
1994 log_test.info('Adding subscribers through OLT app')
1995 self.config_olt(switch_map)
1996 olt_configured = True
1997 time.sleep(5)
1998 devices_list = self.voltha.get_devices()
1999 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2000 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2001 thread1.start()
2002 time.sleep(randint(1,2))
2003 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2004 thread2.start()
2005 time.sleep(10)
2006 thread1.join()
2007 thread2.join()
2008 try:
2009 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002010 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002011 time.sleep(10)
2012 finally:
2013 self.voltha.disable_device(device_id, delete = True)
2014 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002015 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002016 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002017
Thangavelu K S9648eed2017-06-13 20:15:25 +00002018 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002019 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
2020 """
2021 Test Method:
2022 0. Make sure that voltha is up and running on CORD-POD setup.
2023 1. OLT and ONU is detected and validated.
2024 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2025 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2026 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2027 6. Verify that subscriber authenticated successfully.
2028 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2029 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2030 9. Verify that subscriber authentication is unsuccessful..
2031 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2032 """
2033 df = defer.Deferred()
2034 no_iterations = 10
2035 def tls_flow_check_operating_olt_state(df):
2036 aaa_app = ["org.opencord.aaa"]
2037 log_test.info('Enabling ponsim_olt')
2038 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2039 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2040 devices_list = self.voltha.get_devices()
2041 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2042
2043 onu_device_id = devices_list['items'][1]['id']
2044 assert_not_equal(device_id, None)
2045 voltha = VolthaCtrl(self.VOLTHA_HOST,
2046 rest_port = self.VOLTHA_REST_PORT,
2047 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2048 time.sleep(10)
2049 switch_map = None
2050 olt_configured = False
2051 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2052 log_test.info('Installing OLT app')
2053 OnosCtrl.install_app(self.olt_app_file)
2054 time.sleep(5)
2055 log_test.info('Adding subscribers through OLT app')
2056 self.config_olt(switch_map)
2057 olt_configured = True
2058 time.sleep(5)
2059 devices_list = self.voltha.get_devices()
2060 for i in range(no_iterations):
2061 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2062 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2063 thread1.start()
2064 time.sleep(randint(1,2))
2065 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2066 thread2.start()
2067 time.sleep(10)
2068 thread1.join()
2069 thread2.join()
2070 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2071 try:
2072 # assert_equal(status, True)
2073 assert_equal(auth_status, True)
2074 assert_equal(self.success, True)
2075 time.sleep(10)
2076 finally:
2077 self.voltha.disable_device(device_id, delete = True)
2078 df.callback(0)
2079 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2080 return df
2081
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002082 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002083 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002084 """
2085 Test Method:
2086 0. Make sure that voltha is up and running on CORD-POD setup.
2087 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2088 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2089 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2090 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
2091 5. Verify that two subscribers are authenticated successfully.
2092 """
2093
Thangavelu K S9648eed2017-06-13 20:15:25 +00002094 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002095 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002096 aaa_app = ["org.opencord.aaa"]
2097 log_test.info('Enabling ponsim_olt')
2098 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2099 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2100 devices_list = self.voltha.get_devices()
2101 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2102
2103 onu_device_id = devices_list['items'][1]['id']
2104 assert_not_equal(device_id, None)
2105 voltha = VolthaCtrl(self.VOLTHA_HOST,
2106 rest_port = self.VOLTHA_REST_PORT,
2107 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2108 time.sleep(10)
2109 switch_map = None
2110 olt_configured = False
2111 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2112 log_test.info('Installing OLT app')
2113 OnosCtrl.install_app(self.olt_app_file)
2114 time.sleep(5)
2115 log_test.info('Adding subscribers through OLT app')
2116 self.config_olt(switch_map)
2117 olt_configured = True
2118 time.sleep(5)
2119 devices_list = self.voltha.get_devices()
2120 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2121 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2122 thread1.start()
2123 time.sleep(randint(1,2))
2124 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2125 thread2.start()
2126 time.sleep(10)
2127 thread1.join()
2128 thread2.join()
2129 try:
2130 # assert_equal(status, True)
2131 assert_equal(self.success, True)
2132 time.sleep(10)
2133 finally:
2134 self.voltha.disable_device(device_id, delete = True)
2135 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002136 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002137 return df
2138
2139 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002140 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002141 """
2142 Test Method:
2143 0. Make sure that voltha is up and running on CORD-POD setup.
2144 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2145 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2146 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2147 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
2148 5. Verify that two subscribers are not authenticated.
2149 """
2150
Thangavelu K S9648eed2017-06-13 20:15:25 +00002151 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002152 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002153 aaa_app = ["org.opencord.aaa"]
2154 log_test.info('Enabling ponsim_olt')
2155 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2156 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2157 devices_list = self.voltha.get_devices()
2158 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2159
2160 onu_device_id = devices_list['items'][1]['id']
2161 assert_not_equal(device_id, None)
2162 voltha = VolthaCtrl(self.VOLTHA_HOST,
2163 rest_port = self.VOLTHA_REST_PORT,
2164 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2165 time.sleep(10)
2166 switch_map = None
2167 olt_configured = False
2168 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2169 log_test.info('Installing OLT app')
2170 OnosCtrl.install_app(self.olt_app_file)
2171 time.sleep(5)
2172 log_test.info('Adding subscribers through OLT app')
2173 self.config_olt(switch_map)
2174 olt_configured = True
2175 time.sleep(5)
2176 devices_list = self.voltha.get_devices()
2177 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2178 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
2179 thread1.start()
2180 time.sleep(randint(1,2))
2181 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2182 thread2.start()
2183 time.sleep(10)
2184 thread1.join()
2185 thread2.join()
2186 try:
2187 # assert_equal(status, True)
2188 assert_equal(self.success, True)
2189 time.sleep(10)
2190 finally:
2191 self.voltha.disable_device(device_id, delete = True)
2192 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002193 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002194 return df
2195
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002196 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002197 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 +00002198 """
2199 Test Method:
2200 0. Make sure that voltha is up and running on CORD-POD setup.
2201 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2202 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2203 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2204 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2205 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
2206 6. Verify that valid subscriber authenticated successfully.
2207 7. Verify that invalid subscriber are not authenticated successfully.
2208 """
2209
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002210 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002211 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002212 aaa_app = ["org.opencord.aaa"]
2213 log_test.info('Enabling ponsim_olt')
2214 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2215 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2216 devices_list = self.voltha.get_devices()
2217 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2218
2219 onu_device_id = devices_list['items'][1]['id']
2220 assert_not_equal(device_id, None)
2221 voltha = VolthaCtrl(self.VOLTHA_HOST,
2222 rest_port = self.VOLTHA_REST_PORT,
2223 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2224 time.sleep(10)
2225 switch_map = None
2226 olt_configured = False
2227 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2228 log_test.info('Installing OLT app')
2229 OnosCtrl.install_app(self.olt_app_file)
2230 time.sleep(5)
2231 log_test.info('Adding subscribers through OLT app')
2232 self.config_olt(switch_map)
2233 olt_configured = True
2234 time.sleep(5)
2235 devices_list = self.voltha.get_devices()
2236 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2237 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
2238 thread1.start()
2239 time.sleep(randint(1,2))
2240 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2241 thread2.start()
2242 time.sleep(10)
2243 thread1.join()
2244 thread2.join()
2245 try:
2246 # assert_equal(status, True)
2247 assert_equal(self.success, True)
2248 time.sleep(10)
2249 finally:
2250 self.voltha.disable_device(device_id, delete = True)
2251 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002252 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002253 return df
2254
2255 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002256 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 +00002257 """
2258 Test Method:
2259 0. Make sure that voltha is up and running on CORD-POD setup.
2260 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2261 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2262 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2263 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2264 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
2265 6. Verify that valid subscriber authenticated successfully.
2266 7. Verify that invalid subscriber are not authenticated successfully.
2267 """
2268
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002269 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002270 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002271 aaa_app = ["org.opencord.aaa"]
2272 log_test.info('Enabling ponsim_olt')
2273 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2274 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2275 devices_list = self.voltha.get_devices()
2276 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2277
2278 onu_device_id = devices_list['items'][1]['id']
2279 assert_not_equal(device_id, None)
2280 voltha = VolthaCtrl(self.VOLTHA_HOST,
2281 rest_port = self.VOLTHA_REST_PORT,
2282 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2283 time.sleep(10)
2284 switch_map = None
2285 olt_configured = False
2286 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2287 log_test.info('Installing OLT app')
2288 OnosCtrl.install_app(self.olt_app_file)
2289 time.sleep(5)
2290 log_test.info('Adding subscribers through OLT app')
2291 self.config_olt(switch_map)
2292 olt_configured = True
2293 time.sleep(5)
2294 devices_list = self.voltha.get_devices()
2295 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2296 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
2297 thread1.start()
2298 time.sleep(randint(1,2))
2299 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2300 thread2.start()
2301 time.sleep(10)
2302 thread1.join()
2303 thread2.join()
2304 try:
2305 # assert_equal(status, True)
2306 assert_equal(self.success, True)
2307 time.sleep(10)
2308 finally:
2309 self.voltha.disable_device(device_id, delete = True)
2310 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002311 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002312 return df
2313
2314 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002315 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002316 """
2317 Test Method:
2318 0. Make sure that voltha is up and running on CORD-POD setup.
2319 1. OLT and ONU is detected and validated.
2320 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2321 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2322 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
2323 6. Verify that subscriber authenticated successfully.
2324 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
2325 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
2326 9. Verify that subscriber authentication is unsuccessful..
2327 10. Verify that other subscriber authenticated successfully.
2328 """
2329
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002330 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002331 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002332 aaa_app = ["org.opencord.aaa"]
2333 log_test.info('Enabling ponsim_olt')
2334 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2335 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2336 devices_list = self.voltha.get_devices()
2337 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2338
2339 onu_device_id = devices_list['items'][1]['id']
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 devices_list = self.voltha.get_devices()
2356 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2357 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
2358 thread1.start()
2359 time.sleep(randint(1,2))
2360 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2361 thread2.start()
2362 time.sleep(10)
2363 thread1.join()
2364 thread2.join()
2365 try:
2366 # assert_equal(status, True)
2367 assert_equal(self.success, True)
2368 time.sleep(10)
2369 finally:
2370 self.voltha.disable_device(device_id, delete = True)
2371 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002372 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002373 return df
2374
Thangavelu K S36edb012017-07-05 18:24:12 +00002375 def test_3_subscribers_with_voltha_for_eap_tls_authentication(self):
2376 """
2377 Test Method:
2378 0. Make sure that voltha is up and running on CORD-POD setup.
2379 1. OLT and ONU is detected and validated.
2380 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2381 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers)
2382 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2383 5. Verify that subscriber is authenticated successfully.
2384 """
2385 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2386 num_subscribers = 3
2387 num_channels = 1
2388 services = ('TLS')
2389 cbs = (self.tls_flow_check, None, None)
2390 self.voltha_subscribers(services, cbs = cbs,
2391 num_subscribers = num_subscribers,
2392 num_channels = num_channels)
2393
2394 def test_5_subscribers_with_voltha_for_eap_tls_authentication(self):
2395 """
2396 Test Method:
2397 0. Make sure that voltha is up and running on CORD-POD setup.
2398 1. OLT and ONU is detected and validated.
2399 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2400 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber)
2401 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2402 5. Verify that subscriber is authenticated successfully.
2403 """
2404 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2405 num_subscribers = 5
2406 num_channels = 1
2407 services = ('TLS')
2408 cbs = (self.tls_flow_check, None, None)
2409 self.voltha_subscribers(services, cbs = cbs,
2410 num_subscribers = num_subscribers,
2411 num_channels = num_channels)
2412
2413 def test_9_subscribers_with_voltha_for_eap_tls_authentication(self):
2414 """
2415 Test Method:
2416 0. Make sure that voltha is up and running on CORD-POD setup.
2417 1. OLT and ONU is detected and validated.
2418 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2419 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber)
2420 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2421 5. Verify that subscriber is authenticated successfully.
2422 """
2423 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2424 num_subscribers = 9
2425 num_channels = 1
2426 services = ('TLS')
2427 cbs = (self.tls_flow_check, None, None)
2428 self.voltha_subscribers(services, cbs = cbs,
2429 num_subscribers = num_subscribers,
2430 num_channels = num_channels)
2431
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002432 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002433 def test_subscriber_with_voltha_for_dhcp_request(self):
2434 """
2435 Test Method:
2436 0. Make sure that voltha is up and running on CORD-POD setup.
2437 1. OLT and ONU is detected and validated.
2438 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2439 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2440 4. Verify that subscriber get ip from dhcp server successfully.
2441 """
2442
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002443 df = defer.Deferred()
2444 def dhcp_flow_check_scenario(df):
2445 log_test.info('Enabling ponsim_olt')
2446 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2447 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2448 assert_not_equal(device_id, None)
2449 voltha = VolthaCtrl(self.VOLTHA_HOST,
2450 rest_port = self.VOLTHA_REST_PORT,
2451 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2452 time.sleep(10)
2453 switch_map = None
2454 olt_configured = False
2455 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2456 log_test.info('Installing OLT app')
2457 OnosCtrl.install_app(self.olt_app_file)
2458 time.sleep(5)
2459 log_test.info('Adding subscribers through OLT app')
2460 self.config_olt(switch_map)
2461 olt_configured = True
2462 time.sleep(5)
2463 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2464 try:
2465 assert_equal(dhcp_status, True)
2466 #assert_equal(status, True)
2467 time.sleep(10)
2468 finally:
2469 self.remove_olt(switch_map)
2470 self.voltha.disable_device(device_id, delete = True)
2471 df.callback(0)
2472
2473 reactor.callLater(0, dhcp_flow_check_scenario, df)
2474 return df
2475
2476 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002477 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
2478 """
2479 Test Method:
2480 0. Make sure that voltha is up and running on CORD-POD setup.
2481 1. OLT and ONU is detected and validated.
2482 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2483 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
2484 4. Verify that subscriber should not get ip from dhcp server.
2485 """
2486
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002487 df = defer.Deferred()
2488 def dhcp_flow_check_scenario(df):
2489 log_test.info('Enabling ponsim_olt')
2490 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2491 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2492 assert_not_equal(device_id, None)
2493 voltha = VolthaCtrl(self.VOLTHA_HOST,
2494 rest_port = self.VOLTHA_REST_PORT,
2495 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2496 time.sleep(10)
2497 switch_map = None
2498 olt_configured = False
2499 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2500 log_test.info('Installing OLT app')
2501 OnosCtrl.install_app(self.olt_app_file)
2502 time.sleep(5)
2503 log_test.info('Adding subscribers through OLT app')
2504 self.config_olt(switch_map)
2505 olt_configured = True
2506 time.sleep(5)
2507 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
2508 try:
2509 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002510 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002511 #assert_equal(status, True)
2512 time.sleep(10)
2513 finally:
2514 self.voltha.disable_device(device_id, delete = True)
2515 self.remove_olt(switch_map)
2516 df.callback(0)
2517
2518 reactor.callLater(0, dhcp_flow_check_scenario, df)
2519 return df
2520
2521
2522 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002523 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
2524 """
2525 Test Method:
2526 0. Make sure that voltha is up and running on CORD-POD setup.
2527 1. OLT and ONU is detected and validated.
2528 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2529 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
2530 4. Verify that subscriber should not get ip from dhcp server.
2531 """
2532
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002533 df = defer.Deferred()
2534 def dhcp_flow_check_scenario(df):
2535 log_test.info('Enabling ponsim_olt')
2536 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2537 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2538 assert_not_equal(device_id, None)
2539 voltha = VolthaCtrl(self.VOLTHA_HOST,
2540 rest_port = self.VOLTHA_REST_PORT,
2541 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2542 time.sleep(10)
2543 switch_map = None
2544 olt_configured = False
2545 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2546 log_test.info('Installing OLT app')
2547 OnosCtrl.install_app(self.olt_app_file)
2548 time.sleep(5)
2549 log_test.info('Adding subscribers through OLT app')
2550 self.config_olt(switch_map)
2551 olt_configured = True
2552 time.sleep(5)
2553 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
2554 try:
2555 assert_equal(dhcp_status, True)
2556 #assert_equal(status, True)
2557 time.sleep(10)
2558 finally:
2559 self.voltha.disable_device(device_id, delete = True)
2560 self.remove_olt(switch_map)
2561 df.callback(0)
2562
2563 reactor.callLater(0, dhcp_flow_check_scenario, df)
2564 return df
2565
2566 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002567 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
2568 """
2569 Test Method:
2570 0. Make sure that voltha is up and running on CORD-POD setup.
2571 1. OLT and ONU is detected and validated.
2572 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2573 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
2574 4. Verify that subscriber should not get ip from dhcp server.
2575 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002576 df = defer.Deferred()
2577 def dhcp_flow_check_scenario(df):
2578 log_test.info('Enabling ponsim_olt')
2579 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2580 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2581 assert_not_equal(device_id, None)
2582 voltha = VolthaCtrl(self.VOLTHA_HOST,
2583 rest_port = self.VOLTHA_REST_PORT,
2584 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2585 time.sleep(10)
2586 switch_map = None
2587 olt_configured = False
2588 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2589 log_test.info('Installing OLT app')
2590 OnosCtrl.install_app(self.olt_app_file)
2591 time.sleep(5)
2592 log_test.info('Adding subscribers through OLT app')
2593 self.config_olt(switch_map)
2594 olt_configured = True
2595 time.sleep(5)
2596 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
2597 try:
2598 assert_equal(dhcp_status, True)
2599 #assert_equal(status, True)
2600 time.sleep(10)
2601 finally:
2602 self.voltha.disable_device(device_id, delete = True)
2603 self.remove_olt(switch_map)
2604 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002605
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002606 reactor.callLater(0, dhcp_flow_check_scenario, df)
2607 return df
2608
2609 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002610 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
2611 """
2612 Test Method:
2613 0. Make sure that voltha is up and running on CORD-POD setup.
2614 1. OLT and ONU is detected and validated.
2615 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2616 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2617 4. Verify that subscriber get ip from dhcp server successfully.
2618 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
2619 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
2620 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002621 df = defer.Deferred()
2622 def dhcp_flow_check_scenario(df):
2623 log_test.info('Enabling ponsim_olt')
2624 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2625 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2626 assert_not_equal(device_id, None)
2627 voltha = VolthaCtrl(self.VOLTHA_HOST,
2628 rest_port = self.VOLTHA_REST_PORT,
2629 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2630 time.sleep(10)
2631 switch_map = None
2632 olt_configured = False
2633 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2634 log_test.info('Installing OLT app')
2635 OnosCtrl.install_app(self.olt_app_file)
2636 time.sleep(5)
2637 log_test.info('Adding subscribers through OLT app')
2638 self.config_olt(switch_map)
2639 olt_configured = True
2640 time.sleep(5)
2641 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
2642 try:
2643 assert_equal(dhcp_status, True)
2644 #assert_equal(status, True)
2645 time.sleep(10)
2646 finally:
2647 self.voltha.disable_device(device_id, delete = True)
2648 self.remove_olt(switch_map)
2649 df.callback(0)
2650
2651 reactor.callLater(0, dhcp_flow_check_scenario, df)
2652 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002653
Thangavelu K S735a6662017-06-15 18:08:23 +00002654
2655 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07002656 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002657 """
2658 Test Method:
2659 0. Make sure that voltha is up and running on CORD-POD setup.
2660 1. OLT and ONU is detected and validated.
2661 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2662 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2663 4. Verify that subscriber get ip from dhcp server successfully.
2664 5. Repeat step 3 and 4 for 10 times.
2665 6 Verify that subscriber should get ip from dhcp server.
2666 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002667 df = defer.Deferred()
2668 def dhcp_flow_check_scenario(df):
2669 log_test.info('Enabling ponsim_olt')
2670 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2671 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2672 assert_not_equal(device_id, None)
2673 voltha = VolthaCtrl(self.VOLTHA_HOST,
2674 rest_port = self.VOLTHA_REST_PORT,
2675 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2676 time.sleep(10)
2677 switch_map = None
2678 olt_configured = False
2679 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2680 log_test.info('Installing OLT app')
2681 OnosCtrl.install_app(self.olt_app_file)
2682 time.sleep(5)
2683 log_test.info('Adding subscribers through OLT app')
2684 self.config_olt(switch_map)
2685 olt_configured = True
2686 time.sleep(5)
2687 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
2688 try:
2689 assert_equal(dhcp_status, True)
2690 #assert_equal(status, True)
2691 time.sleep(10)
2692 finally:
2693 self.voltha.disable_device(device_id, delete = True)
2694 self.remove_olt(switch_map)
2695 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002696
Thangavelu K S735a6662017-06-15 18:08:23 +00002697 reactor.callLater(0, dhcp_flow_check_scenario, df)
2698 return df
2699
Thangavelu K S735a6662017-06-15 18:08:23 +00002700 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002701 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
2702 """
2703 Test Method:
2704 0. Make sure that voltha is up and running on CORD-POD setup.
2705 1. OLT and ONU is detected and validated.
2706 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2707 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
2708 4. Verify that subscriber should not get ip from dhcp server.
2709 5. Repeat steps 3 and 4 for 10 times.
2710 6 Verify that subscriber should not get ip from dhcp server.
2711 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002712 df = defer.Deferred()
2713 def dhcp_flow_check_scenario(df):
2714 log_test.info('Enabling ponsim_olt')
2715 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2716 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2717 assert_not_equal(device_id, None)
2718 voltha = VolthaCtrl(self.VOLTHA_HOST,
2719 rest_port = self.VOLTHA_REST_PORT,
2720 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2721 time.sleep(10)
2722 switch_map = None
2723 olt_configured = False
2724 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2725 log_test.info('Installing OLT app')
2726 OnosCtrl.install_app(self.olt_app_file)
2727 time.sleep(5)
2728 log_test.info('Adding subscribers through OLT app')
2729 self.config_olt(switch_map)
2730 olt_configured = True
2731 time.sleep(5)
2732 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
2733 try:
2734 assert_equal(dhcp_status, True)
2735 #assert_equal(status, True)
2736 time.sleep(10)
2737 finally:
2738 self.voltha.disable_device(device_id, delete = True)
2739 self.remove_olt(switch_map)
2740 df.callback(0)
2741
2742 reactor.callLater(0, dhcp_flow_check_scenario, df)
2743 return df
2744
Thangavelu K S735a6662017-06-15 18:08:23 +00002745 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002746 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
2747 """
2748 Test Method:
2749 0. Make sure that voltha is up and running on CORD-POD setup.
2750 1. OLT and ONU is detected and validated.
2751 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2752 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2753 4. Verify that subscriber get ip from dhcp server successfully.
2754 5. Repeat step 3 for 50 times.
2755 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2756 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002757 df = defer.Deferred()
2758 def dhcp_flow_check_scenario(df):
2759 log_test.info('Enabling ponsim_olt')
2760 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2761 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2762 assert_not_equal(device_id, None)
2763 voltha = VolthaCtrl(self.VOLTHA_HOST,
2764 rest_port = self.VOLTHA_REST_PORT,
2765 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2766 time.sleep(10)
2767 switch_map = None
2768 olt_configured = False
2769 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2770 log_test.info('Installing OLT app')
2771 OnosCtrl.install_app(self.olt_app_file)
2772 time.sleep(5)
2773 log_test.info('Adding subscribers through OLT app')
2774 self.config_olt(switch_map)
2775 olt_configured = True
2776 time.sleep(5)
2777 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
2778 try:
2779 assert_equal(dhcp_status, True)
2780 #assert_equal(status, True)
2781 time.sleep(10)
2782 finally:
2783 self.voltha.disable_device(device_id, delete = True)
2784 self.remove_olt(switch_map)
2785 df.callback(0)
2786
2787 reactor.callLater(0, dhcp_flow_check_scenario, df)
2788 return df
2789
Thangavelu K S735a6662017-06-15 18:08:23 +00002790 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002791 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
2792 """
2793 Test Method:
2794 0. Make sure that voltha is up and running on CORD-POD setup.
2795 1. OLT and ONU is detected and validated.
2796 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2797 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2798 4. Verify that subscriber get ip from dhcp server successfully.
2799 5. Send DHCP request to dhcp server which is running as onos app.
2800 6. Repeat step 5 for 50 times.
2801 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2802 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002803 df = defer.Deferred()
2804 def dhcp_flow_check_scenario(df):
2805 log_test.info('Enabling ponsim_olt')
2806 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2807 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2808 assert_not_equal(device_id, None)
2809 voltha = VolthaCtrl(self.VOLTHA_HOST,
2810 rest_port = self.VOLTHA_REST_PORT,
2811 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2812 time.sleep(10)
2813 switch_map = None
2814 olt_configured = False
2815 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2816 log_test.info('Installing OLT app')
2817 OnosCtrl.install_app(self.olt_app_file)
2818 time.sleep(5)
2819 log_test.info('Adding subscribers through OLT app')
2820 self.config_olt(switch_map)
2821 olt_configured = True
2822 time.sleep(5)
2823 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
2824 try:
2825 assert_equal(dhcp_status, True)
2826 #assert_equal(status, True)
2827 time.sleep(10)
2828 finally:
2829 self.voltha.disable_device(device_id, delete = True)
2830 self.remove_olt(switch_map)
2831 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002832
Thangavelu K S735a6662017-06-15 18:08:23 +00002833 reactor.callLater(0, dhcp_flow_check_scenario, df)
2834 return df
2835
Thangavelu K S735a6662017-06-15 18:08:23 +00002836 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002837 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
2838 """
2839 Test Method:
2840 0. Make sure that voltha is up and running on CORD-POD setup.
2841 1. OLT and ONU is detected and validated.
2842 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2843 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
2844 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
2845 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002846 df = defer.Deferred()
2847 def dhcp_flow_check_scenario(df):
2848 log_test.info('Enabling ponsim_olt')
2849 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2850 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2851 assert_not_equal(device_id, None)
2852 voltha = VolthaCtrl(self.VOLTHA_HOST,
2853 rest_port = self.VOLTHA_REST_PORT,
2854 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2855 time.sleep(10)
2856 switch_map = None
2857 olt_configured = False
2858 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2859 log_test.info('Installing OLT app')
2860 OnosCtrl.install_app(self.olt_app_file)
2861 time.sleep(5)
2862 log_test.info('Adding subscribers through OLT app')
2863 self.config_olt(switch_map)
2864 olt_configured = True
2865 time.sleep(5)
2866 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
2867 try:
2868 assert_equal(dhcp_status, True)
2869 #assert_equal(status, True)
2870 time.sleep(10)
2871 finally:
2872 self.voltha.disable_device(device_id, delete = True)
2873 self.remove_olt(switch_map)
2874 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002875
Thangavelu K S735a6662017-06-15 18:08:23 +00002876 reactor.callLater(0, dhcp_flow_check_scenario, df)
2877 return df
2878
2879 @deferred(TESTCASE_TIMEOUT)
2880 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002881 """
2882 Test Method:
2883 0. Make sure that voltha is up and running on CORD-POD setup.
2884 1. OLT and ONU is detected and validated.
2885 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2886 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
2887 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.
2888 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002889 df = defer.Deferred()
2890 def dhcp_flow_check_scenario(df):
2891 log_test.info('Enabling ponsim_olt')
2892 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2893 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2894 assert_not_equal(device_id, None)
2895 voltha = VolthaCtrl(self.VOLTHA_HOST,
2896 rest_port = self.VOLTHA_REST_PORT,
2897 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2898 time.sleep(10)
2899 switch_map = None
2900 olt_configured = False
2901 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2902 log_test.info('Installing OLT app')
2903 OnosCtrl.install_app(self.olt_app_file)
2904 time.sleep(5)
2905 log_test.info('Adding subscribers through OLT app')
2906 self.config_olt(switch_map)
2907 olt_configured = True
2908 time.sleep(5)
2909 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
2910 try:
2911 assert_equal(dhcp_status, True)
2912 #assert_equal(status, True)
2913 time.sleep(10)
2914 finally:
2915 self.voltha.disable_device(device_id, delete = True)
2916 self.remove_olt(switch_map)
2917 df.callback(0)
2918
2919 reactor.callLater(0, dhcp_flow_check_scenario, df)
2920 return df
2921
Thangavelu K S735a6662017-06-15 18:08:23 +00002922 @deferred(TESTCASE_TIMEOUT)
2923 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002924 """
2925 Test Method:
2926 0. Make sure that voltha is up and running on CORD-POD setup.
2927 1. OLT and ONU is detected and validated.
2928 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2929 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2930 4. Verify that subscriber get ip from dhcp server successfully.
2931 5. Deactivate dhcp server app in onos.
2932 6. Repeat step 3.
2933 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2934 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002935 df = defer.Deferred()
2936 dhcp_app = 'org.onosproject.dhcp'
2937 def dhcp_flow_check_scenario(df):
2938 log_test.info('Enabling ponsim_olt')
2939 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2940 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2941 assert_not_equal(device_id, None)
2942 voltha = VolthaCtrl(self.VOLTHA_HOST,
2943 rest_port = self.VOLTHA_REST_PORT,
2944 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2945 time.sleep(10)
2946 switch_map = None
2947 olt_configured = False
2948 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2949 log_test.info('Installing OLT app')
2950 OnosCtrl.install_app(self.olt_app_file)
2951 time.sleep(5)
2952 log_test.info('Adding subscribers through OLT app')
2953 self.config_olt(switch_map)
2954 olt_configured = True
2955 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002956 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00002957 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
2958 log_test.info('Restart dhcp app in onos during client send discover to voltha')
2959 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00002960 thread1.start()
2961 time.sleep(10)
2962 thread1.join()
2963 thread2.join()
2964 try:
2965 assert_equal(self.success, True)
2966 #assert_equal(status, True)
2967 time.sleep(10)
2968 finally:
2969 self.voltha.disable_device(device_id, delete = True)
2970 self.remove_olt(switch_map)
2971 df.callback(0)
2972
2973 reactor.callLater(0, dhcp_flow_check_scenario, df)
2974 return df
2975
2976 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002977 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
2978 """
2979 Test Method:
2980 0. Make sure that voltha is up and running on CORD-POD setup.
2981 1. OLT and ONU is detected and validated.
2982 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2983 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2984 4. Verify that subscriber get ip from dhcp server successfully.
2985 5. Send dhcp renew packet to dhcp server which is running as onos app.
2986 6. Repeat step 4.
2987 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002988
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002989 df = defer.Deferred()
2990 def dhcp_flow_check_scenario(df):
2991 log_test.info('Enabling ponsim_olt')
2992 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2993 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2994 assert_not_equal(device_id, None)
2995 voltha = VolthaCtrl(self.VOLTHA_HOST,
2996 rest_port = self.VOLTHA_REST_PORT,
2997 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
2998 time.sleep(10)
2999 switch_map = None
3000 olt_configured = False
3001 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3002 log_test.info('Installing OLT app')
3003 OnosCtrl.install_app(self.olt_app_file)
3004 time.sleep(5)
3005 log_test.info('Adding subscribers through OLT app')
3006 self.config_olt(switch_map)
3007 olt_configured = True
3008 time.sleep(5)
3009 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
3010 try:
3011 assert_equal(dhcp_status, True)
3012 #assert_equal(status, True)
3013 time.sleep(10)
3014 finally:
3015 self.voltha.disable_device(device_id, delete = True)
3016 self.remove_olt(switch_map)
3017 df.callback(0)
3018
3019 reactor.callLater(0, dhcp_flow_check_scenario, df)
3020 return df
3021
3022 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003023 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
3024 """
3025 Test Method:
3026 0. Make sure that voltha is up and running on CORD-POD setup.
3027 1. OLT and ONU is detected and validated.
3028 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3029 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3030 4. Verify that subscriber get ip from dhcp server successfully.
3031 5. Send dhcp rebind packet to dhcp server which is running as onos app.
3032 6. Repeat step 4.
3033 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003034 df = defer.Deferred()
3035 def dhcp_flow_check_scenario(df):
3036 log_test.info('Enabling ponsim_olt')
3037 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3038 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3039 assert_not_equal(device_id, None)
3040 voltha = VolthaCtrl(self.VOLTHA_HOST,
3041 rest_port = self.VOLTHA_REST_PORT,
3042 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3043 time.sleep(10)
3044 switch_map = None
3045 olt_configured = False
3046 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3047 log_test.info('Installing OLT app')
3048 OnosCtrl.install_app(self.olt_app_file)
3049 time.sleep(5)
3050 log_test.info('Adding subscribers through OLT app')
3051 self.config_olt(switch_map)
3052 olt_configured = True
3053 time.sleep(5)
3054 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
3055 try:
3056 assert_equal(dhcp_status, True)
3057 #assert_equal(status, True)
3058 time.sleep(10)
3059 finally:
3060 self.voltha.disable_device(device_id, delete = True)
3061 self.remove_olt(switch_map)
3062 df.callback(0)
3063
3064 reactor.callLater(0, dhcp_flow_check_scenario, df)
3065 return df
3066
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003067 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003068 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003069 """
3070 Test Method:
3071 0. Make sure that voltha is up and running on CORD-POD setup.
3072 1. OLT and ONU is detected and validated.
3073 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3074 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3075 4. Verify that subscriber get ip from dhcp server successfully.
3076 5. Disable olt devices which is being detected in voltha CLI.
3077 6. Repeat step 3.
3078 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3079 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003080 df = defer.Deferred()
3081 dhcp_app = 'org.onosproject.dhcp'
3082 def dhcp_flow_check_scenario(df):
3083 log_test.info('Enabling ponsim_olt')
3084 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3085 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3086 assert_not_equal(device_id, None)
3087 voltha = VolthaCtrl(self.VOLTHA_HOST,
3088 rest_port = self.VOLTHA_REST_PORT,
3089 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3090 time.sleep(10)
3091 switch_map = None
3092 olt_configured = False
3093 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3094 log_test.info('Installing OLT app')
3095 OnosCtrl.install_app(self.olt_app_file)
3096 time.sleep(5)
3097 log_test.info('Adding subscribers through OLT app')
3098 self.config_olt(switch_map)
3099 olt_configured = True
3100 time.sleep(5)
3101 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3102 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3103 log_test.info('Disable the olt device in during client send discover to voltha')
3104 thread2.start()
3105# time.sleep(randint(0,1))
3106 thread1.start()
3107 time.sleep(10)
3108 thread1.join()
3109 thread2.join()
3110 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003111 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003112 #assert_equal(status, True)
3113 time.sleep(10)
3114 finally:
3115 self.voltha.disable_device(device_id, delete = True)
3116 self.remove_olt(switch_map)
3117 df.callback(0)
3118
3119 reactor.callLater(0, dhcp_flow_check_scenario, df)
3120 return df
3121
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003122 @deferred(TESTCASE_TIMEOUT)
3123 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
3124 """
3125 Test Method:
3126 0. Make sure that voltha is up and running on CORD-POD setup.
3127 1. OLT and ONU is detected and validated.
3128 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3129 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3130 4. Verify that subscriber get ip from dhcp server successfully.
3131 5. Disable olt devices which is being detected in voltha CLI.
3132 6. Repeat step 3.
3133 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3134 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
3135 """
3136 df = defer.Deferred()
3137 no_iterations = 10
3138 dhcp_app = 'org.onosproject.dhcp'
3139 def dhcp_flow_check_scenario(df):
3140 log_test.info('Enabling ponsim_olt')
3141 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3142 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3143 assert_not_equal(device_id, None)
3144 voltha = VolthaCtrl(self.VOLTHA_HOST,
3145 rest_port = self.VOLTHA_REST_PORT,
3146 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3147 time.sleep(10)
3148 switch_map = None
3149 olt_configured = False
3150 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3151 log_test.info('Installing OLT app')
3152 OnosCtrl.install_app(self.olt_app_file)
3153 time.sleep(5)
3154 log_test.info('Adding subscribers through OLT app')
3155 self.config_olt(switch_map)
3156 olt_configured = True
3157 time.sleep(5)
3158 for i in range(no_iterations):
3159 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3160 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3161 log_test.info('Disable the olt device in during client send discover to voltha')
3162 thread2.start()
3163# time.sleep(randint(0,1))
3164 thread1.start()
3165 time.sleep(10)
3166 thread1.join()
3167 thread2.join()
3168 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3169 try:
3170 assert_equal(self.success, True)
3171 assert_equal(dhcp_status, True)
3172 #assert_equal(status, True)
3173 time.sleep(10)
3174 finally:
3175 self.voltha.disable_device(device_id, delete = True)
3176 self.remove_olt(switch_map)
3177 df.callback(0)
3178
3179 reactor.callLater(0, dhcp_flow_check_scenario, df)
3180 return df
3181
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003182 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003183 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003184 """
3185 Test Method:
3186 0. Make sure that voltha is up and running on CORD-POD setup.
3187 1. OLT and ONU is detected and validated.
3188 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3189 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3190 4. Verify that subscriber get ip from dhcp server successfully.
3191 5. Disable olt devices which is being detected in voltha CLI.
3192 6. Repeat step 3.
3193 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3194 8. Enable olt devices which is being detected in voltha CLI.
3195 9. Repeat steps 3 and 4.
3196 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003197 df = defer.Deferred()
3198 dhcp_app = 'org.onosproject.dhcp'
3199 def dhcp_flow_check_scenario(df):
3200 log_test.info('Enabling ponsim_olt')
3201 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3202 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3203 assert_not_equal(device_id, None)
3204 voltha = VolthaCtrl(self.VOLTHA_HOST,
3205 rest_port = self.VOLTHA_REST_PORT,
3206 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3207 time.sleep(10)
3208 switch_map = None
3209 olt_configured = False
3210 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3211 log_test.info('Installing OLT app')
3212 OnosCtrl.install_app(self.olt_app_file)
3213 time.sleep(5)
3214 log_test.info('Adding subscribers through OLT app')
3215 self.config_olt(switch_map)
3216 olt_configured = True
3217 time.sleep(5)
3218 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3219 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3220 thread2.start()
3221 thread1.start()
3222 time.sleep(10)
3223 thread1.join()
3224 thread2.join()
3225 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003226 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003227 #assert_equal(status, True)
3228 time.sleep(10)
3229 finally:
3230 self.voltha.disable_device(device_id, delete = True)
3231 self.remove_olt(switch_map)
3232 df.callback(0)
3233
3234 reactor.callLater(0, dhcp_flow_check_scenario, df)
3235 return df
3236
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003237 @deferred(TESTCASE_TIMEOUT)
3238 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
3239 """
3240 Test Method:
3241 0. Make sure that voltha is up and running on CORD-POD setup.
3242 1. OLT and ONU is detected and validated.
3243 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3244 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3245 4. Verify that subscriber get ip from dhcp server successfully.
3246 5. Disable olt devices which is being detected in voltha CLI.
3247 6. Repeat step 3.
3248 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3249 8. Enable olt devices which is being detected in voltha CLI.
3250 9. Repeat steps 3 and 4.
3251 """
3252
3253 df = defer.Deferred()
3254 no_iterations = 10
3255 dhcp_app = 'org.onosproject.dhcp'
3256 def dhcp_flow_check_scenario(df):
3257 log_test.info('Enabling ponsim_olt')
3258 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3259 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3260 assert_not_equal(device_id, None)
3261 voltha = VolthaCtrl(self.VOLTHA_HOST,
3262 rest_port = self.VOLTHA_REST_PORT,
3263 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3264 time.sleep(10)
3265 switch_map = None
3266 olt_configured = False
3267 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3268 log_test.info('Installing OLT app')
3269 OnosCtrl.install_app(self.olt_app_file)
3270 time.sleep(5)
3271 log_test.info('Adding subscribers through OLT app')
3272 self.config_olt(switch_map)
3273 olt_configured = True
3274 time.sleep(5)
3275 for i in range(no_iterations):
3276 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3277 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3278 thread2.start()
3279 thread1.start()
3280 time.sleep(10)
3281 thread1.join()
3282 thread2.join()
3283 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3284 try:
3285 assert_equal(dhcp_status, True)
3286 #assert_equal(status, True)
3287 assert_equal(self.success, True)
3288 time.sleep(10)
3289 finally:
3290 self.voltha.disable_device(device_id, delete = True)
3291 self.remove_olt(switch_map)
3292 df.callback(0)
3293
3294 reactor.callLater(0, dhcp_flow_check_scenario, df)
3295 return df
3296
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003297 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003298 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003299 """
3300 Test Method:
3301 0. Make sure that voltha is up and running on CORD-POD setup.
3302 1. OLT and ONU is detected and validated.
3303 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3304 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3305 4. Verify that subscriber get ip from dhcp server successfully.
3306 5. Disable onu port which is being detected in voltha CLI.
3307 6. Repeat step 3.
3308 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3309 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003310 df = defer.Deferred()
3311 dhcp_app = 'org.onosproject.dhcp'
3312 def dhcp_flow_check_scenario(df):
3313 log_test.info('Enabling ponsim_olt')
3314 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3315 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3316 assert_not_equal(device_id, None)
3317 voltha = VolthaCtrl(self.VOLTHA_HOST,
3318 rest_port = self.VOLTHA_REST_PORT,
3319 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3320 time.sleep(10)
3321 switch_map = None
3322 olt_configured = False
3323 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3324 log_test.info('Installing OLT app')
3325 OnosCtrl.install_app(self.olt_app_file)
3326 time.sleep(5)
3327 log_test.info('Adding subscribers through OLT app')
3328 self.config_olt(switch_map)
3329 olt_configured = True
3330 time.sleep(5)
3331 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3332 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3333 thread1.start()
3334 thread2.start()
3335 time.sleep(10)
3336 thread1.join()
3337 thread2.join()
3338 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003339 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003340 #assert_equal(status, True)
3341 time.sleep(10)
3342 finally:
3343 self.voltha.disable_device(device_id, delete = True)
3344 self.remove_olt(switch_map)
3345 df.callback(0)
3346
3347 reactor.callLater(0, dhcp_flow_check_scenario, df)
3348 return df
3349
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003350 @deferred(TESTCASE_TIMEOUT)
3351 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
3352 """
3353 Test Method:
3354 0. Make sure that voltha is up and running on CORD-POD setup.
3355 1. OLT and ONU is detected and validated.
3356 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3357 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3358 4. Verify that subscriber get ip from dhcp server successfully.
3359 5. Disable onu port which is being detected in voltha CLI.
3360 6. Repeat step 3.
3361 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3362 """
3363 df = defer.Deferred()
3364 no_iterations = 10
3365 dhcp_app = 'org.onosproject.dhcp'
3366 def dhcp_flow_check_scenario(df):
3367 log_test.info('Enabling ponsim_olt')
3368 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3369 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3370 assert_not_equal(device_id, None)
3371 voltha = VolthaCtrl(self.VOLTHA_HOST,
3372 rest_port = self.VOLTHA_REST_PORT,
3373 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3374 time.sleep(10)
3375 switch_map = None
3376 olt_configured = False
3377 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3378 log_test.info('Installing OLT app')
3379 OnosCtrl.install_app(self.olt_app_file)
3380 time.sleep(5)
3381 log_test.info('Adding subscribers through OLT app')
3382 self.config_olt(switch_map)
3383 olt_configured = True
3384 time.sleep(5)
3385 for i in range(no_iterations):
3386 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3387 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3388 thread1.start()
3389 thread2.start()
3390 time.sleep(10)
3391 thread1.join()
3392 thread2.join()
3393 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3394 try:
3395 #assert_equal(status, True)
3396 assert_equal(dhcp_status, True)
3397 assert_equal(self.success, True)
3398 time.sleep(10)
3399 finally:
3400 self.voltha.disable_device(device_id, delete = True)
3401 self.remove_olt(switch_map)
3402 df.callback(0)
3403
3404 reactor.callLater(0, dhcp_flow_check_scenario, df)
3405 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003406
3407 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003408 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003409 """
3410 Test Method:
3411 0. Make sure that voltha is up and running on CORD-POD setup.
3412 1. OLT and ONU is detected and validated.
3413 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3414 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3415 4. Verify that subscriber get ip from dhcp server successfully.
3416 5. Disable onu port which is being detected in voltha CLI.
3417 6. Repeat step 3.
3418 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3419 8. Enable onu port which is being detected in voltha CLI.
3420 9. Repeat steps 3 and 4.
3421 """
3422
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003423 df = defer.Deferred()
3424 dhcp_app = 'org.onosproject.dhcp'
3425 def dhcp_flow_check_scenario(df):
3426 log_test.info('Enabling ponsim_olt')
3427 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3428 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3429 assert_not_equal(device_id, None)
3430 voltha = VolthaCtrl(self.VOLTHA_HOST,
3431 rest_port = self.VOLTHA_REST_PORT,
3432 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3433 time.sleep(10)
3434 switch_map = None
3435 olt_configured = False
3436 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3437 log_test.info('Installing OLT app')
3438 OnosCtrl.install_app(self.olt_app_file)
3439 time.sleep(5)
3440 log_test.info('Adding subscribers through OLT app')
3441 self.config_olt(switch_map)
3442 olt_configured = True
3443 time.sleep(5)
3444 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3445 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3446 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3447 thread2.start()
3448 time.sleep(randint(0,1))
3449 thread1.start()
3450 time.sleep(10)
3451 thread1.join()
3452 thread2.join()
3453 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3454 assert_equal(dhcp_status, True)
3455 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003456 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003457 #assert_equal(status, True)
3458 time.sleep(10)
3459 finally:
3460 self.voltha.disable_device(device_id, delete = True)
3461 self.remove_olt(switch_map)
3462 df.callback(0)
3463
3464 reactor.callLater(0, dhcp_flow_check_scenario, df)
3465 return df
3466
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003467 @deferred(TESTCASE_TIMEOUT)
3468 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
3469 """
3470 Test Method:
3471 0. Make sure that voltha is up and running on CORD-POD setup.
3472 1. OLT and ONU is detected and validated.
3473 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3474 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3475 4. Verify that subscriber get ip from dhcp server successfully.
3476 5. Disable onu port which is being detected in voltha CLI.
3477 6. Repeat step 3.
3478 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3479 8. Enable onu port which is being detected in voltha CLI.
3480 9. Repeat steps 3 and 4.
3481 """
3482
3483 df = defer.Deferred()
3484 no_iterations = 10
3485 dhcp_app = 'org.onosproject.dhcp'
3486 def dhcp_flow_check_scenario(df):
3487 log_test.info('Enabling ponsim_olt')
3488 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3489 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3490 assert_not_equal(device_id, None)
3491 voltha = VolthaCtrl(self.VOLTHA_HOST,
3492 rest_port = self.VOLTHA_REST_PORT,
3493 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3494 time.sleep(10)
3495 switch_map = None
3496 olt_configured = False
3497 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3498 log_test.info('Installing OLT app')
3499 OnosCtrl.install_app(self.olt_app_file)
3500 time.sleep(5)
3501 log_test.info('Adding subscribers through OLT app')
3502 self.config_olt(switch_map)
3503 olt_configured = True
3504 time.sleep(5)
3505 for i in range(no_iterations):
3506 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3507 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3508 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3509 thread2.start()
3510 time.sleep(randint(0,1))
3511 thread1.start()
3512 time.sleep(10)
3513 thread1.join()
3514 thread2.join()
3515 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3516 assert_equal(dhcp_status, True)
3517 try:
3518 assert_equal(self.success, True)
3519 #assert_equal(status, True)
3520 time.sleep(10)
3521 finally:
3522 self.voltha.disable_device(device_id, delete = True)
3523 self.remove_olt(switch_map)
3524 df.callback(0)
3525
3526 reactor.callLater(0, dhcp_flow_check_scenario, df)
3527 return df
3528
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003529 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003530 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003531 """
3532 Test Method:
3533 0. Make sure that voltha is up and running on CORD-POD setup.
3534 1. OLT and ONU is detected and validated.
3535 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3536 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3537 4. Verify that subscribers had got different ips from dhcp server successfully.
3538 """
3539
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003540 df = defer.Deferred()
3541 self.success = True
3542 dhcp_app = 'org.onosproject.dhcp'
3543 def dhcp_flow_check_scenario(df):
3544 log_test.info('Enabling ponsim_olt')
3545 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3546 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3547 assert_not_equal(device_id, None)
3548 voltha = VolthaCtrl(self.VOLTHA_HOST,
3549 rest_port = self.VOLTHA_REST_PORT,
3550 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3551 time.sleep(10)
3552 switch_map = None
3553 olt_configured = False
3554 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3555 log_test.info('Installing OLT app')
3556 OnosCtrl.install_app(self.olt_app_file)
3557 time.sleep(5)
3558 log_test.info('Adding subscribers through OLT app')
3559 self.config_olt(switch_map)
3560 olt_configured = True
3561 time.sleep(5)
3562 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3563 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3564 thread1.start()
3565 thread2.start()
3566 time.sleep(10)
3567 thread1.join()
3568 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003569 dhcp_flow_status = self.success
3570 try:
3571# if self.success is not True:
3572 assert_equal(dhcp_flow_status, True)
3573 #assert_equal(status, True)
3574 time.sleep(10)
3575 finally:
3576 self.voltha.disable_device(device_id, delete = True)
3577 self.remove_olt(switch_map)
3578 df.callback(0)
3579
3580 reactor.callLater(0, dhcp_flow_check_scenario, df)
3581 return df
3582
3583 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003584 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003585 """
3586 Test Method:
3587 0. Make sure that voltha is up and running on CORD-POD setup.
3588 1. OLT and ONU is detected and validated.
3589 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3590 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3591 4. Verify that subscribers had got ip from dhcp server successfully.
3592 5. Repeat step 3 and 4 for 10 times for both subscribers.
3593 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
3594 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003595
3596
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003597 df = defer.Deferred()
3598 self.success = True
3599 dhcp_app = 'org.onosproject.dhcp'
3600 def dhcp_flow_check_scenario(df):
3601 log_test.info('Enabling ponsim_olt')
3602 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3603 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3604 assert_not_equal(device_id, None)
3605 voltha = VolthaCtrl(self.VOLTHA_HOST,
3606 rest_port = self.VOLTHA_REST_PORT,
3607 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3608 time.sleep(10)
3609 switch_map = None
3610 olt_configured = False
3611 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3612 log_test.info('Installing OLT app')
3613 OnosCtrl.install_app(self.olt_app_file)
3614 time.sleep(5)
3615 log_test.info('Adding subscribers through OLT app')
3616 self.config_olt(switch_map)
3617 olt_configured = True
3618 time.sleep(5)
3619 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3620 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
3621 thread1.start()
3622 thread2.start()
3623 time.sleep(10)
3624 thread1.join()
3625 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003626 dhcp_flow_status = self.success
3627 try:
3628# if self.success is not True:
3629 assert_equal(dhcp_flow_status, True)
3630 #assert_equal(status, True)
3631 time.sleep(10)
3632 finally:
3633 self.voltha.disable_device(device_id, delete = True)
3634 self.remove_olt(switch_map)
3635 df.callback(0)
3636
3637 reactor.callLater(0, dhcp_flow_check_scenario, df)
3638 return df
3639
3640 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003641 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003642 """
3643 Test Method:
3644 0. Make sure that voltha is up and running on CORD-POD setup.
3645 1. OLT and ONU is detected and validated.
3646 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3647 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3648 4. Verify that subscribers had got ip from dhcp server successfully.
3649 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3650 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
3651 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003652
3653 df = defer.Deferred()
3654 self.success = True
3655 dhcp_app = 'org.onosproject.dhcp'
3656 def dhcp_flow_check_scenario(df):
3657 log_test.info('Enabling ponsim_olt')
3658 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3659 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3660 assert_not_equal(device_id, None)
3661 voltha = VolthaCtrl(self.VOLTHA_HOST,
3662 rest_port = self.VOLTHA_REST_PORT,
3663 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3664 time.sleep(10)
3665 switch_map = None
3666 olt_configured = False
3667 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3668 log_test.info('Installing OLT app')
3669 OnosCtrl.install_app(self.olt_app_file)
3670 time.sleep(5)
3671 log_test.info('Adding subscribers through OLT app')
3672 self.config_olt(switch_map)
3673 olt_configured = True
3674 time.sleep(5)
3675 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3676 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3677 thread1.start()
3678 thread2.start()
3679 time.sleep(10)
3680 thread1.join()
3681 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003682 dhcp_flow_status = self.success
3683 try:
3684# if self.success is not True:
3685 assert_equal(dhcp_flow_status, True)
3686 #assert_equal(status, True)
3687 time.sleep(10)
3688 finally:
3689 self.voltha.disable_device(device_id, delete = True)
3690 self.remove_olt(switch_map)
3691 df.callback(0)
3692
3693 reactor.callLater(0, dhcp_flow_check_scenario, df)
3694 return df
3695
3696 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003697 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 +00003698 """
3699 Test Method:
3700 0. Make sure that voltha is up and running on CORD-POD setup.
3701 1. OLT and ONU is detected and validated.
3702 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3703 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
3704 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
3705 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
3706 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003707
3708 df = defer.Deferred()
3709 self.success = True
3710 dhcp_app = 'org.onosproject.dhcp'
3711 def dhcp_flow_check_scenario(df):
3712 log_test.info('Enabling ponsim_olt')
3713 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3714 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3715 assert_not_equal(device_id, None)
3716 voltha = VolthaCtrl(self.VOLTHA_HOST,
3717 rest_port = self.VOLTHA_REST_PORT,
3718 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3719 time.sleep(10)
3720 switch_map = None
3721 olt_configured = False
3722 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3723 log_test.info('Installing OLT app')
3724 OnosCtrl.install_app(self.olt_app_file)
3725 time.sleep(5)
3726 log_test.info('Adding subscribers through OLT app')
3727 self.config_olt(switch_map)
3728 olt_configured = True
3729 time.sleep(5)
3730 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3731 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
3732 thread1.start()
3733 thread2.start()
3734 time.sleep(10)
3735 thread1.join()
3736 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003737 dhcp_flow_status = self.success
3738 try:
3739# if self.success is not True:
3740 assert_equal(dhcp_flow_status, True)
3741 #assert_equal(status, True)
3742 time.sleep(10)
3743 finally:
3744 self.voltha.disable_device(device_id, delete = True)
3745 self.remove_olt(switch_map)
3746 df.callback(0)
3747
3748 reactor.callLater(0, dhcp_flow_check_scenario, df)
3749 return df
3750
3751 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003752 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 +00003753 """
3754 Test Method:
3755 0. Make sure that voltha is up and running on CORD-POD setup.
3756 1. OLT and ONU is detected and validated.
3757 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3758 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
3759 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
3760 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
3761 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003762 df = defer.Deferred()
3763 self.success = True
3764 dhcp_app = 'org.onosproject.dhcp'
3765 def dhcp_flow_check_scenario(df):
3766 log_test.info('Enabling ponsim_olt')
3767 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3768 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3769 assert_not_equal(device_id, None)
3770 voltha = VolthaCtrl(self.VOLTHA_HOST,
3771 rest_port = self.VOLTHA_REST_PORT,
3772 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3773 time.sleep(10)
3774 switch_map = None
3775 olt_configured = False
3776 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3777 log_test.info('Installing OLT app')
3778 OnosCtrl.install_app(self.olt_app_file)
3779 time.sleep(5)
3780 log_test.info('Adding subscribers through OLT app')
3781 self.config_olt(switch_map)
3782 olt_configured = True
3783 time.sleep(5)
3784 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3785 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3786 thread1.start()
3787 thread2.start()
3788 time.sleep(10)
3789 thread1.join()
3790 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003791 dhcp_flow_status = self.success
3792 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003793 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003794 time.sleep(10)
3795 finally:
3796 self.voltha.disable_device(device_id, delete = True)
3797 self.remove_olt(switch_map)
3798 df.callback(0)
3799
3800 reactor.callLater(0, dhcp_flow_check_scenario, df)
3801 return df
3802
3803 @deferred(TESTCASE_TIMEOUT)
3804 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003805 """
3806 Test Method:
3807 0. Make sure that voltha is up and running on CORD-POD setup.
3808 1. OLT and ONU is detected and validated.
3809 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3810 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3811 4. Verify that subscribers had got ip from dhcp server successfully.
3812 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3813 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3814 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3815 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003816 df = defer.Deferred()
3817 self.success = True
3818 dhcp_app = 'org.onosproject.dhcp'
3819 def dhcp_flow_check_scenario(df):
3820 log_test.info('Enabling ponsim_olt')
3821 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3822 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3823 assert_not_equal(device_id, None)
3824 voltha = VolthaCtrl(self.VOLTHA_HOST,
3825 rest_port = self.VOLTHA_REST_PORT,
3826 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3827 time.sleep(10)
3828 switch_map = None
3829 olt_configured = False
3830 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3831 log_test.info('Installing OLT app')
3832 OnosCtrl.install_app(self.olt_app_file)
3833 time.sleep(5)
3834 log_test.info('Adding subscribers through OLT app')
3835 self.config_olt(switch_map)
3836 olt_configured = True
3837 time.sleep(5)
3838 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3839 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3840 thread1.start()
3841 thread2.start()
3842 time.sleep(10)
3843 thread1.join()
3844 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003845 dhcp_flow_status = self.success
3846 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003847 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003848 time.sleep(10)
3849 finally:
3850 self.voltha.disable_device(device_id, delete = True)
3851 self.remove_olt(switch_map)
3852 df.callback(0)
3853
3854 reactor.callLater(0, dhcp_flow_check_scenario, df)
3855 return df
3856
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003857 @deferred(TESTCASE_TIMEOUT)
3858 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003859 """
3860 Test Method:
3861 0. Make sure that voltha is up and running on CORD-POD setup.
3862 1. OLT and ONU is detected and validated.
3863 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3864 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3865 4. Verify that subscribers had got ip from dhcp server successfully.
3866 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3867 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3868 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3869 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
3870 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
3871 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
3872 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003873 df = defer.Deferred()
3874 self.success = True
3875 dhcp_app = 'org.onosproject.dhcp'
3876 def dhcp_flow_check_scenario(df):
3877 log_test.info('Enabling ponsim_olt')
3878 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3879 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3880 assert_not_equal(device_id, None)
3881 voltha = VolthaCtrl(self.VOLTHA_HOST,
3882 rest_port = self.VOLTHA_REST_PORT,
3883 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3884 time.sleep(10)
3885 switch_map = None
3886 olt_configured = False
3887 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3888 log_test.info('Installing OLT app')
3889 OnosCtrl.install_app(self.olt_app_file)
3890 time.sleep(5)
3891 log_test.info('Adding subscribers through OLT app')
3892 self.config_olt(switch_map)
3893 olt_configured = True
3894 time.sleep(5)
3895 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3896 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3897 thread3 = threading.Thread(target = self.voltha_uni_port_down_up, args = (self.INTF_2_RX_DEFAULT,))
3898 thread1.start()
3899 thread2.start()
3900 thread3.start()
3901 time.sleep(10)
3902 thread1.join()
3903 thread2.join()
3904 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003905 dhcp_flow_status = self.success
3906 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003907 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003908 time.sleep(10)
3909 finally:
3910 self.voltha.disable_device(device_id, delete = True)
3911 self.remove_olt(switch_map)
3912 df.callback(0)
3913
3914 reactor.callLater(0, dhcp_flow_check_scenario, df)
3915 return df
3916
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003917 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003918 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003919 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003920 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00003921 0. Make sure that voltha is up and running on CORD-POD setup.
3922 1. OLT and ONU is detected and validated.
3923 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3924 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3925 4. Verify that subscribers had got ip from dhcp server successfully.
3926 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3927 6. Disable the olt device which is detected in voltha.
3928 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3929 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003930 df = defer.Deferred()
3931 self.success = True
3932 dhcp_app = 'org.onosproject.dhcp'
3933 def dhcp_flow_check_scenario(df):
3934 log_test.info('Enabling ponsim_olt')
3935 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3936 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3937 assert_not_equal(device_id, None)
3938 voltha = VolthaCtrl(self.VOLTHA_HOST,
3939 rest_port = self.VOLTHA_REST_PORT,
3940 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
3941 time.sleep(10)
3942 switch_map = None
3943 olt_configured = False
3944 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3945 log_test.info('Installing OLT app')
3946 OnosCtrl.install_app(self.olt_app_file)
3947 time.sleep(5)
3948 log_test.info('Adding subscribers through OLT app')
3949 self.config_olt(switch_map)
3950 olt_configured = True
3951 time.sleep(5)
3952 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3953 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3954 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3955
3956 thread1.start()
3957 thread2.start()
3958 thread3.start()
3959 time.sleep(10)
3960 thread1.join()
3961 thread2.join()
3962 thread3.join()
3963 dhcp_flow_status = self.success
3964 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003965 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003966 time.sleep(10)
3967 finally:
3968 self.voltha.disable_device(device_id, delete = True)
3969 self.remove_olt(switch_map)
3970 df.callback(0)
3971
3972 reactor.callLater(0, dhcp_flow_check_scenario, df)
3973 return df
3974
3975 @deferred(TESTCASE_TIMEOUT)
3976 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003977 """
3978 Test Method:
3979 0. Make sure that voltha is up and running on CORD-POD setup.
3980 1. OLT and ONU is detected and validated.
3981 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3982 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3983 4. Verify that subscribers had got ip from dhcp server successfully.
3984 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3985 6. Disable the olt device which is detected in voltha.
3986 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3987 8. Enable the olt device which is detected in voltha.
3988 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 +00003989
Thangavelu K S057b7d22017-05-16 22:03:22 +00003990 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003991 df = defer.Deferred()
3992 self.success = True
3993 dhcp_app = 'org.onosproject.dhcp'
3994 def dhcp_flow_check_scenario(df):
3995 log_test.info('Enabling ponsim_olt')
3996 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3997 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3998 assert_not_equal(device_id, None)
3999 voltha = VolthaCtrl(self.VOLTHA_HOST,
4000 rest_port = self.VOLTHA_REST_PORT,
4001 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
4002 time.sleep(10)
4003 switch_map = None
4004 olt_configured = False
4005 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4006 log_test.info('Installing OLT app')
4007 OnosCtrl.install_app(self.olt_app_file)
4008 time.sleep(5)
4009 log_test.info('Adding subscribers through OLT app')
4010 self.config_olt(switch_map)
4011 olt_configured = True
4012 time.sleep(5)
4013 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4014 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4015 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
4016 thread1.start()
4017 thread2.start()
4018 thread3.start()
4019 time.sleep(10)
4020 thread1.join()
4021 thread2.join()
4022 thread3.join()
4023 dhcp_flow_status = self.success
4024 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004025 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004026 time.sleep(10)
4027 finally:
4028 self.voltha.disable_device(device_id, delete = True)
4029 self.remove_olt(switch_map)
4030 df.callback(0)
4031
4032 reactor.callLater(0, dhcp_flow_check_scenario, df)
4033 return df
4034
4035 @deferred(TESTCASE_TIMEOUT)
4036 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004037 """
4038 Test Method:
4039 0. Make sure that voltha is up and running on CORD-POD setup.
4040 1. OLT and ONU is detected and validated.
4041 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4042 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4043 4. Verify that subscribers had got ip from dhcp server successfully.
4044 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4045 6. Pause the olt device which is detected in voltha.
4046 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4047 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004048 df = defer.Deferred()
4049 self.success = True
4050 dhcp_app = 'org.onosproject.dhcp'
4051 def dhcp_flow_check_scenario(df):
4052 log_test.info('Enabling ponsim_olt')
4053 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4054 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4055 assert_not_equal(device_id, None)
4056 voltha = VolthaCtrl(self.VOLTHA_HOST,
4057 rest_port = self.VOLTHA_REST_PORT,
4058 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
4059 time.sleep(10)
4060 switch_map = None
4061 olt_configured = False
4062 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4063 log_test.info('Installing OLT app')
4064 OnosCtrl.install_app(self.olt_app_file)
4065 time.sleep(5)
4066 log_test.info('Adding subscribers through OLT app')
4067 self.config_olt(switch_map)
4068 olt_configured = True
4069 time.sleep(5)
4070 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4071 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4072 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
4073 thread1.start()
4074 thread2.start()
4075 thread3.start()
4076 time.sleep(10)
4077 thread1.join()
4078 thread2.join()
4079 thread3.join()
4080 dhcp_flow_status = self.success
4081 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004082 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004083 time.sleep(10)
4084 finally:
4085 self.voltha.disable_device(device_id, delete = True)
4086 self.remove_olt(switch_map)
4087 df.callback(0)
4088
4089 reactor.callLater(0, dhcp_flow_check_scenario, df)
4090 return df
4091
Thangavelu K S36edb012017-07-05 18:24:12 +00004092 def test_3_subscribers_with_voltha_for_dhcp_discover_requests(self):
4093 """
4094 Test Method:
4095 0. Make sure that voltha is up and running on CORD-POD setup.
4096 1. OLT and ONU is detected and validated.
4097 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4098 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4099 4. Verify that subscriber get ip from dhcp server successfully.
4100 """
4101 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4102 num_subscribers = 3
4103 num_channels = 1
4104 services = ('DHCP')
4105 cbs = (self.dhcp_flow_check, None, None)
4106 self.voltha_subscribers(services, cbs = cbs,
4107 num_subscribers = num_subscribers,
4108 num_channels = num_channels)
4109
4110 def test_5_subscribers_with_voltha_for_dhcp_discover_requests(self):
4111 """
4112 Test Method:
4113 0. Make sure that voltha is up and running on CORD-POD setup.
4114 1. OLT and ONU is detected and validated.
4115 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4116 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4117 4. Verify that subscriber get ip from dhcp server successfully.
4118 """
4119 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4120 num_subscribers = 5
4121 num_channels = 1
4122 services = ('DHCP')
4123 cbs = (self.dhcp_flow_check, None, None)
4124 self.voltha_subscribers(services, cbs = cbs,
4125 num_subscribers = num_subscribers,
4126 num_channels = num_channels)
4127
4128 def test_9_subscribers_with_voltha_for_dhcp_discover_requests(self):
4129 """
4130 Test Method:
4131 0. Make sure that voltha is up and running on CORD-POD setup.
4132 1. OLT and ONU is detected and validated.
4133 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4134 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4135 4. Verify that subscriber get ip from dhcp server successfully.
4136 """
4137 """Test subscriber join next for channel surfing with 9 subscribers browsing 1 channels each"""
4138 num_subscribers = 9
4139 num_channels = 1
4140 services = ('DHCP')
4141 cbs = (self.dhcp_flow_check, None, None)
4142 self.voltha_subscribers(services, cbs = cbs,
4143 num_subscribers = num_subscribers,
4144 num_channels = num_channels)
4145
4146 def test_3_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4147 """
4148 Test Method:
4149 0. Make sure that voltha is 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 multiple subscribers (3 subscribers)
4152 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4153 4. Verify that subscriber get ip from dhcp server successfully.
4154 """
4155 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4156 num_subscribers = 3
4157 num_channels = 1
4158 services = ('TLS','DHCP')
4159 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4160 self.voltha_subscribers(services, cbs = cbs,
4161 num_subscribers = num_subscribers,
4162 num_channels = num_channels)
4163
4164 def test_5_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4165 """
4166 Test Method:
4167 0. Make sure that voltha is up and running on CORD-POD setup.
4168 1. OLT and ONU is detected and validated.
4169 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4170 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4171 4. Verify that subscriber get ip from dhcp server successfully.
4172 """
4173 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4174 num_subscribers = 5
4175 num_channels = 1
4176 services = ('TLS','DHCP')
4177 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4178 self.voltha_subscribers(services, cbs = cbs,
4179 num_subscribers = num_subscribers,
4180 num_channels = num_channels)
4181
4182 def test_9_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4183 """
4184 Test Method:
4185 0. Make sure that voltha is up and running on CORD-POD setup.
4186 1. OLT and ONU is detected and validated.
4187 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4188 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4189 4. Verify that subscriber get ip from dhcp server successfully.
4190 """
4191 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4192 num_subscribers = 9
4193 num_channels = 1
4194 services = ('TLS','DHCP')
4195 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4196 self.voltha_subscribers(services, cbs = cbs,
4197 num_subscribers = num_subscribers,
4198 num_channels = num_channels)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004199
4200 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004201 def test_subscriber_with_voltha_for_dhcprelay_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004202 """
4203 Test Method:
4204 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4205 1. OLT and ONU is detected and validated.
4206 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4207 3. Send dhcp request from residential subscrber to external dhcp server.
4208 4. Verify that subscriber get ip from external dhcp server successfully.
4209 """
Thangavelu K S6432b522017-07-22 00:05:54 +00004210 self.dhcprelay_setUpClass()
4211# if not port_list:
4212 port_list = self.generate_port_list(1, 0)
4213 iface = self.port_map['ports'][port_list[1][1]]
4214 mac = self.get_mac(iface)
4215 self.host_load(iface)
4216 ##we use the defaults for this test that serves as an example for others
4217 ##You don't need to restart dhcpd server if retaining default config
4218 config = self.default_config
4219 options = self.default_options
4220 subnet = self.default_subnet_config
4221 dhcpd_interface_list = self.relay_interfaces
4222 self.dhcpd_start(intf_list = dhcpd_interface_list,
4223 config = config,
4224 options = options,
4225 subnet = subnet)
4226 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4227 self.send_recv(mac=mac)
4228 self.dhcprelay_tearDwonClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004229
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004230 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004231 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004232 """
4233 Test Method:
4234 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4235 1. OLT and ONU is detected and validated.
4236 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4237 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
4238 4. Verify that subscriber should not get ip from external dhcp server.
4239 """
4240
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004241 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004242 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004243 """
4244 Test Method:
4245 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4246 1. OLT and ONU is detected and validated.
4247 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4248 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
4249 4. Verify that subscriber should not get ip from external dhcp server.
4250 """
4251
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004252 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004253 """
4254 Test Method:
4255 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4256 1. OLT and ONU is detected and validated.
4257 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4258 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
4259 4. Verify that subscriber should not get ip from external dhcp server.
4260 """
4261
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004262 def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004263 """
4264 Test Method:
4265 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4266 1. OLT and ONU is detected and validated.
4267 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4268 3. Send dhcp request from residential subscrber to external dhcp server.
4269 4. Verify that subscriber get ip from external dhcp server successfully.
4270 5. Send dhcp release from residential subscrber to external dhcp server.
4271 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
4272 """
4273
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004274 def test_subscriber_with_voltha_for_dhcprelay_starvation(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004275 """
4276 Test Method:
4277 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4278 1. OLT and ONU is detected and validated.
4279 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4280 3. Send dhcp request from residential subscriber to external dhcp server.
4281 4. Verify that subscriber get ip from external dhcp server. successfully.
4282 5. Repeat step 3 and 4 for 10 times.
4283 6 Verify that subscriber should get ip from external dhcp server..
4284 """
4285
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004286 def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004287 """
4288 Test Method:
4289 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4290 1. OLT and ONU is detected and validated.
4291 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4292 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
4293 4. Verify that subscriber should not get ip from external dhcp server..
4294 5. Repeat steps 3 and 4 for 10 times.
4295 6 Verify that subscriber should not get ip from external dhcp server..
4296 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004297 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004298 """
4299 Test Method:
4300 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4301 1. OLT and ONU is detected and validated.
4302 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4303 3. Send dhcp request from residential subscriber to external dhcp server.
4304 4. Verify that subscriber get ip from external dhcp server. successfully.
4305 5. Repeat step 3 for 50 times.
4306 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4307 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004308 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004309 """
4310 Test Method:
4311 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4312 1. OLT and ONU is detected and validated.
4313 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4314 3. Send dhcp request from residential subscriber to external dhcp server.
4315 4. Verify that subscriber get ip from external dhcp server. successfully.
4316 5. Send DHCP request to external dhcp server.
4317 6. Repeat step 5 for 50 times.
4318 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4319 """
4320
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004321 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004322 """
4323 Test Method:
4324 0. Make sure that voltha and external dhcp server are 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. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
4328 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
4329 """
4330
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004331 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004332 """
4333 Test Method:
4334 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4335 1. OLT and ONU is detected and validated.
4336 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4337 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
4338 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.
4339 """
4340
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004341 def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004342 """
4343 Test Method:
4344 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4345 1. OLT and ONU is detected and validated.
4346 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4347 3. Send dhcp request from residential subscriber to external dhcp server.
4348 4. Verify that subscriber get ip from external dhcp server. successfully.
4349 5. Deactivate dhcp server app in onos.
4350 6. Repeat step 3.
4351 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4352 """
4353
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004354 def test_subscriber_with_voltha_for_dhcprelay_renew_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004355 """
4356 Test Method:
4357 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4358 1. OLT and ONU is detected and validated.
4359 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4360 3. Send dhcp request from residential subscriber to external dhcp server.
4361 4. Verify that subscriber get ip from external dhcp server. successfully.
4362 5. Send dhcp renew packet to external dhcp server.
4363 6. Repeat step 4.
4364 """
4365
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004366 def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004367 """
4368 Test Method:
4369 0. Make sure that voltha and external dhcp server are 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. Send dhcp request from residential subscriber to external dhcp server.
4373 4. Verify that subscriber get ip from external dhcp server. successfully.
4374 5. Send dhcp rebind packet to external dhcp server.
4375 6. Repeat step 4.
4376 """
4377
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004378 def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004379 """
4380 Test Method:
4381 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4382 1. OLT and ONU is detected and validated.
4383 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4384 3. Send dhcp request from residential subscriber to external dhcp server.
4385 4. Verify that subscriber get ip from external dhcp server. successfully.
4386 5. Disable olt devices which is being detected in voltha CLI.
4387 6. Repeat step 3.
4388 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4389 """
4390
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004391 def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004392 """
4393 Test Method:
4394 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4395 1. OLT and ONU is detected and validated.
4396 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4397 3. Send dhcp request from residential subscriber to external dhcp server.
4398 4. Verify that subscriber get ip from external dhcp server. successfully.
4399 5. Disable olt devices which is being detected in voltha CLI.
4400 6. Repeat step 3.
4401 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4402 8. Enable olt devices which is being detected in voltha CLI.
4403 9. Repeat steps 3 and 4.
4404 """
4405
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004406 def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004407 """
4408 Test Method:
4409 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4410 1. OLT and ONU is detected and validated.
4411 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4412 3. Send dhcp request from residential subscriber to external dhcp server.
4413 4. Verify that subscriber get ip from external dhcp server. successfully.
4414 5. Disable onu port which is being detected in voltha CLI.
4415 6. Repeat step 3.
4416 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4417 """
4418
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004419 def test_subscriber_with_voltha_for_dhcprelay_disable_enable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004420 """
4421 Test Method:
4422 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4423 1. OLT and ONU is detected and validated.
4424 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4425 3. Send dhcp request from residential subscriber to external dhcp server.
4426 4. Verify that subscriber get ip from external dhcp server. successfully.
4427 5. Disable onu port which is being detected in voltha CLI.
4428 6. Repeat step 3.
4429 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4430 8. Enable onu port which is being detected in voltha CLI.
4431 9. Repeat steps 3 and 4.
4432 """
4433
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004434 def test_two_subscribers_with_voltha_for_dhcprelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004435 """
4436 Test Method:
4437 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4438 1. OLT and ONU is detected and validated.
4439 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4440 3. Send dhcp request from two residential subscribers to external dhcp server.
4441 4. Verify that subscribers had got different ips from external dhcp server. successfully.
4442 """
4443
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004444 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004445 """
4446 Test Method:
4447 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4448 1. OLT and ONU is detected and validated.
4449 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4450 3. Send dhcp request from two residential subscribers to external dhcp server.
4451 4. Verify that subscribers had got ip from external dhcp server. successfully.
4452 5. Repeat step 3 and 4 for 10 times for both subscribers.
4453 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
4454 """
4455
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004456 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004457 """
4458 Test Method:
4459 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4460 1. OLT and ONU is detected and validated.
4461 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4462 3. Send dhcp request from two residential subscribers to external dhcp server.
4463 4. Verify that subscribers had got ip from external dhcp server. successfully.
4464 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
4465 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
4466 """
4467
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004468 def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004469 """
4470 Test Method:
4471 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4472 1. OLT and ONU is detected and validated.
4473 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4474 3. Send dhcp request from one residential subscriber to external dhcp server.
4475 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
4476 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
4477 """
4478
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004479 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 +00004480 """
4481 Test Method:
4482 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4483 1. OLT and ONU is detected and validated.
4484 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4485 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
4486 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
4487 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
4488 """
4489
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004490 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004491 """
4492 Test Method:
4493 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4494 1. OLT and ONU is detected and validated.
4495 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4496 3. Send dhcp request from two residential subscribers to external dhcp server.
4497 4. Verify that subscribers had got ip from external dhcp server. successfully.
4498 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4499 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4500 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4501 """
4502
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004503 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004504 """
4505 Test Method:
4506 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4507 1. OLT and ONU is detected and validated.
4508 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4509 3. Send dhcp request from two residential subscribers to external dhcp server.
4510 4. Verify that subscribers had got ip from external dhcp server. successfully.
4511 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4512 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4513 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4514 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
4515 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
4516 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4517 """
4518
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004519 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004520 """
4521 Test Method:
4522 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4523 1. OLT and ONU is detected and validated.
4524 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4525 3. Send dhcp request from two residential subscribers to external dhcp server.
4526 4. Verify that subscribers had got ip from external dhcp server. successfully.
4527 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4528 6. Disable the olt device which is detected in voltha.
4529 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4530 """
4531
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004532 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004533 """
4534 Test Method:
4535 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4536 1. OLT and ONU is detected and validated.
4537 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4538 3. Send dhcp request from two residential subscribers to external dhcp server.
4539 4. Verify that subscribers had got ip from external dhcp server. successfully.
4540 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4541 6. Disable the olt device which is detected in voltha.
4542 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4543 8. Enable the olt device which is detected in voltha.
4544 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4545 """
4546
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004547 def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004548 """
4549 Test Method:
4550 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4551 1. OLT and ONU is detected and validated.
4552 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4553 3. Send dhcp request from two residential subscribers to external dhcp server.
4554 4. Verify that subscribers had got ip from external dhcp server. successfully.
4555 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4556 6. Pause the olt device which is detected in voltha.
4557 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4558 """
Thangavelu K S36edb012017-07-05 18:24:12 +00004559
Thangavelu K S6432b522017-07-22 00:05:54 +00004560 def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004561 """
4562 Test Method:
4563 0. Make sure that voltha is up and running on CORD-POD setup.
4564 1. OLT and ONU is detected and validated.
4565 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4566 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4567 4. Send igmp joins for a multicast group address multi-group-addressA.
4568 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4569 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4570 """
4571
Thangavelu K S8e413082017-07-13 20:02:14 +00004572 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4573 num_subscribers = 1
4574 num_channels = 1
4575 services = ('IGMP')
4576 cbs = (self.igmp_flow_check, None, None)
4577 self.voltha_subscribers(services, cbs = cbs,
4578 num_subscribers = num_subscribers,
4579 num_channels = num_channels)
4580
Thangavelu K S6432b522017-07-22 00:05:54 +00004581 def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004582 """
4583 Test Method:
4584 0. Make sure that voltha is up and running on CORD-POD setup.
4585 1. OLT and ONU is detected and validated.
4586 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4587 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4588 4. Send igmp joins for a multicast group address multi-group-addressA.
4589 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4590 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4591 7. Send igmp leave for a multicast group address multi-group-addressA.
4592 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4593 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004594 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4595 num_subscribers = 1
4596 num_channels = 1
4597 services = ('IGMP')
4598 cbs = (self.igmp_flow_check, None, None)
4599 self.voltha_subscribers(services, cbs = cbs,
4600 num_subscribers = num_subscribers,
4601 num_channels = num_channels)
4602
Thangavelu K S6432b522017-07-22 00:05:54 +00004603 def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004604 """
4605 Test Method:
4606 0. Make sure that voltha is up and running on CORD-POD setup.
4607 1. OLT and ONU is detected and validated.
4608 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4609 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4610 4. Send igmp joins for a multicast group address multi-group-addressA.
4611 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4612 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4613 7. Send igmp leave for a multicast group address multi-group-addressA.
4614 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4615 9. Repeat steps 4 to 6.
4616 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004617 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4618 num_subscribers = 1
4619 num_channels = 1
4620 services = ('IGMP')
4621 cbs = (self.igmp_flow_check, None, None)
4622 self.voltha_subscribers(services, cbs = cbs,
4623 num_subscribers = num_subscribers,
4624 num_channels = num_channels)
4625
Thangavelu K S6432b522017-07-22 00:05:54 +00004626 def test_subscriber_with_voltha_for_igmp_2_groups_joins_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004627 """
4628 Test Method:
4629 0. Make sure that voltha is up and running on CORD-POD setup.
4630 1. OLT and ONU is detected and validated.
4631 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4632 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4633 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4634 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4635 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4636 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004637 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4638 num_subscribers = 1
4639 num_channels = 2
4640 services = ('IGMP')
4641 cbs = (self.igmp_flow_check, None, None)
4642 self.voltha_subscribers(services, cbs = cbs,
4643 num_subscribers = num_subscribers,
4644 num_channels = num_channels)
4645
Thangavelu K S6432b522017-07-22 00:05:54 +00004646 def test_subscriber_with_voltha_for_igmp_2_groups_joins_and_leave_for_one_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004647 """
4648 Test Method:
4649 0. Make sure that voltha is up and running on CORD-POD setup.
4650 1. OLT and ONU is detected and validated.
4651 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4652 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4653 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4654 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4655 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4656 7. Send igmp leave for a multicast group address multi-group-addressA.
4657 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.
4658 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester.
4659 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004660 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4661 num_subscribers = 1
4662 num_channels = 2
4663 services = ('IGMP')
4664 cbs = (self.igmp_flow_check, None, None)
4665 self.voltha_subscribers(services, cbs = cbs,
4666 num_subscribers = num_subscribers,
4667 num_channels = num_channels)
4668
Thangavelu K S6432b522017-07-22 00:05:54 +00004669 def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004670 """
4671 Test Method:
4672 0. Make sure that voltha is up and running on CORD-POD setup.
4673 1. OLT and ONU is detected and validated.
4674 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4675 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4676 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4677 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4678 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4679 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4680 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4681 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004682 num_subscribers = 1
4683 num_channels = 1
4684 services = ('IGMP')
4685 cbs = (self.igmp_flow_check, None, None)
4686 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4687 num_subscribers = num_subscribers,
4688 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004689
Thangavelu K S6432b522017-07-22 00:05:54 +00004690 def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004691 """
4692 Test Method:
4693 0. Make sure that voltha is up and running on CORD-POD setup.
4694 1. OLT and ONU is detected and validated.
4695 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4696 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4697 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4698 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4699 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4700 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA
4701 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4702 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4703 """
4704
Thangavelu K S8e413082017-07-13 20:02:14 +00004705 num_subscribers = 1
4706 num_channels = 2
4707 services = ('IGMP')
4708 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4709 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4710 num_subscribers = num_subscribers,
4711 num_channels = num_channels)
4712
Thangavelu K S6432b522017-07-22 00:05:54 +00004713 def test_subscriber_with_voltha_for_igmp_change_to_include_back_from_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004714 """
4715 Test Method:
4716 0. Make sure that voltha is up and running on CORD-POD setup.
4717 1. OLT and ONU is detected and validated.
4718 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4719 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4720 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4721 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4722 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4723 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA
4724 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4725 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4726 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004727 num_subscribers = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004728 num_channels = 2
Thangavelu K S8e413082017-07-13 20:02:14 +00004729 services = ('IGMP')
4730 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4731 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4732 num_subscribers = num_subscribers,
4733 num_channels = num_channels)
4734
Thangavelu K S6432b522017-07-22 00:05:54 +00004735 def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004736 """
4737 Test Method:
4738 0. Make sure that voltha is up and running on CORD-POD setup.
4739 1. OLT and ONU is detected and validated.
4740 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4741 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4742 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4743 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4744 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4745 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA
4746 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4747 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4748 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004749
4750 num_subscribers = 1
4751 num_channels = 1
4752 services = ('IGMP')
4753 cbs = (self.igmp_flow_check_join_change_to_block, None, None)
4754 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4755 num_subscribers = num_subscribers,
4756 num_channels = num_channels)
4757
Thangavelu K S6432b522017-07-22 00:05:54 +00004758 def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004759 """
4760 Test Method:
4761 0. Make sure that voltha is up and running on CORD-POD setup.
4762 1. OLT and ONU is detected and validated.
4763 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4764 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4765 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4766 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4767 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4768 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB
4769 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4770 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4771 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004772
4773 num_subscribers = 1
4774 num_channels = 1
4775 services = ('IGMP')
4776 cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None)
4777 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4778 num_subscribers = num_subscribers,
4779 num_channels = num_channels)
4780
Thangavelu K S6432b522017-07-22 00:05:54 +00004781 def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004782 """
4783 Test Method:
4784 0. Make sure that voltha is up and running on CORD-POD setup.
4785 1. OLT and ONU is detected and validated.
4786 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4787 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4788 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4789 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4790 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4791 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4792 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4793 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004794
4795 num_subscribers = 1
4796 num_channels = 1
4797 services = ('IGMP')
4798 cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None)
4799 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4800 num_subscribers = num_subscribers,
4801 num_channels = num_channels)
4802
Thangavelu K S6432b522017-07-22 00:05:54 +00004803 def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004804 """
4805 Test Method:
4806 0. Make sure that voltha is up and running on CORD-POD setup.
4807 1. OLT and ONU is detected and validated.
4808 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4809 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4810 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4811 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4812 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4813 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4814 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4815 """
4816
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004817 num_subscribers = 1
4818 num_channels = 1
4819 services = ('IGMP')
4820 cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None)
4821 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4822 num_subscribers = num_subscribers,
4823 num_channels = num_channels)
4824
Thangavelu K S6432b522017-07-22 00:05:54 +00004825 def test_two_subscribers_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004826 """
4827 Test Method:
4828 0. Make sure that voltha is up and running on CORD-POD setup.
4829 1. OLT and ONU is detected and validated.
4830 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4831 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4832 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4833 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4834 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4835 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4836 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4837 """
4838
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004839 num_subscribers = 2
4840 num_channels = 1
4841 services = ('IGMP')
4842 cbs = (self.igmp_flow_check, None, None)
4843 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'],
4844 num_subscribers = num_subscribers,
4845 num_channels = num_channels)
4846
Thangavelu K S36edb012017-07-05 18:24:12 +00004847 def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self):
4848 """
4849 Test Method:
4850 0. Make sure that voltha is up and running on CORD-POD setup.
4851 1. OLT and ONU is detected and validated.
4852 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4853 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4854 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4855 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4856 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4857 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4858 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4859 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4860 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4861 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4862 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004863 num_subscribers = 2
4864 num_channels = 2
4865 services = ('IGMP')
4866 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4867 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'],
4868 num_subscribers = num_subscribers,
4869 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004870
Thangavelu K S6432b522017-07-22 00:05:54 +00004871 def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004872 """
4873 Test Method:
4874 0. Make sure that voltha is up and running on CORD-POD setup.
4875 1. OLT and ONU is detected and validated.
4876 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4877 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4878 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4879 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4880 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4881 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.
4882 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.
4883 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4884 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.
4885 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.
4886 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.
4887 """
4888
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004889 num_subscribers = 2
4890 num_channels = 2
4891 services = ('IGMP')
4892 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4893 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'],
4894 num_subscribers = num_subscribers,
4895 num_channels = num_channels)
4896
4897 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00004898 def test_two_subscribers_with_voltha_for_igmp_with_uni_port_down_for_one_subscriber_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004899 """
4900 Test Method:
4901 0. Make sure that voltha is up and running on CORD-POD setup.
4902 1. OLT and ONU is detected and validated.
4903 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4904 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4905 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4906 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4907 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4908 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4909 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4910 9. Disable uni_2 port which is being shown on voltha CLI.
4911 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4912 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4913 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004914 #rx_port = self.port_map['ports'][port_list[i][1]]
4915 df = defer.Deferred()
4916 def igmp_flow_check_operating_onu_admin_state(df):
4917 num_subscribers = 2
4918 num_channels = 2
4919 services = ('IGMP')
4920 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
4921 port_list = self.generate_port_list(num_subscribers, num_channels)
4922
4923 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4924 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
4925 thread1.start()
4926 time.sleep(randint(40,50))
4927 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
4928 thread2.start()
4929 time.sleep(10)
4930 thread1.join()
4931 thread2.join()
4932 try:
4933 assert_equal(self.success, False)
4934 log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check')
4935 time.sleep(10)
4936 finally:
4937 pass
4938 df.callback(0)
4939 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
4940 return df
4941
4942 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00004943 def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self):
4944 """
4945 Test Method:
4946 0. Make sure that voltha is up and running on CORD-POD setup.
4947 1. OLT and ONU is detected and validated.
4948 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4949 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4950 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4951 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4952 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4953 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4954 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4955 9. Disable uni_2 port which is being shown on voltha CLI.
4956 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4957 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4958 12. Enable uni_2 port which we disable at step 9.
4959 13. Repeat step 5,6 and 8.
4960 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004961 df = defer.Deferred()
4962 def igmp_flow_check_operating_onu_admin_state(df):
4963 num_subscribers = 2
4964 num_channels = 2
4965 services = ('IGMP')
4966 cbs = (self.igmp_flow_check, None, None)
4967 port_list = self.generate_port_list(num_subscribers, num_channels)
4968
4969 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4970 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
4971 thread1.start()
4972 time.sleep(randint(50,60))
4973 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
4974 thread2.start()
4975 time.sleep(10)
4976 thread1.join()
4977 thread2.join()
4978 try:
4979 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00004980 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful')
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004981 time.sleep(10)
4982 finally:
4983 pass
4984 df.callback(0)
4985 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
4986 return df
4987
4988 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00004989 def test_two_subscribers_with_voltha_for_igmp_disabling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004990 """
4991 Test Method:
4992 0. Make sure that voltha is up and running on CORD-POD setup.
4993 1. OLT and ONU is detected and validated.
4994 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4995 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4996 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4997 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4998 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4999 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5000 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5001 9. Disable olt device which is being shown on voltha CLI.
5002 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5003 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5004 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005005 df = defer.Deferred()
5006 def igmp_flow_check_operating_olt_admin_disble(df):
5007 num_subscribers = 2
5008 num_channels = 2
5009 services = ('IGMP')
5010 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5011 port_list = self.generate_port_list(num_subscribers, num_channels)
5012
5013 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5014 thread1.start()
5015 time.sleep(randint(50,60))
5016 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5017 thread2.start()
5018 time.sleep(10)
5019 thread1.join()
5020 thread2.join()
5021 try:
5022 assert_equal(self.success, False)
5023 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5024 time.sleep(10)
5025 finally:
5026 pass
5027 df.callback(0)
5028 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5029 return df
5030
5031 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005032 def test_two_subscribers_with_voltha_for_igmp_pausing_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005033 """
5034 Test Method:
5035 0. Make sure that voltha is up and running on CORD-POD setup.
5036 1. OLT and ONU is detected and validated.
5037 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5038 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5039 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5040 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5041 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5042 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5043 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5044 9. Pause olt device which is being shown on voltha CLI.
5045 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5046 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5047 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005048 df = defer.Deferred()
5049 def igmp_flow_check_operating_olt_admin_pause(df):
5050 num_subscribers = 2
5051 num_channels = 2
5052 services = ('IGMP')
5053 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5054 port_list = self.generate_port_list(num_subscribers, num_channels)
5055
5056 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5057 thread1.start()
5058 time.sleep(randint(50,60))
5059 thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,))
5060 thread2.start()
5061 time.sleep(10)
5062 thread1.join()
5063 thread2.join()
5064 try:
5065 assert_equal(self.success, False)
5066 log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test')
5067 time.sleep(10)
5068 finally:
5069 pass
5070 df.callback(0)
5071 reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df)
5072 return df
5073
5074 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005075 def test_two_subscribers_with_voltha_for_igmp_toggling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005076 """
5077 Test Method:
5078 0. Make sure that voltha is up and running on CORD-POD setup.
5079 1. OLT and ONU is detected and validated.
5080 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5081 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5082 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5083 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5084 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5085 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5086 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5087 9. Disable olt device which is being shown on voltha CLI.
5088 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5089 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5090 12. Enable olt device which is disable at step 9.
5091 13. Repeat steps 4,5, 7 and 8.
5092 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005093 df = defer.Deferred()
5094 def igmp_flow_check_operating_olt_admin_restart(df):
5095 num_subscribers = 2
5096 num_channels = 2
5097 services = ('IGMP')
5098 cbs = (self.igmp_flow_check, None, None)
5099 port_list = self.generate_port_list(num_subscribers, num_channels)
5100
5101 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5102 thread1.start()
5103 time.sleep(randint(50,60))
5104 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5105 thread2.start()
5106 time.sleep(10)
5107 thread1.join()
5108 thread2.join()
5109 try:
5110 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005111 log_test.info('Igmp flow check expected to fail during olt device restart, After OLT device is up, it should be successful')
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005112 time.sleep(10)
5113 finally:
5114 pass
5115 df.callback(0)
5116 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5117 return df
Thangavelu K S6432b522017-07-22 00:05:54 +00005118
5119 @deferred(TESTCASE_TIMEOUT)
5120 def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self):
5121 """
5122 Test Method:
5123 0. Make sure that voltha is up and running on CORD-POD setup.
5124 1. OLT and ONU is detected and validated.
5125 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5126 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5127 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5128 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5129 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5130 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5131 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5132 9. Disable olt device which is being shown on voltha CLI.
5133 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5134 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5135 12. Repeat steps 4 to 11 steps multiple times (example 20 times)
5136 """
5137 df = defer.Deferred()
5138 no_iterations = 20
5139 def igmp_flow_check_operating_olt_admin_disble(df):
5140 num_subscribers = 2
5141 num_channels = 2
5142 services = ('IGMP')
5143 cbs = (self.igmp_flow_check, None, None)
5144 port_list = self.generate_port_list(num_subscribers, num_channels)
5145
5146 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5147 thread1.start()
5148 time.sleep(randint(30,40))
5149 for i in range(no_iterations):
5150 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5151 thread2.start()
5152 time.sleep(8)
5153 thread2.join()
5154 thread1.join()
5155 thread1.isAlive()
5156 thread2.join()
5157 try:
5158 assert_equal(self.success, False)
5159 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5160 time.sleep(10)
5161 finally:
5162 pass
5163 df.callback(0)
5164 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5165 return df
5166
5167 @deferred(TESTCASE_TIMEOUT + 200)
5168 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self):
5169 """
5170 Test Method:
5171 0. Make sure that voltha is up and running on CORD-POD setup.
5172 1. OLT and ONU is detected and validated.
5173 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5174 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5175 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5176 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5177 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5178 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5179 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5180 9. Disable uni_2 port which is being shown on voltha CLI.
5181 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5182 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5183 12. Enable uni_2 port which we disable at step 9.
5184 13. Repeat step 5,6 and 8.
5185 14. Repeat steps 4 to 13 steps multiple times (example 5 times)
5186 """
5187 df = defer.Deferred()
5188 no_iterations = 5
5189 def igmp_flow_check_operating_onu_admin_state(df):
5190 num_subscribers = 2
5191 num_channels = 2
5192 services = ('IGMP')
5193 cbs = (self.igmp_flow_check, None, None)
5194 port_list = self.generate_port_list(num_subscribers, num_channels)
5195
5196 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5197 thread1.start()
5198 time.sleep(randint(40,60))
5199 for i in range(no_iterations):
5200 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5201 log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha')
5202 thread2.start()
5203 time.sleep(1)
5204 thread2.join()
5205 thread1.isAlive()
5206 thread1.join()
5207 thread2.join()
5208 try:
5209 assert_equal(self.success, True)
5210 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful')
5211 time.sleep(10)
5212 finally:
5213 pass
5214 df.callback(0)
5215 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5216 return df
5217
5218 @deferred(TESTCASE_TIMEOUT)
5219 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self):
5220 """
5221 Test Method:
5222 0. Make sure that voltha is up and running on CORD-POD setup.
5223 1. OLT and ONU is detected and validated.
5224 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5225 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5226 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5227 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5228 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5229 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5230 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5231 9. Disable olt device which is being shown on voltha CLI.
5232 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5233 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5234 12. Enable olt device which is disable at step 9.
5235 13. Repeat steps 4,5, 7 and 8.
5236 14. Repeat steps 4 to 13 steps multiple times (example 10 times)
5237 """
5238 df = defer.Deferred()
5239 no_iterations = 10
5240 def igmp_flow_check_operating_olt_admin_restart(df):
5241 num_subscribers = 2
5242 num_channels = 2
5243 services = ('IGMP')
5244 cbs = (self.igmp_flow_check, None, None)
5245 port_list = self.generate_port_list(num_subscribers, num_channels)
5246
5247 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5248 thread1.start()
5249 time.sleep(randint(50,60))
5250 for i in range(no_iterations):
5251 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5252 thread2.start()
5253 time.sleep(10)
5254 thread2.join()
5255 thread1.join()
5256 thread2.join()
5257 try:
5258 assert_equal(self.success, True)
5259 log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful')
5260 time.sleep(10)
5261 finally:
5262 pass
5263 df.callback(0)
5264 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5265 return df
5266
5267 def test_5_subscriber_with_voltha_for_igmp_with_10_group_joins_verifying_traffic(self):
5268 """
5269 Test Method:
5270 0. Make sure that voltha is up and running on CORD-POD setup.
5271 1. OLT and ONU is detected and validated.
5272 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5273 3. Issue multiple dhcp client packets to get IP address from dhcp server for as subscribers and check connectivity.
5274 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5275 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5276 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5277 """
5278
5279 num_subscribers = 5
5280 num_channels = 10
5281 services = ('IGMP')
5282 cbs = (self.igmp_flow_check, None, None)
5283 self.voltha_subscribers(services, cbs = cbs,
5284 num_subscribers = num_subscribers,
5285 num_channels = num_channels)
5286
5287 def test_9_subscriber_with_voltha_for_igmp_with_10_group_joins_and_verify_traffic(self):
5288 """
5289 Test Method:
5290 0. Make sure that voltha is up and running on CORD-POD setup.
5291 1. OLT and ONU is detected and validated.
5292 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5293 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity.
5294 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5295 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5296 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5297 """
5298 num_subscribers = 9
5299 num_channels = 10
5300 services = ('IGMP')
5301 cbs = (self.igmp_flow_check, None, None)
5302 self.voltha_subscribers(services, cbs = cbs,
5303 num_subscribers = num_subscribers,
5304 num_channels = num_channels)
5305