blob: c35e95f43b0108a35455659fae4f97ae8c1f4fbf [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
A R Karthickcaa1b6a2017-07-27 14:07:05 -070017from VolthaCtrl import VolthaCtrl, voltha_setup, voltha_teardown
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 """
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001407 ret = voltha_setup(
1408 host = self.VOLTHA_HOST,
1409 rest_port = self.VOLTHA_REST_PORT,
1410 olt_type = 'ponsim_olt',
1411 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP,
1412 uplink_vlan_start = self.VOLTHA_UPLINK_VLAN_START,
1413 config_fake = self.VOLTHA_CONFIG_FAKE,
1414 olt_app = self.olt_app_file)
1415 assert_not_equal(ret, None)
1416 voltha, device_id, switch_map = ret[0], ret[1], ret[2]
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001417 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001418 log_test.info('Adding subscribers through OLT app')
1419 self.config_olt(switch_map)
1420 olt_configured = True
1421 time.sleep(5)
1422 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001423 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001424 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001425 if switch_map is not None:
1426 if olt_configured is True:
1427 self.remove_olt(switch_map)
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001428 voltha_teardown(voltha, device_id, switch_map, olt_app = self.olt_app_file)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001429
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001430 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001431 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
1432 """
1433 Test Method:
1434 0. Make sure that voltha is up and running on CORD-POD setup.
1435 1. OLT and ONU is detected and validated.
1436 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1437 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1438 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
1439 5. Verify that subscriber authentication is unsuccessful..
1440 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001441 df = defer.Deferred()
1442 def tls_flow_check_with_no_cert_scenario(df):
1443 log_test.info('Enabling ponsim_olt')
1444 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1445 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1446 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001447 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001448 time.sleep(10)
1449 switch_map = None
1450 olt_configured = False
1451 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1452 log_test.info('Installing OLT app')
1453 OnosCtrl.install_app(self.olt_app_file)
1454 time.sleep(5)
1455 log_test.info('Adding subscribers through OLT app')
1456 self.config_olt(switch_map)
1457 olt_configured = True
1458 time.sleep(5)
1459 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1460 try:
1461 assert_equal(auth_status, True)
1462 assert_equal(status, True)
1463 time.sleep(10)
1464 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001465 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001466 self.voltha.disable_device(device_id, delete = True)
1467 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001468
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001469 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1470 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001471
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001472 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001473 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
1474 """
1475 Test Method:
1476 0. Make sure that voltha is up and running on CORD-POD setup.
1477 1. OLT and ONU is detected and validated.
1478 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1479 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
1480 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1481 5. Verify that subscriber authentication is unsuccessful..
1482 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001483 df = defer.Deferred()
1484 def tls_flow_check_with_invalid_cert_scenario(df):
1485 log_test.info('Enabling ponsim_olt')
1486 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1487 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1488 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001489 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001490 time.sleep(10)
1491 switch_map = None
1492 olt_configured = False
1493 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1494 log_test.info('Installing OLT app')
1495 OnosCtrl.install_app(self.olt_app_file)
1496 time.sleep(5)
1497 log_test.info('Adding subscribers through OLT app')
1498 self.config_olt(switch_map)
1499 olt_configured = True
1500 time.sleep(5)
1501 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1502 try:
1503 assert_equal(auth_status, True)
1504 assert_equal(status, True)
1505 time.sleep(10)
1506 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001507 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001508 self.voltha.disable_device(device_id, delete = True)
1509 df.callback(0)
1510 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
1511 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001512
Thangavelu K S0d745c82017-06-09 21:56:08 +00001513 @deferred(TESTCASE_TIMEOUT)
1514 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
1515 """
1516 Test Method:
1517 0. Make sure that voltha is up and running on CORD-POD setup.
1518 1. OLT and ONU is detected and validated.
1519 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1520 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
1521 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1522 5. Verify that subscriber authentication is unsuccessful..
1523 """
1524 df = defer.Deferred()
1525 def tls_flow_check_with_no_cert_scenario(df):
1526 log_test.info('Enabling ponsim_olt')
1527 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1528 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1529 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001530 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001531 time.sleep(10)
1532 switch_map = None
1533 olt_configured = False
1534 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1535 log_test.info('Installing OLT app')
1536 OnosCtrl.install_app(self.olt_app_file)
1537 time.sleep(5)
1538 log_test.info('Adding subscribers through OLT app')
1539 self.config_olt(switch_map)
1540 olt_configured = True
1541 time.sleep(5)
1542 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1543 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1544 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1545 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1546 try:
1547 assert_equal(auth_status, True)
1548 assert_equal(status, True)
1549 time.sleep(10)
1550 finally:
1551 self.voltha.disable_device(device_id, delete = True)
1552 df.callback(0)
1553 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1554 return df
1555
1556 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001557 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
1558 """
1559 Test Method:
1560 0. Make sure that voltha is up and running on CORD-POD setup.
1561 1. OLT and ONU is detected and validated.
1562 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1563 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1564 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
1565 5. Verify that subscriber authentication is unsuccessful..
1566 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001567 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001568 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001569 aaa_app = ["org.opencord.aaa"]
1570 log_test.info('Enabling ponsim_olt')
1571 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1572 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1573 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001574 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001575 time.sleep(10)
1576 switch_map = None
1577 olt_configured = False
1578 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1579 log_test.info('Installing OLT app')
1580 OnosCtrl.install_app(self.olt_app_file)
1581 time.sleep(5)
1582 log_test.info('Adding subscribers through OLT app')
1583 self.config_olt(switch_map)
1584 olt_configured = True
1585 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001586
Thangavelu K S0d745c82017-06-09 21:56:08 +00001587 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
1588 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
1589 thread1.start()
1590 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001591 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001592 thread2.start()
1593 time.sleep(10)
1594 thread1.join()
1595 thread2.join()
1596 try:
1597 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001598 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001599 time.sleep(10)
1600 finally:
1601 self.voltha.disable_device(device_id, delete = True)
1602 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001603 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001604 return df
1605
1606 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001607 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
1608 """
1609 Test Method:
1610 0. Make sure that voltha is up and running on CORD-POD setup.
1611 1. OLT and ONU is detected and validated.
1612 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1613 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1614 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
1615 5. Verify that subscriber authentication is unsuccessful..
1616 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001617 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001618 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001619 aaa_app = ["org.opencord.aaa"]
1620 log_test.info('Enabling ponsim_olt')
1621 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1622 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1623 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001624 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001625 time.sleep(10)
1626 switch_map = None
1627 olt_configured = False
1628 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1629 log_test.info('Installing OLT app')
1630 OnosCtrl.install_app(self.olt_app_file)
1631 time.sleep(5)
1632 log_test.info('Adding subscribers through OLT app')
1633 self.config_olt(switch_map)
1634 olt_configured = True
1635 time.sleep(5)
1636
1637 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
1638 thread2 = threading.Thread(target = cord_test_radius_restart)
1639 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001640 time.sleep(randint(1,2))
1641 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001642 thread2.start()
1643 time.sleep(10)
1644 thread1.join()
1645 thread2.join()
1646 try:
1647 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001648 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001649 time.sleep(10)
1650 finally:
1651 self.voltha.disable_device(device_id, delete = True)
1652 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001653 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001654 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001655
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001656 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001657 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
1658 """
1659 Test Method:
1660 0. Make sure that voltha is up and running on CORD-POD setup.
1661 1. OLT and ONU is detected and validated.
1662 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1663 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1664 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1665 6. Verify that subscriber authenticated successfully.
1666 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
1667 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1668 9. Verify that subscriber authentication is unsuccessful..
1669 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001670 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001671 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001672 aaa_app = ["org.opencord.aaa"]
1673 log_test.info('Enabling ponsim_olt')
1674 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1675 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1676 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001677 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001678 time.sleep(10)
1679 switch_map = None
1680 olt_configured = False
1681 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1682 log_test.info('Installing OLT app')
1683 OnosCtrl.install_app(self.olt_app_file)
1684 time.sleep(5)
1685 log_test.info('Adding subscribers through OLT app')
1686 self.config_olt(switch_map)
1687 olt_configured = True
1688 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001689
Thangavelu K S0d745c82017-06-09 21:56:08 +00001690 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001691 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +00001692 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001693 time.sleep(randint(1,2))
1694 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001695 thread2.start()
1696 time.sleep(10)
1697 thread1.join()
1698 thread2.join()
1699 try:
1700 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001701 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001702 time.sleep(10)
1703 finally:
1704 self.voltha.disable_device(device_id, delete = True)
1705 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001706 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001707 return df
1708
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001709 @deferred(TESTCASE_TIMEOUT)
1710 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001711 """
1712 Test Method:
1713 0. Make sure that voltha is up and running on CORD-POD setup.
1714 1. OLT and ONU is detected and validated.
1715 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1716 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1717 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1718 6. Verify that subscriber authenticated successfully.
1719 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1720 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1721 9. Verify that subscriber authentication is unsuccessful..
1722 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001723 df = defer.Deferred()
1724 def tls_flow_check_operating_olt_state(df):
1725 aaa_app = ["org.opencord.aaa"]
1726 log_test.info('Enabling ponsim_olt')
1727 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1728 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1729 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001730 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001731 time.sleep(10)
1732 switch_map = None
1733 olt_configured = False
1734 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1735 log_test.info('Installing OLT app')
1736 OnosCtrl.install_app(self.olt_app_file)
1737 time.sleep(5)
1738 log_test.info('Adding subscribers through OLT app')
1739 self.config_olt(switch_map)
1740 olt_configured = True
1741 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001742
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001743 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1744 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
1745 thread1.start()
1746 time.sleep(randint(1,2))
1747 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1748 thread2.start()
1749 time.sleep(10)
1750 thread1.join()
1751 thread2.join()
1752 try:
1753 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001754 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001755 time.sleep(10)
1756 finally:
1757 self.voltha.disable_device(device_id, delete = True)
1758 df.callback(0)
1759 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1760 return df
1761
1762 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001763 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self):
1764 """
1765 Test Method:
1766 0. Make sure that voltha is up and running on CORD-POD setup.
1767 1. OLT and ONU is detected and validated.
1768 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1769 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1770 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1771 6. Verify that subscriber authenticated successfully.
1772 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1773 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1774 9. Verify that subscriber authentication is unsuccessful..
1775 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1776
1777 """
1778 df = defer.Deferred()
1779 no_iterations = 10
1780 def tls_flow_check_with_disable_olt_device_scenario(df):
1781 aaa_app = ["org.opencord.aaa"]
1782 log_test.info('Enabling ponsim_olt')
1783 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1784 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1785 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001786 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001787 time.sleep(10)
1788 switch_map = None
1789 olt_configured = False
1790 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1791 log_test.info('Installing OLT app')
1792 OnosCtrl.install_app(self.olt_app_file)
1793 time.sleep(5)
1794 log_test.info('Adding subscribers through OLT app')
1795 self.config_olt(switch_map)
1796 olt_configured = True
1797 time.sleep(5)
1798 for i in range(no_iterations):
1799 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1800 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
1801 thread1.start()
1802 time.sleep(randint(1,2))
1803 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1804 thread2.start()
1805 time.sleep(10)
1806 thread1.join()
1807 thread2.join()
1808 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
1809 try:
1810 # assert_equal(status, True)
1811 assert_equal(auth_status, True)
1812 assert_equal(self.success, True)
1813 time.sleep(10)
1814 finally:
1815 self.voltha.disable_device(device_id, delete = True)
1816 df.callback(0)
1817 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
1818 return df
1819
1820 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001821 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
1822 """
1823 Test Method:
1824 0. Make sure that voltha is up and running on CORD-POD setup.
1825 1. OLT and ONU is detected and validated.
1826 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1827 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1828 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1829 6. Verify that subscriber authenticated successfully.
1830 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
1831 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1832 9. Verify that subscriber authentication is unsuccessful..
1833 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001834 df = defer.Deferred()
1835 def tls_flow_check_operating_olt_state(df):
1836 aaa_app = ["org.opencord.aaa"]
1837 log_test.info('Enabling ponsim_olt')
1838 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1839 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1840 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001841 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001842 time.sleep(10)
1843 switch_map = None
1844 olt_configured = False
1845 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1846 log_test.info('Installing OLT app')
1847 OnosCtrl.install_app(self.olt_app_file)
1848 time.sleep(5)
1849 log_test.info('Adding subscribers through OLT app')
1850 self.config_olt(switch_map)
1851 olt_configured = True
1852 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001853
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001854 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
1855 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
1856 thread1.start()
1857 time.sleep(randint(1,2))
1858 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
1859 thread2.start()
1860 time.sleep(10)
1861 thread1.join()
1862 thread2.join()
1863 try:
1864 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001865 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001866 time.sleep(10)
1867 finally:
1868 self.voltha.disable_device(device_id, delete = True)
1869 df.callback(0)
1870 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1871 return df
1872
1873 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00001874 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self):
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001875 """
1876 Test Method:
1877 0. Make sure that voltha is up and running on CORD-POD setup.
1878 1. OLT and ONU is detected and validated.
1879 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1880 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1881 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1882 6. Verify that subscriber authenticated successfully.
1883 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
1884 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1885 9. Verify that subscriber authentication is unsuccessful..
1886 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1887 """
1888 df = defer.Deferred()
1889 no_iterations = 10
1890 def tls_flow_check_with_disable_olt_device_scenario(df):
1891 aaa_app = ["org.opencord.aaa"]
1892 log_test.info('Enabling ponsim_olt')
1893 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1894 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1895 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001896 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001897 time.sleep(10)
1898 switch_map = None
1899 olt_configured = False
1900 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1901 log_test.info('Installing OLT app')
1902 OnosCtrl.install_app(self.olt_app_file)
1903 time.sleep(5)
1904 log_test.info('Adding subscribers through OLT app')
1905 self.config_olt(switch_map)
1906 olt_configured = True
1907 time.sleep(5)
1908 for i in range(no_iterations):
1909 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
1910 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
1911 thread1.start()
1912 time.sleep(randint(1,2))
1913 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
1914 thread2.start()
1915 time.sleep(10)
1916 thread1.join()
1917 thread2.join()
1918 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
1919 try:
1920 # assert_equal(status, True)
1921 assert_equal(auth_status, True)
1922 assert_equal(self.success, True)
1923 time.sleep(10)
1924 finally:
1925 self.voltha.disable_device(device_id, delete = True)
1926 df.callback(0)
1927 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
1928 return df
1929
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001930 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001931 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
1932 """
1933 Test Method:
1934 0. Make sure that voltha is up and running on CORD-POD setup.
1935 1. OLT and ONU is detected and validated.
1936 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1937 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1938 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1939 6. Verify that subscriber authenticated successfully.
1940 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
1941 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1942 9. Verify that subscriber authentication is unsuccessful..
1943 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001944 df = defer.Deferred()
1945 def tls_flow_check_operating_olt_state(df):
1946 aaa_app = ["org.opencord.aaa"]
1947 log_test.info('Enabling ponsim_olt')
1948 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1949 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1950 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00001951 log_test.info('All available devices on voltha = %s'%devices_list['items'])
1952
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001953 onu_device_id = devices_list['items'][1]['id']
1954 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001955 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001956 time.sleep(10)
1957 switch_map = None
1958 olt_configured = False
1959 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1960 log_test.info('Installing OLT app')
1961 OnosCtrl.install_app(self.olt_app_file)
1962 time.sleep(5)
1963 log_test.info('Adding subscribers through OLT app')
1964 self.config_olt(switch_map)
1965 olt_configured = True
1966 time.sleep(5)
1967 devices_list = self.voltha.get_devices()
1968 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
1969 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
1970 thread1.start()
1971 time.sleep(randint(1,2))
1972 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
1973 thread2.start()
1974 time.sleep(10)
1975 thread1.join()
1976 thread2.join()
1977 try:
1978 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001979 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001980 time.sleep(10)
1981 finally:
1982 self.voltha.disable_device(device_id, delete = True)
1983 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001984 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001985 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001986
Thangavelu K S9648eed2017-06-13 20:15:25 +00001987 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001988 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
1989 """
1990 Test Method:
1991 0. Make sure that voltha is up and running on CORD-POD setup.
1992 1. OLT and ONU is detected and validated.
1993 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1994 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1995 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1996 6. Verify that subscriber authenticated successfully.
1997 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
1998 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1999 9. Verify that subscriber authentication is unsuccessful..
2000 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2001 """
2002 df = defer.Deferred()
2003 no_iterations = 10
2004 def tls_flow_check_operating_olt_state(df):
2005 aaa_app = ["org.opencord.aaa"]
2006 log_test.info('Enabling ponsim_olt')
2007 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2008 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2009 devices_list = self.voltha.get_devices()
2010 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2011
2012 onu_device_id = devices_list['items'][1]['id']
2013 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002014 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002015 time.sleep(10)
2016 switch_map = None
2017 olt_configured = False
2018 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2019 log_test.info('Installing OLT app')
2020 OnosCtrl.install_app(self.olt_app_file)
2021 time.sleep(5)
2022 log_test.info('Adding subscribers through OLT app')
2023 self.config_olt(switch_map)
2024 olt_configured = True
2025 time.sleep(5)
2026 devices_list = self.voltha.get_devices()
2027 for i in range(no_iterations):
2028 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2029 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2030 thread1.start()
2031 time.sleep(randint(1,2))
2032 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2033 thread2.start()
2034 time.sleep(10)
2035 thread1.join()
2036 thread2.join()
2037 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2038 try:
2039 # assert_equal(status, True)
2040 assert_equal(auth_status, True)
2041 assert_equal(self.success, True)
2042 time.sleep(10)
2043 finally:
2044 self.voltha.disable_device(device_id, delete = True)
2045 df.callback(0)
2046 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2047 return df
2048
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002049 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002050 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002051 """
2052 Test Method:
2053 0. Make sure that voltha is up and running on CORD-POD setup.
2054 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2055 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2056 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2057 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
2058 5. Verify that two subscribers are authenticated successfully.
2059 """
2060
Thangavelu K S9648eed2017-06-13 20:15:25 +00002061 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002062 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002063 aaa_app = ["org.opencord.aaa"]
2064 log_test.info('Enabling ponsim_olt')
2065 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2066 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2067 devices_list = self.voltha.get_devices()
2068 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2069
2070 onu_device_id = devices_list['items'][1]['id']
2071 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002072 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002073 time.sleep(10)
2074 switch_map = None
2075 olt_configured = False
2076 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2077 log_test.info('Installing OLT app')
2078 OnosCtrl.install_app(self.olt_app_file)
2079 time.sleep(5)
2080 log_test.info('Adding subscribers through OLT app')
2081 self.config_olt(switch_map)
2082 olt_configured = True
2083 time.sleep(5)
2084 devices_list = self.voltha.get_devices()
2085 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2086 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2087 thread1.start()
2088 time.sleep(randint(1,2))
2089 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2090 thread2.start()
2091 time.sleep(10)
2092 thread1.join()
2093 thread2.join()
2094 try:
2095 # assert_equal(status, True)
2096 assert_equal(self.success, True)
2097 time.sleep(10)
2098 finally:
2099 self.voltha.disable_device(device_id, delete = True)
2100 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002101 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002102 return df
2103
2104 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002105 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002106 """
2107 Test Method:
2108 0. Make sure that voltha is up and running on CORD-POD setup.
2109 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2110 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2111 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2112 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
2113 5. Verify that two subscribers are not authenticated.
2114 """
2115
Thangavelu K S9648eed2017-06-13 20:15:25 +00002116 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002117 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002118 aaa_app = ["org.opencord.aaa"]
2119 log_test.info('Enabling ponsim_olt')
2120 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2121 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2122 devices_list = self.voltha.get_devices()
2123 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2124
2125 onu_device_id = devices_list['items'][1]['id']
2126 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002127 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002128 time.sleep(10)
2129 switch_map = None
2130 olt_configured = False
2131 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2132 log_test.info('Installing OLT app')
2133 OnosCtrl.install_app(self.olt_app_file)
2134 time.sleep(5)
2135 log_test.info('Adding subscribers through OLT app')
2136 self.config_olt(switch_map)
2137 olt_configured = True
2138 time.sleep(5)
2139 devices_list = self.voltha.get_devices()
2140 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2141 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
2142 thread1.start()
2143 time.sleep(randint(1,2))
2144 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2145 thread2.start()
2146 time.sleep(10)
2147 thread1.join()
2148 thread2.join()
2149 try:
2150 # assert_equal(status, True)
2151 assert_equal(self.success, True)
2152 time.sleep(10)
2153 finally:
2154 self.voltha.disable_device(device_id, delete = True)
2155 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002156 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002157 return df
2158
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002159 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002160 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 +00002161 """
2162 Test Method:
2163 0. Make sure that voltha is up and running on CORD-POD setup.
2164 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2165 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2166 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2167 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2168 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
2169 6. Verify that valid subscriber authenticated successfully.
2170 7. Verify that invalid subscriber are not authenticated successfully.
2171 """
2172
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002173 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002174 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002175 aaa_app = ["org.opencord.aaa"]
2176 log_test.info('Enabling ponsim_olt')
2177 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2178 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2179 devices_list = self.voltha.get_devices()
2180 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2181
2182 onu_device_id = devices_list['items'][1]['id']
2183 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002184 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002185 time.sleep(10)
2186 switch_map = None
2187 olt_configured = False
2188 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2189 log_test.info('Installing OLT app')
2190 OnosCtrl.install_app(self.olt_app_file)
2191 time.sleep(5)
2192 log_test.info('Adding subscribers through OLT app')
2193 self.config_olt(switch_map)
2194 olt_configured = True
2195 time.sleep(5)
2196 devices_list = self.voltha.get_devices()
2197 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2198 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
2199 thread1.start()
2200 time.sleep(randint(1,2))
2201 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2202 thread2.start()
2203 time.sleep(10)
2204 thread1.join()
2205 thread2.join()
2206 try:
2207 # assert_equal(status, True)
2208 assert_equal(self.success, True)
2209 time.sleep(10)
2210 finally:
2211 self.voltha.disable_device(device_id, delete = True)
2212 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002213 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002214 return df
2215
2216 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002217 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 +00002218 """
2219 Test Method:
2220 0. Make sure that voltha is up and running on CORD-POD setup.
2221 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2222 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2223 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2224 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2225 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
2226 6. Verify that valid subscriber authenticated successfully.
2227 7. Verify that invalid subscriber are not authenticated successfully.
2228 """
2229
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002230 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002231 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002232 aaa_app = ["org.opencord.aaa"]
2233 log_test.info('Enabling ponsim_olt')
2234 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2235 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2236 devices_list = self.voltha.get_devices()
2237 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2238
2239 onu_device_id = devices_list['items'][1]['id']
2240 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002241 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002242 time.sleep(10)
2243 switch_map = None
2244 olt_configured = False
2245 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2246 log_test.info('Installing OLT app')
2247 OnosCtrl.install_app(self.olt_app_file)
2248 time.sleep(5)
2249 log_test.info('Adding subscribers through OLT app')
2250 self.config_olt(switch_map)
2251 olt_configured = True
2252 time.sleep(5)
2253 devices_list = self.voltha.get_devices()
2254 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2255 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
2256 thread1.start()
2257 time.sleep(randint(1,2))
2258 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2259 thread2.start()
2260 time.sleep(10)
2261 thread1.join()
2262 thread2.join()
2263 try:
2264 # assert_equal(status, True)
2265 assert_equal(self.success, True)
2266 time.sleep(10)
2267 finally:
2268 self.voltha.disable_device(device_id, delete = True)
2269 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002270 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002271 return df
2272
2273 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002274 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002275 """
2276 Test Method:
2277 0. Make sure that voltha is up and running on CORD-POD setup.
2278 1. OLT and ONU is detected and validated.
2279 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2280 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2281 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
2282 6. Verify that subscriber authenticated successfully.
2283 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
2284 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
2285 9. Verify that subscriber authentication is unsuccessful..
2286 10. Verify that other subscriber authenticated successfully.
2287 """
2288
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002289 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002290 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002291 aaa_app = ["org.opencord.aaa"]
2292 log_test.info('Enabling ponsim_olt')
2293 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2294 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2295 devices_list = self.voltha.get_devices()
2296 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2297
2298 onu_device_id = devices_list['items'][1]['id']
2299 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002300 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002301 time.sleep(10)
2302 switch_map = None
2303 olt_configured = False
2304 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2305 log_test.info('Installing OLT app')
2306 OnosCtrl.install_app(self.olt_app_file)
2307 time.sleep(5)
2308 log_test.info('Adding subscribers through OLT app')
2309 self.config_olt(switch_map)
2310 olt_configured = True
2311 time.sleep(5)
2312 devices_list = self.voltha.get_devices()
2313 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2314 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
2315 thread1.start()
2316 time.sleep(randint(1,2))
2317 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2318 thread2.start()
2319 time.sleep(10)
2320 thread1.join()
2321 thread2.join()
2322 try:
2323 # assert_equal(status, True)
2324 assert_equal(self.success, True)
2325 time.sleep(10)
2326 finally:
2327 self.voltha.disable_device(device_id, delete = True)
2328 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002329 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002330 return df
2331
Thangavelu K S36edb012017-07-05 18:24:12 +00002332 def test_3_subscribers_with_voltha_for_eap_tls_authentication(self):
2333 """
2334 Test Method:
2335 0. Make sure that voltha is up and running on CORD-POD setup.
2336 1. OLT and ONU is detected and validated.
2337 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2338 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers)
2339 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2340 5. Verify that subscriber is authenticated successfully.
2341 """
2342 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2343 num_subscribers = 3
2344 num_channels = 1
2345 services = ('TLS')
2346 cbs = (self.tls_flow_check, None, None)
2347 self.voltha_subscribers(services, cbs = cbs,
2348 num_subscribers = num_subscribers,
2349 num_channels = num_channels)
2350
2351 def test_5_subscribers_with_voltha_for_eap_tls_authentication(self):
2352 """
2353 Test Method:
2354 0. Make sure that voltha is up and running on CORD-POD setup.
2355 1. OLT and ONU is detected and validated.
2356 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2357 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber)
2358 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2359 5. Verify that subscriber is authenticated successfully.
2360 """
2361 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2362 num_subscribers = 5
2363 num_channels = 1
2364 services = ('TLS')
2365 cbs = (self.tls_flow_check, None, None)
2366 self.voltha_subscribers(services, cbs = cbs,
2367 num_subscribers = num_subscribers,
2368 num_channels = num_channels)
2369
2370 def test_9_subscribers_with_voltha_for_eap_tls_authentication(self):
2371 """
2372 Test Method:
2373 0. Make sure that voltha is up and running on CORD-POD setup.
2374 1. OLT and ONU is detected and validated.
2375 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2376 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber)
2377 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2378 5. Verify that subscriber is authenticated successfully.
2379 """
2380 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2381 num_subscribers = 9
2382 num_channels = 1
2383 services = ('TLS')
2384 cbs = (self.tls_flow_check, None, None)
2385 self.voltha_subscribers(services, cbs = cbs,
2386 num_subscribers = num_subscribers,
2387 num_channels = num_channels)
2388
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002389 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002390 def test_subscriber_with_voltha_for_dhcp_request(self):
2391 """
2392 Test Method:
2393 0. Make sure that voltha is up and running on CORD-POD setup.
2394 1. OLT and ONU is detected and validated.
2395 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2396 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2397 4. Verify that subscriber get ip from dhcp server successfully.
2398 """
2399
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002400 df = defer.Deferred()
2401 def dhcp_flow_check_scenario(df):
2402 log_test.info('Enabling ponsim_olt')
2403 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2404 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2405 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002406 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002407 time.sleep(10)
2408 switch_map = None
2409 olt_configured = False
2410 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2411 log_test.info('Installing OLT app')
2412 OnosCtrl.install_app(self.olt_app_file)
2413 time.sleep(5)
2414 log_test.info('Adding subscribers through OLT app')
2415 self.config_olt(switch_map)
2416 olt_configured = True
2417 time.sleep(5)
2418 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2419 try:
2420 assert_equal(dhcp_status, True)
2421 #assert_equal(status, True)
2422 time.sleep(10)
2423 finally:
2424 self.remove_olt(switch_map)
2425 self.voltha.disable_device(device_id, delete = True)
2426 df.callback(0)
2427
2428 reactor.callLater(0, dhcp_flow_check_scenario, df)
2429 return df
2430
2431 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002432 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
2433 """
2434 Test Method:
2435 0. Make sure that voltha is up and running on CORD-POD setup.
2436 1. OLT and ONU is detected and validated.
2437 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2438 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
2439 4. Verify that subscriber should not get ip from dhcp server.
2440 """
2441
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002442 df = defer.Deferred()
2443 def dhcp_flow_check_scenario(df):
2444 log_test.info('Enabling ponsim_olt')
2445 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2446 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2447 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002448 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002449 time.sleep(10)
2450 switch_map = None
2451 olt_configured = False
2452 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2453 log_test.info('Installing OLT app')
2454 OnosCtrl.install_app(self.olt_app_file)
2455 time.sleep(5)
2456 log_test.info('Adding subscribers through OLT app')
2457 self.config_olt(switch_map)
2458 olt_configured = True
2459 time.sleep(5)
2460 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
2461 try:
2462 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002463 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002464 #assert_equal(status, True)
2465 time.sleep(10)
2466 finally:
2467 self.voltha.disable_device(device_id, delete = True)
2468 self.remove_olt(switch_map)
2469 df.callback(0)
2470
2471 reactor.callLater(0, dhcp_flow_check_scenario, df)
2472 return df
2473
2474
2475 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002476 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
2477 """
2478 Test Method:
2479 0. Make sure that voltha is up and running on CORD-POD setup.
2480 1. OLT and ONU is detected and validated.
2481 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2482 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
2483 4. Verify that subscriber should not get ip from dhcp server.
2484 """
2485
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002486 df = defer.Deferred()
2487 def dhcp_flow_check_scenario(df):
2488 log_test.info('Enabling ponsim_olt')
2489 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2490 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2491 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002492 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002493 time.sleep(10)
2494 switch_map = None
2495 olt_configured = False
2496 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2497 log_test.info('Installing OLT app')
2498 OnosCtrl.install_app(self.olt_app_file)
2499 time.sleep(5)
2500 log_test.info('Adding subscribers through OLT app')
2501 self.config_olt(switch_map)
2502 olt_configured = True
2503 time.sleep(5)
2504 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
2505 try:
2506 assert_equal(dhcp_status, True)
2507 #assert_equal(status, True)
2508 time.sleep(10)
2509 finally:
2510 self.voltha.disable_device(device_id, delete = True)
2511 self.remove_olt(switch_map)
2512 df.callback(0)
2513
2514 reactor.callLater(0, dhcp_flow_check_scenario, df)
2515 return df
2516
2517 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002518 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
2519 """
2520 Test Method:
2521 0. Make sure that voltha is up and running on CORD-POD setup.
2522 1. OLT and ONU is detected and validated.
2523 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2524 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
2525 4. Verify that subscriber should not get ip from dhcp server.
2526 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002527 df = defer.Deferred()
2528 def dhcp_flow_check_scenario(df):
2529 log_test.info('Enabling ponsim_olt')
2530 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2531 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2532 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002533 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002534 time.sleep(10)
2535 switch_map = None
2536 olt_configured = False
2537 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2538 log_test.info('Installing OLT app')
2539 OnosCtrl.install_app(self.olt_app_file)
2540 time.sleep(5)
2541 log_test.info('Adding subscribers through OLT app')
2542 self.config_olt(switch_map)
2543 olt_configured = True
2544 time.sleep(5)
2545 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
2546 try:
2547 assert_equal(dhcp_status, True)
2548 #assert_equal(status, True)
2549 time.sleep(10)
2550 finally:
2551 self.voltha.disable_device(device_id, delete = True)
2552 self.remove_olt(switch_map)
2553 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002554
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002555 reactor.callLater(0, dhcp_flow_check_scenario, df)
2556 return df
2557
2558 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002559 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
2560 """
2561 Test Method:
2562 0. Make sure that voltha is up and running on CORD-POD setup.
2563 1. OLT and ONU is detected and validated.
2564 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2565 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2566 4. Verify that subscriber get ip from dhcp server successfully.
2567 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
2568 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
2569 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002570 df = defer.Deferred()
2571 def dhcp_flow_check_scenario(df):
2572 log_test.info('Enabling ponsim_olt')
2573 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2574 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2575 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002576 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002577 time.sleep(10)
2578 switch_map = None
2579 olt_configured = False
2580 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2581 log_test.info('Installing OLT app')
2582 OnosCtrl.install_app(self.olt_app_file)
2583 time.sleep(5)
2584 log_test.info('Adding subscribers through OLT app')
2585 self.config_olt(switch_map)
2586 olt_configured = True
2587 time.sleep(5)
2588 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
2589 try:
2590 assert_equal(dhcp_status, True)
2591 #assert_equal(status, True)
2592 time.sleep(10)
2593 finally:
2594 self.voltha.disable_device(device_id, delete = True)
2595 self.remove_olt(switch_map)
2596 df.callback(0)
2597
2598 reactor.callLater(0, dhcp_flow_check_scenario, df)
2599 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002600
Thangavelu K S735a6662017-06-15 18:08:23 +00002601
2602 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07002603 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002604 """
2605 Test Method:
2606 0. Make sure that voltha is up and running on CORD-POD setup.
2607 1. OLT and ONU is detected and validated.
2608 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2609 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2610 4. Verify that subscriber get ip from dhcp server successfully.
2611 5. Repeat step 3 and 4 for 10 times.
2612 6 Verify that subscriber should get ip from dhcp server.
2613 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002614 df = defer.Deferred()
2615 def dhcp_flow_check_scenario(df):
2616 log_test.info('Enabling ponsim_olt')
2617 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2618 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2619 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002620 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002621 time.sleep(10)
2622 switch_map = None
2623 olt_configured = False
2624 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2625 log_test.info('Installing OLT app')
2626 OnosCtrl.install_app(self.olt_app_file)
2627 time.sleep(5)
2628 log_test.info('Adding subscribers through OLT app')
2629 self.config_olt(switch_map)
2630 olt_configured = True
2631 time.sleep(5)
2632 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
2633 try:
2634 assert_equal(dhcp_status, True)
2635 #assert_equal(status, True)
2636 time.sleep(10)
2637 finally:
2638 self.voltha.disable_device(device_id, delete = True)
2639 self.remove_olt(switch_map)
2640 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002641
Thangavelu K S735a6662017-06-15 18:08:23 +00002642 reactor.callLater(0, dhcp_flow_check_scenario, df)
2643 return df
2644
Thangavelu K S735a6662017-06-15 18:08:23 +00002645 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002646 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
2647 """
2648 Test Method:
2649 0. Make sure that voltha is up and running on CORD-POD setup.
2650 1. OLT and ONU is detected and validated.
2651 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2652 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
2653 4. Verify that subscriber should not get ip from dhcp server.
2654 5. Repeat steps 3 and 4 for 10 times.
2655 6 Verify that subscriber should not get ip from dhcp server.
2656 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002657 df = defer.Deferred()
2658 def dhcp_flow_check_scenario(df):
2659 log_test.info('Enabling ponsim_olt')
2660 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2661 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2662 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002663 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002664 time.sleep(10)
2665 switch_map = None
2666 olt_configured = False
2667 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2668 log_test.info('Installing OLT app')
2669 OnosCtrl.install_app(self.olt_app_file)
2670 time.sleep(5)
2671 log_test.info('Adding subscribers through OLT app')
2672 self.config_olt(switch_map)
2673 olt_configured = True
2674 time.sleep(5)
2675 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
2676 try:
2677 assert_equal(dhcp_status, True)
2678 #assert_equal(status, True)
2679 time.sleep(10)
2680 finally:
2681 self.voltha.disable_device(device_id, delete = True)
2682 self.remove_olt(switch_map)
2683 df.callback(0)
2684
2685 reactor.callLater(0, dhcp_flow_check_scenario, df)
2686 return df
2687
Thangavelu K S735a6662017-06-15 18:08:23 +00002688 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002689 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
2690 """
2691 Test Method:
2692 0. Make sure that voltha is up and running on CORD-POD setup.
2693 1. OLT and ONU is detected and validated.
2694 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2695 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2696 4. Verify that subscriber get ip from dhcp server successfully.
2697 5. Repeat step 3 for 50 times.
2698 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2699 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002700 df = defer.Deferred()
2701 def dhcp_flow_check_scenario(df):
2702 log_test.info('Enabling ponsim_olt')
2703 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2704 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2705 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002706 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002707 time.sleep(10)
2708 switch_map = None
2709 olt_configured = False
2710 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2711 log_test.info('Installing OLT app')
2712 OnosCtrl.install_app(self.olt_app_file)
2713 time.sleep(5)
2714 log_test.info('Adding subscribers through OLT app')
2715 self.config_olt(switch_map)
2716 olt_configured = True
2717 time.sleep(5)
2718 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
2719 try:
2720 assert_equal(dhcp_status, True)
2721 #assert_equal(status, True)
2722 time.sleep(10)
2723 finally:
2724 self.voltha.disable_device(device_id, delete = True)
2725 self.remove_olt(switch_map)
2726 df.callback(0)
2727
2728 reactor.callLater(0, dhcp_flow_check_scenario, df)
2729 return df
2730
Thangavelu K S735a6662017-06-15 18:08:23 +00002731 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002732 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
2733 """
2734 Test Method:
2735 0. Make sure that voltha is up and running on CORD-POD setup.
2736 1. OLT and ONU is detected and validated.
2737 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2738 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2739 4. Verify that subscriber get ip from dhcp server successfully.
2740 5. Send DHCP request to dhcp server which is running as onos app.
2741 6. Repeat step 5 for 50 times.
2742 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2743 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002744 df = defer.Deferred()
2745 def dhcp_flow_check_scenario(df):
2746 log_test.info('Enabling ponsim_olt')
2747 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2748 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2749 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002750 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002751 time.sleep(10)
2752 switch_map = None
2753 olt_configured = False
2754 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2755 log_test.info('Installing OLT app')
2756 OnosCtrl.install_app(self.olt_app_file)
2757 time.sleep(5)
2758 log_test.info('Adding subscribers through OLT app')
2759 self.config_olt(switch_map)
2760 olt_configured = True
2761 time.sleep(5)
2762 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
2763 try:
2764 assert_equal(dhcp_status, True)
2765 #assert_equal(status, True)
2766 time.sleep(10)
2767 finally:
2768 self.voltha.disable_device(device_id, delete = True)
2769 self.remove_olt(switch_map)
2770 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002771
Thangavelu K S735a6662017-06-15 18:08:23 +00002772 reactor.callLater(0, dhcp_flow_check_scenario, df)
2773 return df
2774
Thangavelu K S735a6662017-06-15 18:08:23 +00002775 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002776 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
2777 """
2778 Test Method:
2779 0. Make sure that voltha is up and running on CORD-POD setup.
2780 1. OLT and ONU is detected and validated.
2781 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2782 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
2783 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
2784 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002785 df = defer.Deferred()
2786 def dhcp_flow_check_scenario(df):
2787 log_test.info('Enabling ponsim_olt')
2788 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2789 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2790 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002791 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002792 time.sleep(10)
2793 switch_map = None
2794 olt_configured = False
2795 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2796 log_test.info('Installing OLT app')
2797 OnosCtrl.install_app(self.olt_app_file)
2798 time.sleep(5)
2799 log_test.info('Adding subscribers through OLT app')
2800 self.config_olt(switch_map)
2801 olt_configured = True
2802 time.sleep(5)
2803 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
2804 try:
2805 assert_equal(dhcp_status, True)
2806 #assert_equal(status, True)
2807 time.sleep(10)
2808 finally:
2809 self.voltha.disable_device(device_id, delete = True)
2810 self.remove_olt(switch_map)
2811 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002812
Thangavelu K S735a6662017-06-15 18:08:23 +00002813 reactor.callLater(0, dhcp_flow_check_scenario, df)
2814 return df
2815
2816 @deferred(TESTCASE_TIMEOUT)
2817 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002818 """
2819 Test Method:
2820 0. Make sure that voltha is up and running on CORD-POD setup.
2821 1. OLT and ONU is detected and validated.
2822 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2823 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
2824 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.
2825 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002826 df = defer.Deferred()
2827 def dhcp_flow_check_scenario(df):
2828 log_test.info('Enabling ponsim_olt')
2829 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2830 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2831 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002832 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002833 time.sleep(10)
2834 switch_map = None
2835 olt_configured = False
2836 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2837 log_test.info('Installing OLT app')
2838 OnosCtrl.install_app(self.olt_app_file)
2839 time.sleep(5)
2840 log_test.info('Adding subscribers through OLT app')
2841 self.config_olt(switch_map)
2842 olt_configured = True
2843 time.sleep(5)
2844 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
2845 try:
2846 assert_equal(dhcp_status, True)
2847 #assert_equal(status, True)
2848 time.sleep(10)
2849 finally:
2850 self.voltha.disable_device(device_id, delete = True)
2851 self.remove_olt(switch_map)
2852 df.callback(0)
2853
2854 reactor.callLater(0, dhcp_flow_check_scenario, df)
2855 return df
2856
Thangavelu K S735a6662017-06-15 18:08:23 +00002857 @deferred(TESTCASE_TIMEOUT)
2858 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002859 """
2860 Test Method:
2861 0. Make sure that voltha is up and running on CORD-POD setup.
2862 1. OLT and ONU is detected and validated.
2863 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2864 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2865 4. Verify that subscriber get ip from dhcp server successfully.
2866 5. Deactivate dhcp server app in onos.
2867 6. Repeat step 3.
2868 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
2869 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002870 df = defer.Deferred()
2871 dhcp_app = 'org.onosproject.dhcp'
2872 def dhcp_flow_check_scenario(df):
2873 log_test.info('Enabling ponsim_olt')
2874 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2875 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2876 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002877 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002878 time.sleep(10)
2879 switch_map = None
2880 olt_configured = False
2881 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2882 log_test.info('Installing OLT app')
2883 OnosCtrl.install_app(self.olt_app_file)
2884 time.sleep(5)
2885 log_test.info('Adding subscribers through OLT app')
2886 self.config_olt(switch_map)
2887 olt_configured = True
2888 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002889 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00002890 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
2891 log_test.info('Restart dhcp app in onos during client send discover to voltha')
2892 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00002893 thread1.start()
2894 time.sleep(10)
2895 thread1.join()
2896 thread2.join()
2897 try:
2898 assert_equal(self.success, True)
2899 #assert_equal(status, True)
2900 time.sleep(10)
2901 finally:
2902 self.voltha.disable_device(device_id, delete = True)
2903 self.remove_olt(switch_map)
2904 df.callback(0)
2905
2906 reactor.callLater(0, dhcp_flow_check_scenario, df)
2907 return df
2908
2909 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002910 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
2911 """
2912 Test Method:
2913 0. Make sure that voltha is up and running on CORD-POD setup.
2914 1. OLT and ONU is detected and validated.
2915 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2916 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2917 4. Verify that subscriber get ip from dhcp server successfully.
2918 5. Send dhcp renew packet to dhcp server which is running as onos app.
2919 6. Repeat step 4.
2920 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002921
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002922 df = defer.Deferred()
2923 def dhcp_flow_check_scenario(df):
2924 log_test.info('Enabling ponsim_olt')
2925 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2926 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2927 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002928 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002929 time.sleep(10)
2930 switch_map = None
2931 olt_configured = False
2932 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2933 log_test.info('Installing OLT app')
2934 OnosCtrl.install_app(self.olt_app_file)
2935 time.sleep(5)
2936 log_test.info('Adding subscribers through OLT app')
2937 self.config_olt(switch_map)
2938 olt_configured = True
2939 time.sleep(5)
2940 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
2941 try:
2942 assert_equal(dhcp_status, True)
2943 #assert_equal(status, True)
2944 time.sleep(10)
2945 finally:
2946 self.voltha.disable_device(device_id, delete = True)
2947 self.remove_olt(switch_map)
2948 df.callback(0)
2949
2950 reactor.callLater(0, dhcp_flow_check_scenario, df)
2951 return df
2952
2953 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002954 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
2955 """
2956 Test Method:
2957 0. Make sure that voltha is up and running on CORD-POD setup.
2958 1. OLT and ONU is detected and validated.
2959 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2960 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2961 4. Verify that subscriber get ip from dhcp server successfully.
2962 5. Send dhcp rebind packet to dhcp server which is running as onos app.
2963 6. Repeat step 4.
2964 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002965 df = defer.Deferred()
2966 def dhcp_flow_check_scenario(df):
2967 log_test.info('Enabling ponsim_olt')
2968 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2969 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2970 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002971 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002972 time.sleep(10)
2973 switch_map = None
2974 olt_configured = False
2975 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2976 log_test.info('Installing OLT app')
2977 OnosCtrl.install_app(self.olt_app_file)
2978 time.sleep(5)
2979 log_test.info('Adding subscribers through OLT app')
2980 self.config_olt(switch_map)
2981 olt_configured = True
2982 time.sleep(5)
2983 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
2984 try:
2985 assert_equal(dhcp_status, True)
2986 #assert_equal(status, True)
2987 time.sleep(10)
2988 finally:
2989 self.voltha.disable_device(device_id, delete = True)
2990 self.remove_olt(switch_map)
2991 df.callback(0)
2992
2993 reactor.callLater(0, dhcp_flow_check_scenario, df)
2994 return df
2995
Thangavelu K S0f2c5232017-06-19 19:11:43 +00002996 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002997 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002998 """
2999 Test Method:
3000 0. Make sure that voltha is up and running on CORD-POD setup.
3001 1. OLT and ONU is detected and validated.
3002 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3003 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3004 4. Verify that subscriber get ip from dhcp server successfully.
3005 5. Disable olt devices which is being detected in voltha CLI.
3006 6. Repeat step 3.
3007 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3008 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003009 df = defer.Deferred()
3010 dhcp_app = 'org.onosproject.dhcp'
3011 def dhcp_flow_check_scenario(df):
3012 log_test.info('Enabling ponsim_olt')
3013 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3014 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3015 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003016 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003017 time.sleep(10)
3018 switch_map = None
3019 olt_configured = False
3020 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3021 log_test.info('Installing OLT app')
3022 OnosCtrl.install_app(self.olt_app_file)
3023 time.sleep(5)
3024 log_test.info('Adding subscribers through OLT app')
3025 self.config_olt(switch_map)
3026 olt_configured = True
3027 time.sleep(5)
3028 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3029 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3030 log_test.info('Disable the olt device in during client send discover to voltha')
3031 thread2.start()
3032# time.sleep(randint(0,1))
3033 thread1.start()
3034 time.sleep(10)
3035 thread1.join()
3036 thread2.join()
3037 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003038 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003039 #assert_equal(status, True)
3040 time.sleep(10)
3041 finally:
3042 self.voltha.disable_device(device_id, delete = True)
3043 self.remove_olt(switch_map)
3044 df.callback(0)
3045
3046 reactor.callLater(0, dhcp_flow_check_scenario, df)
3047 return df
3048
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003049 @deferred(TESTCASE_TIMEOUT)
3050 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
3051 """
3052 Test Method:
3053 0. Make sure that voltha is up and running on CORD-POD setup.
3054 1. OLT and ONU is detected and validated.
3055 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3056 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3057 4. Verify that subscriber get ip from dhcp server successfully.
3058 5. Disable olt devices which is being detected in voltha CLI.
3059 6. Repeat step 3.
3060 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3061 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
3062 """
3063 df = defer.Deferred()
3064 no_iterations = 10
3065 dhcp_app = 'org.onosproject.dhcp'
3066 def dhcp_flow_check_scenario(df):
3067 log_test.info('Enabling ponsim_olt')
3068 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3069 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3070 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003071 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003072 time.sleep(10)
3073 switch_map = None
3074 olt_configured = False
3075 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3076 log_test.info('Installing OLT app')
3077 OnosCtrl.install_app(self.olt_app_file)
3078 time.sleep(5)
3079 log_test.info('Adding subscribers through OLT app')
3080 self.config_olt(switch_map)
3081 olt_configured = True
3082 time.sleep(5)
3083 for i in range(no_iterations):
3084 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3085 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3086 log_test.info('Disable the olt device in during client send discover to voltha')
3087 thread2.start()
3088# time.sleep(randint(0,1))
3089 thread1.start()
3090 time.sleep(10)
3091 thread1.join()
3092 thread2.join()
3093 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3094 try:
3095 assert_equal(self.success, True)
3096 assert_equal(dhcp_status, True)
3097 #assert_equal(status, True)
3098 time.sleep(10)
3099 finally:
3100 self.voltha.disable_device(device_id, delete = True)
3101 self.remove_olt(switch_map)
3102 df.callback(0)
3103
3104 reactor.callLater(0, dhcp_flow_check_scenario, df)
3105 return df
3106
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003107 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003108 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003109 """
3110 Test Method:
3111 0. Make sure that voltha is up and running on CORD-POD setup.
3112 1. OLT and ONU is detected and validated.
3113 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3114 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3115 4. Verify that subscriber get ip from dhcp server successfully.
3116 5. Disable olt devices which is being detected in voltha CLI.
3117 6. Repeat step 3.
3118 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3119 8. Enable olt devices which is being detected in voltha CLI.
3120 9. Repeat steps 3 and 4.
3121 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003122 df = defer.Deferred()
3123 dhcp_app = 'org.onosproject.dhcp'
3124 def dhcp_flow_check_scenario(df):
3125 log_test.info('Enabling ponsim_olt')
3126 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3127 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3128 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003129 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003130 time.sleep(10)
3131 switch_map = None
3132 olt_configured = False
3133 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3134 log_test.info('Installing OLT app')
3135 OnosCtrl.install_app(self.olt_app_file)
3136 time.sleep(5)
3137 log_test.info('Adding subscribers through OLT app')
3138 self.config_olt(switch_map)
3139 olt_configured = True
3140 time.sleep(5)
3141 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3142 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3143 thread2.start()
3144 thread1.start()
3145 time.sleep(10)
3146 thread1.join()
3147 thread2.join()
3148 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003149 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003150 #assert_equal(status, True)
3151 time.sleep(10)
3152 finally:
3153 self.voltha.disable_device(device_id, delete = True)
3154 self.remove_olt(switch_map)
3155 df.callback(0)
3156
3157 reactor.callLater(0, dhcp_flow_check_scenario, df)
3158 return df
3159
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003160 @deferred(TESTCASE_TIMEOUT)
3161 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
3162 """
3163 Test Method:
3164 0. Make sure that voltha is up and running on CORD-POD setup.
3165 1. OLT and ONU is detected and validated.
3166 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3167 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3168 4. Verify that subscriber get ip from dhcp server successfully.
3169 5. Disable olt devices which is being detected in voltha CLI.
3170 6. Repeat step 3.
3171 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3172 8. Enable olt devices which is being detected in voltha CLI.
3173 9. Repeat steps 3 and 4.
3174 """
3175
3176 df = defer.Deferred()
3177 no_iterations = 10
3178 dhcp_app = 'org.onosproject.dhcp'
3179 def dhcp_flow_check_scenario(df):
3180 log_test.info('Enabling ponsim_olt')
3181 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3182 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3183 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003184 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003185 time.sleep(10)
3186 switch_map = None
3187 olt_configured = False
3188 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3189 log_test.info('Installing OLT app')
3190 OnosCtrl.install_app(self.olt_app_file)
3191 time.sleep(5)
3192 log_test.info('Adding subscribers through OLT app')
3193 self.config_olt(switch_map)
3194 olt_configured = True
3195 time.sleep(5)
3196 for i in range(no_iterations):
3197 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3198 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3199 thread2.start()
3200 thread1.start()
3201 time.sleep(10)
3202 thread1.join()
3203 thread2.join()
3204 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3205 try:
3206 assert_equal(dhcp_status, True)
3207 #assert_equal(status, True)
3208 assert_equal(self.success, True)
3209 time.sleep(10)
3210 finally:
3211 self.voltha.disable_device(device_id, delete = True)
3212 self.remove_olt(switch_map)
3213 df.callback(0)
3214
3215 reactor.callLater(0, dhcp_flow_check_scenario, df)
3216 return df
3217
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003218 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003219 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003220 """
3221 Test Method:
3222 0. Make sure that voltha is up and running on CORD-POD setup.
3223 1. OLT and ONU is detected and validated.
3224 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3225 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3226 4. Verify that subscriber get ip from dhcp server successfully.
3227 5. Disable onu port which is being detected in voltha CLI.
3228 6. Repeat step 3.
3229 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3230 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003231 df = defer.Deferred()
3232 dhcp_app = 'org.onosproject.dhcp'
3233 def dhcp_flow_check_scenario(df):
3234 log_test.info('Enabling ponsim_olt')
3235 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3236 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3237 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003238 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003239 time.sleep(10)
3240 switch_map = None
3241 olt_configured = False
3242 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3243 log_test.info('Installing OLT app')
3244 OnosCtrl.install_app(self.olt_app_file)
3245 time.sleep(5)
3246 log_test.info('Adding subscribers through OLT app')
3247 self.config_olt(switch_map)
3248 olt_configured = True
3249 time.sleep(5)
3250 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3251 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3252 thread1.start()
3253 thread2.start()
3254 time.sleep(10)
3255 thread1.join()
3256 thread2.join()
3257 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003258 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003259 #assert_equal(status, True)
3260 time.sleep(10)
3261 finally:
3262 self.voltha.disable_device(device_id, delete = True)
3263 self.remove_olt(switch_map)
3264 df.callback(0)
3265
3266 reactor.callLater(0, dhcp_flow_check_scenario, df)
3267 return df
3268
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003269 @deferred(TESTCASE_TIMEOUT)
3270 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
3271 """
3272 Test Method:
3273 0. Make sure that voltha is up and running on CORD-POD setup.
3274 1. OLT and ONU is detected and validated.
3275 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3276 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3277 4. Verify that subscriber get ip from dhcp server successfully.
3278 5. Disable onu port which is being detected in voltha CLI.
3279 6. Repeat step 3.
3280 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3281 """
3282 df = defer.Deferred()
3283 no_iterations = 10
3284 dhcp_app = 'org.onosproject.dhcp'
3285 def dhcp_flow_check_scenario(df):
3286 log_test.info('Enabling ponsim_olt')
3287 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3288 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3289 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003290 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003291 time.sleep(10)
3292 switch_map = None
3293 olt_configured = False
3294 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3295 log_test.info('Installing OLT app')
3296 OnosCtrl.install_app(self.olt_app_file)
3297 time.sleep(5)
3298 log_test.info('Adding subscribers through OLT app')
3299 self.config_olt(switch_map)
3300 olt_configured = True
3301 time.sleep(5)
3302 for i in range(no_iterations):
3303 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3304 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3305 thread1.start()
3306 thread2.start()
3307 time.sleep(10)
3308 thread1.join()
3309 thread2.join()
3310 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3311 try:
3312 #assert_equal(status, True)
3313 assert_equal(dhcp_status, True)
3314 assert_equal(self.success, True)
3315 time.sleep(10)
3316 finally:
3317 self.voltha.disable_device(device_id, delete = True)
3318 self.remove_olt(switch_map)
3319 df.callback(0)
3320
3321 reactor.callLater(0, dhcp_flow_check_scenario, df)
3322 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003323
3324 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003325 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003326 """
3327 Test Method:
3328 0. Make sure that voltha is up and running on CORD-POD setup.
3329 1. OLT and ONU is detected and validated.
3330 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3331 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3332 4. Verify that subscriber get ip from dhcp server successfully.
3333 5. Disable onu port which is being detected in voltha CLI.
3334 6. Repeat step 3.
3335 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3336 8. Enable onu port which is being detected in voltha CLI.
3337 9. Repeat steps 3 and 4.
3338 """
3339
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003340 df = defer.Deferred()
3341 dhcp_app = 'org.onosproject.dhcp'
3342 def dhcp_flow_check_scenario(df):
3343 log_test.info('Enabling ponsim_olt')
3344 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3345 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3346 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003347 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003348 time.sleep(10)
3349 switch_map = None
3350 olt_configured = False
3351 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3352 log_test.info('Installing OLT app')
3353 OnosCtrl.install_app(self.olt_app_file)
3354 time.sleep(5)
3355 log_test.info('Adding subscribers through OLT app')
3356 self.config_olt(switch_map)
3357 olt_configured = True
3358 time.sleep(5)
3359 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3360 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3361 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3362 thread2.start()
3363 time.sleep(randint(0,1))
3364 thread1.start()
3365 time.sleep(10)
3366 thread1.join()
3367 thread2.join()
3368 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3369 assert_equal(dhcp_status, True)
3370 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003371 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003372 #assert_equal(status, True)
3373 time.sleep(10)
3374 finally:
3375 self.voltha.disable_device(device_id, delete = True)
3376 self.remove_olt(switch_map)
3377 df.callback(0)
3378
3379 reactor.callLater(0, dhcp_flow_check_scenario, df)
3380 return df
3381
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003382 @deferred(TESTCASE_TIMEOUT)
3383 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
3384 """
3385 Test Method:
3386 0. Make sure that voltha is up and running on CORD-POD setup.
3387 1. OLT and ONU is detected and validated.
3388 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3389 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3390 4. Verify that subscriber get ip from dhcp server successfully.
3391 5. Disable onu port which is being detected in voltha CLI.
3392 6. Repeat step 3.
3393 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3394 8. Enable onu port which is being detected in voltha CLI.
3395 9. Repeat steps 3 and 4.
3396 """
3397
3398 df = defer.Deferred()
3399 no_iterations = 10
3400 dhcp_app = 'org.onosproject.dhcp'
3401 def dhcp_flow_check_scenario(df):
3402 log_test.info('Enabling ponsim_olt')
3403 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3404 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3405 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003406 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003407 time.sleep(10)
3408 switch_map = None
3409 olt_configured = False
3410 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3411 log_test.info('Installing OLT app')
3412 OnosCtrl.install_app(self.olt_app_file)
3413 time.sleep(5)
3414 log_test.info('Adding subscribers through OLT app')
3415 self.config_olt(switch_map)
3416 olt_configured = True
3417 time.sleep(5)
3418 for i in range(no_iterations):
3419 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3420 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3421 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3422 thread2.start()
3423 time.sleep(randint(0,1))
3424 thread1.start()
3425 time.sleep(10)
3426 thread1.join()
3427 thread2.join()
3428 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3429 assert_equal(dhcp_status, True)
3430 try:
3431 assert_equal(self.success, True)
3432 #assert_equal(status, True)
3433 time.sleep(10)
3434 finally:
3435 self.voltha.disable_device(device_id, delete = True)
3436 self.remove_olt(switch_map)
3437 df.callback(0)
3438
3439 reactor.callLater(0, dhcp_flow_check_scenario, df)
3440 return df
3441
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003442 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003443 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003444 """
3445 Test Method:
3446 0. Make sure that voltha is up and running on CORD-POD setup.
3447 1. OLT and ONU is detected and validated.
3448 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3449 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3450 4. Verify that subscribers had got different ips from dhcp server successfully.
3451 """
3452
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003453 df = defer.Deferred()
3454 self.success = True
3455 dhcp_app = 'org.onosproject.dhcp'
3456 def dhcp_flow_check_scenario(df):
3457 log_test.info('Enabling ponsim_olt')
3458 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3459 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3460 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003461 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003462 time.sleep(10)
3463 switch_map = None
3464 olt_configured = False
3465 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3466 log_test.info('Installing OLT app')
3467 OnosCtrl.install_app(self.olt_app_file)
3468 time.sleep(5)
3469 log_test.info('Adding subscribers through OLT app')
3470 self.config_olt(switch_map)
3471 olt_configured = True
3472 time.sleep(5)
3473 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3474 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3475 thread1.start()
3476 thread2.start()
3477 time.sleep(10)
3478 thread1.join()
3479 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003480 dhcp_flow_status = self.success
3481 try:
3482# if self.success is not True:
3483 assert_equal(dhcp_flow_status, True)
3484 #assert_equal(status, True)
3485 time.sleep(10)
3486 finally:
3487 self.voltha.disable_device(device_id, delete = True)
3488 self.remove_olt(switch_map)
3489 df.callback(0)
3490
3491 reactor.callLater(0, dhcp_flow_check_scenario, df)
3492 return df
3493
3494 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003495 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003496 """
3497 Test Method:
3498 0. Make sure that voltha is up and running on CORD-POD setup.
3499 1. OLT and ONU is detected and validated.
3500 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3501 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3502 4. Verify that subscribers had got ip from dhcp server successfully.
3503 5. Repeat step 3 and 4 for 10 times for both subscribers.
3504 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
3505 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003506
3507
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003508 df = defer.Deferred()
3509 self.success = True
3510 dhcp_app = 'org.onosproject.dhcp'
3511 def dhcp_flow_check_scenario(df):
3512 log_test.info('Enabling ponsim_olt')
3513 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3514 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3515 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003516 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003517 time.sleep(10)
3518 switch_map = None
3519 olt_configured = False
3520 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3521 log_test.info('Installing OLT app')
3522 OnosCtrl.install_app(self.olt_app_file)
3523 time.sleep(5)
3524 log_test.info('Adding subscribers through OLT app')
3525 self.config_olt(switch_map)
3526 olt_configured = True
3527 time.sleep(5)
3528 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3529 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
3530 thread1.start()
3531 thread2.start()
3532 time.sleep(10)
3533 thread1.join()
3534 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003535 dhcp_flow_status = self.success
3536 try:
3537# if self.success is not True:
3538 assert_equal(dhcp_flow_status, True)
3539 #assert_equal(status, True)
3540 time.sleep(10)
3541 finally:
3542 self.voltha.disable_device(device_id, delete = True)
3543 self.remove_olt(switch_map)
3544 df.callback(0)
3545
3546 reactor.callLater(0, dhcp_flow_check_scenario, df)
3547 return df
3548
3549 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003550 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003551 """
3552 Test Method:
3553 0. Make sure that voltha is up and running on CORD-POD setup.
3554 1. OLT and ONU is detected and validated.
3555 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3556 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3557 4. Verify that subscribers had got ip from dhcp server successfully.
3558 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3559 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
3560 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003561
3562 df = defer.Deferred()
3563 self.success = True
3564 dhcp_app = 'org.onosproject.dhcp'
3565 def dhcp_flow_check_scenario(df):
3566 log_test.info('Enabling ponsim_olt')
3567 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3568 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3569 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003570 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003571 time.sleep(10)
3572 switch_map = None
3573 olt_configured = False
3574 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3575 log_test.info('Installing OLT app')
3576 OnosCtrl.install_app(self.olt_app_file)
3577 time.sleep(5)
3578 log_test.info('Adding subscribers through OLT app')
3579 self.config_olt(switch_map)
3580 olt_configured = True
3581 time.sleep(5)
3582 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3583 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3584 thread1.start()
3585 thread2.start()
3586 time.sleep(10)
3587 thread1.join()
3588 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003589 dhcp_flow_status = self.success
3590 try:
3591# if self.success is not True:
3592 assert_equal(dhcp_flow_status, True)
3593 #assert_equal(status, True)
3594 time.sleep(10)
3595 finally:
3596 self.voltha.disable_device(device_id, delete = True)
3597 self.remove_olt(switch_map)
3598 df.callback(0)
3599
3600 reactor.callLater(0, dhcp_flow_check_scenario, df)
3601 return df
3602
3603 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003604 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 +00003605 """
3606 Test Method:
3607 0. Make sure that voltha is up and running on CORD-POD setup.
3608 1. OLT and ONU is detected and validated.
3609 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3610 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
3611 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
3612 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
3613 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003614
3615 df = defer.Deferred()
3616 self.success = True
3617 dhcp_app = 'org.onosproject.dhcp'
3618 def dhcp_flow_check_scenario(df):
3619 log_test.info('Enabling ponsim_olt')
3620 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3621 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3622 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003623 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003624 time.sleep(10)
3625 switch_map = None
3626 olt_configured = False
3627 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3628 log_test.info('Installing OLT app')
3629 OnosCtrl.install_app(self.olt_app_file)
3630 time.sleep(5)
3631 log_test.info('Adding subscribers through OLT app')
3632 self.config_olt(switch_map)
3633 olt_configured = True
3634 time.sleep(5)
3635 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3636 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
3637 thread1.start()
3638 thread2.start()
3639 time.sleep(10)
3640 thread1.join()
3641 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003642 dhcp_flow_status = self.success
3643 try:
3644# if self.success is not True:
3645 assert_equal(dhcp_flow_status, True)
3646 #assert_equal(status, True)
3647 time.sleep(10)
3648 finally:
3649 self.voltha.disable_device(device_id, delete = True)
3650 self.remove_olt(switch_map)
3651 df.callback(0)
3652
3653 reactor.callLater(0, dhcp_flow_check_scenario, df)
3654 return df
3655
3656 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003657 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 +00003658 """
3659 Test Method:
3660 0. Make sure that voltha is up and running on CORD-POD setup.
3661 1. OLT and ONU is detected and validated.
3662 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3663 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
3664 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
3665 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
3666 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003667 df = defer.Deferred()
3668 self.success = True
3669 dhcp_app = 'org.onosproject.dhcp'
3670 def dhcp_flow_check_scenario(df):
3671 log_test.info('Enabling ponsim_olt')
3672 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3673 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3674 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003675 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003676 time.sleep(10)
3677 switch_map = None
3678 olt_configured = False
3679 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3680 log_test.info('Installing OLT app')
3681 OnosCtrl.install_app(self.olt_app_file)
3682 time.sleep(5)
3683 log_test.info('Adding subscribers through OLT app')
3684 self.config_olt(switch_map)
3685 olt_configured = True
3686 time.sleep(5)
3687 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3688 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3689 thread1.start()
3690 thread2.start()
3691 time.sleep(10)
3692 thread1.join()
3693 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003694 dhcp_flow_status = self.success
3695 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003696 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003697 time.sleep(10)
3698 finally:
3699 self.voltha.disable_device(device_id, delete = True)
3700 self.remove_olt(switch_map)
3701 df.callback(0)
3702
3703 reactor.callLater(0, dhcp_flow_check_scenario, df)
3704 return df
3705
3706 @deferred(TESTCASE_TIMEOUT)
3707 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003708 """
3709 Test Method:
3710 0. Make sure that voltha is up and running on CORD-POD setup.
3711 1. OLT and ONU is detected and validated.
3712 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3713 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3714 4. Verify that subscribers had got ip from dhcp server successfully.
3715 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3716 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3717 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3718 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003719 df = defer.Deferred()
3720 self.success = True
3721 dhcp_app = 'org.onosproject.dhcp'
3722 def dhcp_flow_check_scenario(df):
3723 log_test.info('Enabling ponsim_olt')
3724 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3725 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3726 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003727 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003728 time.sleep(10)
3729 switch_map = None
3730 olt_configured = False
3731 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3732 log_test.info('Installing OLT app')
3733 OnosCtrl.install_app(self.olt_app_file)
3734 time.sleep(5)
3735 log_test.info('Adding subscribers through OLT app')
3736 self.config_olt(switch_map)
3737 olt_configured = True
3738 time.sleep(5)
3739 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3740 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3741 thread1.start()
3742 thread2.start()
3743 time.sleep(10)
3744 thread1.join()
3745 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003746 dhcp_flow_status = self.success
3747 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003748 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003749 time.sleep(10)
3750 finally:
3751 self.voltha.disable_device(device_id, delete = True)
3752 self.remove_olt(switch_map)
3753 df.callback(0)
3754
3755 reactor.callLater(0, dhcp_flow_check_scenario, df)
3756 return df
3757
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003758 @deferred(TESTCASE_TIMEOUT)
3759 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003760 """
3761 Test Method:
3762 0. Make sure that voltha is up and running on CORD-POD setup.
3763 1. OLT and ONU is detected and validated.
3764 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3765 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3766 4. Verify that subscribers had got ip from dhcp server successfully.
3767 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3768 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3769 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3770 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
3771 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
3772 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
3773 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003774 df = defer.Deferred()
3775 self.success = True
3776 dhcp_app = 'org.onosproject.dhcp'
3777 def dhcp_flow_check_scenario(df):
3778 log_test.info('Enabling ponsim_olt')
3779 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3780 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3781 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003782 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003783 time.sleep(10)
3784 switch_map = None
3785 olt_configured = False
3786 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3787 log_test.info('Installing OLT app')
3788 OnosCtrl.install_app(self.olt_app_file)
3789 time.sleep(5)
3790 log_test.info('Adding subscribers through OLT app')
3791 self.config_olt(switch_map)
3792 olt_configured = True
3793 time.sleep(5)
3794 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3795 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3796 thread3 = threading.Thread(target = self.voltha_uni_port_down_up, args = (self.INTF_2_RX_DEFAULT,))
3797 thread1.start()
3798 thread2.start()
3799 thread3.start()
3800 time.sleep(10)
3801 thread1.join()
3802 thread2.join()
3803 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003804 dhcp_flow_status = self.success
3805 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003806 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003807 time.sleep(10)
3808 finally:
3809 self.voltha.disable_device(device_id, delete = True)
3810 self.remove_olt(switch_map)
3811 df.callback(0)
3812
3813 reactor.callLater(0, dhcp_flow_check_scenario, df)
3814 return df
3815
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003816 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003817 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003818 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003819 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00003820 0. Make sure that voltha is up and running on CORD-POD setup.
3821 1. OLT and ONU is detected and validated.
3822 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3823 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3824 4. Verify that subscribers had got ip from dhcp server successfully.
3825 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3826 6. Disable the olt device which is detected in voltha.
3827 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3828 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003829 df = defer.Deferred()
3830 self.success = True
3831 dhcp_app = 'org.onosproject.dhcp'
3832 def dhcp_flow_check_scenario(df):
3833 log_test.info('Enabling ponsim_olt')
3834 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3835 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3836 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003837 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003838 time.sleep(10)
3839 switch_map = None
3840 olt_configured = False
3841 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3842 log_test.info('Installing OLT app')
3843 OnosCtrl.install_app(self.olt_app_file)
3844 time.sleep(5)
3845 log_test.info('Adding subscribers through OLT app')
3846 self.config_olt(switch_map)
3847 olt_configured = True
3848 time.sleep(5)
3849 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3850 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3851 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3852
3853 thread1.start()
3854 thread2.start()
3855 thread3.start()
3856 time.sleep(10)
3857 thread1.join()
3858 thread2.join()
3859 thread3.join()
3860 dhcp_flow_status = self.success
3861 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003862 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003863 time.sleep(10)
3864 finally:
3865 self.voltha.disable_device(device_id, delete = True)
3866 self.remove_olt(switch_map)
3867 df.callback(0)
3868
3869 reactor.callLater(0, dhcp_flow_check_scenario, df)
3870 return df
3871
3872 @deferred(TESTCASE_TIMEOUT)
3873 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003874 """
3875 Test Method:
3876 0. Make sure that voltha is up and running on CORD-POD setup.
3877 1. OLT and ONU is detected and validated.
3878 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3879 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3880 4. Verify that subscribers had got ip from dhcp server successfully.
3881 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3882 6. Disable the olt device which is detected in voltha.
3883 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3884 8. Enable the olt device which is detected in voltha.
3885 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 +00003886
Thangavelu K S057b7d22017-05-16 22:03:22 +00003887 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003888 df = defer.Deferred()
3889 self.success = True
3890 dhcp_app = 'org.onosproject.dhcp'
3891 def dhcp_flow_check_scenario(df):
3892 log_test.info('Enabling ponsim_olt')
3893 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3894 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3895 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003896 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003897 time.sleep(10)
3898 switch_map = None
3899 olt_configured = False
3900 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3901 log_test.info('Installing OLT app')
3902 OnosCtrl.install_app(self.olt_app_file)
3903 time.sleep(5)
3904 log_test.info('Adding subscribers through OLT app')
3905 self.config_olt(switch_map)
3906 olt_configured = True
3907 time.sleep(5)
3908 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3909 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3910 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3911 thread1.start()
3912 thread2.start()
3913 thread3.start()
3914 time.sleep(10)
3915 thread1.join()
3916 thread2.join()
3917 thread3.join()
3918 dhcp_flow_status = self.success
3919 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003920 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003921 time.sleep(10)
3922 finally:
3923 self.voltha.disable_device(device_id, delete = True)
3924 self.remove_olt(switch_map)
3925 df.callback(0)
3926
3927 reactor.callLater(0, dhcp_flow_check_scenario, df)
3928 return df
3929
3930 @deferred(TESTCASE_TIMEOUT)
3931 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003932 """
3933 Test Method:
3934 0. Make sure that voltha is up and running on CORD-POD setup.
3935 1. OLT and ONU is detected and validated.
3936 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3937 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3938 4. Verify that subscribers had got ip from dhcp server successfully.
3939 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
3940 6. Pause the olt device which is detected in voltha.
3941 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
3942 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003943 df = defer.Deferred()
3944 self.success = True
3945 dhcp_app = 'org.onosproject.dhcp'
3946 def dhcp_flow_check_scenario(df):
3947 log_test.info('Enabling ponsim_olt')
3948 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3949 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3950 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003951 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003952 time.sleep(10)
3953 switch_map = None
3954 olt_configured = False
3955 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3956 log_test.info('Installing OLT app')
3957 OnosCtrl.install_app(self.olt_app_file)
3958 time.sleep(5)
3959 log_test.info('Adding subscribers through OLT app')
3960 self.config_olt(switch_map)
3961 olt_configured = True
3962 time.sleep(5)
3963 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3964 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3965 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
3966 thread1.start()
3967 thread2.start()
3968 thread3.start()
3969 time.sleep(10)
3970 thread1.join()
3971 thread2.join()
3972 thread3.join()
3973 dhcp_flow_status = self.success
3974 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003975 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003976 time.sleep(10)
3977 finally:
3978 self.voltha.disable_device(device_id, delete = True)
3979 self.remove_olt(switch_map)
3980 df.callback(0)
3981
3982 reactor.callLater(0, dhcp_flow_check_scenario, df)
3983 return df
3984
Thangavelu K S36edb012017-07-05 18:24:12 +00003985 def test_3_subscribers_with_voltha_for_dhcp_discover_requests(self):
3986 """
3987 Test Method:
3988 0. Make sure that voltha is up and running on CORD-POD setup.
3989 1. OLT and ONU is detected and validated.
3990 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
3991 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
3992 4. Verify that subscriber get ip from dhcp server successfully.
3993 """
3994 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
3995 num_subscribers = 3
3996 num_channels = 1
3997 services = ('DHCP')
3998 cbs = (self.dhcp_flow_check, None, None)
3999 self.voltha_subscribers(services, cbs = cbs,
4000 num_subscribers = num_subscribers,
4001 num_channels = num_channels)
4002
4003 def test_5_subscribers_with_voltha_for_dhcp_discover_requests(self):
4004 """
4005 Test Method:
4006 0. Make sure that voltha is up and running on CORD-POD setup.
4007 1. OLT and ONU is detected and validated.
4008 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4009 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4010 4. Verify that subscriber get ip from dhcp server successfully.
4011 """
4012 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4013 num_subscribers = 5
4014 num_channels = 1
4015 services = ('DHCP')
4016 cbs = (self.dhcp_flow_check, None, None)
4017 self.voltha_subscribers(services, cbs = cbs,
4018 num_subscribers = num_subscribers,
4019 num_channels = num_channels)
4020
4021 def test_9_subscribers_with_voltha_for_dhcp_discover_requests(self):
4022 """
4023 Test Method:
4024 0. Make sure that voltha is up and running on CORD-POD setup.
4025 1. OLT and ONU is detected and validated.
4026 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4027 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4028 4. Verify that subscriber get ip from dhcp server successfully.
4029 """
4030 """Test subscriber join next for channel surfing with 9 subscribers browsing 1 channels each"""
4031 num_subscribers = 9
4032 num_channels = 1
4033 services = ('DHCP')
4034 cbs = (self.dhcp_flow_check, None, None)
4035 self.voltha_subscribers(services, cbs = cbs,
4036 num_subscribers = num_subscribers,
4037 num_channels = num_channels)
4038
4039 def test_3_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4040 """
4041 Test Method:
4042 0. Make sure that voltha is up and running on CORD-POD setup.
4043 1. OLT and ONU is detected and validated.
4044 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4045 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4046 4. Verify that subscriber get ip from dhcp server successfully.
4047 """
4048 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4049 num_subscribers = 3
4050 num_channels = 1
4051 services = ('TLS','DHCP')
4052 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4053 self.voltha_subscribers(services, cbs = cbs,
4054 num_subscribers = num_subscribers,
4055 num_channels = num_channels)
4056
4057 def test_5_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4058 """
4059 Test Method:
4060 0. Make sure that voltha is up and running on CORD-POD setup.
4061 1. OLT and ONU is detected and validated.
4062 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4063 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4064 4. Verify that subscriber get ip from dhcp server successfully.
4065 """
4066 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4067 num_subscribers = 5
4068 num_channels = 1
4069 services = ('TLS','DHCP')
4070 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4071 self.voltha_subscribers(services, cbs = cbs,
4072 num_subscribers = num_subscribers,
4073 num_channels = num_channels)
4074
4075 def test_9_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4076 """
4077 Test Method:
4078 0. Make sure that voltha is up and running on CORD-POD setup.
4079 1. OLT and ONU is detected and validated.
4080 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4081 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4082 4. Verify that subscriber get ip from dhcp server successfully.
4083 """
4084 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4085 num_subscribers = 9
4086 num_channels = 1
4087 services = ('TLS','DHCP')
4088 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4089 self.voltha_subscribers(services, cbs = cbs,
4090 num_subscribers = num_subscribers,
4091 num_channels = num_channels)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004092
4093 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004094 def test_subscriber_with_voltha_for_dhcprelay_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004095 """
4096 Test Method:
4097 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4098 1. OLT and ONU is detected and validated.
4099 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4100 3. Send dhcp request from residential subscrber to external dhcp server.
4101 4. Verify that subscriber get ip from external dhcp server successfully.
4102 """
Thangavelu K S6432b522017-07-22 00:05:54 +00004103 self.dhcprelay_setUpClass()
4104# if not port_list:
4105 port_list = self.generate_port_list(1, 0)
4106 iface = self.port_map['ports'][port_list[1][1]]
4107 mac = self.get_mac(iface)
4108 self.host_load(iface)
4109 ##we use the defaults for this test that serves as an example for others
4110 ##You don't need to restart dhcpd server if retaining default config
4111 config = self.default_config
4112 options = self.default_options
4113 subnet = self.default_subnet_config
4114 dhcpd_interface_list = self.relay_interfaces
4115 self.dhcpd_start(intf_list = dhcpd_interface_list,
4116 config = config,
4117 options = options,
4118 subnet = subnet)
4119 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4120 self.send_recv(mac=mac)
4121 self.dhcprelay_tearDwonClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004122
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004123 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004124 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004125 """
4126 Test Method:
4127 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4128 1. OLT and ONU is detected and validated.
4129 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4130 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
4131 4. Verify that subscriber should not get ip from external dhcp server.
4132 """
4133
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004134 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004135 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004136 """
4137 Test Method:
4138 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4139 1. OLT and ONU is detected and validated.
4140 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4141 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
4142 4. Verify that subscriber should not get ip from external dhcp server.
4143 """
4144
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004145 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_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 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 zero 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_and_release(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 from residential subscrber to external dhcp server.
4162 4. Verify that subscriber get ip from external dhcp server successfully.
4163 5. Send dhcp release from residential subscrber to external dhcp server.
4164 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
4165 """
4166
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004167 def test_subscriber_with_voltha_for_dhcprelay_starvation(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004168 """
4169 Test Method:
4170 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4171 1. OLT and ONU is detected and validated.
4172 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4173 3. Send dhcp request from residential subscriber to external dhcp server.
4174 4. Verify that subscriber get ip from external dhcp server. successfully.
4175 5. Repeat step 3 and 4 for 10 times.
4176 6 Verify that subscriber should get ip from external dhcp server..
4177 """
4178
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004179 def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004180 """
4181 Test Method:
4182 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4183 1. OLT and ONU is detected and validated.
4184 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4185 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
4186 4. Verify that subscriber should not get ip from external dhcp server..
4187 5. Repeat steps 3 and 4 for 10 times.
4188 6 Verify that subscriber should not get ip from external dhcp server..
4189 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004190 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004191 """
4192 Test Method:
4193 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4194 1. OLT and ONU is detected and validated.
4195 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4196 3. Send dhcp request from residential subscriber to external dhcp server.
4197 4. Verify that subscriber get ip from external dhcp server. successfully.
4198 5. Repeat step 3 for 50 times.
4199 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4200 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004201 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004202 """
4203 Test Method:
4204 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4205 1. OLT and ONU is detected and validated.
4206 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4207 3. Send dhcp request from residential subscriber to external dhcp server.
4208 4. Verify that subscriber get ip from external dhcp server. successfully.
4209 5. Send DHCP request to external dhcp server.
4210 6. Repeat step 5 for 50 times.
4211 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4212 """
4213
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004214 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004215 """
4216 Test Method:
4217 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4218 1. OLT and ONU is detected and validated.
4219 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4220 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
4221 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
4222 """
4223
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004224 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_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 out of pool ip address from residential subscriber to external dhcp server.
4231 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.
4232 """
4233
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004234 def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(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 from residential subscriber to external dhcp server.
4241 4. Verify that subscriber get ip from external dhcp server. successfully.
4242 5. Deactivate dhcp server app in onos.
4243 6. Repeat step 3.
4244 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4245 """
4246
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004247 def test_subscriber_with_voltha_for_dhcprelay_renew_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004248 """
4249 Test Method:
4250 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4251 1. OLT and ONU is detected and validated.
4252 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4253 3. Send dhcp request from residential subscriber to external dhcp server.
4254 4. Verify that subscriber get ip from external dhcp server. successfully.
4255 5. Send dhcp renew packet to external dhcp server.
4256 6. Repeat step 4.
4257 """
4258
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004259 def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004260 """
4261 Test Method:
4262 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4263 1. OLT and ONU is detected and validated.
4264 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4265 3. Send dhcp request from residential subscriber to external dhcp server.
4266 4. Verify that subscriber get ip from external dhcp server. successfully.
4267 5. Send dhcp rebind packet to external dhcp server.
4268 6. Repeat step 4.
4269 """
4270
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004271 def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004272 """
4273 Test Method:
4274 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4275 1. OLT and ONU is detected and validated.
4276 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4277 3. Send dhcp request from residential subscriber to external dhcp server.
4278 4. Verify that subscriber get ip from external dhcp server. successfully.
4279 5. Disable olt devices which is being detected in voltha CLI.
4280 6. Repeat step 3.
4281 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4282 """
4283
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004284 def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004285 """
4286 Test Method:
4287 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4288 1. OLT and ONU is detected and validated.
4289 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4290 3. Send dhcp request from residential subscriber to external dhcp server.
4291 4. Verify that subscriber get ip from external dhcp server. successfully.
4292 5. Disable olt devices which is being detected in voltha CLI.
4293 6. Repeat step 3.
4294 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4295 8. Enable olt devices which is being detected in voltha CLI.
4296 9. Repeat steps 3 and 4.
4297 """
4298
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004299 def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004300 """
4301 Test Method:
4302 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4303 1. OLT and ONU is detected and validated.
4304 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4305 3. Send dhcp request from residential subscriber to external dhcp server.
4306 4. Verify that subscriber get ip from external dhcp server. successfully.
4307 5. Disable onu port which is being detected in voltha CLI.
4308 6. Repeat step 3.
4309 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4310 """
4311
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004312 def test_subscriber_with_voltha_for_dhcprelay_disable_enable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004313 """
4314 Test Method:
4315 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4316 1. OLT and ONU is detected and validated.
4317 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4318 3. Send dhcp request from residential subscriber to external dhcp server.
4319 4. Verify that subscriber get ip from external dhcp server. successfully.
4320 5. Disable onu port which is being detected in voltha CLI.
4321 6. Repeat step 3.
4322 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4323 8. Enable onu port which is being detected in voltha CLI.
4324 9. Repeat steps 3 and 4.
4325 """
4326
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004327 def test_two_subscribers_with_voltha_for_dhcprelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004328 """
4329 Test Method:
4330 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4331 1. OLT and ONU is detected and validated.
4332 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4333 3. Send dhcp request from two residential subscribers to external dhcp server.
4334 4. Verify that subscribers had got different ips from external dhcp server. successfully.
4335 """
4336
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004337 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_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 ip from external dhcp server. successfully.
4345 5. Repeat step 3 and 4 for 10 times for both subscribers.
4346 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
4347 """
4348
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004349 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004350 """
4351 Test Method:
4352 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4353 1. OLT and ONU is detected and validated.
4354 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4355 3. Send dhcp request from two residential subscribers to external dhcp server.
4356 4. Verify that subscribers had got ip from external dhcp server. successfully.
4357 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
4358 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
4359 """
4360
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004361 def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004362 """
4363 Test Method:
4364 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4365 1. OLT and ONU is detected and validated.
4366 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4367 3. Send dhcp request from one residential subscriber to external dhcp server.
4368 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
4369 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
4370 """
4371
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004372 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 +00004373 """
4374 Test Method:
4375 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4376 1. OLT and ONU is detected and validated.
4377 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4378 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
4379 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
4380 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
4381 """
4382
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004383 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004384 """
4385 Test Method:
4386 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4387 1. OLT and ONU is detected and validated.
4388 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4389 3. Send dhcp request from two residential subscribers to external dhcp server.
4390 4. Verify that subscribers had got ip from external dhcp server. successfully.
4391 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4392 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4393 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4394 """
4395
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004396 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004397 """
4398 Test Method:
4399 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4400 1. OLT and ONU is detected and validated.
4401 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4402 3. Send dhcp request from two residential subscribers to external dhcp server.
4403 4. Verify that subscribers had got ip from external dhcp server. successfully.
4404 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4405 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4406 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4407 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
4408 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
4409 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4410 """
4411
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004412 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004413 """
4414 Test Method:
4415 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4416 1. OLT and ONU is detected and validated.
4417 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4418 3. Send dhcp request from two residential subscribers to external dhcp server.
4419 4. Verify that subscribers had got ip from external dhcp server. successfully.
4420 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4421 6. Disable the olt device which is detected in voltha.
4422 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4423 """
4424
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004425 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004426 """
4427 Test Method:
4428 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4429 1. OLT and ONU is detected and validated.
4430 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4431 3. Send dhcp request from two residential subscribers to external dhcp server.
4432 4. Verify that subscribers had got ip from external dhcp server. successfully.
4433 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4434 6. Disable the olt device which is detected in voltha.
4435 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4436 8. Enable the olt device which is detected in voltha.
4437 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4438 """
4439
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004440 def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004441 """
4442 Test Method:
4443 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4444 1. OLT and ONU is detected and validated.
4445 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4446 3. Send dhcp request from two residential subscribers to external dhcp server.
4447 4. Verify that subscribers had got ip from external dhcp server. successfully.
4448 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4449 6. Pause the olt device which is detected in voltha.
4450 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4451 """
Thangavelu K S36edb012017-07-05 18:24:12 +00004452
Thangavelu K S6432b522017-07-22 00:05:54 +00004453 def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004454 """
4455 Test Method:
4456 0. Make sure that voltha is up and running on CORD-POD setup.
4457 1. OLT and ONU is detected and validated.
4458 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4459 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4460 4. Send igmp joins for a multicast group address multi-group-addressA.
4461 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4462 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4463 """
4464
Thangavelu K S8e413082017-07-13 20:02:14 +00004465 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4466 num_subscribers = 1
4467 num_channels = 1
4468 services = ('IGMP')
4469 cbs = (self.igmp_flow_check, None, None)
4470 self.voltha_subscribers(services, cbs = cbs,
4471 num_subscribers = num_subscribers,
4472 num_channels = num_channels)
4473
Thangavelu K S6432b522017-07-22 00:05:54 +00004474 def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004475 """
4476 Test Method:
4477 0. Make sure that voltha is up and running on CORD-POD setup.
4478 1. OLT and ONU is detected and validated.
4479 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4480 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4481 4. Send igmp joins for a multicast group address multi-group-addressA.
4482 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4483 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4484 7. Send igmp leave for a multicast group address multi-group-addressA.
4485 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4486 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004487 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4488 num_subscribers = 1
4489 num_channels = 1
4490 services = ('IGMP')
4491 cbs = (self.igmp_flow_check, None, None)
4492 self.voltha_subscribers(services, cbs = cbs,
4493 num_subscribers = num_subscribers,
4494 num_channels = num_channels)
4495
Thangavelu K S6432b522017-07-22 00:05:54 +00004496 def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004497 """
4498 Test Method:
4499 0. Make sure that voltha is up and running on CORD-POD setup.
4500 1. OLT and ONU is detected and validated.
4501 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4502 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4503 4. Send igmp joins for a multicast group address multi-group-addressA.
4504 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4505 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4506 7. Send igmp leave for a multicast group address multi-group-addressA.
4507 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4508 9. Repeat steps 4 to 6.
4509 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004510 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4511 num_subscribers = 1
4512 num_channels = 1
4513 services = ('IGMP')
4514 cbs = (self.igmp_flow_check, None, None)
4515 self.voltha_subscribers(services, cbs = cbs,
4516 num_subscribers = num_subscribers,
4517 num_channels = num_channels)
4518
Thangavelu K S6432b522017-07-22 00:05:54 +00004519 def test_subscriber_with_voltha_for_igmp_2_groups_joins_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004520 """
4521 Test Method:
4522 0. Make sure that voltha is up and running on CORD-POD setup.
4523 1. OLT and ONU is detected and validated.
4524 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4525 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4526 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4527 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4528 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4529 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004530 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4531 num_subscribers = 1
4532 num_channels = 2
4533 services = ('IGMP')
4534 cbs = (self.igmp_flow_check, None, None)
4535 self.voltha_subscribers(services, cbs = cbs,
4536 num_subscribers = num_subscribers,
4537 num_channels = num_channels)
4538
Thangavelu K S6432b522017-07-22 00:05:54 +00004539 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 +00004540 """
4541 Test Method:
4542 0. Make sure that voltha is up and running on CORD-POD setup.
4543 1. OLT and ONU is detected and validated.
4544 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4545 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4546 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4547 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4548 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4549 7. Send igmp leave for a multicast group address multi-group-addressA.
4550 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.
4551 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester.
4552 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004553 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4554 num_subscribers = 1
4555 num_channels = 2
4556 services = ('IGMP')
4557 cbs = (self.igmp_flow_check, None, None)
4558 self.voltha_subscribers(services, cbs = cbs,
4559 num_subscribers = num_subscribers,
4560 num_channels = num_channels)
4561
Thangavelu K S6432b522017-07-22 00:05:54 +00004562 def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004563 """
4564 Test Method:
4565 0. Make sure that voltha is up and running on CORD-POD setup.
4566 1. OLT and ONU is detected and validated.
4567 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4568 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4569 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4570 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4571 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4572 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4573 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4574 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004575 num_subscribers = 1
4576 num_channels = 1
4577 services = ('IGMP')
4578 cbs = (self.igmp_flow_check, None, None)
4579 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4580 num_subscribers = num_subscribers,
4581 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004582
Thangavelu K S6432b522017-07-22 00:05:54 +00004583 def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004584 """
4585 Test Method:
4586 0. Make sure that voltha is up and running on CORD-POD setup.
4587 1. OLT and ONU is detected and validated.
4588 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4589 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4590 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4591 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4592 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4593 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA
4594 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4595 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4596 """
4597
Thangavelu K S8e413082017-07-13 20:02:14 +00004598 num_subscribers = 1
4599 num_channels = 2
4600 services = ('IGMP')
4601 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4602 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4603 num_subscribers = num_subscribers,
4604 num_channels = num_channels)
4605
Thangavelu K S6432b522017-07-22 00:05:54 +00004606 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 +00004607 """
4608 Test Method:
4609 0. Make sure that voltha is up and running on CORD-POD setup.
4610 1. OLT and ONU is detected and validated.
4611 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4612 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4613 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4614 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4615 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4616 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA
4617 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4618 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4619 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004620 num_subscribers = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004621 num_channels = 2
Thangavelu K S8e413082017-07-13 20:02:14 +00004622 services = ('IGMP')
4623 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4624 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4625 num_subscribers = num_subscribers,
4626 num_channels = num_channels)
4627
Thangavelu K S6432b522017-07-22 00:05:54 +00004628 def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004629 """
4630 Test Method:
4631 0. Make sure that voltha is up and running on CORD-POD setup.
4632 1. OLT and ONU is detected and validated.
4633 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4634 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4635 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4636 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4637 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4638 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA
4639 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4640 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4641 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004642
4643 num_subscribers = 1
4644 num_channels = 1
4645 services = ('IGMP')
4646 cbs = (self.igmp_flow_check_join_change_to_block, None, None)
4647 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4648 num_subscribers = num_subscribers,
4649 num_channels = num_channels)
4650
Thangavelu K S6432b522017-07-22 00:05:54 +00004651 def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004652 """
4653 Test Method:
4654 0. Make sure that voltha is up and running on CORD-POD setup.
4655 1. OLT and ONU is detected and validated.
4656 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4657 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4658 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4659 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4660 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4661 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB
4662 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4663 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4664 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004665
4666 num_subscribers = 1
4667 num_channels = 1
4668 services = ('IGMP')
4669 cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None)
4670 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4671 num_subscribers = num_subscribers,
4672 num_channels = num_channels)
4673
Thangavelu K S6432b522017-07-22 00:05:54 +00004674 def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004675 """
4676 Test Method:
4677 0. Make sure that voltha is up and running on CORD-POD setup.
4678 1. OLT and ONU is detected and validated.
4679 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4680 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4681 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4682 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4683 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4684 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4685 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4686 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004687
4688 num_subscribers = 1
4689 num_channels = 1
4690 services = ('IGMP')
4691 cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None)
4692 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4693 num_subscribers = num_subscribers,
4694 num_channels = num_channels)
4695
Thangavelu K S6432b522017-07-22 00:05:54 +00004696 def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004697 """
4698 Test Method:
4699 0. Make sure that voltha is up and running on CORD-POD setup.
4700 1. OLT and ONU is detected and validated.
4701 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4702 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4703 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4704 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4705 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4706 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4707 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4708 """
4709
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004710 num_subscribers = 1
4711 num_channels = 1
4712 services = ('IGMP')
4713 cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None)
4714 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4715 num_subscribers = num_subscribers,
4716 num_channels = num_channels)
4717
Thangavelu K S6432b522017-07-22 00:05:54 +00004718 def test_two_subscribers_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004719 """
4720 Test Method:
4721 0. Make sure that voltha is up and running on CORD-POD setup.
4722 1. OLT and ONU is detected and validated.
4723 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4724 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4725 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4726 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4727 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4728 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4729 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4730 """
4731
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004732 num_subscribers = 2
4733 num_channels = 1
4734 services = ('IGMP')
4735 cbs = (self.igmp_flow_check, None, None)
4736 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'],
4737 num_subscribers = num_subscribers,
4738 num_channels = num_channels)
4739
Thangavelu K S36edb012017-07-05 18:24:12 +00004740 def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self):
4741 """
4742 Test Method:
4743 0. Make sure that voltha is up and running on CORD-POD setup.
4744 1. OLT and ONU is detected and validated.
4745 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4746 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4747 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4748 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4749 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4750 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4751 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4752 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4753 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4754 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4755 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004756 num_subscribers = 2
4757 num_channels = 2
4758 services = ('IGMP')
4759 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4760 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'],
4761 num_subscribers = num_subscribers,
4762 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004763
Thangavelu K S6432b522017-07-22 00:05:54 +00004764 def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004765 """
4766 Test Method:
4767 0. Make sure that voltha is up and running on CORD-POD setup.
4768 1. OLT and ONU is detected and validated.
4769 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4770 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4771 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4772 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4773 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4774 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.
4775 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.
4776 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4777 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.
4778 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.
4779 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.
4780 """
4781
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004782 num_subscribers = 2
4783 num_channels = 2
4784 services = ('IGMP')
4785 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4786 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'],
4787 num_subscribers = num_subscribers,
4788 num_channels = num_channels)
4789
4790 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00004791 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 +00004792 """
4793 Test Method:
4794 0. Make sure that voltha is up and running on CORD-POD setup.
4795 1. OLT and ONU is detected and validated.
4796 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4797 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4798 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4799 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4800 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4801 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4802 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4803 9. Disable uni_2 port which is being shown on voltha CLI.
4804 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4805 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4806 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004807 #rx_port = self.port_map['ports'][port_list[i][1]]
4808 df = defer.Deferred()
4809 def igmp_flow_check_operating_onu_admin_state(df):
4810 num_subscribers = 2
4811 num_channels = 2
4812 services = ('IGMP')
4813 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
4814 port_list = self.generate_port_list(num_subscribers, num_channels)
4815
4816 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4817 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
4818 thread1.start()
4819 time.sleep(randint(40,50))
4820 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
4821 thread2.start()
4822 time.sleep(10)
4823 thread1.join()
4824 thread2.join()
4825 try:
4826 assert_equal(self.success, False)
4827 log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check')
4828 time.sleep(10)
4829 finally:
4830 pass
4831 df.callback(0)
4832 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
4833 return df
4834
4835 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00004836 def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self):
4837 """
4838 Test Method:
4839 0. Make sure that voltha is up and running on CORD-POD setup.
4840 1. OLT and ONU is detected and validated.
4841 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4842 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4843 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4844 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4845 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4846 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4847 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4848 9. Disable uni_2 port which is being shown on voltha CLI.
4849 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4850 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4851 12. Enable uni_2 port which we disable at step 9.
4852 13. Repeat step 5,6 and 8.
4853 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004854 df = defer.Deferred()
4855 def igmp_flow_check_operating_onu_admin_state(df):
4856 num_subscribers = 2
4857 num_channels = 2
4858 services = ('IGMP')
4859 cbs = (self.igmp_flow_check, None, None)
4860 port_list = self.generate_port_list(num_subscribers, num_channels)
4861
4862 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4863 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
4864 thread1.start()
4865 time.sleep(randint(50,60))
4866 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
4867 thread2.start()
4868 time.sleep(10)
4869 thread1.join()
4870 thread2.join()
4871 try:
4872 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00004873 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 +00004874 time.sleep(10)
4875 finally:
4876 pass
4877 df.callback(0)
4878 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
4879 return df
4880
4881 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00004882 def test_two_subscribers_with_voltha_for_igmp_disabling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004883 """
4884 Test Method:
4885 0. Make sure that voltha is up and running on CORD-POD setup.
4886 1. OLT and ONU is detected and validated.
4887 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4888 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4889 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4890 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4891 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4892 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4893 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4894 9. Disable olt device which is being shown on voltha CLI.
4895 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4896 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4897 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004898 df = defer.Deferred()
4899 def igmp_flow_check_operating_olt_admin_disble(df):
4900 num_subscribers = 2
4901 num_channels = 2
4902 services = ('IGMP')
4903 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
4904 port_list = self.generate_port_list(num_subscribers, num_channels)
4905
4906 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4907 thread1.start()
4908 time.sleep(randint(50,60))
4909 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
4910 thread2.start()
4911 time.sleep(10)
4912 thread1.join()
4913 thread2.join()
4914 try:
4915 assert_equal(self.success, False)
4916 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
4917 time.sleep(10)
4918 finally:
4919 pass
4920 df.callback(0)
4921 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
4922 return df
4923
4924 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00004925 def test_two_subscribers_with_voltha_for_igmp_pausing_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004926 """
4927 Test Method:
4928 0. Make sure that voltha is up and running on CORD-POD setup.
4929 1. OLT and ONU is detected and validated.
4930 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4931 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4932 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4933 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4934 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4935 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4936 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4937 9. Pause olt device which is being shown on voltha CLI.
4938 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4939 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4940 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004941 df = defer.Deferred()
4942 def igmp_flow_check_operating_olt_admin_pause(df):
4943 num_subscribers = 2
4944 num_channels = 2
4945 services = ('IGMP')
4946 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
4947 port_list = self.generate_port_list(num_subscribers, num_channels)
4948
4949 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4950 thread1.start()
4951 time.sleep(randint(50,60))
4952 thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,))
4953 thread2.start()
4954 time.sleep(10)
4955 thread1.join()
4956 thread2.join()
4957 try:
4958 assert_equal(self.success, False)
4959 log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test')
4960 time.sleep(10)
4961 finally:
4962 pass
4963 df.callback(0)
4964 reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df)
4965 return df
4966
4967 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00004968 def test_two_subscribers_with_voltha_for_igmp_toggling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004969 """
4970 Test Method:
4971 0. Make sure that voltha is up and running on CORD-POD setup.
4972 1. OLT and ONU is detected and validated.
4973 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4974 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4975 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4976 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4977 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4978 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4979 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4980 9. Disable olt device which is being shown on voltha CLI.
4981 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4982 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4983 12. Enable olt device which is disable at step 9.
4984 13. Repeat steps 4,5, 7 and 8.
4985 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004986 df = defer.Deferred()
4987 def igmp_flow_check_operating_olt_admin_restart(df):
4988 num_subscribers = 2
4989 num_channels = 2
4990 services = ('IGMP')
4991 cbs = (self.igmp_flow_check, None, None)
4992 port_list = self.generate_port_list(num_subscribers, num_channels)
4993
4994 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
4995 thread1.start()
4996 time.sleep(randint(50,60))
4997 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
4998 thread2.start()
4999 time.sleep(10)
5000 thread1.join()
5001 thread2.join()
5002 try:
5003 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005004 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 +00005005 time.sleep(10)
5006 finally:
5007 pass
5008 df.callback(0)
5009 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5010 return df
Thangavelu K S6432b522017-07-22 00:05:54 +00005011
5012 @deferred(TESTCASE_TIMEOUT)
5013 def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self):
5014 """
5015 Test Method:
5016 0. Make sure that voltha is up and running on CORD-POD setup.
5017 1. OLT and ONU is detected and validated.
5018 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5019 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5020 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5021 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5022 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5023 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5024 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5025 9. Disable olt device which is being shown on voltha CLI.
5026 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5027 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5028 12. Repeat steps 4 to 11 steps multiple times (example 20 times)
5029 """
5030 df = defer.Deferred()
5031 no_iterations = 20
5032 def igmp_flow_check_operating_olt_admin_disble(df):
5033 num_subscribers = 2
5034 num_channels = 2
5035 services = ('IGMP')
5036 cbs = (self.igmp_flow_check, None, None)
5037 port_list = self.generate_port_list(num_subscribers, num_channels)
5038
5039 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5040 thread1.start()
5041 time.sleep(randint(30,40))
5042 for i in range(no_iterations):
5043 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5044 thread2.start()
5045 time.sleep(8)
5046 thread2.join()
5047 thread1.join()
5048 thread1.isAlive()
5049 thread2.join()
5050 try:
5051 assert_equal(self.success, False)
5052 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5053 time.sleep(10)
5054 finally:
5055 pass
5056 df.callback(0)
5057 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5058 return df
5059
5060 @deferred(TESTCASE_TIMEOUT + 200)
5061 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self):
5062 """
5063 Test Method:
5064 0. Make sure that voltha is up and running on CORD-POD setup.
5065 1. OLT and ONU is detected and validated.
5066 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5067 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5068 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5069 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5070 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5071 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5072 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5073 9. Disable uni_2 port which is being shown on voltha CLI.
5074 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5075 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5076 12. Enable uni_2 port which we disable at step 9.
5077 13. Repeat step 5,6 and 8.
5078 14. Repeat steps 4 to 13 steps multiple times (example 5 times)
5079 """
5080 df = defer.Deferred()
5081 no_iterations = 5
5082 def igmp_flow_check_operating_onu_admin_state(df):
5083 num_subscribers = 2
5084 num_channels = 2
5085 services = ('IGMP')
5086 cbs = (self.igmp_flow_check, None, None)
5087 port_list = self.generate_port_list(num_subscribers, num_channels)
5088
5089 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5090 thread1.start()
5091 time.sleep(randint(40,60))
5092 for i in range(no_iterations):
5093 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5094 log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha')
5095 thread2.start()
5096 time.sleep(1)
5097 thread2.join()
5098 thread1.isAlive()
5099 thread1.join()
5100 thread2.join()
5101 try:
5102 assert_equal(self.success, True)
5103 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful')
5104 time.sleep(10)
5105 finally:
5106 pass
5107 df.callback(0)
5108 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5109 return df
5110
5111 @deferred(TESTCASE_TIMEOUT)
5112 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self):
5113 """
5114 Test Method:
5115 0. Make sure that voltha is up and running on CORD-POD setup.
5116 1. OLT and ONU is detected and validated.
5117 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5118 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5119 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5120 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5121 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5122 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5123 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5124 9. Disable olt device which is being shown on voltha CLI.
5125 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5126 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5127 12. Enable olt device which is disable at step 9.
5128 13. Repeat steps 4,5, 7 and 8.
5129 14. Repeat steps 4 to 13 steps multiple times (example 10 times)
5130 """
5131 df = defer.Deferred()
5132 no_iterations = 10
5133 def igmp_flow_check_operating_olt_admin_restart(df):
5134 num_subscribers = 2
5135 num_channels = 2
5136 services = ('IGMP')
5137 cbs = (self.igmp_flow_check, None, None)
5138 port_list = self.generate_port_list(num_subscribers, num_channels)
5139
5140 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 2, ['1.2.3.4', '3.4.5.6'],))
5141 thread1.start()
5142 time.sleep(randint(50,60))
5143 for i in range(no_iterations):
5144 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5145 thread2.start()
5146 time.sleep(10)
5147 thread2.join()
5148 thread1.join()
5149 thread2.join()
5150 try:
5151 assert_equal(self.success, True)
5152 log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful')
5153 time.sleep(10)
5154 finally:
5155 pass
5156 df.callback(0)
5157 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5158 return df
5159
5160 def test_5_subscriber_with_voltha_for_igmp_with_10_group_joins_verifying_traffic(self):
5161 """
5162 Test Method:
5163 0. Make sure that voltha is up and running on CORD-POD setup.
5164 1. OLT and ONU is detected and validated.
5165 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5166 3. Issue multiple dhcp client packets to get IP address from dhcp server for as subscribers and check connectivity.
5167 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5168 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5169 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5170 """
5171
5172 num_subscribers = 5
5173 num_channels = 10
5174 services = ('IGMP')
5175 cbs = (self.igmp_flow_check, None, None)
5176 self.voltha_subscribers(services, cbs = cbs,
5177 num_subscribers = num_subscribers,
5178 num_channels = num_channels)
5179
5180 def test_9_subscriber_with_voltha_for_igmp_with_10_group_joins_and_verify_traffic(self):
5181 """
5182 Test Method:
5183 0. Make sure that voltha is up and running on CORD-POD setup.
5184 1. OLT and ONU is detected and validated.
5185 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5186 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity.
5187 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5188 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5189 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5190 """
5191 num_subscribers = 9
5192 num_channels = 10
5193 services = ('IGMP')
5194 cbs = (self.igmp_flow_check, None, None)
5195 self.voltha_subscribers(services, cbs = cbs,
5196 num_subscribers = num_subscribers,
5197 num_channels = num_channels)