blob: 231bcf568bc90e6ffa243823701bc18b3366f08a [file] [log] [blame]
A R Karthick35495c32017-05-11 14:58:32 -07001import os
2import sys
3import unittest
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004import time, monotonic
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 Sb006b8a2017-07-28 19:29:39 +000036 STATS_RX = 0
37 STATS_TX = 1
Thangavelu K S8e413082017-07-13 20:02:14 +000038 STATS_JOIN = 2
39 STATS_LEAVE = 3
40
Thangavelu K S8e413082017-07-13 20:02:14 +000041 def __init__(self, tx_port, rx_port, num_channels =1, channel_start = 0, src_list = None):
42 self.tx_port = tx_port
43 self.rx_port = rx_port
44 self.src_list = src_list
Thangavelu K Sb006b8a2017-07-28 19:29:39 +000045 self.num_channels = num_channels
Thangavelu K S36edb012017-07-05 18:24:12 +000046 try:
Thangavelu K S8e413082017-07-13 20:02:14 +000047 self.tx_intf = tx_port
48 self.rx_intf = rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +000049 except:
50 self.tx_intf = self.INTF_TX_DEFAULT
51 self.rx_intf = self.INTF_RX_DEFAULT
Thangavelu K S8e413082017-07-13 20:02:14 +000052# num = 1
53# channel_start = 0
Thangavelu K S36edb012017-07-05 18:24:12 +000054 mcast_cb = None
Thangavelu K S8e413082017-07-13 20:02:14 +000055 Channels.__init__(self, num_channels, channel_start = channel_start, src_list = src_list,
Thangavelu K S36edb012017-07-05 18:24:12 +000056 iface = self.rx_intf, iface_mcast = self.tx_intf, mcast_cb = mcast_cb)
57
Thangavelu K S8e413082017-07-13 20:02:14 +000058 self.loginType = 'wireless'
Thangavelu K S36edb012017-07-05 18:24:12 +000059 ##start streaming channels
60 self.join_map = {}
61 ##accumulated join recv stats
62 self.join_rx_stats = Stats()
63 self.recv_timeout = False
64
65
66 def channel_join_update(self, chan, join_time):
67 self.join_map[chan] = ( Stats(), Stats(), Stats(), Stats() )
68 self.channel_update(chan, self.STATS_JOIN, 1, t = join_time)
69
Thangavelu K S8e413082017-07-13 20:02:14 +000070 def channel_join(self, chan = 0, delay = 2, src_list = None, record_type = None):
Thangavelu K S36edb012017-07-05 18:24:12 +000071 '''Join a channel and create a send/recv stats map'''
72 if self.join_map.has_key(chan):
73 del self.join_map[chan]
74 self.delay = delay
Thangavelu K S8e413082017-07-13 20:02:14 +000075 chan, join_time = self.join(chan, src_list = src_list, record_type = record_type)
76 #chan, join_time = self.join(chan)
Thangavelu K S36edb012017-07-05 18:24:12 +000077 self.channel_join_update(chan, join_time)
78 return chan
79
Thangavelu K Sb006b8a2017-07-28 19:29:39 +000080 def channel_join_next(self, delay = 2, src_list = None, leave_flag = True):
Thangavelu K S36edb012017-07-05 18:24:12 +000081 '''Joins the next channel leaving the last channel'''
82 if self.last_chan:
83 if self.join_map.has_key(self.last_chan):
84 del self.join_map[self.last_chan]
85 self.delay = delay
Thangavelu K Sb006b8a2017-07-28 19:29:39 +000086 chan, join_time = self.join_next(src_list = src_list, leave_flag = leave_flag)
Thangavelu K S36edb012017-07-05 18:24:12 +000087 self.channel_join_update(chan, join_time)
88 return chan
89
90 def channel_jump(self, delay = 2):
91 '''Jumps randomly to the next channel leaving the last channel'''
92 if self.last_chan is not None:
93 if self.join_map.has_key(self.last_chan):
94 del self.join_map[self.last_chan]
95 self.delay = delay
96 chan, join_time = self.jump()
97 self.channel_join_update(chan, join_time)
98 return chan
99
Thangavelu K S8e413082017-07-13 20:02:14 +0000100 def channel_leave(self, chan = 0, force = False, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +0000101 if self.join_map.has_key(chan):
102 del self.join_map[chan]
Thangavelu K S8e413082017-07-13 20:02:14 +0000103 self.leave(chan, force = force, src_list = src_list)
Thangavelu K S36edb012017-07-05 18:24:12 +0000104
105 def channel_update(self, chan, stats_type, packets, t=0):
106 if type(chan) == type(0):
107 chan_list = (chan,)
108 else:
109 chan_list = chan
110 for c in chan_list:
111 if self.join_map.has_key(c):
112 self.join_map[c][stats_type].update(packets = packets, t = t)
113
Thangavelu K S8e413082017-07-13 20:02:14 +0000114 def channel_receive(self, chan, cb = None, count = 1, timeout = 5, src_list = None):
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000115 log_test.info('Subscriber on port %s checking data traffic receiving from group %s, channel %d' %
Thangavelu K S8e413082017-07-13 20:02:14 +0000116 (self.rx_intf, self.gaddr(chan), chan))
117 r = self.recv(chan, cb = cb, count = count, timeout = timeout, src_list = src_list)
Thangavelu K S36edb012017-07-05 18:24:12 +0000118 if len(r) == 0:
Thangavelu K S8e413082017-07-13 20:02:14 +0000119 log_test.info('Subscriber on port %s timed out' %( self.rx_intf))
120 self.test_status = False
Thangavelu K S36edb012017-07-05 18:24:12 +0000121 else:
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000122 self.test_status = True
123 pass
124# log_test.info('Subscriber on port %s received %d packets' %(self.rx_intf, len(r)))
Thangavelu K S36edb012017-07-05 18:24:12 +0000125 if self.recv_timeout:
126 ##Negative test case is disabled for now
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000127 log_test.info('Subscriber on port %s not received %d packets' %(self.rx_intf, len(r)))
Thangavelu K S36edb012017-07-05 18:24:12 +0000128 assert_equal(len(r), 0)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000129 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000130 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +0000131
Thangavelu K S9a637332017-08-01 23:22:23 +0000132 def channel_not_receive(self, chan, cb = None, count = 1, timeout = 5, src_list = None):
133 log_test.info('Subscriber on port %s checking data traffic receiving from group %s, channel %d' %
134 (self.rx_intf, self.gaddr(chan), chan))
135 r = self.not_recv(chan, cb = cb, count = count, timeout = timeout, src_list = src_list)
136 if len(r) == 0:
137 log_test.info('Subscriber on port %s timed out' %( self.rx_intf))
138 self.test_status = True
139 else:
140 self.test_status = False
141 pass
142# log_test.info('Subscriber on port %s received %d packets' %(self.rx_intf, len(r)))
143 if self.recv_timeout:
144 ##Negative test case is disabled for now
145 log_test.info('Subscriber on port %s not received %d packets' %(self.rx_intf, len(r)))
146 assert_equal(len(r), 0)
147 self.test_status = True
148 return self.test_status
149
150
Thangavelu K S8e413082017-07-13 20:02:14 +0000151 def recv_channel_cb(self, pkt, src_list = None):
152
Thangavelu K S36edb012017-07-05 18:24:12 +0000153 ##First verify that we have received the packet for the joined instance
Thangavelu K S9a637332017-08-01 23:22:23 +0000154 log_test.info('Packet received for group %s, subscriber, port %s and from source ip %s showing full packet %s'%
155 (pkt[IP].dst, self.rx_intf, pkt[IP].src, pkt.show))
156 if src_list is not None:
157 for i in src_list:
158 if pkt[IP].src == src_list[i]:
159 pass
160 else:
161 log_test.info('Packet received for group %s, subscriber, port %s and from source ip %s which is not expcted on that port'%
162 (pkt[IP].dst, self.rx_intf, pkt[IP].src))
163
164 self.recv_timeout = True
165
Thangavelu K S36edb012017-07-05 18:24:12 +0000166 if self.recv_timeout:
167 return
168 chan = self.caddr(pkt[IP].dst)
169 assert_equal(chan in self.join_map.keys(), True)
170 recv_time = monotonic.monotonic() * 1000000
171 join_time = self.join_map[chan][self.STATS_JOIN].start
172 delta = recv_time - join_time
173 self.join_rx_stats.update(packets=1, t = delta, usecs = True)
174 self.channel_update(chan, self.STATS_RX, 1, t = delta)
175 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
176
Thangavelu K S36edb012017-07-05 18:24:12 +0000177class voltha_subscriber_pool:
178
179 def __init__(self, subscriber, test_cbs):
180 self.subscriber = subscriber
181 self.test_cbs = test_cbs
182
183 def pool_cb(self):
184 for cb in self.test_cbs:
185 if cb:
Thangavelu K S8e413082017-07-13 20:02:14 +0000186 self.test_status = cb(self.subscriber, multiple_sub = True)
Thangavelu K S36edb012017-07-05 18:24:12 +0000187 if self.test_status is not True:
Thangavelu K S6432b522017-07-22 00:05:54 +0000188 ## This is chaining for other sub status has to check again
Thangavelu K S36edb012017-07-05 18:24:12 +0000189 self.test_status = True
190 log_test.info('This service is failed and other services will not run for this subscriber')
191 break
192 log_test.info('This Subscriber is tested for multiple service eligibility ')
193 self.test_status = True
194
A R Karthick35495c32017-05-11 14:58:32 -0700195class voltha_exchange(unittest.TestCase):
196
197 OLT_TYPE = 'tibit_olt'
198 OLT_MAC = '00:0c:e2:31:12:00'
199 VOLTHA_HOST = 'localhost'
200 VOLTHA_REST_PORT = 8881
Thangavelu K S36edb012017-07-05 18:24:12 +0000201 VOLTHA_OLT_TYPE = 'ponsim_olt'
202 VOLTHA_OLT_MAC = '00:0c:e2:31:12:00'
203 VOLTHA_IGMP_ITERATIONS = 100
A R Karthick35495c32017-05-11 14:58:32 -0700204 voltha = None
A R Karthick53442712017-07-27 12:23:30 -0700205 voltha_attrs = None
Thangavelu K S9648eed2017-06-13 20:15:25 +0000206 success = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000207 olt_device_id = None
Thangavelu K S6432b522017-07-22 00:05:54 +0000208 apps = ('org.opencord.aaa', 'org.onosproject.dhcp', 'org.onosproject.dhcprelay')
209 app_dhcp = ('org.onosproject.dhcp')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000210 olt_apps = () #'org.opencord.cordmcast')
211 vtn_app = 'org.opencord.vtn'
212 table_app = 'org.ciena.cordigmp'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000213 test_path = os.path.dirname(os.path.realpath(__file__))
214 table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700215 app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000216 olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar')
A.R Karthick3493a572017-06-07 18:28:10 -0700217 olt_app_name = 'org.onosproject.olt'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000218 #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
219 olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
220 onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
A R Karthick9dc6e922017-07-12 14:40:16 -0700221 VOLTHA_AUTO_CONFIGURE = False
Thangavelu K S8e413082017-07-13 20:02:14 +0000222 num_joins = 0
223
Thangavelu K S6432b522017-07-22 00:05:54 +0000224 relay_interfaces_last = ()
225 interface_to_mac_map = {}
226 host_ip_map = {}
227 default_config = { 'default-lease-time' : 600, 'max-lease-time' : 7200, }
228 default_options = [ ('subnet-mask', '255.255.255.0'),
229 ('broadcast-address', '192.168.1.255'),
230 ('domain-name-servers', '192.168.1.1'),
231 ('domain-name', '"mydomain.cord-tester"'),
232 ]
233 ##specify the IP for the dhcp interface matching the subnet and subnet config
234 ##this is done for each interface dhcpd server would be listening on
235 default_subnet_config = [ ('192.168.1.2',
236'''
237subnet 192.168.1.0 netmask 255.255.255.0 {
238 range 192.168.1.10 192.168.1.100;
239}
240'''), ]
241
242
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000243 VOLTHA_ENABLED = True
244 INTF_TX_DEFAULT = 'veth2'
245 INTF_RX_DEFAULT = 'veth0'
Thangavelu K S9648eed2017-06-13 20:15:25 +0000246 INTF_2_RX_DEFAULT = 'veth6'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000247 TESTCASE_TIMEOUT = 300
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000248 VOLTHA_IGMP_ITERATIONS = 10
249# VOLTHA_CONFIG_FAKE = True
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000250 VOLTHA_CONFIG_FAKE = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000251 VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
A R Karthick53442712017-07-27 12:23:30 -0700252 VOLTHA_UPLINK_VLAN_START = 444
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000253 VOLTHA_ONU_UNI_PORT = 'veth0'
254
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000255 dhcp_server_config = {
256 "ip": "10.1.11.50",
257 "mac": "ca:fe:ca:fe:ca:fe",
258 "subnet": "255.255.252.0",
259 "broadcast": "10.1.11.255",
260 "router": "10.1.8.1",
261 "domain": "8.8.8.8",
262 "ttl": "63",
263 "delay": "2",
264 "startip": "10.1.11.51",
265 "endip": "10.1.11.100"
266 }
267
268
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000269 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
270MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
271CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
272IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
273RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
274MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
275BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
276hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
277gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
278+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
279rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
280VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
281eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
2826tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
283PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
284nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
285-----END CERTIFICATE-----"""
286
287 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
288MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
289CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
290IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
291RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
292MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
293BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
294hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
295AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
2965An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
297tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
298OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
299qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
3002Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
301BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
302eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
303MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
304VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
305RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
306dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
307T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
308yg==
309-----END CERTIFICATE-----'''
A R Karthick35495c32017-05-11 14:58:32 -0700310
A.R Karthick3493a572017-06-07 18:28:10 -0700311 @classmethod
312 def update_apps_version(cls):
313 version = Onos.getVersion()
314 major = int(version.split('.')[0])
315 minor = int(version.split('.')[1])
316 cordigmp_app_version = '2.0-SNAPSHOT'
317 olt_app_version = '1.2-SNAPSHOT'
318 if major > 1:
319 cordigmp_app_version = '3.0-SNAPSHOT'
320 olt_app_version = '2.0-SNAPSHOT'
321 elif major == 1:
322 if minor > 10:
323 cordigmp_app_version = '3.0-SNAPSHOT'
324 olt_app_version = '2.0-SNAPSHOT'
325 elif minor <= 8:
326 olt_app_version = '1.1-SNAPSHOT'
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700327 cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version))
328 cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version))
329 cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
330
A R Karthick35495c32017-05-11 14:58:32 -0700331 @classmethod
Thangavelu K S6432b522017-07-22 00:05:54 +0000332 def dhcprelay_setUpClass(cls):
333 ''' Activate the dhcprelay app'''
334 OnosCtrl(cls.app_dhcp).deactivate()
335 time.sleep(3)
336 cls.onos_ctrl = OnosCtrl('org.onosproject.dhcprelay')
337 status, _ = cls.onos_ctrl.activate()
338 assert_equal(status, True)
339 time.sleep(3)
340 cls.dhcp_relay_setup()
341 ##start dhcpd initially with default config
342 cls.dhcpd_start()
343
344 @classmethod
345 def dhcprelay_tearDownClass(cls):
346 '''Deactivate the dhcp relay app'''
347 try:
348 os.unlink('{}/dhcpd.conf'.format(cls.dhcp_data_dir))
349 os.unlink('{}/dhcpd.leases'.format(cls.dhcp_data_dir))
350 except: pass
351 cls.onos_ctrl.deactivate()
352 cls.dhcpd_stop()
353 cls.dhcp_relay_cleanup()
354
355 @classmethod
A.R Karthickf874d032017-06-07 18:47:51 -0700356 def onos_load_config(cls, app, config):
357 status, code = OnosCtrl.config(config)
358 if status is False:
359 log_test.info('JSON config request for app %s returned status %d' %(app, code))
360 assert_equal(status, True)
361 time.sleep(2)
362
363 @classmethod
364 def onos_aaa_load(cls):
365 aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
366 'radiusIp': '172.17.0.2' } } } }
367 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
368 aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip
369 cls.onos_load_config('org.opencord.aaa', aaa_dict)
370
371 @classmethod
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000372 def onos_dhcp_table_load(self, config = None):
373 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
374 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
375 if config:
376 for k in config.keys():
377 if dhcp_config.has_key(k):
378 dhcp_config[k] = config[k]
379 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
380
Thangavelu K S36edb012017-07-05 18:24:12 +0000381 def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = None):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000382 if validation:
Thangavelu K S735a6662017-06-15 18:08:23 +0000383 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
384 assert_not_equal(cip, None)
385 assert_not_equal(sip, None)
386 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
387 (cip, sip, dhcp.get_mac(cip)[0]))
388 if validation == False:
389 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
390 assert_equal(cip, None)
391 assert_equal(sip, None)
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000392 log_test.info('Dhcp client did not get IP from server')
Thangavelu K S735a6662017-06-15 18:08:23 +0000393
Thangavelu K S36edb012017-07-05 18:24:12 +0000394 if validation == 'skip':
395 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
396
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000397 return cip,sip
398
Thangavelu K S36edb012017-07-05 18:24:12 +0000399 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):
400 config = {'startip':startip, 'endip':'10.10.10.200',
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000401 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
402 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
403 self.onos_dhcp_table_load(config)
404 dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface)
Thangavelu K S36edb012017-07-05 18:24:12 +0000405 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed, validation = validation, mac = mac)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000406 return cip, sip
407
408 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700409 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700410 cls.update_apps_version()
A R Karthick53442712017-07-27 12:23:30 -0700411 cls.voltha_attrs = dict(host = cls.VOLTHA_HOST,
412 rest_port = cls.VOLTHA_REST_PORT,
413 uplink_vlan_map = cls.VOLTHA_UPLINK_VLAN_MAP,
414 uplink_vlan_start = cls.VOLTHA_UPLINK_VLAN_START)
415 cls.voltha = VolthaCtrl(**cls.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000416 cls.install_app_table()
417 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
418 cls.port_map, cls.port_list = cls.olt.olt_port_map()
419 cls.switches = cls.port_map['switches']
Thangavelu K S36edb012017-07-05 18:24:12 +0000420 cls.ponsim_ports = cls.port_map['ponsim']
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000421 cls.num_ports = cls.port_map['num_ports']
422 if cls.num_ports > 1:
423 cls.num_ports -= 1 ##account for the tx port
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000424 cls.activate_apps(cls.apps + cls.olt_apps, deactivate = True)
A.R Karthickf874d032017-06-07 18:47:51 -0700425 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000426
A.R Karthick3493a572017-06-07 18:28:10 -0700427 @classmethod
428 def tearDownClass(cls):
429 '''Deactivate the olt apps and restart OVS back'''
430 apps = cls.olt_apps + ( cls.table_app,)
431 for app in apps:
432 onos_ctrl = OnosCtrl(app)
433 onos_ctrl.deactivate()
434 cls.install_app_igmp()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000435 cord_test_radius_restart()
436
A.R Karthick3493a572017-06-07 18:28:10 -0700437 @classmethod
438 def install_app_igmp(cls):
439 ##Uninstall the table app on class exit
440 OnosCtrl.uninstall_app(cls.table_app)
441 time.sleep(2)
442 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
443 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700444
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000445 def remove_olt(self, switch_map):
446 controller = get_controller()
447 auth = ('karaf', 'karaf')
448 #remove subscriber for every port on all the voltha devices
449 for device, device_map in switch_map.iteritems():
450 uni_ports = device_map['ports']
451 uplink_vlan = device_map['uplink_vlan']
452 for port in uni_ports:
453 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
454 device,
455 port)
456 resp = requests.delete(rest_url, auth = auth)
457 if resp.status_code not in [204, 202, 200]:
458 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
459 else:
460 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
461 OnosCtrl.uninstall_app(self.olt_app_file)
462
463 def config_olt(self, switch_map):
464 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000465 auth = ('karaf', 'karaf')
466 #configure subscriber for every port on all the voltha devices
467 for device, device_map in switch_map.iteritems():
468 uni_ports = device_map['ports']
469 uplink_vlan = device_map['uplink_vlan']
470 for port in uni_ports:
471 vlan = port
472 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
473 device,
474 port,
475 vlan)
476 resp = requests.post(rest_url, auth = auth)
477 #assert_equal(resp.ok, True)
478
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000479 def voltha_uni_port_toggle(self, uni_port = None):
480 ## Admin state of port is down and up
481 if not uni_port:
482 uni_port = self.INTF_RX_DEFAULT
483 cmd = 'ifconfig {} down'.format(uni_port)
484 os.system(cmd)
485 log_test.info('Admin state of uni_port is down')
486 time.sleep(30)
487 cmd = 'ifconfig {} up'.format(uni_port)
488 os.system(cmd)
489 log_test.info('Admin state of uni_port is up now')
490 time.sleep(30)
491 return
492
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000493 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000494 def install_app_table(cls):
495 ##Uninstall the existing app if any
496 OnosCtrl.uninstall_app(cls.table_app)
497 time.sleep(2)
498 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
499 OnosCtrl.install_app(cls.table_app_file)
500 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000501
502 @classmethod
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000503 def activate_apps(cls, apps, deactivate = False):
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000504 for app in apps:
505 onos_ctrl = OnosCtrl(app)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000506 if deactivate is True:
507 onos_ctrl.deactivate()
508 time.sleep(2)
509 status, _ = onos_ctrl.activate()
510 assert_equal(status, True)
511 time.sleep(2)
512
513
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000514
Thangavelu K S735a6662017-06-15 18:08:23 +0000515 @classmethod
516 def deactivate_apps(cls, apps):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000517 cls.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000518 for app in apps:
519 onos_ctrl = OnosCtrl(app)
520 status, _ = onos_ctrl.deactivate()
521 if status is False:
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000522 cls.success = False
523 # assert_equal(status, True)
Thangavelu K S735a6662017-06-15 18:08:23 +0000524 time.sleep(2)
525
Thangavelu K S36edb012017-07-05 18:24:12 +0000526 def random_ip(self,start_ip = '10.10.10.20', end_ip = '10.10.10.65'):
527 start = list(map(int, start_ip.split(".")))
528 end = list(map(int, end_ip.split(".")))
529 temp = start
530 ip_range = []
531 ip_range.append(start_ip)
532 while temp != end:
533 start[3] += 1
534 for i in (3, 2, 1):
535 if temp[i] == 255:
536 temp[i] = 0
537 temp[i-1] += 1
538 ip_range.append(".".join(map(str, temp)))
539 return random.choice(ip_range)
540
Thangavelu K S8e413082017-07-13 20:02:14 +0000541 def random_mcast_ip(self,start_ip = '224.0.1.0', end_ip = '224.0.1.100'):
542 start = list(map(int, start_ip.split(".")))
543 end = list(map(int, end_ip.split(".")))
544 temp = start
545 ip_range = []
546 ip_range.append(start_ip)
547 while temp != end:
548 start[3] += 1
549 for i in (3, 2, 1):
550 if temp[i] == 255:
551 temp[i] = 0
552 temp[i-1] += 1
553 ip_range.append(".".join(map(str, temp)))
554 return random.choice(ip_range)
555
Thangavelu K S6432b522017-07-22 00:05:54 +0000556 @classmethod
557 def dhcp_relay_setup(cls):
558 #did = OnosCtrl.get_device_id()
559 #cls.relay_device_id = did
560 #cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
561 #cls.port_map, _ = cls.olt.olt_port_map() self.port_map['ports'][port_list[1][1]]
562 if cls.port_map:
563 ##Per subscriber, we use 1 relay port
564 try:
565 relay_port = cls.port_map['ports']
566 except:
567 relay_port = cls.port_map['uplink']
568 cls.relay_interface_port = relay_port
569 cls.relay_interfaces = (cls.port_map[cls.relay_interface_port],)
570 else:
571# cls.relay_interface_port = 100
572# cls.relay_interfaces = (g_subscriber_port_map[cls.relay_interface_port],)
573 log_test.info('No ONU ports are available, hence returning nothing')
574 cls.relay_interfaces_last = cls.relay_interfaces
575 if cls.port_map:
576 ##generate a ip/mac client virtual interface config for onos
577 interface_list = []
578 for port in cls.port_map['ports']:
579 port_num = cls.port_map[port]
580 if port_num == cls.port_map['uplink']:
581 continue
582 ip = cls.get_host_ip(port_num)
583 mac = cls.get_mac(port)
584 interface_list.append((port_num, ip, mac))
585
586 #configure dhcp server virtual interface on the same subnet as first client interface
587 relay_ip = cls.get_host_ip(interface_list[0][0])
588 relay_mac = cls.get_mac(cls.port_map[cls.relay_interface_port])
589 interface_list.append((cls.relay_interface_port, relay_ip, relay_mac))
590 cls.onos_interface_load(interface_list)
591
592 @classmethod
593 def onos_interface_load(cls, interface_list):
594 interface_dict = { 'ports': {} }
595 for port_num, ip, mac in interface_list:
596 port_map = interface_dict['ports']
597 port = '{}/{}'.format(cls.relay_device_id, port_num)
598 port_map[port] = { 'interfaces': [] }
599 interface_list = port_map[port]['interfaces']
600 interface_map = { 'ips' : [ '{}/{}'.format(ip, 24) ],
601 'mac' : mac,
602 'name': 'vir-{}'.format(port_num)
603 }
604 interface_list.append(interface_map)
605
606 cls.onos_load_config(interface_dict)
607 cls.configs['interface_config'] = interface_dict
608
609 @classmethod
610 def get_host_ip(cls, port):
611 if cls.host_ip_map.has_key(port):
612 return cls.host_ip_map[port]
613 cls.host_ip_map[port] = '192.168.1.{}'.format(port)
614 return cls.host_ip_map[port]
615
616 @classmethod
617 def host_load(cls, iface):
618 '''Have ONOS discover the hosts for dhcp-relay responses'''
619 port = g_subscriber_port_map[iface]
620 host = '173.17.1.{}'.format(port)
621 cmds = ( 'ifconfig {} 0'.format(iface),
622 'ifconfig {0} {1}'.format(iface, host),
623 'arping -I {0} {1} -c 2'.format(iface, host),
624 'ifconfig {} 0'.format(iface), )
625 for c in cmds:
626 os.system(c)
627
628 @classmethod
629 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
630 subnet = default_subnet_config):
631 conf = ''
632 for k, v in config.items():
633 conf += '{} {};\n'.format(k, v)
634
635 opts = ''
636 for k, v in options:
637 opts += 'option {} {};\n'.format(k, v)
638
639 subnet_config = ''
640 for _, v in subnet:
641 subnet_config += '{}\n'.format(v)
642
643 return '{}{}{}'.format(conf, opts, subnet_config)
644
645 @classmethod
646 def dhcpd_start(cls, intf_list = None,
647 config = default_config, options = default_options,
648 subnet = default_subnet_config):
649 '''Start the dhcpd server by generating the conf file'''
650 if intf_list is None:
651 intf_list = cls.relay_interfaces
652 ##stop dhcpd if already running
653 cls.dhcpd_stop()
654 dhcp_conf = cls.dhcpd_conf_generate(config = config, options = options,
655 subnet = subnet)
656 ##first touch dhcpd.leases if it doesn't exist
657 lease_file = '{}/dhcpd.leases'.format(cls.dhcp_data_dir)
658 if os.access(lease_file, os.F_OK) is False:
659 with open(lease_file, 'w') as fd: pass
660
661 conf_file = '{}/dhcpd.conf'.format(cls.dhcp_data_dir)
662 with open(conf_file, 'w') as fd:
663 fd.write(dhcp_conf)
664
665 #now configure the dhcpd interfaces for various subnets
666 index = 0
667 intf_info = []
668 for ip,_ in subnet:
669 intf = intf_list[index]
670 mac = cls.get_mac(intf)
671 intf_info.append((ip, mac))
672 index += 1
673 os.system('ifconfig {} {}'.format(intf, ip))
674
675 intf_str = ','.join(intf_list)
676 dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format(conf_file, lease_file, intf_str)
677 log_test.info('Starting DHCPD server with command: %s' %dhcpd_cmd)
678 ret = os.system(dhcpd_cmd)
679 assert_equal(ret, 0)
680 time.sleep(3)
681 cls.relay_interfaces_last = cls.relay_interfaces
682 cls.relay_interfaces = intf_list
683 cls.onos_dhcp_relay_load(*intf_info[0])
684
685 @classmethod
686 def dhcpd_stop(cls):
687 os.system('pkill -9 dhcpd')
688 for intf in cls.relay_interfaces:
689 os.system('ifconfig {} 0'.format(intf))
690
691 cls.relay_interfaces = cls.relay_interfaces_last
692
693 @classmethod
694 def get_mac(cls, iface):
695 if cls.interface_to_mac_map.has_key(iface):
696 return cls.interface_to_mac_map[iface]
697 mac = get_mac(iface, pad = 0)
698 cls.interface_to_mac_map[iface] = mac
699 return mac
700
701 def send_recv(self, mac=None, update_seed = False, validate = True):
702 cip, sip = self.dhcp.discover(mac = mac, update_seed = update_seed)
703 if validate:
704 assert_not_equal(cip, None)
705 assert_not_equal(sip, None)
706 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
707 (cip, sip, self.dhcp.get_mac(cip)[0]))
708 return cip,sip
709
710 @classmethod
711 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
712 subnet = default_subnet_config):
713 conf = ''
714 for k, v in config.items():
715 conf += '{} {};\n'.format(k, v)
716
717 opts = ''
718 for k, v in options:
719 opts += 'option {} {};\n'.format(k, v)
720
721 subnet_config = ''
722 for _, v in subnet:
723 subnet_config += '{}\n'.format(v)
724
725 return '{}{}{}'.format(conf, opts, subnet_config)
726
727 @classmethod
728 def onos_dhcp_relay_load(cls, server_ip, server_mac):
729 relay_device_map = '{}/{}'.format(cls.relay_device_id, cls.relay_interface_port)
730 dhcp_dict = {'apps':{'org.onosproject.dhcp-relay':{'dhcprelay':
731 {'dhcpserverConnectPoint':relay_device_map,
732 'serverip':server_ip,
733 'servermac':server_mac
734 }
735 }
736 }
737 }
738 cls.onos_load_config(dhcp_dict)
739 cls.configs['relay_config'] = dhcp_dict
740
741 @classmethod
742 def dhcp_relay_cleanup(cls):
743 ##reset the ONOS port configuration back to default
744 for config in cls.configs.items():
745 OnosCtrl.delete(config)
746 # if cls.onos_restartable is True:
747 # log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
748 # return cord_test_onos_restart(config = {})
749
750
Thangavelu K S8e413082017-07-13 20:02:14 +0000751 def tls_flow_check(self, olt_ports, cert_info = None, multiple_sub = False):
752 if multiple_sub is True:
753 olt_nni_port = olt_ports.tx_port
754 olt_uni_port = olt_ports.rx_port
755 else:
Thangavelu K S36edb012017-07-05 18:24:12 +0000756 olt_uni_port = olt_ports
757
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000758 def tls_fail_cb():
759 log_test.info('TLS verification failed')
760 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700761 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000762 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
763 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000764 if tls.failTest is True:
765 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000766 assert_equal(tls.failTest, False)
767 if cert_info == "no_cert":
768 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
769 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
770 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000771 if tls.failTest is False:
772 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000773 assert_equal(tls.failTest, True)
774 if cert_info == "invalid_cert":
775 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
776 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
777 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000778 if tls.failTest is False:
779 self.success = False
780 assert_equal(tls.failTest, True)
781 if cert_info == "same_cert":
782 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000783 log_test.info('Running subscriber %s tls auth test with same valid TLS certificate' %olt_uni_port)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000784 tls.runTest()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000785 if tls.failTest is True:
Thangavelu K S9648eed2017-06-13 20:15:25 +0000786 self.success = False
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000787 assert_equal(tls.failTest, False)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000788 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 +0000789 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 +0000790 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
791 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
792 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000793 if tls.failTest is False:
794 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000795 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000796 self.test_status = True
797 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700798
Thangavelu K S8e413082017-07-13 20:02:14 +0000799 def dhcp_flow_check(self, olt_ports, negative_test = None, multiple_sub = False):
800 if multiple_sub is True:
801 olt_nni_port = olt_ports.tx_port
802 onu_iface = olt_ports.rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +0000803 dhcp_server_startip = self.random_ip()
804 random_mac = '00:00:00:0a:0a:' + hex(random.randrange(50,254)).split('x')[1]
Thangavelu K S8e413082017-07-13 20:02:14 +0000805 else:
806 onu_iface = olt_ports
807 dhcp_server_startip = '10.10.10.20'
808 random_mac = None
Thangavelu K S735a6662017-06-15 18:08:23 +0000809 self.success = True
810
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000811 if negative_test is None:
Thangavelu K S36edb012017-07-05 18:24:12 +0000812 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = 'skip', startip = dhcp_server_startip, mac = random_mac)
813 if cip == None or sip == None:
Thangavelu K S735a6662017-06-15 18:08:23 +0000814 self.success = False
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000815 self.test_status = False
816 assert_not_equal(cip,None)
817 assert_not_equal(sip,None)
818 else:
819 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
820 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000821
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000822 if negative_test == "interrupting_dhcp_flows":
823 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
Thangavelu K S735a6662017-06-15 18:08:23 +0000824 if cip is not None:
825 self.success = False
826 assert_equal(cip,None)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000827 log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000828 self.test_status = True
829
830 if negative_test == "invalid_src_mac_broadcast":
831 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
832 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
833 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
834 self.onos_dhcp_table_load(config)
835 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
836 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000837
838 if cip is not None:
839 self.success = False
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000840 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected self.success = %s '%self.success)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000841 assert_equal(cip,None)
842 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
843 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000844
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000845 if negative_test == "invalid_src_mac_multicast":
846 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
847 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
848 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
849 self.onos_dhcp_table_load(config)
850 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
851 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000852 if cip is not None:
853 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000854 assert_equal(cip,None)
855 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
856 self.test_status = True
857
858 if negative_test == "invalid_src_mac_junk":
859 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
860 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
861 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
862 self.onos_dhcp_table_load(config)
863 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
864 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000865 if cip is not None:
866 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000867 assert_equal(cip,None)
868 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
869 self.test_status = True
870
871 if negative_test == "request_release":
872 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
873 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
874 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
875 self.onos_dhcp_table_load(config)
876 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
877 cip, sip = self.dhcp_sndrcv(self.dhcp)
878 log_test.info('Releasing ip %s to server %s' %(cip, sip))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000879 if not self.dhcp.release(cip):
880 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000881 assert_equal(self.dhcp.release(cip), True)
882 log_test.info('Triggering DHCP discover again after release')
883 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
884 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000885 if not cip == cip2:
Thangavelu K S735a6662017-06-15 18:08:23 +0000886 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000887 assert_equal(cip, cip2)
888 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
889 assert_equal(self.dhcp.release(cip2), True)
890 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000891
Thangavelu K S735a6662017-06-15 18:08:23 +0000892 if negative_test == "starvation_positive":
893 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
894 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
895 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
896 self.onos_dhcp_table_load(config)
897 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
898 ip_map = {}
899 for i in range(10):
900 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
901 if ip_map.has_key(cip):
902 self.success = False
903 log_test.info('IP %s given out multiple times' %cip)
904 assert_equal(False, ip_map.has_key(cip))
905 ip_map[cip] = sip
906 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000907
Thangavelu K S735a6662017-06-15 18:08:23 +0000908 if negative_test == "starvation_negative":
909 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
910 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
911 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
912 self.onos_dhcp_table_load(config)
913 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
914 log_test.info('Verifying passitive case')
915 for x in xrange(50):
916 mac = RandMAC()._fix()
917 self.dhcp_sndrcv(self.dhcp,mac = mac)
918 log_test.info('Verifying negative case')
919 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000920 if cip or sip is not None:
921 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000922 assert_equal(cip, None)
923 assert_equal(sip, None)
924 self.test_status = True
925 self.success = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000926
Thangavelu K S735a6662017-06-15 18:08:23 +0000927 if negative_test == "multiple_discover":
928 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
929 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
930 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
931 self.onos_dhcp_table_load(config)
932 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
933 cip, sip, mac, _ = self.dhcp.only_discover()
934 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
935 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000936 if cip is None:
937 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000938 assert_not_equal(cip, None)
939 log_test.info('Triggering DHCP discover again.')
940 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000941 if not new_cip == cip:
942 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000943 assert_equal(new_cip, cip)
944 log_test.info('client got same IP as expected when sent 2nd discovery')
945 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000946 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000947 if negative_test == "multiple_requests":
948 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
949 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
950 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
951 self.onos_dhcp_table_load(config)
952 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
953 log_test.info('Sending DHCP discover and DHCP request.')
954 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
955 mac = self.dhcp.get_mac(cip)[0]
956 log_test.info("Sending DHCP request again.")
957 new_cip, new_sip = self.dhcp.only_request(cip, mac)
958 assert_equal(new_cip,cip)
959 log_test.info('server offered same IP to clain for multiple requests, as expected')
960 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000961# self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000962 if negative_test == "desired_ip_address":
963 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
964 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
965 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
966 self.onos_dhcp_table_load(config)
967 self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface)
968 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000969 if cip or sip is None:
970 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000971 assert_not_equal(cip, None)
972 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
973 (cip, sip, mac))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000974 if not self.dhcp.seed_ip == cip:
975 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000976 assert_equal(cip,self.dhcp.seed_ip)
977 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
978 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000979 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000980 if negative_test == "desired_out_of_pool_ip_address":
981 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
982 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
983 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
984 self.onos_dhcp_table_load(config)
985 self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface)
986 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000987 if cip or sip is None:
988 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000989 assert_not_equal(cip, None)
990 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
991 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000992 if self.dhcp.seed_ip == cip:
993 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000994 assert_not_equal(cip,self.dhcp.seed_ip)
995 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
996 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000997 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000998 if negative_test == "dhcp_renew":
999 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1000 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1001 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1002 self.onos_dhcp_table_load(config)
1003 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1004 cip, sip, mac, _ = self.dhcp.only_discover()
1005 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1006 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001007 if cip or sip is None:
1008 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001009 assert_not_equal(cip, None)
1010 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
1011 log_test.info('waiting renew time %d seconds to send next request packet'%lval)
1012 time.sleep(lval)
1013 latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001014 if not latest_cip == cip:
1015 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001016 assert_equal(latest_cip,cip)
1017 log_test.info('client got same IP after renew time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001018 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001019 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001020 if negative_test == "dhcp_rebind":
1021 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1022 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1023 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1024 self.onos_dhcp_table_load(config)
1025 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1026 cip, sip, mac, _ = self.dhcp.only_discover()
1027 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1028 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001029 if cip or sip is None:
1030 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001031 assert_not_equal(cip, None)
1032 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
1033 log_test.info('waiting rebind time %d seconds to send next request packet'%lval)
1034 time.sleep(lval)
1035 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001036 if not latest_cip == cip:
1037 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001038 assert_equal(latest_cip,cip)
1039 log_test.info('client got same IP after rebind time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001040 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001041 # self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001042 return self.test_status
1043
Thangavelu K S8e413082017-07-13 20:02:14 +00001044 def recv_channel_cb(self, pkt):
1045 ##First verify that we have received the packet for the joined instance
1046 chan = self.subscriber.caddr(pkt[IP].dst)
1047 assert_equal(chan in self.subscriber.join_map.keys(), True)
1048 recv_time = monotonic.monotonic() * 1000000
1049 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
1050 delta = recv_time - join_time
1051 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
1052 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
1053 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
1054 self.test_status = True
Thangavelu K S36edb012017-07-05 18:24:12 +00001055
Thangavelu K S8e413082017-07-13 20:02:14 +00001056 def traffic_verify(self, subscriber):
1057 # if subscriber.has_service('TRAFFIC'):
1058 url = 'http://www.google.com'
1059 resp = requests.get(url)
1060 self.test_status = resp.ok
1061 if resp.ok == False:
1062 log_test.info('Subscriber %s failed get from url %s with status code %d'
1063 %(subscriber.name, url, resp.status_code))
1064 else:
1065 log_test.info('GET request from %s succeeded for subscriber %s'
1066 %(url, subscriber.name))
1067 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001068
Thangavelu K S8e413082017-07-13 20:02:14 +00001069 def igmp_flow_check(self, subscriber, multiple_sub = False):
1070 chan = 0
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001071 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1072 if subscriber.num_channels == 1:
Thangavelu K S9a637332017-08-01 23:22:23 +00001073 if i != 0:
1074 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001075 chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1076 else:
1077 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1078 self.num_joins += 1
1079 while self.num_joins < self.num_subscribers:
1080 time.sleep(5)
1081 log_test.info('All subscribers have joined the channel')
1082 # for i in range(1):
1083 time.sleep(0.5)
1084 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1085 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1086 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001087 time.sleep(5)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001088# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1089 if subscriber.num_channels == 1:
1090 pass
1091 elif chan != 0:
1092 #Should not receive packets for this channel
1093 self.recv_timeout = True
1094 subscriber.recv_timeout = True
1095 subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1096 subscriber.recv_timeout = False
1097 self.recv_timeout = False
Thangavelu K S9a637332017-08-01 23:22:23 +00001098 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001099# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K S9a637332017-08-01 23:22:23 +00001100# chan = subscriber.num_channels - i
1101# self.test_status = True
1102 return self.test_status
1103
1104 def igmp_join_next_channel_flow_check(self, subscriber, multiple_sub = False):
1105 chan = 0
1106 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1107# if subscriber.num_channels == 1:
1108# chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1109# else:
1110 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1111 self.num_joins += 1
1112 while self.num_joins < self.num_subscribers:
1113 time.sleep(5)
1114 log_test.info('All subscribers have joined the channel')
1115 # for i in range(1):
1116 time.sleep(0.5)
1117 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1118 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1119 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
1120 time.sleep(5)
1121# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1122# if subscriber.num_channels == 1:
1123# pass
1124# elif chan != 0:
1125# pass
1126 #Should not receive packets for this channel
1127# log_test.info
1128# self.recv_timeout = True
1129# subscriber.recv_timeout = True
1130# subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1131# subscriber.recv_timeout = False
1132# self.recv_timeout = False
1133# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1134# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001135 chan = subscriber.num_channels - i
Thangavelu K S8e413082017-07-13 20:02:14 +00001136# self.test_status = True
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00001137 return self.test_status
1138
Thangavelu K S36edb012017-07-05 18:24:12 +00001139
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001140 def igmp_leave_flow_check(self, subscriber, multiple_sub = False):
1141 chan = 0
1142 for i in range(self.VOLTHA_IGMP_ITERATIONS):
1143 subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1144 self.num_joins += 1
1145 while self.num_joins < self.num_subscribers:
1146 time.sleep(5)
1147 log_test.info('All subscribers have joined the channel')
1148# for i in range(1):
1149 time.sleep(0.5)
1150 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1151 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1152 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1153 time.sleep(10)
1154# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1155 #Should not receive packets for this subscriber
1156 self.recv_timeout = True
1157 subscriber.recv_timeout = True
1158 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1159 subscriber.recv_timeout = False
1160 self.recv_timeout = False
1161# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1162# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1163# self.test_status = True
1164 return self.test_status
1165
1166
1167
Thangavelu K S8e413082017-07-13 20:02:14 +00001168 def igmp_flow_check_join_change_to_exclude(self, subscriber, multiple_sub = False):
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001169 chan = 2
1170 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1171 self.num_joins += 1
1172 while self.num_joins < self.num_subscribers:
1173 time.sleep(5)
1174 log_test.info('All subscribers have joined the channel')
1175 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1176 time.sleep(5)
1177 chan = 1
1178 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1179 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1180 time.sleep(5)
1181 self.recv_timeout = True
1182 subscriber.recv_timeout = True
1183 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
1184 if self.test_status is True:
1185 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
1186 if self.test_status is True:
1187 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
1188 self.test_status = False
1189 subscriber.recv_timeout = False
1190 self.recv_timeout = False
1191 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001192 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1193 for i in range(3):
1194 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1195 self.num_joins += 1
1196 while self.num_joins < self.num_subscribers:
1197 time.sleep(5)
1198 log_test.info('All subscribers have joined the channel')
1199 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1200 time.sleep(5)
1201 log_test.info('Leaving channel %d for subscriber on port %s from specific source address %s and waited till GMI timer expires' %(chan, subscriber.rx_port, subscriber.src_list[0]))
1202 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1203 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1204 time.sleep(60)
1205 self.recv_timeout = False
1206 subscriber.recv_timeout = False
1207 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1208 if self.test_status is True:
1209 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1210 if self.test_status is False:
1211 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1212 continue
1213 subscriber.recv_timeout = False
1214 self.recv_timeout = False
1215 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001216# self.test_status = True
1217 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001218
Thangavelu K S8e413082017-07-13 20:02:14 +00001219 def igmp_flow_check_join_change_to_exclude_again_include_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001220 chan = 0
1221 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1222 for i in range(3):
1223 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1224 self.num_joins += 1
1225 while self.num_joins < self.num_subscribers:
1226 time.sleep(5)
1227 log_test.info('All subscribers have joined the channel')
1228 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1229 time.sleep(5)
1230 log_test.info('Leaving channel %d for subscriber on port %s from specific source address %s and waited till GMI timer expires' %(chan, subscriber.rx_port, subscriber.src_list[0]))
1231 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1232 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1233 time.sleep(60)
1234 self.recv_timeout = False
1235 subscriber.recv_timeout = False
1236 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1237 if self.test_status is True:
1238 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1239 if self.test_status is False:
1240 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1241 continue
1242 subscriber.recv_timeout = False
1243 self.recv_timeout = False
1244 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1245 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_INCLUDE)
1246 time.sleep(5)
1247# self.recv_timeout = True
1248# subscriber.recv_timeout = True
1249 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1250 subscriber.recv_timeout = False
1251 self.recv_timeout = False
1252
1253
1254 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1255# self.test_status = True
1256 return self.test_status
1257
Thangavelu K S36edb012017-07-05 18:24:12 +00001258
Thangavelu K S8e413082017-07-13 20:02:14 +00001259 def igmp_flow_check_join_change_to_block(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001260 chan = 0
1261 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1262 for i in range(3):
1263 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1264 self.num_joins += 1
1265 while self.num_joins < self.num_subscribers:
1266 time.sleep(5)
1267 log_test.info('All subscribers have joined the channel')
1268 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1269 time.sleep(5)
1270 log_test.info('Leaving channel %d for subscriber on port %s from specific source address %s and waited till GMI timer expires' %(chan, subscriber.rx_port, subscriber.src_list[0]))
1271 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_BLOCK_OLD)
1272 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1273 time.sleep(60)
1274 self.recv_timeout = False
1275 subscriber.recv_timeout = False
1276 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1277 if self.test_status is True:
1278 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1279 if self.test_status is False:
1280 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1281 continue
1282 subscriber.recv_timeout = False
1283 self.recv_timeout = False
1284 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1285# self.test_status = True
1286 return self.test_status
1287
Thangavelu K S36edb012017-07-05 18:24:12 +00001288
Thangavelu K S8e413082017-07-13 20:02:14 +00001289 def igmp_flow_check_join_change_to_block_again_allow_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001290 chan = 0
1291 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1292 for i in range(3):
1293 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1294 self.num_joins += 1
1295 while self.num_joins < self.num_subscribers:
1296 time.sleep(5)
1297 log_test.info('All subscribers have joined the channel')
1298 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1299 time.sleep(5)
1300 log_test.info('Leaving channel %d for subscriber on port %s from specific source address %s and waited till GMI timer expires' %(chan, subscriber.rx_port, subscriber.src_list[0]))
1301 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1302 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1303 time.sleep(60)
1304 self.recv_timeout = False
1305 subscriber.recv_timeout = False
1306 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1307 if self.test_status is True:
1308 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1309 if self.test_status is False:
1310 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1311 continue
1312 subscriber.recv_timeout = False
1313 self.recv_timeout = False
1314 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1315 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_ALLOW_NEW)
1316 time.sleep(5)
1317# self.recv_timeout = True
1318# subscriber.recv_timeout = True
1319 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1320 subscriber.recv_timeout = False
1321 self.recv_timeout = False
1322
1323
1324 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1325# self.test_status = True
1326 return self.test_status
Thangavelu K S8e413082017-07-13 20:02:14 +00001327
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001328 def igmp_flow_check_group_include_source_empty_list(self, subscriber, multiple_sub = False):
1329 chan = 0
1330 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1331 self.num_joins += 1
1332 while self.num_joins < self.num_subscribers:
1333 time.sleep(5)
1334 log_test.info('All subscribers have joined the channel')
1335 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1336 if self.test_status is True:
1337 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1338 self.test_status = False
1339 else:
1340 log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port))
Thangavelu K S9a637332017-08-01 23:22:23 +00001341 self.test_status = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001342 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1343 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1344 time.sleep(5)
1345 subscriber.recv_timeout = False
1346 self.recv_timeout = False
1347 return self.test_status
1348
1349 def igmp_flow_check_group_exclude_source_empty_list(self, subscriber, multiple_sub = False):
1350 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001351 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1352 self.num_joins += 1
1353 while self.num_joins < self.num_subscribers:
1354 time.sleep(5)
1355 log_test.info('All subscribers have joined the channel')
1356 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1357 if self.test_status is True:
1358 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1359 self.test_status = False
1360 else:
1361 log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port))
1362 self.test_status = True
1363
1364 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1365 log_test.info('Send join to multicast group with exclude empty source list and waited till GMI timer expires')
1366 time.sleep(60)
1367
1368 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1369 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1370 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1371 time.sleep(5)
1372 subscriber.recv_timeout = False
1373 self.recv_timeout = False
1374 return self.test_status
1375
1376 def igmp_flow_check_group_exclude_source_empty_list_1(self, subscriber, multiple_sub = False):
1377 chan = 0
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001378 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list,record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1379 self.num_joins += 1
1380 while self.num_joins < self.num_subscribers:
1381 time.sleep(5)
1382 log_test.info('All subscribers have joined the channel')
1383 for i in range(10):
1384 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1385 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1386 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1387 time.sleep(5)
1388 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1389 #Should not receive packets for this subscriber
1390 self.recv_timeout = True
1391 subscriber.recv_timeout = True
1392 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1393 subscriber.recv_timeout = False
1394 self.recv_timeout = False
1395 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1396 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1397# self.test_status = True
1398 return self.test_status
1399
1400 def igmp_flow_check_during_olt_onu_operational_issues(self, subscriber, multiple_sub = False):
1401 chan = 0
1402 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1403 self.num_joins += 1
1404 while self.num_joins < self.num_subscribers:
1405 time.sleep(5)
1406 log_test.info('All subscribers have joined the channel')
1407 for i in range(2):
1408 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1409 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1410 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1411 time.sleep(5)
1412 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1413 #Should not receive packets for this subscriber
1414 self.recv_timeout = True
1415 subscriber.recv_timeout = True
1416 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1417 subscriber.recv_timeout = False
1418 self.recv_timeout = False
1419 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1420 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1421# self.test_status = True
1422 return self.test_status
1423
Thangavelu K S8e413082017-07-13 20:02:14 +00001424 def voltha_igmp_jump_verify(self, subscriber):
1425 if subscriber.has_service('IGMP'):
1426 for i in xrange(subscriber.num):
1427 log_test.info('Subscriber %s jumping channel' %subscriber.name)
1428 chan = subscriber.channel_jump(delay=0)
1429 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
1430 log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1431 time.sleep(3)
1432 log_test.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats))
1433 self.test_status = True
1434 return self.test_status
1435
1436 def voltha_igmp_next_verify(self, subscriber):
1437 for c in xrange(self.VOLTHA_IGMP_ITERATIONS):
1438 for i in xrange(subscriber.num):
1439 if i:
1440 chan = subscriber.channel_join_next(delay=0, leave_flag = self.leave_flag)
1441 time.sleep(0.2)
1442 else:
1443 chan = subscriber.channel_join(i, delay=0)
1444 time.sleep(0.2)
1445 if subscriber.num == 1:
1446 subscriber.channel_leave(chan)
1447 log_test.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
1448 #subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
1449 #log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1450 self.test_status = True
1451 return self.test_status
1452
1453 def voltha_subscribers(self, services, cbs = None, num_subscribers = 1, num_channels = 1, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +00001454 """Test subscriber join next for channel surfing"""
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001455 voltha = VolthaCtrl(self.VOLTHA_HOST,
1456 rest_port = self.VOLTHA_REST_PORT,
1457 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S36edb012017-07-05 18:24:12 +00001458 if self.VOLTHA_OLT_TYPE.startswith('ponsim'):
1459 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1460 log_test.info('Enabling ponsim olt')
1461 device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001462 if device_id != '':
1463 self.olt_device_id = device_id
Thangavelu K S36edb012017-07-05 18:24:12 +00001464 else:
1465 log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution')
1466 assert_equal(False, True)
1467
1468 assert_not_equal(device_id, None)
1469 if status == False:
1470 voltha.disable_device(device_id, delete = True)
1471 assert_equal(status, True)
1472 time.sleep(10)
1473 switch_map = None
1474 olt_configured = False
1475 try:
1476 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1477 if not switch_map:
1478 log_test.info('No voltha devices found')
1479 return
1480 log_test.info('Installing OLT app')
1481 OnosCtrl.install_app(self.olt_app_file)
1482 time.sleep(5)
1483 log_test.info('Adding subscribers through OLT app')
1484 self.config_olt(switch_map)
1485 olt_configured = True
1486 time.sleep(5)
1487 self.num_subscribers = num_subscribers
1488 self.num_channels = num_channels
1489 test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers,
1490 num_channels = self.num_channels,
1491 cbs = cbs,
1492 port_list = self.generate_port_list(self.num_subscribers,
1493 self.num_channels),
Thangavelu K S8e413082017-07-13 20:02:14 +00001494 src_list = src_list, services = services)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001495 if test_status is False:
1496 self.success = False
Thangavelu K S36edb012017-07-05 18:24:12 +00001497 assert_equal(test_status, True)
1498 finally:
1499 if switch_map is not None:
1500 if olt_configured is True:
1501 self.remove_olt(switch_map)
1502 voltha.disable_device(device_id, delete = True)
1503 time.sleep(10)
1504 log_test.info('Uninstalling OLT app')
1505 OnosCtrl.uninstall_app(self.olt_app_name)
1506
Thangavelu K S8e413082017-07-13 20:02:14 +00001507 def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1,
1508 channel_start = 0, cbs = None, port_list = [], src_list = None,
Thangavelu K S36edb012017-07-05 18:24:12 +00001509 services = None, negative_subscriber_auth = None):
1510 self.test_status = False
1511 self.ovs_cleanup()
1512 subscribers_count = num_subscribers
1513 sub_loop_count = num_subscribers
1514 if not port_list:
1515 port_list = self.generate_port_list(num_subscribers, num_channels)
1516 subscriber_tx_rx_ports = []
1517 for i in range(num_subscribers):
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001518 subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map[port_list[i][0]],
1519 rx_port = self.port_map[port_list[i][1]],
Thangavelu K S8e413082017-07-13 20:02:14 +00001520 num_channels = num_channels,src_list = src_list,))
Thangavelu K S36edb012017-07-05 18:24:12 +00001521 self.onos_aaa_load()
Thangavelu K S8e413082017-07-13 20:02:14 +00001522 #load the ssm list for all subscriber channels
1523 igmpChannel = IgmpChannel(src_list = src_list)
1524 ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports)
1525 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
Thangavelu K S6432b522017-07-22 00:05:54 +00001526 if src_list is None:
1527 igmpChannel = IgmpChannel()
1528 igmpChannel.igmp_load_ssm_config(ssm_list)
1529 else:
1530 igmpChannel = IgmpChannel(src_list = src_list)
1531 igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001532
Thangavelu K S36edb012017-07-05 18:24:12 +00001533 self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1)
1534
1535 chan_leave = False #for single channel, multiple subscribers
1536 if cbs is None:
1537 cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check)
1538 chan_leave = True
1539 for subscriber in subscriber_tx_rx_ports:
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001540 if 'IGMP' in services:
1541# if src_list:
1542# for i in range(len(src_list)):
1543# subscriber.start(src_ip = src_list[i])
1544# else:
1545# subscriber.start()
1546 subscriber.start()
Thangavelu K S36edb012017-07-05 18:24:12 +00001547 sub_loop_count = sub_loop_count - 1
1548 pool_object = voltha_subscriber_pool(subscriber, cbs)
1549 self.thread_pool.addTask(pool_object.pool_cb)
1550 self.thread_pool.cleanUpThreads()
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001551 for subscriber in subscriber_tx_rx_ports:
1552 if services and 'IGMP' in services:
1553# if src_list:
1554# for i in range(len(src_list)):
1555# subscriber.stop(src_ip = src_list[i])
1556# else:
1557# subscriber.stop()
1558 subscriber.stop()
1559 if chan_leave is True:
1560 subscriber.channel_leave(0)
Thangavelu K S36edb012017-07-05 18:24:12 +00001561 subscribers_count = 0
1562 return self.test_status
1563
1564
1565 def generate_port_list(self, subscribers, channels):
1566 return self.port_list[:subscribers]
1567
Thangavelu K S36edb012017-07-05 18:24:12 +00001568 @classmethod
1569 def ovs_cleanup(cls):
1570 ##For every test case, delete all the OVS groups
1571 cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1'
1572 try:
1573 cord_test_shell(cmd)
1574 ##Since olt config is used for this test, we just fire a careless local cmd as well
1575 os.system(cmd)
1576 finally:
1577 return
1578
A.R Karthick8a507cf2017-06-02 18:44:49 -07001579 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -07001580 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -07001581 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
1582 assert_not_equal(device_id, None)
1583 try:
1584 assert_equal(status, True)
1585 time.sleep(10)
1586 finally:
1587 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001588
A.R Karthick8a507cf2017-06-02 18:44:49 -07001589 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001590 log_test.info('Enabling ponsim_olt')
1591 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -07001592 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1593 assert_not_equal(device_id, None)
1594 try:
1595 assert_equal(status, True)
1596 time.sleep(10)
1597 finally:
1598 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001599
Thangavelu K S008f38e2017-05-15 19:36:55 +00001600 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
1601 """
1602 Test Method:
1603 0. Make sure that voltha is up and running on CORD-POD setup.
1604 1. OLT and ONU is detected and validated.
1605 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1606 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
1607 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
1608 5. Verify that subscriber is authenticated successfully.
1609 """
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001610 ret = voltha_setup(
1611 host = self.VOLTHA_HOST,
1612 rest_port = self.VOLTHA_REST_PORT,
1613 olt_type = 'ponsim_olt',
1614 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP,
1615 uplink_vlan_start = self.VOLTHA_UPLINK_VLAN_START,
1616 config_fake = self.VOLTHA_CONFIG_FAKE,
1617 olt_app = self.olt_app_file)
1618 assert_not_equal(ret, None)
1619 voltha, device_id, switch_map = ret[0], ret[1], ret[2]
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001620 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001621 log_test.info('Adding subscribers through OLT app')
1622 self.config_olt(switch_map)
1623 olt_configured = True
1624 time.sleep(5)
1625 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001626 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001627 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001628 if switch_map is not None:
1629 if olt_configured is True:
1630 self.remove_olt(switch_map)
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001631 voltha_teardown(voltha, device_id, switch_map, olt_app = self.olt_app_file)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001632
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001633 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001634 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
1635 """
1636 Test Method:
1637 0. Make sure that voltha is up and running on CORD-POD setup.
1638 1. OLT and ONU is detected and validated.
1639 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1640 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1641 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
1642 5. Verify that subscriber authentication is unsuccessful..
1643 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001644 df = defer.Deferred()
1645 def tls_flow_check_with_no_cert_scenario(df):
1646 log_test.info('Enabling ponsim_olt')
1647 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1648 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1649 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001650 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001651 time.sleep(10)
1652 switch_map = None
1653 olt_configured = False
1654 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1655 log_test.info('Installing OLT app')
1656 OnosCtrl.install_app(self.olt_app_file)
1657 time.sleep(5)
1658 log_test.info('Adding subscribers through OLT app')
1659 self.config_olt(switch_map)
1660 olt_configured = True
1661 time.sleep(5)
1662 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1663 try:
1664 assert_equal(auth_status, True)
1665 assert_equal(status, True)
1666 time.sleep(10)
1667 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001668 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001669 self.voltha.disable_device(device_id, delete = True)
1670 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001671
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001672 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1673 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001674
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001675 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001676 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
1677 """
1678 Test Method:
1679 0. Make sure that voltha is up and running on CORD-POD setup.
1680 1. OLT and ONU is detected and validated.
1681 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1682 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
1683 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1684 5. Verify that subscriber authentication is unsuccessful..
1685 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001686 df = defer.Deferred()
1687 def tls_flow_check_with_invalid_cert_scenario(df):
1688 log_test.info('Enabling ponsim_olt')
1689 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1690 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1691 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001692 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001693 time.sleep(10)
1694 switch_map = None
1695 olt_configured = False
1696 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1697 log_test.info('Installing OLT app')
1698 OnosCtrl.install_app(self.olt_app_file)
1699 time.sleep(5)
1700 log_test.info('Adding subscribers through OLT app')
1701 self.config_olt(switch_map)
1702 olt_configured = True
1703 time.sleep(5)
1704 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1705 try:
1706 assert_equal(auth_status, True)
1707 assert_equal(status, True)
1708 time.sleep(10)
1709 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001710 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001711 self.voltha.disable_device(device_id, delete = True)
1712 df.callback(0)
1713 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
1714 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001715
Thangavelu K S0d745c82017-06-09 21:56:08 +00001716 @deferred(TESTCASE_TIMEOUT)
1717 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
1718 """
1719 Test Method:
1720 0. Make sure that voltha is up and running on CORD-POD setup.
1721 1. OLT and ONU is detected and validated.
1722 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1723 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
1724 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1725 5. Verify that subscriber authentication is unsuccessful..
1726 """
1727 df = defer.Deferred()
1728 def tls_flow_check_with_no_cert_scenario(df):
1729 log_test.info('Enabling ponsim_olt')
1730 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1731 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1732 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001733 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001734 time.sleep(10)
1735 switch_map = None
1736 olt_configured = False
1737 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1738 log_test.info('Installing OLT app')
1739 OnosCtrl.install_app(self.olt_app_file)
1740 time.sleep(5)
1741 log_test.info('Adding subscribers through OLT app')
1742 self.config_olt(switch_map)
1743 olt_configured = True
1744 time.sleep(5)
1745 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1746 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1747 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1748 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1749 try:
1750 assert_equal(auth_status, True)
1751 assert_equal(status, True)
1752 time.sleep(10)
1753 finally:
1754 self.voltha.disable_device(device_id, delete = True)
1755 df.callback(0)
1756 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1757 return df
1758
1759 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001760 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
1761 """
1762 Test Method:
1763 0. Make sure that voltha is up and running on CORD-POD setup.
1764 1. OLT and ONU is detected and validated.
1765 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1766 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1767 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
1768 5. Verify that subscriber authentication is unsuccessful..
1769 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001770 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001771 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001772 aaa_app = ["org.opencord.aaa"]
1773 log_test.info('Enabling ponsim_olt')
1774 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1775 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1776 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001777 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001778 time.sleep(10)
1779 switch_map = None
1780 olt_configured = False
1781 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1782 log_test.info('Installing OLT app')
1783 OnosCtrl.install_app(self.olt_app_file)
1784 time.sleep(5)
1785 log_test.info('Adding subscribers through OLT app')
1786 self.config_olt(switch_map)
1787 olt_configured = True
1788 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001789
Thangavelu K S0d745c82017-06-09 21:56:08 +00001790 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
1791 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
1792 thread1.start()
1793 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001794 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001795 thread2.start()
1796 time.sleep(10)
1797 thread1.join()
1798 thread2.join()
1799 try:
1800 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001801 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001802 time.sleep(10)
1803 finally:
1804 self.voltha.disable_device(device_id, delete = True)
1805 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001806 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001807 return df
1808
1809 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001810 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
1811 """
1812 Test Method:
1813 0. Make sure that voltha is up and running on CORD-POD setup.
1814 1. OLT and ONU is detected and validated.
1815 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1816 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1817 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
1818 5. Verify that subscriber authentication is unsuccessful..
1819 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001820 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001821 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001822 aaa_app = ["org.opencord.aaa"]
1823 log_test.info('Enabling ponsim_olt')
1824 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1825 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1826 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001827 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001828 time.sleep(10)
1829 switch_map = None
1830 olt_configured = False
1831 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1832 log_test.info('Installing OLT app')
1833 OnosCtrl.install_app(self.olt_app_file)
1834 time.sleep(5)
1835 log_test.info('Adding subscribers through OLT app')
1836 self.config_olt(switch_map)
1837 olt_configured = True
1838 time.sleep(5)
1839
1840 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
1841 thread2 = threading.Thread(target = cord_test_radius_restart)
1842 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001843 time.sleep(randint(1,2))
1844 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001845 thread2.start()
1846 time.sleep(10)
1847 thread1.join()
1848 thread2.join()
1849 try:
1850 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001851 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001852 time.sleep(10)
1853 finally:
1854 self.voltha.disable_device(device_id, delete = True)
1855 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001856 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001857 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001858
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001859 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001860 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
1861 """
1862 Test Method:
1863 0. Make sure that voltha is up and running on CORD-POD setup.
1864 1. OLT and ONU is detected and validated.
1865 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1866 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1867 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1868 6. Verify that subscriber authenticated successfully.
1869 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
1870 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1871 9. Verify that subscriber authentication is unsuccessful..
1872 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001873 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001874 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001875 aaa_app = ["org.opencord.aaa"]
1876 log_test.info('Enabling ponsim_olt')
1877 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1878 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1879 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001880 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001881 time.sleep(10)
1882 switch_map = None
1883 olt_configured = False
1884 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1885 log_test.info('Installing OLT app')
1886 OnosCtrl.install_app(self.olt_app_file)
1887 time.sleep(5)
1888 log_test.info('Adding subscribers through OLT app')
1889 self.config_olt(switch_map)
1890 olt_configured = True
1891 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001892
Thangavelu K S0d745c82017-06-09 21:56:08 +00001893 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001894 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +00001895 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001896 time.sleep(randint(1,2))
1897 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001898 thread2.start()
1899 time.sleep(10)
1900 thread1.join()
1901 thread2.join()
1902 try:
1903 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001904 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001905 time.sleep(10)
1906 finally:
1907 self.voltha.disable_device(device_id, delete = True)
1908 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001909 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001910 return df
1911
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001912 @deferred(TESTCASE_TIMEOUT)
1913 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001914 """
1915 Test Method:
1916 0. Make sure that voltha is up and running on CORD-POD setup.
1917 1. OLT and ONU is detected and validated.
1918 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1919 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1920 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1921 6. Verify that subscriber authenticated successfully.
1922 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1923 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1924 9. Verify that subscriber authentication is unsuccessful..
1925 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001926 df = defer.Deferred()
1927 def tls_flow_check_operating_olt_state(df):
1928 aaa_app = ["org.opencord.aaa"]
1929 log_test.info('Enabling ponsim_olt')
1930 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1931 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1932 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001933 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001934 time.sleep(10)
1935 switch_map = None
1936 olt_configured = False
1937 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1938 log_test.info('Installing OLT app')
1939 OnosCtrl.install_app(self.olt_app_file)
1940 time.sleep(5)
1941 log_test.info('Adding subscribers through OLT app')
1942 self.config_olt(switch_map)
1943 olt_configured = True
1944 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001945
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001946 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1947 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
1948 thread1.start()
1949 time.sleep(randint(1,2))
1950 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1951 thread2.start()
1952 time.sleep(10)
1953 thread1.join()
1954 thread2.join()
1955 try:
1956 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001957 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001958 time.sleep(10)
1959 finally:
1960 self.voltha.disable_device(device_id, delete = True)
1961 df.callback(0)
1962 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1963 return df
1964
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00001965 @deferred(TESTCASE_TIMEOUT +600)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001966 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self):
1967 """
1968 Test Method:
1969 0. Make sure that voltha is up and running on CORD-POD setup.
1970 1. OLT and ONU is detected and validated.
1971 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1972 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1973 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1974 6. Verify that subscriber authenticated successfully.
1975 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1976 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1977 9. Verify that subscriber authentication is unsuccessful..
1978 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1979
1980 """
1981 df = defer.Deferred()
1982 no_iterations = 10
1983 def tls_flow_check_with_disable_olt_device_scenario(df):
1984 aaa_app = ["org.opencord.aaa"]
1985 log_test.info('Enabling ponsim_olt')
1986 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1987 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1988 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001989 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001990 time.sleep(10)
1991 switch_map = None
1992 olt_configured = False
1993 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1994 log_test.info('Installing OLT app')
1995 OnosCtrl.install_app(self.olt_app_file)
1996 time.sleep(5)
1997 log_test.info('Adding subscribers through OLT app')
1998 self.config_olt(switch_map)
1999 olt_configured = True
2000 time.sleep(5)
2001 for i in range(no_iterations):
2002 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002003 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002004 thread1.start()
2005 time.sleep(randint(1,2))
2006 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
2007 thread2.start()
2008 time.sleep(10)
2009 thread1.join()
2010 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002011 time.sleep(60)
2012 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002013 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2014 try:
2015 # assert_equal(status, True)
2016 assert_equal(auth_status, True)
2017 assert_equal(self.success, True)
2018 time.sleep(10)
2019 finally:
2020 self.voltha.disable_device(device_id, delete = True)
2021 df.callback(0)
2022 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2023 return df
2024
2025 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002026 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
2027 """
2028 Test Method:
2029 0. Make sure that voltha is up and running on CORD-POD setup.
2030 1. OLT and ONU is detected and validated.
2031 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2032 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2033 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2034 6. Verify that subscriber authenticated successfully.
2035 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2036 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2037 9. Verify that subscriber authentication is unsuccessful..
2038 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002039 df = defer.Deferred()
2040 def tls_flow_check_operating_olt_state(df):
2041 aaa_app = ["org.opencord.aaa"]
2042 log_test.info('Enabling ponsim_olt')
2043 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2044 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2045 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002046 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002047 time.sleep(10)
2048 switch_map = None
2049 olt_configured = False
2050 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2051 log_test.info('Installing OLT app')
2052 OnosCtrl.install_app(self.olt_app_file)
2053 time.sleep(5)
2054 log_test.info('Adding subscribers through OLT app')
2055 self.config_olt(switch_map)
2056 olt_configured = True
2057 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002058
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002059 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2060 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2061 thread1.start()
2062 time.sleep(randint(1,2))
2063 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2064 thread2.start()
2065 time.sleep(10)
2066 thread1.join()
2067 thread2.join()
2068 try:
2069 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002070 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002071 time.sleep(10)
2072 finally:
2073 self.voltha.disable_device(device_id, delete = True)
2074 df.callback(0)
2075 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2076 return df
2077
2078 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002079 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self):
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002080 """
2081 Test Method:
2082 0. Make sure that voltha is up and running on CORD-POD setup.
2083 1. OLT and ONU is detected and validated.
2084 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2085 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2086 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2087 6. Verify that subscriber authenticated successfully.
2088 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2089 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2090 9. Verify that subscriber authentication is unsuccessful..
2091 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2092 """
2093 df = defer.Deferred()
2094 no_iterations = 10
2095 def tls_flow_check_with_disable_olt_device_scenario(df):
2096 aaa_app = ["org.opencord.aaa"]
2097 log_test.info('Enabling ponsim_olt')
2098 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2099 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2100 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002101 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002102 time.sleep(10)
2103 switch_map = None
2104 olt_configured = False
2105 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2106 log_test.info('Installing OLT app')
2107 OnosCtrl.install_app(self.olt_app_file)
2108 time.sleep(5)
2109 log_test.info('Adding subscribers through OLT app')
2110 self.config_olt(switch_map)
2111 olt_configured = True
2112 time.sleep(5)
2113 for i in range(no_iterations):
2114 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2115 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2116 thread1.start()
2117 time.sleep(randint(1,2))
2118 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2119 thread2.start()
2120 time.sleep(10)
2121 thread1.join()
2122 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002123 time.sleep(60)
2124 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002125 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2126 try:
2127 # assert_equal(status, True)
2128 assert_equal(auth_status, True)
2129 assert_equal(self.success, True)
2130 time.sleep(10)
2131 finally:
2132 self.voltha.disable_device(device_id, delete = True)
2133 df.callback(0)
2134 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2135 return df
2136
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002137 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002138 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
2139 """
2140 Test Method:
2141 0. Make sure that voltha is up and running on CORD-POD setup.
2142 1. OLT and ONU is detected and validated.
2143 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2144 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2145 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2146 6. Verify that subscriber authenticated successfully.
2147 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2148 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2149 9. Verify that subscriber authentication is unsuccessful..
2150 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002151 df = defer.Deferred()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002152 def tls_flow_check_operating_onu_state(df):
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002153 aaa_app = ["org.opencord.aaa"]
2154 log_test.info('Enabling ponsim_olt')
2155 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2156 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2157 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00002158 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2159
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002160 onu_device_id = devices_list['items'][1]['id']
2161 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002162 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002163 time.sleep(10)
2164 switch_map = None
2165 olt_configured = False
2166 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2167 log_test.info('Installing OLT app')
2168 OnosCtrl.install_app(self.olt_app_file)
2169 time.sleep(5)
2170 log_test.info('Adding subscribers through OLT app')
2171 self.config_olt(switch_map)
2172 olt_configured = True
2173 time.sleep(5)
2174 devices_list = self.voltha.get_devices()
2175 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2176 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2177 thread1.start()
2178 time.sleep(randint(1,2))
2179 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2180 thread2.start()
2181 time.sleep(10)
2182 thread1.join()
2183 thread2.join()
2184 try:
2185 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002186 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002187 time.sleep(10)
2188 finally:
2189 self.voltha.disable_device(device_id, delete = True)
2190 df.callback(0)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002191 reactor.callLater(0, tls_flow_check_operating_onu_state, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002192 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002193
Thangavelu K S9648eed2017-06-13 20:15:25 +00002194 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002195 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
2196 """
2197 Test Method:
2198 0. Make sure that voltha is up and running on CORD-POD setup.
2199 1. OLT and ONU is detected and validated.
2200 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2201 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2202 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2203 6. Verify that subscriber authenticated successfully.
2204 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2205 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2206 9. Verify that subscriber authentication is unsuccessful..
2207 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2208 """
2209 df = defer.Deferred()
2210 no_iterations = 10
2211 def tls_flow_check_operating_olt_state(df):
2212 aaa_app = ["org.opencord.aaa"]
2213 log_test.info('Enabling ponsim_olt')
2214 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2215 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2216 devices_list = self.voltha.get_devices()
2217 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2218
2219 onu_device_id = devices_list['items'][1]['id']
2220 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002221 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002222 time.sleep(10)
2223 switch_map = None
2224 olt_configured = False
2225 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2226 log_test.info('Installing OLT app')
2227 OnosCtrl.install_app(self.olt_app_file)
2228 time.sleep(5)
2229 log_test.info('Adding subscribers through OLT app')
2230 self.config_olt(switch_map)
2231 olt_configured = True
2232 time.sleep(5)
2233 devices_list = self.voltha.get_devices()
2234 for i in range(no_iterations):
2235 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2236 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2237 thread1.start()
2238 time.sleep(randint(1,2))
2239 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2240 thread2.start()
2241 time.sleep(10)
2242 thread1.join()
2243 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002244 time.sleep(60)
2245 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002246 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2247 try:
2248 # assert_equal(status, True)
2249 assert_equal(auth_status, True)
2250 assert_equal(self.success, True)
2251 time.sleep(10)
2252 finally:
2253 self.voltha.disable_device(device_id, delete = True)
2254 df.callback(0)
2255 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2256 return df
2257
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002258 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002259 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002260 """
2261 Test Method:
2262 0. Make sure that voltha is up and running on CORD-POD setup.
2263 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2264 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2265 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2266 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
2267 5. Verify that two subscribers are authenticated successfully.
2268 """
2269
Thangavelu K S9648eed2017-06-13 20:15:25 +00002270 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002271 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002272 aaa_app = ["org.opencord.aaa"]
2273 log_test.info('Enabling ponsim_olt')
2274 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2275 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2276 devices_list = self.voltha.get_devices()
2277 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2278
2279 onu_device_id = devices_list['items'][1]['id']
2280 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002281 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002282 time.sleep(10)
2283 switch_map = None
2284 olt_configured = False
2285 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2286 log_test.info('Installing OLT app')
2287 OnosCtrl.install_app(self.olt_app_file)
2288 time.sleep(5)
2289 log_test.info('Adding subscribers through OLT app')
2290 self.config_olt(switch_map)
2291 olt_configured = True
2292 time.sleep(5)
2293 devices_list = self.voltha.get_devices()
2294 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2295 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2296 thread1.start()
2297 time.sleep(randint(1,2))
2298 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2299 thread2.start()
2300 time.sleep(10)
2301 thread1.join()
2302 thread2.join()
2303 try:
2304 # assert_equal(status, True)
2305 assert_equal(self.success, True)
2306 time.sleep(10)
2307 finally:
2308 self.voltha.disable_device(device_id, delete = True)
2309 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002310 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002311 return df
2312
2313 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002314 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002315 """
2316 Test Method:
2317 0. Make sure that voltha is up and running on CORD-POD setup.
2318 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2319 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2320 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2321 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
2322 5. Verify that two subscribers are not authenticated.
2323 """
2324
Thangavelu K S9648eed2017-06-13 20:15:25 +00002325 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002326 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002327 aaa_app = ["org.opencord.aaa"]
2328 log_test.info('Enabling ponsim_olt')
2329 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2330 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2331 devices_list = self.voltha.get_devices()
2332 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2333
2334 onu_device_id = devices_list['items'][1]['id']
2335 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002336 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002337 time.sleep(10)
2338 switch_map = None
2339 olt_configured = False
2340 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2341 log_test.info('Installing OLT app')
2342 OnosCtrl.install_app(self.olt_app_file)
2343 time.sleep(5)
2344 log_test.info('Adding subscribers through OLT app')
2345 self.config_olt(switch_map)
2346 olt_configured = True
2347 time.sleep(5)
2348 devices_list = self.voltha.get_devices()
2349 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2350 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
2351 thread1.start()
2352 time.sleep(randint(1,2))
2353 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2354 thread2.start()
2355 time.sleep(10)
2356 thread1.join()
2357 thread2.join()
2358 try:
2359 # assert_equal(status, True)
2360 assert_equal(self.success, True)
2361 time.sleep(10)
2362 finally:
2363 self.voltha.disable_device(device_id, delete = True)
2364 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002365 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002366 return df
2367
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002368 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002369 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 +00002370 """
2371 Test Method:
2372 0. Make sure that voltha is up and running on CORD-POD setup.
2373 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2374 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2375 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2376 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2377 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
2378 6. Verify that valid subscriber authenticated successfully.
2379 7. Verify that invalid subscriber are not authenticated successfully.
2380 """
2381
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002382 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002383 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002384 aaa_app = ["org.opencord.aaa"]
2385 log_test.info('Enabling ponsim_olt')
2386 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2387 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2388 devices_list = self.voltha.get_devices()
2389 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2390
2391 onu_device_id = devices_list['items'][1]['id']
2392 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002393 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002394 time.sleep(10)
2395 switch_map = None
2396 olt_configured = False
2397 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2398 log_test.info('Installing OLT app')
2399 OnosCtrl.install_app(self.olt_app_file)
2400 time.sleep(5)
2401 log_test.info('Adding subscribers through OLT app')
2402 self.config_olt(switch_map)
2403 olt_configured = True
2404 time.sleep(5)
2405 devices_list = self.voltha.get_devices()
2406 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2407 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
2408 thread1.start()
2409 time.sleep(randint(1,2))
2410 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2411 thread2.start()
2412 time.sleep(10)
2413 thread1.join()
2414 thread2.join()
2415 try:
2416 # assert_equal(status, True)
2417 assert_equal(self.success, True)
2418 time.sleep(10)
2419 finally:
2420 self.voltha.disable_device(device_id, delete = True)
2421 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002422 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002423 return df
2424
2425 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002426 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 +00002427 """
2428 Test Method:
2429 0. Make sure that voltha is up and running on CORD-POD setup.
2430 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2431 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2432 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2433 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2434 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
2435 6. Verify that valid subscriber authenticated successfully.
2436 7. Verify that invalid subscriber are not authenticated successfully.
2437 """
2438
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002439 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002440 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002441 aaa_app = ["org.opencord.aaa"]
2442 log_test.info('Enabling ponsim_olt')
2443 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2444 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2445 devices_list = self.voltha.get_devices()
2446 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2447
2448 onu_device_id = devices_list['items'][1]['id']
2449 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002450 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002451 time.sleep(10)
2452 switch_map = None
2453 olt_configured = False
2454 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2455 log_test.info('Installing OLT app')
2456 OnosCtrl.install_app(self.olt_app_file)
2457 time.sleep(5)
2458 log_test.info('Adding subscribers through OLT app')
2459 self.config_olt(switch_map)
2460 olt_configured = True
2461 time.sleep(5)
2462 devices_list = self.voltha.get_devices()
2463 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2464 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
2465 thread1.start()
2466 time.sleep(randint(1,2))
2467 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2468 thread2.start()
2469 time.sleep(10)
2470 thread1.join()
2471 thread2.join()
2472 try:
2473 # assert_equal(status, True)
2474 assert_equal(self.success, True)
2475 time.sleep(10)
2476 finally:
2477 self.voltha.disable_device(device_id, delete = True)
2478 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002479 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002480 return df
2481
2482 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002483 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002484 """
2485 Test Method:
2486 0. Make sure that voltha is up and running on CORD-POD setup.
2487 1. OLT and ONU is detected and validated.
2488 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2489 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2490 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
2491 6. Verify that subscriber authenticated successfully.
2492 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
2493 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
2494 9. Verify that subscriber authentication is unsuccessful..
2495 10. Verify that other subscriber authenticated successfully.
2496 """
2497
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002498 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002499 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002500 aaa_app = ["org.opencord.aaa"]
2501 log_test.info('Enabling ponsim_olt')
2502 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2503 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2504 devices_list = self.voltha.get_devices()
2505 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2506
2507 onu_device_id = devices_list['items'][1]['id']
2508 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002509 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002510 time.sleep(10)
2511 switch_map = None
2512 olt_configured = False
2513 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2514 log_test.info('Installing OLT app')
2515 OnosCtrl.install_app(self.olt_app_file)
2516 time.sleep(5)
2517 log_test.info('Adding subscribers through OLT app')
2518 self.config_olt(switch_map)
2519 olt_configured = True
2520 time.sleep(5)
2521 devices_list = self.voltha.get_devices()
2522 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2523 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
2524 thread1.start()
2525 time.sleep(randint(1,2))
2526 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2527 thread2.start()
2528 time.sleep(10)
2529 thread1.join()
2530 thread2.join()
2531 try:
2532 # assert_equal(status, True)
2533 assert_equal(self.success, True)
2534 time.sleep(10)
2535 finally:
2536 self.voltha.disable_device(device_id, delete = True)
2537 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002538 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002539 return df
2540
Thangavelu K S36edb012017-07-05 18:24:12 +00002541 def test_3_subscribers_with_voltha_for_eap_tls_authentication(self):
2542 """
2543 Test Method:
2544 0. Make sure that voltha is up and running on CORD-POD setup.
2545 1. OLT and ONU is detected and validated.
2546 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2547 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers)
2548 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2549 5. Verify that subscriber is authenticated successfully.
2550 """
2551 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2552 num_subscribers = 3
2553 num_channels = 1
2554 services = ('TLS')
2555 cbs = (self.tls_flow_check, None, None)
2556 self.voltha_subscribers(services, cbs = cbs,
2557 num_subscribers = num_subscribers,
2558 num_channels = num_channels)
2559
2560 def test_5_subscribers_with_voltha_for_eap_tls_authentication(self):
2561 """
2562 Test Method:
2563 0. Make sure that voltha is up and running on CORD-POD setup.
2564 1. OLT and ONU is detected and validated.
2565 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2566 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber)
2567 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2568 5. Verify that subscriber is authenticated successfully.
2569 """
2570 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2571 num_subscribers = 5
2572 num_channels = 1
2573 services = ('TLS')
2574 cbs = (self.tls_flow_check, None, None)
2575 self.voltha_subscribers(services, cbs = cbs,
2576 num_subscribers = num_subscribers,
2577 num_channels = num_channels)
2578
2579 def test_9_subscribers_with_voltha_for_eap_tls_authentication(self):
2580 """
2581 Test Method:
2582 0. Make sure that voltha is up and running on CORD-POD setup.
2583 1. OLT and ONU is detected and validated.
2584 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2585 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber)
2586 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2587 5. Verify that subscriber is authenticated successfully.
2588 """
2589 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2590 num_subscribers = 9
2591 num_channels = 1
2592 services = ('TLS')
2593 cbs = (self.tls_flow_check, None, None)
2594 self.voltha_subscribers(services, cbs = cbs,
2595 num_subscribers = num_subscribers,
2596 num_channels = num_channels)
2597
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002598 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002599 def test_subscriber_with_voltha_for_dhcp_request(self):
2600 """
2601 Test Method:
2602 0. Make sure that voltha is up and running on CORD-POD setup.
2603 1. OLT and ONU is detected and validated.
2604 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2605 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2606 4. Verify that subscriber get ip from dhcp server successfully.
2607 """
2608
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002609 df = defer.Deferred()
2610 def dhcp_flow_check_scenario(df):
2611 log_test.info('Enabling ponsim_olt')
2612 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2613 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2614 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002615 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002616 time.sleep(10)
2617 switch_map = None
2618 olt_configured = False
2619 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2620 log_test.info('Installing OLT app')
2621 OnosCtrl.install_app(self.olt_app_file)
2622 time.sleep(5)
2623 log_test.info('Adding subscribers through OLT app')
2624 self.config_olt(switch_map)
2625 olt_configured = True
2626 time.sleep(5)
2627 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2628 try:
2629 assert_equal(dhcp_status, True)
2630 #assert_equal(status, True)
2631 time.sleep(10)
2632 finally:
2633 self.remove_olt(switch_map)
2634 self.voltha.disable_device(device_id, delete = True)
2635 df.callback(0)
2636
2637 reactor.callLater(0, dhcp_flow_check_scenario, df)
2638 return df
2639
2640 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002641 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
2642 """
2643 Test Method:
2644 0. Make sure that voltha is up and running on CORD-POD setup.
2645 1. OLT and ONU is detected and validated.
2646 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2647 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
2648 4. Verify that subscriber should not get ip from dhcp server.
2649 """
2650
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002651 df = defer.Deferred()
2652 def dhcp_flow_check_scenario(df):
2653 log_test.info('Enabling ponsim_olt')
2654 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2655 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2656 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002657 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002658 time.sleep(10)
2659 switch_map = None
2660 olt_configured = False
2661 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2662 log_test.info('Installing OLT app')
2663 OnosCtrl.install_app(self.olt_app_file)
2664 time.sleep(5)
2665 log_test.info('Adding subscribers through OLT app')
2666 self.config_olt(switch_map)
2667 olt_configured = True
2668 time.sleep(5)
2669 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
2670 try:
2671 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002672 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002673 #assert_equal(status, True)
2674 time.sleep(10)
2675 finally:
2676 self.voltha.disable_device(device_id, delete = True)
2677 self.remove_olt(switch_map)
2678 df.callback(0)
2679
2680 reactor.callLater(0, dhcp_flow_check_scenario, df)
2681 return df
2682
2683
2684 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002685 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
2686 """
2687 Test Method:
2688 0. Make sure that voltha is up and running on CORD-POD setup.
2689 1. OLT and ONU is detected and validated.
2690 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2691 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
2692 4. Verify that subscriber should not get ip from dhcp server.
2693 """
2694
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002695 df = defer.Deferred()
2696 def dhcp_flow_check_scenario(df):
2697 log_test.info('Enabling ponsim_olt')
2698 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2699 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2700 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002701 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002702 time.sleep(10)
2703 switch_map = None
2704 olt_configured = False
2705 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2706 log_test.info('Installing OLT app')
2707 OnosCtrl.install_app(self.olt_app_file)
2708 time.sleep(5)
2709 log_test.info('Adding subscribers through OLT app')
2710 self.config_olt(switch_map)
2711 olt_configured = True
2712 time.sleep(5)
2713 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
2714 try:
2715 assert_equal(dhcp_status, True)
2716 #assert_equal(status, True)
2717 time.sleep(10)
2718 finally:
2719 self.voltha.disable_device(device_id, delete = True)
2720 self.remove_olt(switch_map)
2721 df.callback(0)
2722
2723 reactor.callLater(0, dhcp_flow_check_scenario, df)
2724 return df
2725
2726 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002727 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
2728 """
2729 Test Method:
2730 0. Make sure that voltha is up and running on CORD-POD setup.
2731 1. OLT and ONU is detected and validated.
2732 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2733 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
2734 4. Verify that subscriber should not get ip from dhcp server.
2735 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002736 df = defer.Deferred()
2737 def dhcp_flow_check_scenario(df):
2738 log_test.info('Enabling ponsim_olt')
2739 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2740 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2741 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002742 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002743 time.sleep(10)
2744 switch_map = None
2745 olt_configured = False
2746 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2747 log_test.info('Installing OLT app')
2748 OnosCtrl.install_app(self.olt_app_file)
2749 time.sleep(5)
2750 log_test.info('Adding subscribers through OLT app')
2751 self.config_olt(switch_map)
2752 olt_configured = True
2753 time.sleep(5)
2754 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
2755 try:
2756 assert_equal(dhcp_status, True)
2757 #assert_equal(status, True)
2758 time.sleep(10)
2759 finally:
2760 self.voltha.disable_device(device_id, delete = True)
2761 self.remove_olt(switch_map)
2762 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002763
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002764 reactor.callLater(0, dhcp_flow_check_scenario, df)
2765 return df
2766
2767 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002768 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
2769 """
2770 Test Method:
2771 0. Make sure that voltha is up and running on CORD-POD setup.
2772 1. OLT and ONU is detected and validated.
2773 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2774 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2775 4. Verify that subscriber get ip from dhcp server successfully.
2776 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
2777 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
2778 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002779 df = defer.Deferred()
2780 def dhcp_flow_check_scenario(df):
2781 log_test.info('Enabling ponsim_olt')
2782 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2783 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2784 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002785 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002786 time.sleep(10)
2787 switch_map = None
2788 olt_configured = False
2789 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2790 log_test.info('Installing OLT app')
2791 OnosCtrl.install_app(self.olt_app_file)
2792 time.sleep(5)
2793 log_test.info('Adding subscribers through OLT app')
2794 self.config_olt(switch_map)
2795 olt_configured = True
2796 time.sleep(5)
2797 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
2798 try:
2799 assert_equal(dhcp_status, True)
2800 #assert_equal(status, True)
2801 time.sleep(10)
2802 finally:
2803 self.voltha.disable_device(device_id, delete = True)
2804 self.remove_olt(switch_map)
2805 df.callback(0)
2806
2807 reactor.callLater(0, dhcp_flow_check_scenario, df)
2808 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002809
Thangavelu K S735a6662017-06-15 18:08:23 +00002810
2811 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07002812 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002813 """
2814 Test Method:
2815 0. Make sure that voltha is up and running on CORD-POD setup.
2816 1. OLT and ONU is detected and validated.
2817 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2818 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2819 4. Verify that subscriber get ip from dhcp server successfully.
2820 5. Repeat step 3 and 4 for 10 times.
2821 6 Verify that subscriber should get ip from dhcp server.
2822 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002823 df = defer.Deferred()
2824 def dhcp_flow_check_scenario(df):
2825 log_test.info('Enabling ponsim_olt')
2826 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2827 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2828 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002829 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002830 time.sleep(10)
2831 switch_map = None
2832 olt_configured = False
2833 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2834 log_test.info('Installing OLT app')
2835 OnosCtrl.install_app(self.olt_app_file)
2836 time.sleep(5)
2837 log_test.info('Adding subscribers through OLT app')
2838 self.config_olt(switch_map)
2839 olt_configured = True
2840 time.sleep(5)
2841 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
2842 try:
2843 assert_equal(dhcp_status, True)
2844 #assert_equal(status, True)
2845 time.sleep(10)
2846 finally:
2847 self.voltha.disable_device(device_id, delete = True)
2848 self.remove_olt(switch_map)
2849 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002850
Thangavelu K S735a6662017-06-15 18:08:23 +00002851 reactor.callLater(0, dhcp_flow_check_scenario, df)
2852 return df
2853
Thangavelu K S735a6662017-06-15 18:08:23 +00002854 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002855 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
2856 """
2857 Test Method:
2858 0. Make sure that voltha is up and running on CORD-POD setup.
2859 1. OLT and ONU is detected and validated.
2860 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2861 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
2862 4. Verify that subscriber should not get ip from dhcp server.
2863 5. Repeat steps 3 and 4 for 10 times.
2864 6 Verify that subscriber should not get ip from dhcp server.
2865 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002866 df = defer.Deferred()
2867 def dhcp_flow_check_scenario(df):
2868 log_test.info('Enabling ponsim_olt')
2869 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2870 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2871 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002872 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002873 time.sleep(10)
2874 switch_map = None
2875 olt_configured = False
2876 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2877 log_test.info('Installing OLT app')
2878 OnosCtrl.install_app(self.olt_app_file)
2879 time.sleep(5)
2880 log_test.info('Adding subscribers through OLT app')
2881 self.config_olt(switch_map)
2882 olt_configured = True
2883 time.sleep(5)
2884 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
2885 try:
2886 assert_equal(dhcp_status, True)
2887 #assert_equal(status, True)
2888 time.sleep(10)
2889 finally:
2890 self.voltha.disable_device(device_id, delete = True)
2891 self.remove_olt(switch_map)
2892 df.callback(0)
2893
2894 reactor.callLater(0, dhcp_flow_check_scenario, df)
2895 return df
2896
Thangavelu K S735a6662017-06-15 18:08:23 +00002897 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002898 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
2899 """
2900 Test Method:
2901 0. Make sure that voltha is up and running on CORD-POD setup.
2902 1. OLT and ONU is detected and validated.
2903 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2904 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2905 4. Verify that subscriber get ip from dhcp server successfully.
2906 5. Repeat step 3 for 50 times.
2907 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2908 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002909 df = defer.Deferred()
2910 def dhcp_flow_check_scenario(df):
2911 log_test.info('Enabling ponsim_olt')
2912 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2913 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2914 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002915 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002916 time.sleep(10)
2917 switch_map = None
2918 olt_configured = False
2919 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2920 log_test.info('Installing OLT app')
2921 OnosCtrl.install_app(self.olt_app_file)
2922 time.sleep(5)
2923 log_test.info('Adding subscribers through OLT app')
2924 self.config_olt(switch_map)
2925 olt_configured = True
2926 time.sleep(5)
2927 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
2928 try:
2929 assert_equal(dhcp_status, True)
2930 #assert_equal(status, True)
2931 time.sleep(10)
2932 finally:
2933 self.voltha.disable_device(device_id, delete = True)
2934 self.remove_olt(switch_map)
2935 df.callback(0)
2936
2937 reactor.callLater(0, dhcp_flow_check_scenario, df)
2938 return df
2939
Thangavelu K S735a6662017-06-15 18:08:23 +00002940 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002941 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
2942 """
2943 Test Method:
2944 0. Make sure that voltha is up and running on CORD-POD setup.
2945 1. OLT and ONU is detected and validated.
2946 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2947 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2948 4. Verify that subscriber get ip from dhcp server successfully.
2949 5. Send DHCP request to dhcp server which is running as onos app.
2950 6. Repeat step 5 for 50 times.
2951 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2952 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002953 df = defer.Deferred()
2954 def dhcp_flow_check_scenario(df):
2955 log_test.info('Enabling ponsim_olt')
2956 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2957 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2958 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002959 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002960 time.sleep(10)
2961 switch_map = None
2962 olt_configured = False
2963 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2964 log_test.info('Installing OLT app')
2965 OnosCtrl.install_app(self.olt_app_file)
2966 time.sleep(5)
2967 log_test.info('Adding subscribers through OLT app')
2968 self.config_olt(switch_map)
2969 olt_configured = True
2970 time.sleep(5)
2971 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
2972 try:
2973 assert_equal(dhcp_status, True)
2974 #assert_equal(status, True)
2975 time.sleep(10)
2976 finally:
2977 self.voltha.disable_device(device_id, delete = True)
2978 self.remove_olt(switch_map)
2979 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002980
Thangavelu K S735a6662017-06-15 18:08:23 +00002981 reactor.callLater(0, dhcp_flow_check_scenario, df)
2982 return df
2983
Thangavelu K S735a6662017-06-15 18:08:23 +00002984 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002985 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
2986 """
2987 Test Method:
2988 0. Make sure that voltha is up and running on CORD-POD setup.
2989 1. OLT and ONU is detected and validated.
2990 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2991 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
2992 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
2993 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002994 df = defer.Deferred()
2995 def dhcp_flow_check_scenario(df):
2996 log_test.info('Enabling ponsim_olt')
2997 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2998 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2999 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003000 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003001 time.sleep(10)
3002 switch_map = None
3003 olt_configured = False
3004 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3005 log_test.info('Installing OLT app')
3006 OnosCtrl.install_app(self.olt_app_file)
3007 time.sleep(5)
3008 log_test.info('Adding subscribers through OLT app')
3009 self.config_olt(switch_map)
3010 olt_configured = True
3011 time.sleep(5)
3012 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
3013 try:
3014 assert_equal(dhcp_status, True)
3015 #assert_equal(status, True)
3016 time.sleep(10)
3017 finally:
3018 self.voltha.disable_device(device_id, delete = True)
3019 self.remove_olt(switch_map)
3020 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003021
Thangavelu K S735a6662017-06-15 18:08:23 +00003022 reactor.callLater(0, dhcp_flow_check_scenario, df)
3023 return df
3024
3025 @deferred(TESTCASE_TIMEOUT)
3026 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003027 """
3028 Test Method:
3029 0. Make sure that voltha is up and running on CORD-POD setup.
3030 1. OLT and ONU is detected and validated.
3031 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3032 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
3033 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.
3034 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003035 df = defer.Deferred()
3036 def dhcp_flow_check_scenario(df):
3037 log_test.info('Enabling ponsim_olt')
3038 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3039 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3040 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003041 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003042 time.sleep(10)
3043 switch_map = None
3044 olt_configured = False
3045 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3046 log_test.info('Installing OLT app')
3047 OnosCtrl.install_app(self.olt_app_file)
3048 time.sleep(5)
3049 log_test.info('Adding subscribers through OLT app')
3050 self.config_olt(switch_map)
3051 olt_configured = True
3052 time.sleep(5)
3053 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
3054 try:
3055 assert_equal(dhcp_status, True)
3056 #assert_equal(status, True)
3057 time.sleep(10)
3058 finally:
3059 self.voltha.disable_device(device_id, delete = True)
3060 self.remove_olt(switch_map)
3061 df.callback(0)
3062
3063 reactor.callLater(0, dhcp_flow_check_scenario, df)
3064 return df
3065
Thangavelu K S735a6662017-06-15 18:08:23 +00003066 @deferred(TESTCASE_TIMEOUT)
3067 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003068 """
3069 Test Method:
3070 0. Make sure that voltha is up and running on CORD-POD setup.
3071 1. OLT and ONU is detected and validated.
3072 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3073 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3074 4. Verify that subscriber get ip from dhcp server successfully.
3075 5. Deactivate dhcp server app in onos.
3076 6. Repeat step 3.
3077 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3078 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003079 df = defer.Deferred()
3080 dhcp_app = 'org.onosproject.dhcp'
3081 def dhcp_flow_check_scenario(df):
3082 log_test.info('Enabling ponsim_olt')
3083 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3084 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3085 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003086 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003087 time.sleep(10)
3088 switch_map = None
3089 olt_configured = False
3090 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3091 log_test.info('Installing OLT app')
3092 OnosCtrl.install_app(self.olt_app_file)
3093 time.sleep(5)
3094 log_test.info('Adding subscribers through OLT app')
3095 self.config_olt(switch_map)
3096 olt_configured = True
3097 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003098 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00003099 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
3100 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3101 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00003102 thread1.start()
3103 time.sleep(10)
3104 thread1.join()
3105 thread2.join()
3106 try:
3107 assert_equal(self.success, True)
3108 #assert_equal(status, True)
3109 time.sleep(10)
3110 finally:
3111 self.voltha.disable_device(device_id, delete = True)
3112 self.remove_olt(switch_map)
3113 df.callback(0)
3114
3115 reactor.callLater(0, dhcp_flow_check_scenario, df)
3116 return df
3117
3118 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003119 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
3120 """
3121 Test Method:
3122 0. Make sure that voltha is up and running on CORD-POD setup.
3123 1. OLT and ONU is detected and validated.
3124 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3125 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3126 4. Verify that subscriber get ip from dhcp server successfully.
3127 5. Send dhcp renew packet to dhcp server which is running as onos app.
3128 6. Repeat step 4.
3129 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003130
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003131 df = defer.Deferred()
3132 def dhcp_flow_check_scenario(df):
3133 log_test.info('Enabling ponsim_olt')
3134 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3135 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3136 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003137 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003138 time.sleep(10)
3139 switch_map = None
3140 olt_configured = False
3141 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3142 log_test.info('Installing OLT app')
3143 OnosCtrl.install_app(self.olt_app_file)
3144 time.sleep(5)
3145 log_test.info('Adding subscribers through OLT app')
3146 self.config_olt(switch_map)
3147 olt_configured = True
3148 time.sleep(5)
3149 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
3150 try:
3151 assert_equal(dhcp_status, True)
3152 #assert_equal(status, True)
3153 time.sleep(10)
3154 finally:
3155 self.voltha.disable_device(device_id, delete = True)
3156 self.remove_olt(switch_map)
3157 df.callback(0)
3158
3159 reactor.callLater(0, dhcp_flow_check_scenario, df)
3160 return df
3161
3162 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003163 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
3164 """
3165 Test Method:
3166 0. Make sure that voltha is up and running on CORD-POD setup.
3167 1. OLT and ONU is detected and validated.
3168 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3169 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3170 4. Verify that subscriber get ip from dhcp server successfully.
3171 5. Send dhcp rebind packet to dhcp server which is running as onos app.
3172 6. Repeat step 4.
3173 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003174 df = defer.Deferred()
3175 def dhcp_flow_check_scenario(df):
3176 log_test.info('Enabling ponsim_olt')
3177 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3178 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3179 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003180 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003181 time.sleep(10)
3182 switch_map = None
3183 olt_configured = False
3184 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3185 log_test.info('Installing OLT app')
3186 OnosCtrl.install_app(self.olt_app_file)
3187 time.sleep(5)
3188 log_test.info('Adding subscribers through OLT app')
3189 self.config_olt(switch_map)
3190 olt_configured = True
3191 time.sleep(5)
3192 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
3193 try:
3194 assert_equal(dhcp_status, True)
3195 #assert_equal(status, True)
3196 time.sleep(10)
3197 finally:
3198 self.voltha.disable_device(device_id, delete = True)
3199 self.remove_olt(switch_map)
3200 df.callback(0)
3201
3202 reactor.callLater(0, dhcp_flow_check_scenario, df)
3203 return df
3204
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003205 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003206 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003207 """
3208 Test Method:
3209 0. Make sure that voltha is up and running on CORD-POD setup.
3210 1. OLT and ONU is detected and validated.
3211 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3212 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3213 4. Verify that subscriber get ip from dhcp server successfully.
3214 5. Disable olt devices which is being detected in voltha CLI.
3215 6. Repeat step 3.
3216 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3217 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003218 df = defer.Deferred()
3219 dhcp_app = 'org.onosproject.dhcp'
3220 def dhcp_flow_check_scenario(df):
3221 log_test.info('Enabling ponsim_olt')
3222 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3223 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3224 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003225 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003226 time.sleep(10)
3227 switch_map = None
3228 olt_configured = False
3229 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3230 log_test.info('Installing OLT app')
3231 OnosCtrl.install_app(self.olt_app_file)
3232 time.sleep(5)
3233 log_test.info('Adding subscribers through OLT app')
3234 self.config_olt(switch_map)
3235 olt_configured = True
3236 time.sleep(5)
3237 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3238 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3239 log_test.info('Disable the olt device in during client send discover to voltha')
3240 thread2.start()
3241# time.sleep(randint(0,1))
3242 thread1.start()
3243 time.sleep(10)
3244 thread1.join()
3245 thread2.join()
3246 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003247 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003248 #assert_equal(status, True)
3249 time.sleep(10)
3250 finally:
3251 self.voltha.disable_device(device_id, delete = True)
3252 self.remove_olt(switch_map)
3253 df.callback(0)
3254
3255 reactor.callLater(0, dhcp_flow_check_scenario, df)
3256 return df
3257
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003258 @deferred(TESTCASE_TIMEOUT)
3259 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
3260 """
3261 Test Method:
3262 0. Make sure that voltha is up and running on CORD-POD setup.
3263 1. OLT and ONU is detected and validated.
3264 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3265 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3266 4. Verify that subscriber get ip from dhcp server successfully.
3267 5. Disable olt devices which is being detected in voltha CLI.
3268 6. Repeat step 3.
3269 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3270 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
3271 """
3272 df = defer.Deferred()
3273 no_iterations = 10
3274 dhcp_app = 'org.onosproject.dhcp'
3275 def dhcp_flow_check_scenario(df):
3276 log_test.info('Enabling ponsim_olt')
3277 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3278 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3279 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003280 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003281 time.sleep(10)
3282 switch_map = None
3283 olt_configured = False
3284 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3285 log_test.info('Installing OLT app')
3286 OnosCtrl.install_app(self.olt_app_file)
3287 time.sleep(5)
3288 log_test.info('Adding subscribers through OLT app')
3289 self.config_olt(switch_map)
3290 olt_configured = True
3291 time.sleep(5)
3292 for i in range(no_iterations):
3293 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3294 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3295 log_test.info('Disable the olt device in during client send discover to voltha')
3296 thread2.start()
3297# time.sleep(randint(0,1))
3298 thread1.start()
3299 time.sleep(10)
3300 thread1.join()
3301 thread2.join()
3302 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3303 try:
3304 assert_equal(self.success, True)
3305 assert_equal(dhcp_status, True)
3306 #assert_equal(status, True)
3307 time.sleep(10)
3308 finally:
3309 self.voltha.disable_device(device_id, delete = True)
3310 self.remove_olt(switch_map)
3311 df.callback(0)
3312
3313 reactor.callLater(0, dhcp_flow_check_scenario, df)
3314 return df
3315
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003316 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003317 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003318 """
3319 Test Method:
3320 0. Make sure that voltha is up and running on CORD-POD setup.
3321 1. OLT and ONU is detected and validated.
3322 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3323 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3324 4. Verify that subscriber get ip from dhcp server successfully.
3325 5. Disable olt devices which is being detected in voltha CLI.
3326 6. Repeat step 3.
3327 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3328 8. Enable olt devices which is being detected in voltha CLI.
3329 9. Repeat steps 3 and 4.
3330 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003331 df = defer.Deferred()
3332 dhcp_app = 'org.onosproject.dhcp'
3333 def dhcp_flow_check_scenario(df):
3334 log_test.info('Enabling ponsim_olt')
3335 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3336 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3337 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003338 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003339 time.sleep(10)
3340 switch_map = None
3341 olt_configured = False
3342 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3343 log_test.info('Installing OLT app')
3344 OnosCtrl.install_app(self.olt_app_file)
3345 time.sleep(5)
3346 log_test.info('Adding subscribers through OLT app')
3347 self.config_olt(switch_map)
3348 olt_configured = True
3349 time.sleep(5)
3350 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3351 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3352 thread2.start()
3353 thread1.start()
3354 time.sleep(10)
3355 thread1.join()
3356 thread2.join()
3357 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003358 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003359 #assert_equal(status, True)
3360 time.sleep(10)
3361 finally:
3362 self.voltha.disable_device(device_id, delete = True)
3363 self.remove_olt(switch_map)
3364 df.callback(0)
3365
3366 reactor.callLater(0, dhcp_flow_check_scenario, df)
3367 return df
3368
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003369 @deferred(TESTCASE_TIMEOUT)
3370 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
3371 """
3372 Test Method:
3373 0. Make sure that voltha is up and running on CORD-POD setup.
3374 1. OLT and ONU is detected and validated.
3375 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3376 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3377 4. Verify that subscriber get ip from dhcp server successfully.
3378 5. Disable olt devices which is being detected in voltha CLI.
3379 6. Repeat step 3.
3380 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3381 8. Enable olt devices which is being detected in voltha CLI.
3382 9. Repeat steps 3 and 4.
3383 """
3384
3385 df = defer.Deferred()
3386 no_iterations = 10
3387 dhcp_app = 'org.onosproject.dhcp'
3388 def dhcp_flow_check_scenario(df):
3389 log_test.info('Enabling ponsim_olt')
3390 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3391 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3392 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003393 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003394 time.sleep(10)
3395 switch_map = None
3396 olt_configured = False
3397 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3398 log_test.info('Installing OLT app')
3399 OnosCtrl.install_app(self.olt_app_file)
3400 time.sleep(5)
3401 log_test.info('Adding subscribers through OLT app')
3402 self.config_olt(switch_map)
3403 olt_configured = True
3404 time.sleep(5)
3405 for i in range(no_iterations):
3406 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3407 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3408 thread2.start()
3409 thread1.start()
3410 time.sleep(10)
3411 thread1.join()
3412 thread2.join()
3413 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3414 try:
3415 assert_equal(dhcp_status, True)
3416 #assert_equal(status, True)
3417 assert_equal(self.success, True)
3418 time.sleep(10)
3419 finally:
3420 self.voltha.disable_device(device_id, delete = True)
3421 self.remove_olt(switch_map)
3422 df.callback(0)
3423
3424 reactor.callLater(0, dhcp_flow_check_scenario, df)
3425 return df
3426
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003427 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003428 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003429 """
3430 Test Method:
3431 0. Make sure that voltha is up and running on CORD-POD setup.
3432 1. OLT and ONU is detected and validated.
3433 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3434 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3435 4. Verify that subscriber get ip from dhcp server successfully.
3436 5. Disable onu port which is being detected in voltha CLI.
3437 6. Repeat step 3.
3438 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3439 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003440 df = defer.Deferred()
3441 dhcp_app = 'org.onosproject.dhcp'
3442 def dhcp_flow_check_scenario(df):
3443 log_test.info('Enabling ponsim_olt')
3444 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3445 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3446 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003447 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003448 time.sleep(10)
3449 switch_map = None
3450 olt_configured = False
3451 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3452 log_test.info('Installing OLT app')
3453 OnosCtrl.install_app(self.olt_app_file)
3454 time.sleep(5)
3455 log_test.info('Adding subscribers through OLT app')
3456 self.config_olt(switch_map)
3457 olt_configured = True
3458 time.sleep(5)
3459 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00003460 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003461 thread1.start()
3462 thread2.start()
3463 time.sleep(10)
3464 thread1.join()
3465 thread2.join()
3466 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003467 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003468 #assert_equal(status, True)
3469 time.sleep(10)
3470 finally:
3471 self.voltha.disable_device(device_id, delete = True)
3472 self.remove_olt(switch_map)
3473 df.callback(0)
3474
3475 reactor.callLater(0, dhcp_flow_check_scenario, df)
3476 return df
3477
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003478 @deferred(TESTCASE_TIMEOUT)
3479 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
3480 """
3481 Test Method:
3482 0. Make sure that voltha is up and running on CORD-POD setup.
3483 1. OLT and ONU is detected and validated.
3484 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3485 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3486 4. Verify that subscriber get ip from dhcp server successfully.
3487 5. Disable onu port which is being detected in voltha CLI.
3488 6. Repeat step 3.
3489 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3490 """
3491 df = defer.Deferred()
3492 no_iterations = 10
3493 dhcp_app = 'org.onosproject.dhcp'
3494 def dhcp_flow_check_scenario(df):
3495 log_test.info('Enabling ponsim_olt')
3496 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3497 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3498 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003499 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003500 time.sleep(10)
3501 switch_map = None
3502 olt_configured = False
3503 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3504 log_test.info('Installing OLT app')
3505 OnosCtrl.install_app(self.olt_app_file)
3506 time.sleep(5)
3507 log_test.info('Adding subscribers through OLT app')
3508 self.config_olt(switch_map)
3509 olt_configured = True
3510 time.sleep(5)
3511 for i in range(no_iterations):
3512 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00003513 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003514 thread1.start()
3515 thread2.start()
3516 time.sleep(10)
3517 thread1.join()
3518 thread2.join()
3519 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3520 try:
3521 #assert_equal(status, True)
3522 assert_equal(dhcp_status, True)
3523 assert_equal(self.success, True)
3524 time.sleep(10)
3525 finally:
3526 self.voltha.disable_device(device_id, delete = True)
3527 self.remove_olt(switch_map)
3528 df.callback(0)
3529
3530 reactor.callLater(0, dhcp_flow_check_scenario, df)
3531 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003532
3533 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003534 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003535 """
3536 Test Method:
3537 0. Make sure that voltha is up and running on CORD-POD setup.
3538 1. OLT and ONU is detected and validated.
3539 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3540 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3541 4. Verify that subscriber get ip from dhcp server successfully.
3542 5. Disable onu port which is being detected in voltha CLI.
3543 6. Repeat step 3.
3544 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3545 8. Enable onu port which is being detected in voltha CLI.
3546 9. Repeat steps 3 and 4.
3547 """
3548
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003549 df = defer.Deferred()
3550 dhcp_app = 'org.onosproject.dhcp'
3551 def dhcp_flow_check_scenario(df):
3552 log_test.info('Enabling ponsim_olt')
3553 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3554 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3555 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003556 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003557 time.sleep(10)
3558 switch_map = None
3559 olt_configured = False
3560 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3561 log_test.info('Installing OLT app')
3562 OnosCtrl.install_app(self.olt_app_file)
3563 time.sleep(5)
3564 log_test.info('Adding subscribers through OLT app')
3565 self.config_olt(switch_map)
3566 olt_configured = True
3567 time.sleep(5)
3568 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00003569 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003570 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3571 thread2.start()
3572 time.sleep(randint(0,1))
3573 thread1.start()
3574 time.sleep(10)
3575 thread1.join()
3576 thread2.join()
3577 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3578 assert_equal(dhcp_status, True)
3579 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003580 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003581 #assert_equal(status, True)
3582 time.sleep(10)
3583 finally:
3584 self.voltha.disable_device(device_id, delete = True)
3585 self.remove_olt(switch_map)
3586 df.callback(0)
3587
3588 reactor.callLater(0, dhcp_flow_check_scenario, df)
3589 return df
3590
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003591 @deferred(TESTCASE_TIMEOUT)
3592 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
3593 """
3594 Test Method:
3595 0. Make sure that voltha is up and running on CORD-POD setup.
3596 1. OLT and ONU is detected and validated.
3597 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3598 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3599 4. Verify that subscriber get ip from dhcp server successfully.
3600 5. Disable onu port which is being detected in voltha CLI.
3601 6. Repeat step 3.
3602 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3603 8. Enable onu port which is being detected in voltha CLI.
3604 9. Repeat steps 3 and 4.
3605 """
3606
3607 df = defer.Deferred()
3608 no_iterations = 10
3609 dhcp_app = 'org.onosproject.dhcp'
3610 def dhcp_flow_check_scenario(df):
3611 log_test.info('Enabling ponsim_olt')
3612 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3613 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3614 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003615 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003616 time.sleep(10)
3617 switch_map = None
3618 olt_configured = False
3619 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3620 log_test.info('Installing OLT app')
3621 OnosCtrl.install_app(self.olt_app_file)
3622 time.sleep(5)
3623 log_test.info('Adding subscribers through OLT app')
3624 self.config_olt(switch_map)
3625 olt_configured = True
3626 time.sleep(5)
3627 for i in range(no_iterations):
3628 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00003629 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003630 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3631 thread2.start()
3632 time.sleep(randint(0,1))
3633 thread1.start()
3634 time.sleep(10)
3635 thread1.join()
3636 thread2.join()
3637 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3638 assert_equal(dhcp_status, True)
3639 try:
3640 assert_equal(self.success, True)
3641 #assert_equal(status, True)
3642 time.sleep(10)
3643 finally:
3644 self.voltha.disable_device(device_id, delete = True)
3645 self.remove_olt(switch_map)
3646 df.callback(0)
3647
3648 reactor.callLater(0, dhcp_flow_check_scenario, df)
3649 return df
3650
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003651 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003652 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003653 """
3654 Test Method:
3655 0. Make sure that voltha is up and running on CORD-POD setup.
3656 1. OLT and ONU is detected and validated.
3657 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3658 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3659 4. Verify that subscribers had got different ips from dhcp server successfully.
3660 """
3661
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003662 df = defer.Deferred()
3663 self.success = True
3664 dhcp_app = 'org.onosproject.dhcp'
3665 def dhcp_flow_check_scenario(df):
3666 log_test.info('Enabling ponsim_olt')
3667 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3668 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3669 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003670 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003671 time.sleep(10)
3672 switch_map = None
3673 olt_configured = False
3674 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3675 log_test.info('Installing OLT app')
3676 OnosCtrl.install_app(self.olt_app_file)
3677 time.sleep(5)
3678 log_test.info('Adding subscribers through OLT app')
3679 self.config_olt(switch_map)
3680 olt_configured = True
3681 time.sleep(5)
3682 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3683 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3684 thread1.start()
3685 thread2.start()
3686 time.sleep(10)
3687 thread1.join()
3688 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003689 dhcp_flow_status = self.success
3690 try:
3691# if self.success is not True:
3692 assert_equal(dhcp_flow_status, True)
3693 #assert_equal(status, True)
3694 time.sleep(10)
3695 finally:
3696 self.voltha.disable_device(device_id, delete = True)
3697 self.remove_olt(switch_map)
3698 df.callback(0)
3699
3700 reactor.callLater(0, dhcp_flow_check_scenario, df)
3701 return df
3702
3703 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003704 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003705 """
3706 Test Method:
3707 0. Make sure that voltha is up and running on CORD-POD setup.
3708 1. OLT and ONU is detected and validated.
3709 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3710 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3711 4. Verify that subscribers had got ip from dhcp server successfully.
3712 5. Repeat step 3 and 4 for 10 times for both subscribers.
3713 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
3714 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003715
3716
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003717 df = defer.Deferred()
3718 self.success = True
3719 dhcp_app = 'org.onosproject.dhcp'
3720 def dhcp_flow_check_scenario(df):
3721 log_test.info('Enabling ponsim_olt')
3722 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3723 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3724 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003725 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003726 time.sleep(10)
3727 switch_map = None
3728 olt_configured = False
3729 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3730 log_test.info('Installing OLT app')
3731 OnosCtrl.install_app(self.olt_app_file)
3732 time.sleep(5)
3733 log_test.info('Adding subscribers through OLT app')
3734 self.config_olt(switch_map)
3735 olt_configured = True
3736 time.sleep(5)
3737 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3738 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
3739 thread1.start()
3740 thread2.start()
3741 time.sleep(10)
3742 thread1.join()
3743 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003744 dhcp_flow_status = self.success
3745 try:
3746# if self.success is not True:
3747 assert_equal(dhcp_flow_status, True)
3748 #assert_equal(status, True)
3749 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
3758 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003759 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_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. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3768 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
3769 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003770
3771 df = defer.Deferred()
3772 self.success = True
3773 dhcp_app = 'org.onosproject.dhcp'
3774 def dhcp_flow_check_scenario(df):
3775 log_test.info('Enabling ponsim_olt')
3776 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3777 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3778 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003779 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003780 time.sleep(10)
3781 switch_map = None
3782 olt_configured = False
3783 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3784 log_test.info('Installing OLT app')
3785 OnosCtrl.install_app(self.olt_app_file)
3786 time.sleep(5)
3787 log_test.info('Adding subscribers through OLT app')
3788 self.config_olt(switch_map)
3789 olt_configured = True
3790 time.sleep(5)
3791 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3792 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3793 thread1.start()
3794 thread2.start()
3795 time.sleep(10)
3796 thread1.join()
3797 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003798 dhcp_flow_status = self.success
3799 try:
3800# if self.success is not True:
3801 assert_equal(dhcp_flow_status, True)
3802 #assert_equal(status, True)
3803 time.sleep(10)
3804 finally:
3805 self.voltha.disable_device(device_id, delete = True)
3806 self.remove_olt(switch_map)
3807 df.callback(0)
3808
3809 reactor.callLater(0, dhcp_flow_check_scenario, df)
3810 return df
3811
3812 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003813 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 +00003814 """
3815 Test Method:
3816 0. Make sure that voltha is up and running on CORD-POD setup.
3817 1. OLT and ONU is detected and validated.
3818 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3819 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
3820 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
3821 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
3822 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003823
3824 df = defer.Deferred()
3825 self.success = True
3826 dhcp_app = 'org.onosproject.dhcp'
3827 def dhcp_flow_check_scenario(df):
3828 log_test.info('Enabling ponsim_olt')
3829 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3830 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3831 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003832 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003833 time.sleep(10)
3834 switch_map = None
3835 olt_configured = False
3836 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3837 log_test.info('Installing OLT app')
3838 OnosCtrl.install_app(self.olt_app_file)
3839 time.sleep(5)
3840 log_test.info('Adding subscribers through OLT app')
3841 self.config_olt(switch_map)
3842 olt_configured = True
3843 time.sleep(5)
3844 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3845 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
3846 thread1.start()
3847 thread2.start()
3848 time.sleep(10)
3849 thread1.join()
3850 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003851 dhcp_flow_status = self.success
3852 try:
3853# if self.success is not True:
3854 assert_equal(dhcp_flow_status, True)
3855 #assert_equal(status, True)
3856 time.sleep(10)
3857 finally:
3858 self.voltha.disable_device(device_id, delete = True)
3859 self.remove_olt(switch_map)
3860 df.callback(0)
3861
3862 reactor.callLater(0, dhcp_flow_check_scenario, df)
3863 return df
3864
3865 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003866 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 +00003867 """
3868 Test Method:
3869 0. Make sure that voltha is up and running on CORD-POD setup.
3870 1. OLT and ONU is detected and validated.
3871 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3872 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
3873 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
3874 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
3875 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003876 df = defer.Deferred()
3877 self.success = True
3878 dhcp_app = 'org.onosproject.dhcp'
3879 def dhcp_flow_check_scenario(df):
3880 log_test.info('Enabling ponsim_olt')
3881 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3882 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3883 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003884 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003885 time.sleep(10)
3886 switch_map = None
3887 olt_configured = False
3888 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3889 log_test.info('Installing OLT app')
3890 OnosCtrl.install_app(self.olt_app_file)
3891 time.sleep(5)
3892 log_test.info('Adding subscribers through OLT app')
3893 self.config_olt(switch_map)
3894 olt_configured = True
3895 time.sleep(5)
3896 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3897 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3898 thread1.start()
3899 thread2.start()
3900 time.sleep(10)
3901 thread1.join()
3902 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003903 dhcp_flow_status = self.success
3904 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003905 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003906 time.sleep(10)
3907 finally:
3908 self.voltha.disable_device(device_id, delete = True)
3909 self.remove_olt(switch_map)
3910 df.callback(0)
3911
3912 reactor.callLater(0, dhcp_flow_check_scenario, df)
3913 return df
3914
3915 @deferred(TESTCASE_TIMEOUT)
3916 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003917 """
3918 Test Method:
3919 0. Make sure that voltha is up and running on CORD-POD setup.
3920 1. OLT and ONU is detected and validated.
3921 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3922 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3923 4. Verify that subscribers had got ip from dhcp server successfully.
3924 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3925 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3926 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3927 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003928 df = defer.Deferred()
3929 self.success = True
3930 dhcp_app = 'org.onosproject.dhcp'
3931 def dhcp_flow_check_scenario(df):
3932 log_test.info('Enabling ponsim_olt')
3933 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3934 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3935 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003936 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003937 time.sleep(10)
3938 switch_map = None
3939 olt_configured = False
3940 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3941 log_test.info('Installing OLT app')
3942 OnosCtrl.install_app(self.olt_app_file)
3943 time.sleep(5)
3944 log_test.info('Adding subscribers through OLT app')
3945 self.config_olt(switch_map)
3946 olt_configured = True
3947 time.sleep(5)
3948 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3949 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3950 thread1.start()
3951 thread2.start()
3952 time.sleep(10)
3953 thread1.join()
3954 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003955 dhcp_flow_status = self.success
3956 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003957 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003958 time.sleep(10)
3959 finally:
3960 self.voltha.disable_device(device_id, delete = True)
3961 self.remove_olt(switch_map)
3962 df.callback(0)
3963
3964 reactor.callLater(0, dhcp_flow_check_scenario, df)
3965 return df
3966
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003967 @deferred(TESTCASE_TIMEOUT)
3968 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003969 """
3970 Test Method:
3971 0. Make sure that voltha is up and running on CORD-POD setup.
3972 1. OLT and ONU is detected and validated.
3973 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3974 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3975 4. Verify that subscribers had got ip from dhcp server successfully.
3976 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3977 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3978 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3979 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
3980 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
3981 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
3982 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003983 df = defer.Deferred()
3984 self.success = True
3985 dhcp_app = 'org.onosproject.dhcp'
3986 def dhcp_flow_check_scenario(df):
3987 log_test.info('Enabling ponsim_olt')
3988 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3989 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3990 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003991 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003992 time.sleep(10)
3993 switch_map = None
3994 olt_configured = False
3995 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3996 log_test.info('Installing OLT app')
3997 OnosCtrl.install_app(self.olt_app_file)
3998 time.sleep(5)
3999 log_test.info('Adding subscribers through OLT app')
4000 self.config_olt(switch_map)
4001 olt_configured = True
4002 time.sleep(5)
4003 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4004 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00004005 thread3 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.INTF_2_RX_DEFAULT,))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004006 thread1.start()
4007 thread2.start()
4008 thread3.start()
4009 time.sleep(10)
4010 thread1.join()
4011 thread2.join()
4012 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004013 dhcp_flow_status = self.success
4014 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004015 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004016 time.sleep(10)
4017 finally:
4018 self.voltha.disable_device(device_id, delete = True)
4019 self.remove_olt(switch_map)
4020 df.callback(0)
4021
4022 reactor.callLater(0, dhcp_flow_check_scenario, df)
4023 return df
4024
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004025 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004026 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004027 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004028 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00004029 0. Make sure that voltha is up and running on CORD-POD setup.
4030 1. OLT and ONU is detected and validated.
4031 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4032 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4033 4. Verify that subscribers had got ip from dhcp server successfully.
4034 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4035 6. Disable the olt device which is detected in voltha.
4036 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4037 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004038 df = defer.Deferred()
4039 self.success = True
4040 dhcp_app = 'org.onosproject.dhcp'
4041 def dhcp_flow_check_scenario(df):
4042 log_test.info('Enabling ponsim_olt')
4043 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4044 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4045 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004046 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004047 time.sleep(10)
4048 switch_map = None
4049 olt_configured = False
4050 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4051 log_test.info('Installing OLT app')
4052 OnosCtrl.install_app(self.olt_app_file)
4053 time.sleep(5)
4054 log_test.info('Adding subscribers through OLT app')
4055 self.config_olt(switch_map)
4056 olt_configured = True
4057 time.sleep(5)
4058 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4059 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4060 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
4061
4062 thread1.start()
4063 thread2.start()
4064 thread3.start()
4065 time.sleep(10)
4066 thread1.join()
4067 thread2.join()
4068 thread3.join()
4069 dhcp_flow_status = self.success
4070 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004071 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004072 time.sleep(10)
4073 finally:
4074 self.voltha.disable_device(device_id, delete = True)
4075 self.remove_olt(switch_map)
4076 df.callback(0)
4077
4078 reactor.callLater(0, dhcp_flow_check_scenario, df)
4079 return df
4080
4081 @deferred(TESTCASE_TIMEOUT)
4082 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004083 """
4084 Test Method:
4085 0. Make sure that voltha is up and running on CORD-POD setup.
4086 1. OLT and ONU is detected and validated.
4087 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4088 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4089 4. Verify that subscribers had got ip from dhcp server successfully.
4090 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4091 6. Disable the olt device which is detected in voltha.
4092 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4093 8. Enable the olt device which is detected in voltha.
4094 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 +00004095
Thangavelu K S057b7d22017-05-16 22:03:22 +00004096 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004097 df = defer.Deferred()
4098 self.success = True
4099 dhcp_app = 'org.onosproject.dhcp'
4100 def dhcp_flow_check_scenario(df):
4101 log_test.info('Enabling ponsim_olt')
4102 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4103 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4104 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004105 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004106 time.sleep(10)
4107 switch_map = None
4108 olt_configured = False
4109 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4110 log_test.info('Installing OLT app')
4111 OnosCtrl.install_app(self.olt_app_file)
4112 time.sleep(5)
4113 log_test.info('Adding subscribers through OLT app')
4114 self.config_olt(switch_map)
4115 olt_configured = True
4116 time.sleep(5)
4117 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4118 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4119 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
4120 thread1.start()
4121 thread2.start()
4122 thread3.start()
4123 time.sleep(10)
4124 thread1.join()
4125 thread2.join()
4126 thread3.join()
4127 dhcp_flow_status = self.success
4128 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004129 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004130 time.sleep(10)
4131 finally:
4132 self.voltha.disable_device(device_id, delete = True)
4133 self.remove_olt(switch_map)
4134 df.callback(0)
4135
4136 reactor.callLater(0, dhcp_flow_check_scenario, df)
4137 return df
4138
4139 @deferred(TESTCASE_TIMEOUT)
4140 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004141 """
4142 Test Method:
4143 0. Make sure that voltha is up and running on CORD-POD setup.
4144 1. OLT and ONU is detected and validated.
4145 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4146 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4147 4. Verify that subscribers had got ip from dhcp server successfully.
4148 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4149 6. Pause the olt device which is detected in voltha.
4150 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4151 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004152 df = defer.Deferred()
4153 self.success = True
4154 dhcp_app = 'org.onosproject.dhcp'
4155 def dhcp_flow_check_scenario(df):
4156 log_test.info('Enabling ponsim_olt')
4157 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4158 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4159 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004160 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004161 time.sleep(10)
4162 switch_map = None
4163 olt_configured = False
4164 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4165 log_test.info('Installing OLT app')
4166 OnosCtrl.install_app(self.olt_app_file)
4167 time.sleep(5)
4168 log_test.info('Adding subscribers through OLT app')
4169 self.config_olt(switch_map)
4170 olt_configured = True
4171 time.sleep(5)
4172 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4173 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4174 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
4175 thread1.start()
4176 thread2.start()
4177 thread3.start()
4178 time.sleep(10)
4179 thread1.join()
4180 thread2.join()
4181 thread3.join()
4182 dhcp_flow_status = self.success
4183 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004184 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004185 time.sleep(10)
4186 finally:
4187 self.voltha.disable_device(device_id, delete = True)
4188 self.remove_olt(switch_map)
4189 df.callback(0)
4190
4191 reactor.callLater(0, dhcp_flow_check_scenario, df)
4192 return df
4193
Thangavelu K S36edb012017-07-05 18:24:12 +00004194 def test_3_subscribers_with_voltha_for_dhcp_discover_requests(self):
4195 """
4196 Test Method:
4197 0. Make sure that voltha is up and running on CORD-POD setup.
4198 1. OLT and ONU is detected and validated.
4199 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4200 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4201 4. Verify that subscriber get ip from dhcp server successfully.
4202 """
4203 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4204 num_subscribers = 3
4205 num_channels = 1
4206 services = ('DHCP')
4207 cbs = (self.dhcp_flow_check, None, None)
4208 self.voltha_subscribers(services, cbs = cbs,
4209 num_subscribers = num_subscribers,
4210 num_channels = num_channels)
4211
4212 def test_5_subscribers_with_voltha_for_dhcp_discover_requests(self):
4213 """
4214 Test Method:
4215 0. Make sure that voltha is up and running on CORD-POD setup.
4216 1. OLT and ONU is detected and validated.
4217 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4218 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4219 4. Verify that subscriber get ip from dhcp server successfully.
4220 """
4221 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4222 num_subscribers = 5
4223 num_channels = 1
4224 services = ('DHCP')
4225 cbs = (self.dhcp_flow_check, None, None)
4226 self.voltha_subscribers(services, cbs = cbs,
4227 num_subscribers = num_subscribers,
4228 num_channels = num_channels)
4229
4230 def test_9_subscribers_with_voltha_for_dhcp_discover_requests(self):
4231 """
4232 Test Method:
4233 0. Make sure that voltha is up and running on CORD-POD setup.
4234 1. OLT and ONU is detected and validated.
4235 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4236 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4237 4. Verify that subscriber get ip from dhcp server successfully.
4238 """
4239 """Test subscriber join next for channel surfing with 9 subscribers browsing 1 channels each"""
4240 num_subscribers = 9
4241 num_channels = 1
4242 services = ('DHCP')
4243 cbs = (self.dhcp_flow_check, None, None)
4244 self.voltha_subscribers(services, cbs = cbs,
4245 num_subscribers = num_subscribers,
4246 num_channels = num_channels)
4247
4248 def test_3_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4249 """
4250 Test Method:
4251 0. Make sure that voltha is up and running on CORD-POD setup.
4252 1. OLT and ONU is detected and validated.
4253 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4254 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4255 4. Verify that subscriber get ip from dhcp server successfully.
4256 """
4257 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4258 num_subscribers = 3
4259 num_channels = 1
4260 services = ('TLS','DHCP')
4261 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4262 self.voltha_subscribers(services, cbs = cbs,
4263 num_subscribers = num_subscribers,
4264 num_channels = num_channels)
4265
4266 def test_5_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4267 """
4268 Test Method:
4269 0. Make sure that voltha is up and running on CORD-POD setup.
4270 1. OLT and ONU is detected and validated.
4271 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4272 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4273 4. Verify that subscriber get ip from dhcp server successfully.
4274 """
4275 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4276 num_subscribers = 5
4277 num_channels = 1
4278 services = ('TLS','DHCP')
4279 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4280 self.voltha_subscribers(services, cbs = cbs,
4281 num_subscribers = num_subscribers,
4282 num_channels = num_channels)
4283
4284 def test_9_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4285 """
4286 Test Method:
4287 0. Make sure that voltha is 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 multiple subscribers (9 subscribers)
4290 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4291 4. Verify that subscriber get ip from dhcp server successfully.
4292 """
4293 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4294 num_subscribers = 9
4295 num_channels = 1
4296 services = ('TLS','DHCP')
4297 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4298 self.voltha_subscribers(services, cbs = cbs,
4299 num_subscribers = num_subscribers,
4300 num_channels = num_channels)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004301
4302 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004303 def test_subscriber_with_voltha_for_dhcprelay_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004304 """
4305 Test Method:
4306 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4307 1. OLT and ONU is detected and validated.
4308 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4309 3. Send dhcp request from residential subscrber to external dhcp server.
4310 4. Verify that subscriber get ip from external dhcp server successfully.
4311 """
Thangavelu K S6432b522017-07-22 00:05:54 +00004312 self.dhcprelay_setUpClass()
4313# if not port_list:
4314 port_list = self.generate_port_list(1, 0)
4315 iface = self.port_map['ports'][port_list[1][1]]
4316 mac = self.get_mac(iface)
4317 self.host_load(iface)
4318 ##we use the defaults for this test that serves as an example for others
4319 ##You don't need to restart dhcpd server if retaining default config
4320 config = self.default_config
4321 options = self.default_options
4322 subnet = self.default_subnet_config
4323 dhcpd_interface_list = self.relay_interfaces
4324 self.dhcpd_start(intf_list = dhcpd_interface_list,
4325 config = config,
4326 options = options,
4327 subnet = subnet)
4328 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4329 self.send_recv(mac=mac)
4330 self.dhcprelay_tearDwonClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004331
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004332 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004333 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004334 """
4335 Test Method:
4336 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4337 1. OLT and ONU is detected and validated.
4338 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4339 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
4340 4. Verify that subscriber should not get ip from external dhcp server.
4341 """
4342
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004343 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004344 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004345 """
4346 Test Method:
4347 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4348 1. OLT and ONU is detected and validated.
4349 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4350 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
4351 4. Verify that subscriber should not get ip from external dhcp server.
4352 """
4353
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004354 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004355 """
4356 Test Method:
4357 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4358 1. OLT and ONU is detected and validated.
4359 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4360 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
4361 4. Verify that subscriber should not get ip from external dhcp server.
4362 """
4363
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004364 def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004365 """
4366 Test Method:
4367 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4368 1. OLT and ONU is detected and validated.
4369 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4370 3. Send dhcp request from residential subscrber to external dhcp server.
4371 4. Verify that subscriber get ip from external dhcp server successfully.
4372 5. Send dhcp release from residential subscrber to external dhcp server.
4373 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
4374 """
4375
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004376 def test_subscriber_with_voltha_for_dhcprelay_starvation(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004377 """
4378 Test Method:
4379 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4380 1. OLT and ONU is detected and validated.
4381 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4382 3. Send dhcp request from residential subscriber to external dhcp server.
4383 4. Verify that subscriber get ip from external dhcp server. successfully.
4384 5. Repeat step 3 and 4 for 10 times.
4385 6 Verify that subscriber should get ip from external dhcp server..
4386 """
4387
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004388 def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004389 """
4390 Test Method:
4391 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4392 1. OLT and ONU is detected and validated.
4393 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4394 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
4395 4. Verify that subscriber should not get ip from external dhcp server..
4396 5. Repeat steps 3 and 4 for 10 times.
4397 6 Verify that subscriber should not get ip from external dhcp server..
4398 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004399 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004400 """
4401 Test Method:
4402 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4403 1. OLT and ONU is detected and validated.
4404 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4405 3. Send dhcp request from residential subscriber to external dhcp server.
4406 4. Verify that subscriber get ip from external dhcp server. successfully.
4407 5. Repeat step 3 for 50 times.
4408 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4409 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004410 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004411 """
4412 Test Method:
4413 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4414 1. OLT and ONU is detected and validated.
4415 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4416 3. Send dhcp request from residential subscriber to external dhcp server.
4417 4. Verify that subscriber get ip from external dhcp server. successfully.
4418 5. Send DHCP request to external dhcp server.
4419 6. Repeat step 5 for 50 times.
4420 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4421 """
4422
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004423 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004424 """
4425 Test Method:
4426 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4427 1. OLT and ONU is detected and validated.
4428 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4429 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
4430 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
4431 """
4432
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004433 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004434 """
4435 Test Method:
4436 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4437 1. OLT and ONU is detected and validated.
4438 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4439 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
4440 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.
4441 """
4442
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004443 def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004444 """
4445 Test Method:
4446 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4447 1. OLT and ONU is detected and validated.
4448 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4449 3. Send dhcp request from residential subscriber to external dhcp server.
4450 4. Verify that subscriber get ip from external dhcp server. successfully.
4451 5. Deactivate dhcp server app in onos.
4452 6. Repeat step 3.
4453 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4454 """
4455
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004456 def test_subscriber_with_voltha_for_dhcprelay_renew_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004457 """
4458 Test Method:
4459 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4460 1. OLT and ONU is detected and validated.
4461 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4462 3. Send dhcp request from residential subscriber to external dhcp server.
4463 4. Verify that subscriber get ip from external dhcp server. successfully.
4464 5. Send dhcp renew packet to external dhcp server.
4465 6. Repeat step 4.
4466 """
4467
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004468 def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004469 """
4470 Test Method:
4471 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4472 1. OLT and ONU is detected and validated.
4473 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4474 3. Send dhcp request from residential subscriber to external dhcp server.
4475 4. Verify that subscriber get ip from external dhcp server. successfully.
4476 5. Send dhcp rebind packet to external dhcp server.
4477 6. Repeat step 4.
4478 """
4479
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004480 def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004481 """
4482 Test Method:
4483 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4484 1. OLT and ONU is detected and validated.
4485 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4486 3. Send dhcp request from residential subscriber to external dhcp server.
4487 4. Verify that subscriber get ip from external dhcp server. successfully.
4488 5. Disable olt devices which is being detected in voltha CLI.
4489 6. Repeat step 3.
4490 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4491 """
4492
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004493 def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004494 """
4495 Test Method:
4496 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4497 1. OLT and ONU is detected and validated.
4498 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4499 3. Send dhcp request from residential subscriber to external dhcp server.
4500 4. Verify that subscriber get ip from external dhcp server. successfully.
4501 5. Disable olt devices which is being detected in voltha CLI.
4502 6. Repeat step 3.
4503 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4504 8. Enable olt devices which is being detected in voltha CLI.
4505 9. Repeat steps 3 and 4.
4506 """
4507
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004508 def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004509 """
4510 Test Method:
4511 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4512 1. OLT and ONU is detected and validated.
4513 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4514 3. Send dhcp request from residential subscriber to external dhcp server.
4515 4. Verify that subscriber get ip from external dhcp server. successfully.
4516 5. Disable onu port which is being detected in voltha CLI.
4517 6. Repeat step 3.
4518 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4519 """
4520
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004521 def test_subscriber_with_voltha_for_dhcprelay_disable_enable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004522 """
4523 Test Method:
4524 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4525 1. OLT and ONU is detected and validated.
4526 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4527 3. Send dhcp request from residential subscriber to external dhcp server.
4528 4. Verify that subscriber get ip from external dhcp server. successfully.
4529 5. Disable onu port which is being detected in voltha CLI.
4530 6. Repeat step 3.
4531 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4532 8. Enable onu port which is being detected in voltha CLI.
4533 9. Repeat steps 3 and 4.
4534 """
4535
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004536 def test_two_subscribers_with_voltha_for_dhcprelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004537 """
4538 Test Method:
4539 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4540 1. OLT and ONU is detected and validated.
4541 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4542 3. Send dhcp request from two residential subscribers to external dhcp server.
4543 4. Verify that subscribers had got different ips from external dhcp server. successfully.
4544 """
4545
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004546 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004547 """
4548 Test Method:
4549 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4550 1. OLT and ONU is detected and validated.
4551 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4552 3. Send dhcp request from two residential subscribers to external dhcp server.
4553 4. Verify that subscribers had got ip from external dhcp server. successfully.
4554 5. Repeat step 3 and 4 for 10 times for both subscribers.
4555 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
4556 """
4557
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004558 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004559 """
4560 Test Method:
4561 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4562 1. OLT and ONU is detected and validated.
4563 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4564 3. Send dhcp request from two residential subscribers to external dhcp server.
4565 4. Verify that subscribers had got ip from external dhcp server. successfully.
4566 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
4567 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
4568 """
4569
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004570 def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004571 """
4572 Test Method:
4573 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4574 1. OLT and ONU is detected and validated.
4575 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4576 3. Send dhcp request from one residential subscriber to external dhcp server.
4577 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
4578 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
4579 """
4580
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004581 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 +00004582 """
4583 Test Method:
4584 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4585 1. OLT and ONU is detected and validated.
4586 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4587 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
4588 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
4589 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
4590 """
4591
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004592 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004593 """
4594 Test Method:
4595 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4596 1. OLT and ONU is detected and validated.
4597 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4598 3. Send dhcp request from two residential subscribers to external dhcp server.
4599 4. Verify that subscribers had got ip from external dhcp server. successfully.
4600 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4601 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4602 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4603 """
4604
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004605 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004606 """
4607 Test Method:
4608 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4609 1. OLT and ONU is detected and validated.
4610 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4611 3. Send dhcp request from two residential subscribers to external dhcp server.
4612 4. Verify that subscribers had got ip from external dhcp server. successfully.
4613 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4614 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4615 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4616 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
4617 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
4618 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4619 """
4620
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004621 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004622 """
4623 Test Method:
4624 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4625 1. OLT and ONU is detected and validated.
4626 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4627 3. Send dhcp request from two residential subscribers to external dhcp server.
4628 4. Verify that subscribers had got ip from external dhcp server. successfully.
4629 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4630 6. Disable the olt device which is detected in voltha.
4631 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4632 """
4633
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004634 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004635 """
4636 Test Method:
4637 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4638 1. OLT and ONU is detected and validated.
4639 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4640 3. Send dhcp request from two residential subscribers to external dhcp server.
4641 4. Verify that subscribers had got ip from external dhcp server. successfully.
4642 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4643 6. Disable the olt device which is detected in voltha.
4644 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4645 8. Enable the olt device which is detected in voltha.
4646 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4647 """
4648
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004649 def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004650 """
4651 Test Method:
4652 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4653 1. OLT and ONU is detected and validated.
4654 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4655 3. Send dhcp request from two residential subscribers to external dhcp server.
4656 4. Verify that subscribers had got ip from external dhcp server. successfully.
4657 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4658 6. Pause the olt device which is detected in voltha.
4659 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4660 """
Thangavelu K S36edb012017-07-05 18:24:12 +00004661
Thangavelu K S6432b522017-07-22 00:05:54 +00004662 def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004663 """
4664 Test Method:
4665 0. Make sure that voltha is up and running on CORD-POD setup.
4666 1. OLT and ONU is detected and validated.
4667 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4668 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4669 4. Send igmp joins for a multicast group address multi-group-addressA.
4670 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4671 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4672 """
4673
Thangavelu K S8e413082017-07-13 20:02:14 +00004674 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4675 num_subscribers = 1
4676 num_channels = 1
4677 services = ('IGMP')
4678 cbs = (self.igmp_flow_check, None, None)
4679 self.voltha_subscribers(services, cbs = cbs,
4680 num_subscribers = num_subscribers,
4681 num_channels = num_channels)
4682
Thangavelu K S6432b522017-07-22 00:05:54 +00004683 def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004684 """
4685 Test Method:
4686 0. Make sure that voltha is up and running on CORD-POD setup.
4687 1. OLT and ONU is detected and validated.
4688 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4689 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4690 4. Send igmp joins for a multicast group address multi-group-addressA.
4691 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4692 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4693 7. Send igmp leave for a multicast group address multi-group-addressA.
4694 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4695 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004696 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4697 num_subscribers = 1
4698 num_channels = 1
4699 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004700 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00004701 self.voltha_subscribers(services, cbs = cbs,
4702 num_subscribers = num_subscribers,
4703 num_channels = num_channels)
4704
Thangavelu K S6432b522017-07-22 00:05:54 +00004705 def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004706 """
4707 Test Method:
4708 0. Make sure that voltha is up and running on CORD-POD setup.
4709 1. OLT and ONU is detected and validated.
4710 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4711 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4712 4. Send igmp joins for a multicast group address multi-group-addressA.
4713 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4714 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4715 7. Send igmp leave for a multicast group address multi-group-addressA.
4716 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4717 9. Repeat steps 4 to 6.
4718 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004719 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4720 num_subscribers = 1
4721 num_channels = 1
4722 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004723 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00004724 self.voltha_subscribers(services, cbs = cbs,
4725 num_subscribers = num_subscribers,
4726 num_channels = num_channels)
4727
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004728 def test_subscriber_with_voltha_for_igmp_5_groups_joins_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004729 """
4730 Test Method:
4731 0. Make sure that voltha is up and running on CORD-POD setup.
4732 1. OLT and ONU is detected and validated.
4733 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4734 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4735 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4736 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4737 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4738 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004739 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4740 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004741 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00004742 services = ('IGMP')
4743 cbs = (self.igmp_flow_check, None, None)
4744 self.voltha_subscribers(services, cbs = cbs,
4745 num_subscribers = num_subscribers,
4746 num_channels = num_channels)
4747
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004748 def test_subscriber_with_voltha_for_igmp_5_groups_joins_and_leave_for_one_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004749 """
4750 Test Method:
4751 0. Make sure that voltha is up and running on CORD-POD setup.
4752 1. OLT and ONU is detected and validated.
4753 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4754 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4755 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4756 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4757 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4758 7. Send igmp leave for a multicast group address multi-group-addressA.
4759 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.
4760 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester.
4761 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004762 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4763 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004764 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00004765 services = ('IGMP')
4766 cbs = (self.igmp_flow_check, None, None)
4767 self.voltha_subscribers(services, cbs = cbs,
4768 num_subscribers = num_subscribers,
4769 num_channels = num_channels)
4770
Thangavelu K S6432b522017-07-22 00:05:54 +00004771 def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004772 """
4773 Test Method:
4774 0. Make sure that voltha is up and running on CORD-POD setup.
4775 1. OLT and ONU is detected and validated.
4776 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4777 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4778 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4779 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4780 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4781 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4782 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4783 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004784 num_subscribers = 1
4785 num_channels = 1
4786 services = ('IGMP')
4787 cbs = (self.igmp_flow_check, None, None)
4788 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4789 num_subscribers = num_subscribers,
4790 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004791
Thangavelu K S6432b522017-07-22 00:05:54 +00004792 def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004793 """
4794 Test Method:
4795 0. Make sure that voltha is up and running on CORD-POD setup.
4796 1. OLT and ONU is detected and validated.
4797 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4798 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4799 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4800 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4801 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4802 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA
4803 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4804 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4805 """
4806
Thangavelu K S8e413082017-07-13 20:02:14 +00004807 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00004808 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00004809 services = ('IGMP')
4810 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4811 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4812 num_subscribers = num_subscribers,
4813 num_channels = num_channels)
4814
Thangavelu K S6432b522017-07-22 00:05:54 +00004815 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 +00004816 """
4817 Test Method:
4818 0. Make sure that voltha is up and running on CORD-POD setup.
4819 1. OLT and ONU is detected and validated.
4820 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4821 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4822 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4823 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4824 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4825 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA
4826 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4827 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4828 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004829 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00004830 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00004831 services = ('IGMP')
4832 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4833 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4834 num_subscribers = num_subscribers,
4835 num_channels = num_channels)
4836
Thangavelu K S6432b522017-07-22 00:05:54 +00004837 def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004838 """
4839 Test Method:
4840 0. Make sure that voltha is up and running on CORD-POD setup.
4841 1. OLT and ONU is detected and validated.
4842 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4843 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4844 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4845 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4846 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4847 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA
4848 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4849 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4850 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004851
4852 num_subscribers = 1
4853 num_channels = 1
4854 services = ('IGMP')
4855 cbs = (self.igmp_flow_check_join_change_to_block, None, None)
4856 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4857 num_subscribers = num_subscribers,
4858 num_channels = num_channels)
4859
Thangavelu K S6432b522017-07-22 00:05:54 +00004860 def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004861 """
4862 Test Method:
4863 0. Make sure that voltha is up and running on CORD-POD setup.
4864 1. OLT and ONU is detected and validated.
4865 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4866 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4867 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4868 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4869 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4870 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB
4871 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4872 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4873 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004874
4875 num_subscribers = 1
4876 num_channels = 1
4877 services = ('IGMP')
4878 cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None)
4879 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4880 num_subscribers = num_subscribers,
4881 num_channels = num_channels)
4882
Thangavelu K S6432b522017-07-22 00:05:54 +00004883 def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004884 """
4885 Test Method:
4886 0. Make sure that voltha is up and running on CORD-POD setup.
4887 1. OLT and ONU is detected and validated.
4888 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4889 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4890 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4891 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4892 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4893 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4894 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4895 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004896
4897 num_subscribers = 1
4898 num_channels = 1
4899 services = ('IGMP')
4900 cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None)
4901 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4902 num_subscribers = num_subscribers,
4903 num_channels = num_channels)
4904
Thangavelu K S6432b522017-07-22 00:05:54 +00004905 def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004906 """
4907 Test Method:
4908 0. Make sure that voltha is up and running on CORD-POD setup.
4909 1. OLT and ONU is detected and validated.
4910 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4911 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4912 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4913 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4914 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4915 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4916 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4917 """
4918
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004919 num_subscribers = 1
4920 num_channels = 1
4921 services = ('IGMP')
4922 cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None)
4923 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4924 num_subscribers = num_subscribers,
4925 num_channels = num_channels)
4926
Thangavelu K S6432b522017-07-22 00:05:54 +00004927 def test_two_subscribers_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004928 """
4929 Test Method:
4930 0. Make sure that voltha is up and running on CORD-POD setup.
4931 1. OLT and ONU is detected and validated.
4932 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4933 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4934 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4935 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4936 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4937 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4938 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4939 """
4940
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004941 num_subscribers = 2
4942 num_channels = 1
4943 services = ('IGMP')
4944 cbs = (self.igmp_flow_check, None, None)
4945 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'],
4946 num_subscribers = num_subscribers,
4947 num_channels = num_channels)
4948
Thangavelu K S36edb012017-07-05 18:24:12 +00004949 def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self):
4950 """
4951 Test Method:
4952 0. Make sure that voltha is up and running on CORD-POD setup.
4953 1. OLT and ONU is detected and validated.
4954 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4955 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4956 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4957 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4958 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4959 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4960 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4961 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4962 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4963 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4964 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004965 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00004966 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004967 services = ('IGMP')
4968 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4969 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'],
4970 num_subscribers = num_subscribers,
4971 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004972
Thangavelu K S6432b522017-07-22 00:05:54 +00004973 def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004974 """
4975 Test Method:
4976 0. Make sure that voltha is up and running on CORD-POD setup.
4977 1. OLT and ONU is detected and validated.
4978 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4979 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4980 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4981 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4982 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4983 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.
4984 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.
4985 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4986 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.
4987 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.
4988 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.
4989 """
4990
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004991 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00004992 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004993 services = ('IGMP')
4994 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4995 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'],
4996 num_subscribers = num_subscribers,
4997 num_channels = num_channels)
4998
4999 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005000 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 +00005001 """
5002 Test Method:
5003 0. Make sure that voltha is up and running on CORD-POD setup.
5004 1. OLT and ONU is detected and validated.
5005 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5006 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5007 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5008 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5009 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5010 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5011 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5012 9. Disable uni_2 port which is being shown on voltha CLI.
5013 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5014 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5015 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005016 #rx_port = self.port_map['ports'][port_list[i][1]]
5017 df = defer.Deferred()
5018 def igmp_flow_check_operating_onu_admin_state(df):
5019 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005020 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005021 services = ('IGMP')
5022 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5023 port_list = self.generate_port_list(num_subscribers, num_channels)
5024
Thangavelu K S9a637332017-08-01 23:22:23 +00005025 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],))
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005026 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5027 thread1.start()
5028 time.sleep(randint(40,50))
5029 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
5030 thread2.start()
5031 time.sleep(10)
5032 thread1.join()
5033 thread2.join()
5034 try:
5035 assert_equal(self.success, False)
5036 log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check')
5037 time.sleep(10)
5038 finally:
5039 pass
5040 df.callback(0)
5041 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5042 return df
5043
5044 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00005045 def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self):
5046 """
5047 Test Method:
5048 0. Make sure that voltha is up and running on CORD-POD setup.
5049 1. OLT and ONU is detected and validated.
5050 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5051 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5052 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5053 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5054 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5055 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5056 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5057 9. Disable uni_2 port which is being shown on voltha CLI.
5058 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5059 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5060 12. Enable uni_2 port which we disable at step 9.
5061 13. Repeat step 5,6 and 8.
5062 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005063 df = defer.Deferred()
5064 def igmp_flow_check_operating_onu_admin_state(df):
5065 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005066 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005067 services = ('IGMP')
5068 cbs = (self.igmp_flow_check, None, None)
5069 port_list = self.generate_port_list(num_subscribers, num_channels)
5070
Thangavelu K S9a637332017-08-01 23:22:23 +00005071 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],))
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005072 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5073 thread1.start()
5074 time.sleep(randint(50,60))
5075 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
5076 thread2.start()
5077 time.sleep(10)
5078 thread1.join()
5079 thread2.join()
5080 try:
5081 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005082 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 +00005083 time.sleep(10)
5084 finally:
5085 pass
5086 df.callback(0)
5087 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5088 return df
5089
5090 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005091 def test_two_subscribers_with_voltha_for_igmp_disabling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005092 """
5093 Test Method:
5094 0. Make sure that voltha is up and running on CORD-POD setup.
5095 1. OLT and ONU is detected and validated.
5096 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5097 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5098 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5099 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5100 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5101 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5102 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5103 9. Disable olt device which is being shown on voltha CLI.
5104 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5105 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5106 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005107 df = defer.Deferred()
5108 def igmp_flow_check_operating_olt_admin_disble(df):
5109 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005110 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005111 services = ('IGMP')
5112 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5113 port_list = self.generate_port_list(num_subscribers, num_channels)
5114
Thangavelu K S9a637332017-08-01 23:22:23 +00005115 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],))
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005116 thread1.start()
5117 time.sleep(randint(50,60))
5118 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5119 thread2.start()
5120 time.sleep(10)
5121 thread1.join()
5122 thread2.join()
5123 try:
5124 assert_equal(self.success, False)
5125 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5126 time.sleep(10)
5127 finally:
5128 pass
5129 df.callback(0)
5130 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5131 return df
5132
5133 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005134 def test_two_subscribers_with_voltha_for_igmp_pausing_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005135 """
5136 Test Method:
5137 0. Make sure that voltha is up and running on CORD-POD setup.
5138 1. OLT and ONU is detected and validated.
5139 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5140 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5141 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5142 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5143 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5144 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5145 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5146 9. Pause olt device which is being shown on voltha CLI.
5147 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5148 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5149 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005150 df = defer.Deferred()
5151 def igmp_flow_check_operating_olt_admin_pause(df):
5152 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005153 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005154 services = ('IGMP')
5155 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5156 port_list = self.generate_port_list(num_subscribers, num_channels)
5157
Thangavelu K S9a637332017-08-01 23:22:23 +00005158 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],))
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005159 thread1.start()
5160 time.sleep(randint(50,60))
5161 thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,))
5162 thread2.start()
5163 time.sleep(10)
5164 thread1.join()
5165 thread2.join()
5166 try:
5167 assert_equal(self.success, False)
5168 log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test')
5169 time.sleep(10)
5170 finally:
5171 pass
5172 df.callback(0)
5173 reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df)
5174 return df
5175
5176 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005177 def test_two_subscribers_with_voltha_for_igmp_toggling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005178 """
5179 Test Method:
5180 0. Make sure that voltha is up and running on CORD-POD setup.
5181 1. OLT and ONU is detected and validated.
5182 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5183 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5184 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5185 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5186 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5187 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5188 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5189 9. Disable olt device which is being shown on voltha CLI.
5190 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5191 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5192 12. Enable olt device which is disable at step 9.
5193 13. Repeat steps 4,5, 7 and 8.
5194 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005195 df = defer.Deferred()
5196 def igmp_flow_check_operating_olt_admin_restart(df):
5197 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005198 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005199 services = ('IGMP')
5200 cbs = (self.igmp_flow_check, None, None)
5201 port_list = self.generate_port_list(num_subscribers, num_channels)
5202
Thangavelu K S9a637332017-08-01 23:22:23 +00005203 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],))
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005204 thread1.start()
5205 time.sleep(randint(50,60))
5206 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5207 thread2.start()
5208 time.sleep(10)
5209 thread1.join()
5210 thread2.join()
5211 try:
5212 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005213 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 +00005214 time.sleep(10)
5215 finally:
5216 pass
5217 df.callback(0)
5218 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5219 return df
Thangavelu K S6432b522017-07-22 00:05:54 +00005220
5221 @deferred(TESTCASE_TIMEOUT)
5222 def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self):
5223 """
5224 Test Method:
5225 0. Make sure that voltha is up and running on CORD-POD setup.
5226 1. OLT and ONU is detected and validated.
5227 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5228 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5229 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5230 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5231 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5232 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5233 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5234 9. Disable olt device which is being shown on voltha CLI.
5235 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5236 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5237 12. Repeat steps 4 to 11 steps multiple times (example 20 times)
5238 """
5239 df = defer.Deferred()
5240 no_iterations = 20
5241 def igmp_flow_check_operating_olt_admin_disble(df):
5242 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005243 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005244 services = ('IGMP')
5245 cbs = (self.igmp_flow_check, None, None)
5246 port_list = self.generate_port_list(num_subscribers, num_channels)
5247
Thangavelu K S9a637332017-08-01 23:22:23 +00005248 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],))
Thangavelu K S6432b522017-07-22 00:05:54 +00005249 thread1.start()
5250 time.sleep(randint(30,40))
5251 for i in range(no_iterations):
5252 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5253 thread2.start()
5254 time.sleep(8)
5255 thread2.join()
5256 thread1.join()
5257 thread1.isAlive()
5258 thread2.join()
5259 try:
5260 assert_equal(self.success, False)
5261 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5262 time.sleep(10)
5263 finally:
5264 pass
5265 df.callback(0)
5266 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5267 return df
5268
5269 @deferred(TESTCASE_TIMEOUT + 200)
5270 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self):
5271 """
5272 Test Method:
5273 0. Make sure that voltha is up and running on CORD-POD setup.
5274 1. OLT and ONU is detected and validated.
5275 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5276 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5277 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5278 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5279 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5280 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5281 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5282 9. Disable uni_2 port which is being shown on voltha CLI.
5283 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5284 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5285 12. Enable uni_2 port which we disable at step 9.
5286 13. Repeat step 5,6 and 8.
5287 14. Repeat steps 4 to 13 steps multiple times (example 5 times)
5288 """
5289 df = defer.Deferred()
5290 no_iterations = 5
5291 def igmp_flow_check_operating_onu_admin_state(df):
5292 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005293 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005294 services = ('IGMP')
5295 cbs = (self.igmp_flow_check, None, None)
5296 port_list = self.generate_port_list(num_subscribers, num_channels)
5297
Thangavelu K S9a637332017-08-01 23:22:23 +00005298 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],))
Thangavelu K S6432b522017-07-22 00:05:54 +00005299 thread1.start()
5300 time.sleep(randint(40,60))
5301 for i in range(no_iterations):
5302 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5303 log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha')
5304 thread2.start()
5305 time.sleep(1)
5306 thread2.join()
5307 thread1.isAlive()
5308 thread1.join()
5309 thread2.join()
5310 try:
5311 assert_equal(self.success, True)
5312 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful')
5313 time.sleep(10)
5314 finally:
5315 pass
5316 df.callback(0)
5317 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5318 return df
5319
5320 @deferred(TESTCASE_TIMEOUT)
5321 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self):
5322 """
5323 Test Method:
5324 0. Make sure that voltha is up and running on CORD-POD setup.
5325 1. OLT and ONU is detected and validated.
5326 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5327 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5328 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5329 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5330 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5331 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5332 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5333 9. Disable olt device which is being shown on voltha CLI.
5334 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5335 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5336 12. Enable olt device which is disable at step 9.
5337 13. Repeat steps 4,5, 7 and 8.
5338 14. Repeat steps 4 to 13 steps multiple times (example 10 times)
5339 """
5340 df = defer.Deferred()
5341 no_iterations = 10
5342 def igmp_flow_check_operating_olt_admin_restart(df):
5343 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005344 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005345 services = ('IGMP')
5346 cbs = (self.igmp_flow_check, None, None)
5347 port_list = self.generate_port_list(num_subscribers, num_channels)
5348
Thangavelu K S9a637332017-08-01 23:22:23 +00005349 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],))
Thangavelu K S6432b522017-07-22 00:05:54 +00005350 thread1.start()
5351 time.sleep(randint(50,60))
5352 for i in range(no_iterations):
5353 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5354 thread2.start()
5355 time.sleep(10)
5356 thread2.join()
5357 thread1.join()
5358 thread2.join()
5359 try:
5360 assert_equal(self.success, True)
5361 log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful')
5362 time.sleep(10)
5363 finally:
5364 pass
5365 df.callback(0)
5366 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5367 return df
5368
5369 def test_5_subscriber_with_voltha_for_igmp_with_10_group_joins_verifying_traffic(self):
5370 """
5371 Test Method:
5372 0. Make sure that voltha is up and running on CORD-POD setup.
5373 1. OLT and ONU is detected and validated.
5374 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5375 3. Issue multiple dhcp client packets to get IP address from dhcp server for as subscribers and check connectivity.
5376 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5377 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5378 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5379 """
5380
5381 num_subscribers = 5
5382 num_channels = 10
5383 services = ('IGMP')
5384 cbs = (self.igmp_flow_check, None, None)
5385 self.voltha_subscribers(services, cbs = cbs,
5386 num_subscribers = num_subscribers,
5387 num_channels = num_channels)
5388
5389 def test_9_subscriber_with_voltha_for_igmp_with_10_group_joins_and_verify_traffic(self):
5390 """
5391 Test Method:
5392 0. Make sure that voltha is up and running on CORD-POD setup.
5393 1. OLT and ONU is detected and validated.
5394 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5395 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity.
5396 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5397 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5398 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5399 """
5400 num_subscribers = 9
5401 num_channels = 10
5402 services = ('IGMP')
5403 cbs = (self.igmp_flow_check, None, None)
5404 self.voltha_subscribers(services, cbs = cbs,
5405 num_subscribers = num_subscribers,
5406 num_channels = num_channels)