blob: e2008160b216e4a796b6e74d299fab3a4e552e5f [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()
A.R Karthick3493a572017-06-07 18:28:10 -0700435 @classmethod
436 def install_app_igmp(cls):
437 ##Uninstall the table app on class exit
438 OnosCtrl.uninstall_app(cls.table_app)
439 time.sleep(2)
440 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
441 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700442
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000443 def remove_olt(self, switch_map):
444 controller = get_controller()
445 auth = ('karaf', 'karaf')
446 #remove subscriber for every port on all the voltha devices
447 for device, device_map in switch_map.iteritems():
448 uni_ports = device_map['ports']
449 uplink_vlan = device_map['uplink_vlan']
450 for port in uni_ports:
451 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
452 device,
453 port)
454 resp = requests.delete(rest_url, auth = auth)
455 if resp.status_code not in [204, 202, 200]:
456 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
457 else:
458 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
459 OnosCtrl.uninstall_app(self.olt_app_file)
460
461 def config_olt(self, switch_map):
462 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000463 auth = ('karaf', 'karaf')
464 #configure subscriber for every port on all the voltha devices
465 for device, device_map in switch_map.iteritems():
466 uni_ports = device_map['ports']
467 uplink_vlan = device_map['uplink_vlan']
468 for port in uni_ports:
469 vlan = port
470 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
471 device,
472 port,
473 vlan)
474 resp = requests.post(rest_url, auth = auth)
475 #assert_equal(resp.ok, True)
476
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000477 def voltha_uni_port_toggle(self, uni_port = None):
478 ## Admin state of port is down and up
479 if not uni_port:
480 uni_port = self.INTF_RX_DEFAULT
481 cmd = 'ifconfig {} down'.format(uni_port)
482 os.system(cmd)
483 log_test.info('Admin state of uni_port is down')
484 time.sleep(30)
485 cmd = 'ifconfig {} up'.format(uni_port)
486 os.system(cmd)
487 log_test.info('Admin state of uni_port is up now')
488 time.sleep(30)
489 return
490
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000491 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000492 def install_app_table(cls):
493 ##Uninstall the existing app if any
494 OnosCtrl.uninstall_app(cls.table_app)
495 time.sleep(2)
496 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
497 OnosCtrl.install_app(cls.table_app_file)
498 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000499
500 @classmethod
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000501 def activate_apps(cls, apps, deactivate = False):
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000502 for app in apps:
503 onos_ctrl = OnosCtrl(app)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000504 if deactivate is True:
505 onos_ctrl.deactivate()
506 time.sleep(2)
507 status, _ = onos_ctrl.activate()
508 assert_equal(status, True)
509 time.sleep(2)
510
511
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000512
Thangavelu K S735a6662017-06-15 18:08:23 +0000513 @classmethod
514 def deactivate_apps(cls, apps):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000515 cls.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000516 for app in apps:
517 onos_ctrl = OnosCtrl(app)
518 status, _ = onos_ctrl.deactivate()
519 if status is False:
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000520 cls.success = False
521 # assert_equal(status, True)
Thangavelu K S735a6662017-06-15 18:08:23 +0000522 time.sleep(2)
523
Thangavelu K S36edb012017-07-05 18:24:12 +0000524 def random_ip(self,start_ip = '10.10.10.20', end_ip = '10.10.10.65'):
525 start = list(map(int, start_ip.split(".")))
526 end = list(map(int, end_ip.split(".")))
527 temp = start
528 ip_range = []
529 ip_range.append(start_ip)
530 while temp != end:
531 start[3] += 1
532 for i in (3, 2, 1):
533 if temp[i] == 255:
534 temp[i] = 0
535 temp[i-1] += 1
536 ip_range.append(".".join(map(str, temp)))
537 return random.choice(ip_range)
538
Thangavelu K S8e413082017-07-13 20:02:14 +0000539 def random_mcast_ip(self,start_ip = '224.0.1.0', end_ip = '224.0.1.100'):
540 start = list(map(int, start_ip.split(".")))
541 end = list(map(int, end_ip.split(".")))
542 temp = start
543 ip_range = []
544 ip_range.append(start_ip)
545 while temp != end:
546 start[3] += 1
547 for i in (3, 2, 1):
548 if temp[i] == 255:
549 temp[i] = 0
550 temp[i-1] += 1
551 ip_range.append(".".join(map(str, temp)))
552 return random.choice(ip_range)
553
Thangavelu K S6432b522017-07-22 00:05:54 +0000554 @classmethod
555 def dhcp_relay_setup(cls):
556 #did = OnosCtrl.get_device_id()
557 #cls.relay_device_id = did
558 #cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
559 #cls.port_map, _ = cls.olt.olt_port_map() self.port_map['ports'][port_list[1][1]]
560 if cls.port_map:
561 ##Per subscriber, we use 1 relay port
562 try:
563 relay_port = cls.port_map['ports']
564 except:
565 relay_port = cls.port_map['uplink']
566 cls.relay_interface_port = relay_port
567 cls.relay_interfaces = (cls.port_map[cls.relay_interface_port],)
568 else:
569# cls.relay_interface_port = 100
570# cls.relay_interfaces = (g_subscriber_port_map[cls.relay_interface_port],)
571 log_test.info('No ONU ports are available, hence returning nothing')
572 cls.relay_interfaces_last = cls.relay_interfaces
573 if cls.port_map:
574 ##generate a ip/mac client virtual interface config for onos
575 interface_list = []
576 for port in cls.port_map['ports']:
577 port_num = cls.port_map[port]
578 if port_num == cls.port_map['uplink']:
579 continue
580 ip = cls.get_host_ip(port_num)
581 mac = cls.get_mac(port)
582 interface_list.append((port_num, ip, mac))
583
584 #configure dhcp server virtual interface on the same subnet as first client interface
585 relay_ip = cls.get_host_ip(interface_list[0][0])
586 relay_mac = cls.get_mac(cls.port_map[cls.relay_interface_port])
587 interface_list.append((cls.relay_interface_port, relay_ip, relay_mac))
588 cls.onos_interface_load(interface_list)
589
590 @classmethod
591 def onos_interface_load(cls, interface_list):
592 interface_dict = { 'ports': {} }
593 for port_num, ip, mac in interface_list:
594 port_map = interface_dict['ports']
595 port = '{}/{}'.format(cls.relay_device_id, port_num)
596 port_map[port] = { 'interfaces': [] }
597 interface_list = port_map[port]['interfaces']
598 interface_map = { 'ips' : [ '{}/{}'.format(ip, 24) ],
599 'mac' : mac,
600 'name': 'vir-{}'.format(port_num)
601 }
602 interface_list.append(interface_map)
603
604 cls.onos_load_config(interface_dict)
605 cls.configs['interface_config'] = interface_dict
606
607 @classmethod
608 def get_host_ip(cls, port):
609 if cls.host_ip_map.has_key(port):
610 return cls.host_ip_map[port]
611 cls.host_ip_map[port] = '192.168.1.{}'.format(port)
612 return cls.host_ip_map[port]
613
614 @classmethod
615 def host_load(cls, iface):
616 '''Have ONOS discover the hosts for dhcp-relay responses'''
617 port = g_subscriber_port_map[iface]
618 host = '173.17.1.{}'.format(port)
619 cmds = ( 'ifconfig {} 0'.format(iface),
620 'ifconfig {0} {1}'.format(iface, host),
621 'arping -I {0} {1} -c 2'.format(iface, host),
622 'ifconfig {} 0'.format(iface), )
623 for c in cmds:
624 os.system(c)
625
626 @classmethod
627 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
628 subnet = default_subnet_config):
629 conf = ''
630 for k, v in config.items():
631 conf += '{} {};\n'.format(k, v)
632
633 opts = ''
634 for k, v in options:
635 opts += 'option {} {};\n'.format(k, v)
636
637 subnet_config = ''
638 for _, v in subnet:
639 subnet_config += '{}\n'.format(v)
640
641 return '{}{}{}'.format(conf, opts, subnet_config)
642
643 @classmethod
644 def dhcpd_start(cls, intf_list = None,
645 config = default_config, options = default_options,
646 subnet = default_subnet_config):
647 '''Start the dhcpd server by generating the conf file'''
648 if intf_list is None:
649 intf_list = cls.relay_interfaces
650 ##stop dhcpd if already running
651 cls.dhcpd_stop()
652 dhcp_conf = cls.dhcpd_conf_generate(config = config, options = options,
653 subnet = subnet)
654 ##first touch dhcpd.leases if it doesn't exist
655 lease_file = '{}/dhcpd.leases'.format(cls.dhcp_data_dir)
656 if os.access(lease_file, os.F_OK) is False:
657 with open(lease_file, 'w') as fd: pass
658
659 conf_file = '{}/dhcpd.conf'.format(cls.dhcp_data_dir)
660 with open(conf_file, 'w') as fd:
661 fd.write(dhcp_conf)
662
663 #now configure the dhcpd interfaces for various subnets
664 index = 0
665 intf_info = []
666 for ip,_ in subnet:
667 intf = intf_list[index]
668 mac = cls.get_mac(intf)
669 intf_info.append((ip, mac))
670 index += 1
671 os.system('ifconfig {} {}'.format(intf, ip))
672
673 intf_str = ','.join(intf_list)
674 dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format(conf_file, lease_file, intf_str)
675 log_test.info('Starting DHCPD server with command: %s' %dhcpd_cmd)
676 ret = os.system(dhcpd_cmd)
677 assert_equal(ret, 0)
678 time.sleep(3)
679 cls.relay_interfaces_last = cls.relay_interfaces
680 cls.relay_interfaces = intf_list
681 cls.onos_dhcp_relay_load(*intf_info[0])
682
683 @classmethod
684 def dhcpd_stop(cls):
685 os.system('pkill -9 dhcpd')
686 for intf in cls.relay_interfaces:
687 os.system('ifconfig {} 0'.format(intf))
688
689 cls.relay_interfaces = cls.relay_interfaces_last
690
691 @classmethod
692 def get_mac(cls, iface):
693 if cls.interface_to_mac_map.has_key(iface):
694 return cls.interface_to_mac_map[iface]
695 mac = get_mac(iface, pad = 0)
696 cls.interface_to_mac_map[iface] = mac
697 return mac
698
699 def send_recv(self, mac=None, update_seed = False, validate = True):
700 cip, sip = self.dhcp.discover(mac = mac, update_seed = update_seed)
701 if validate:
702 assert_not_equal(cip, None)
703 assert_not_equal(sip, None)
704 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
705 (cip, sip, self.dhcp.get_mac(cip)[0]))
706 return cip,sip
707
708 @classmethod
709 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
710 subnet = default_subnet_config):
711 conf = ''
712 for k, v in config.items():
713 conf += '{} {};\n'.format(k, v)
714
715 opts = ''
716 for k, v in options:
717 opts += 'option {} {};\n'.format(k, v)
718
719 subnet_config = ''
720 for _, v in subnet:
721 subnet_config += '{}\n'.format(v)
722
723 return '{}{}{}'.format(conf, opts, subnet_config)
724
725 @classmethod
726 def onos_dhcp_relay_load(cls, server_ip, server_mac):
727 relay_device_map = '{}/{}'.format(cls.relay_device_id, cls.relay_interface_port)
728 dhcp_dict = {'apps':{'org.onosproject.dhcp-relay':{'dhcprelay':
729 {'dhcpserverConnectPoint':relay_device_map,
730 'serverip':server_ip,
731 'servermac':server_mac
732 }
733 }
734 }
735 }
736 cls.onos_load_config(dhcp_dict)
737 cls.configs['relay_config'] = dhcp_dict
738
739 @classmethod
740 def dhcp_relay_cleanup(cls):
741 ##reset the ONOS port configuration back to default
742 for config in cls.configs.items():
743 OnosCtrl.delete(config)
744 # if cls.onos_restartable is True:
745 # log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
746 # return cord_test_onos_restart(config = {})
747
748
Thangavelu K S8e413082017-07-13 20:02:14 +0000749 def tls_flow_check(self, olt_ports, cert_info = None, multiple_sub = False):
750 if multiple_sub is True:
751 olt_nni_port = olt_ports.tx_port
752 olt_uni_port = olt_ports.rx_port
753 else:
Thangavelu K S36edb012017-07-05 18:24:12 +0000754 olt_uni_port = olt_ports
755
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000756 def tls_fail_cb():
757 log_test.info('TLS verification failed')
758 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700759 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000760 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
761 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000762 if tls.failTest is True:
763 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000764 assert_equal(tls.failTest, False)
765 if cert_info == "no_cert":
766 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
767 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
768 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000769 if tls.failTest is False:
770 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000771 assert_equal(tls.failTest, True)
772 if cert_info == "invalid_cert":
773 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
774 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
775 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000776 if tls.failTest is False:
777 self.success = False
778 assert_equal(tls.failTest, True)
779 if cert_info == "same_cert":
780 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
781 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
782 tls.runTest()
783 if tls.failTest is False:
784 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000785 assert_equal(tls.failTest, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000786 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 +0000787 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 +0000788 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
789 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
790 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000791 if tls.failTest is False:
792 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000793 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000794 self.test_status = True
795 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700796
Thangavelu K S8e413082017-07-13 20:02:14 +0000797 def dhcp_flow_check(self, olt_ports, negative_test = None, multiple_sub = False):
798 if multiple_sub is True:
799 olt_nni_port = olt_ports.tx_port
800 onu_iface = olt_ports.rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +0000801 dhcp_server_startip = self.random_ip()
802 random_mac = '00:00:00:0a:0a:' + hex(random.randrange(50,254)).split('x')[1]
Thangavelu K S8e413082017-07-13 20:02:14 +0000803 else:
804 onu_iface = olt_ports
805 dhcp_server_startip = '10.10.10.20'
806 random_mac = None
Thangavelu K S735a6662017-06-15 18:08:23 +0000807 self.success = True
808
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000809 if negative_test is None:
Thangavelu K S36edb012017-07-05 18:24:12 +0000810 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = 'skip', startip = dhcp_server_startip, mac = random_mac)
811 if cip == None or sip == None:
Thangavelu K S735a6662017-06-15 18:08:23 +0000812 self.success = False
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000813 self.test_status = False
814 assert_not_equal(cip,None)
815 assert_not_equal(sip,None)
816 else:
817 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
818 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000819
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000820 if negative_test == "interrupting_dhcp_flows":
821 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
Thangavelu K S735a6662017-06-15 18:08:23 +0000822 if cip is not None:
823 self.success = False
824 assert_equal(cip,None)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000825 log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000826 self.test_status = True
827
828 if negative_test == "invalid_src_mac_broadcast":
829 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
830 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
831 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
832 self.onos_dhcp_table_load(config)
833 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
834 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000835
836 if cip is not None:
837 self.success = False
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000838 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 +0000839 assert_equal(cip,None)
840 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
841 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000842
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000843 if negative_test == "invalid_src_mac_multicast":
844 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
845 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
846 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
847 self.onos_dhcp_table_load(config)
848 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
849 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000850 if cip is not None:
851 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000852 assert_equal(cip,None)
853 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
854 self.test_status = True
855
856 if negative_test == "invalid_src_mac_junk":
857 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
858 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
859 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
860 self.onos_dhcp_table_load(config)
861 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
862 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000863 if cip is not None:
864 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000865 assert_equal(cip,None)
866 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
867 self.test_status = True
868
869 if negative_test == "request_release":
870 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
871 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
872 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
873 self.onos_dhcp_table_load(config)
874 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
875 cip, sip = self.dhcp_sndrcv(self.dhcp)
876 log_test.info('Releasing ip %s to server %s' %(cip, sip))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000877 if not self.dhcp.release(cip):
878 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000879 assert_equal(self.dhcp.release(cip), True)
880 log_test.info('Triggering DHCP discover again after release')
881 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
882 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000883 if not cip == cip2:
Thangavelu K S735a6662017-06-15 18:08:23 +0000884 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000885 assert_equal(cip, cip2)
886 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
887 assert_equal(self.dhcp.release(cip2), True)
888 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000889
Thangavelu K S735a6662017-06-15 18:08:23 +0000890 if negative_test == "starvation_positive":
891 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
892 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
893 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
894 self.onos_dhcp_table_load(config)
895 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
896 ip_map = {}
897 for i in range(10):
898 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
899 if ip_map.has_key(cip):
900 self.success = False
901 log_test.info('IP %s given out multiple times' %cip)
902 assert_equal(False, ip_map.has_key(cip))
903 ip_map[cip] = sip
904 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000905
Thangavelu K S735a6662017-06-15 18:08:23 +0000906 if negative_test == "starvation_negative":
907 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
908 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
909 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
910 self.onos_dhcp_table_load(config)
911 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
912 log_test.info('Verifying passitive case')
913 for x in xrange(50):
914 mac = RandMAC()._fix()
915 self.dhcp_sndrcv(self.dhcp,mac = mac)
916 log_test.info('Verifying negative case')
917 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000918 if cip or sip is not None:
919 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000920 assert_equal(cip, None)
921 assert_equal(sip, None)
922 self.test_status = True
923 self.success = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000924
Thangavelu K S735a6662017-06-15 18:08:23 +0000925 if negative_test == "multiple_discover":
926 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
927 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
928 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
929 self.onos_dhcp_table_load(config)
930 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
931 cip, sip, mac, _ = self.dhcp.only_discover()
932 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
933 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000934 if cip is None:
935 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000936 assert_not_equal(cip, None)
937 log_test.info('Triggering DHCP discover again.')
938 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000939 if not new_cip == cip:
940 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000941 assert_equal(new_cip, cip)
942 log_test.info('client got same IP as expected when sent 2nd discovery')
943 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000944 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000945 if negative_test == "multiple_requests":
946 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
947 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
948 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
949 self.onos_dhcp_table_load(config)
950 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
951 log_test.info('Sending DHCP discover and DHCP request.')
952 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
953 mac = self.dhcp.get_mac(cip)[0]
954 log_test.info("Sending DHCP request again.")
955 new_cip, new_sip = self.dhcp.only_request(cip, mac)
956 assert_equal(new_cip,cip)
957 log_test.info('server offered same IP to clain for multiple requests, as expected')
958 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000959# self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000960 if negative_test == "desired_ip_address":
961 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
962 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
963 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
964 self.onos_dhcp_table_load(config)
965 self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface)
966 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000967 if cip or sip is None:
968 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000969 assert_not_equal(cip, None)
970 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
971 (cip, sip, mac))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000972 if not self.dhcp.seed_ip == cip:
973 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000974 assert_equal(cip,self.dhcp.seed_ip)
975 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
976 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000977 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000978 if negative_test == "desired_out_of_pool_ip_address":
979 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
980 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
981 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
982 self.onos_dhcp_table_load(config)
983 self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface)
984 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000985 if cip or sip is None:
986 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000987 assert_not_equal(cip, None)
988 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
989 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000990 if self.dhcp.seed_ip == cip:
991 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000992 assert_not_equal(cip,self.dhcp.seed_ip)
993 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
994 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000995 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +0000996 if negative_test == "dhcp_renew":
997 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
998 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
999 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1000 self.onos_dhcp_table_load(config)
1001 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1002 cip, sip, mac, _ = self.dhcp.only_discover()
1003 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1004 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001005 if cip or sip is None:
1006 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001007 assert_not_equal(cip, None)
1008 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
1009 log_test.info('waiting renew time %d seconds to send next request packet'%lval)
1010 time.sleep(lval)
1011 latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001012 if not latest_cip == cip:
1013 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001014 assert_equal(latest_cip,cip)
1015 log_test.info('client got same IP after renew time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001016 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001017 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001018 if negative_test == "dhcp_rebind":
1019 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1020 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1021 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1022 self.onos_dhcp_table_load(config)
1023 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1024 cip, sip, mac, _ = self.dhcp.only_discover()
1025 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1026 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001027 if cip or sip is None:
1028 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001029 assert_not_equal(cip, None)
1030 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
1031 log_test.info('waiting rebind time %d seconds to send next request packet'%lval)
1032 time.sleep(lval)
1033 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001034 if not latest_cip == cip:
1035 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001036 assert_equal(latest_cip,cip)
1037 log_test.info('client got same IP after rebind time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001038 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001039 # self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001040 return self.test_status
1041
Thangavelu K S8e413082017-07-13 20:02:14 +00001042 def recv_channel_cb(self, pkt):
1043 ##First verify that we have received the packet for the joined instance
1044 chan = self.subscriber.caddr(pkt[IP].dst)
1045 assert_equal(chan in self.subscriber.join_map.keys(), True)
1046 recv_time = monotonic.monotonic() * 1000000
1047 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
1048 delta = recv_time - join_time
1049 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
1050 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
1051 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
1052 self.test_status = True
Thangavelu K S36edb012017-07-05 18:24:12 +00001053
Thangavelu K S8e413082017-07-13 20:02:14 +00001054 def traffic_verify(self, subscriber):
1055 # if subscriber.has_service('TRAFFIC'):
1056 url = 'http://www.google.com'
1057 resp = requests.get(url)
1058 self.test_status = resp.ok
1059 if resp.ok == False:
1060 log_test.info('Subscriber %s failed get from url %s with status code %d'
1061 %(subscriber.name, url, resp.status_code))
1062 else:
1063 log_test.info('GET request from %s succeeded for subscriber %s'
1064 %(url, subscriber.name))
1065 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001066
Thangavelu K S8e413082017-07-13 20:02:14 +00001067 def igmp_flow_check(self, subscriber, multiple_sub = False):
1068 chan = 0
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001069 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1070 if subscriber.num_channels == 1:
Thangavelu K S9a637332017-08-01 23:22:23 +00001071 if i != 0:
1072 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001073 chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1074 else:
1075 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1076 self.num_joins += 1
1077 while self.num_joins < self.num_subscribers:
1078 time.sleep(5)
1079 log_test.info('All subscribers have joined the channel')
1080 # for i in range(1):
1081 time.sleep(0.5)
1082 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1083 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1084 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001085 time.sleep(5)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001086# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1087 if subscriber.num_channels == 1:
1088 pass
1089 elif chan != 0:
1090 #Should not receive packets for this channel
1091 self.recv_timeout = True
1092 subscriber.recv_timeout = True
1093 subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1094 subscriber.recv_timeout = False
1095 self.recv_timeout = False
Thangavelu K S9a637332017-08-01 23:22:23 +00001096 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001097# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K S9a637332017-08-01 23:22:23 +00001098# chan = subscriber.num_channels - i
1099# self.test_status = True
1100 return self.test_status
1101
1102 def igmp_join_next_channel_flow_check(self, subscriber, multiple_sub = False):
1103 chan = 0
1104 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1105# if subscriber.num_channels == 1:
1106# chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1107# else:
1108 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1109 self.num_joins += 1
1110 while self.num_joins < self.num_subscribers:
1111 time.sleep(5)
1112 log_test.info('All subscribers have joined the channel')
1113 # for i in range(1):
1114 time.sleep(0.5)
1115 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1116 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1117 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
1118 time.sleep(5)
1119# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1120# if subscriber.num_channels == 1:
1121# pass
1122# elif chan != 0:
1123# pass
1124 #Should not receive packets for this channel
1125# log_test.info
1126# self.recv_timeout = True
1127# subscriber.recv_timeout = True
1128# subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1129# subscriber.recv_timeout = False
1130# self.recv_timeout = False
1131# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1132# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001133 chan = subscriber.num_channels - i
Thangavelu K S8e413082017-07-13 20:02:14 +00001134# self.test_status = True
1135 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001136
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001137 def igmp_leave_flow_check(self, subscriber, multiple_sub = False):
1138 chan = 0
1139 for i in range(self.VOLTHA_IGMP_ITERATIONS):
1140 subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1141 self.num_joins += 1
1142 while self.num_joins < self.num_subscribers:
1143 time.sleep(5)
1144 log_test.info('All subscribers have joined the channel')
1145# for i in range(1):
1146 time.sleep(0.5)
1147 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1148 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1149 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1150 time.sleep(10)
1151# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1152 #Should not receive packets for this subscriber
1153 self.recv_timeout = True
1154 subscriber.recv_timeout = True
1155 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1156 subscriber.recv_timeout = False
1157 self.recv_timeout = False
1158# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1159# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1160# self.test_status = True
1161 return self.test_status
1162
1163
1164
Thangavelu K S8e413082017-07-13 20:02:14 +00001165 def igmp_flow_check_join_change_to_exclude(self, subscriber, multiple_sub = False):
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001166 chan = 2
1167 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1168 self.num_joins += 1
1169 while self.num_joins < self.num_subscribers:
1170 time.sleep(5)
1171 log_test.info('All subscribers have joined the channel')
1172 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1173 time.sleep(5)
1174 chan = 1
1175 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1176 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1177 time.sleep(5)
1178 self.recv_timeout = True
1179 subscriber.recv_timeout = True
1180 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
1181 if self.test_status is True:
1182 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
1183 if self.test_status is True:
1184 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
1185 self.test_status = False
1186 subscriber.recv_timeout = False
1187 self.recv_timeout = False
1188 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001189 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1190 for i in range(3):
1191 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1192 self.num_joins += 1
1193 while self.num_joins < self.num_subscribers:
1194 time.sleep(5)
1195 log_test.info('All subscribers have joined the channel')
1196 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1197 time.sleep(5)
1198 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]))
1199 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1200 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1201 time.sleep(60)
1202 self.recv_timeout = False
1203 subscriber.recv_timeout = False
1204 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1205 if self.test_status is True:
1206 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1207 if self.test_status is False:
1208 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1209 continue
1210 subscriber.recv_timeout = False
1211 self.recv_timeout = False
1212 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001213# self.test_status = True
1214 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001215
Thangavelu K S8e413082017-07-13 20:02:14 +00001216 def igmp_flow_check_join_change_to_exclude_again_include_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001217 chan = 0
1218 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1219 for i in range(3):
1220 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1221 self.num_joins += 1
1222 while self.num_joins < self.num_subscribers:
1223 time.sleep(5)
1224 log_test.info('All subscribers have joined the channel')
1225 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1226 time.sleep(5)
1227 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]))
1228 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1229 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1230 time.sleep(60)
1231 self.recv_timeout = False
1232 subscriber.recv_timeout = False
1233 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1234 if self.test_status is True:
1235 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1236 if self.test_status is False:
1237 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1238 continue
1239 subscriber.recv_timeout = False
1240 self.recv_timeout = False
1241 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1242 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_INCLUDE)
1243 time.sleep(5)
1244# self.recv_timeout = True
1245# subscriber.recv_timeout = True
1246 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1247 subscriber.recv_timeout = False
1248 self.recv_timeout = False
1249
1250
1251 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1252# self.test_status = True
1253 return self.test_status
1254
Thangavelu K S36edb012017-07-05 18:24:12 +00001255
Thangavelu K S8e413082017-07-13 20:02:14 +00001256 def igmp_flow_check_join_change_to_block(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001257 chan = 0
1258 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1259 for i in range(3):
1260 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1261 self.num_joins += 1
1262 while self.num_joins < self.num_subscribers:
1263 time.sleep(5)
1264 log_test.info('All subscribers have joined the channel')
1265 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1266 time.sleep(5)
1267 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]))
1268 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_BLOCK_OLD)
1269 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1270 time.sleep(60)
1271 self.recv_timeout = False
1272 subscriber.recv_timeout = False
1273 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1274 if self.test_status is True:
1275 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1276 if self.test_status is False:
1277 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1278 continue
1279 subscriber.recv_timeout = False
1280 self.recv_timeout = False
1281 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1282# self.test_status = True
1283 return self.test_status
1284
Thangavelu K S36edb012017-07-05 18:24:12 +00001285
Thangavelu K S8e413082017-07-13 20:02:14 +00001286 def igmp_flow_check_join_change_to_block_again_allow_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001287 chan = 0
1288 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1289 for i in range(3):
1290 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1291 self.num_joins += 1
1292 while self.num_joins < self.num_subscribers:
1293 time.sleep(5)
1294 log_test.info('All subscribers have joined the channel')
1295 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1296 time.sleep(5)
1297 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]))
1298 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1299 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1300 time.sleep(60)
1301 self.recv_timeout = False
1302 subscriber.recv_timeout = False
1303 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1304 if self.test_status is True:
1305 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1306 if self.test_status is False:
1307 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1308 continue
1309 subscriber.recv_timeout = False
1310 self.recv_timeout = False
1311 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1312 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_ALLOW_NEW)
1313 time.sleep(5)
1314# self.recv_timeout = True
1315# subscriber.recv_timeout = True
1316 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1317 subscriber.recv_timeout = False
1318 self.recv_timeout = False
1319
1320
1321 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1322# self.test_status = True
1323 return self.test_status
Thangavelu K S8e413082017-07-13 20:02:14 +00001324
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001325 def igmp_flow_check_group_include_source_empty_list(self, subscriber, multiple_sub = False):
1326 chan = 0
1327 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1328 self.num_joins += 1
1329 while self.num_joins < self.num_subscribers:
1330 time.sleep(5)
1331 log_test.info('All subscribers have joined the channel')
1332 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1333 if self.test_status is True:
1334 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1335 self.test_status = False
1336 else:
1337 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 +00001338 self.test_status = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001339 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1340 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1341 time.sleep(5)
1342 subscriber.recv_timeout = False
1343 self.recv_timeout = False
1344 return self.test_status
1345
1346 def igmp_flow_check_group_exclude_source_empty_list(self, subscriber, multiple_sub = False):
1347 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001348 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1349 self.num_joins += 1
1350 while self.num_joins < self.num_subscribers:
1351 time.sleep(5)
1352 log_test.info('All subscribers have joined the channel')
1353 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1354 if self.test_status is True:
1355 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1356 self.test_status = False
1357 else:
1358 log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port))
1359 self.test_status = True
1360
1361 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1362 log_test.info('Send join to multicast group with exclude empty source list and waited till GMI timer expires')
1363 time.sleep(60)
1364
1365 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1366 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1367 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1368 time.sleep(5)
1369 subscriber.recv_timeout = False
1370 self.recv_timeout = False
1371 return self.test_status
1372
1373 def igmp_flow_check_group_exclude_source_empty_list_1(self, subscriber, multiple_sub = False):
1374 chan = 0
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001375 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list,record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1376 self.num_joins += 1
1377 while self.num_joins < self.num_subscribers:
1378 time.sleep(5)
1379 log_test.info('All subscribers have joined the channel')
1380 for i in range(10):
1381 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1382 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1383 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1384 time.sleep(5)
1385 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1386 #Should not receive packets for this subscriber
1387 self.recv_timeout = True
1388 subscriber.recv_timeout = True
1389 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1390 subscriber.recv_timeout = False
1391 self.recv_timeout = False
1392 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1393 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1394# self.test_status = True
1395 return self.test_status
1396
1397 def igmp_flow_check_during_olt_onu_operational_issues(self, subscriber, multiple_sub = False):
1398 chan = 0
1399 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1400 self.num_joins += 1
1401 while self.num_joins < self.num_subscribers:
1402 time.sleep(5)
1403 log_test.info('All subscribers have joined the channel')
1404 for i in range(2):
1405 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1406 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1407 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1408 time.sleep(5)
1409 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1410 #Should not receive packets for this subscriber
1411 self.recv_timeout = True
1412 subscriber.recv_timeout = True
1413 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1414 subscriber.recv_timeout = False
1415 self.recv_timeout = False
1416 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1417 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1418# self.test_status = True
1419 return self.test_status
1420
Thangavelu K S8e413082017-07-13 20:02:14 +00001421 def voltha_igmp_jump_verify(self, subscriber):
1422 if subscriber.has_service('IGMP'):
1423 for i in xrange(subscriber.num):
1424 log_test.info('Subscriber %s jumping channel' %subscriber.name)
1425 chan = subscriber.channel_jump(delay=0)
1426 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
1427 log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1428 time.sleep(3)
1429 log_test.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats))
1430 self.test_status = True
1431 return self.test_status
1432
1433 def voltha_igmp_next_verify(self, subscriber):
1434 for c in xrange(self.VOLTHA_IGMP_ITERATIONS):
1435 for i in xrange(subscriber.num):
1436 if i:
1437 chan = subscriber.channel_join_next(delay=0, leave_flag = self.leave_flag)
1438 time.sleep(0.2)
1439 else:
1440 chan = subscriber.channel_join(i, delay=0)
1441 time.sleep(0.2)
1442 if subscriber.num == 1:
1443 subscriber.channel_leave(chan)
1444 log_test.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
1445 #subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
1446 #log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1447 self.test_status = True
1448 return self.test_status
1449
1450 def voltha_subscribers(self, services, cbs = None, num_subscribers = 1, num_channels = 1, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +00001451 """Test subscriber join next for channel surfing"""
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001452 voltha = VolthaCtrl(self.VOLTHA_HOST,
1453 rest_port = self.VOLTHA_REST_PORT,
1454 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S36edb012017-07-05 18:24:12 +00001455 if self.VOLTHA_OLT_TYPE.startswith('ponsim'):
1456 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1457 log_test.info('Enabling ponsim olt')
1458 device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001459 if device_id != '':
1460 self.olt_device_id = device_id
Thangavelu K S36edb012017-07-05 18:24:12 +00001461 else:
1462 log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution')
1463 assert_equal(False, True)
1464
1465 assert_not_equal(device_id, None)
1466 if status == False:
1467 voltha.disable_device(device_id, delete = True)
1468 assert_equal(status, True)
1469 time.sleep(10)
1470 switch_map = None
1471 olt_configured = False
1472 try:
1473 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1474 if not switch_map:
1475 log_test.info('No voltha devices found')
1476 return
1477 log_test.info('Installing OLT app')
1478 OnosCtrl.install_app(self.olt_app_file)
1479 time.sleep(5)
1480 log_test.info('Adding subscribers through OLT app')
1481 self.config_olt(switch_map)
1482 olt_configured = True
1483 time.sleep(5)
1484 self.num_subscribers = num_subscribers
1485 self.num_channels = num_channels
1486 test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers,
1487 num_channels = self.num_channels,
1488 cbs = cbs,
1489 port_list = self.generate_port_list(self.num_subscribers,
1490 self.num_channels),
Thangavelu K S8e413082017-07-13 20:02:14 +00001491 src_list = src_list, services = services)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001492 if test_status is False:
1493 self.success = False
Thangavelu K S36edb012017-07-05 18:24:12 +00001494 assert_equal(test_status, True)
1495 finally:
1496 if switch_map is not None:
1497 if olt_configured is True:
1498 self.remove_olt(switch_map)
1499 voltha.disable_device(device_id, delete = True)
1500 time.sleep(10)
1501 log_test.info('Uninstalling OLT app')
1502 OnosCtrl.uninstall_app(self.olt_app_name)
1503
Thangavelu K S8e413082017-07-13 20:02:14 +00001504 def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1,
1505 channel_start = 0, cbs = None, port_list = [], src_list = None,
Thangavelu K S36edb012017-07-05 18:24:12 +00001506 services = None, negative_subscriber_auth = None):
1507 self.test_status = False
1508 self.ovs_cleanup()
1509 subscribers_count = num_subscribers
1510 sub_loop_count = num_subscribers
1511 if not port_list:
1512 port_list = self.generate_port_list(num_subscribers, num_channels)
1513 subscriber_tx_rx_ports = []
1514 for i in range(num_subscribers):
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001515 subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map[port_list[i][0]],
1516 rx_port = self.port_map[port_list[i][1]],
Thangavelu K S8e413082017-07-13 20:02:14 +00001517 num_channels = num_channels,src_list = src_list,))
Thangavelu K S36edb012017-07-05 18:24:12 +00001518 self.onos_aaa_load()
Thangavelu K S8e413082017-07-13 20:02:14 +00001519 #load the ssm list for all subscriber channels
1520 igmpChannel = IgmpChannel(src_list = src_list)
1521 ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports)
1522 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
Thangavelu K S6432b522017-07-22 00:05:54 +00001523 if src_list is None:
1524 igmpChannel = IgmpChannel()
1525 igmpChannel.igmp_load_ssm_config(ssm_list)
1526 else:
1527 igmpChannel = IgmpChannel(src_list = src_list)
1528 igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001529
Thangavelu K S36edb012017-07-05 18:24:12 +00001530 self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1)
1531
1532 chan_leave = False #for single channel, multiple subscribers
1533 if cbs is None:
1534 cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check)
1535 chan_leave = True
1536 for subscriber in subscriber_tx_rx_ports:
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001537 if 'IGMP' in services:
1538# if src_list:
1539# for i in range(len(src_list)):
1540# subscriber.start(src_ip = src_list[i])
1541# else:
1542# subscriber.start()
1543 subscriber.start()
Thangavelu K S36edb012017-07-05 18:24:12 +00001544 sub_loop_count = sub_loop_count - 1
1545 pool_object = voltha_subscriber_pool(subscriber, cbs)
1546 self.thread_pool.addTask(pool_object.pool_cb)
1547 self.thread_pool.cleanUpThreads()
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001548 for subscriber in subscriber_tx_rx_ports:
1549 if services and 'IGMP' in services:
1550# if src_list:
1551# for i in range(len(src_list)):
1552# subscriber.stop(src_ip = src_list[i])
1553# else:
1554# subscriber.stop()
1555 subscriber.stop()
1556 if chan_leave is True:
1557 subscriber.channel_leave(0)
Thangavelu K S36edb012017-07-05 18:24:12 +00001558 subscribers_count = 0
1559 return self.test_status
1560
1561
1562 def generate_port_list(self, subscribers, channels):
1563 return self.port_list[:subscribers]
1564
Thangavelu K S36edb012017-07-05 18:24:12 +00001565 @classmethod
1566 def ovs_cleanup(cls):
1567 ##For every test case, delete all the OVS groups
1568 cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1'
1569 try:
1570 cord_test_shell(cmd)
1571 ##Since olt config is used for this test, we just fire a careless local cmd as well
1572 os.system(cmd)
1573 finally:
1574 return
1575
A.R Karthick8a507cf2017-06-02 18:44:49 -07001576 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -07001577 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -07001578 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
1579 assert_not_equal(device_id, None)
1580 try:
1581 assert_equal(status, True)
1582 time.sleep(10)
1583 finally:
1584 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001585
A.R Karthick8a507cf2017-06-02 18:44:49 -07001586 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001587 log_test.info('Enabling ponsim_olt')
1588 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -07001589 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1590 assert_not_equal(device_id, None)
1591 try:
1592 assert_equal(status, True)
1593 time.sleep(10)
1594 finally:
1595 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001596
Thangavelu K S008f38e2017-05-15 19:36:55 +00001597 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
1598 """
1599 Test Method:
1600 0. Make sure that voltha is up and running on CORD-POD setup.
1601 1. OLT and ONU is detected and validated.
1602 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1603 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
1604 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
1605 5. Verify that subscriber is authenticated successfully.
1606 """
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001607 ret = voltha_setup(
1608 host = self.VOLTHA_HOST,
1609 rest_port = self.VOLTHA_REST_PORT,
1610 olt_type = 'ponsim_olt',
1611 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP,
1612 uplink_vlan_start = self.VOLTHA_UPLINK_VLAN_START,
1613 config_fake = self.VOLTHA_CONFIG_FAKE,
1614 olt_app = self.olt_app_file)
1615 assert_not_equal(ret, None)
1616 voltha, device_id, switch_map = ret[0], ret[1], ret[2]
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001617 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001618 log_test.info('Adding subscribers through OLT app')
1619 self.config_olt(switch_map)
1620 olt_configured = True
1621 time.sleep(5)
1622 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001623 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001624 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001625 if switch_map is not None:
1626 if olt_configured is True:
1627 self.remove_olt(switch_map)
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001628 voltha_teardown(voltha, device_id, switch_map, olt_app = self.olt_app_file)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001629
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001630 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001631 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
1632 """
1633 Test Method:
1634 0. Make sure that voltha is up and running on CORD-POD setup.
1635 1. OLT and ONU is detected and validated.
1636 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1637 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1638 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
1639 5. Verify that subscriber authentication is unsuccessful..
1640 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001641 df = defer.Deferred()
1642 def tls_flow_check_with_no_cert_scenario(df):
1643 log_test.info('Enabling ponsim_olt')
1644 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1645 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1646 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001647 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001648 time.sleep(10)
1649 switch_map = None
1650 olt_configured = False
1651 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1652 log_test.info('Installing OLT app')
1653 OnosCtrl.install_app(self.olt_app_file)
1654 time.sleep(5)
1655 log_test.info('Adding subscribers through OLT app')
1656 self.config_olt(switch_map)
1657 olt_configured = True
1658 time.sleep(5)
1659 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1660 try:
1661 assert_equal(auth_status, True)
1662 assert_equal(status, True)
1663 time.sleep(10)
1664 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001665 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001666 self.voltha.disable_device(device_id, delete = True)
1667 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001668
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001669 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1670 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001671
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001672 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001673 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
1674 """
1675 Test Method:
1676 0. Make sure that voltha is up and running on CORD-POD setup.
1677 1. OLT and ONU is detected and validated.
1678 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1679 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
1680 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1681 5. Verify that subscriber authentication is unsuccessful..
1682 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001683 df = defer.Deferred()
1684 def tls_flow_check_with_invalid_cert_scenario(df):
1685 log_test.info('Enabling ponsim_olt')
1686 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1687 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1688 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001689 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001690 time.sleep(10)
1691 switch_map = None
1692 olt_configured = False
1693 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1694 log_test.info('Installing OLT app')
1695 OnosCtrl.install_app(self.olt_app_file)
1696 time.sleep(5)
1697 log_test.info('Adding subscribers through OLT app')
1698 self.config_olt(switch_map)
1699 olt_configured = True
1700 time.sleep(5)
1701 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1702 try:
1703 assert_equal(auth_status, True)
1704 assert_equal(status, True)
1705 time.sleep(10)
1706 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001707 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001708 self.voltha.disable_device(device_id, delete = True)
1709 df.callback(0)
1710 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
1711 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001712
Thangavelu K S0d745c82017-06-09 21:56:08 +00001713 @deferred(TESTCASE_TIMEOUT)
1714 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
1715 """
1716 Test Method:
1717 0. Make sure that voltha is up and running on CORD-POD setup.
1718 1. OLT and ONU is detected and validated.
1719 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1720 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
1721 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1722 5. Verify that subscriber authentication is unsuccessful..
1723 """
1724 df = defer.Deferred()
1725 def tls_flow_check_with_no_cert_scenario(df):
1726 log_test.info('Enabling ponsim_olt')
1727 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1728 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1729 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001730 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001731 time.sleep(10)
1732 switch_map = None
1733 olt_configured = False
1734 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1735 log_test.info('Installing OLT app')
1736 OnosCtrl.install_app(self.olt_app_file)
1737 time.sleep(5)
1738 log_test.info('Adding subscribers through OLT app')
1739 self.config_olt(switch_map)
1740 olt_configured = True
1741 time.sleep(5)
1742 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1743 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1744 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1745 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1746 try:
1747 assert_equal(auth_status, True)
1748 assert_equal(status, True)
1749 time.sleep(10)
1750 finally:
1751 self.voltha.disable_device(device_id, delete = True)
1752 df.callback(0)
1753 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1754 return df
1755
1756 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001757 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
1758 """
1759 Test Method:
1760 0. Make sure that voltha is up and running on CORD-POD setup.
1761 1. OLT and ONU is detected and validated.
1762 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1763 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1764 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
1765 5. Verify that subscriber authentication is unsuccessful..
1766 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001767 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001768 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001769 aaa_app = ["org.opencord.aaa"]
1770 log_test.info('Enabling ponsim_olt')
1771 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1772 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1773 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001774 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001775 time.sleep(10)
1776 switch_map = None
1777 olt_configured = False
1778 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1779 log_test.info('Installing OLT app')
1780 OnosCtrl.install_app(self.olt_app_file)
1781 time.sleep(5)
1782 log_test.info('Adding subscribers through OLT app')
1783 self.config_olt(switch_map)
1784 olt_configured = True
1785 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001786
Thangavelu K S0d745c82017-06-09 21:56:08 +00001787 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
1788 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
1789 thread1.start()
1790 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001791 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001792 thread2.start()
1793 time.sleep(10)
1794 thread1.join()
1795 thread2.join()
1796 try:
1797 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001798 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001799 time.sleep(10)
1800 finally:
1801 self.voltha.disable_device(device_id, delete = True)
1802 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001803 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001804 return df
1805
1806 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001807 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
1808 """
1809 Test Method:
1810 0. Make sure that voltha is up and running on CORD-POD setup.
1811 1. OLT and ONU is detected and validated.
1812 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1813 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1814 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
1815 5. Verify that subscriber authentication is unsuccessful..
1816 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001817 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001818 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001819 aaa_app = ["org.opencord.aaa"]
1820 log_test.info('Enabling ponsim_olt')
1821 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1822 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1823 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001824 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001825 time.sleep(10)
1826 switch_map = None
1827 olt_configured = False
1828 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1829 log_test.info('Installing OLT app')
1830 OnosCtrl.install_app(self.olt_app_file)
1831 time.sleep(5)
1832 log_test.info('Adding subscribers through OLT app')
1833 self.config_olt(switch_map)
1834 olt_configured = True
1835 time.sleep(5)
1836
1837 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
1838 thread2 = threading.Thread(target = cord_test_radius_restart)
1839 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001840 time.sleep(randint(1,2))
1841 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001842 thread2.start()
1843 time.sleep(10)
1844 thread1.join()
1845 thread2.join()
1846 try:
1847 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001848 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001849 time.sleep(10)
1850 finally:
1851 self.voltha.disable_device(device_id, delete = True)
1852 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001853 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001854 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001855
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001856 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001857 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
1858 """
1859 Test Method:
1860 0. Make sure that voltha is up and running on CORD-POD setup.
1861 1. OLT and ONU is detected and validated.
1862 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1863 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1864 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1865 6. Verify that subscriber authenticated successfully.
1866 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
1867 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1868 9. Verify that subscriber authentication is unsuccessful..
1869 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001870 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001871 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001872 aaa_app = ["org.opencord.aaa"]
1873 log_test.info('Enabling ponsim_olt')
1874 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1875 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1876 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001877 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001878 time.sleep(10)
1879 switch_map = None
1880 olt_configured = False
1881 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1882 log_test.info('Installing OLT app')
1883 OnosCtrl.install_app(self.olt_app_file)
1884 time.sleep(5)
1885 log_test.info('Adding subscribers through OLT app')
1886 self.config_olt(switch_map)
1887 olt_configured = True
1888 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001889
Thangavelu K S0d745c82017-06-09 21:56:08 +00001890 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001891 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +00001892 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001893 time.sleep(randint(1,2))
1894 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001895 thread2.start()
1896 time.sleep(10)
1897 thread1.join()
1898 thread2.join()
1899 try:
1900 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001901 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001902 time.sleep(10)
1903 finally:
1904 self.voltha.disable_device(device_id, delete = True)
1905 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001906 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001907 return df
1908
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001909 @deferred(TESTCASE_TIMEOUT)
1910 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001911 """
1912 Test Method:
1913 0. Make sure that voltha is up and running on CORD-POD setup.
1914 1. OLT and ONU is detected and validated.
1915 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1916 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1917 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1918 6. Verify that subscriber authenticated successfully.
1919 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1920 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1921 9. Verify that subscriber authentication is unsuccessful..
1922 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001923 df = defer.Deferred()
1924 def tls_flow_check_operating_olt_state(df):
1925 aaa_app = ["org.opencord.aaa"]
1926 log_test.info('Enabling ponsim_olt')
1927 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1928 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1929 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001930 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001931 time.sleep(10)
1932 switch_map = None
1933 olt_configured = False
1934 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1935 log_test.info('Installing OLT app')
1936 OnosCtrl.install_app(self.olt_app_file)
1937 time.sleep(5)
1938 log_test.info('Adding subscribers through OLT app')
1939 self.config_olt(switch_map)
1940 olt_configured = True
1941 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001942
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001943 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1944 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
1945 thread1.start()
1946 time.sleep(randint(1,2))
1947 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1948 thread2.start()
1949 time.sleep(10)
1950 thread1.join()
1951 thread2.join()
1952 try:
1953 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001954 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001955 time.sleep(10)
1956 finally:
1957 self.voltha.disable_device(device_id, delete = True)
1958 df.callback(0)
1959 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1960 return df
1961
1962 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001963 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self):
1964 """
1965 Test Method:
1966 0. Make sure that voltha is up and running on CORD-POD setup.
1967 1. OLT and ONU is detected and validated.
1968 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1969 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1970 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1971 6. Verify that subscriber authenticated successfully.
1972 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1973 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1974 9. Verify that subscriber authentication is unsuccessful..
1975 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1976
1977 """
1978 df = defer.Deferred()
1979 no_iterations = 10
1980 def tls_flow_check_with_disable_olt_device_scenario(df):
1981 aaa_app = ["org.opencord.aaa"]
1982 log_test.info('Enabling ponsim_olt')
1983 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1984 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1985 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001986 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001987 time.sleep(10)
1988 switch_map = None
1989 olt_configured = False
1990 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1991 log_test.info('Installing OLT app')
1992 OnosCtrl.install_app(self.olt_app_file)
1993 time.sleep(5)
1994 log_test.info('Adding subscribers through OLT app')
1995 self.config_olt(switch_map)
1996 olt_configured = True
1997 time.sleep(5)
1998 for i in range(no_iterations):
1999 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
2000 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
2001 thread1.start()
2002 time.sleep(randint(1,2))
2003 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
2004 thread2.start()
2005 time.sleep(10)
2006 thread1.join()
2007 thread2.join()
2008 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2009 try:
2010 # assert_equal(status, True)
2011 assert_equal(auth_status, True)
2012 assert_equal(self.success, True)
2013 time.sleep(10)
2014 finally:
2015 self.voltha.disable_device(device_id, delete = True)
2016 df.callback(0)
2017 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2018 return df
2019
2020 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002021 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
2022 """
2023 Test Method:
2024 0. Make sure that voltha is up and running on CORD-POD setup.
2025 1. OLT and ONU is detected and validated.
2026 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2027 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2028 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2029 6. Verify that subscriber authenticated successfully.
2030 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2031 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2032 9. Verify that subscriber authentication is unsuccessful..
2033 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002034 df = defer.Deferred()
2035 def tls_flow_check_operating_olt_state(df):
2036 aaa_app = ["org.opencord.aaa"]
2037 log_test.info('Enabling ponsim_olt')
2038 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2039 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2040 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002041 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002042 time.sleep(10)
2043 switch_map = None
2044 olt_configured = False
2045 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2046 log_test.info('Installing OLT app')
2047 OnosCtrl.install_app(self.olt_app_file)
2048 time.sleep(5)
2049 log_test.info('Adding subscribers through OLT app')
2050 self.config_olt(switch_map)
2051 olt_configured = True
2052 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002053
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002054 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2055 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2056 thread1.start()
2057 time.sleep(randint(1,2))
2058 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2059 thread2.start()
2060 time.sleep(10)
2061 thread1.join()
2062 thread2.join()
2063 try:
2064 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002065 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002066 time.sleep(10)
2067 finally:
2068 self.voltha.disable_device(device_id, delete = True)
2069 df.callback(0)
2070 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2071 return df
2072
2073 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002074 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self):
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002075 """
2076 Test Method:
2077 0. Make sure that voltha is up and running on CORD-POD setup.
2078 1. OLT and ONU is detected and validated.
2079 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2080 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2081 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2082 6. Verify that subscriber authenticated successfully.
2083 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2084 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2085 9. Verify that subscriber authentication is unsuccessful..
2086 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2087 """
2088 df = defer.Deferred()
2089 no_iterations = 10
2090 def tls_flow_check_with_disable_olt_device_scenario(df):
2091 aaa_app = ["org.opencord.aaa"]
2092 log_test.info('Enabling ponsim_olt')
2093 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2094 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2095 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002096 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002097 time.sleep(10)
2098 switch_map = None
2099 olt_configured = False
2100 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2101 log_test.info('Installing OLT app')
2102 OnosCtrl.install_app(self.olt_app_file)
2103 time.sleep(5)
2104 log_test.info('Adding subscribers through OLT app')
2105 self.config_olt(switch_map)
2106 olt_configured = True
2107 time.sleep(5)
2108 for i in range(no_iterations):
2109 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2110 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2111 thread1.start()
2112 time.sleep(randint(1,2))
2113 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2114 thread2.start()
2115 time.sleep(10)
2116 thread1.join()
2117 thread2.join()
2118 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2119 try:
2120 # assert_equal(status, True)
2121 assert_equal(auth_status, True)
2122 assert_equal(self.success, True)
2123 time.sleep(10)
2124 finally:
2125 self.voltha.disable_device(device_id, delete = True)
2126 df.callback(0)
2127 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2128 return df
2129
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002130 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002131 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
2132 """
2133 Test Method:
2134 0. Make sure that voltha is up and running on CORD-POD setup.
2135 1. OLT and ONU is detected and validated.
2136 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2137 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2138 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2139 6. Verify that subscriber authenticated successfully.
2140 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2141 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2142 9. Verify that subscriber authentication is unsuccessful..
2143 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002144 df = defer.Deferred()
2145 def tls_flow_check_operating_olt_state(df):
2146 aaa_app = ["org.opencord.aaa"]
2147 log_test.info('Enabling ponsim_olt')
2148 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2149 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2150 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00002151 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2152
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002153 onu_device_id = devices_list['items'][1]['id']
2154 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002155 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002156 time.sleep(10)
2157 switch_map = None
2158 olt_configured = False
2159 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2160 log_test.info('Installing OLT app')
2161 OnosCtrl.install_app(self.olt_app_file)
2162 time.sleep(5)
2163 log_test.info('Adding subscribers through OLT app')
2164 self.config_olt(switch_map)
2165 olt_configured = True
2166 time.sleep(5)
2167 devices_list = self.voltha.get_devices()
2168 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2169 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2170 thread1.start()
2171 time.sleep(randint(1,2))
2172 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2173 thread2.start()
2174 time.sleep(10)
2175 thread1.join()
2176 thread2.join()
2177 try:
2178 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002179 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002180 time.sleep(10)
2181 finally:
2182 self.voltha.disable_device(device_id, delete = True)
2183 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002184 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002185 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002186
Thangavelu K S9648eed2017-06-13 20:15:25 +00002187 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002188 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
2189 """
2190 Test Method:
2191 0. Make sure that voltha is up and running on CORD-POD setup.
2192 1. OLT and ONU is detected and validated.
2193 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2194 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2195 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2196 6. Verify that subscriber authenticated successfully.
2197 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2198 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2199 9. Verify that subscriber authentication is unsuccessful..
2200 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2201 """
2202 df = defer.Deferred()
2203 no_iterations = 10
2204 def tls_flow_check_operating_olt_state(df):
2205 aaa_app = ["org.opencord.aaa"]
2206 log_test.info('Enabling ponsim_olt')
2207 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2208 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2209 devices_list = self.voltha.get_devices()
2210 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2211
2212 onu_device_id = devices_list['items'][1]['id']
2213 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002214 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002215 time.sleep(10)
2216 switch_map = None
2217 olt_configured = False
2218 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2219 log_test.info('Installing OLT app')
2220 OnosCtrl.install_app(self.olt_app_file)
2221 time.sleep(5)
2222 log_test.info('Adding subscribers through OLT app')
2223 self.config_olt(switch_map)
2224 olt_configured = True
2225 time.sleep(5)
2226 devices_list = self.voltha.get_devices()
2227 for i in range(no_iterations):
2228 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2229 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2230 thread1.start()
2231 time.sleep(randint(1,2))
2232 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2233 thread2.start()
2234 time.sleep(10)
2235 thread1.join()
2236 thread2.join()
2237 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2238 try:
2239 # assert_equal(status, True)
2240 assert_equal(auth_status, True)
2241 assert_equal(self.success, True)
2242 time.sleep(10)
2243 finally:
2244 self.voltha.disable_device(device_id, delete = True)
2245 df.callback(0)
2246 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2247 return df
2248
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002249 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002250 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002251 """
2252 Test Method:
2253 0. Make sure that voltha is up and running on CORD-POD setup.
2254 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2255 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2256 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2257 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
2258 5. Verify that two subscribers are authenticated successfully.
2259 """
2260
Thangavelu K S9648eed2017-06-13 20:15:25 +00002261 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002262 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002263 aaa_app = ["org.opencord.aaa"]
2264 log_test.info('Enabling ponsim_olt')
2265 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2266 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2267 devices_list = self.voltha.get_devices()
2268 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2269
2270 onu_device_id = devices_list['items'][1]['id']
2271 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002272 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002273 time.sleep(10)
2274 switch_map = None
2275 olt_configured = False
2276 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2277 log_test.info('Installing OLT app')
2278 OnosCtrl.install_app(self.olt_app_file)
2279 time.sleep(5)
2280 log_test.info('Adding subscribers through OLT app')
2281 self.config_olt(switch_map)
2282 olt_configured = True
2283 time.sleep(5)
2284 devices_list = self.voltha.get_devices()
2285 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2286 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2287 thread1.start()
2288 time.sleep(randint(1,2))
2289 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2290 thread2.start()
2291 time.sleep(10)
2292 thread1.join()
2293 thread2.join()
2294 try:
2295 # assert_equal(status, True)
2296 assert_equal(self.success, True)
2297 time.sleep(10)
2298 finally:
2299 self.voltha.disable_device(device_id, delete = True)
2300 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002301 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002302 return df
2303
2304 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002305 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002306 """
2307 Test Method:
2308 0. Make sure that voltha is up and running on CORD-POD setup.
2309 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2310 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2311 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2312 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
2313 5. Verify that two subscribers are not authenticated.
2314 """
2315
Thangavelu K S9648eed2017-06-13 20:15:25 +00002316 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002317 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002318 aaa_app = ["org.opencord.aaa"]
2319 log_test.info('Enabling ponsim_olt')
2320 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2321 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2322 devices_list = self.voltha.get_devices()
2323 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2324
2325 onu_device_id = devices_list['items'][1]['id']
2326 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002327 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002328 time.sleep(10)
2329 switch_map = None
2330 olt_configured = False
2331 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2332 log_test.info('Installing OLT app')
2333 OnosCtrl.install_app(self.olt_app_file)
2334 time.sleep(5)
2335 log_test.info('Adding subscribers through OLT app')
2336 self.config_olt(switch_map)
2337 olt_configured = True
2338 time.sleep(5)
2339 devices_list = self.voltha.get_devices()
2340 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2341 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
2342 thread1.start()
2343 time.sleep(randint(1,2))
2344 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2345 thread2.start()
2346 time.sleep(10)
2347 thread1.join()
2348 thread2.join()
2349 try:
2350 # assert_equal(status, True)
2351 assert_equal(self.success, True)
2352 time.sleep(10)
2353 finally:
2354 self.voltha.disable_device(device_id, delete = True)
2355 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002356 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002357 return df
2358
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002359 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002360 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 +00002361 """
2362 Test Method:
2363 0. Make sure that voltha is up and running on CORD-POD setup.
2364 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2365 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2366 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2367 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2368 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
2369 6. Verify that valid subscriber authenticated successfully.
2370 7. Verify that invalid subscriber are not authenticated successfully.
2371 """
2372
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002373 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002374 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002375 aaa_app = ["org.opencord.aaa"]
2376 log_test.info('Enabling ponsim_olt')
2377 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2378 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2379 devices_list = self.voltha.get_devices()
2380 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2381
2382 onu_device_id = devices_list['items'][1]['id']
2383 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002384 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002385 time.sleep(10)
2386 switch_map = None
2387 olt_configured = False
2388 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2389 log_test.info('Installing OLT app')
2390 OnosCtrl.install_app(self.olt_app_file)
2391 time.sleep(5)
2392 log_test.info('Adding subscribers through OLT app')
2393 self.config_olt(switch_map)
2394 olt_configured = True
2395 time.sleep(5)
2396 devices_list = self.voltha.get_devices()
2397 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2398 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
2399 thread1.start()
2400 time.sleep(randint(1,2))
2401 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2402 thread2.start()
2403 time.sleep(10)
2404 thread1.join()
2405 thread2.join()
2406 try:
2407 # assert_equal(status, True)
2408 assert_equal(self.success, True)
2409 time.sleep(10)
2410 finally:
2411 self.voltha.disable_device(device_id, delete = True)
2412 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002413 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002414 return df
2415
2416 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002417 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 +00002418 """
2419 Test Method:
2420 0. Make sure that voltha is up and running on CORD-POD setup.
2421 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2422 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2423 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2424 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2425 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
2426 6. Verify that valid subscriber authenticated successfully.
2427 7. Verify that invalid subscriber are not authenticated successfully.
2428 """
2429
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002430 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002431 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002432 aaa_app = ["org.opencord.aaa"]
2433 log_test.info('Enabling ponsim_olt')
2434 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2435 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2436 devices_list = self.voltha.get_devices()
2437 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2438
2439 onu_device_id = devices_list['items'][1]['id']
2440 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002441 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002442 time.sleep(10)
2443 switch_map = None
2444 olt_configured = False
2445 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2446 log_test.info('Installing OLT app')
2447 OnosCtrl.install_app(self.olt_app_file)
2448 time.sleep(5)
2449 log_test.info('Adding subscribers through OLT app')
2450 self.config_olt(switch_map)
2451 olt_configured = True
2452 time.sleep(5)
2453 devices_list = self.voltha.get_devices()
2454 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2455 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
2456 thread1.start()
2457 time.sleep(randint(1,2))
2458 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2459 thread2.start()
2460 time.sleep(10)
2461 thread1.join()
2462 thread2.join()
2463 try:
2464 # assert_equal(status, True)
2465 assert_equal(self.success, True)
2466 time.sleep(10)
2467 finally:
2468 self.voltha.disable_device(device_id, delete = True)
2469 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002470 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002471 return df
2472
2473 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002474 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002475 """
2476 Test Method:
2477 0. Make sure that voltha is up and running on CORD-POD setup.
2478 1. OLT and ONU is detected and validated.
2479 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2480 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2481 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
2482 6. Verify that subscriber authenticated successfully.
2483 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
2484 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
2485 9. Verify that subscriber authentication is unsuccessful..
2486 10. Verify that other subscriber authenticated successfully.
2487 """
2488
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002489 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002490 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002491 aaa_app = ["org.opencord.aaa"]
2492 log_test.info('Enabling ponsim_olt')
2493 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2494 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2495 devices_list = self.voltha.get_devices()
2496 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2497
2498 onu_device_id = devices_list['items'][1]['id']
2499 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002500 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002501 time.sleep(10)
2502 switch_map = None
2503 olt_configured = False
2504 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2505 log_test.info('Installing OLT app')
2506 OnosCtrl.install_app(self.olt_app_file)
2507 time.sleep(5)
2508 log_test.info('Adding subscribers through OLT app')
2509 self.config_olt(switch_map)
2510 olt_configured = True
2511 time.sleep(5)
2512 devices_list = self.voltha.get_devices()
2513 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2514 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
2515 thread1.start()
2516 time.sleep(randint(1,2))
2517 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2518 thread2.start()
2519 time.sleep(10)
2520 thread1.join()
2521 thread2.join()
2522 try:
2523 # assert_equal(status, True)
2524 assert_equal(self.success, True)
2525 time.sleep(10)
2526 finally:
2527 self.voltha.disable_device(device_id, delete = True)
2528 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002529 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002530 return df
2531
Thangavelu K S36edb012017-07-05 18:24:12 +00002532 def test_3_subscribers_with_voltha_for_eap_tls_authentication(self):
2533 """
2534 Test Method:
2535 0. Make sure that voltha is up and running on CORD-POD setup.
2536 1. OLT and ONU is detected and validated.
2537 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2538 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers)
2539 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2540 5. Verify that subscriber is authenticated successfully.
2541 """
2542 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2543 num_subscribers = 3
2544 num_channels = 1
2545 services = ('TLS')
2546 cbs = (self.tls_flow_check, None, None)
2547 self.voltha_subscribers(services, cbs = cbs,
2548 num_subscribers = num_subscribers,
2549 num_channels = num_channels)
2550
2551 def test_5_subscribers_with_voltha_for_eap_tls_authentication(self):
2552 """
2553 Test Method:
2554 0. Make sure that voltha is up and running on CORD-POD setup.
2555 1. OLT and ONU is detected and validated.
2556 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2557 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber)
2558 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2559 5. Verify that subscriber is authenticated successfully.
2560 """
2561 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2562 num_subscribers = 5
2563 num_channels = 1
2564 services = ('TLS')
2565 cbs = (self.tls_flow_check, None, None)
2566 self.voltha_subscribers(services, cbs = cbs,
2567 num_subscribers = num_subscribers,
2568 num_channels = num_channels)
2569
2570 def test_9_subscribers_with_voltha_for_eap_tls_authentication(self):
2571 """
2572 Test Method:
2573 0. Make sure that voltha is up and running on CORD-POD setup.
2574 1. OLT and ONU is detected and validated.
2575 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2576 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber)
2577 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2578 5. Verify that subscriber is authenticated successfully.
2579 """
2580 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2581 num_subscribers = 9
2582 num_channels = 1
2583 services = ('TLS')
2584 cbs = (self.tls_flow_check, None, None)
2585 self.voltha_subscribers(services, cbs = cbs,
2586 num_subscribers = num_subscribers,
2587 num_channels = num_channels)
2588
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002589 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002590 def test_subscriber_with_voltha_for_dhcp_request(self):
2591 """
2592 Test Method:
2593 0. Make sure that voltha is up and running on CORD-POD setup.
2594 1. OLT and ONU is detected and validated.
2595 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2596 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2597 4. Verify that subscriber get ip from dhcp server successfully.
2598 """
2599
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002600 df = defer.Deferred()
2601 def dhcp_flow_check_scenario(df):
2602 log_test.info('Enabling ponsim_olt')
2603 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2604 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2605 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002606 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002607 time.sleep(10)
2608 switch_map = None
2609 olt_configured = False
2610 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2611 log_test.info('Installing OLT app')
2612 OnosCtrl.install_app(self.olt_app_file)
2613 time.sleep(5)
2614 log_test.info('Adding subscribers through OLT app')
2615 self.config_olt(switch_map)
2616 olt_configured = True
2617 time.sleep(5)
2618 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2619 try:
2620 assert_equal(dhcp_status, True)
2621 #assert_equal(status, True)
2622 time.sleep(10)
2623 finally:
2624 self.remove_olt(switch_map)
2625 self.voltha.disable_device(device_id, delete = True)
2626 df.callback(0)
2627
2628 reactor.callLater(0, dhcp_flow_check_scenario, df)
2629 return df
2630
2631 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002632 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
2633 """
2634 Test Method:
2635 0. Make sure that voltha is up and running on CORD-POD setup.
2636 1. OLT and ONU is detected and validated.
2637 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2638 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
2639 4. Verify that subscriber should not get ip from dhcp server.
2640 """
2641
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002642 df = defer.Deferred()
2643 def dhcp_flow_check_scenario(df):
2644 log_test.info('Enabling ponsim_olt')
2645 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2646 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2647 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002648 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002649 time.sleep(10)
2650 switch_map = None
2651 olt_configured = False
2652 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2653 log_test.info('Installing OLT app')
2654 OnosCtrl.install_app(self.olt_app_file)
2655 time.sleep(5)
2656 log_test.info('Adding subscribers through OLT app')
2657 self.config_olt(switch_map)
2658 olt_configured = True
2659 time.sleep(5)
2660 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
2661 try:
2662 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002663 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002664 #assert_equal(status, True)
2665 time.sleep(10)
2666 finally:
2667 self.voltha.disable_device(device_id, delete = True)
2668 self.remove_olt(switch_map)
2669 df.callback(0)
2670
2671 reactor.callLater(0, dhcp_flow_check_scenario, df)
2672 return df
2673
2674
2675 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002676 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
2677 """
2678 Test Method:
2679 0. Make sure that voltha is up and running on CORD-POD setup.
2680 1. OLT and ONU is detected and validated.
2681 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2682 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
2683 4. Verify that subscriber should not get ip from dhcp server.
2684 """
2685
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002686 df = defer.Deferred()
2687 def dhcp_flow_check_scenario(df):
2688 log_test.info('Enabling ponsim_olt')
2689 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2690 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2691 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002692 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002693 time.sleep(10)
2694 switch_map = None
2695 olt_configured = False
2696 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2697 log_test.info('Installing OLT app')
2698 OnosCtrl.install_app(self.olt_app_file)
2699 time.sleep(5)
2700 log_test.info('Adding subscribers through OLT app')
2701 self.config_olt(switch_map)
2702 olt_configured = True
2703 time.sleep(5)
2704 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
2705 try:
2706 assert_equal(dhcp_status, True)
2707 #assert_equal(status, True)
2708 time.sleep(10)
2709 finally:
2710 self.voltha.disable_device(device_id, delete = True)
2711 self.remove_olt(switch_map)
2712 df.callback(0)
2713
2714 reactor.callLater(0, dhcp_flow_check_scenario, df)
2715 return df
2716
2717 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002718 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
2719 """
2720 Test Method:
2721 0. Make sure that voltha is up and running on CORD-POD setup.
2722 1. OLT and ONU is detected and validated.
2723 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2724 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
2725 4. Verify that subscriber should not get ip from dhcp server.
2726 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002727 df = defer.Deferred()
2728 def dhcp_flow_check_scenario(df):
2729 log_test.info('Enabling ponsim_olt')
2730 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2731 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2732 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002733 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002734 time.sleep(10)
2735 switch_map = None
2736 olt_configured = False
2737 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2738 log_test.info('Installing OLT app')
2739 OnosCtrl.install_app(self.olt_app_file)
2740 time.sleep(5)
2741 log_test.info('Adding subscribers through OLT app')
2742 self.config_olt(switch_map)
2743 olt_configured = True
2744 time.sleep(5)
2745 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
2746 try:
2747 assert_equal(dhcp_status, True)
2748 #assert_equal(status, True)
2749 time.sleep(10)
2750 finally:
2751 self.voltha.disable_device(device_id, delete = True)
2752 self.remove_olt(switch_map)
2753 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002754
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002755 reactor.callLater(0, dhcp_flow_check_scenario, df)
2756 return df
2757
2758 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002759 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
2760 """
2761 Test Method:
2762 0. Make sure that voltha is up and running on CORD-POD setup.
2763 1. OLT and ONU is detected and validated.
2764 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2765 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2766 4. Verify that subscriber get ip from dhcp server successfully.
2767 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
2768 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
2769 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002770 df = defer.Deferred()
2771 def dhcp_flow_check_scenario(df):
2772 log_test.info('Enabling ponsim_olt')
2773 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2774 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2775 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002776 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002777 time.sleep(10)
2778 switch_map = None
2779 olt_configured = False
2780 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2781 log_test.info('Installing OLT app')
2782 OnosCtrl.install_app(self.olt_app_file)
2783 time.sleep(5)
2784 log_test.info('Adding subscribers through OLT app')
2785 self.config_olt(switch_map)
2786 olt_configured = True
2787 time.sleep(5)
2788 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
2789 try:
2790 assert_equal(dhcp_status, True)
2791 #assert_equal(status, True)
2792 time.sleep(10)
2793 finally:
2794 self.voltha.disable_device(device_id, delete = True)
2795 self.remove_olt(switch_map)
2796 df.callback(0)
2797
2798 reactor.callLater(0, dhcp_flow_check_scenario, df)
2799 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002800
Thangavelu K S735a6662017-06-15 18:08:23 +00002801
2802 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07002803 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002804 """
2805 Test Method:
2806 0. Make sure that voltha is up and running on CORD-POD setup.
2807 1. OLT and ONU is detected and validated.
2808 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2809 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2810 4. Verify that subscriber get ip from dhcp server successfully.
2811 5. Repeat step 3 and 4 for 10 times.
2812 6 Verify that subscriber should get ip from dhcp server.
2813 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002814 df = defer.Deferred()
2815 def dhcp_flow_check_scenario(df):
2816 log_test.info('Enabling ponsim_olt')
2817 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2818 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2819 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002820 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002821 time.sleep(10)
2822 switch_map = None
2823 olt_configured = False
2824 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2825 log_test.info('Installing OLT app')
2826 OnosCtrl.install_app(self.olt_app_file)
2827 time.sleep(5)
2828 log_test.info('Adding subscribers through OLT app')
2829 self.config_olt(switch_map)
2830 olt_configured = True
2831 time.sleep(5)
2832 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
2833 try:
2834 assert_equal(dhcp_status, True)
2835 #assert_equal(status, True)
2836 time.sleep(10)
2837 finally:
2838 self.voltha.disable_device(device_id, delete = True)
2839 self.remove_olt(switch_map)
2840 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002841
Thangavelu K S735a6662017-06-15 18:08:23 +00002842 reactor.callLater(0, dhcp_flow_check_scenario, df)
2843 return df
2844
Thangavelu K S735a6662017-06-15 18:08:23 +00002845 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002846 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
2847 """
2848 Test Method:
2849 0. Make sure that voltha is up and running on CORD-POD setup.
2850 1. OLT and ONU is detected and validated.
2851 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2852 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
2853 4. Verify that subscriber should not get ip from dhcp server.
2854 5. Repeat steps 3 and 4 for 10 times.
2855 6 Verify that subscriber should not get ip from dhcp server.
2856 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002857 df = defer.Deferred()
2858 def dhcp_flow_check_scenario(df):
2859 log_test.info('Enabling ponsim_olt')
2860 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2861 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2862 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002863 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002864 time.sleep(10)
2865 switch_map = None
2866 olt_configured = False
2867 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2868 log_test.info('Installing OLT app')
2869 OnosCtrl.install_app(self.olt_app_file)
2870 time.sleep(5)
2871 log_test.info('Adding subscribers through OLT app')
2872 self.config_olt(switch_map)
2873 olt_configured = True
2874 time.sleep(5)
2875 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
2876 try:
2877 assert_equal(dhcp_status, True)
2878 #assert_equal(status, True)
2879 time.sleep(10)
2880 finally:
2881 self.voltha.disable_device(device_id, delete = True)
2882 self.remove_olt(switch_map)
2883 df.callback(0)
2884
2885 reactor.callLater(0, dhcp_flow_check_scenario, df)
2886 return df
2887
Thangavelu K S735a6662017-06-15 18:08:23 +00002888 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002889 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
2890 """
2891 Test Method:
2892 0. Make sure that voltha is up and running on CORD-POD setup.
2893 1. OLT and ONU is detected and validated.
2894 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2895 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2896 4. Verify that subscriber get ip from dhcp server successfully.
2897 5. Repeat step 3 for 50 times.
2898 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2899 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002900 df = defer.Deferred()
2901 def dhcp_flow_check_scenario(df):
2902 log_test.info('Enabling ponsim_olt')
2903 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2904 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2905 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002906 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002907 time.sleep(10)
2908 switch_map = None
2909 olt_configured = False
2910 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2911 log_test.info('Installing OLT app')
2912 OnosCtrl.install_app(self.olt_app_file)
2913 time.sleep(5)
2914 log_test.info('Adding subscribers through OLT app')
2915 self.config_olt(switch_map)
2916 olt_configured = True
2917 time.sleep(5)
2918 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
2919 try:
2920 assert_equal(dhcp_status, True)
2921 #assert_equal(status, True)
2922 time.sleep(10)
2923 finally:
2924 self.voltha.disable_device(device_id, delete = True)
2925 self.remove_olt(switch_map)
2926 df.callback(0)
2927
2928 reactor.callLater(0, dhcp_flow_check_scenario, df)
2929 return df
2930
Thangavelu K S735a6662017-06-15 18:08:23 +00002931 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002932 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
2933 """
2934 Test Method:
2935 0. Make sure that voltha is up and running on CORD-POD setup.
2936 1. OLT and ONU is detected and validated.
2937 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2938 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2939 4. Verify that subscriber get ip from dhcp server successfully.
2940 5. Send DHCP request to dhcp server which is running as onos app.
2941 6. Repeat step 5 for 50 times.
2942 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2943 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002944 df = defer.Deferred()
2945 def dhcp_flow_check_scenario(df):
2946 log_test.info('Enabling ponsim_olt')
2947 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2948 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2949 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002950 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002951 time.sleep(10)
2952 switch_map = None
2953 olt_configured = False
2954 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2955 log_test.info('Installing OLT app')
2956 OnosCtrl.install_app(self.olt_app_file)
2957 time.sleep(5)
2958 log_test.info('Adding subscribers through OLT app')
2959 self.config_olt(switch_map)
2960 olt_configured = True
2961 time.sleep(5)
2962 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
2963 try:
2964 assert_equal(dhcp_status, True)
2965 #assert_equal(status, True)
2966 time.sleep(10)
2967 finally:
2968 self.voltha.disable_device(device_id, delete = True)
2969 self.remove_olt(switch_map)
2970 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002971
Thangavelu K S735a6662017-06-15 18:08:23 +00002972 reactor.callLater(0, dhcp_flow_check_scenario, df)
2973 return df
2974
Thangavelu K S735a6662017-06-15 18:08:23 +00002975 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002976 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
2977 """
2978 Test Method:
2979 0. Make sure that voltha is up and running on CORD-POD setup.
2980 1. OLT and ONU is detected and validated.
2981 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2982 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
2983 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
2984 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002985 df = defer.Deferred()
2986 def dhcp_flow_check_scenario(df):
2987 log_test.info('Enabling ponsim_olt')
2988 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2989 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2990 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002991 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002992 time.sleep(10)
2993 switch_map = None
2994 olt_configured = False
2995 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2996 log_test.info('Installing OLT app')
2997 OnosCtrl.install_app(self.olt_app_file)
2998 time.sleep(5)
2999 log_test.info('Adding subscribers through OLT app')
3000 self.config_olt(switch_map)
3001 olt_configured = True
3002 time.sleep(5)
3003 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
3004 try:
3005 assert_equal(dhcp_status, True)
3006 #assert_equal(status, True)
3007 time.sleep(10)
3008 finally:
3009 self.voltha.disable_device(device_id, delete = True)
3010 self.remove_olt(switch_map)
3011 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003012
Thangavelu K S735a6662017-06-15 18:08:23 +00003013 reactor.callLater(0, dhcp_flow_check_scenario, df)
3014 return df
3015
3016 @deferred(TESTCASE_TIMEOUT)
3017 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003018 """
3019 Test Method:
3020 0. Make sure that voltha is up and running on CORD-POD setup.
3021 1. OLT and ONU is detected and validated.
3022 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3023 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
3024 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.
3025 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003026 df = defer.Deferred()
3027 def dhcp_flow_check_scenario(df):
3028 log_test.info('Enabling ponsim_olt')
3029 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3030 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3031 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003032 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003033 time.sleep(10)
3034 switch_map = None
3035 olt_configured = False
3036 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3037 log_test.info('Installing OLT app')
3038 OnosCtrl.install_app(self.olt_app_file)
3039 time.sleep(5)
3040 log_test.info('Adding subscribers through OLT app')
3041 self.config_olt(switch_map)
3042 olt_configured = True
3043 time.sleep(5)
3044 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
3045 try:
3046 assert_equal(dhcp_status, True)
3047 #assert_equal(status, True)
3048 time.sleep(10)
3049 finally:
3050 self.voltha.disable_device(device_id, delete = True)
3051 self.remove_olt(switch_map)
3052 df.callback(0)
3053
3054 reactor.callLater(0, dhcp_flow_check_scenario, df)
3055 return df
3056
Thangavelu K S735a6662017-06-15 18:08:23 +00003057 @deferred(TESTCASE_TIMEOUT)
3058 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003059 """
3060 Test Method:
3061 0. Make sure that voltha is up and running on CORD-POD setup.
3062 1. OLT and ONU is detected and validated.
3063 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3064 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3065 4. Verify that subscriber get ip from dhcp server successfully.
3066 5. Deactivate dhcp server app in onos.
3067 6. Repeat step 3.
3068 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3069 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003070 df = defer.Deferred()
3071 dhcp_app = 'org.onosproject.dhcp'
3072 def dhcp_flow_check_scenario(df):
3073 log_test.info('Enabling ponsim_olt')
3074 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3075 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3076 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003077 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003078 time.sleep(10)
3079 switch_map = None
3080 olt_configured = False
3081 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3082 log_test.info('Installing OLT app')
3083 OnosCtrl.install_app(self.olt_app_file)
3084 time.sleep(5)
3085 log_test.info('Adding subscribers through OLT app')
3086 self.config_olt(switch_map)
3087 olt_configured = True
3088 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003089 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00003090 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
3091 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3092 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00003093 thread1.start()
3094 time.sleep(10)
3095 thread1.join()
3096 thread2.join()
3097 try:
3098 assert_equal(self.success, True)
3099 #assert_equal(status, True)
3100 time.sleep(10)
3101 finally:
3102 self.voltha.disable_device(device_id, delete = True)
3103 self.remove_olt(switch_map)
3104 df.callback(0)
3105
3106 reactor.callLater(0, dhcp_flow_check_scenario, df)
3107 return df
3108
3109 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003110 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
3111 """
3112 Test Method:
3113 0. Make sure that voltha is up and running on CORD-POD setup.
3114 1. OLT and ONU is detected and validated.
3115 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3116 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3117 4. Verify that subscriber get ip from dhcp server successfully.
3118 5. Send dhcp renew packet to dhcp server which is running as onos app.
3119 6. Repeat step 4.
3120 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003121
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003122 df = defer.Deferred()
3123 def dhcp_flow_check_scenario(df):
3124 log_test.info('Enabling ponsim_olt')
3125 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3126 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3127 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003128 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003129 time.sleep(10)
3130 switch_map = None
3131 olt_configured = False
3132 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3133 log_test.info('Installing OLT app')
3134 OnosCtrl.install_app(self.olt_app_file)
3135 time.sleep(5)
3136 log_test.info('Adding subscribers through OLT app')
3137 self.config_olt(switch_map)
3138 olt_configured = True
3139 time.sleep(5)
3140 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
3141 try:
3142 assert_equal(dhcp_status, True)
3143 #assert_equal(status, True)
3144 time.sleep(10)
3145 finally:
3146 self.voltha.disable_device(device_id, delete = True)
3147 self.remove_olt(switch_map)
3148 df.callback(0)
3149
3150 reactor.callLater(0, dhcp_flow_check_scenario, df)
3151 return df
3152
3153 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003154 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
3155 """
3156 Test Method:
3157 0. Make sure that voltha is up and running on CORD-POD setup.
3158 1. OLT and ONU is detected and validated.
3159 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3160 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3161 4. Verify that subscriber get ip from dhcp server successfully.
3162 5. Send dhcp rebind packet to dhcp server which is running as onos app.
3163 6. Repeat step 4.
3164 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003165 df = defer.Deferred()
3166 def dhcp_flow_check_scenario(df):
3167 log_test.info('Enabling ponsim_olt')
3168 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3169 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3170 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003171 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003172 time.sleep(10)
3173 switch_map = None
3174 olt_configured = False
3175 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3176 log_test.info('Installing OLT app')
3177 OnosCtrl.install_app(self.olt_app_file)
3178 time.sleep(5)
3179 log_test.info('Adding subscribers through OLT app')
3180 self.config_olt(switch_map)
3181 olt_configured = True
3182 time.sleep(5)
3183 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
3184 try:
3185 assert_equal(dhcp_status, True)
3186 #assert_equal(status, True)
3187 time.sleep(10)
3188 finally:
3189 self.voltha.disable_device(device_id, delete = True)
3190 self.remove_olt(switch_map)
3191 df.callback(0)
3192
3193 reactor.callLater(0, dhcp_flow_check_scenario, df)
3194 return df
3195
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003196 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003197 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003198 """
3199 Test Method:
3200 0. Make sure that voltha is up and running on CORD-POD setup.
3201 1. OLT and ONU is detected and validated.
3202 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3203 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3204 4. Verify that subscriber get ip from dhcp server successfully.
3205 5. Disable olt devices which is being detected in voltha CLI.
3206 6. Repeat step 3.
3207 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3208 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003209 df = defer.Deferred()
3210 dhcp_app = 'org.onosproject.dhcp'
3211 def dhcp_flow_check_scenario(df):
3212 log_test.info('Enabling ponsim_olt')
3213 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3214 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3215 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003216 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003217 time.sleep(10)
3218 switch_map = None
3219 olt_configured = False
3220 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3221 log_test.info('Installing OLT app')
3222 OnosCtrl.install_app(self.olt_app_file)
3223 time.sleep(5)
3224 log_test.info('Adding subscribers through OLT app')
3225 self.config_olt(switch_map)
3226 olt_configured = True
3227 time.sleep(5)
3228 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3229 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3230 log_test.info('Disable the olt device in during client send discover to voltha')
3231 thread2.start()
3232# time.sleep(randint(0,1))
3233 thread1.start()
3234 time.sleep(10)
3235 thread1.join()
3236 thread2.join()
3237 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003238 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003239 #assert_equal(status, True)
3240 time.sleep(10)
3241 finally:
3242 self.voltha.disable_device(device_id, delete = True)
3243 self.remove_olt(switch_map)
3244 df.callback(0)
3245
3246 reactor.callLater(0, dhcp_flow_check_scenario, df)
3247 return df
3248
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003249 @deferred(TESTCASE_TIMEOUT)
3250 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
3251 """
3252 Test Method:
3253 0. Make sure that voltha is up and running on CORD-POD setup.
3254 1. OLT and ONU is detected and validated.
3255 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3256 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3257 4. Verify that subscriber get ip from dhcp server successfully.
3258 5. Disable olt devices which is being detected in voltha CLI.
3259 6. Repeat step 3.
3260 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3261 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
3262 """
3263 df = defer.Deferred()
3264 no_iterations = 10
3265 dhcp_app = 'org.onosproject.dhcp'
3266 def dhcp_flow_check_scenario(df):
3267 log_test.info('Enabling ponsim_olt')
3268 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3269 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3270 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003271 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003272 time.sleep(10)
3273 switch_map = None
3274 olt_configured = False
3275 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3276 log_test.info('Installing OLT app')
3277 OnosCtrl.install_app(self.olt_app_file)
3278 time.sleep(5)
3279 log_test.info('Adding subscribers through OLT app')
3280 self.config_olt(switch_map)
3281 olt_configured = True
3282 time.sleep(5)
3283 for i in range(no_iterations):
3284 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3285 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3286 log_test.info('Disable the olt device in during client send discover to voltha')
3287 thread2.start()
3288# time.sleep(randint(0,1))
3289 thread1.start()
3290 time.sleep(10)
3291 thread1.join()
3292 thread2.join()
3293 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3294 try:
3295 assert_equal(self.success, True)
3296 assert_equal(dhcp_status, True)
3297 #assert_equal(status, True)
3298 time.sleep(10)
3299 finally:
3300 self.voltha.disable_device(device_id, delete = True)
3301 self.remove_olt(switch_map)
3302 df.callback(0)
3303
3304 reactor.callLater(0, dhcp_flow_check_scenario, df)
3305 return df
3306
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003307 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003308 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003309 """
3310 Test Method:
3311 0. Make sure that voltha is up and running on CORD-POD setup.
3312 1. OLT and ONU is detected and validated.
3313 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3314 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3315 4. Verify that subscriber get ip from dhcp server successfully.
3316 5. Disable olt devices which is being detected in voltha CLI.
3317 6. Repeat step 3.
3318 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3319 8. Enable olt devices which is being detected in voltha CLI.
3320 9. Repeat steps 3 and 4.
3321 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003322 df = defer.Deferred()
3323 dhcp_app = 'org.onosproject.dhcp'
3324 def dhcp_flow_check_scenario(df):
3325 log_test.info('Enabling ponsim_olt')
3326 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3327 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3328 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003329 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003330 time.sleep(10)
3331 switch_map = None
3332 olt_configured = False
3333 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3334 log_test.info('Installing OLT app')
3335 OnosCtrl.install_app(self.olt_app_file)
3336 time.sleep(5)
3337 log_test.info('Adding subscribers through OLT app')
3338 self.config_olt(switch_map)
3339 olt_configured = True
3340 time.sleep(5)
3341 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3342 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3343 thread2.start()
3344 thread1.start()
3345 time.sleep(10)
3346 thread1.join()
3347 thread2.join()
3348 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003349 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003350 #assert_equal(status, True)
3351 time.sleep(10)
3352 finally:
3353 self.voltha.disable_device(device_id, delete = True)
3354 self.remove_olt(switch_map)
3355 df.callback(0)
3356
3357 reactor.callLater(0, dhcp_flow_check_scenario, df)
3358 return df
3359
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003360 @deferred(TESTCASE_TIMEOUT)
3361 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
3362 """
3363 Test Method:
3364 0. Make sure that voltha is up and running on CORD-POD setup.
3365 1. OLT and ONU is detected and validated.
3366 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3367 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3368 4. Verify that subscriber get ip from dhcp server successfully.
3369 5. Disable olt devices which is being detected in voltha CLI.
3370 6. Repeat step 3.
3371 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3372 8. Enable olt devices which is being detected in voltha CLI.
3373 9. Repeat steps 3 and 4.
3374 """
3375
3376 df = defer.Deferred()
3377 no_iterations = 10
3378 dhcp_app = 'org.onosproject.dhcp'
3379 def dhcp_flow_check_scenario(df):
3380 log_test.info('Enabling ponsim_olt')
3381 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3382 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3383 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003384 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003385 time.sleep(10)
3386 switch_map = None
3387 olt_configured = False
3388 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3389 log_test.info('Installing OLT app')
3390 OnosCtrl.install_app(self.olt_app_file)
3391 time.sleep(5)
3392 log_test.info('Adding subscribers through OLT app')
3393 self.config_olt(switch_map)
3394 olt_configured = True
3395 time.sleep(5)
3396 for i in range(no_iterations):
3397 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3398 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3399 thread2.start()
3400 thread1.start()
3401 time.sleep(10)
3402 thread1.join()
3403 thread2.join()
3404 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3405 try:
3406 assert_equal(dhcp_status, True)
3407 #assert_equal(status, True)
3408 assert_equal(self.success, True)
3409 time.sleep(10)
3410 finally:
3411 self.voltha.disable_device(device_id, delete = True)
3412 self.remove_olt(switch_map)
3413 df.callback(0)
3414
3415 reactor.callLater(0, dhcp_flow_check_scenario, df)
3416 return df
3417
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003418 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003419 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003420 """
3421 Test Method:
3422 0. Make sure that voltha is up and running on CORD-POD setup.
3423 1. OLT and ONU is detected and validated.
3424 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3425 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3426 4. Verify that subscriber get ip from dhcp server successfully.
3427 5. Disable onu port which is being detected in voltha CLI.
3428 6. Repeat step 3.
3429 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3430 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003431 df = defer.Deferred()
3432 dhcp_app = 'org.onosproject.dhcp'
3433 def dhcp_flow_check_scenario(df):
3434 log_test.info('Enabling ponsim_olt')
3435 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3436 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3437 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003438 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003439 time.sleep(10)
3440 switch_map = None
3441 olt_configured = False
3442 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3443 log_test.info('Installing OLT app')
3444 OnosCtrl.install_app(self.olt_app_file)
3445 time.sleep(5)
3446 log_test.info('Adding subscribers through OLT app')
3447 self.config_olt(switch_map)
3448 olt_configured = True
3449 time.sleep(5)
3450 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3451 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3452 thread1.start()
3453 thread2.start()
3454 time.sleep(10)
3455 thread1.join()
3456 thread2.join()
3457 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003458 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003459 #assert_equal(status, True)
3460 time.sleep(10)
3461 finally:
3462 self.voltha.disable_device(device_id, delete = True)
3463 self.remove_olt(switch_map)
3464 df.callback(0)
3465
3466 reactor.callLater(0, dhcp_flow_check_scenario, df)
3467 return df
3468
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003469 @deferred(TESTCASE_TIMEOUT)
3470 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
3471 """
3472 Test Method:
3473 0. Make sure that voltha is up and running on CORD-POD setup.
3474 1. OLT and ONU is detected and validated.
3475 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3476 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3477 4. Verify that subscriber get ip from dhcp server successfully.
3478 5. Disable onu port which is being detected in voltha CLI.
3479 6. Repeat step 3.
3480 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3481 """
3482 df = defer.Deferred()
3483 no_iterations = 10
3484 dhcp_app = 'org.onosproject.dhcp'
3485 def dhcp_flow_check_scenario(df):
3486 log_test.info('Enabling ponsim_olt')
3487 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3488 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3489 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003490 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003491 time.sleep(10)
3492 switch_map = None
3493 olt_configured = False
3494 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3495 log_test.info('Installing OLT app')
3496 OnosCtrl.install_app(self.olt_app_file)
3497 time.sleep(5)
3498 log_test.info('Adding subscribers through OLT app')
3499 self.config_olt(switch_map)
3500 olt_configured = True
3501 time.sleep(5)
3502 for i in range(no_iterations):
3503 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3504 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3505 thread1.start()
3506 thread2.start()
3507 time.sleep(10)
3508 thread1.join()
3509 thread2.join()
3510 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3511 try:
3512 #assert_equal(status, True)
3513 assert_equal(dhcp_status, True)
3514 assert_equal(self.success, True)
3515 time.sleep(10)
3516 finally:
3517 self.voltha.disable_device(device_id, delete = True)
3518 self.remove_olt(switch_map)
3519 df.callback(0)
3520
3521 reactor.callLater(0, dhcp_flow_check_scenario, df)
3522 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003523
3524 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003525 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003526 """
3527 Test Method:
3528 0. Make sure that voltha is up and running on CORD-POD setup.
3529 1. OLT and ONU is detected and validated.
3530 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3531 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3532 4. Verify that subscriber get ip from dhcp server successfully.
3533 5. Disable onu port which is being detected in voltha CLI.
3534 6. Repeat step 3.
3535 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3536 8. Enable onu port which is being detected in voltha CLI.
3537 9. Repeat steps 3 and 4.
3538 """
3539
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003540 df = defer.Deferred()
3541 dhcp_app = 'org.onosproject.dhcp'
3542 def dhcp_flow_check_scenario(df):
3543 log_test.info('Enabling ponsim_olt')
3544 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3545 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3546 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003547 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003548 time.sleep(10)
3549 switch_map = None
3550 olt_configured = False
3551 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3552 log_test.info('Installing OLT app')
3553 OnosCtrl.install_app(self.olt_app_file)
3554 time.sleep(5)
3555 log_test.info('Adding subscribers through OLT app')
3556 self.config_olt(switch_map)
3557 olt_configured = True
3558 time.sleep(5)
3559 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3560 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3561 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3562 thread2.start()
3563 time.sleep(randint(0,1))
3564 thread1.start()
3565 time.sleep(10)
3566 thread1.join()
3567 thread2.join()
3568 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3569 assert_equal(dhcp_status, True)
3570 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003571 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003572 #assert_equal(status, True)
3573 time.sleep(10)
3574 finally:
3575 self.voltha.disable_device(device_id, delete = True)
3576 self.remove_olt(switch_map)
3577 df.callback(0)
3578
3579 reactor.callLater(0, dhcp_flow_check_scenario, df)
3580 return df
3581
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003582 @deferred(TESTCASE_TIMEOUT)
3583 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
3584 """
3585 Test Method:
3586 0. Make sure that voltha is up and running on CORD-POD setup.
3587 1. OLT and ONU is detected and validated.
3588 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3589 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3590 4. Verify that subscriber get ip from dhcp server successfully.
3591 5. Disable onu port which is being detected in voltha CLI.
3592 6. Repeat step 3.
3593 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3594 8. Enable onu port which is being detected in voltha CLI.
3595 9. Repeat steps 3 and 4.
3596 """
3597
3598 df = defer.Deferred()
3599 no_iterations = 10
3600 dhcp_app = 'org.onosproject.dhcp'
3601 def dhcp_flow_check_scenario(df):
3602 log_test.info('Enabling ponsim_olt')
3603 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3604 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3605 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003606 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003607 time.sleep(10)
3608 switch_map = None
3609 olt_configured = False
3610 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3611 log_test.info('Installing OLT app')
3612 OnosCtrl.install_app(self.olt_app_file)
3613 time.sleep(5)
3614 log_test.info('Adding subscribers through OLT app')
3615 self.config_olt(switch_map)
3616 olt_configured = True
3617 time.sleep(5)
3618 for i in range(no_iterations):
3619 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3620 thread2 = threading.Thread(target = self.voltha_uni_port_down_up)
3621 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3622 thread2.start()
3623 time.sleep(randint(0,1))
3624 thread1.start()
3625 time.sleep(10)
3626 thread1.join()
3627 thread2.join()
3628 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3629 assert_equal(dhcp_status, True)
3630 try:
3631 assert_equal(self.success, True)
3632 #assert_equal(status, True)
3633 time.sleep(10)
3634 finally:
3635 self.voltha.disable_device(device_id, delete = True)
3636 self.remove_olt(switch_map)
3637 df.callback(0)
3638
3639 reactor.callLater(0, dhcp_flow_check_scenario, df)
3640 return df
3641
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003642 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003643 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003644 """
3645 Test Method:
3646 0. Make sure that voltha is up and running on CORD-POD setup.
3647 1. OLT and ONU is detected and validated.
3648 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3649 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3650 4. Verify that subscribers had got different ips from dhcp server successfully.
3651 """
3652
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003653 df = defer.Deferred()
3654 self.success = True
3655 dhcp_app = 'org.onosproject.dhcp'
3656 def dhcp_flow_check_scenario(df):
3657 log_test.info('Enabling ponsim_olt')
3658 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3659 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3660 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003661 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003662 time.sleep(10)
3663 switch_map = None
3664 olt_configured = False
3665 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3666 log_test.info('Installing OLT app')
3667 OnosCtrl.install_app(self.olt_app_file)
3668 time.sleep(5)
3669 log_test.info('Adding subscribers through OLT app')
3670 self.config_olt(switch_map)
3671 olt_configured = True
3672 time.sleep(5)
3673 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3674 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3675 thread1.start()
3676 thread2.start()
3677 time.sleep(10)
3678 thread1.join()
3679 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003680 dhcp_flow_status = self.success
3681 try:
3682# if self.success is not True:
3683 assert_equal(dhcp_flow_status, True)
3684 #assert_equal(status, True)
3685 time.sleep(10)
3686 finally:
3687 self.voltha.disable_device(device_id, delete = True)
3688 self.remove_olt(switch_map)
3689 df.callback(0)
3690
3691 reactor.callLater(0, dhcp_flow_check_scenario, df)
3692 return df
3693
3694 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003695 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003696 """
3697 Test Method:
3698 0. Make sure that voltha is up and running on CORD-POD setup.
3699 1. OLT and ONU is detected and validated.
3700 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3701 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3702 4. Verify that subscribers had got ip from dhcp server successfully.
3703 5. Repeat step 3 and 4 for 10 times for both subscribers.
3704 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
3705 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003706
3707
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003708 df = defer.Deferred()
3709 self.success = True
3710 dhcp_app = 'org.onosproject.dhcp'
3711 def dhcp_flow_check_scenario(df):
3712 log_test.info('Enabling ponsim_olt')
3713 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3714 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3715 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003716 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003717 time.sleep(10)
3718 switch_map = None
3719 olt_configured = False
3720 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3721 log_test.info('Installing OLT app')
3722 OnosCtrl.install_app(self.olt_app_file)
3723 time.sleep(5)
3724 log_test.info('Adding subscribers through OLT app')
3725 self.config_olt(switch_map)
3726 olt_configured = True
3727 time.sleep(5)
3728 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3729 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
3730 thread1.start()
3731 thread2.start()
3732 time.sleep(10)
3733 thread1.join()
3734 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003735 dhcp_flow_status = self.success
3736 try:
3737# if self.success is not True:
3738 assert_equal(dhcp_flow_status, True)
3739 #assert_equal(status, True)
3740 time.sleep(10)
3741 finally:
3742 self.voltha.disable_device(device_id, delete = True)
3743 self.remove_olt(switch_map)
3744 df.callback(0)
3745
3746 reactor.callLater(0, dhcp_flow_check_scenario, df)
3747 return df
3748
3749 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003750 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003751 """
3752 Test Method:
3753 0. Make sure that voltha is up and running on CORD-POD setup.
3754 1. OLT and ONU is detected and validated.
3755 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3756 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3757 4. Verify that subscribers had got ip from dhcp server successfully.
3758 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3759 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
3760 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003761
3762 df = defer.Deferred()
3763 self.success = True
3764 dhcp_app = 'org.onosproject.dhcp'
3765 def dhcp_flow_check_scenario(df):
3766 log_test.info('Enabling ponsim_olt')
3767 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3768 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3769 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003770 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003771 time.sleep(10)
3772 switch_map = None
3773 olt_configured = False
3774 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3775 log_test.info('Installing OLT app')
3776 OnosCtrl.install_app(self.olt_app_file)
3777 time.sleep(5)
3778 log_test.info('Adding subscribers through OLT app')
3779 self.config_olt(switch_map)
3780 olt_configured = True
3781 time.sleep(5)
3782 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3783 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3784 thread1.start()
3785 thread2.start()
3786 time.sleep(10)
3787 thread1.join()
3788 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003789 dhcp_flow_status = self.success
3790 try:
3791# if self.success is not True:
3792 assert_equal(dhcp_flow_status, True)
3793 #assert_equal(status, True)
3794 time.sleep(10)
3795 finally:
3796 self.voltha.disable_device(device_id, delete = True)
3797 self.remove_olt(switch_map)
3798 df.callback(0)
3799
3800 reactor.callLater(0, dhcp_flow_check_scenario, df)
3801 return df
3802
3803 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003804 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 +00003805 """
3806 Test Method:
3807 0. Make sure that voltha is up and running on CORD-POD setup.
3808 1. OLT and ONU is detected and validated.
3809 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3810 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
3811 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
3812 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
3813 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003814
3815 df = defer.Deferred()
3816 self.success = True
3817 dhcp_app = 'org.onosproject.dhcp'
3818 def dhcp_flow_check_scenario(df):
3819 log_test.info('Enabling ponsim_olt')
3820 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3821 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3822 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003823 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003824 time.sleep(10)
3825 switch_map = None
3826 olt_configured = False
3827 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3828 log_test.info('Installing OLT app')
3829 OnosCtrl.install_app(self.olt_app_file)
3830 time.sleep(5)
3831 log_test.info('Adding subscribers through OLT app')
3832 self.config_olt(switch_map)
3833 olt_configured = True
3834 time.sleep(5)
3835 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3836 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
3837 thread1.start()
3838 thread2.start()
3839 time.sleep(10)
3840 thread1.join()
3841 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003842 dhcp_flow_status = self.success
3843 try:
3844# if self.success is not True:
3845 assert_equal(dhcp_flow_status, True)
3846 #assert_equal(status, True)
3847 time.sleep(10)
3848 finally:
3849 self.voltha.disable_device(device_id, delete = True)
3850 self.remove_olt(switch_map)
3851 df.callback(0)
3852
3853 reactor.callLater(0, dhcp_flow_check_scenario, df)
3854 return df
3855
3856 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003857 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 +00003858 """
3859 Test Method:
3860 0. Make sure that voltha is up and running on CORD-POD setup.
3861 1. OLT and ONU is detected and validated.
3862 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3863 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
3864 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
3865 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
3866 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003867 df = defer.Deferred()
3868 self.success = True
3869 dhcp_app = 'org.onosproject.dhcp'
3870 def dhcp_flow_check_scenario(df):
3871 log_test.info('Enabling ponsim_olt')
3872 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3873 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3874 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003875 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003876 time.sleep(10)
3877 switch_map = None
3878 olt_configured = False
3879 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3880 log_test.info('Installing OLT app')
3881 OnosCtrl.install_app(self.olt_app_file)
3882 time.sleep(5)
3883 log_test.info('Adding subscribers through OLT app')
3884 self.config_olt(switch_map)
3885 olt_configured = True
3886 time.sleep(5)
3887 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3888 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3889 thread1.start()
3890 thread2.start()
3891 time.sleep(10)
3892 thread1.join()
3893 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003894 dhcp_flow_status = self.success
3895 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003896 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003897 time.sleep(10)
3898 finally:
3899 self.voltha.disable_device(device_id, delete = True)
3900 self.remove_olt(switch_map)
3901 df.callback(0)
3902
3903 reactor.callLater(0, dhcp_flow_check_scenario, df)
3904 return df
3905
3906 @deferred(TESTCASE_TIMEOUT)
3907 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003908 """
3909 Test Method:
3910 0. Make sure that voltha is up and running on CORD-POD setup.
3911 1. OLT and ONU is detected and validated.
3912 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3913 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3914 4. Verify that subscribers had got ip from dhcp server successfully.
3915 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3916 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3917 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3918 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003919 df = defer.Deferred()
3920 self.success = True
3921 dhcp_app = 'org.onosproject.dhcp'
3922 def dhcp_flow_check_scenario(df):
3923 log_test.info('Enabling ponsim_olt')
3924 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3925 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3926 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003927 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003928 time.sleep(10)
3929 switch_map = None
3930 olt_configured = False
3931 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3932 log_test.info('Installing OLT app')
3933 OnosCtrl.install_app(self.olt_app_file)
3934 time.sleep(5)
3935 log_test.info('Adding subscribers through OLT app')
3936 self.config_olt(switch_map)
3937 olt_configured = True
3938 time.sleep(5)
3939 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3940 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3941 thread1.start()
3942 thread2.start()
3943 time.sleep(10)
3944 thread1.join()
3945 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003946 dhcp_flow_status = self.success
3947 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003948 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003949 time.sleep(10)
3950 finally:
3951 self.voltha.disable_device(device_id, delete = True)
3952 self.remove_olt(switch_map)
3953 df.callback(0)
3954
3955 reactor.callLater(0, dhcp_flow_check_scenario, df)
3956 return df
3957
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003958 @deferred(TESTCASE_TIMEOUT)
3959 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003960 """
3961 Test Method:
3962 0. Make sure that voltha is up and running on CORD-POD setup.
3963 1. OLT and ONU is detected and validated.
3964 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3965 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3966 4. Verify that subscribers had got ip from dhcp server successfully.
3967 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3968 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3969 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3970 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
3971 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
3972 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
3973 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003974 df = defer.Deferred()
3975 self.success = True
3976 dhcp_app = 'org.onosproject.dhcp'
3977 def dhcp_flow_check_scenario(df):
3978 log_test.info('Enabling ponsim_olt')
3979 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3980 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3981 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003982 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003983 time.sleep(10)
3984 switch_map = None
3985 olt_configured = False
3986 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3987 log_test.info('Installing OLT app')
3988 OnosCtrl.install_app(self.olt_app_file)
3989 time.sleep(5)
3990 log_test.info('Adding subscribers through OLT app')
3991 self.config_olt(switch_map)
3992 olt_configured = True
3993 time.sleep(5)
3994 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3995 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3996 thread3 = threading.Thread(target = self.voltha_uni_port_down_up, args = (self.INTF_2_RX_DEFAULT,))
3997 thread1.start()
3998 thread2.start()
3999 thread3.start()
4000 time.sleep(10)
4001 thread1.join()
4002 thread2.join()
4003 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004004 dhcp_flow_status = self.success
4005 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004006 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004007 time.sleep(10)
4008 finally:
4009 self.voltha.disable_device(device_id, delete = True)
4010 self.remove_olt(switch_map)
4011 df.callback(0)
4012
4013 reactor.callLater(0, dhcp_flow_check_scenario, df)
4014 return df
4015
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004016 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004017 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004018 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004019 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00004020 0. Make sure that voltha is up and running on CORD-POD setup.
4021 1. OLT and ONU is detected and validated.
4022 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4023 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4024 4. Verify that subscribers had got ip from dhcp server successfully.
4025 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4026 6. Disable the olt device which is detected in voltha.
4027 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4028 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004029 df = defer.Deferred()
4030 self.success = True
4031 dhcp_app = 'org.onosproject.dhcp'
4032 def dhcp_flow_check_scenario(df):
4033 log_test.info('Enabling ponsim_olt')
4034 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4035 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4036 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004037 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004038 time.sleep(10)
4039 switch_map = None
4040 olt_configured = False
4041 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4042 log_test.info('Installing OLT app')
4043 OnosCtrl.install_app(self.olt_app_file)
4044 time.sleep(5)
4045 log_test.info('Adding subscribers through OLT app')
4046 self.config_olt(switch_map)
4047 olt_configured = True
4048 time.sleep(5)
4049 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4050 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4051 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
4052
4053 thread1.start()
4054 thread2.start()
4055 thread3.start()
4056 time.sleep(10)
4057 thread1.join()
4058 thread2.join()
4059 thread3.join()
4060 dhcp_flow_status = self.success
4061 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004062 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004063 time.sleep(10)
4064 finally:
4065 self.voltha.disable_device(device_id, delete = True)
4066 self.remove_olt(switch_map)
4067 df.callback(0)
4068
4069 reactor.callLater(0, dhcp_flow_check_scenario, df)
4070 return df
4071
4072 @deferred(TESTCASE_TIMEOUT)
4073 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004074 """
4075 Test Method:
4076 0. Make sure that voltha is up and running on CORD-POD setup.
4077 1. OLT and ONU is detected and validated.
4078 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4079 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4080 4. Verify that subscribers had got ip from dhcp server successfully.
4081 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4082 6. Disable the olt device which is detected in voltha.
4083 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4084 8. Enable the olt device which is detected in voltha.
4085 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 +00004086
Thangavelu K S057b7d22017-05-16 22:03:22 +00004087 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004088 df = defer.Deferred()
4089 self.success = True
4090 dhcp_app = 'org.onosproject.dhcp'
4091 def dhcp_flow_check_scenario(df):
4092 log_test.info('Enabling ponsim_olt')
4093 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4094 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4095 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004096 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004097 time.sleep(10)
4098 switch_map = None
4099 olt_configured = False
4100 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4101 log_test.info('Installing OLT app')
4102 OnosCtrl.install_app(self.olt_app_file)
4103 time.sleep(5)
4104 log_test.info('Adding subscribers through OLT app')
4105 self.config_olt(switch_map)
4106 olt_configured = True
4107 time.sleep(5)
4108 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4109 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4110 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
4111 thread1.start()
4112 thread2.start()
4113 thread3.start()
4114 time.sleep(10)
4115 thread1.join()
4116 thread2.join()
4117 thread3.join()
4118 dhcp_flow_status = self.success
4119 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004120 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004121 time.sleep(10)
4122 finally:
4123 self.voltha.disable_device(device_id, delete = True)
4124 self.remove_olt(switch_map)
4125 df.callback(0)
4126
4127 reactor.callLater(0, dhcp_flow_check_scenario, df)
4128 return df
4129
4130 @deferred(TESTCASE_TIMEOUT)
4131 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004132 """
4133 Test Method:
4134 0. Make sure that voltha is up and running on CORD-POD setup.
4135 1. OLT and ONU is detected and validated.
4136 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4137 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4138 4. Verify that subscribers had got ip from dhcp server successfully.
4139 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4140 6. Pause the olt device which is detected in voltha.
4141 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4142 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004143 df = defer.Deferred()
4144 self.success = True
4145 dhcp_app = 'org.onosproject.dhcp'
4146 def dhcp_flow_check_scenario(df):
4147 log_test.info('Enabling ponsim_olt')
4148 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4149 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4150 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004151 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004152 time.sleep(10)
4153 switch_map = None
4154 olt_configured = False
4155 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4156 log_test.info('Installing OLT app')
4157 OnosCtrl.install_app(self.olt_app_file)
4158 time.sleep(5)
4159 log_test.info('Adding subscribers through OLT app')
4160 self.config_olt(switch_map)
4161 olt_configured = True
4162 time.sleep(5)
4163 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4164 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4165 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
4166 thread1.start()
4167 thread2.start()
4168 thread3.start()
4169 time.sleep(10)
4170 thread1.join()
4171 thread2.join()
4172 thread3.join()
4173 dhcp_flow_status = self.success
4174 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004175 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004176 time.sleep(10)
4177 finally:
4178 self.voltha.disable_device(device_id, delete = True)
4179 self.remove_olt(switch_map)
4180 df.callback(0)
4181
4182 reactor.callLater(0, dhcp_flow_check_scenario, df)
4183 return df
4184
Thangavelu K S36edb012017-07-05 18:24:12 +00004185 def test_3_subscribers_with_voltha_for_dhcp_discover_requests(self):
4186 """
4187 Test Method:
4188 0. Make sure that voltha is up and running on CORD-POD setup.
4189 1. OLT and ONU is detected and validated.
4190 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4191 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4192 4. Verify that subscriber get ip from dhcp server successfully.
4193 """
4194 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4195 num_subscribers = 3
4196 num_channels = 1
4197 services = ('DHCP')
4198 cbs = (self.dhcp_flow_check, None, None)
4199 self.voltha_subscribers(services, cbs = cbs,
4200 num_subscribers = num_subscribers,
4201 num_channels = num_channels)
4202
4203 def test_5_subscribers_with_voltha_for_dhcp_discover_requests(self):
4204 """
4205 Test Method:
4206 0. Make sure that voltha is up and running on CORD-POD setup.
4207 1. OLT and ONU is detected and validated.
4208 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4209 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4210 4. Verify that subscriber get ip from dhcp server successfully.
4211 """
4212 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4213 num_subscribers = 5
4214 num_channels = 1
4215 services = ('DHCP')
4216 cbs = (self.dhcp_flow_check, None, None)
4217 self.voltha_subscribers(services, cbs = cbs,
4218 num_subscribers = num_subscribers,
4219 num_channels = num_channels)
4220
4221 def test_9_subscribers_with_voltha_for_dhcp_discover_requests(self):
4222 """
4223 Test Method:
4224 0. Make sure that voltha is up and running on CORD-POD setup.
4225 1. OLT and ONU is detected and validated.
4226 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4227 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4228 4. Verify that subscriber get ip from dhcp server successfully.
4229 """
4230 """Test subscriber join next for channel surfing with 9 subscribers browsing 1 channels each"""
4231 num_subscribers = 9
4232 num_channels = 1
4233 services = ('DHCP')
4234 cbs = (self.dhcp_flow_check, None, None)
4235 self.voltha_subscribers(services, cbs = cbs,
4236 num_subscribers = num_subscribers,
4237 num_channels = num_channels)
4238
4239 def test_3_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4240 """
4241 Test Method:
4242 0. Make sure that voltha is up and running on CORD-POD setup.
4243 1. OLT and ONU is detected and validated.
4244 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4245 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4246 4. Verify that subscriber get ip from dhcp server successfully.
4247 """
4248 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4249 num_subscribers = 3
4250 num_channels = 1
4251 services = ('TLS','DHCP')
4252 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4253 self.voltha_subscribers(services, cbs = cbs,
4254 num_subscribers = num_subscribers,
4255 num_channels = num_channels)
4256
4257 def test_5_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4258 """
4259 Test Method:
4260 0. Make sure that voltha is up and running on CORD-POD setup.
4261 1. OLT and ONU is detected and validated.
4262 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4263 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4264 4. Verify that subscriber get ip from dhcp server successfully.
4265 """
4266 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4267 num_subscribers = 5
4268 num_channels = 1
4269 services = ('TLS','DHCP')
4270 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4271 self.voltha_subscribers(services, cbs = cbs,
4272 num_subscribers = num_subscribers,
4273 num_channels = num_channels)
4274
4275 def test_9_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4276 """
4277 Test Method:
4278 0. Make sure that voltha is up and running on CORD-POD setup.
4279 1. OLT and ONU is detected and validated.
4280 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4281 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4282 4. Verify that subscriber get ip from dhcp server successfully.
4283 """
4284 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4285 num_subscribers = 9
4286 num_channels = 1
4287 services = ('TLS','DHCP')
4288 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4289 self.voltha_subscribers(services, cbs = cbs,
4290 num_subscribers = num_subscribers,
4291 num_channels = num_channels)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004292
4293 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004294 def test_subscriber_with_voltha_for_dhcprelay_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004295 """
4296 Test Method:
4297 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4298 1. OLT and ONU is detected and validated.
4299 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4300 3. Send dhcp request from residential subscrber to external dhcp server.
4301 4. Verify that subscriber get ip from external dhcp server successfully.
4302 """
Thangavelu K S6432b522017-07-22 00:05:54 +00004303 self.dhcprelay_setUpClass()
4304# if not port_list:
4305 port_list = self.generate_port_list(1, 0)
4306 iface = self.port_map['ports'][port_list[1][1]]
4307 mac = self.get_mac(iface)
4308 self.host_load(iface)
4309 ##we use the defaults for this test that serves as an example for others
4310 ##You don't need to restart dhcpd server if retaining default config
4311 config = self.default_config
4312 options = self.default_options
4313 subnet = self.default_subnet_config
4314 dhcpd_interface_list = self.relay_interfaces
4315 self.dhcpd_start(intf_list = dhcpd_interface_list,
4316 config = config,
4317 options = options,
4318 subnet = subnet)
4319 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4320 self.send_recv(mac=mac)
4321 self.dhcprelay_tearDwonClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004322
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004323 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004324 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004325 """
4326 Test Method:
4327 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4328 1. OLT and ONU is detected and validated.
4329 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4330 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
4331 4. Verify that subscriber should not get ip from external dhcp server.
4332 """
4333
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004334 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004335 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004336 """
4337 Test Method:
4338 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4339 1. OLT and ONU is detected and validated.
4340 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4341 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
4342 4. Verify that subscriber should not get ip from external dhcp server.
4343 """
4344
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004345 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004346 """
4347 Test Method:
4348 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4349 1. OLT and ONU is detected and validated.
4350 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4351 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
4352 4. Verify that subscriber should not get ip from external dhcp server.
4353 """
4354
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004355 def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004356 """
4357 Test Method:
4358 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4359 1. OLT and ONU is detected and validated.
4360 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4361 3. Send dhcp request from residential subscrber to external dhcp server.
4362 4. Verify that subscriber get ip from external dhcp server successfully.
4363 5. Send dhcp release from residential subscrber to external dhcp server.
4364 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
4365 """
4366
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004367 def test_subscriber_with_voltha_for_dhcprelay_starvation(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004368 """
4369 Test Method:
4370 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4371 1. OLT and ONU is detected and validated.
4372 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4373 3. Send dhcp request from residential subscriber to external dhcp server.
4374 4. Verify that subscriber get ip from external dhcp server. successfully.
4375 5. Repeat step 3 and 4 for 10 times.
4376 6 Verify that subscriber should get ip from external dhcp server..
4377 """
4378
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004379 def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004380 """
4381 Test Method:
4382 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4383 1. OLT and ONU is detected and validated.
4384 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4385 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
4386 4. Verify that subscriber should not get ip from external dhcp server..
4387 5. Repeat steps 3 and 4 for 10 times.
4388 6 Verify that subscriber should not get ip from external dhcp server..
4389 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004390 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004391 """
4392 Test Method:
4393 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4394 1. OLT and ONU is detected and validated.
4395 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4396 3. Send dhcp request from residential subscriber to external dhcp server.
4397 4. Verify that subscriber get ip from external dhcp server. successfully.
4398 5. Repeat step 3 for 50 times.
4399 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4400 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004401 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004402 """
4403 Test Method:
4404 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4405 1. OLT and ONU is detected and validated.
4406 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4407 3. Send dhcp request from residential subscriber to external dhcp server.
4408 4. Verify that subscriber get ip from external dhcp server. successfully.
4409 5. Send DHCP request to external dhcp server.
4410 6. Repeat step 5 for 50 times.
4411 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4412 """
4413
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004414 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004415 """
4416 Test Method:
4417 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4418 1. OLT and ONU is detected and validated.
4419 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4420 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
4421 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
4422 """
4423
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004424 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004425 """
4426 Test Method:
4427 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4428 1. OLT and ONU is detected and validated.
4429 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4430 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
4431 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.
4432 """
4433
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004434 def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004435 """
4436 Test Method:
4437 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4438 1. OLT and ONU is detected and validated.
4439 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4440 3. Send dhcp request from residential subscriber to external dhcp server.
4441 4. Verify that subscriber get ip from external dhcp server. successfully.
4442 5. Deactivate dhcp server app in onos.
4443 6. Repeat step 3.
4444 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4445 """
4446
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004447 def test_subscriber_with_voltha_for_dhcprelay_renew_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004448 """
4449 Test Method:
4450 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4451 1. OLT and ONU is detected and validated.
4452 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4453 3. Send dhcp request from residential subscriber to external dhcp server.
4454 4. Verify that subscriber get ip from external dhcp server. successfully.
4455 5. Send dhcp renew packet to external dhcp server.
4456 6. Repeat step 4.
4457 """
4458
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004459 def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004460 """
4461 Test Method:
4462 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4463 1. OLT and ONU is detected and validated.
4464 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4465 3. Send dhcp request from residential subscriber to external dhcp server.
4466 4. Verify that subscriber get ip from external dhcp server. successfully.
4467 5. Send dhcp rebind packet to external dhcp server.
4468 6. Repeat step 4.
4469 """
4470
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004471 def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004472 """
4473 Test Method:
4474 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4475 1. OLT and ONU is detected and validated.
4476 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4477 3. Send dhcp request from residential subscriber to external dhcp server.
4478 4. Verify that subscriber get ip from external dhcp server. successfully.
4479 5. Disable olt devices which is being detected in voltha CLI.
4480 6. Repeat step 3.
4481 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4482 """
4483
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004484 def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004485 """
4486 Test Method:
4487 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4488 1. OLT and ONU is detected and validated.
4489 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4490 3. Send dhcp request from residential subscriber to external dhcp server.
4491 4. Verify that subscriber get ip from external dhcp server. successfully.
4492 5. Disable olt devices which is being detected in voltha CLI.
4493 6. Repeat step 3.
4494 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4495 8. Enable olt devices which is being detected in voltha CLI.
4496 9. Repeat steps 3 and 4.
4497 """
4498
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004499 def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004500 """
4501 Test Method:
4502 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4503 1. OLT and ONU is detected and validated.
4504 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4505 3. Send dhcp request from residential subscriber to external dhcp server.
4506 4. Verify that subscriber get ip from external dhcp server. successfully.
4507 5. Disable onu port which is being detected in voltha CLI.
4508 6. Repeat step 3.
4509 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4510 """
4511
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004512 def test_subscriber_with_voltha_for_dhcprelay_disable_enable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004513 """
4514 Test Method:
4515 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4516 1. OLT and ONU is detected and validated.
4517 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4518 3. Send dhcp request from residential subscriber to external dhcp server.
4519 4. Verify that subscriber get ip from external dhcp server. successfully.
4520 5. Disable onu port which is being detected in voltha CLI.
4521 6. Repeat step 3.
4522 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4523 8. Enable onu port which is being detected in voltha CLI.
4524 9. Repeat steps 3 and 4.
4525 """
4526
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004527 def test_two_subscribers_with_voltha_for_dhcprelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004528 """
4529 Test Method:
4530 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4531 1. OLT and ONU is detected and validated.
4532 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4533 3. Send dhcp request from two residential subscribers to external dhcp server.
4534 4. Verify that subscribers had got different ips from external dhcp server. successfully.
4535 """
4536
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004537 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004538 """
4539 Test Method:
4540 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4541 1. OLT and ONU is detected and validated.
4542 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4543 3. Send dhcp request from two residential subscribers to external dhcp server.
4544 4. Verify that subscribers had got ip from external dhcp server. successfully.
4545 5. Repeat step 3 and 4 for 10 times for both subscribers.
4546 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
4547 """
4548
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004549 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004550 """
4551 Test Method:
4552 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4553 1. OLT and ONU is detected and validated.
4554 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4555 3. Send dhcp request from two residential subscribers to external dhcp server.
4556 4. Verify that subscribers had got ip from external dhcp server. successfully.
4557 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
4558 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
4559 """
4560
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004561 def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004562 """
4563 Test Method:
4564 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4565 1. OLT and ONU is detected and validated.
4566 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4567 3. Send dhcp request from one residential subscriber to external dhcp server.
4568 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
4569 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
4570 """
4571
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004572 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 +00004573 """
4574 Test Method:
4575 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4576 1. OLT and ONU is detected and validated.
4577 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4578 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
4579 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
4580 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
4581 """
4582
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004583 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004584 """
4585 Test Method:
4586 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4587 1. OLT and ONU is detected and validated.
4588 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4589 3. Send dhcp request from two residential subscribers to external dhcp server.
4590 4. Verify that subscribers had got ip from external dhcp server. successfully.
4591 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4592 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4593 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4594 """
4595
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004596 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004597 """
4598 Test Method:
4599 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4600 1. OLT and ONU is detected and validated.
4601 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4602 3. Send dhcp request from two residential subscribers to external dhcp server.
4603 4. Verify that subscribers had got ip from external dhcp server. successfully.
4604 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4605 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4606 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4607 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
4608 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
4609 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4610 """
4611
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004612 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004613 """
4614 Test Method:
4615 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4616 1. OLT and ONU is detected and validated.
4617 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4618 3. Send dhcp request from two residential subscribers to external dhcp server.
4619 4. Verify that subscribers had got ip from external dhcp server. successfully.
4620 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4621 6. Disable the olt device which is detected in voltha.
4622 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4623 """
4624
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004625 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004626 """
4627 Test Method:
4628 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4629 1. OLT and ONU is detected and validated.
4630 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4631 3. Send dhcp request from two residential subscribers to external dhcp server.
4632 4. Verify that subscribers had got ip from external dhcp server. successfully.
4633 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4634 6. Disable the olt device which is detected in voltha.
4635 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4636 8. Enable the olt device which is detected in voltha.
4637 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4638 """
4639
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004640 def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004641 """
4642 Test Method:
4643 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4644 1. OLT and ONU is detected and validated.
4645 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4646 3. Send dhcp request from two residential subscribers to external dhcp server.
4647 4. Verify that subscribers had got ip from external dhcp server. successfully.
4648 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4649 6. Pause the olt device which is detected in voltha.
4650 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4651 """
Thangavelu K S36edb012017-07-05 18:24:12 +00004652
Thangavelu K S6432b522017-07-22 00:05:54 +00004653 def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004654 """
4655 Test Method:
4656 0. Make sure that voltha is up and running on CORD-POD setup.
4657 1. OLT and ONU is detected and validated.
4658 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4659 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4660 4. Send igmp joins for a multicast group address multi-group-addressA.
4661 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4662 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4663 """
4664
Thangavelu K S8e413082017-07-13 20:02:14 +00004665 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4666 num_subscribers = 1
4667 num_channels = 1
4668 services = ('IGMP')
4669 cbs = (self.igmp_flow_check, None, None)
4670 self.voltha_subscribers(services, cbs = cbs,
4671 num_subscribers = num_subscribers,
4672 num_channels = num_channels)
4673
Thangavelu K S6432b522017-07-22 00:05:54 +00004674 def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004675 """
4676 Test Method:
4677 0. Make sure that voltha is up and running on CORD-POD setup.
4678 1. OLT and ONU is detected and validated.
4679 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4680 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4681 4. Send igmp joins for a multicast group address multi-group-addressA.
4682 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4683 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4684 7. Send igmp leave for a multicast group address multi-group-addressA.
4685 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4686 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004687 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4688 num_subscribers = 1
4689 num_channels = 1
4690 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004691 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00004692 self.voltha_subscribers(services, cbs = cbs,
4693 num_subscribers = num_subscribers,
4694 num_channels = num_channels)
4695
Thangavelu K S6432b522017-07-22 00:05:54 +00004696 def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004697 """
4698 Test Method:
4699 0. Make sure that voltha is up and running on CORD-POD setup.
4700 1. OLT and ONU is detected and validated.
4701 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4702 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4703 4. Send igmp joins for a multicast group address multi-group-addressA.
4704 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4705 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4706 7. Send igmp leave for a multicast group address multi-group-addressA.
4707 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4708 9. Repeat steps 4 to 6.
4709 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004710 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4711 num_subscribers = 1
4712 num_channels = 1
4713 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004714 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00004715 self.voltha_subscribers(services, cbs = cbs,
4716 num_subscribers = num_subscribers,
4717 num_channels = num_channels)
4718
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004719 def test_subscriber_with_voltha_for_igmp_5_groups_joins_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004720 """
4721 Test Method:
4722 0. Make sure that voltha is up and running on CORD-POD setup.
4723 1. OLT and ONU is detected and validated.
4724 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4725 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4726 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4727 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4728 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4729 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004730 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4731 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004732 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00004733 services = ('IGMP')
4734 cbs = (self.igmp_flow_check, None, None)
4735 self.voltha_subscribers(services, cbs = cbs,
4736 num_subscribers = num_subscribers,
4737 num_channels = num_channels)
4738
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004739 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 +00004740 """
4741 Test Method:
4742 0. Make sure that voltha is up and running on CORD-POD setup.
4743 1. OLT and ONU is detected and validated.
4744 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4745 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4746 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4747 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4748 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4749 7. Send igmp leave for a multicast group address multi-group-addressA.
4750 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.
4751 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester.
4752 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004753 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4754 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004755 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00004756 services = ('IGMP')
4757 cbs = (self.igmp_flow_check, None, None)
4758 self.voltha_subscribers(services, cbs = cbs,
4759 num_subscribers = num_subscribers,
4760 num_channels = num_channels)
4761
Thangavelu K S6432b522017-07-22 00:05:54 +00004762 def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004763 """
4764 Test Method:
4765 0. Make sure that voltha is up and running on CORD-POD setup.
4766 1. OLT and ONU is detected and validated.
4767 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4768 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4769 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4770 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4771 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4772 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4773 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4774 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004775 num_subscribers = 1
4776 num_channels = 1
4777 services = ('IGMP')
4778 cbs = (self.igmp_flow_check, None, None)
4779 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4780 num_subscribers = num_subscribers,
4781 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004782
Thangavelu K S6432b522017-07-22 00:05:54 +00004783 def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004784 """
4785 Test Method:
4786 0. Make sure that voltha is up and running on CORD-POD setup.
4787 1. OLT and ONU is detected and validated.
4788 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4789 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4790 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4791 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4792 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4793 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA
4794 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4795 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4796 """
4797
Thangavelu K S8e413082017-07-13 20:02:14 +00004798 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00004799 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00004800 services = ('IGMP')
4801 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4802 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4803 num_subscribers = num_subscribers,
4804 num_channels = num_channels)
4805
Thangavelu K S6432b522017-07-22 00:05:54 +00004806 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 +00004807 """
4808 Test Method:
4809 0. Make sure that voltha is up and running on CORD-POD setup.
4810 1. OLT and ONU is detected and validated.
4811 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4812 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4813 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4814 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4815 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4816 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA
4817 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4818 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4819 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004820 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00004821 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00004822 services = ('IGMP')
4823 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4824 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4825 num_subscribers = num_subscribers,
4826 num_channels = num_channels)
4827
Thangavelu K S6432b522017-07-22 00:05:54 +00004828 def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004829 """
4830 Test Method:
4831 0. Make sure that voltha is up and running on CORD-POD setup.
4832 1. OLT and ONU is detected and validated.
4833 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4834 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4835 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4836 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4837 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4838 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA
4839 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4840 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4841 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004842
4843 num_subscribers = 1
4844 num_channels = 1
4845 services = ('IGMP')
4846 cbs = (self.igmp_flow_check_join_change_to_block, None, None)
4847 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4848 num_subscribers = num_subscribers,
4849 num_channels = num_channels)
4850
Thangavelu K S6432b522017-07-22 00:05:54 +00004851 def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004852 """
4853 Test Method:
4854 0. Make sure that voltha is up and running on CORD-POD setup.
4855 1. OLT and ONU is detected and validated.
4856 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4857 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4858 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4859 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4860 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4861 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB
4862 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4863 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4864 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004865
4866 num_subscribers = 1
4867 num_channels = 1
4868 services = ('IGMP')
4869 cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None)
4870 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4871 num_subscribers = num_subscribers,
4872 num_channels = num_channels)
4873
Thangavelu K S6432b522017-07-22 00:05:54 +00004874 def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004875 """
4876 Test Method:
4877 0. Make sure that voltha is up and running on CORD-POD setup.
4878 1. OLT and ONU is detected and validated.
4879 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4880 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4881 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4882 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4883 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4884 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4885 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4886 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004887
4888 num_subscribers = 1
4889 num_channels = 1
4890 services = ('IGMP')
4891 cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None)
4892 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4893 num_subscribers = num_subscribers,
4894 num_channels = num_channels)
4895
Thangavelu K S6432b522017-07-22 00:05:54 +00004896 def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004897 """
4898 Test Method:
4899 0. Make sure that voltha is up and running on CORD-POD setup.
4900 1. OLT and ONU is detected and validated.
4901 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4902 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4903 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4904 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4905 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4906 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4907 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4908 """
4909
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004910 num_subscribers = 1
4911 num_channels = 1
4912 services = ('IGMP')
4913 cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None)
4914 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4915 num_subscribers = num_subscribers,
4916 num_channels = num_channels)
4917
Thangavelu K S6432b522017-07-22 00:05:54 +00004918 def test_two_subscribers_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004919 """
4920 Test Method:
4921 0. Make sure that voltha is up and running on CORD-POD setup.
4922 1. OLT and ONU is detected and validated.
4923 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4924 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4925 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4926 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4927 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4928 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4929 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4930 """
4931
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004932 num_subscribers = 2
4933 num_channels = 1
4934 services = ('IGMP')
4935 cbs = (self.igmp_flow_check, None, None)
4936 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'],
4937 num_subscribers = num_subscribers,
4938 num_channels = num_channels)
4939
Thangavelu K S36edb012017-07-05 18:24:12 +00004940 def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self):
4941 """
4942 Test Method:
4943 0. Make sure that voltha is up and running on CORD-POD setup.
4944 1. OLT and ONU is detected and validated.
4945 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4946 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4947 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4948 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4949 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4950 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4951 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4952 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4953 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4954 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4955 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004956 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00004957 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004958 services = ('IGMP')
4959 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4960 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'],
4961 num_subscribers = num_subscribers,
4962 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004963
Thangavelu K S6432b522017-07-22 00:05:54 +00004964 def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004965 """
4966 Test Method:
4967 0. Make sure that voltha is up and running on CORD-POD setup.
4968 1. OLT and ONU is detected and validated.
4969 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4970 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4971 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4972 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4973 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4974 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.
4975 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.
4976 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4977 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.
4978 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.
4979 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.
4980 """
4981
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004982 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00004983 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004984 services = ('IGMP')
4985 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4986 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'],
4987 num_subscribers = num_subscribers,
4988 num_channels = num_channels)
4989
4990 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00004991 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 +00004992 """
4993 Test Method:
4994 0. Make sure that voltha is up and running on CORD-POD setup.
4995 1. OLT and ONU is detected and validated.
4996 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4997 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4998 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4999 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5000 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5001 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5002 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5003 9. Disable uni_2 port which is being shown on voltha CLI.
5004 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5005 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5006 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005007 #rx_port = self.port_map['ports'][port_list[i][1]]
5008 df = defer.Deferred()
5009 def igmp_flow_check_operating_onu_admin_state(df):
5010 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005011 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005012 services = ('IGMP')
5013 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5014 port_list = self.generate_port_list(num_subscribers, num_channels)
5015
Thangavelu K S9a637332017-08-01 23:22:23 +00005016 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 +00005017 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5018 thread1.start()
5019 time.sleep(randint(40,50))
5020 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
5021 thread2.start()
5022 time.sleep(10)
5023 thread1.join()
5024 thread2.join()
5025 try:
5026 assert_equal(self.success, False)
5027 log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check')
5028 time.sleep(10)
5029 finally:
5030 pass
5031 df.callback(0)
5032 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5033 return df
5034
5035 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00005036 def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self):
5037 """
5038 Test Method:
5039 0. Make sure that voltha is up and running on CORD-POD setup.
5040 1. OLT and ONU is detected and validated.
5041 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5042 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5043 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5044 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5045 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5046 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5047 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5048 9. Disable uni_2 port which is being shown on voltha CLI.
5049 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5050 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5051 12. Enable uni_2 port which we disable at step 9.
5052 13. Repeat step 5,6 and 8.
5053 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005054 df = defer.Deferred()
5055 def igmp_flow_check_operating_onu_admin_state(df):
5056 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005057 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005058 services = ('IGMP')
5059 cbs = (self.igmp_flow_check, None, None)
5060 port_list = self.generate_port_list(num_subscribers, num_channels)
5061
Thangavelu K S9a637332017-08-01 23:22:23 +00005062 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 +00005063 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5064 thread1.start()
5065 time.sleep(randint(50,60))
5066 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
5067 thread2.start()
5068 time.sleep(10)
5069 thread1.join()
5070 thread2.join()
5071 try:
5072 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005073 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 +00005074 time.sleep(10)
5075 finally:
5076 pass
5077 df.callback(0)
5078 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5079 return df
5080
5081 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005082 def test_two_subscribers_with_voltha_for_igmp_disabling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005083 """
5084 Test Method:
5085 0. Make sure that voltha is up and running on CORD-POD setup.
5086 1. OLT and ONU is detected and validated.
5087 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5088 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5089 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5090 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5091 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5092 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5093 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5094 9. Disable olt device which is being shown on voltha CLI.
5095 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5096 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5097 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005098 df = defer.Deferred()
5099 def igmp_flow_check_operating_olt_admin_disble(df):
5100 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005101 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005102 services = ('IGMP')
5103 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5104 port_list = self.generate_port_list(num_subscribers, num_channels)
5105
Thangavelu K S9a637332017-08-01 23:22:23 +00005106 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 +00005107 thread1.start()
5108 time.sleep(randint(50,60))
5109 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5110 thread2.start()
5111 time.sleep(10)
5112 thread1.join()
5113 thread2.join()
5114 try:
5115 assert_equal(self.success, False)
5116 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5117 time.sleep(10)
5118 finally:
5119 pass
5120 df.callback(0)
5121 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5122 return df
5123
5124 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005125 def test_two_subscribers_with_voltha_for_igmp_pausing_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005126 """
5127 Test Method:
5128 0. Make sure that voltha is up and running on CORD-POD setup.
5129 1. OLT and ONU is detected and validated.
5130 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5131 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5132 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5133 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5134 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5135 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5136 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5137 9. Pause olt device which is being shown on voltha CLI.
5138 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5139 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5140 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005141 df = defer.Deferred()
5142 def igmp_flow_check_operating_olt_admin_pause(df):
5143 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005144 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005145 services = ('IGMP')
5146 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5147 port_list = self.generate_port_list(num_subscribers, num_channels)
5148
Thangavelu K S9a637332017-08-01 23:22:23 +00005149 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 +00005150 thread1.start()
5151 time.sleep(randint(50,60))
5152 thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,))
5153 thread2.start()
5154 time.sleep(10)
5155 thread1.join()
5156 thread2.join()
5157 try:
5158 assert_equal(self.success, False)
5159 log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test')
5160 time.sleep(10)
5161 finally:
5162 pass
5163 df.callback(0)
5164 reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df)
5165 return df
5166
5167 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005168 def test_two_subscribers_with_voltha_for_igmp_toggling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005169 """
5170 Test Method:
5171 0. Make sure that voltha is up and running on CORD-POD setup.
5172 1. OLT and ONU is detected and validated.
5173 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5174 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5175 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5176 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5177 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5178 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5179 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5180 9. Disable olt device which is being shown on voltha CLI.
5181 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5182 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5183 12. Enable olt device which is disable at step 9.
5184 13. Repeat steps 4,5, 7 and 8.
5185 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005186 df = defer.Deferred()
5187 def igmp_flow_check_operating_olt_admin_restart(df):
5188 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005189 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005190 services = ('IGMP')
5191 cbs = (self.igmp_flow_check, None, None)
5192 port_list = self.generate_port_list(num_subscribers, num_channels)
5193
Thangavelu K S9a637332017-08-01 23:22:23 +00005194 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 +00005195 thread1.start()
5196 time.sleep(randint(50,60))
5197 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5198 thread2.start()
5199 time.sleep(10)
5200 thread1.join()
5201 thread2.join()
5202 try:
5203 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005204 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 +00005205 time.sleep(10)
5206 finally:
5207 pass
5208 df.callback(0)
5209 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5210 return df
Thangavelu K S6432b522017-07-22 00:05:54 +00005211
5212 @deferred(TESTCASE_TIMEOUT)
5213 def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self):
5214 """
5215 Test Method:
5216 0. Make sure that voltha is up and running on CORD-POD setup.
5217 1. OLT and ONU is detected and validated.
5218 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5219 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5220 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5221 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5222 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5223 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5224 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5225 9. Disable olt device which is being shown on voltha CLI.
5226 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5227 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5228 12. Repeat steps 4 to 11 steps multiple times (example 20 times)
5229 """
5230 df = defer.Deferred()
5231 no_iterations = 20
5232 def igmp_flow_check_operating_olt_admin_disble(df):
5233 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005234 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005235 services = ('IGMP')
5236 cbs = (self.igmp_flow_check, None, None)
5237 port_list = self.generate_port_list(num_subscribers, num_channels)
5238
Thangavelu K S9a637332017-08-01 23:22:23 +00005239 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 +00005240 thread1.start()
5241 time.sleep(randint(30,40))
5242 for i in range(no_iterations):
5243 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5244 thread2.start()
5245 time.sleep(8)
5246 thread2.join()
5247 thread1.join()
5248 thread1.isAlive()
5249 thread2.join()
5250 try:
5251 assert_equal(self.success, False)
5252 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5253 time.sleep(10)
5254 finally:
5255 pass
5256 df.callback(0)
5257 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5258 return df
5259
5260 @deferred(TESTCASE_TIMEOUT + 200)
5261 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self):
5262 """
5263 Test Method:
5264 0. Make sure that voltha is up and running on CORD-POD setup.
5265 1. OLT and ONU is detected and validated.
5266 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5267 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5268 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5269 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5270 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5271 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5272 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5273 9. Disable uni_2 port which is being shown on voltha CLI.
5274 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5275 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5276 12. Enable uni_2 port which we disable at step 9.
5277 13. Repeat step 5,6 and 8.
5278 14. Repeat steps 4 to 13 steps multiple times (example 5 times)
5279 """
5280 df = defer.Deferred()
5281 no_iterations = 5
5282 def igmp_flow_check_operating_onu_admin_state(df):
5283 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005284 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005285 services = ('IGMP')
5286 cbs = (self.igmp_flow_check, None, None)
5287 port_list = self.generate_port_list(num_subscribers, num_channels)
5288
Thangavelu K S9a637332017-08-01 23:22:23 +00005289 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 +00005290 thread1.start()
5291 time.sleep(randint(40,60))
5292 for i in range(no_iterations):
5293 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5294 log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha')
5295 thread2.start()
5296 time.sleep(1)
5297 thread2.join()
5298 thread1.isAlive()
5299 thread1.join()
5300 thread2.join()
5301 try:
5302 assert_equal(self.success, True)
5303 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful')
5304 time.sleep(10)
5305 finally:
5306 pass
5307 df.callback(0)
5308 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5309 return df
5310
5311 @deferred(TESTCASE_TIMEOUT)
5312 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self):
5313 """
5314 Test Method:
5315 0. Make sure that voltha is up and running on CORD-POD setup.
5316 1. OLT and ONU is detected and validated.
5317 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5318 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5319 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5320 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5321 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5322 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5323 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5324 9. Disable olt device which is being shown on voltha CLI.
5325 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5326 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5327 12. Enable olt device which is disable at step 9.
5328 13. Repeat steps 4,5, 7 and 8.
5329 14. Repeat steps 4 to 13 steps multiple times (example 10 times)
5330 """
5331 df = defer.Deferred()
5332 no_iterations = 10
5333 def igmp_flow_check_operating_olt_admin_restart(df):
5334 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005335 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005336 services = ('IGMP')
5337 cbs = (self.igmp_flow_check, None, None)
5338 port_list = self.generate_port_list(num_subscribers, num_channels)
5339
Thangavelu K S9a637332017-08-01 23:22:23 +00005340 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 +00005341 thread1.start()
5342 time.sleep(randint(50,60))
5343 for i in range(no_iterations):
5344 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5345 thread2.start()
5346 time.sleep(10)
5347 thread2.join()
5348 thread1.join()
5349 thread2.join()
5350 try:
5351 assert_equal(self.success, True)
5352 log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful')
5353 time.sleep(10)
5354 finally:
5355 pass
5356 df.callback(0)
5357 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5358 return df
5359
5360 def test_5_subscriber_with_voltha_for_igmp_with_10_group_joins_verifying_traffic(self):
5361 """
5362 Test Method:
5363 0. Make sure that voltha is up and running on CORD-POD setup.
5364 1. OLT and ONU is detected and validated.
5365 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5366 3. Issue multiple dhcp client packets to get IP address from dhcp server for as subscribers and check connectivity.
5367 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5368 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5369 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5370 """
5371
5372 num_subscribers = 5
5373 num_channels = 10
5374 services = ('IGMP')
5375 cbs = (self.igmp_flow_check, None, None)
5376 self.voltha_subscribers(services, cbs = cbs,
5377 num_subscribers = num_subscribers,
5378 num_channels = num_channels)
5379
5380 def test_9_subscriber_with_voltha_for_igmp_with_10_group_joins_and_verify_traffic(self):
5381 """
5382 Test Method:
5383 0. Make sure that voltha is up and running on CORD-POD setup.
5384 1. OLT and ONU is detected and validated.
5385 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5386 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity.
5387 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5388 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5389 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5390 """
5391 num_subscribers = 9
5392 num_channels = 10
5393 services = ('IGMP')
5394 cbs = (self.igmp_flow_check, None, None)
5395 self.voltha_subscribers(services, cbs = cbs,
5396 num_subscribers = num_subscribers,
5397 num_channels = num_channels)