blob: 1be45baaccefd9bb0eabc3d68ef77607614ba226 [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
A R Karthick53442712017-07-27 12:23:30 -0700169 voltha_attrs = None
Thangavelu K S9648eed2017-06-13 20:15:25 +0000170 success = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000171 olt_device_id = None
Thangavelu K S6432b522017-07-22 00:05:54 +0000172 apps = ('org.opencord.aaa', 'org.onosproject.dhcp', 'org.onosproject.dhcprelay')
173 app_dhcp = ('org.onosproject.dhcp')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000174 olt_apps = () #'org.opencord.cordmcast')
175 vtn_app = 'org.opencord.vtn'
176 table_app = 'org.ciena.cordigmp'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000177 test_path = os.path.dirname(os.path.realpath(__file__))
178 table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700179 app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000180 olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar')
A.R Karthick3493a572017-06-07 18:28:10 -0700181 olt_app_name = 'org.onosproject.olt'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000182 #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
183 olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
184 onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
A R Karthick9dc6e922017-07-12 14:40:16 -0700185 VOLTHA_AUTO_CONFIGURE = False
Thangavelu K S8e413082017-07-13 20:02:14 +0000186 num_joins = 0
187
Thangavelu K S6432b522017-07-22 00:05:54 +0000188 relay_interfaces_last = ()
189 interface_to_mac_map = {}
190 host_ip_map = {}
191 default_config = { 'default-lease-time' : 600, 'max-lease-time' : 7200, }
192 default_options = [ ('subnet-mask', '255.255.255.0'),
193 ('broadcast-address', '192.168.1.255'),
194 ('domain-name-servers', '192.168.1.1'),
195 ('domain-name', '"mydomain.cord-tester"'),
196 ]
197 ##specify the IP for the dhcp interface matching the subnet and subnet config
198 ##this is done for each interface dhcpd server would be listening on
199 default_subnet_config = [ ('192.168.1.2',
200'''
201subnet 192.168.1.0 netmask 255.255.255.0 {
202 range 192.168.1.10 192.168.1.100;
203}
204'''), ]
205
206
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000207 VOLTHA_ENABLED = True
208 INTF_TX_DEFAULT = 'veth2'
209 INTF_RX_DEFAULT = 'veth0'
Thangavelu K S9648eed2017-06-13 20:15:25 +0000210 INTF_2_RX_DEFAULT = 'veth6'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000211 TESTCASE_TIMEOUT = 300
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000212 VOLTHA_CONFIG_FAKE = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000213 VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
A R Karthick53442712017-07-27 12:23:30 -0700214 VOLTHA_UPLINK_VLAN_START = 444
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000215 VOLTHA_ONU_UNI_PORT = 'veth0'
216
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000217 dhcp_server_config = {
218 "ip": "10.1.11.50",
219 "mac": "ca:fe:ca:fe:ca:fe",
220 "subnet": "255.255.252.0",
221 "broadcast": "10.1.11.255",
222 "router": "10.1.8.1",
223 "domain": "8.8.8.8",
224 "ttl": "63",
225 "delay": "2",
226 "startip": "10.1.11.51",
227 "endip": "10.1.11.100"
228 }
229
230
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000231 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
232MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
233CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
234IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
235RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
236MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
237BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
238hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
239gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
240+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
241rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
242VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
243eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
2446tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
245PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
246nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
247-----END CERTIFICATE-----"""
248
249 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
250MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
251CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
252IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
253RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
254MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
255BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
256hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
257AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
2585An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
259tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
260OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
261qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
2622Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
263BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
264eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
265MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
266VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
267RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
268dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
269T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
270yg==
271-----END CERTIFICATE-----'''
A R Karthick35495c32017-05-11 14:58:32 -0700272
A.R Karthick3493a572017-06-07 18:28:10 -0700273 @classmethod
274 def update_apps_version(cls):
275 version = Onos.getVersion()
276 major = int(version.split('.')[0])
277 minor = int(version.split('.')[1])
278 cordigmp_app_version = '2.0-SNAPSHOT'
279 olt_app_version = '1.2-SNAPSHOT'
280 if major > 1:
281 cordigmp_app_version = '3.0-SNAPSHOT'
282 olt_app_version = '2.0-SNAPSHOT'
283 elif major == 1:
284 if minor > 10:
285 cordigmp_app_version = '3.0-SNAPSHOT'
286 olt_app_version = '2.0-SNAPSHOT'
287 elif minor <= 8:
288 olt_app_version = '1.1-SNAPSHOT'
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700289 cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version))
290 cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version))
291 cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
292
A R Karthick35495c32017-05-11 14:58:32 -0700293 @classmethod
Thangavelu K S6432b522017-07-22 00:05:54 +0000294 def dhcprelay_setUpClass(cls):
295 ''' Activate the dhcprelay app'''
296 OnosCtrl(cls.app_dhcp).deactivate()
297 time.sleep(3)
298 cls.onos_ctrl = OnosCtrl('org.onosproject.dhcprelay')
299 status, _ = cls.onos_ctrl.activate()
300 assert_equal(status, True)
301 time.sleep(3)
302 cls.dhcp_relay_setup()
303 ##start dhcpd initially with default config
304 cls.dhcpd_start()
305
306 @classmethod
307 def dhcprelay_tearDownClass(cls):
308 '''Deactivate the dhcp relay app'''
309 try:
310 os.unlink('{}/dhcpd.conf'.format(cls.dhcp_data_dir))
311 os.unlink('{}/dhcpd.leases'.format(cls.dhcp_data_dir))
312 except: pass
313 cls.onos_ctrl.deactivate()
314 cls.dhcpd_stop()
315 cls.dhcp_relay_cleanup()
316
317 @classmethod
A.R Karthickf874d032017-06-07 18:47:51 -0700318 def onos_load_config(cls, app, config):
319 status, code = OnosCtrl.config(config)
320 if status is False:
321 log_test.info('JSON config request for app %s returned status %d' %(app, code))
322 assert_equal(status, True)
323 time.sleep(2)
324
325 @classmethod
326 def onos_aaa_load(cls):
327 aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
328 'radiusIp': '172.17.0.2' } } } }
329 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
330 aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip
331 cls.onos_load_config('org.opencord.aaa', aaa_dict)
332
333 @classmethod
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000334 def onos_dhcp_table_load(self, config = None):
335 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
336 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
337 if config:
338 for k in config.keys():
339 if dhcp_config.has_key(k):
340 dhcp_config[k] = config[k]
341 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
342
Thangavelu K S36edb012017-07-05 18:24:12 +0000343 def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = None):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000344 if validation:
Thangavelu K S735a6662017-06-15 18:08:23 +0000345 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
346 assert_not_equal(cip, None)
347 assert_not_equal(sip, None)
348 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
349 (cip, sip, dhcp.get_mac(cip)[0]))
350 if validation == False:
351 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
352 assert_equal(cip, None)
353 assert_equal(sip, None)
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000354 log_test.info('Dhcp client did not get IP from server')
Thangavelu K S735a6662017-06-15 18:08:23 +0000355
Thangavelu K S36edb012017-07-05 18:24:12 +0000356 if validation == 'skip':
357 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
358
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000359 return cip,sip
360
Thangavelu K S36edb012017-07-05 18:24:12 +0000361 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):
362 config = {'startip':startip, 'endip':'10.10.10.200',
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000363 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
364 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
365 self.onos_dhcp_table_load(config)
366 dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface)
Thangavelu K S36edb012017-07-05 18:24:12 +0000367 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed, validation = validation, mac = mac)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000368 return cip, sip
369
370 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700371 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700372 cls.update_apps_version()
A R Karthick53442712017-07-27 12:23:30 -0700373 cls.voltha_attrs = dict(host = cls.VOLTHA_HOST,
374 rest_port = cls.VOLTHA_REST_PORT,
375 uplink_vlan_map = cls.VOLTHA_UPLINK_VLAN_MAP,
376 uplink_vlan_start = cls.VOLTHA_UPLINK_VLAN_START)
377 cls.voltha = VolthaCtrl(**cls.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000378 cls.install_app_table()
379 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
380 cls.port_map, cls.port_list = cls.olt.olt_port_map()
381 cls.switches = cls.port_map['switches']
Thangavelu K S36edb012017-07-05 18:24:12 +0000382 cls.ponsim_ports = cls.port_map['ponsim']
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000383 cls.num_ports = cls.port_map['num_ports']
384 if cls.num_ports > 1:
385 cls.num_ports -= 1 ##account for the tx port
386 cls.activate_apps(cls.apps + cls.olt_apps)
A.R Karthickf874d032017-06-07 18:47:51 -0700387 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000388
A.R Karthick3493a572017-06-07 18:28:10 -0700389 @classmethod
390 def tearDownClass(cls):
391 '''Deactivate the olt apps and restart OVS back'''
392 apps = cls.olt_apps + ( cls.table_app,)
393 for app in apps:
394 onos_ctrl = OnosCtrl(app)
395 onos_ctrl.deactivate()
396 cls.install_app_igmp()
A.R Karthick3493a572017-06-07 18:28:10 -0700397 @classmethod
398 def install_app_igmp(cls):
399 ##Uninstall the table app on class exit
400 OnosCtrl.uninstall_app(cls.table_app)
401 time.sleep(2)
402 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
403 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700404
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000405 def remove_olt(self, switch_map):
406 controller = get_controller()
407 auth = ('karaf', 'karaf')
408 #remove subscriber for every port on all the voltha devices
409 for device, device_map in switch_map.iteritems():
410 uni_ports = device_map['ports']
411 uplink_vlan = device_map['uplink_vlan']
412 for port in uni_ports:
413 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
414 device,
415 port)
416 resp = requests.delete(rest_url, auth = auth)
417 if resp.status_code not in [204, 202, 200]:
418 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
419 else:
420 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
421 OnosCtrl.uninstall_app(self.olt_app_file)
422
423 def config_olt(self, switch_map):
424 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000425 auth = ('karaf', 'karaf')
426 #configure subscriber for every port on all the voltha devices
427 for device, device_map in switch_map.iteritems():
428 uni_ports = device_map['ports']
429 uplink_vlan = device_map['uplink_vlan']
430 for port in uni_ports:
431 vlan = port
432 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
433 device,
434 port,
435 vlan)
436 resp = requests.post(rest_url, auth = auth)
437 #assert_equal(resp.ok, True)
438
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000439 def voltha_uni_port_toggle(self, uni_port = None):
440 ## Admin state of port is down and up
441 if not uni_port:
442 uni_port = self.INTF_RX_DEFAULT
443 cmd = 'ifconfig {} down'.format(uni_port)
444 os.system(cmd)
445 log_test.info('Admin state of uni_port is down')
446 time.sleep(30)
447 cmd = 'ifconfig {} up'.format(uni_port)
448 os.system(cmd)
449 log_test.info('Admin state of uni_port is up now')
450 time.sleep(30)
451 return
452
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000453 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000454 def install_app_table(cls):
455 ##Uninstall the existing app if any
456 OnosCtrl.uninstall_app(cls.table_app)
457 time.sleep(2)
458 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
459 OnosCtrl.install_app(cls.table_app_file)
460 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000461
462 @classmethod
463 def activate_apps(cls, apps):
464 for app in apps:
465 onos_ctrl = OnosCtrl(app)
466 status, _ = onos_ctrl.activate()
467 assert_equal(status, True)
468 time.sleep(2)
469
Thangavelu K S735a6662017-06-15 18:08:23 +0000470 @classmethod
471 def deactivate_apps(cls, apps):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000472 cls.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000473 for app in apps:
474 onos_ctrl = OnosCtrl(app)
475 status, _ = onos_ctrl.deactivate()
476 if status is False:
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000477 cls.success = False
478 # assert_equal(status, True)
Thangavelu K S735a6662017-06-15 18:08:23 +0000479 time.sleep(2)
480
Thangavelu K S36edb012017-07-05 18:24:12 +0000481 def random_ip(self,start_ip = '10.10.10.20', end_ip = '10.10.10.65'):
482 start = list(map(int, start_ip.split(".")))
483 end = list(map(int, end_ip.split(".")))
484 temp = start
485 ip_range = []
486 ip_range.append(start_ip)
487 while temp != end:
488 start[3] += 1
489 for i in (3, 2, 1):
490 if temp[i] == 255:
491 temp[i] = 0
492 temp[i-1] += 1
493 ip_range.append(".".join(map(str, temp)))
494 return random.choice(ip_range)
495
Thangavelu K S8e413082017-07-13 20:02:14 +0000496 def random_mcast_ip(self,start_ip = '224.0.1.0', end_ip = '224.0.1.100'):
497 start = list(map(int, start_ip.split(".")))
498 end = list(map(int, end_ip.split(".")))
499 temp = start
500 ip_range = []
501 ip_range.append(start_ip)
502 while temp != end:
503 start[3] += 1
504 for i in (3, 2, 1):
505 if temp[i] == 255:
506 temp[i] = 0
507 temp[i-1] += 1
508 ip_range.append(".".join(map(str, temp)))
509 return random.choice(ip_range)
510
Thangavelu K S6432b522017-07-22 00:05:54 +0000511 @classmethod
512 def dhcp_relay_setup(cls):
513 #did = OnosCtrl.get_device_id()
514 #cls.relay_device_id = did
515 #cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
516 #cls.port_map, _ = cls.olt.olt_port_map() self.port_map['ports'][port_list[1][1]]
517 if cls.port_map:
518 ##Per subscriber, we use 1 relay port
519 try:
520 relay_port = cls.port_map['ports']
521 except:
522 relay_port = cls.port_map['uplink']
523 cls.relay_interface_port = relay_port
524 cls.relay_interfaces = (cls.port_map[cls.relay_interface_port],)
525 else:
526# cls.relay_interface_port = 100
527# cls.relay_interfaces = (g_subscriber_port_map[cls.relay_interface_port],)
528 log_test.info('No ONU ports are available, hence returning nothing')
529 cls.relay_interfaces_last = cls.relay_interfaces
530 if cls.port_map:
531 ##generate a ip/mac client virtual interface config for onos
532 interface_list = []
533 for port in cls.port_map['ports']:
534 port_num = cls.port_map[port]
535 if port_num == cls.port_map['uplink']:
536 continue
537 ip = cls.get_host_ip(port_num)
538 mac = cls.get_mac(port)
539 interface_list.append((port_num, ip, mac))
540
541 #configure dhcp server virtual interface on the same subnet as first client interface
542 relay_ip = cls.get_host_ip(interface_list[0][0])
543 relay_mac = cls.get_mac(cls.port_map[cls.relay_interface_port])
544 interface_list.append((cls.relay_interface_port, relay_ip, relay_mac))
545 cls.onos_interface_load(interface_list)
546
547 @classmethod
548 def onos_interface_load(cls, interface_list):
549 interface_dict = { 'ports': {} }
550 for port_num, ip, mac in interface_list:
551 port_map = interface_dict['ports']
552 port = '{}/{}'.format(cls.relay_device_id, port_num)
553 port_map[port] = { 'interfaces': [] }
554 interface_list = port_map[port]['interfaces']
555 interface_map = { 'ips' : [ '{}/{}'.format(ip, 24) ],
556 'mac' : mac,
557 'name': 'vir-{}'.format(port_num)
558 }
559 interface_list.append(interface_map)
560
561 cls.onos_load_config(interface_dict)
562 cls.configs['interface_config'] = interface_dict
563
564 @classmethod
565 def get_host_ip(cls, port):
566 if cls.host_ip_map.has_key(port):
567 return cls.host_ip_map[port]
568 cls.host_ip_map[port] = '192.168.1.{}'.format(port)
569 return cls.host_ip_map[port]
570
571 @classmethod
572 def host_load(cls, iface):
573 '''Have ONOS discover the hosts for dhcp-relay responses'''
574 port = g_subscriber_port_map[iface]
575 host = '173.17.1.{}'.format(port)
576 cmds = ( 'ifconfig {} 0'.format(iface),
577 'ifconfig {0} {1}'.format(iface, host),
578 'arping -I {0} {1} -c 2'.format(iface, host),
579 'ifconfig {} 0'.format(iface), )
580 for c in cmds:
581 os.system(c)
582
583 @classmethod
584 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
585 subnet = default_subnet_config):
586 conf = ''
587 for k, v in config.items():
588 conf += '{} {};\n'.format(k, v)
589
590 opts = ''
591 for k, v in options:
592 opts += 'option {} {};\n'.format(k, v)
593
594 subnet_config = ''
595 for _, v in subnet:
596 subnet_config += '{}\n'.format(v)
597
598 return '{}{}{}'.format(conf, opts, subnet_config)
599
600 @classmethod
601 def dhcpd_start(cls, intf_list = None,
602 config = default_config, options = default_options,
603 subnet = default_subnet_config):
604 '''Start the dhcpd server by generating the conf file'''
605 if intf_list is None:
606 intf_list = cls.relay_interfaces
607 ##stop dhcpd if already running
608 cls.dhcpd_stop()
609 dhcp_conf = cls.dhcpd_conf_generate(config = config, options = options,
610 subnet = subnet)
611 ##first touch dhcpd.leases if it doesn't exist
612 lease_file = '{}/dhcpd.leases'.format(cls.dhcp_data_dir)
613 if os.access(lease_file, os.F_OK) is False:
614 with open(lease_file, 'w') as fd: pass
615
616 conf_file = '{}/dhcpd.conf'.format(cls.dhcp_data_dir)
617 with open(conf_file, 'w') as fd:
618 fd.write(dhcp_conf)
619
620 #now configure the dhcpd interfaces for various subnets
621 index = 0
622 intf_info = []
623 for ip,_ in subnet:
624 intf = intf_list[index]
625 mac = cls.get_mac(intf)
626 intf_info.append((ip, mac))
627 index += 1
628 os.system('ifconfig {} {}'.format(intf, ip))
629
630 intf_str = ','.join(intf_list)
631 dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format(conf_file, lease_file, intf_str)
632 log_test.info('Starting DHCPD server with command: %s' %dhcpd_cmd)
633 ret = os.system(dhcpd_cmd)
634 assert_equal(ret, 0)
635 time.sleep(3)
636 cls.relay_interfaces_last = cls.relay_interfaces
637 cls.relay_interfaces = intf_list
638 cls.onos_dhcp_relay_load(*intf_info[0])
639
640 @classmethod
641 def dhcpd_stop(cls):
642 os.system('pkill -9 dhcpd')
643 for intf in cls.relay_interfaces:
644 os.system('ifconfig {} 0'.format(intf))
645
646 cls.relay_interfaces = cls.relay_interfaces_last
647
648 @classmethod
649 def get_mac(cls, iface):
650 if cls.interface_to_mac_map.has_key(iface):
651 return cls.interface_to_mac_map[iface]
652 mac = get_mac(iface, pad = 0)
653 cls.interface_to_mac_map[iface] = mac
654 return mac
655
656 def send_recv(self, mac=None, update_seed = False, validate = True):
657 cip, sip = self.dhcp.discover(mac = mac, update_seed = update_seed)
658 if validate:
659 assert_not_equal(cip, None)
660 assert_not_equal(sip, None)
661 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
662 (cip, sip, self.dhcp.get_mac(cip)[0]))
663 return cip,sip
664
665 @classmethod
666 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
667 subnet = default_subnet_config):
668 conf = ''
669 for k, v in config.items():
670 conf += '{} {};\n'.format(k, v)
671
672 opts = ''
673 for k, v in options:
674 opts += 'option {} {};\n'.format(k, v)
675
676 subnet_config = ''
677 for _, v in subnet:
678 subnet_config += '{}\n'.format(v)
679
680 return '{}{}{}'.format(conf, opts, subnet_config)
681
682 @classmethod
683 def onos_dhcp_relay_load(cls, server_ip, server_mac):
684 relay_device_map = '{}/{}'.format(cls.relay_device_id, cls.relay_interface_port)
685 dhcp_dict = {'apps':{'org.onosproject.dhcp-relay':{'dhcprelay':
686 {'dhcpserverConnectPoint':relay_device_map,
687 'serverip':server_ip,
688 'servermac':server_mac
689 }
690 }
691 }
692 }
693 cls.onos_load_config(dhcp_dict)
694 cls.configs['relay_config'] = dhcp_dict
695
696 @classmethod
697 def dhcp_relay_cleanup(cls):
698 ##reset the ONOS port configuration back to default
699 for config in cls.configs.items():
700 OnosCtrl.delete(config)
701 # if cls.onos_restartable is True:
702 # log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
703 # return cord_test_onos_restart(config = {})
704
705
Thangavelu K S8e413082017-07-13 20:02:14 +0000706 def tls_flow_check(self, olt_ports, cert_info = None, multiple_sub = False):
707 if multiple_sub is True:
708 olt_nni_port = olt_ports.tx_port
709 olt_uni_port = olt_ports.rx_port
710 else:
Thangavelu K S36edb012017-07-05 18:24:12 +0000711 olt_uni_port = olt_ports
712
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000713 def tls_fail_cb():
714 log_test.info('TLS verification failed')
715 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700716 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000717 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
718 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000719 if tls.failTest is True:
720 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000721 assert_equal(tls.failTest, False)
722 if cert_info == "no_cert":
723 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
724 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
725 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000726 if tls.failTest is False:
727 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000728 assert_equal(tls.failTest, True)
729 if cert_info == "invalid_cert":
730 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
731 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
732 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000733 if tls.failTest is False:
734 self.success = False
735 assert_equal(tls.failTest, True)
736 if cert_info == "same_cert":
737 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
738 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
739 tls.runTest()
740 if tls.failTest is False:
741 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000742 assert_equal(tls.failTest, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000743 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 +0000744 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 +0000745 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
746 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
747 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000748 if tls.failTest is False:
749 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000750 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000751 self.test_status = True
752 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700753
Thangavelu K S8e413082017-07-13 20:02:14 +0000754 def dhcp_flow_check(self, olt_ports, negative_test = None, multiple_sub = False):
755 if multiple_sub is True:
756 olt_nni_port = olt_ports.tx_port
757 onu_iface = olt_ports.rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +0000758 dhcp_server_startip = self.random_ip()
759 random_mac = '00:00:00:0a:0a:' + hex(random.randrange(50,254)).split('x')[1]
Thangavelu K S8e413082017-07-13 20:02:14 +0000760 else:
761 onu_iface = olt_ports
762 dhcp_server_startip = '10.10.10.20'
763 random_mac = None
Thangavelu K S735a6662017-06-15 18:08:23 +0000764 self.success = True
765
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000766 if negative_test is None:
Thangavelu K S36edb012017-07-05 18:24:12 +0000767 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = 'skip', startip = dhcp_server_startip, mac = random_mac)
768 if cip == None or sip == None:
Thangavelu K S735a6662017-06-15 18:08:23 +0000769 self.success = False
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000770 self.test_status = False
771 assert_not_equal(cip,None)
772 assert_not_equal(sip,None)
773 else:
774 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
775 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000776
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000777 if negative_test == "interrupting_dhcp_flows":
778 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
Thangavelu K S735a6662017-06-15 18:08:23 +0000779 if cip is not None:
780 self.success = False
781 assert_equal(cip,None)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000782 log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000783 self.test_status = True
784
785 if negative_test == "invalid_src_mac_broadcast":
786 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
787 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
788 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
789 self.onos_dhcp_table_load(config)
790 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
791 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000792
793 if cip is not None:
794 self.success = False
Thangavelu K S6432b522017-07-22 00:05:54 +0000795 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 +0000796 assert_equal(cip,None)
797 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
798 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000799
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000800 if negative_test == "invalid_src_mac_multicast":
801 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
802 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
803 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
804 self.onos_dhcp_table_load(config)
805 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
806 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000807 if cip is not None:
808 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000809 assert_equal(cip,None)
810 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
811 self.test_status = True
812
813 if negative_test == "invalid_src_mac_junk":
814 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
815 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
816 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
817 self.onos_dhcp_table_load(config)
818 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
819 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000820 if cip is not None:
821 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000822 assert_equal(cip,None)
823 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
824 self.test_status = True
825
826 if negative_test == "request_release":
827 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
828 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
829 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
830 self.onos_dhcp_table_load(config)
831 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
832 cip, sip = self.dhcp_sndrcv(self.dhcp)
833 log_test.info('Releasing ip %s to server %s' %(cip, sip))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000834 if not self.dhcp.release(cip):
835 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000836 assert_equal(self.dhcp.release(cip), True)
837 log_test.info('Triggering DHCP discover again after release')
838 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
839 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000840 if not cip == cip2:
Thangavelu K S735a6662017-06-15 18:08:23 +0000841 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000842 assert_equal(cip, cip2)
843 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
844 assert_equal(self.dhcp.release(cip2), True)
845 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000846
Thangavelu K S735a6662017-06-15 18:08:23 +0000847 if negative_test == "starvation_positive":
848 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
849 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
850 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
851 self.onos_dhcp_table_load(config)
852 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
853 ip_map = {}
854 for i in range(10):
855 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
856 if ip_map.has_key(cip):
857 self.success = False
858 log_test.info('IP %s given out multiple times' %cip)
859 assert_equal(False, ip_map.has_key(cip))
860 ip_map[cip] = sip
861 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000862
Thangavelu K S735a6662017-06-15 18:08:23 +0000863 if negative_test == "starvation_negative":
864 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
865 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
866 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
867 self.onos_dhcp_table_load(config)
868 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
869 log_test.info('Verifying passitive case')
870 for x in xrange(50):
871 mac = RandMAC()._fix()
872 self.dhcp_sndrcv(self.dhcp,mac = mac)
873 log_test.info('Verifying negative case')
874 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000875 if cip or sip is not None:
876 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000877 assert_equal(cip, None)
878 assert_equal(sip, None)
879 self.test_status = True
880 self.success = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000881
Thangavelu K S735a6662017-06-15 18:08:23 +0000882 if negative_test == "multiple_discover":
883 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
884 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
885 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
886 self.onos_dhcp_table_load(config)
887 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
888 cip, sip, mac, _ = self.dhcp.only_discover()
889 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
890 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000891 if cip is None:
892 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000893 assert_not_equal(cip, None)
894 log_test.info('Triggering DHCP discover again.')
895 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000896 if not new_cip == cip:
897 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000898 assert_equal(new_cip, cip)
899 log_test.info('client got same IP as expected when sent 2nd discovery')
900 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000901 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000902 if negative_test == "multiple_requests":
903 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
904 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
905 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
906 self.onos_dhcp_table_load(config)
907 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
908 log_test.info('Sending DHCP discover and DHCP request.')
909 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
910 mac = self.dhcp.get_mac(cip)[0]
911 log_test.info("Sending DHCP request again.")
912 new_cip, new_sip = self.dhcp.only_request(cip, mac)
913 assert_equal(new_cip,cip)
914 log_test.info('server offered same IP to clain for multiple requests, as expected')
915 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000916# self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000917 if negative_test == "desired_ip_address":
918 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
919 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
920 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
921 self.onos_dhcp_table_load(config)
922 self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface)
923 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000924 if cip or sip is None:
925 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000926 assert_not_equal(cip, None)
927 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
928 (cip, sip, mac))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000929 if not self.dhcp.seed_ip == cip:
930 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000931 assert_equal(cip,self.dhcp.seed_ip)
932 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
933 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000934 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000935 if negative_test == "desired_out_of_pool_ip_address":
936 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
937 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
938 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
939 self.onos_dhcp_table_load(config)
940 self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface)
941 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000942 if cip or sip is None:
943 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000944 assert_not_equal(cip, None)
945 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
946 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000947 if self.dhcp.seed_ip == cip:
948 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000949 assert_not_equal(cip,self.dhcp.seed_ip)
950 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
951 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000952 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000953 if negative_test == "dhcp_renew":
954 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
955 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
956 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
957 self.onos_dhcp_table_load(config)
958 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
959 cip, sip, mac, _ = self.dhcp.only_discover()
960 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
961 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000962 if cip or sip is None:
963 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000964 assert_not_equal(cip, None)
965 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
966 log_test.info('waiting renew time %d seconds to send next request packet'%lval)
967 time.sleep(lval)
968 latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000969 if not latest_cip == cip:
970 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000971 assert_equal(latest_cip,cip)
972 log_test.info('client got same IP after renew time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +0000973 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000974 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000975 if negative_test == "dhcp_rebind":
976 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
977 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
978 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
979 self.onos_dhcp_table_load(config)
980 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
981 cip, sip, mac, _ = self.dhcp.only_discover()
982 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
983 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000984 if cip or sip is None:
985 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000986 assert_not_equal(cip, None)
987 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
988 log_test.info('waiting rebind time %d seconds to send next request packet'%lval)
989 time.sleep(lval)
990 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000991 if not latest_cip == cip:
992 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000993 assert_equal(latest_cip,cip)
994 log_test.info('client got same IP after rebind time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +0000995 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000996 # self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000997 return self.test_status
998
Thangavelu K S8e413082017-07-13 20:02:14 +0000999 def recv_channel_cb(self, pkt):
1000 ##First verify that we have received the packet for the joined instance
1001 chan = self.subscriber.caddr(pkt[IP].dst)
1002 assert_equal(chan in self.subscriber.join_map.keys(), True)
1003 recv_time = monotonic.monotonic() * 1000000
1004 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
1005 delta = recv_time - join_time
1006 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
1007 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
1008 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
1009 self.test_status = True
Thangavelu K S36edb012017-07-05 18:24:12 +00001010
Thangavelu K S8e413082017-07-13 20:02:14 +00001011 def traffic_verify(self, subscriber):
1012 # if subscriber.has_service('TRAFFIC'):
1013 url = 'http://www.google.com'
1014 resp = requests.get(url)
1015 self.test_status = resp.ok
1016 if resp.ok == False:
1017 log_test.info('Subscriber %s failed get from url %s with status code %d'
1018 %(subscriber.name, url, resp.status_code))
1019 else:
1020 log_test.info('GET request from %s succeeded for subscriber %s'
1021 %(url, subscriber.name))
1022 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001023
Thangavelu K S8e413082017-07-13 20:02:14 +00001024 def igmp_flow_check(self, subscriber, multiple_sub = False):
1025 chan = 0
1026 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1027 self.num_joins += 1
1028 while self.num_joins < self.num_subscribers:
1029 time.sleep(5)
1030 log_test.info('All subscribers have joined the channel')
1031 for i in range(10):
1032 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1033 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1034 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1035 time.sleep(5)
1036 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1037 #Should not receive packets for this subscriber
1038 self.recv_timeout = True
1039 subscriber.recv_timeout = True
1040 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1041 subscriber.recv_timeout = False
1042 self.recv_timeout = False
1043 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1044 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1045# self.test_status = True
1046 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001047
Thangavelu K S8e413082017-07-13 20:02:14 +00001048 def igmp_flow_check_join_change_to_exclude(self, subscriber, multiple_sub = False):
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001049 chan = 2
1050 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1051 self.num_joins += 1
1052 while self.num_joins < self.num_subscribers:
1053 time.sleep(5)
1054 log_test.info('All subscribers have joined the channel')
1055 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1056 time.sleep(5)
1057 chan = 1
1058 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1059 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1060 time.sleep(5)
1061 self.recv_timeout = True
1062 subscriber.recv_timeout = True
1063 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
1064 if self.test_status is True:
1065 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
1066 if self.test_status is True:
1067 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
1068 self.test_status = False
1069 subscriber.recv_timeout = False
1070 self.recv_timeout = False
1071 chan = 0
1072 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1073# self.test_status = True
1074 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001075
Thangavelu K S8e413082017-07-13 20:02:14 +00001076 def igmp_flow_check_join_change_to_exclude_again_include_back(self, subscriber, multiple_sub = False):
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001077 chan = 2
Thangavelu K S8e413082017-07-13 20:02:14 +00001078 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1079 self.num_joins += 1
1080 while self.num_joins < self.num_subscribers:
1081 time.sleep(5)
1082 log_test.info('All subscribers have joined the channel')
1083 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1084 time.sleep(5)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001085 chan = 1
1086 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port,))
Thangavelu K S8e413082017-07-13 20:02:14 +00001087 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1088 time.sleep(5)
1089 self.recv_timeout = True
1090 subscriber.recv_timeout = True
1091 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
1092 if self.test_status is True:
1093 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
1094 if self.test_status is True:
1095 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
1096 self.test_status = False
1097 subscriber.recv_timeout = False
1098 self.recv_timeout = False
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001099 chan = 1
1100 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1101 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 +00001102 time.sleep(5)
1103 self.recv_timeout = True
1104 subscriber.recv_timeout = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001105 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 +00001106 subscriber.recv_timeout = False
1107 self.recv_timeout = False
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001108 chan = 2
Thangavelu K S8e413082017-07-13 20:02:14 +00001109 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1110# self.test_status = True
1111 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001112
Thangavelu K S8e413082017-07-13 20:02:14 +00001113 def igmp_flow_check_join_change_to_block(self, subscriber, multiple_sub = False):
1114 chan = 0
1115 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1116 self.num_joins += 1
1117 while self.num_joins < self.num_subscribers:
1118 time.sleep(5)
1119 log_test.info('All subscribers have joined the channel')
1120 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1121 time.sleep(5)
1122 log_test.info('Leaving channel %d for subscriber on port %s from specific source ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1123 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_BLOCK_OLD)
1124 time.sleep(5)
1125 self.recv_timeout = True
1126 subscriber.recv_timeout = True
1127 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
1128 if self.test_status is True:
1129 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
1130 if self.test_status is True:
1131 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
1132 self.test_status = False
1133 subscriber.recv_timeout = False
1134 self.recv_timeout = False
1135 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1136 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001137
Thangavelu K S8e413082017-07-13 20:02:14 +00001138 def igmp_flow_check_join_change_to_block_again_allow_back(self, subscriber, multiple_sub = False):
1139 chan = 0
1140 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1141 self.num_joins += 1
1142 while self.num_joins < self.num_subscribers:
1143 time.sleep(5)
1144 log_test.info('All subscribers have joined the channel')
1145 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1146 time.sleep(5)
1147 log_test.info('Leaving channel %d for subscriber on port %s from specific source ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1148 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1149 time.sleep(5)
1150 self.recv_timeout = True
1151 subscriber.recv_timeout = True
1152 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
1153 if self.test_status is True:
1154 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
1155 if self.test_status is True:
1156 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
1157 self.test_status = False
1158 subscriber.recv_timeout = False
1159 self.recv_timeout = False
1160 log_test.info('Again include the source list in the group %s souce ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1161 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_ALLOW_NEW)
1162 time.sleep(5)
1163 self.recv_timeout = True
1164 subscriber.recv_timeout = True
1165 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1166 subscriber.recv_timeout = False
1167 self.recv_timeout = False
1168 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1169 return self.test_status
1170
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001171 def igmp_flow_check_group_include_source_empty_list(self, subscriber, multiple_sub = False):
1172 chan = 0
1173 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1174 self.num_joins += 1
1175 while self.num_joins < self.num_subscribers:
1176 time.sleep(5)
1177 log_test.info('All subscribers have joined the channel')
1178 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1179 if self.test_status is True:
1180 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1181 self.test_status = False
1182 else:
1183 log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port))
1184 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1185 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1186 time.sleep(5)
1187 subscriber.recv_timeout = False
1188 self.recv_timeout = False
1189 return self.test_status
1190
1191 def igmp_flow_check_group_exclude_source_empty_list(self, subscriber, multiple_sub = False):
1192 chan = 0
1193 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list,record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1194 self.num_joins += 1
1195 while self.num_joins < self.num_subscribers:
1196 time.sleep(5)
1197 log_test.info('All subscribers have joined the channel')
1198 for i in range(10):
1199 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1200 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1201 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1202 time.sleep(5)
1203 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1204 #Should not receive packets for this subscriber
1205 self.recv_timeout = True
1206 subscriber.recv_timeout = True
1207 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1208 subscriber.recv_timeout = False
1209 self.recv_timeout = False
1210 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1211 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1212# self.test_status = True
1213 return self.test_status
1214
1215 def igmp_flow_check_during_olt_onu_operational_issues(self, subscriber, multiple_sub = False):
1216 chan = 0
1217 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1218 self.num_joins += 1
1219 while self.num_joins < self.num_subscribers:
1220 time.sleep(5)
1221 log_test.info('All subscribers have joined the channel')
1222 for i in range(2):
1223 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1224 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1225 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1226 time.sleep(5)
1227 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1228 #Should not receive packets for this subscriber
1229 self.recv_timeout = True
1230 subscriber.recv_timeout = True
1231 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1232 subscriber.recv_timeout = False
1233 self.recv_timeout = False
1234 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1235 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1236# self.test_status = True
1237 return self.test_status
1238
Thangavelu K S8e413082017-07-13 20:02:14 +00001239 def voltha_igmp_jump_verify(self, subscriber):
1240 if subscriber.has_service('IGMP'):
1241 for i in xrange(subscriber.num):
1242 log_test.info('Subscriber %s jumping channel' %subscriber.name)
1243 chan = subscriber.channel_jump(delay=0)
1244 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
1245 log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1246 time.sleep(3)
1247 log_test.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats))
1248 self.test_status = True
1249 return self.test_status
1250
1251 def voltha_igmp_next_verify(self, subscriber):
1252 for c in xrange(self.VOLTHA_IGMP_ITERATIONS):
1253 for i in xrange(subscriber.num):
1254 if i:
1255 chan = subscriber.channel_join_next(delay=0, leave_flag = self.leave_flag)
1256 time.sleep(0.2)
1257 else:
1258 chan = subscriber.channel_join(i, delay=0)
1259 time.sleep(0.2)
1260 if subscriber.num == 1:
1261 subscriber.channel_leave(chan)
1262 log_test.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
1263 #subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
1264 #log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1265 self.test_status = True
1266 return self.test_status
1267
1268 def voltha_subscribers(self, services, cbs = None, num_subscribers = 1, num_channels = 1, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +00001269 """Test subscriber join next for channel surfing"""
A R Karthick53442712017-07-27 12:23:30 -07001270 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S36edb012017-07-05 18:24:12 +00001271 if self.VOLTHA_OLT_TYPE.startswith('ponsim'):
1272 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1273 log_test.info('Enabling ponsim olt')
1274 device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001275 if device_id != '':
1276 self.olt_device_id = device_id
Thangavelu K S36edb012017-07-05 18:24:12 +00001277 else:
1278 log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution')
1279 assert_equal(False, True)
1280
1281 assert_not_equal(device_id, None)
1282 if status == False:
1283 voltha.disable_device(device_id, delete = True)
1284 assert_equal(status, True)
1285 time.sleep(10)
1286 switch_map = None
1287 olt_configured = False
1288 try:
1289 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1290 if not switch_map:
1291 log_test.info('No voltha devices found')
1292 return
1293 log_test.info('Installing OLT app')
1294 OnosCtrl.install_app(self.olt_app_file)
1295 time.sleep(5)
1296 log_test.info('Adding subscribers through OLT app')
1297 self.config_olt(switch_map)
1298 olt_configured = True
1299 time.sleep(5)
1300 self.num_subscribers = num_subscribers
1301 self.num_channels = num_channels
1302 test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers,
1303 num_channels = self.num_channels,
1304 cbs = cbs,
1305 port_list = self.generate_port_list(self.num_subscribers,
1306 self.num_channels),
Thangavelu K S8e413082017-07-13 20:02:14 +00001307 src_list = src_list, services = services)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001308 if test_status is False:
1309 self.success = False
Thangavelu K S36edb012017-07-05 18:24:12 +00001310 assert_equal(test_status, True)
1311 finally:
1312 if switch_map is not None:
1313 if olt_configured is True:
1314 self.remove_olt(switch_map)
1315 voltha.disable_device(device_id, delete = True)
1316 time.sleep(10)
1317 log_test.info('Uninstalling OLT app')
1318 OnosCtrl.uninstall_app(self.olt_app_name)
1319
Thangavelu K S8e413082017-07-13 20:02:14 +00001320 def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1,
1321 channel_start = 0, cbs = None, port_list = [], src_list = None,
Thangavelu K S36edb012017-07-05 18:24:12 +00001322 services = None, negative_subscriber_auth = None):
1323 self.test_status = False
1324 self.ovs_cleanup()
1325 subscribers_count = num_subscribers
1326 sub_loop_count = num_subscribers
1327 if not port_list:
1328 port_list = self.generate_port_list(num_subscribers, num_channels)
1329 subscriber_tx_rx_ports = []
1330 for i in range(num_subscribers):
Thangavelu K S8e413082017-07-13 20:02:14 +00001331 #subscriber_tx_rx_ports.append((self.port_map['ports'][port_list[i][0]], self.port_map['ports'][port_list[i][1]]))
1332 subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map['ports'][port_list[i][0]],
1333 rx_port = self.port_map['ports'][port_list[i][1]],
1334 num_channels = num_channels,src_list = src_list,))
Thangavelu K S36edb012017-07-05 18:24:12 +00001335 self.onos_aaa_load()
Thangavelu K S8e413082017-07-13 20:02:14 +00001336 #load the ssm list for all subscriber channels
1337 igmpChannel = IgmpChannel(src_list = src_list)
1338 ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports)
1339 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
Thangavelu K S6432b522017-07-22 00:05:54 +00001340 if src_list is None:
1341 igmpChannel = IgmpChannel()
1342 igmpChannel.igmp_load_ssm_config(ssm_list)
1343 else:
1344 igmpChannel = IgmpChannel(src_list = src_list)
1345 igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001346
Thangavelu K S36edb012017-07-05 18:24:12 +00001347 self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1)
1348
1349 chan_leave = False #for single channel, multiple subscribers
1350 if cbs is None:
1351 cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check)
1352 chan_leave = True
1353 for subscriber in subscriber_tx_rx_ports:
1354 sub_loop_count = sub_loop_count - 1
1355 pool_object = voltha_subscriber_pool(subscriber, cbs)
1356 self.thread_pool.addTask(pool_object.pool_cb)
1357 self.thread_pool.cleanUpThreads()
1358 subscribers_count = 0
1359 return self.test_status
1360
1361
1362 def generate_port_list(self, subscribers, channels):
1363 return self.port_list[:subscribers]
1364
Thangavelu K S36edb012017-07-05 18:24:12 +00001365 @classmethod
1366 def ovs_cleanup(cls):
1367 ##For every test case, delete all the OVS groups
1368 cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1'
1369 try:
1370 cord_test_shell(cmd)
1371 ##Since olt config is used for this test, we just fire a careless local cmd as well
1372 os.system(cmd)
1373 finally:
1374 return
1375
A.R Karthick8a507cf2017-06-02 18:44:49 -07001376 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -07001377 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -07001378 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
1379 assert_not_equal(device_id, None)
1380 try:
1381 assert_equal(status, True)
1382 time.sleep(10)
1383 finally:
1384 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001385
A.R Karthick8a507cf2017-06-02 18:44:49 -07001386 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001387 log_test.info('Enabling ponsim_olt')
1388 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -07001389 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1390 assert_not_equal(device_id, None)
1391 try:
1392 assert_equal(status, True)
1393 time.sleep(10)
1394 finally:
1395 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001396
Thangavelu K S008f38e2017-05-15 19:36:55 +00001397 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
1398 """
1399 Test Method:
1400 0. Make sure that voltha is up and running on CORD-POD setup.
1401 1. OLT and ONU is detected and validated.
1402 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1403 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
1404 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
1405 5. Verify that subscriber is authenticated successfully.
1406 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001407 log_test.info('Enabling ponsim_olt')
1408 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1409 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1410 assert_not_equal(device_id, None)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001411 if status == False:
1412 self.voltha.disable_device(device_id, delete = True)
1413 assert_equal(status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001414 time.sleep(10)
1415 switch_map = None
1416 olt_configured = False
A R Karthick53442712017-07-27 12:23:30 -07001417 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001418 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001419 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1420 if not switch_map:
1421 log_test.info('No voltha devices found')
1422 return
1423 log_test.info('Installing OLT app')
1424 OnosCtrl.install_app(self.olt_app_file)
1425 time.sleep(5)
1426 log_test.info('Adding subscribers through OLT app')
1427 self.config_olt(switch_map)
1428 olt_configured = True
1429 time.sleep(5)
1430 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001431 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001432 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001433 if switch_map is not None:
1434 if olt_configured is True:
1435 self.remove_olt(switch_map)
1436 self.voltha.disable_device(device_id, delete = True)
1437 time.sleep(10)
1438 OnosCtrl.uninstall_app(self.olt_app_name)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001439
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001440 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001441 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
1442 """
1443 Test Method:
1444 0. Make sure that voltha is up and running on CORD-POD setup.
1445 1. OLT and ONU is detected and validated.
1446 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1447 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1448 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
1449 5. Verify that subscriber authentication is unsuccessful..
1450 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001451 df = defer.Deferred()
1452 def tls_flow_check_with_no_cert_scenario(df):
1453 log_test.info('Enabling ponsim_olt')
1454 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1455 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1456 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001457 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001458 time.sleep(10)
1459 switch_map = None
1460 olt_configured = False
1461 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1462 log_test.info('Installing OLT app')
1463 OnosCtrl.install_app(self.olt_app_file)
1464 time.sleep(5)
1465 log_test.info('Adding subscribers through OLT app')
1466 self.config_olt(switch_map)
1467 olt_configured = True
1468 time.sleep(5)
1469 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1470 try:
1471 assert_equal(auth_status, True)
1472 assert_equal(status, True)
1473 time.sleep(10)
1474 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001475 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001476 self.voltha.disable_device(device_id, delete = True)
1477 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001478
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001479 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1480 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001481
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001482 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001483 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
1484 """
1485 Test Method:
1486 0. Make sure that voltha is up and running on CORD-POD setup.
1487 1. OLT and ONU is detected and validated.
1488 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1489 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
1490 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1491 5. Verify that subscriber authentication is unsuccessful..
1492 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001493 df = defer.Deferred()
1494 def tls_flow_check_with_invalid_cert_scenario(df):
1495 log_test.info('Enabling ponsim_olt')
1496 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1497 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1498 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001499 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001500 time.sleep(10)
1501 switch_map = None
1502 olt_configured = False
1503 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1504 log_test.info('Installing OLT app')
1505 OnosCtrl.install_app(self.olt_app_file)
1506 time.sleep(5)
1507 log_test.info('Adding subscribers through OLT app')
1508 self.config_olt(switch_map)
1509 olt_configured = True
1510 time.sleep(5)
1511 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1512 try:
1513 assert_equal(auth_status, True)
1514 assert_equal(status, True)
1515 time.sleep(10)
1516 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001517 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001518 self.voltha.disable_device(device_id, delete = True)
1519 df.callback(0)
1520 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
1521 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001522
Thangavelu K S0d745c82017-06-09 21:56:08 +00001523 @deferred(TESTCASE_TIMEOUT)
1524 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
1525 """
1526 Test Method:
1527 0. Make sure that voltha is up and running on CORD-POD setup.
1528 1. OLT and ONU is detected and validated.
1529 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1530 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
1531 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1532 5. Verify that subscriber authentication is unsuccessful..
1533 """
1534 df = defer.Deferred()
1535 def tls_flow_check_with_no_cert_scenario(df):
1536 log_test.info('Enabling ponsim_olt')
1537 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1538 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1539 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001540 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001541 time.sleep(10)
1542 switch_map = None
1543 olt_configured = False
1544 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1545 log_test.info('Installing OLT app')
1546 OnosCtrl.install_app(self.olt_app_file)
1547 time.sleep(5)
1548 log_test.info('Adding subscribers through OLT app')
1549 self.config_olt(switch_map)
1550 olt_configured = True
1551 time.sleep(5)
1552 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1553 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1554 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1555 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1556 try:
1557 assert_equal(auth_status, True)
1558 assert_equal(status, True)
1559 time.sleep(10)
1560 finally:
1561 self.voltha.disable_device(device_id, delete = True)
1562 df.callback(0)
1563 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1564 return df
1565
1566 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001567 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
1568 """
1569 Test Method:
1570 0. Make sure that voltha is up and running on CORD-POD setup.
1571 1. OLT and ONU is detected and validated.
1572 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1573 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1574 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
1575 5. Verify that subscriber authentication is unsuccessful..
1576 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001577 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001578 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001579 aaa_app = ["org.opencord.aaa"]
1580 log_test.info('Enabling ponsim_olt')
1581 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1582 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1583 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001584 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001585 time.sleep(10)
1586 switch_map = None
1587 olt_configured = False
1588 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1589 log_test.info('Installing OLT app')
1590 OnosCtrl.install_app(self.olt_app_file)
1591 time.sleep(5)
1592 log_test.info('Adding subscribers through OLT app')
1593 self.config_olt(switch_map)
1594 olt_configured = True
1595 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001596
Thangavelu K S0d745c82017-06-09 21:56:08 +00001597 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
1598 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
1599 thread1.start()
1600 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001601 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001602 thread2.start()
1603 time.sleep(10)
1604 thread1.join()
1605 thread2.join()
1606 try:
1607 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001608 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001609 time.sleep(10)
1610 finally:
1611 self.voltha.disable_device(device_id, delete = True)
1612 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001613 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001614 return df
1615
1616 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001617 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
1618 """
1619 Test Method:
1620 0. Make sure that voltha is up and running on CORD-POD setup.
1621 1. OLT and ONU is detected and validated.
1622 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1623 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1624 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
1625 5. Verify that subscriber authentication is unsuccessful..
1626 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001627 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001628 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001629 aaa_app = ["org.opencord.aaa"]
1630 log_test.info('Enabling ponsim_olt')
1631 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1632 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1633 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001634 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001635 time.sleep(10)
1636 switch_map = None
1637 olt_configured = False
1638 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1639 log_test.info('Installing OLT app')
1640 OnosCtrl.install_app(self.olt_app_file)
1641 time.sleep(5)
1642 log_test.info('Adding subscribers through OLT app')
1643 self.config_olt(switch_map)
1644 olt_configured = True
1645 time.sleep(5)
1646
1647 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
1648 thread2 = threading.Thread(target = cord_test_radius_restart)
1649 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001650 time.sleep(randint(1,2))
1651 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001652 thread2.start()
1653 time.sleep(10)
1654 thread1.join()
1655 thread2.join()
1656 try:
1657 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001658 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001659 time.sleep(10)
1660 finally:
1661 self.voltha.disable_device(device_id, delete = True)
1662 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001663 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001664 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001665
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001666 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001667 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
1668 """
1669 Test Method:
1670 0. Make sure that voltha is up and running on CORD-POD setup.
1671 1. OLT and ONU is detected and validated.
1672 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1673 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1674 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1675 6. Verify that subscriber authenticated successfully.
1676 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
1677 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1678 9. Verify that subscriber authentication is unsuccessful..
1679 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001680 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001681 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001682 aaa_app = ["org.opencord.aaa"]
1683 log_test.info('Enabling ponsim_olt')
1684 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1685 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1686 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001687 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001688 time.sleep(10)
1689 switch_map = None
1690 olt_configured = False
1691 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1692 log_test.info('Installing OLT app')
1693 OnosCtrl.install_app(self.olt_app_file)
1694 time.sleep(5)
1695 log_test.info('Adding subscribers through OLT app')
1696 self.config_olt(switch_map)
1697 olt_configured = True
1698 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001699
Thangavelu K S0d745c82017-06-09 21:56:08 +00001700 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001701 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +00001702 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001703 time.sleep(randint(1,2))
1704 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001705 thread2.start()
1706 time.sleep(10)
1707 thread1.join()
1708 thread2.join()
1709 try:
1710 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001711 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001712 time.sleep(10)
1713 finally:
1714 self.voltha.disable_device(device_id, delete = True)
1715 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001716 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001717 return df
1718
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001719 @deferred(TESTCASE_TIMEOUT)
1720 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001721 """
1722 Test Method:
1723 0. Make sure that voltha is up and running on CORD-POD setup.
1724 1. OLT and ONU is detected and validated.
1725 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1726 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1727 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1728 6. Verify that subscriber authenticated successfully.
1729 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1730 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1731 9. Verify that subscriber authentication is unsuccessful..
1732 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001733 df = defer.Deferred()
1734 def tls_flow_check_operating_olt_state(df):
1735 aaa_app = ["org.opencord.aaa"]
1736 log_test.info('Enabling ponsim_olt')
1737 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1738 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1739 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001740 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001741 time.sleep(10)
1742 switch_map = None
1743 olt_configured = False
1744 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1745 log_test.info('Installing OLT app')
1746 OnosCtrl.install_app(self.olt_app_file)
1747 time.sleep(5)
1748 log_test.info('Adding subscribers through OLT app')
1749 self.config_olt(switch_map)
1750 olt_configured = True
1751 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001752
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001753 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1754 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
1755 thread1.start()
1756 time.sleep(randint(1,2))
1757 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1758 thread2.start()
1759 time.sleep(10)
1760 thread1.join()
1761 thread2.join()
1762 try:
1763 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001764 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001765 time.sleep(10)
1766 finally:
1767 self.voltha.disable_device(device_id, delete = True)
1768 df.callback(0)
1769 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1770 return df
1771
1772 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001773 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self):
1774 """
1775 Test Method:
1776 0. Make sure that voltha is up and running on CORD-POD setup.
1777 1. OLT and ONU is detected and validated.
1778 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1779 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1780 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1781 6. Verify that subscriber authenticated successfully.
1782 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1783 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1784 9. Verify that subscriber authentication is unsuccessful..
1785 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1786
1787 """
1788 df = defer.Deferred()
1789 no_iterations = 10
1790 def tls_flow_check_with_disable_olt_device_scenario(df):
1791 aaa_app = ["org.opencord.aaa"]
1792 log_test.info('Enabling ponsim_olt')
1793 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1794 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1795 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001796 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001797 time.sleep(10)
1798 switch_map = None
1799 olt_configured = False
1800 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1801 log_test.info('Installing OLT app')
1802 OnosCtrl.install_app(self.olt_app_file)
1803 time.sleep(5)
1804 log_test.info('Adding subscribers through OLT app')
1805 self.config_olt(switch_map)
1806 olt_configured = True
1807 time.sleep(5)
1808 for i in range(no_iterations):
1809 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1810 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
1811 thread1.start()
1812 time.sleep(randint(1,2))
1813 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1814 thread2.start()
1815 time.sleep(10)
1816 thread1.join()
1817 thread2.join()
1818 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
1819 try:
1820 # assert_equal(status, True)
1821 assert_equal(auth_status, True)
1822 assert_equal(self.success, True)
1823 time.sleep(10)
1824 finally:
1825 self.voltha.disable_device(device_id, delete = True)
1826 df.callback(0)
1827 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
1828 return df
1829
1830 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001831 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
1832 """
1833 Test Method:
1834 0. Make sure that voltha is up and running on CORD-POD setup.
1835 1. OLT and ONU is detected and validated.
1836 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1837 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1838 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1839 6. Verify that subscriber authenticated successfully.
1840 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
1841 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1842 9. Verify that subscriber authentication is unsuccessful..
1843 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001844 df = defer.Deferred()
1845 def tls_flow_check_operating_olt_state(df):
1846 aaa_app = ["org.opencord.aaa"]
1847 log_test.info('Enabling ponsim_olt')
1848 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1849 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1850 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001851 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001852 time.sleep(10)
1853 switch_map = None
1854 olt_configured = False
1855 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1856 log_test.info('Installing OLT app')
1857 OnosCtrl.install_app(self.olt_app_file)
1858 time.sleep(5)
1859 log_test.info('Adding subscribers through OLT app')
1860 self.config_olt(switch_map)
1861 olt_configured = True
1862 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001863
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001864 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
1865 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
1866 thread1.start()
1867 time.sleep(randint(1,2))
1868 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
1869 thread2.start()
1870 time.sleep(10)
1871 thread1.join()
1872 thread2.join()
1873 try:
1874 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001875 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001876 time.sleep(10)
1877 finally:
1878 self.voltha.disable_device(device_id, delete = True)
1879 df.callback(0)
1880 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1881 return df
1882
1883 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00001884 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self):
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001885 """
1886 Test Method:
1887 0. Make sure that voltha is up and running on CORD-POD setup.
1888 1. OLT and ONU is detected and validated.
1889 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1890 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1891 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1892 6. Verify that subscriber authenticated successfully.
1893 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
1894 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1895 9. Verify that subscriber authentication is unsuccessful..
1896 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1897 """
1898 df = defer.Deferred()
1899 no_iterations = 10
1900 def tls_flow_check_with_disable_olt_device_scenario(df):
1901 aaa_app = ["org.opencord.aaa"]
1902 log_test.info('Enabling ponsim_olt')
1903 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1904 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1905 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001906 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001907 time.sleep(10)
1908 switch_map = None
1909 olt_configured = False
1910 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1911 log_test.info('Installing OLT app')
1912 OnosCtrl.install_app(self.olt_app_file)
1913 time.sleep(5)
1914 log_test.info('Adding subscribers through OLT app')
1915 self.config_olt(switch_map)
1916 olt_configured = True
1917 time.sleep(5)
1918 for i in range(no_iterations):
1919 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
1920 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
1921 thread1.start()
1922 time.sleep(randint(1,2))
1923 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
1924 thread2.start()
1925 time.sleep(10)
1926 thread1.join()
1927 thread2.join()
1928 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
1929 try:
1930 # assert_equal(status, True)
1931 assert_equal(auth_status, True)
1932 assert_equal(self.success, True)
1933 time.sleep(10)
1934 finally:
1935 self.voltha.disable_device(device_id, delete = True)
1936 df.callback(0)
1937 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
1938 return df
1939
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001940 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001941 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
1942 """
1943 Test Method:
1944 0. Make sure that voltha is up and running on CORD-POD setup.
1945 1. OLT and ONU is detected and validated.
1946 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1947 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1948 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1949 6. Verify that subscriber authenticated successfully.
1950 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
1951 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1952 9. Verify that subscriber authentication is unsuccessful..
1953 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001954 df = defer.Deferred()
1955 def tls_flow_check_operating_olt_state(df):
1956 aaa_app = ["org.opencord.aaa"]
1957 log_test.info('Enabling ponsim_olt')
1958 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1959 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1960 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00001961 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1962
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001963 onu_device_id = devices_list['items'][1]['id']
1964 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001965 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001966 time.sleep(10)
1967 switch_map = None
1968 olt_configured = False
1969 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1970 log_test.info('Installing OLT app')
1971 OnosCtrl.install_app(self.olt_app_file)
1972 time.sleep(5)
1973 log_test.info('Adding subscribers through OLT app')
1974 self.config_olt(switch_map)
1975 olt_configured = True
1976 time.sleep(5)
1977 devices_list = self.voltha.get_devices()
1978 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
1979 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
1980 thread1.start()
1981 time.sleep(randint(1,2))
1982 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
1983 thread2.start()
1984 time.sleep(10)
1985 thread1.join()
1986 thread2.join()
1987 try:
1988 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001989 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001990 time.sleep(10)
1991 finally:
1992 self.voltha.disable_device(device_id, delete = True)
1993 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001994 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001995 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001996
Thangavelu K S9648eed2017-06-13 20:15:25 +00001997 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001998 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
1999 """
2000 Test Method:
2001 0. Make sure that voltha is up and running on CORD-POD setup.
2002 1. OLT and ONU is detected and validated.
2003 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2004 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2005 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2006 6. Verify that subscriber authenticated successfully.
2007 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2008 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2009 9. Verify that subscriber authentication is unsuccessful..
2010 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2011 """
2012 df = defer.Deferred()
2013 no_iterations = 10
2014 def tls_flow_check_operating_olt_state(df):
2015 aaa_app = ["org.opencord.aaa"]
2016 log_test.info('Enabling ponsim_olt')
2017 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2018 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2019 devices_list = self.voltha.get_devices()
2020 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2021
2022 onu_device_id = devices_list['items'][1]['id']
2023 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002024 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002025 time.sleep(10)
2026 switch_map = None
2027 olt_configured = False
2028 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2029 log_test.info('Installing OLT app')
2030 OnosCtrl.install_app(self.olt_app_file)
2031 time.sleep(5)
2032 log_test.info('Adding subscribers through OLT app')
2033 self.config_olt(switch_map)
2034 olt_configured = True
2035 time.sleep(5)
2036 devices_list = self.voltha.get_devices()
2037 for i in range(no_iterations):
2038 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2039 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2040 thread1.start()
2041 time.sleep(randint(1,2))
2042 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2043 thread2.start()
2044 time.sleep(10)
2045 thread1.join()
2046 thread2.join()
2047 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2048 try:
2049 # assert_equal(status, True)
2050 assert_equal(auth_status, True)
2051 assert_equal(self.success, True)
2052 time.sleep(10)
2053 finally:
2054 self.voltha.disable_device(device_id, delete = True)
2055 df.callback(0)
2056 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2057 return df
2058
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002059 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002060 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002061 """
2062 Test Method:
2063 0. Make sure that voltha is up and running on CORD-POD setup.
2064 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2065 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2066 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2067 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
2068 5. Verify that two subscribers are authenticated successfully.
2069 """
2070
Thangavelu K S9648eed2017-06-13 20:15:25 +00002071 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002072 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002073 aaa_app = ["org.opencord.aaa"]
2074 log_test.info('Enabling ponsim_olt')
2075 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2076 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2077 devices_list = self.voltha.get_devices()
2078 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2079
2080 onu_device_id = devices_list['items'][1]['id']
2081 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002082 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002083 time.sleep(10)
2084 switch_map = None
2085 olt_configured = False
2086 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2087 log_test.info('Installing OLT app')
2088 OnosCtrl.install_app(self.olt_app_file)
2089 time.sleep(5)
2090 log_test.info('Adding subscribers through OLT app')
2091 self.config_olt(switch_map)
2092 olt_configured = True
2093 time.sleep(5)
2094 devices_list = self.voltha.get_devices()
2095 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2096 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2097 thread1.start()
2098 time.sleep(randint(1,2))
2099 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2100 thread2.start()
2101 time.sleep(10)
2102 thread1.join()
2103 thread2.join()
2104 try:
2105 # assert_equal(status, True)
2106 assert_equal(self.success, True)
2107 time.sleep(10)
2108 finally:
2109 self.voltha.disable_device(device_id, delete = True)
2110 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002111 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002112 return df
2113
2114 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002115 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002116 """
2117 Test Method:
2118 0. Make sure that voltha is up and running on CORD-POD setup.
2119 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2120 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2121 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2122 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
2123 5. Verify that two subscribers are not authenticated.
2124 """
2125
Thangavelu K S9648eed2017-06-13 20:15:25 +00002126 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002127 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002128 aaa_app = ["org.opencord.aaa"]
2129 log_test.info('Enabling ponsim_olt')
2130 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2131 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2132 devices_list = self.voltha.get_devices()
2133 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2134
2135 onu_device_id = devices_list['items'][1]['id']
2136 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002137 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002138 time.sleep(10)
2139 switch_map = None
2140 olt_configured = False
2141 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2142 log_test.info('Installing OLT app')
2143 OnosCtrl.install_app(self.olt_app_file)
2144 time.sleep(5)
2145 log_test.info('Adding subscribers through OLT app')
2146 self.config_olt(switch_map)
2147 olt_configured = True
2148 time.sleep(5)
2149 devices_list = self.voltha.get_devices()
2150 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2151 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
2152 thread1.start()
2153 time.sleep(randint(1,2))
2154 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2155 thread2.start()
2156 time.sleep(10)
2157 thread1.join()
2158 thread2.join()
2159 try:
2160 # assert_equal(status, True)
2161 assert_equal(self.success, True)
2162 time.sleep(10)
2163 finally:
2164 self.voltha.disable_device(device_id, delete = True)
2165 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002166 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002167 return df
2168
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002169 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002170 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 +00002171 """
2172 Test Method:
2173 0. Make sure that voltha is up and running on CORD-POD setup.
2174 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2175 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2176 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2177 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2178 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
2179 6. Verify that valid subscriber authenticated successfully.
2180 7. Verify that invalid subscriber are not authenticated successfully.
2181 """
2182
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002183 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002184 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002185 aaa_app = ["org.opencord.aaa"]
2186 log_test.info('Enabling ponsim_olt')
2187 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2188 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2189 devices_list = self.voltha.get_devices()
2190 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2191
2192 onu_device_id = devices_list['items'][1]['id']
2193 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002194 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002195 time.sleep(10)
2196 switch_map = None
2197 olt_configured = False
2198 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2199 log_test.info('Installing OLT app')
2200 OnosCtrl.install_app(self.olt_app_file)
2201 time.sleep(5)
2202 log_test.info('Adding subscribers through OLT app')
2203 self.config_olt(switch_map)
2204 olt_configured = True
2205 time.sleep(5)
2206 devices_list = self.voltha.get_devices()
2207 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2208 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
2209 thread1.start()
2210 time.sleep(randint(1,2))
2211 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2212 thread2.start()
2213 time.sleep(10)
2214 thread1.join()
2215 thread2.join()
2216 try:
2217 # assert_equal(status, True)
2218 assert_equal(self.success, True)
2219 time.sleep(10)
2220 finally:
2221 self.voltha.disable_device(device_id, delete = True)
2222 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002223 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002224 return df
2225
2226 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002227 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 +00002228 """
2229 Test Method:
2230 0. Make sure that voltha is up and running on CORD-POD setup.
2231 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2232 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2233 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2234 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2235 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
2236 6. Verify that valid subscriber authenticated successfully.
2237 7. Verify that invalid subscriber are not authenticated successfully.
2238 """
2239
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002240 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002241 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002242 aaa_app = ["org.opencord.aaa"]
2243 log_test.info('Enabling ponsim_olt')
2244 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2245 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2246 devices_list = self.voltha.get_devices()
2247 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2248
2249 onu_device_id = devices_list['items'][1]['id']
2250 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002251 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002252 time.sleep(10)
2253 switch_map = None
2254 olt_configured = False
2255 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2256 log_test.info('Installing OLT app')
2257 OnosCtrl.install_app(self.olt_app_file)
2258 time.sleep(5)
2259 log_test.info('Adding subscribers through OLT app')
2260 self.config_olt(switch_map)
2261 olt_configured = True
2262 time.sleep(5)
2263 devices_list = self.voltha.get_devices()
2264 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2265 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
2266 thread1.start()
2267 time.sleep(randint(1,2))
2268 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2269 thread2.start()
2270 time.sleep(10)
2271 thread1.join()
2272 thread2.join()
2273 try:
2274 # assert_equal(status, True)
2275 assert_equal(self.success, True)
2276 time.sleep(10)
2277 finally:
2278 self.voltha.disable_device(device_id, delete = True)
2279 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002280 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002281 return df
2282
2283 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002284 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002285 """
2286 Test Method:
2287 0. Make sure that voltha is up and running on CORD-POD setup.
2288 1. OLT and ONU is detected and validated.
2289 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2290 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2291 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
2292 6. Verify that subscriber authenticated successfully.
2293 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
2294 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
2295 9. Verify that subscriber authentication is unsuccessful..
2296 10. Verify that other subscriber authenticated successfully.
2297 """
2298
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002299 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002300 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002301 aaa_app = ["org.opencord.aaa"]
2302 log_test.info('Enabling ponsim_olt')
2303 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2304 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2305 devices_list = self.voltha.get_devices()
2306 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2307
2308 onu_device_id = devices_list['items'][1]['id']
2309 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002310 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002311 time.sleep(10)
2312 switch_map = None
2313 olt_configured = False
2314 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2315 log_test.info('Installing OLT app')
2316 OnosCtrl.install_app(self.olt_app_file)
2317 time.sleep(5)
2318 log_test.info('Adding subscribers through OLT app')
2319 self.config_olt(switch_map)
2320 olt_configured = True
2321 time.sleep(5)
2322 devices_list = self.voltha.get_devices()
2323 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2324 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
2325 thread1.start()
2326 time.sleep(randint(1,2))
2327 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2328 thread2.start()
2329 time.sleep(10)
2330 thread1.join()
2331 thread2.join()
2332 try:
2333 # assert_equal(status, True)
2334 assert_equal(self.success, True)
2335 time.sleep(10)
2336 finally:
2337 self.voltha.disable_device(device_id, delete = True)
2338 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002339 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002340 return df
2341
Thangavelu K S36edb012017-07-05 18:24:12 +00002342 def test_3_subscribers_with_voltha_for_eap_tls_authentication(self):
2343 """
2344 Test Method:
2345 0. Make sure that voltha is up and running on CORD-POD setup.
2346 1. OLT and ONU is detected and validated.
2347 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2348 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers)
2349 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2350 5. Verify that subscriber is authenticated successfully.
2351 """
2352 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2353 num_subscribers = 3
2354 num_channels = 1
2355 services = ('TLS')
2356 cbs = (self.tls_flow_check, None, None)
2357 self.voltha_subscribers(services, cbs = cbs,
2358 num_subscribers = num_subscribers,
2359 num_channels = num_channels)
2360
2361 def test_5_subscribers_with_voltha_for_eap_tls_authentication(self):
2362 """
2363 Test Method:
2364 0. Make sure that voltha is up and running on CORD-POD setup.
2365 1. OLT and ONU is detected and validated.
2366 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2367 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber)
2368 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2369 5. Verify that subscriber is authenticated successfully.
2370 """
2371 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2372 num_subscribers = 5
2373 num_channels = 1
2374 services = ('TLS')
2375 cbs = (self.tls_flow_check, None, None)
2376 self.voltha_subscribers(services, cbs = cbs,
2377 num_subscribers = num_subscribers,
2378 num_channels = num_channels)
2379
2380 def test_9_subscribers_with_voltha_for_eap_tls_authentication(self):
2381 """
2382 Test Method:
2383 0. Make sure that voltha is up and running on CORD-POD setup.
2384 1. OLT and ONU is detected and validated.
2385 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2386 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber)
2387 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2388 5. Verify that subscriber is authenticated successfully.
2389 """
2390 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2391 num_subscribers = 9
2392 num_channels = 1
2393 services = ('TLS')
2394 cbs = (self.tls_flow_check, None, None)
2395 self.voltha_subscribers(services, cbs = cbs,
2396 num_subscribers = num_subscribers,
2397 num_channels = num_channels)
2398
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002399 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002400 def test_subscriber_with_voltha_for_dhcp_request(self):
2401 """
2402 Test Method:
2403 0. Make sure that voltha is up and running on CORD-POD setup.
2404 1. OLT and ONU is detected and validated.
2405 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2406 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2407 4. Verify that subscriber get ip from dhcp server successfully.
2408 """
2409
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002410 df = defer.Deferred()
2411 def dhcp_flow_check_scenario(df):
2412 log_test.info('Enabling ponsim_olt')
2413 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2414 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2415 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002416 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002417 time.sleep(10)
2418 switch_map = None
2419 olt_configured = False
2420 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2421 log_test.info('Installing OLT app')
2422 OnosCtrl.install_app(self.olt_app_file)
2423 time.sleep(5)
2424 log_test.info('Adding subscribers through OLT app')
2425 self.config_olt(switch_map)
2426 olt_configured = True
2427 time.sleep(5)
2428 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2429 try:
2430 assert_equal(dhcp_status, True)
2431 #assert_equal(status, True)
2432 time.sleep(10)
2433 finally:
2434 self.remove_olt(switch_map)
2435 self.voltha.disable_device(device_id, delete = True)
2436 df.callback(0)
2437
2438 reactor.callLater(0, dhcp_flow_check_scenario, df)
2439 return df
2440
2441 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002442 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
2443 """
2444 Test Method:
2445 0. Make sure that voltha is up and running on CORD-POD setup.
2446 1. OLT and ONU is detected and validated.
2447 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2448 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
2449 4. Verify that subscriber should not get ip from dhcp server.
2450 """
2451
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002452 df = defer.Deferred()
2453 def dhcp_flow_check_scenario(df):
2454 log_test.info('Enabling ponsim_olt')
2455 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2456 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2457 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002458 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002459 time.sleep(10)
2460 switch_map = None
2461 olt_configured = False
2462 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2463 log_test.info('Installing OLT app')
2464 OnosCtrl.install_app(self.olt_app_file)
2465 time.sleep(5)
2466 log_test.info('Adding subscribers through OLT app')
2467 self.config_olt(switch_map)
2468 olt_configured = True
2469 time.sleep(5)
2470 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
2471 try:
2472 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002473 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002474 #assert_equal(status, True)
2475 time.sleep(10)
2476 finally:
2477 self.voltha.disable_device(device_id, delete = True)
2478 self.remove_olt(switch_map)
2479 df.callback(0)
2480
2481 reactor.callLater(0, dhcp_flow_check_scenario, df)
2482 return df
2483
2484
2485 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002486 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
2487 """
2488 Test Method:
2489 0. Make sure that voltha is up and running on CORD-POD setup.
2490 1. OLT and ONU is detected and validated.
2491 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2492 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
2493 4. Verify that subscriber should not get ip from dhcp server.
2494 """
2495
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002496 df = defer.Deferred()
2497 def dhcp_flow_check_scenario(df):
2498 log_test.info('Enabling ponsim_olt')
2499 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2500 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2501 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002502 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002503 time.sleep(10)
2504 switch_map = None
2505 olt_configured = False
2506 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2507 log_test.info('Installing OLT app')
2508 OnosCtrl.install_app(self.olt_app_file)
2509 time.sleep(5)
2510 log_test.info('Adding subscribers through OLT app')
2511 self.config_olt(switch_map)
2512 olt_configured = True
2513 time.sleep(5)
2514 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
2515 try:
2516 assert_equal(dhcp_status, True)
2517 #assert_equal(status, True)
2518 time.sleep(10)
2519 finally:
2520 self.voltha.disable_device(device_id, delete = True)
2521 self.remove_olt(switch_map)
2522 df.callback(0)
2523
2524 reactor.callLater(0, dhcp_flow_check_scenario, df)
2525 return df
2526
2527 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002528 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
2529 """
2530 Test Method:
2531 0. Make sure that voltha is up and running on CORD-POD setup.
2532 1. OLT and ONU is detected and validated.
2533 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2534 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
2535 4. Verify that subscriber should not get ip from dhcp server.
2536 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002537 df = defer.Deferred()
2538 def dhcp_flow_check_scenario(df):
2539 log_test.info('Enabling ponsim_olt')
2540 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2541 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2542 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002543 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002544 time.sleep(10)
2545 switch_map = None
2546 olt_configured = False
2547 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2548 log_test.info('Installing OLT app')
2549 OnosCtrl.install_app(self.olt_app_file)
2550 time.sleep(5)
2551 log_test.info('Adding subscribers through OLT app')
2552 self.config_olt(switch_map)
2553 olt_configured = True
2554 time.sleep(5)
2555 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
2556 try:
2557 assert_equal(dhcp_status, True)
2558 #assert_equal(status, True)
2559 time.sleep(10)
2560 finally:
2561 self.voltha.disable_device(device_id, delete = True)
2562 self.remove_olt(switch_map)
2563 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002564
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002565 reactor.callLater(0, dhcp_flow_check_scenario, df)
2566 return df
2567
2568 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002569 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
2570 """
2571 Test Method:
2572 0. Make sure that voltha is up and running on CORD-POD setup.
2573 1. OLT and ONU is detected and validated.
2574 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2575 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2576 4. Verify that subscriber get ip from dhcp server successfully.
2577 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
2578 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
2579 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002580 df = defer.Deferred()
2581 def dhcp_flow_check_scenario(df):
2582 log_test.info('Enabling ponsim_olt')
2583 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2584 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2585 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002586 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002587 time.sleep(10)
2588 switch_map = None
2589 olt_configured = False
2590 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2591 log_test.info('Installing OLT app')
2592 OnosCtrl.install_app(self.olt_app_file)
2593 time.sleep(5)
2594 log_test.info('Adding subscribers through OLT app')
2595 self.config_olt(switch_map)
2596 olt_configured = True
2597 time.sleep(5)
2598 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
2599 try:
2600 assert_equal(dhcp_status, True)
2601 #assert_equal(status, True)
2602 time.sleep(10)
2603 finally:
2604 self.voltha.disable_device(device_id, delete = True)
2605 self.remove_olt(switch_map)
2606 df.callback(0)
2607
2608 reactor.callLater(0, dhcp_flow_check_scenario, df)
2609 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002610
Thangavelu K S735a6662017-06-15 18:08:23 +00002611
2612 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07002613 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002614 """
2615 Test Method:
2616 0. Make sure that voltha is up and running on CORD-POD setup.
2617 1. OLT and ONU is detected and validated.
2618 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2619 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2620 4. Verify that subscriber get ip from dhcp server successfully.
2621 5. Repeat step 3 and 4 for 10 times.
2622 6 Verify that subscriber should get ip from dhcp server.
2623 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002624 df = defer.Deferred()
2625 def dhcp_flow_check_scenario(df):
2626 log_test.info('Enabling ponsim_olt')
2627 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2628 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2629 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002630 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002631 time.sleep(10)
2632 switch_map = None
2633 olt_configured = False
2634 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2635 log_test.info('Installing OLT app')
2636 OnosCtrl.install_app(self.olt_app_file)
2637 time.sleep(5)
2638 log_test.info('Adding subscribers through OLT app')
2639 self.config_olt(switch_map)
2640 olt_configured = True
2641 time.sleep(5)
2642 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
2643 try:
2644 assert_equal(dhcp_status, True)
2645 #assert_equal(status, True)
2646 time.sleep(10)
2647 finally:
2648 self.voltha.disable_device(device_id, delete = True)
2649 self.remove_olt(switch_map)
2650 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002651
Thangavelu K S735a6662017-06-15 18:08:23 +00002652 reactor.callLater(0, dhcp_flow_check_scenario, df)
2653 return df
2654
Thangavelu K S735a6662017-06-15 18:08:23 +00002655 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002656 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
2657 """
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 without of pool ip to dhcp server which is running as onos app.
2663 4. Verify that subscriber should not get ip from dhcp server.
2664 5. Repeat steps 3 and 4 for 10 times.
2665 6 Verify that subscriber should not 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)
A R Karthick53442712017-07-27 12:23:30 -07002673 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002674 time.sleep(10)
2675 switch_map = None
2676 olt_configured = False
2677 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2678 log_test.info('Installing OLT app')
2679 OnosCtrl.install_app(self.olt_app_file)
2680 time.sleep(5)
2681 log_test.info('Adding subscribers through OLT app')
2682 self.config_olt(switch_map)
2683 olt_configured = True
2684 time.sleep(5)
2685 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
2686 try:
2687 assert_equal(dhcp_status, True)
2688 #assert_equal(status, True)
2689 time.sleep(10)
2690 finally:
2691 self.voltha.disable_device(device_id, delete = True)
2692 self.remove_olt(switch_map)
2693 df.callback(0)
2694
2695 reactor.callLater(0, dhcp_flow_check_scenario, df)
2696 return df
2697
Thangavelu K S735a6662017-06-15 18:08:23 +00002698 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002699 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
2700 """
2701 Test Method:
2702 0. Make sure that voltha is up and running on CORD-POD setup.
2703 1. OLT and ONU is detected and validated.
2704 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2705 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2706 4. Verify that subscriber get ip from dhcp server successfully.
2707 5. Repeat step 3 for 50 times.
2708 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2709 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002710 df = defer.Deferred()
2711 def dhcp_flow_check_scenario(df):
2712 log_test.info('Enabling ponsim_olt')
2713 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2714 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2715 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002716 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002717 time.sleep(10)
2718 switch_map = None
2719 olt_configured = False
2720 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2721 log_test.info('Installing OLT app')
2722 OnosCtrl.install_app(self.olt_app_file)
2723 time.sleep(5)
2724 log_test.info('Adding subscribers through OLT app')
2725 self.config_olt(switch_map)
2726 olt_configured = True
2727 time.sleep(5)
2728 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
2729 try:
2730 assert_equal(dhcp_status, True)
2731 #assert_equal(status, True)
2732 time.sleep(10)
2733 finally:
2734 self.voltha.disable_device(device_id, delete = True)
2735 self.remove_olt(switch_map)
2736 df.callback(0)
2737
2738 reactor.callLater(0, dhcp_flow_check_scenario, df)
2739 return df
2740
Thangavelu K S735a6662017-06-15 18:08:23 +00002741 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002742 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
2743 """
2744 Test Method:
2745 0. Make sure that voltha is up and running on CORD-POD setup.
2746 1. OLT and ONU is detected and validated.
2747 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2748 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2749 4. Verify that subscriber get ip from dhcp server successfully.
2750 5. Send DHCP request to dhcp server which is running as onos app.
2751 6. Repeat step 5 for 50 times.
2752 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2753 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002754 df = defer.Deferred()
2755 def dhcp_flow_check_scenario(df):
2756 log_test.info('Enabling ponsim_olt')
2757 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2758 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2759 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002760 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002761 time.sleep(10)
2762 switch_map = None
2763 olt_configured = False
2764 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2765 log_test.info('Installing OLT app')
2766 OnosCtrl.install_app(self.olt_app_file)
2767 time.sleep(5)
2768 log_test.info('Adding subscribers through OLT app')
2769 self.config_olt(switch_map)
2770 olt_configured = True
2771 time.sleep(5)
2772 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
2773 try:
2774 assert_equal(dhcp_status, True)
2775 #assert_equal(status, True)
2776 time.sleep(10)
2777 finally:
2778 self.voltha.disable_device(device_id, delete = True)
2779 self.remove_olt(switch_map)
2780 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002781
Thangavelu K S735a6662017-06-15 18:08:23 +00002782 reactor.callLater(0, dhcp_flow_check_scenario, df)
2783 return df
2784
Thangavelu K S735a6662017-06-15 18:08:23 +00002785 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002786 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
2787 """
2788 Test Method:
2789 0. Make sure that voltha is up and running on CORD-POD setup.
2790 1. OLT and ONU is detected and validated.
2791 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2792 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
2793 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
2794 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002795 df = defer.Deferred()
2796 def dhcp_flow_check_scenario(df):
2797 log_test.info('Enabling ponsim_olt')
2798 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2799 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2800 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002801 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002802 time.sleep(10)
2803 switch_map = None
2804 olt_configured = False
2805 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2806 log_test.info('Installing OLT app')
2807 OnosCtrl.install_app(self.olt_app_file)
2808 time.sleep(5)
2809 log_test.info('Adding subscribers through OLT app')
2810 self.config_olt(switch_map)
2811 olt_configured = True
2812 time.sleep(5)
2813 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
2814 try:
2815 assert_equal(dhcp_status, True)
2816 #assert_equal(status, True)
2817 time.sleep(10)
2818 finally:
2819 self.voltha.disable_device(device_id, delete = True)
2820 self.remove_olt(switch_map)
2821 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002822
Thangavelu K S735a6662017-06-15 18:08:23 +00002823 reactor.callLater(0, dhcp_flow_check_scenario, df)
2824 return df
2825
2826 @deferred(TESTCASE_TIMEOUT)
2827 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002828 """
2829 Test Method:
2830 0. Make sure that voltha is up and running on CORD-POD setup.
2831 1. OLT and ONU is detected and validated.
2832 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2833 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
2834 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.
2835 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002836 df = defer.Deferred()
2837 def dhcp_flow_check_scenario(df):
2838 log_test.info('Enabling ponsim_olt')
2839 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2840 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2841 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002842 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002843 time.sleep(10)
2844 switch_map = None
2845 olt_configured = False
2846 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2847 log_test.info('Installing OLT app')
2848 OnosCtrl.install_app(self.olt_app_file)
2849 time.sleep(5)
2850 log_test.info('Adding subscribers through OLT app')
2851 self.config_olt(switch_map)
2852 olt_configured = True
2853 time.sleep(5)
2854 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
2855 try:
2856 assert_equal(dhcp_status, True)
2857 #assert_equal(status, True)
2858 time.sleep(10)
2859 finally:
2860 self.voltha.disable_device(device_id, delete = True)
2861 self.remove_olt(switch_map)
2862 df.callback(0)
2863
2864 reactor.callLater(0, dhcp_flow_check_scenario, df)
2865 return df
2866
Thangavelu K S735a6662017-06-15 18:08:23 +00002867 @deferred(TESTCASE_TIMEOUT)
2868 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002869 """
2870 Test Method:
2871 0. Make sure that voltha is up and running on CORD-POD setup.
2872 1. OLT and ONU is detected and validated.
2873 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2874 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2875 4. Verify that subscriber get ip from dhcp server successfully.
2876 5. Deactivate dhcp server app in onos.
2877 6. Repeat step 3.
2878 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2879 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002880 df = defer.Deferred()
2881 dhcp_app = 'org.onosproject.dhcp'
2882 def dhcp_flow_check_scenario(df):
2883 log_test.info('Enabling ponsim_olt')
2884 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2885 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2886 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002887 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002888 time.sleep(10)
2889 switch_map = None
2890 olt_configured = False
2891 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2892 log_test.info('Installing OLT app')
2893 OnosCtrl.install_app(self.olt_app_file)
2894 time.sleep(5)
2895 log_test.info('Adding subscribers through OLT app')
2896 self.config_olt(switch_map)
2897 olt_configured = True
2898 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002899 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00002900 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
2901 log_test.info('Restart dhcp app in onos during client send discover to voltha')
2902 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00002903 thread1.start()
2904 time.sleep(10)
2905 thread1.join()
2906 thread2.join()
2907 try:
2908 assert_equal(self.success, True)
2909 #assert_equal(status, True)
2910 time.sleep(10)
2911 finally:
2912 self.voltha.disable_device(device_id, delete = True)
2913 self.remove_olt(switch_map)
2914 df.callback(0)
2915
2916 reactor.callLater(0, dhcp_flow_check_scenario, df)
2917 return df
2918
2919 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002920 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
2921 """
2922 Test Method:
2923 0. Make sure that voltha is up and running on CORD-POD setup.
2924 1. OLT and ONU is detected and validated.
2925 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2926 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2927 4. Verify that subscriber get ip from dhcp server successfully.
2928 5. Send dhcp renew packet to dhcp server which is running as onos app.
2929 6. Repeat step 4.
2930 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002931
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002932 df = defer.Deferred()
2933 def dhcp_flow_check_scenario(df):
2934 log_test.info('Enabling ponsim_olt')
2935 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2936 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2937 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002938 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002939 time.sleep(10)
2940 switch_map = None
2941 olt_configured = False
2942 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2943 log_test.info('Installing OLT app')
2944 OnosCtrl.install_app(self.olt_app_file)
2945 time.sleep(5)
2946 log_test.info('Adding subscribers through OLT app')
2947 self.config_olt(switch_map)
2948 olt_configured = True
2949 time.sleep(5)
2950 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
2951 try:
2952 assert_equal(dhcp_status, True)
2953 #assert_equal(status, True)
2954 time.sleep(10)
2955 finally:
2956 self.voltha.disable_device(device_id, delete = True)
2957 self.remove_olt(switch_map)
2958 df.callback(0)
2959
2960 reactor.callLater(0, dhcp_flow_check_scenario, df)
2961 return df
2962
2963 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002964 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
2965 """
2966 Test Method:
2967 0. Make sure that voltha is up and running on CORD-POD setup.
2968 1. OLT and ONU is detected and validated.
2969 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2970 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2971 4. Verify that subscriber get ip from dhcp server successfully.
2972 5. Send dhcp rebind packet to dhcp server which is running as onos app.
2973 6. Repeat step 4.
2974 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002975 df = defer.Deferred()
2976 def dhcp_flow_check_scenario(df):
2977 log_test.info('Enabling ponsim_olt')
2978 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2979 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2980 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002981 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002982 time.sleep(10)
2983 switch_map = None
2984 olt_configured = False
2985 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2986 log_test.info('Installing OLT app')
2987 OnosCtrl.install_app(self.olt_app_file)
2988 time.sleep(5)
2989 log_test.info('Adding subscribers through OLT app')
2990 self.config_olt(switch_map)
2991 olt_configured = True
2992 time.sleep(5)
2993 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
2994 try:
2995 assert_equal(dhcp_status, True)
2996 #assert_equal(status, True)
2997 time.sleep(10)
2998 finally:
2999 self.voltha.disable_device(device_id, delete = True)
3000 self.remove_olt(switch_map)
3001 df.callback(0)
3002
3003 reactor.callLater(0, dhcp_flow_check_scenario, df)
3004 return df
3005
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003006 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003007 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003008 """
3009 Test Method:
3010 0. Make sure that voltha is up and running on CORD-POD setup.
3011 1. OLT and ONU is detected and validated.
3012 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3013 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3014 4. Verify that subscriber get ip from dhcp server successfully.
3015 5. Disable olt devices which is being detected in voltha CLI.
3016 6. Repeat step 3.
3017 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3018 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003019 df = defer.Deferred()
3020 dhcp_app = 'org.onosproject.dhcp'
3021 def dhcp_flow_check_scenario(df):
3022 log_test.info('Enabling ponsim_olt')
3023 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3024 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3025 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003026 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003027 time.sleep(10)
3028 switch_map = None
3029 olt_configured = False
3030 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3031 log_test.info('Installing OLT app')
3032 OnosCtrl.install_app(self.olt_app_file)
3033 time.sleep(5)
3034 log_test.info('Adding subscribers through OLT app')
3035 self.config_olt(switch_map)
3036 olt_configured = True
3037 time.sleep(5)
3038 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3039 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3040 log_test.info('Disable the olt device in during client send discover to voltha')
3041 thread2.start()
3042# time.sleep(randint(0,1))
3043 thread1.start()
3044 time.sleep(10)
3045 thread1.join()
3046 thread2.join()
3047 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003048 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003049 #assert_equal(status, True)
3050 time.sleep(10)
3051 finally:
3052 self.voltha.disable_device(device_id, delete = True)
3053 self.remove_olt(switch_map)
3054 df.callback(0)
3055
3056 reactor.callLater(0, dhcp_flow_check_scenario, df)
3057 return df
3058
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003059 @deferred(TESTCASE_TIMEOUT)
3060 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
3061 """
3062 Test Method:
3063 0. Make sure that voltha is up and running on CORD-POD setup.
3064 1. OLT and ONU is detected and validated.
3065 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3066 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3067 4. Verify that subscriber get ip from dhcp server successfully.
3068 5. Disable olt devices which is being detected in voltha CLI.
3069 6. Repeat step 3.
3070 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3071 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
3072 """
3073 df = defer.Deferred()
3074 no_iterations = 10
3075 dhcp_app = 'org.onosproject.dhcp'
3076 def dhcp_flow_check_scenario(df):
3077 log_test.info('Enabling ponsim_olt')
3078 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3079 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3080 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003081 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003082 time.sleep(10)
3083 switch_map = None
3084 olt_configured = False
3085 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3086 log_test.info('Installing OLT app')
3087 OnosCtrl.install_app(self.olt_app_file)
3088 time.sleep(5)
3089 log_test.info('Adding subscribers through OLT app')
3090 self.config_olt(switch_map)
3091 olt_configured = True
3092 time.sleep(5)
3093 for i in range(no_iterations):
3094 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3095 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3096 log_test.info('Disable the olt device in during client send discover to voltha')
3097 thread2.start()
3098# time.sleep(randint(0,1))
3099 thread1.start()
3100 time.sleep(10)
3101 thread1.join()
3102 thread2.join()
3103 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3104 try:
3105 assert_equal(self.success, True)
3106 assert_equal(dhcp_status, True)
3107 #assert_equal(status, True)
3108 time.sleep(10)
3109 finally:
3110 self.voltha.disable_device(device_id, delete = True)
3111 self.remove_olt(switch_map)
3112 df.callback(0)
3113
3114 reactor.callLater(0, dhcp_flow_check_scenario, df)
3115 return df
3116
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003117 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003118 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003119 """
3120 Test Method:
3121 0. Make sure that voltha is up and running on CORD-POD setup.
3122 1. OLT and ONU is detected and validated.
3123 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3124 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3125 4. Verify that subscriber get ip from dhcp server successfully.
3126 5. Disable olt devices which is being detected in voltha CLI.
3127 6. Repeat step 3.
3128 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3129 8. Enable olt devices which is being detected in voltha CLI.
3130 9. Repeat steps 3 and 4.
3131 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003132 df = defer.Deferred()
3133 dhcp_app = 'org.onosproject.dhcp'
3134 def dhcp_flow_check_scenario(df):
3135 log_test.info('Enabling ponsim_olt')
3136 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3137 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3138 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003139 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003140 time.sleep(10)
3141 switch_map = None
3142 olt_configured = False
3143 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3144 log_test.info('Installing OLT app')
3145 OnosCtrl.install_app(self.olt_app_file)
3146 time.sleep(5)
3147 log_test.info('Adding subscribers through OLT app')
3148 self.config_olt(switch_map)
3149 olt_configured = True
3150 time.sleep(5)
3151 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3152 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3153 thread2.start()
3154 thread1.start()
3155 time.sleep(10)
3156 thread1.join()
3157 thread2.join()
3158 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003159 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003160 #assert_equal(status, True)
3161 time.sleep(10)
3162 finally:
3163 self.voltha.disable_device(device_id, delete = True)
3164 self.remove_olt(switch_map)
3165 df.callback(0)
3166
3167 reactor.callLater(0, dhcp_flow_check_scenario, df)
3168 return df
3169
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003170 @deferred(TESTCASE_TIMEOUT)
3171 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
3172 """
3173 Test Method:
3174 0. Make sure that voltha is up and running on CORD-POD setup.
3175 1. OLT and ONU is detected and validated.
3176 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3177 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3178 4. Verify that subscriber get ip from dhcp server successfully.
3179 5. Disable olt devices which is being detected in voltha CLI.
3180 6. Repeat step 3.
3181 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3182 8. Enable olt devices which is being detected in voltha CLI.
3183 9. Repeat steps 3 and 4.
3184 """
3185
3186 df = defer.Deferred()
3187 no_iterations = 10
3188 dhcp_app = 'org.onosproject.dhcp'
3189 def dhcp_flow_check_scenario(df):
3190 log_test.info('Enabling ponsim_olt')
3191 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3192 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3193 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003194 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003195 time.sleep(10)
3196 switch_map = None
3197 olt_configured = False
3198 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3199 log_test.info('Installing OLT app')
3200 OnosCtrl.install_app(self.olt_app_file)
3201 time.sleep(5)
3202 log_test.info('Adding subscribers through OLT app')
3203 self.config_olt(switch_map)
3204 olt_configured = True
3205 time.sleep(5)
3206 for i in range(no_iterations):
3207 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3208 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3209 thread2.start()
3210 thread1.start()
3211 time.sleep(10)
3212 thread1.join()
3213 thread2.join()
3214 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3215 try:
3216 assert_equal(dhcp_status, True)
3217 #assert_equal(status, True)
3218 assert_equal(self.success, True)
3219 time.sleep(10)
3220 finally:
3221 self.voltha.disable_device(device_id, delete = True)
3222 self.remove_olt(switch_map)
3223 df.callback(0)
3224
3225 reactor.callLater(0, dhcp_flow_check_scenario, df)
3226 return df
3227
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003228 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003229 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003230 """
3231 Test Method:
3232 0. Make sure that voltha is up and running on CORD-POD setup.
3233 1. OLT and ONU is detected and validated.
3234 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3235 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3236 4. Verify that subscriber get ip from dhcp server successfully.
3237 5. Disable onu port which is being detected in voltha CLI.
3238 6. Repeat step 3.
3239 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3240 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003241 df = defer.Deferred()
3242 dhcp_app = 'org.onosproject.dhcp'
3243 def dhcp_flow_check_scenario(df):
3244 log_test.info('Enabling ponsim_olt')
3245 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3246 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3247 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003248 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003249 time.sleep(10)
3250 switch_map = None
3251 olt_configured = False
3252 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3253 log_test.info('Installing OLT app')
3254 OnosCtrl.install_app(self.olt_app_file)
3255 time.sleep(5)
3256 log_test.info('Adding subscribers through OLT app')
3257 self.config_olt(switch_map)
3258 olt_configured = True
3259 time.sleep(5)
3260 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3261 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3262 thread1.start()
3263 thread2.start()
3264 time.sleep(10)
3265 thread1.join()
3266 thread2.join()
3267 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003268 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003269 #assert_equal(status, True)
3270 time.sleep(10)
3271 finally:
3272 self.voltha.disable_device(device_id, delete = True)
3273 self.remove_olt(switch_map)
3274 df.callback(0)
3275
3276 reactor.callLater(0, dhcp_flow_check_scenario, df)
3277 return df
3278
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003279 @deferred(TESTCASE_TIMEOUT)
3280 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
3281 """
3282 Test Method:
3283 0. Make sure that voltha is up and running on CORD-POD setup.
3284 1. OLT and ONU is detected and validated.
3285 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3286 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3287 4. Verify that subscriber get ip from dhcp server successfully.
3288 5. Disable onu port which is being detected in voltha CLI.
3289 6. Repeat step 3.
3290 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3291 """
3292 df = defer.Deferred()
3293 no_iterations = 10
3294 dhcp_app = 'org.onosproject.dhcp'
3295 def dhcp_flow_check_scenario(df):
3296 log_test.info('Enabling ponsim_olt')
3297 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3298 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3299 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003300 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003301 time.sleep(10)
3302 switch_map = None
3303 olt_configured = False
3304 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3305 log_test.info('Installing OLT app')
3306 OnosCtrl.install_app(self.olt_app_file)
3307 time.sleep(5)
3308 log_test.info('Adding subscribers through OLT app')
3309 self.config_olt(switch_map)
3310 olt_configured = True
3311 time.sleep(5)
3312 for i in range(no_iterations):
3313 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3314 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3315 thread1.start()
3316 thread2.start()
3317 time.sleep(10)
3318 thread1.join()
3319 thread2.join()
3320 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3321 try:
3322 #assert_equal(status, True)
3323 assert_equal(dhcp_status, True)
3324 assert_equal(self.success, True)
3325 time.sleep(10)
3326 finally:
3327 self.voltha.disable_device(device_id, delete = True)
3328 self.remove_olt(switch_map)
3329 df.callback(0)
3330
3331 reactor.callLater(0, dhcp_flow_check_scenario, df)
3332 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003333
3334 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003335 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003336 """
3337 Test Method:
3338 0. Make sure that voltha is up and running on CORD-POD setup.
3339 1. OLT and ONU is detected and validated.
3340 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3341 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3342 4. Verify that subscriber get ip from dhcp server successfully.
3343 5. Disable onu port which is being detected in voltha CLI.
3344 6. Repeat step 3.
3345 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3346 8. Enable onu port which is being detected in voltha CLI.
3347 9. Repeat steps 3 and 4.
3348 """
3349
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003350 df = defer.Deferred()
3351 dhcp_app = 'org.onosproject.dhcp'
3352 def dhcp_flow_check_scenario(df):
3353 log_test.info('Enabling ponsim_olt')
3354 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3355 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3356 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003357 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003358 time.sleep(10)
3359 switch_map = None
3360 olt_configured = False
3361 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3362 log_test.info('Installing OLT app')
3363 OnosCtrl.install_app(self.olt_app_file)
3364 time.sleep(5)
3365 log_test.info('Adding subscribers through OLT app')
3366 self.config_olt(switch_map)
3367 olt_configured = True
3368 time.sleep(5)
3369 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3370 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3371 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3372 thread2.start()
3373 time.sleep(randint(0,1))
3374 thread1.start()
3375 time.sleep(10)
3376 thread1.join()
3377 thread2.join()
3378 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3379 assert_equal(dhcp_status, True)
3380 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003381 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003382 #assert_equal(status, True)
3383 time.sleep(10)
3384 finally:
3385 self.voltha.disable_device(device_id, delete = True)
3386 self.remove_olt(switch_map)
3387 df.callback(0)
3388
3389 reactor.callLater(0, dhcp_flow_check_scenario, df)
3390 return df
3391
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003392 @deferred(TESTCASE_TIMEOUT)
3393 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
3394 """
3395 Test Method:
3396 0. Make sure that voltha is up and running on CORD-POD setup.
3397 1. OLT and ONU is detected and validated.
3398 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3399 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3400 4. Verify that subscriber get ip from dhcp server successfully.
3401 5. Disable onu port which is being detected in voltha CLI.
3402 6. Repeat step 3.
3403 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3404 8. Enable onu port which is being detected in voltha CLI.
3405 9. Repeat steps 3 and 4.
3406 """
3407
3408 df = defer.Deferred()
3409 no_iterations = 10
3410 dhcp_app = 'org.onosproject.dhcp'
3411 def dhcp_flow_check_scenario(df):
3412 log_test.info('Enabling ponsim_olt')
3413 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3414 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3415 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003416 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003417 time.sleep(10)
3418 switch_map = None
3419 olt_configured = False
3420 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3421 log_test.info('Installing OLT app')
3422 OnosCtrl.install_app(self.olt_app_file)
3423 time.sleep(5)
3424 log_test.info('Adding subscribers through OLT app')
3425 self.config_olt(switch_map)
3426 olt_configured = True
3427 time.sleep(5)
3428 for i in range(no_iterations):
3429 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3430 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3431 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3432 thread2.start()
3433 time.sleep(randint(0,1))
3434 thread1.start()
3435 time.sleep(10)
3436 thread1.join()
3437 thread2.join()
3438 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3439 assert_equal(dhcp_status, True)
3440 try:
3441 assert_equal(self.success, True)
3442 #assert_equal(status, True)
3443 time.sleep(10)
3444 finally:
3445 self.voltha.disable_device(device_id, delete = True)
3446 self.remove_olt(switch_map)
3447 df.callback(0)
3448
3449 reactor.callLater(0, dhcp_flow_check_scenario, df)
3450 return df
3451
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003452 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003453 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003454 """
3455 Test Method:
3456 0. Make sure that voltha is up and running on CORD-POD setup.
3457 1. OLT and ONU is detected and validated.
3458 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3459 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3460 4. Verify that subscribers had got different ips from dhcp server successfully.
3461 """
3462
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003463 df = defer.Deferred()
3464 self.success = True
3465 dhcp_app = 'org.onosproject.dhcp'
3466 def dhcp_flow_check_scenario(df):
3467 log_test.info('Enabling ponsim_olt')
3468 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3469 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3470 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003471 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003472 time.sleep(10)
3473 switch_map = None
3474 olt_configured = False
3475 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3476 log_test.info('Installing OLT app')
3477 OnosCtrl.install_app(self.olt_app_file)
3478 time.sleep(5)
3479 log_test.info('Adding subscribers through OLT app')
3480 self.config_olt(switch_map)
3481 olt_configured = True
3482 time.sleep(5)
3483 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3484 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3485 thread1.start()
3486 thread2.start()
3487 time.sleep(10)
3488 thread1.join()
3489 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003490 dhcp_flow_status = self.success
3491 try:
3492# if self.success is not True:
3493 assert_equal(dhcp_flow_status, True)
3494 #assert_equal(status, True)
3495 time.sleep(10)
3496 finally:
3497 self.voltha.disable_device(device_id, delete = True)
3498 self.remove_olt(switch_map)
3499 df.callback(0)
3500
3501 reactor.callLater(0, dhcp_flow_check_scenario, df)
3502 return df
3503
3504 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003505 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003506 """
3507 Test Method:
3508 0. Make sure that voltha is up and running on CORD-POD setup.
3509 1. OLT and ONU is detected and validated.
3510 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3511 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3512 4. Verify that subscribers had got ip from dhcp server successfully.
3513 5. Repeat step 3 and 4 for 10 times for both subscribers.
3514 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
3515 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003516
3517
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003518 df = defer.Deferred()
3519 self.success = True
3520 dhcp_app = 'org.onosproject.dhcp'
3521 def dhcp_flow_check_scenario(df):
3522 log_test.info('Enabling ponsim_olt')
3523 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3524 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3525 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003526 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003527 time.sleep(10)
3528 switch_map = None
3529 olt_configured = False
3530 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3531 log_test.info('Installing OLT app')
3532 OnosCtrl.install_app(self.olt_app_file)
3533 time.sleep(5)
3534 log_test.info('Adding subscribers through OLT app')
3535 self.config_olt(switch_map)
3536 olt_configured = True
3537 time.sleep(5)
3538 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3539 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
3540 thread1.start()
3541 thread2.start()
3542 time.sleep(10)
3543 thread1.join()
3544 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003545 dhcp_flow_status = self.success
3546 try:
3547# if self.success is not True:
3548 assert_equal(dhcp_flow_status, True)
3549 #assert_equal(status, True)
3550 time.sleep(10)
3551 finally:
3552 self.voltha.disable_device(device_id, delete = True)
3553 self.remove_olt(switch_map)
3554 df.callback(0)
3555
3556 reactor.callLater(0, dhcp_flow_check_scenario, df)
3557 return df
3558
3559 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003560 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003561 """
3562 Test Method:
3563 0. Make sure that voltha is up and running on CORD-POD setup.
3564 1. OLT and ONU is detected and validated.
3565 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3566 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3567 4. Verify that subscribers had got ip from dhcp server successfully.
3568 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3569 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
3570 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003571
3572 df = defer.Deferred()
3573 self.success = True
3574 dhcp_app = 'org.onosproject.dhcp'
3575 def dhcp_flow_check_scenario(df):
3576 log_test.info('Enabling ponsim_olt')
3577 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3578 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3579 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003580 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003581 time.sleep(10)
3582 switch_map = None
3583 olt_configured = False
3584 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3585 log_test.info('Installing OLT app')
3586 OnosCtrl.install_app(self.olt_app_file)
3587 time.sleep(5)
3588 log_test.info('Adding subscribers through OLT app')
3589 self.config_olt(switch_map)
3590 olt_configured = True
3591 time.sleep(5)
3592 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3593 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3594 thread1.start()
3595 thread2.start()
3596 time.sleep(10)
3597 thread1.join()
3598 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003599 dhcp_flow_status = self.success
3600 try:
3601# if self.success is not True:
3602 assert_equal(dhcp_flow_status, True)
3603 #assert_equal(status, True)
3604 time.sleep(10)
3605 finally:
3606 self.voltha.disable_device(device_id, delete = True)
3607 self.remove_olt(switch_map)
3608 df.callback(0)
3609
3610 reactor.callLater(0, dhcp_flow_check_scenario, df)
3611 return df
3612
3613 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003614 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 +00003615 """
3616 Test Method:
3617 0. Make sure that voltha is up and running on CORD-POD setup.
3618 1. OLT and ONU is detected and validated.
3619 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3620 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
3621 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
3622 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
3623 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003624
3625 df = defer.Deferred()
3626 self.success = True
3627 dhcp_app = 'org.onosproject.dhcp'
3628 def dhcp_flow_check_scenario(df):
3629 log_test.info('Enabling ponsim_olt')
3630 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3631 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3632 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003633 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003634 time.sleep(10)
3635 switch_map = None
3636 olt_configured = False
3637 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3638 log_test.info('Installing OLT app')
3639 OnosCtrl.install_app(self.olt_app_file)
3640 time.sleep(5)
3641 log_test.info('Adding subscribers through OLT app')
3642 self.config_olt(switch_map)
3643 olt_configured = True
3644 time.sleep(5)
3645 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3646 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
3647 thread1.start()
3648 thread2.start()
3649 time.sleep(10)
3650 thread1.join()
3651 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003652 dhcp_flow_status = self.success
3653 try:
3654# if self.success is not True:
3655 assert_equal(dhcp_flow_status, True)
3656 #assert_equal(status, True)
3657 time.sleep(10)
3658 finally:
3659 self.voltha.disable_device(device_id, delete = True)
3660 self.remove_olt(switch_map)
3661 df.callback(0)
3662
3663 reactor.callLater(0, dhcp_flow_check_scenario, df)
3664 return df
3665
3666 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003667 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 +00003668 """
3669 Test Method:
3670 0. Make sure that voltha is up and running on CORD-POD setup.
3671 1. OLT and ONU is detected and validated.
3672 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3673 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
3674 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
3675 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
3676 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003677 df = defer.Deferred()
3678 self.success = True
3679 dhcp_app = 'org.onosproject.dhcp'
3680 def dhcp_flow_check_scenario(df):
3681 log_test.info('Enabling ponsim_olt')
3682 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3683 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3684 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003685 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003686 time.sleep(10)
3687 switch_map = None
3688 olt_configured = False
3689 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3690 log_test.info('Installing OLT app')
3691 OnosCtrl.install_app(self.olt_app_file)
3692 time.sleep(5)
3693 log_test.info('Adding subscribers through OLT app')
3694 self.config_olt(switch_map)
3695 olt_configured = True
3696 time.sleep(5)
3697 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3698 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3699 thread1.start()
3700 thread2.start()
3701 time.sleep(10)
3702 thread1.join()
3703 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003704 dhcp_flow_status = self.success
3705 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003706 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003707 time.sleep(10)
3708 finally:
3709 self.voltha.disable_device(device_id, delete = True)
3710 self.remove_olt(switch_map)
3711 df.callback(0)
3712
3713 reactor.callLater(0, dhcp_flow_check_scenario, df)
3714 return df
3715
3716 @deferred(TESTCASE_TIMEOUT)
3717 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003718 """
3719 Test Method:
3720 0. Make sure that voltha is up and running on CORD-POD setup.
3721 1. OLT and ONU is detected and validated.
3722 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3723 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3724 4. Verify that subscribers had got ip from dhcp server successfully.
3725 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3726 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3727 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3728 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003729 df = defer.Deferred()
3730 self.success = True
3731 dhcp_app = 'org.onosproject.dhcp'
3732 def dhcp_flow_check_scenario(df):
3733 log_test.info('Enabling ponsim_olt')
3734 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3735 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3736 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003737 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003738 time.sleep(10)
3739 switch_map = None
3740 olt_configured = False
3741 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3742 log_test.info('Installing OLT app')
3743 OnosCtrl.install_app(self.olt_app_file)
3744 time.sleep(5)
3745 log_test.info('Adding subscribers through OLT app')
3746 self.config_olt(switch_map)
3747 olt_configured = True
3748 time.sleep(5)
3749 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3750 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3751 thread1.start()
3752 thread2.start()
3753 time.sleep(10)
3754 thread1.join()
3755 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003756 dhcp_flow_status = self.success
3757 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003758 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003759 time.sleep(10)
3760 finally:
3761 self.voltha.disable_device(device_id, delete = True)
3762 self.remove_olt(switch_map)
3763 df.callback(0)
3764
3765 reactor.callLater(0, dhcp_flow_check_scenario, df)
3766 return df
3767
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003768 @deferred(TESTCASE_TIMEOUT)
3769 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003770 """
3771 Test Method:
3772 0. Make sure that voltha is up and running on CORD-POD setup.
3773 1. OLT and ONU is detected and validated.
3774 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3775 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3776 4. Verify that subscribers had got ip from dhcp server successfully.
3777 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3778 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3779 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3780 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
3781 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
3782 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
3783 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003784 df = defer.Deferred()
3785 self.success = True
3786 dhcp_app = 'org.onosproject.dhcp'
3787 def dhcp_flow_check_scenario(df):
3788 log_test.info('Enabling ponsim_olt')
3789 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3790 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3791 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003792 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003793 time.sleep(10)
3794 switch_map = None
3795 olt_configured = False
3796 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3797 log_test.info('Installing OLT app')
3798 OnosCtrl.install_app(self.olt_app_file)
3799 time.sleep(5)
3800 log_test.info('Adding subscribers through OLT app')
3801 self.config_olt(switch_map)
3802 olt_configured = True
3803 time.sleep(5)
3804 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3805 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3806 thread3 = threading.Thread(target = self.voltha_uni_port_down_up, args = (self.INTF_2_RX_DEFAULT,))
3807 thread1.start()
3808 thread2.start()
3809 thread3.start()
3810 time.sleep(10)
3811 thread1.join()
3812 thread2.join()
3813 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003814 dhcp_flow_status = self.success
3815 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003816 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003817 time.sleep(10)
3818 finally:
3819 self.voltha.disable_device(device_id, delete = True)
3820 self.remove_olt(switch_map)
3821 df.callback(0)
3822
3823 reactor.callLater(0, dhcp_flow_check_scenario, df)
3824 return df
3825
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003826 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003827 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003828 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003829 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00003830 0. Make sure that voltha is up and running on CORD-POD setup.
3831 1. OLT and ONU is detected and validated.
3832 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3833 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3834 4. Verify that subscribers had got ip from dhcp server successfully.
3835 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3836 6. Disable the olt device which is detected in voltha.
3837 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3838 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003839 df = defer.Deferred()
3840 self.success = True
3841 dhcp_app = 'org.onosproject.dhcp'
3842 def dhcp_flow_check_scenario(df):
3843 log_test.info('Enabling ponsim_olt')
3844 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3845 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3846 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003847 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003848 time.sleep(10)
3849 switch_map = None
3850 olt_configured = False
3851 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3852 log_test.info('Installing OLT app')
3853 OnosCtrl.install_app(self.olt_app_file)
3854 time.sleep(5)
3855 log_test.info('Adding subscribers through OLT app')
3856 self.config_olt(switch_map)
3857 olt_configured = True
3858 time.sleep(5)
3859 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3860 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3861 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3862
3863 thread1.start()
3864 thread2.start()
3865 thread3.start()
3866 time.sleep(10)
3867 thread1.join()
3868 thread2.join()
3869 thread3.join()
3870 dhcp_flow_status = self.success
3871 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003872 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003873 time.sleep(10)
3874 finally:
3875 self.voltha.disable_device(device_id, delete = True)
3876 self.remove_olt(switch_map)
3877 df.callback(0)
3878
3879 reactor.callLater(0, dhcp_flow_check_scenario, df)
3880 return df
3881
3882 @deferred(TESTCASE_TIMEOUT)
3883 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003884 """
3885 Test Method:
3886 0. Make sure that voltha is up and running on CORD-POD setup.
3887 1. OLT and ONU is detected and validated.
3888 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3889 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3890 4. Verify that subscribers had got ip from dhcp server successfully.
3891 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3892 6. Disable the olt device which is detected in voltha.
3893 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3894 8. Enable the olt device which is detected in voltha.
3895 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 +00003896
Thangavelu K S057b7d22017-05-16 22:03:22 +00003897 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003898 df = defer.Deferred()
3899 self.success = True
3900 dhcp_app = 'org.onosproject.dhcp'
3901 def dhcp_flow_check_scenario(df):
3902 log_test.info('Enabling ponsim_olt')
3903 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3904 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3905 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003906 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003907 time.sleep(10)
3908 switch_map = None
3909 olt_configured = False
3910 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3911 log_test.info('Installing OLT app')
3912 OnosCtrl.install_app(self.olt_app_file)
3913 time.sleep(5)
3914 log_test.info('Adding subscribers through OLT app')
3915 self.config_olt(switch_map)
3916 olt_configured = True
3917 time.sleep(5)
3918 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3919 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3920 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3921 thread1.start()
3922 thread2.start()
3923 thread3.start()
3924 time.sleep(10)
3925 thread1.join()
3926 thread2.join()
3927 thread3.join()
3928 dhcp_flow_status = self.success
3929 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003930 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003931 time.sleep(10)
3932 finally:
3933 self.voltha.disable_device(device_id, delete = True)
3934 self.remove_olt(switch_map)
3935 df.callback(0)
3936
3937 reactor.callLater(0, dhcp_flow_check_scenario, df)
3938 return df
3939
3940 @deferred(TESTCASE_TIMEOUT)
3941 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003942 """
3943 Test Method:
3944 0. Make sure that voltha is up and running on CORD-POD setup.
3945 1. OLT and ONU is detected and validated.
3946 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3947 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3948 4. Verify that subscribers had got ip from dhcp server successfully.
3949 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3950 6. Pause the olt device which is detected in voltha.
3951 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3952 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003953 df = defer.Deferred()
3954 self.success = True
3955 dhcp_app = 'org.onosproject.dhcp'
3956 def dhcp_flow_check_scenario(df):
3957 log_test.info('Enabling ponsim_olt')
3958 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3959 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3960 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003961 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003962 time.sleep(10)
3963 switch_map = None
3964 olt_configured = False
3965 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3966 log_test.info('Installing OLT app')
3967 OnosCtrl.install_app(self.olt_app_file)
3968 time.sleep(5)
3969 log_test.info('Adding subscribers through OLT app')
3970 self.config_olt(switch_map)
3971 olt_configured = True
3972 time.sleep(5)
3973 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3974 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3975 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
3976 thread1.start()
3977 thread2.start()
3978 thread3.start()
3979 time.sleep(10)
3980 thread1.join()
3981 thread2.join()
3982 thread3.join()
3983 dhcp_flow_status = self.success
3984 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003985 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003986 time.sleep(10)
3987 finally:
3988 self.voltha.disable_device(device_id, delete = True)
3989 self.remove_olt(switch_map)
3990 df.callback(0)
3991
3992 reactor.callLater(0, dhcp_flow_check_scenario, df)
3993 return df
3994
Thangavelu K S36edb012017-07-05 18:24:12 +00003995 def test_3_subscribers_with_voltha_for_dhcp_discover_requests(self):
3996 """
3997 Test Method:
3998 0. Make sure that voltha is up and running on CORD-POD setup.
3999 1. OLT and ONU is detected and validated.
4000 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4001 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4002 4. Verify that subscriber get ip from dhcp server successfully.
4003 """
4004 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4005 num_subscribers = 3
4006 num_channels = 1
4007 services = ('DHCP')
4008 cbs = (self.dhcp_flow_check, None, None)
4009 self.voltha_subscribers(services, cbs = cbs,
4010 num_subscribers = num_subscribers,
4011 num_channels = num_channels)
4012
4013 def test_5_subscribers_with_voltha_for_dhcp_discover_requests(self):
4014 """
4015 Test Method:
4016 0. Make sure that voltha is up and running on CORD-POD setup.
4017 1. OLT and ONU is detected and validated.
4018 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4019 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4020 4. Verify that subscriber get ip from dhcp server successfully.
4021 """
4022 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4023 num_subscribers = 5
4024 num_channels = 1
4025 services = ('DHCP')
4026 cbs = (self.dhcp_flow_check, None, None)
4027 self.voltha_subscribers(services, cbs = cbs,
4028 num_subscribers = num_subscribers,
4029 num_channels = num_channels)
4030
4031 def test_9_subscribers_with_voltha_for_dhcp_discover_requests(self):
4032 """
4033 Test Method:
4034 0. Make sure that voltha is up and running on CORD-POD setup.
4035 1. OLT and ONU is detected and validated.
4036 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4037 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4038 4. Verify that subscriber get ip from dhcp server successfully.
4039 """
4040 """Test subscriber join next for channel surfing with 9 subscribers browsing 1 channels each"""
4041 num_subscribers = 9
4042 num_channels = 1
4043 services = ('DHCP')
4044 cbs = (self.dhcp_flow_check, None, None)
4045 self.voltha_subscribers(services, cbs = cbs,
4046 num_subscribers = num_subscribers,
4047 num_channels = num_channels)
4048
4049 def test_3_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4050 """
4051 Test Method:
4052 0. Make sure that voltha is up and running on CORD-POD setup.
4053 1. OLT and ONU is detected and validated.
4054 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4055 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4056 4. Verify that subscriber get ip from dhcp server successfully.
4057 """
4058 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4059 num_subscribers = 3
4060 num_channels = 1
4061 services = ('TLS','DHCP')
4062 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4063 self.voltha_subscribers(services, cbs = cbs,
4064 num_subscribers = num_subscribers,
4065 num_channels = num_channels)
4066
4067 def test_5_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4068 """
4069 Test Method:
4070 0. Make sure that voltha is up and running on CORD-POD setup.
4071 1. OLT and ONU is detected and validated.
4072 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4073 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4074 4. Verify that subscriber get ip from dhcp server successfully.
4075 """
4076 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4077 num_subscribers = 5
4078 num_channels = 1
4079 services = ('TLS','DHCP')
4080 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4081 self.voltha_subscribers(services, cbs = cbs,
4082 num_subscribers = num_subscribers,
4083 num_channels = num_channels)
4084
4085 def test_9_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4086 """
4087 Test Method:
4088 0. Make sure that voltha is up and running on CORD-POD setup.
4089 1. OLT and ONU is detected and validated.
4090 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4091 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4092 4. Verify that subscriber get ip from dhcp server successfully.
4093 """
4094 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4095 num_subscribers = 9
4096 num_channels = 1
4097 services = ('TLS','DHCP')
4098 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4099 self.voltha_subscribers(services, cbs = cbs,
4100 num_subscribers = num_subscribers,
4101 num_channels = num_channels)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004102
4103 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004104 def test_subscriber_with_voltha_for_dhcprelay_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004105 """
4106 Test Method:
4107 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4108 1. OLT and ONU is detected and validated.
4109 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4110 3. Send dhcp request from residential subscrber to external dhcp server.
4111 4. Verify that subscriber get ip from external dhcp server successfully.
4112 """
Thangavelu K S6432b522017-07-22 00:05:54 +00004113 self.dhcprelay_setUpClass()
4114# if not port_list:
4115 port_list = self.generate_port_list(1, 0)
4116 iface = self.port_map['ports'][port_list[1][1]]
4117 mac = self.get_mac(iface)
4118 self.host_load(iface)
4119 ##we use the defaults for this test that serves as an example for others
4120 ##You don't need to restart dhcpd server if retaining default config
4121 config = self.default_config
4122 options = self.default_options
4123 subnet = self.default_subnet_config
4124 dhcpd_interface_list = self.relay_interfaces
4125 self.dhcpd_start(intf_list = dhcpd_interface_list,
4126 config = config,
4127 options = options,
4128 subnet = subnet)
4129 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4130 self.send_recv(mac=mac)
4131 self.dhcprelay_tearDwonClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004132
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004133 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004134 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004135 """
4136 Test Method:
4137 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4138 1. OLT and ONU is detected and validated.
4139 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4140 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
4141 4. Verify that subscriber should not get ip from external dhcp server.
4142 """
4143
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004144 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004145 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004146 """
4147 Test Method:
4148 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4149 1. OLT and ONU is detected and validated.
4150 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4151 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
4152 4. Verify that subscriber should not get ip from external dhcp server.
4153 """
4154
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004155 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004156 """
4157 Test Method:
4158 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4159 1. OLT and ONU is detected and validated.
4160 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4161 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
4162 4. Verify that subscriber should not get ip from external dhcp server.
4163 """
4164
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004165 def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004166 """
4167 Test Method:
4168 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4169 1. OLT and ONU is detected and validated.
4170 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4171 3. Send dhcp request from residential subscrber to external dhcp server.
4172 4. Verify that subscriber get ip from external dhcp server successfully.
4173 5. Send dhcp release from residential subscrber to external dhcp server.
4174 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
4175 """
4176
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004177 def test_subscriber_with_voltha_for_dhcprelay_starvation(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004178 """
4179 Test Method:
4180 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4181 1. OLT and ONU is detected and validated.
4182 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4183 3. Send dhcp request from residential subscriber to external dhcp server.
4184 4. Verify that subscriber get ip from external dhcp server. successfully.
4185 5. Repeat step 3 and 4 for 10 times.
4186 6 Verify that subscriber should get ip from external dhcp server..
4187 """
4188
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004189 def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004190 """
4191 Test Method:
4192 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4193 1. OLT and ONU is detected and validated.
4194 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4195 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
4196 4. Verify that subscriber should not get ip from external dhcp server..
4197 5. Repeat steps 3 and 4 for 10 times.
4198 6 Verify that subscriber should not get ip from external dhcp server..
4199 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004200 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004201 """
4202 Test Method:
4203 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4204 1. OLT and ONU is detected and validated.
4205 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4206 3. Send dhcp request from residential subscriber to external dhcp server.
4207 4. Verify that subscriber get ip from external dhcp server. successfully.
4208 5. Repeat step 3 for 50 times.
4209 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4210 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004211 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004212 """
4213 Test Method:
4214 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4215 1. OLT and ONU is detected and validated.
4216 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4217 3. Send dhcp request from residential subscriber to external dhcp server.
4218 4. Verify that subscriber get ip from external dhcp server. successfully.
4219 5. Send DHCP request to external dhcp server.
4220 6. Repeat step 5 for 50 times.
4221 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4222 """
4223
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004224 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004225 """
4226 Test Method:
4227 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4228 1. OLT and ONU is detected and validated.
4229 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4230 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
4231 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
4232 """
4233
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004234 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004235 """
4236 Test Method:
4237 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4238 1. OLT and ONU is detected and validated.
4239 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4240 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
4241 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.
4242 """
4243
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004244 def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004245 """
4246 Test Method:
4247 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4248 1. OLT and ONU is detected and validated.
4249 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4250 3. Send dhcp request from residential subscriber to external dhcp server.
4251 4. Verify that subscriber get ip from external dhcp server. successfully.
4252 5. Deactivate dhcp server app in onos.
4253 6. Repeat step 3.
4254 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4255 """
4256
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004257 def test_subscriber_with_voltha_for_dhcprelay_renew_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004258 """
4259 Test Method:
4260 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4261 1. OLT and ONU is detected and validated.
4262 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4263 3. Send dhcp request from residential subscriber to external dhcp server.
4264 4. Verify that subscriber get ip from external dhcp server. successfully.
4265 5. Send dhcp renew packet to external dhcp server.
4266 6. Repeat step 4.
4267 """
4268
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004269 def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004270 """
4271 Test Method:
4272 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4273 1. OLT and ONU is detected and validated.
4274 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4275 3. Send dhcp request from residential subscriber to external dhcp server.
4276 4. Verify that subscriber get ip from external dhcp server. successfully.
4277 5. Send dhcp rebind packet to external dhcp server.
4278 6. Repeat step 4.
4279 """
4280
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004281 def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004282 """
4283 Test Method:
4284 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4285 1. OLT and ONU is detected and validated.
4286 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4287 3. Send dhcp request from residential subscriber to external dhcp server.
4288 4. Verify that subscriber get ip from external dhcp server. successfully.
4289 5. Disable olt devices which is being detected in voltha CLI.
4290 6. Repeat step 3.
4291 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4292 """
4293
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004294 def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004295 """
4296 Test Method:
4297 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4298 1. OLT and ONU is detected and validated.
4299 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4300 3. Send dhcp request from residential subscriber to external dhcp server.
4301 4. Verify that subscriber get ip from external dhcp server. successfully.
4302 5. Disable olt devices which is being detected in voltha CLI.
4303 6. Repeat step 3.
4304 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4305 8. Enable olt devices which is being detected in voltha CLI.
4306 9. Repeat steps 3 and 4.
4307 """
4308
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004309 def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004310 """
4311 Test Method:
4312 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4313 1. OLT and ONU is detected and validated.
4314 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4315 3. Send dhcp request from residential subscriber to external dhcp server.
4316 4. Verify that subscriber get ip from external dhcp server. successfully.
4317 5. Disable onu port which is being detected in voltha CLI.
4318 6. Repeat step 3.
4319 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4320 """
4321
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004322 def test_subscriber_with_voltha_for_dhcprelay_disable_enable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004323 """
4324 Test Method:
4325 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4326 1. OLT and ONU is detected and validated.
4327 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4328 3. Send dhcp request from residential subscriber to external dhcp server.
4329 4. Verify that subscriber get ip from external dhcp server. successfully.
4330 5. Disable onu port which is being detected in voltha CLI.
4331 6. Repeat step 3.
4332 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4333 8. Enable onu port which is being detected in voltha CLI.
4334 9. Repeat steps 3 and 4.
4335 """
4336
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004337 def test_two_subscribers_with_voltha_for_dhcprelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004338 """
4339 Test Method:
4340 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4341 1. OLT and ONU is detected and validated.
4342 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4343 3. Send dhcp request from two residential subscribers to external dhcp server.
4344 4. Verify that subscribers had got different ips from external dhcp server. successfully.
4345 """
4346
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004347 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004348 """
4349 Test Method:
4350 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4351 1. OLT and ONU is detected and validated.
4352 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4353 3. Send dhcp request from two residential subscribers to external dhcp server.
4354 4. Verify that subscribers had got ip from external dhcp server. successfully.
4355 5. Repeat step 3 and 4 for 10 times for both subscribers.
4356 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
4357 """
4358
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004359 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004360 """
4361 Test Method:
4362 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4363 1. OLT and ONU is detected and validated.
4364 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4365 3. Send dhcp request from two residential subscribers to external dhcp server.
4366 4. Verify that subscribers had got ip from external dhcp server. successfully.
4367 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
4368 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
4369 """
4370
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004371 def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004372 """
4373 Test Method:
4374 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4375 1. OLT and ONU is detected and validated.
4376 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4377 3. Send dhcp request from one residential subscriber to external dhcp server.
4378 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
4379 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
4380 """
4381
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004382 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 +00004383 """
4384 Test Method:
4385 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4386 1. OLT and ONU is detected and validated.
4387 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4388 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
4389 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
4390 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
4391 """
4392
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004393 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004394 """
4395 Test Method:
4396 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4397 1. OLT and ONU is detected and validated.
4398 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4399 3. Send dhcp request from two residential subscribers to external dhcp server.
4400 4. Verify that subscribers had got ip from external dhcp server. successfully.
4401 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4402 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4403 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4404 """
4405
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004406 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(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 two residential subscribers to external dhcp server.
4413 4. Verify that subscribers had got ip from external dhcp server. successfully.
4414 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4415 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4416 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4417 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
4418 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
4419 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4420 """
4421
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004422 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004423 """
4424 Test Method:
4425 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4426 1. OLT and ONU is detected and validated.
4427 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4428 3. Send dhcp request from two residential subscribers to external dhcp server.
4429 4. Verify that subscribers had got ip from external dhcp server. successfully.
4430 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4431 6. Disable the olt device which is detected in voltha.
4432 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4433 """
4434
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004435 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004436 """
4437 Test Method:
4438 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4439 1. OLT and ONU is detected and validated.
4440 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4441 3. Send dhcp request from two residential subscribers to external dhcp server.
4442 4. Verify that subscribers had got ip from external dhcp server. successfully.
4443 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4444 6. Disable the olt device which is detected in voltha.
4445 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4446 8. Enable the olt device which is detected in voltha.
4447 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4448 """
4449
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004450 def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004451 """
4452 Test Method:
4453 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4454 1. OLT and ONU is detected and validated.
4455 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4456 3. Send dhcp request from two residential subscribers to external dhcp server.
4457 4. Verify that subscribers had got ip from external dhcp server. successfully.
4458 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4459 6. Pause the olt device which is detected in voltha.
4460 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4461 """
Thangavelu K S36edb012017-07-05 18:24:12 +00004462
Thangavelu K S6432b522017-07-22 00:05:54 +00004463 def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004464 """
4465 Test Method:
4466 0. Make sure that voltha is up and running on CORD-POD setup.
4467 1. OLT and ONU is detected and validated.
4468 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4469 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4470 4. Send igmp joins for a multicast group address multi-group-addressA.
4471 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4472 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4473 """
4474
Thangavelu K S8e413082017-07-13 20:02:14 +00004475 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4476 num_subscribers = 1
4477 num_channels = 1
4478 services = ('IGMP')
4479 cbs = (self.igmp_flow_check, None, None)
4480 self.voltha_subscribers(services, cbs = cbs,
4481 num_subscribers = num_subscribers,
4482 num_channels = num_channels)
4483
Thangavelu K S6432b522017-07-22 00:05:54 +00004484 def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004485 """
4486 Test Method:
4487 0. Make sure that voltha is up and running on CORD-POD setup.
4488 1. OLT and ONU is detected and validated.
4489 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4490 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4491 4. Send igmp joins for a multicast group address multi-group-addressA.
4492 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4493 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4494 7. Send igmp leave for a multicast group address multi-group-addressA.
4495 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4496 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004497 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4498 num_subscribers = 1
4499 num_channels = 1
4500 services = ('IGMP')
4501 cbs = (self.igmp_flow_check, None, None)
4502 self.voltha_subscribers(services, cbs = cbs,
4503 num_subscribers = num_subscribers,
4504 num_channels = num_channels)
4505
Thangavelu K S6432b522017-07-22 00:05:54 +00004506 def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004507 """
4508 Test Method:
4509 0. Make sure that voltha is up and running on CORD-POD setup.
4510 1. OLT and ONU is detected and validated.
4511 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4512 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4513 4. Send igmp joins for a multicast group address multi-group-addressA.
4514 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4515 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4516 7. Send igmp leave for a multicast group address multi-group-addressA.
4517 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4518 9. Repeat steps 4 to 6.
4519 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004520 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4521 num_subscribers = 1
4522 num_channels = 1
4523 services = ('IGMP')
4524 cbs = (self.igmp_flow_check, None, None)
4525 self.voltha_subscribers(services, cbs = cbs,
4526 num_subscribers = num_subscribers,
4527 num_channels = num_channels)
4528
Thangavelu K S6432b522017-07-22 00:05:54 +00004529 def test_subscriber_with_voltha_for_igmp_2_groups_joins_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004530 """
4531 Test Method:
4532 0. Make sure that voltha is up and running on CORD-POD setup.
4533 1. OLT and ONU is detected and validated.
4534 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4535 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4536 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4537 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4538 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4539 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004540 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4541 num_subscribers = 1
4542 num_channels = 2
4543 services = ('IGMP')
4544 cbs = (self.igmp_flow_check, None, None)
4545 self.voltha_subscribers(services, cbs = cbs,
4546 num_subscribers = num_subscribers,
4547 num_channels = num_channels)
4548
Thangavelu K S6432b522017-07-22 00:05:54 +00004549 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 +00004550 """
4551 Test Method:
4552 0. Make sure that voltha is up and running on CORD-POD setup.
4553 1. OLT and ONU is detected and validated.
4554 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4555 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4556 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4557 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4558 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4559 7. Send igmp leave for a multicast group address multi-group-addressA.
4560 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.
4561 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester.
4562 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004563 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4564 num_subscribers = 1
4565 num_channels = 2
4566 services = ('IGMP')
4567 cbs = (self.igmp_flow_check, None, None)
4568 self.voltha_subscribers(services, cbs = cbs,
4569 num_subscribers = num_subscribers,
4570 num_channels = num_channels)
4571
Thangavelu K S6432b522017-07-22 00:05:54 +00004572 def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004573 """
4574 Test Method:
4575 0. Make sure that voltha is up and running on CORD-POD setup.
4576 1. OLT and ONU is detected and validated.
4577 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4578 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4579 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4580 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4581 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4582 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4583 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4584 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004585 num_subscribers = 1
4586 num_channels = 1
4587 services = ('IGMP')
4588 cbs = (self.igmp_flow_check, None, None)
4589 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4590 num_subscribers = num_subscribers,
4591 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004592
Thangavelu K S6432b522017-07-22 00:05:54 +00004593 def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004594 """
4595 Test Method:
4596 0. Make sure that voltha is up and running on CORD-POD setup.
4597 1. OLT and ONU is detected and validated.
4598 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4599 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4600 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4601 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4602 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4603 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA
4604 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4605 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4606 """
4607
Thangavelu K S8e413082017-07-13 20:02:14 +00004608 num_subscribers = 1
4609 num_channels = 2
4610 services = ('IGMP')
4611 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4612 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4613 num_subscribers = num_subscribers,
4614 num_channels = num_channels)
4615
Thangavelu K S6432b522017-07-22 00:05:54 +00004616 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 +00004617 """
4618 Test Method:
4619 0. Make sure that voltha is up and running on CORD-POD setup.
4620 1. OLT and ONU is detected and validated.
4621 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4622 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4623 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4624 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4625 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4626 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA
4627 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4628 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4629 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004630 num_subscribers = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004631 num_channels = 2
Thangavelu K S8e413082017-07-13 20:02:14 +00004632 services = ('IGMP')
4633 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4634 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4635 num_subscribers = num_subscribers,
4636 num_channels = num_channels)
4637
Thangavelu K S6432b522017-07-22 00:05:54 +00004638 def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004639 """
4640 Test Method:
4641 0. Make sure that voltha is up and running on CORD-POD setup.
4642 1. OLT and ONU is detected and validated.
4643 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4644 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4645 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4646 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4647 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4648 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA
4649 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4650 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4651 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004652
4653 num_subscribers = 1
4654 num_channels = 1
4655 services = ('IGMP')
4656 cbs = (self.igmp_flow_check_join_change_to_block, None, None)
4657 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4658 num_subscribers = num_subscribers,
4659 num_channels = num_channels)
4660
Thangavelu K S6432b522017-07-22 00:05:54 +00004661 def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004662 """
4663 Test Method:
4664 0. Make sure that voltha is up and running on CORD-POD setup.
4665 1. OLT and ONU is detected and validated.
4666 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4667 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4668 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4669 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4670 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4671 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB
4672 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4673 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4674 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004675
4676 num_subscribers = 1
4677 num_channels = 1
4678 services = ('IGMP')
4679 cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None)
4680 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4681 num_subscribers = num_subscribers,
4682 num_channels = num_channels)
4683
Thangavelu K S6432b522017-07-22 00:05:54 +00004684 def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004685 """
4686 Test Method:
4687 0. Make sure that voltha is up and running on CORD-POD setup.
4688 1. OLT and ONU is detected and validated.
4689 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4690 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4691 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4692 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4693 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4694 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4695 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4696 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004697
4698 num_subscribers = 1
4699 num_channels = 1
4700 services = ('IGMP')
4701 cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None)
4702 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4703 num_subscribers = num_subscribers,
4704 num_channels = num_channels)
4705
Thangavelu K S6432b522017-07-22 00:05:54 +00004706 def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004707 """
4708 Test Method:
4709 0. Make sure that voltha is up and running on CORD-POD setup.
4710 1. OLT and ONU is detected and validated.
4711 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4712 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4713 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4714 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4715 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4716 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4717 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4718 """
4719
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004720 num_subscribers = 1
4721 num_channels = 1
4722 services = ('IGMP')
4723 cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None)
4724 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4725 num_subscribers = num_subscribers,
4726 num_channels = num_channels)
4727
Thangavelu K S6432b522017-07-22 00:05:54 +00004728 def test_two_subscribers_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004729 """
4730 Test Method:
4731 0. Make sure that voltha is up and running on CORD-POD setup.
4732 1. OLT and ONU is detected and validated.
4733 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4734 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4735 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4736 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4737 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4738 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4739 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4740 """
4741
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004742 num_subscribers = 2
4743 num_channels = 1
4744 services = ('IGMP')
4745 cbs = (self.igmp_flow_check, None, None)
4746 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'],
4747 num_subscribers = num_subscribers,
4748 num_channels = num_channels)
4749
Thangavelu K S36edb012017-07-05 18:24:12 +00004750 def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self):
4751 """
4752 Test Method:
4753 0. Make sure that voltha is up and running on CORD-POD setup.
4754 1. OLT and ONU is detected and validated.
4755 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4756 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4757 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4758 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4759 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4760 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4761 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4762 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4763 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4764 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4765 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004766 num_subscribers = 2
4767 num_channels = 2
4768 services = ('IGMP')
4769 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4770 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'],
4771 num_subscribers = num_subscribers,
4772 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004773
Thangavelu K S6432b522017-07-22 00:05:54 +00004774 def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004775 """
4776 Test Method:
4777 0. Make sure that voltha is up and running on CORD-POD setup.
4778 1. OLT and ONU is detected and validated.
4779 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4780 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4781 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4782 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4783 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4784 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.
4785 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.
4786 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4787 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.
4788 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.
4789 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.
4790 """
4791
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004792 num_subscribers = 2
4793 num_channels = 2
4794 services = ('IGMP')
4795 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4796 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'],
4797 num_subscribers = num_subscribers,
4798 num_channels = num_channels)
4799
4800 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00004801 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 +00004802 """
4803 Test Method:
4804 0. Make sure that voltha is up and running on CORD-POD setup.
4805 1. OLT and ONU is detected and validated.
4806 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4807 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4808 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4809 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4810 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4811 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4812 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4813 9. Disable uni_2 port which is being shown on voltha CLI.
4814 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4815 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4816 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004817 #rx_port = self.port_map['ports'][port_list[i][1]]
4818 df = defer.Deferred()
4819 def igmp_flow_check_operating_onu_admin_state(df):
4820 num_subscribers = 2
4821 num_channels = 2
4822 services = ('IGMP')
4823 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
4824 port_list = self.generate_port_list(num_subscribers, num_channels)
4825
4826 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4827 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
4828 thread1.start()
4829 time.sleep(randint(40,50))
4830 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
4831 thread2.start()
4832 time.sleep(10)
4833 thread1.join()
4834 thread2.join()
4835 try:
4836 assert_equal(self.success, False)
4837 log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check')
4838 time.sleep(10)
4839 finally:
4840 pass
4841 df.callback(0)
4842 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
4843 return df
4844
4845 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00004846 def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self):
4847 """
4848 Test Method:
4849 0. Make sure that voltha is up and running on CORD-POD setup.
4850 1. OLT and ONU is detected and validated.
4851 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4852 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4853 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4854 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4855 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4856 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4857 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4858 9. Disable uni_2 port which is being shown on voltha CLI.
4859 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4860 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4861 12. Enable uni_2 port which we disable at step 9.
4862 13. Repeat step 5,6 and 8.
4863 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004864 df = defer.Deferred()
4865 def igmp_flow_check_operating_onu_admin_state(df):
4866 num_subscribers = 2
4867 num_channels = 2
4868 services = ('IGMP')
4869 cbs = (self.igmp_flow_check, None, None)
4870 port_list = self.generate_port_list(num_subscribers, num_channels)
4871
4872 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4873 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
4874 thread1.start()
4875 time.sleep(randint(50,60))
4876 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
4877 thread2.start()
4878 time.sleep(10)
4879 thread1.join()
4880 thread2.join()
4881 try:
4882 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00004883 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 +00004884 time.sleep(10)
4885 finally:
4886 pass
4887 df.callback(0)
4888 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
4889 return df
4890
4891 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00004892 def test_two_subscribers_with_voltha_for_igmp_disabling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004893 """
4894 Test Method:
4895 0. Make sure that voltha is up and running on CORD-POD setup.
4896 1. OLT and ONU is detected and validated.
4897 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4898 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4899 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4900 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4901 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4902 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4903 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4904 9. Disable olt device which is being shown on voltha CLI.
4905 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4906 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4907 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004908 df = defer.Deferred()
4909 def igmp_flow_check_operating_olt_admin_disble(df):
4910 num_subscribers = 2
4911 num_channels = 2
4912 services = ('IGMP')
4913 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
4914 port_list = self.generate_port_list(num_subscribers, num_channels)
4915
4916 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4917 thread1.start()
4918 time.sleep(randint(50,60))
4919 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
4920 thread2.start()
4921 time.sleep(10)
4922 thread1.join()
4923 thread2.join()
4924 try:
4925 assert_equal(self.success, False)
4926 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
4927 time.sleep(10)
4928 finally:
4929 pass
4930 df.callback(0)
4931 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
4932 return df
4933
4934 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00004935 def test_two_subscribers_with_voltha_for_igmp_pausing_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004936 """
4937 Test Method:
4938 0. Make sure that voltha is up and running on CORD-POD setup.
4939 1. OLT and ONU is detected and validated.
4940 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4941 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4942 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4943 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4944 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4945 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4946 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4947 9. Pause olt device which is being shown on voltha CLI.
4948 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4949 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4950 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004951 df = defer.Deferred()
4952 def igmp_flow_check_operating_olt_admin_pause(df):
4953 num_subscribers = 2
4954 num_channels = 2
4955 services = ('IGMP')
4956 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
4957 port_list = self.generate_port_list(num_subscribers, num_channels)
4958
4959 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4960 thread1.start()
4961 time.sleep(randint(50,60))
4962 thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,))
4963 thread2.start()
4964 time.sleep(10)
4965 thread1.join()
4966 thread2.join()
4967 try:
4968 assert_equal(self.success, False)
4969 log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test')
4970 time.sleep(10)
4971 finally:
4972 pass
4973 df.callback(0)
4974 reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df)
4975 return df
4976
4977 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00004978 def test_two_subscribers_with_voltha_for_igmp_toggling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004979 """
4980 Test Method:
4981 0. Make sure that voltha is up and running on CORD-POD setup.
4982 1. OLT and ONU is detected and validated.
4983 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4984 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4985 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4986 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4987 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4988 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4989 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4990 9. Disable olt device which is being shown on voltha CLI.
4991 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4992 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4993 12. Enable olt device which is disable at step 9.
4994 13. Repeat steps 4,5, 7 and 8.
4995 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004996 df = defer.Deferred()
4997 def igmp_flow_check_operating_olt_admin_restart(df):
4998 num_subscribers = 2
4999 num_channels = 2
5000 services = ('IGMP')
5001 cbs = (self.igmp_flow_check, None, None)
5002 port_list = self.generate_port_list(num_subscribers, num_channels)
5003
5004 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5005 thread1.start()
5006 time.sleep(randint(50,60))
5007 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5008 thread2.start()
5009 time.sleep(10)
5010 thread1.join()
5011 thread2.join()
5012 try:
5013 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005014 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 +00005015 time.sleep(10)
5016 finally:
5017 pass
5018 df.callback(0)
5019 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5020 return df
Thangavelu K S6432b522017-07-22 00:05:54 +00005021
5022 @deferred(TESTCASE_TIMEOUT)
5023 def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self):
5024 """
5025 Test Method:
5026 0. Make sure that voltha is up and running on CORD-POD setup.
5027 1. OLT and ONU is detected and validated.
5028 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5029 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5030 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5031 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5032 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5033 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5034 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5035 9. Disable olt device which is being shown on voltha CLI.
5036 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5037 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5038 12. Repeat steps 4 to 11 steps multiple times (example 20 times)
5039 """
5040 df = defer.Deferred()
5041 no_iterations = 20
5042 def igmp_flow_check_operating_olt_admin_disble(df):
5043 num_subscribers = 2
5044 num_channels = 2
5045 services = ('IGMP')
5046 cbs = (self.igmp_flow_check, None, None)
5047 port_list = self.generate_port_list(num_subscribers, num_channels)
5048
5049 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5050 thread1.start()
5051 time.sleep(randint(30,40))
5052 for i in range(no_iterations):
5053 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5054 thread2.start()
5055 time.sleep(8)
5056 thread2.join()
5057 thread1.join()
5058 thread1.isAlive()
5059 thread2.join()
5060 try:
5061 assert_equal(self.success, False)
5062 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5063 time.sleep(10)
5064 finally:
5065 pass
5066 df.callback(0)
5067 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5068 return df
5069
5070 @deferred(TESTCASE_TIMEOUT + 200)
5071 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self):
5072 """
5073 Test Method:
5074 0. Make sure that voltha is up and running on CORD-POD setup.
5075 1. OLT and ONU is detected and validated.
5076 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5077 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5078 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5079 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5080 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5081 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5082 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5083 9. Disable uni_2 port which is being shown on voltha CLI.
5084 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5085 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5086 12. Enable uni_2 port which we disable at step 9.
5087 13. Repeat step 5,6 and 8.
5088 14. Repeat steps 4 to 13 steps multiple times (example 5 times)
5089 """
5090 df = defer.Deferred()
5091 no_iterations = 5
5092 def igmp_flow_check_operating_onu_admin_state(df):
5093 num_subscribers = 2
5094 num_channels = 2
5095 services = ('IGMP')
5096 cbs = (self.igmp_flow_check, None, None)
5097 port_list = self.generate_port_list(num_subscribers, num_channels)
5098
5099 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5100 thread1.start()
5101 time.sleep(randint(40,60))
5102 for i in range(no_iterations):
5103 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5104 log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha')
5105 thread2.start()
5106 time.sleep(1)
5107 thread2.join()
5108 thread1.isAlive()
5109 thread1.join()
5110 thread2.join()
5111 try:
5112 assert_equal(self.success, True)
5113 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful')
5114 time.sleep(10)
5115 finally:
5116 pass
5117 df.callback(0)
5118 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5119 return df
5120
5121 @deferred(TESTCASE_TIMEOUT)
5122 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self):
5123 """
5124 Test Method:
5125 0. Make sure that voltha is up and running on CORD-POD setup.
5126 1. OLT and ONU is detected and validated.
5127 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5128 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5129 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5130 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5131 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5132 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5133 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5134 9. Disable olt device which is being shown on voltha CLI.
5135 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5136 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5137 12. Enable olt device which is disable at step 9.
5138 13. Repeat steps 4,5, 7 and 8.
5139 14. Repeat steps 4 to 13 steps multiple times (example 10 times)
5140 """
5141 df = defer.Deferred()
5142 no_iterations = 10
5143 def igmp_flow_check_operating_olt_admin_restart(df):
5144 num_subscribers = 2
5145 num_channels = 2
5146 services = ('IGMP')
5147 cbs = (self.igmp_flow_check, None, None)
5148 port_list = self.generate_port_list(num_subscribers, num_channels)
5149
5150 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5151 thread1.start()
5152 time.sleep(randint(50,60))
5153 for i in range(no_iterations):
5154 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5155 thread2.start()
5156 time.sleep(10)
5157 thread2.join()
5158 thread1.join()
5159 thread2.join()
5160 try:
5161 assert_equal(self.success, True)
5162 log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful')
5163 time.sleep(10)
5164 finally:
5165 pass
5166 df.callback(0)
5167 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5168 return df
5169
5170 def test_5_subscriber_with_voltha_for_igmp_with_10_group_joins_verifying_traffic(self):
5171 """
5172 Test Method:
5173 0. Make sure that voltha is up and running on CORD-POD setup.
5174 1. OLT and ONU is detected and validated.
5175 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5176 3. Issue multiple dhcp client packets to get IP address from dhcp server for as subscribers and check connectivity.
5177 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5178 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5179 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5180 """
5181
5182 num_subscribers = 5
5183 num_channels = 10
5184 services = ('IGMP')
5185 cbs = (self.igmp_flow_check, None, None)
5186 self.voltha_subscribers(services, cbs = cbs,
5187 num_subscribers = num_subscribers,
5188 num_channels = num_channels)
5189
5190 def test_9_subscriber_with_voltha_for_igmp_with_10_group_joins_and_verify_traffic(self):
5191 """
5192 Test Method:
5193 0. Make sure that voltha is up and running on CORD-POD setup.
5194 1. OLT and ONU is detected and validated.
5195 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5196 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity.
5197 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5198 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5199 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5200 """
5201 num_subscribers = 9
5202 num_channels = 10
5203 services = ('IGMP')
5204 cbs = (self.igmp_flow_check, None, None)
5205 self.voltha_subscribers(services, cbs = cbs,
5206 num_subscribers = num_subscribers,
5207 num_channels = num_channels)