blob: ff4b1b0b3e54cdce7cca61e2de834d860cd99a9a [file] [log] [blame]
Matteo Scandolo48d3d2d2017-08-08 13:05:27 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
A R Karthick35495c32017-05-11 14:58:32 -070017import os
18import sys
19import unittest
Thangavelu K Sb006b8a2017-07-28 19:29:39 +000020import time, monotonic
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000021import json
22import requests
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +000023import threading
Thangavelu K S8e413082017-07-13 20:02:14 +000024from IGMP import *
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +000025from random import randint
26from threading import Timer
Thangavelu K S36edb012017-07-05 18:24:12 +000027from threadPool import ThreadPool
A R Karthick35495c32017-05-11 14:58:32 -070028from nose.tools import *
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000029from nose.twistedtools import reactor, deferred
30from twisted.internet import defer
A R Karthick9dc6e922017-07-12 14:40:16 -070031from CordTestConfig import setup_module, teardown_module
A R Karthick35495c32017-05-11 14:58:32 -070032from CordTestUtils import log_test
A R Karthickcaa1b6a2017-07-27 14:07:05 -070033from VolthaCtrl import VolthaCtrl, voltha_setup, voltha_teardown
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000034from CordTestUtils import log_test, get_controller
35from portmaps import g_subscriber_port_map
36from OltConfig import *
37from EapTLS import TLSAuthTest
Thangavelu K S8e413082017-07-13 20:02:14 +000038from Channels import Channels, IgmpChannel
39from Stats import Stats
Thangavelu K Sa1c71b42017-06-14 18:13:21 +000040from DHCP import DHCPTest
Thangavelu K S77c8c0c2017-06-07 18:04:21 +000041from OnosCtrl import OnosCtrl
42from CordLogger import CordLogger
43from scapy.all import *
44from scapy_ssl_tls.ssl_tls import *
45from scapy_ssl_tls.ssl_tls_crypto import *
46from CordTestServer import cord_test_onos_restart, cord_test_shell, cord_test_radius_restart
A.R Karthickb9eab5a2017-06-07 16:03:51 -070047from CordContainer import Onos
A R Karthick35495c32017-05-11 14:58:32 -070048
Thangavelu K S36edb012017-07-05 18:24:12 +000049
Thangavelu K S8e413082017-07-13 20:02:14 +000050class Voltha_olt_subscribers(Channels):
Thangavelu K S36edb012017-07-05 18:24:12 +000051
Thangavelu K Sb006b8a2017-07-28 19:29:39 +000052 STATS_RX = 0
53 STATS_TX = 1
Thangavelu K S8e413082017-07-13 20:02:14 +000054 STATS_JOIN = 2
55 STATS_LEAVE = 3
56
Thangavelu K S8e413082017-07-13 20:02:14 +000057 def __init__(self, tx_port, rx_port, num_channels =1, channel_start = 0, src_list = None):
58 self.tx_port = tx_port
59 self.rx_port = rx_port
60 self.src_list = src_list
Thangavelu K Sb006b8a2017-07-28 19:29:39 +000061 self.num_channels = num_channels
Thangavelu K S36edb012017-07-05 18:24:12 +000062 try:
Thangavelu K S8e413082017-07-13 20:02:14 +000063 self.tx_intf = tx_port
64 self.rx_intf = rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +000065 except:
66 self.tx_intf = self.INTF_TX_DEFAULT
67 self.rx_intf = self.INTF_RX_DEFAULT
Thangavelu K S8e413082017-07-13 20:02:14 +000068# num = 1
69# channel_start = 0
Thangavelu K S36edb012017-07-05 18:24:12 +000070 mcast_cb = None
Thangavelu K S8e413082017-07-13 20:02:14 +000071 Channels.__init__(self, num_channels, channel_start = channel_start, src_list = src_list,
Thangavelu K S36edb012017-07-05 18:24:12 +000072 iface = self.rx_intf, iface_mcast = self.tx_intf, mcast_cb = mcast_cb)
73
Thangavelu K S8e413082017-07-13 20:02:14 +000074 self.loginType = 'wireless'
Thangavelu K S36edb012017-07-05 18:24:12 +000075 ##start streaming channels
76 self.join_map = {}
77 ##accumulated join recv stats
78 self.join_rx_stats = Stats()
79 self.recv_timeout = False
80
81
82 def channel_join_update(self, chan, join_time):
83 self.join_map[chan] = ( Stats(), Stats(), Stats(), Stats() )
84 self.channel_update(chan, self.STATS_JOIN, 1, t = join_time)
85
Thangavelu K S8e413082017-07-13 20:02:14 +000086 def channel_join(self, chan = 0, delay = 2, src_list = None, record_type = None):
Thangavelu K S36edb012017-07-05 18:24:12 +000087 '''Join a channel and create a send/recv stats map'''
88 if self.join_map.has_key(chan):
89 del self.join_map[chan]
90 self.delay = delay
Thangavelu K S8e413082017-07-13 20:02:14 +000091 chan, join_time = self.join(chan, src_list = src_list, record_type = record_type)
92 #chan, join_time = self.join(chan)
Thangavelu K S36edb012017-07-05 18:24:12 +000093 self.channel_join_update(chan, join_time)
94 return chan
95
Thangavelu K Sb006b8a2017-07-28 19:29:39 +000096 def channel_join_next(self, delay = 2, src_list = None, leave_flag = True):
Thangavelu K S36edb012017-07-05 18:24:12 +000097 '''Joins the next channel leaving the last channel'''
98 if self.last_chan:
99 if self.join_map.has_key(self.last_chan):
100 del self.join_map[self.last_chan]
101 self.delay = delay
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000102 chan, join_time = self.join_next(src_list = src_list, leave_flag = leave_flag)
Thangavelu K S36edb012017-07-05 18:24:12 +0000103 self.channel_join_update(chan, join_time)
104 return chan
105
106 def channel_jump(self, delay = 2):
107 '''Jumps randomly to the next channel leaving the last channel'''
108 if self.last_chan is not None:
109 if self.join_map.has_key(self.last_chan):
110 del self.join_map[self.last_chan]
111 self.delay = delay
112 chan, join_time = self.jump()
113 self.channel_join_update(chan, join_time)
114 return chan
115
Thangavelu K S8e413082017-07-13 20:02:14 +0000116 def channel_leave(self, chan = 0, force = False, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +0000117 if self.join_map.has_key(chan):
118 del self.join_map[chan]
Thangavelu K S8e413082017-07-13 20:02:14 +0000119 self.leave(chan, force = force, src_list = src_list)
Thangavelu K S36edb012017-07-05 18:24:12 +0000120
121 def channel_update(self, chan, stats_type, packets, t=0):
122 if type(chan) == type(0):
123 chan_list = (chan,)
124 else:
125 chan_list = chan
126 for c in chan_list:
127 if self.join_map.has_key(c):
128 self.join_map[c][stats_type].update(packets = packets, t = t)
129
Thangavelu K S8e413082017-07-13 20:02:14 +0000130 def channel_receive(self, chan, cb = None, count = 1, timeout = 5, src_list = None):
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000131 log_test.info('Subscriber on port %s checking data traffic receiving from group %s, channel %d' %
Thangavelu K S8e413082017-07-13 20:02:14 +0000132 (self.rx_intf, self.gaddr(chan), chan))
133 r = self.recv(chan, cb = cb, count = count, timeout = timeout, src_list = src_list)
Thangavelu K S36edb012017-07-05 18:24:12 +0000134 if len(r) == 0:
Thangavelu K S8e413082017-07-13 20:02:14 +0000135 log_test.info('Subscriber on port %s timed out' %( self.rx_intf))
136 self.test_status = False
Thangavelu K S36edb012017-07-05 18:24:12 +0000137 else:
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000138 self.test_status = True
139 pass
140# log_test.info('Subscriber on port %s received %d packets' %(self.rx_intf, len(r)))
Thangavelu K S36edb012017-07-05 18:24:12 +0000141 if self.recv_timeout:
142 ##Negative test case is disabled for now
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000143 log_test.info('Subscriber on port %s not received %d packets' %(self.rx_intf, len(r)))
Thangavelu K S36edb012017-07-05 18:24:12 +0000144 assert_equal(len(r), 0)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000145 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000146 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +0000147
Thangavelu K S9a637332017-08-01 23:22:23 +0000148 def channel_not_receive(self, chan, cb = None, count = 1, timeout = 5, src_list = None):
149 log_test.info('Subscriber on port %s checking data traffic receiving from group %s, channel %d' %
150 (self.rx_intf, self.gaddr(chan), chan))
151 r = self.not_recv(chan, cb = cb, count = count, timeout = timeout, src_list = src_list)
152 if len(r) == 0:
153 log_test.info('Subscriber on port %s timed out' %( self.rx_intf))
154 self.test_status = True
155 else:
156 self.test_status = False
157 pass
158# log_test.info('Subscriber on port %s received %d packets' %(self.rx_intf, len(r)))
159 if self.recv_timeout:
160 ##Negative test case is disabled for now
161 log_test.info('Subscriber on port %s not received %d packets' %(self.rx_intf, len(r)))
162 assert_equal(len(r), 0)
163 self.test_status = True
164 return self.test_status
165
166
Thangavelu K S8e413082017-07-13 20:02:14 +0000167 def recv_channel_cb(self, pkt, src_list = None):
168
Thangavelu K S36edb012017-07-05 18:24:12 +0000169 ##First verify that we have received the packet for the joined instance
Thangavelu K S9a637332017-08-01 23:22:23 +0000170 log_test.info('Packet received for group %s, subscriber, port %s and from source ip %s showing full packet %s'%
171 (pkt[IP].dst, self.rx_intf, pkt[IP].src, pkt.show))
172 if src_list is not None:
173 for i in src_list:
174 if pkt[IP].src == src_list[i]:
175 pass
176 else:
177 log_test.info('Packet received for group %s, subscriber, port %s and from source ip %s which is not expcted on that port'%
178 (pkt[IP].dst, self.rx_intf, pkt[IP].src))
179
180 self.recv_timeout = True
181
Thangavelu K S36edb012017-07-05 18:24:12 +0000182 if self.recv_timeout:
183 return
184 chan = self.caddr(pkt[IP].dst)
185 assert_equal(chan in self.join_map.keys(), True)
186 recv_time = monotonic.monotonic() * 1000000
187 join_time = self.join_map[chan][self.STATS_JOIN].start
188 delta = recv_time - join_time
189 self.join_rx_stats.update(packets=1, t = delta, usecs = True)
190 self.channel_update(chan, self.STATS_RX, 1, t = delta)
191 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
192
Thangavelu K S36edb012017-07-05 18:24:12 +0000193class voltha_subscriber_pool:
194
195 def __init__(self, subscriber, test_cbs):
196 self.subscriber = subscriber
197 self.test_cbs = test_cbs
198
199 def pool_cb(self):
200 for cb in self.test_cbs:
201 if cb:
Thangavelu K S8e413082017-07-13 20:02:14 +0000202 self.test_status = cb(self.subscriber, multiple_sub = True)
Thangavelu K S36edb012017-07-05 18:24:12 +0000203 if self.test_status is not True:
Thangavelu K S6432b522017-07-22 00:05:54 +0000204 ## This is chaining for other sub status has to check again
Thangavelu K S36edb012017-07-05 18:24:12 +0000205 self.test_status = True
206 log_test.info('This service is failed and other services will not run for this subscriber')
207 break
208 log_test.info('This Subscriber is tested for multiple service eligibility ')
209 self.test_status = True
210
A R Karthick35495c32017-05-11 14:58:32 -0700211class voltha_exchange(unittest.TestCase):
212
213 OLT_TYPE = 'tibit_olt'
214 OLT_MAC = '00:0c:e2:31:12:00'
215 VOLTHA_HOST = 'localhost'
216 VOLTHA_REST_PORT = 8881
Thangavelu K S36edb012017-07-05 18:24:12 +0000217 VOLTHA_OLT_TYPE = 'ponsim_olt'
218 VOLTHA_OLT_MAC = '00:0c:e2:31:12:00'
219 VOLTHA_IGMP_ITERATIONS = 100
A R Karthick35495c32017-05-11 14:58:32 -0700220 voltha = None
A R Karthick53442712017-07-27 12:23:30 -0700221 voltha_attrs = None
Thangavelu K S9648eed2017-06-13 20:15:25 +0000222 success = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000223 olt_device_id = None
Thangavelu K S6432b522017-07-22 00:05:54 +0000224 apps = ('org.opencord.aaa', 'org.onosproject.dhcp', 'org.onosproject.dhcprelay')
225 app_dhcp = ('org.onosproject.dhcp')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000226 olt_apps = () #'org.opencord.cordmcast')
227 vtn_app = 'org.opencord.vtn'
228 table_app = 'org.ciena.cordigmp'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000229 test_path = os.path.dirname(os.path.realpath(__file__))
230 table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700231 app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000232 olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar')
A.R Karthick3493a572017-06-07 18:28:10 -0700233 olt_app_name = 'org.onosproject.olt'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000234 #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
235 olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
236 onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
A R Karthick9dc6e922017-07-12 14:40:16 -0700237 VOLTHA_AUTO_CONFIGURE = False
Thangavelu K S8e413082017-07-13 20:02:14 +0000238 num_joins = 0
239
Thangavelu K S6432b522017-07-22 00:05:54 +0000240 relay_interfaces_last = ()
241 interface_to_mac_map = {}
242 host_ip_map = {}
243 default_config = { 'default-lease-time' : 600, 'max-lease-time' : 7200, }
244 default_options = [ ('subnet-mask', '255.255.255.0'),
245 ('broadcast-address', '192.168.1.255'),
246 ('domain-name-servers', '192.168.1.1'),
247 ('domain-name', '"mydomain.cord-tester"'),
248 ]
249 ##specify the IP for the dhcp interface matching the subnet and subnet config
250 ##this is done for each interface dhcpd server would be listening on
251 default_subnet_config = [ ('192.168.1.2',
252'''
253subnet 192.168.1.0 netmask 255.255.255.0 {
254 range 192.168.1.10 192.168.1.100;
255}
256'''), ]
257
258
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000259 VOLTHA_ENABLED = True
260 INTF_TX_DEFAULT = 'veth2'
261 INTF_RX_DEFAULT = 'veth0'
Thangavelu K S9648eed2017-06-13 20:15:25 +0000262 INTF_2_RX_DEFAULT = 'veth6'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000263 TESTCASE_TIMEOUT = 300
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000264 VOLTHA_IGMP_ITERATIONS = 10
265# VOLTHA_CONFIG_FAKE = True
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000266 VOLTHA_CONFIG_FAKE = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000267 VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
A R Karthick53442712017-07-27 12:23:30 -0700268 VOLTHA_UPLINK_VLAN_START = 444
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000269 VOLTHA_ONU_UNI_PORT = 'veth0'
270
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000271 dhcp_server_config = {
272 "ip": "10.1.11.50",
273 "mac": "ca:fe:ca:fe:ca:fe",
274 "subnet": "255.255.252.0",
275 "broadcast": "10.1.11.255",
276 "router": "10.1.8.1",
277 "domain": "8.8.8.8",
278 "ttl": "63",
279 "delay": "2",
280 "startip": "10.1.11.51",
281 "endip": "10.1.11.100"
282 }
283
284
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000285 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
286MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
287CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
288IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
289RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
290MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
291BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
292hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
293gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
294+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
295rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
296VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
297eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
2986tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
299PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
300nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
301-----END CERTIFICATE-----"""
302
303 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
304MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
305CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
306IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
307RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
308MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
309BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
310hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
311AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
3125An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
313tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
314OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
315qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
3162Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
317BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
318eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
319MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
320VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
321RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
322dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
323T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
324yg==
325-----END CERTIFICATE-----'''
A R Karthick35495c32017-05-11 14:58:32 -0700326
A.R Karthick3493a572017-06-07 18:28:10 -0700327 @classmethod
328 def update_apps_version(cls):
329 version = Onos.getVersion()
330 major = int(version.split('.')[0])
331 minor = int(version.split('.')[1])
332 cordigmp_app_version = '2.0-SNAPSHOT'
333 olt_app_version = '1.2-SNAPSHOT'
334 if major > 1:
335 cordigmp_app_version = '3.0-SNAPSHOT'
336 olt_app_version = '2.0-SNAPSHOT'
337 elif major == 1:
338 if minor > 10:
339 cordigmp_app_version = '3.0-SNAPSHOT'
340 olt_app_version = '2.0-SNAPSHOT'
341 elif minor <= 8:
342 olt_app_version = '1.1-SNAPSHOT'
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700343 cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version))
344 cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version))
345 cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
346
A R Karthick35495c32017-05-11 14:58:32 -0700347 @classmethod
Thangavelu K S6432b522017-07-22 00:05:54 +0000348 def dhcprelay_setUpClass(cls):
349 ''' Activate the dhcprelay app'''
350 OnosCtrl(cls.app_dhcp).deactivate()
351 time.sleep(3)
352 cls.onos_ctrl = OnosCtrl('org.onosproject.dhcprelay')
353 status, _ = cls.onos_ctrl.activate()
354 assert_equal(status, True)
355 time.sleep(3)
356 cls.dhcp_relay_setup()
357 ##start dhcpd initially with default config
358 cls.dhcpd_start()
359
360 @classmethod
361 def dhcprelay_tearDownClass(cls):
362 '''Deactivate the dhcp relay app'''
363 try:
364 os.unlink('{}/dhcpd.conf'.format(cls.dhcp_data_dir))
365 os.unlink('{}/dhcpd.leases'.format(cls.dhcp_data_dir))
366 except: pass
367 cls.onos_ctrl.deactivate()
368 cls.dhcpd_stop()
369 cls.dhcp_relay_cleanup()
370
371 @classmethod
A.R Karthickf874d032017-06-07 18:47:51 -0700372 def onos_load_config(cls, app, config):
373 status, code = OnosCtrl.config(config)
374 if status is False:
375 log_test.info('JSON config request for app %s returned status %d' %(app, code))
376 assert_equal(status, True)
377 time.sleep(2)
378
379 @classmethod
380 def onos_aaa_load(cls):
381 aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
382 'radiusIp': '172.17.0.2' } } } }
383 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
384 aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip
385 cls.onos_load_config('org.opencord.aaa', aaa_dict)
386
387 @classmethod
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000388 def onos_dhcp_table_load(self, config = None):
389 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
390 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
391 if config:
392 for k in config.keys():
393 if dhcp_config.has_key(k):
394 dhcp_config[k] = config[k]
395 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
396
Thangavelu K S36edb012017-07-05 18:24:12 +0000397 def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = None):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000398 if validation:
Thangavelu K S735a6662017-06-15 18:08:23 +0000399 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
400 assert_not_equal(cip, None)
401 assert_not_equal(sip, None)
402 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
403 (cip, sip, dhcp.get_mac(cip)[0]))
404 if validation == False:
405 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
406 assert_equal(cip, None)
407 assert_equal(sip, None)
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000408 log_test.info('Dhcp client did not get IP from server')
Thangavelu K S735a6662017-06-15 18:08:23 +0000409
Thangavelu K S36edb012017-07-05 18:24:12 +0000410 if validation == 'skip':
411 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
412
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000413 return cip,sip
414
Thangavelu K S36edb012017-07-05 18:24:12 +0000415 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):
416 config = {'startip':startip, 'endip':'10.10.10.200',
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000417 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
418 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
419 self.onos_dhcp_table_load(config)
420 dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface)
Thangavelu K S36edb012017-07-05 18:24:12 +0000421 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed, validation = validation, mac = mac)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000422 return cip, sip
423
424 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700425 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700426 cls.update_apps_version()
A R Karthick53442712017-07-27 12:23:30 -0700427 cls.voltha_attrs = dict(host = cls.VOLTHA_HOST,
428 rest_port = cls.VOLTHA_REST_PORT,
429 uplink_vlan_map = cls.VOLTHA_UPLINK_VLAN_MAP,
430 uplink_vlan_start = cls.VOLTHA_UPLINK_VLAN_START)
431 cls.voltha = VolthaCtrl(**cls.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000432 cls.install_app_table()
433 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
434 cls.port_map, cls.port_list = cls.olt.olt_port_map()
435 cls.switches = cls.port_map['switches']
Thangavelu K S36edb012017-07-05 18:24:12 +0000436 cls.ponsim_ports = cls.port_map['ponsim']
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000437 cls.num_ports = cls.port_map['num_ports']
438 if cls.num_ports > 1:
439 cls.num_ports -= 1 ##account for the tx port
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000440 cls.activate_apps(cls.apps + cls.olt_apps, deactivate = True)
A.R Karthickf874d032017-06-07 18:47:51 -0700441 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000442
A.R Karthick3493a572017-06-07 18:28:10 -0700443 @classmethod
444 def tearDownClass(cls):
445 '''Deactivate the olt apps and restart OVS back'''
446 apps = cls.olt_apps + ( cls.table_app,)
447 for app in apps:
448 onos_ctrl = OnosCtrl(app)
449 onos_ctrl.deactivate()
450 cls.install_app_igmp()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000451 cord_test_radius_restart()
452
A.R Karthick3493a572017-06-07 18:28:10 -0700453 @classmethod
454 def install_app_igmp(cls):
455 ##Uninstall the table app on class exit
456 OnosCtrl.uninstall_app(cls.table_app)
457 time.sleep(2)
458 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
459 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700460
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000461 def remove_olt(self, switch_map):
462 controller = get_controller()
463 auth = ('karaf', 'karaf')
464 #remove 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 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
470 device,
471 port)
472 resp = requests.delete(rest_url, auth = auth)
473 if resp.status_code not in [204, 202, 200]:
474 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
475 else:
476 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
477 OnosCtrl.uninstall_app(self.olt_app_file)
478
479 def config_olt(self, switch_map):
480 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000481 auth = ('karaf', 'karaf')
482 #configure subscriber for every port on all the voltha devices
483 for device, device_map in switch_map.iteritems():
484 uni_ports = device_map['ports']
485 uplink_vlan = device_map['uplink_vlan']
486 for port in uni_ports:
487 vlan = port
488 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
489 device,
490 port,
491 vlan)
492 resp = requests.post(rest_url, auth = auth)
493 #assert_equal(resp.ok, True)
494
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000495 def voltha_uni_port_toggle(self, uni_port = None):
496 ## Admin state of port is down and up
497 if not uni_port:
498 uni_port = self.INTF_RX_DEFAULT
499 cmd = 'ifconfig {} down'.format(uni_port)
500 os.system(cmd)
501 log_test.info('Admin state of uni_port is down')
502 time.sleep(30)
503 cmd = 'ifconfig {} up'.format(uni_port)
504 os.system(cmd)
505 log_test.info('Admin state of uni_port is up now')
506 time.sleep(30)
507 return
508
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000509 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000510 def install_app_table(cls):
511 ##Uninstall the existing app if any
512 OnosCtrl.uninstall_app(cls.table_app)
513 time.sleep(2)
514 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
515 OnosCtrl.install_app(cls.table_app_file)
516 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000517
518 @classmethod
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000519 def activate_apps(cls, apps, deactivate = False):
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000520 for app in apps:
521 onos_ctrl = OnosCtrl(app)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000522 if deactivate is True:
523 onos_ctrl.deactivate()
524 time.sleep(2)
525 status, _ = onos_ctrl.activate()
526 assert_equal(status, True)
527 time.sleep(2)
528
529
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000530
Thangavelu K S735a6662017-06-15 18:08:23 +0000531 @classmethod
532 def deactivate_apps(cls, apps):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000533 cls.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000534 for app in apps:
535 onos_ctrl = OnosCtrl(app)
536 status, _ = onos_ctrl.deactivate()
537 if status is False:
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000538 cls.success = False
539 # assert_equal(status, True)
Thangavelu K S735a6662017-06-15 18:08:23 +0000540 time.sleep(2)
541
Thangavelu K S36edb012017-07-05 18:24:12 +0000542 def random_ip(self,start_ip = '10.10.10.20', end_ip = '10.10.10.65'):
543 start = list(map(int, start_ip.split(".")))
544 end = list(map(int, end_ip.split(".")))
545 temp = start
546 ip_range = []
547 ip_range.append(start_ip)
548 while temp != end:
549 start[3] += 1
550 for i in (3, 2, 1):
551 if temp[i] == 255:
552 temp[i] = 0
553 temp[i-1] += 1
554 ip_range.append(".".join(map(str, temp)))
555 return random.choice(ip_range)
556
Thangavelu K S8e413082017-07-13 20:02:14 +0000557 def random_mcast_ip(self,start_ip = '224.0.1.0', end_ip = '224.0.1.100'):
558 start = list(map(int, start_ip.split(".")))
559 end = list(map(int, end_ip.split(".")))
560 temp = start
561 ip_range = []
562 ip_range.append(start_ip)
563 while temp != end:
564 start[3] += 1
565 for i in (3, 2, 1):
566 if temp[i] == 255:
567 temp[i] = 0
568 temp[i-1] += 1
569 ip_range.append(".".join(map(str, temp)))
570 return random.choice(ip_range)
571
Thangavelu K S6432b522017-07-22 00:05:54 +0000572 @classmethod
573 def dhcp_relay_setup(cls):
574 #did = OnosCtrl.get_device_id()
575 #cls.relay_device_id = did
576 #cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
577 #cls.port_map, _ = cls.olt.olt_port_map() self.port_map['ports'][port_list[1][1]]
578 if cls.port_map:
579 ##Per subscriber, we use 1 relay port
580 try:
581 relay_port = cls.port_map['ports']
582 except:
583 relay_port = cls.port_map['uplink']
584 cls.relay_interface_port = relay_port
585 cls.relay_interfaces = (cls.port_map[cls.relay_interface_port],)
586 else:
587# cls.relay_interface_port = 100
588# cls.relay_interfaces = (g_subscriber_port_map[cls.relay_interface_port],)
589 log_test.info('No ONU ports are available, hence returning nothing')
590 cls.relay_interfaces_last = cls.relay_interfaces
591 if cls.port_map:
592 ##generate a ip/mac client virtual interface config for onos
593 interface_list = []
594 for port in cls.port_map['ports']:
595 port_num = cls.port_map[port]
596 if port_num == cls.port_map['uplink']:
597 continue
598 ip = cls.get_host_ip(port_num)
599 mac = cls.get_mac(port)
600 interface_list.append((port_num, ip, mac))
601
602 #configure dhcp server virtual interface on the same subnet as first client interface
603 relay_ip = cls.get_host_ip(interface_list[0][0])
604 relay_mac = cls.get_mac(cls.port_map[cls.relay_interface_port])
605 interface_list.append((cls.relay_interface_port, relay_ip, relay_mac))
606 cls.onos_interface_load(interface_list)
607
608 @classmethod
609 def onos_interface_load(cls, interface_list):
610 interface_dict = { 'ports': {} }
611 for port_num, ip, mac in interface_list:
612 port_map = interface_dict['ports']
613 port = '{}/{}'.format(cls.relay_device_id, port_num)
614 port_map[port] = { 'interfaces': [] }
615 interface_list = port_map[port]['interfaces']
616 interface_map = { 'ips' : [ '{}/{}'.format(ip, 24) ],
617 'mac' : mac,
618 'name': 'vir-{}'.format(port_num)
619 }
620 interface_list.append(interface_map)
621
622 cls.onos_load_config(interface_dict)
623 cls.configs['interface_config'] = interface_dict
624
625 @classmethod
626 def get_host_ip(cls, port):
627 if cls.host_ip_map.has_key(port):
628 return cls.host_ip_map[port]
629 cls.host_ip_map[port] = '192.168.1.{}'.format(port)
630 return cls.host_ip_map[port]
631
632 @classmethod
633 def host_load(cls, iface):
634 '''Have ONOS discover the hosts for dhcp-relay responses'''
635 port = g_subscriber_port_map[iface]
636 host = '173.17.1.{}'.format(port)
637 cmds = ( 'ifconfig {} 0'.format(iface),
638 'ifconfig {0} {1}'.format(iface, host),
639 'arping -I {0} {1} -c 2'.format(iface, host),
640 'ifconfig {} 0'.format(iface), )
641 for c in cmds:
642 os.system(c)
643
644 @classmethod
645 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
646 subnet = default_subnet_config):
647 conf = ''
648 for k, v in config.items():
649 conf += '{} {};\n'.format(k, v)
650
651 opts = ''
652 for k, v in options:
653 opts += 'option {} {};\n'.format(k, v)
654
655 subnet_config = ''
656 for _, v in subnet:
657 subnet_config += '{}\n'.format(v)
658
659 return '{}{}{}'.format(conf, opts, subnet_config)
660
661 @classmethod
662 def dhcpd_start(cls, intf_list = None,
663 config = default_config, options = default_options,
664 subnet = default_subnet_config):
665 '''Start the dhcpd server by generating the conf file'''
666 if intf_list is None:
667 intf_list = cls.relay_interfaces
668 ##stop dhcpd if already running
669 cls.dhcpd_stop()
670 dhcp_conf = cls.dhcpd_conf_generate(config = config, options = options,
671 subnet = subnet)
672 ##first touch dhcpd.leases if it doesn't exist
673 lease_file = '{}/dhcpd.leases'.format(cls.dhcp_data_dir)
674 if os.access(lease_file, os.F_OK) is False:
675 with open(lease_file, 'w') as fd: pass
676
677 conf_file = '{}/dhcpd.conf'.format(cls.dhcp_data_dir)
678 with open(conf_file, 'w') as fd:
679 fd.write(dhcp_conf)
680
681 #now configure the dhcpd interfaces for various subnets
682 index = 0
683 intf_info = []
684 for ip,_ in subnet:
685 intf = intf_list[index]
686 mac = cls.get_mac(intf)
687 intf_info.append((ip, mac))
688 index += 1
689 os.system('ifconfig {} {}'.format(intf, ip))
690
691 intf_str = ','.join(intf_list)
692 dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format(conf_file, lease_file, intf_str)
693 log_test.info('Starting DHCPD server with command: %s' %dhcpd_cmd)
694 ret = os.system(dhcpd_cmd)
695 assert_equal(ret, 0)
696 time.sleep(3)
697 cls.relay_interfaces_last = cls.relay_interfaces
698 cls.relay_interfaces = intf_list
699 cls.onos_dhcp_relay_load(*intf_info[0])
700
701 @classmethod
702 def dhcpd_stop(cls):
703 os.system('pkill -9 dhcpd')
704 for intf in cls.relay_interfaces:
705 os.system('ifconfig {} 0'.format(intf))
706
707 cls.relay_interfaces = cls.relay_interfaces_last
708
709 @classmethod
710 def get_mac(cls, iface):
711 if cls.interface_to_mac_map.has_key(iface):
712 return cls.interface_to_mac_map[iface]
713 mac = get_mac(iface, pad = 0)
714 cls.interface_to_mac_map[iface] = mac
715 return mac
716
717 def send_recv(self, mac=None, update_seed = False, validate = True):
718 cip, sip = self.dhcp.discover(mac = mac, update_seed = update_seed)
719 if validate:
720 assert_not_equal(cip, None)
721 assert_not_equal(sip, None)
722 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
723 (cip, sip, self.dhcp.get_mac(cip)[0]))
724 return cip,sip
725
726 @classmethod
727 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
728 subnet = default_subnet_config):
729 conf = ''
730 for k, v in config.items():
731 conf += '{} {};\n'.format(k, v)
732
733 opts = ''
734 for k, v in options:
735 opts += 'option {} {};\n'.format(k, v)
736
737 subnet_config = ''
738 for _, v in subnet:
739 subnet_config += '{}\n'.format(v)
740
741 return '{}{}{}'.format(conf, opts, subnet_config)
742
743 @classmethod
744 def onos_dhcp_relay_load(cls, server_ip, server_mac):
745 relay_device_map = '{}/{}'.format(cls.relay_device_id, cls.relay_interface_port)
746 dhcp_dict = {'apps':{'org.onosproject.dhcp-relay':{'dhcprelay':
747 {'dhcpserverConnectPoint':relay_device_map,
748 'serverip':server_ip,
749 'servermac':server_mac
750 }
751 }
752 }
753 }
754 cls.onos_load_config(dhcp_dict)
755 cls.configs['relay_config'] = dhcp_dict
756
757 @classmethod
758 def dhcp_relay_cleanup(cls):
759 ##reset the ONOS port configuration back to default
760 for config in cls.configs.items():
761 OnosCtrl.delete(config)
762 # if cls.onos_restartable is True:
763 # log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
764 # return cord_test_onos_restart(config = {})
765
766
Thangavelu K S8e413082017-07-13 20:02:14 +0000767 def tls_flow_check(self, olt_ports, cert_info = None, multiple_sub = False):
768 if multiple_sub is True:
769 olt_nni_port = olt_ports.tx_port
770 olt_uni_port = olt_ports.rx_port
771 else:
Thangavelu K S36edb012017-07-05 18:24:12 +0000772 olt_uni_port = olt_ports
773
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000774 def tls_fail_cb():
775 log_test.info('TLS verification failed')
776 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700777 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000778 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
779 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000780 if tls.failTest is True:
781 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000782 assert_equal(tls.failTest, False)
783 if cert_info == "no_cert":
784 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
785 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
786 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000787 if tls.failTest is False:
788 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000789 assert_equal(tls.failTest, True)
790 if cert_info == "invalid_cert":
791 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
792 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
793 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000794 if tls.failTest is False:
795 self.success = False
796 assert_equal(tls.failTest, True)
797 if cert_info == "same_cert":
798 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000799 log_test.info('Running subscriber %s tls auth test with same valid TLS certificate' %olt_uni_port)
Thangavelu K S9648eed2017-06-13 20:15:25 +0000800 tls.runTest()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000801 if tls.failTest is True:
Thangavelu K S9648eed2017-06-13 20:15:25 +0000802 self.success = False
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000803 assert_equal(tls.failTest, False)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000804 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 +0000805 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 +0000806 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
807 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
808 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000809 if tls.failTest is False:
810 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000811 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000812 self.test_status = True
813 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700814
Thangavelu K S8e413082017-07-13 20:02:14 +0000815 def dhcp_flow_check(self, olt_ports, negative_test = None, multiple_sub = False):
816 if multiple_sub is True:
817 olt_nni_port = olt_ports.tx_port
818 onu_iface = olt_ports.rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +0000819 dhcp_server_startip = self.random_ip()
820 random_mac = '00:00:00:0a:0a:' + hex(random.randrange(50,254)).split('x')[1]
Thangavelu K S8e413082017-07-13 20:02:14 +0000821 else:
822 onu_iface = olt_ports
823 dhcp_server_startip = '10.10.10.20'
824 random_mac = None
Thangavelu K S735a6662017-06-15 18:08:23 +0000825 self.success = True
826
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000827 if negative_test is None:
Thangavelu K S36edb012017-07-05 18:24:12 +0000828 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = 'skip', startip = dhcp_server_startip, mac = random_mac)
829 if cip == None or sip == None:
Thangavelu K S735a6662017-06-15 18:08:23 +0000830 self.success = False
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000831 self.test_status = False
832 assert_not_equal(cip,None)
833 assert_not_equal(sip,None)
834 else:
835 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
836 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000837
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000838 if negative_test == "interrupting_dhcp_flows":
839 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
Thangavelu K S735a6662017-06-15 18:08:23 +0000840 if cip is not None:
841 self.success = False
842 assert_equal(cip,None)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000843 log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000844 self.test_status = True
845
846 if negative_test == "invalid_src_mac_broadcast":
847 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
848 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
849 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
850 self.onos_dhcp_table_load(config)
851 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
852 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000853
854 if cip is not None:
855 self.success = False
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000856 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 +0000857 assert_equal(cip,None)
858 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
859 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000860
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000861 if negative_test == "invalid_src_mac_multicast":
862 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
863 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
864 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
865 self.onos_dhcp_table_load(config)
866 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
867 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000868 if cip is not None:
869 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000870 assert_equal(cip,None)
871 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
872 self.test_status = True
873
874 if negative_test == "invalid_src_mac_junk":
875 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
876 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
877 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
878 self.onos_dhcp_table_load(config)
879 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
880 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000881 if cip is not None:
882 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000883 assert_equal(cip,None)
884 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
885 self.test_status = True
886
887 if negative_test == "request_release":
888 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
889 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
890 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
891 self.onos_dhcp_table_load(config)
892 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
893 cip, sip = self.dhcp_sndrcv(self.dhcp)
894 log_test.info('Releasing ip %s to server %s' %(cip, sip))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000895 if not self.dhcp.release(cip):
896 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000897 assert_equal(self.dhcp.release(cip), True)
898 log_test.info('Triggering DHCP discover again after release')
899 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
900 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000901 if not cip == cip2:
Thangavelu K S735a6662017-06-15 18:08:23 +0000902 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000903 assert_equal(cip, cip2)
904 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
905 assert_equal(self.dhcp.release(cip2), True)
906 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000907
Thangavelu K S735a6662017-06-15 18:08:23 +0000908 if negative_test == "starvation_positive":
909 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
910 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
911 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
912 self.onos_dhcp_table_load(config)
913 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
914 ip_map = {}
915 for i in range(10):
916 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
917 if ip_map.has_key(cip):
918 self.success = False
919 log_test.info('IP %s given out multiple times' %cip)
920 assert_equal(False, ip_map.has_key(cip))
921 ip_map[cip] = sip
922 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000923
Thangavelu K S735a6662017-06-15 18:08:23 +0000924 if negative_test == "starvation_negative":
925 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
926 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
927 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
928 self.onos_dhcp_table_load(config)
929 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
930 log_test.info('Verifying passitive case')
931 for x in xrange(50):
932 mac = RandMAC()._fix()
933 self.dhcp_sndrcv(self.dhcp,mac = mac)
934 log_test.info('Verifying negative case')
935 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000936 if cip or sip is not None:
937 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000938 assert_equal(cip, None)
939 assert_equal(sip, None)
940 self.test_status = True
941 self.success = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000942
Thangavelu K S735a6662017-06-15 18:08:23 +0000943 if negative_test == "multiple_discover":
944 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
945 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
946 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
947 self.onos_dhcp_table_load(config)
948 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
949 cip, sip, mac, _ = self.dhcp.only_discover()
950 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
951 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000952 if cip is None:
953 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000954 assert_not_equal(cip, None)
955 log_test.info('Triggering DHCP discover again.')
956 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000957 if not new_cip == cip:
958 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000959 assert_equal(new_cip, cip)
960 log_test.info('client got same IP as expected when sent 2nd discovery')
961 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000962 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000963 if negative_test == "multiple_requests":
964 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
965 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
966 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
967 self.onos_dhcp_table_load(config)
968 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
969 log_test.info('Sending DHCP discover and DHCP request.')
970 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
971 mac = self.dhcp.get_mac(cip)[0]
972 log_test.info("Sending DHCP request again.")
973 new_cip, new_sip = self.dhcp.only_request(cip, mac)
974 assert_equal(new_cip,cip)
975 log_test.info('server offered same IP to clain for multiple requests, as expected')
976 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000977# self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000978 if negative_test == "desired_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.50', 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 not self.dhcp.seed_ip == cip:
991 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000992 assert_equal(cip,self.dhcp.seed_ip)
993 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
994 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000995 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000996 if negative_test == "desired_out_of_pool_ip_address":
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.75', iface = onu_iface)
1002 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001003 if cip or sip is None:
1004 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001005 assert_not_equal(cip, None)
1006 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1007 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001008 if self.dhcp.seed_ip == cip:
1009 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001010 assert_not_equal(cip,self.dhcp.seed_ip)
1011 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
1012 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001013 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001014 if negative_test == "dhcp_renew":
1015 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1016 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1017 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1018 self.onos_dhcp_table_load(config)
1019 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1020 cip, sip, mac, _ = self.dhcp.only_discover()
1021 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1022 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001023 if cip or sip is None:
1024 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001025 assert_not_equal(cip, None)
1026 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
1027 log_test.info('waiting renew time %d seconds to send next request packet'%lval)
1028 time.sleep(lval)
1029 latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001030 if not latest_cip == cip:
1031 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001032 assert_equal(latest_cip,cip)
1033 log_test.info('client got same IP after renew time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001034 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001035 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001036 if negative_test == "dhcp_rebind":
1037 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1038 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1039 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1040 self.onos_dhcp_table_load(config)
1041 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1042 cip, sip, mac, _ = self.dhcp.only_discover()
1043 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1044 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001045 if cip or sip is None:
1046 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001047 assert_not_equal(cip, None)
1048 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
1049 log_test.info('waiting rebind time %d seconds to send next request packet'%lval)
1050 time.sleep(lval)
1051 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001052 if not latest_cip == cip:
1053 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001054 assert_equal(latest_cip,cip)
1055 log_test.info('client got same IP after rebind time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001056 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001057 # self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001058 return self.test_status
1059
Thangavelu K S8e413082017-07-13 20:02:14 +00001060 def recv_channel_cb(self, pkt):
1061 ##First verify that we have received the packet for the joined instance
1062 chan = self.subscriber.caddr(pkt[IP].dst)
1063 assert_equal(chan in self.subscriber.join_map.keys(), True)
1064 recv_time = monotonic.monotonic() * 1000000
1065 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
1066 delta = recv_time - join_time
1067 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
1068 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
1069 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
1070 self.test_status = True
Thangavelu K S36edb012017-07-05 18:24:12 +00001071
Thangavelu K S8e413082017-07-13 20:02:14 +00001072 def traffic_verify(self, subscriber):
1073 # if subscriber.has_service('TRAFFIC'):
1074 url = 'http://www.google.com'
1075 resp = requests.get(url)
1076 self.test_status = resp.ok
1077 if resp.ok == False:
1078 log_test.info('Subscriber %s failed get from url %s with status code %d'
1079 %(subscriber.name, url, resp.status_code))
1080 else:
1081 log_test.info('GET request from %s succeeded for subscriber %s'
1082 %(url, subscriber.name))
1083 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001084
Thangavelu K S8e413082017-07-13 20:02:14 +00001085 def igmp_flow_check(self, subscriber, multiple_sub = False):
1086 chan = 0
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001087 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1088 if subscriber.num_channels == 1:
Thangavelu K S9a637332017-08-01 23:22:23 +00001089 if i != 0:
1090 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001091 chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1092 else:
1093 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1094 self.num_joins += 1
1095 while self.num_joins < self.num_subscribers:
1096 time.sleep(5)
1097 log_test.info('All subscribers have joined the channel')
1098 # for i in range(1):
1099 time.sleep(0.5)
1100 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1101 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1102 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001103 time.sleep(5)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001104# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1105 if subscriber.num_channels == 1:
1106 pass
1107 elif chan != 0:
1108 #Should not receive packets for this channel
1109 self.recv_timeout = True
1110 subscriber.recv_timeout = True
1111 subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1112 subscriber.recv_timeout = False
1113 self.recv_timeout = False
Thangavelu K S9a637332017-08-01 23:22:23 +00001114 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001115# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K S9a637332017-08-01 23:22:23 +00001116# chan = subscriber.num_channels - i
1117# self.test_status = True
1118 return self.test_status
1119
1120 def igmp_join_next_channel_flow_check(self, subscriber, multiple_sub = False):
1121 chan = 0
1122 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1123# if subscriber.num_channels == 1:
1124# chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1125# else:
1126 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1127 self.num_joins += 1
1128 while self.num_joins < self.num_subscribers:
1129 time.sleep(5)
1130 log_test.info('All subscribers have joined the channel')
1131 # for i in range(1):
1132 time.sleep(0.5)
1133 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1134 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1135 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
1136 time.sleep(5)
1137# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1138# if subscriber.num_channels == 1:
1139# pass
1140# elif chan != 0:
1141# pass
1142 #Should not receive packets for this channel
1143# log_test.info
1144# self.recv_timeout = True
1145# subscriber.recv_timeout = True
1146# subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1147# subscriber.recv_timeout = False
1148# self.recv_timeout = False
1149# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1150# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001151 chan = subscriber.num_channels - i
Thangavelu K S8e413082017-07-13 20:02:14 +00001152# self.test_status = True
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00001153 return self.test_status
1154
Thangavelu K S36edb012017-07-05 18:24:12 +00001155
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001156 def igmp_leave_flow_check(self, subscriber, multiple_sub = False):
1157 chan = 0
1158 for i in range(self.VOLTHA_IGMP_ITERATIONS):
1159 subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1160 self.num_joins += 1
1161 while self.num_joins < self.num_subscribers:
1162 time.sleep(5)
1163 log_test.info('All subscribers have joined the channel')
1164# for i in range(1):
1165 time.sleep(0.5)
1166 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1167 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1168 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1169 time.sleep(10)
1170# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1171 #Should not receive packets for this subscriber
1172 self.recv_timeout = True
1173 subscriber.recv_timeout = True
1174 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1175 subscriber.recv_timeout = False
1176 self.recv_timeout = False
1177# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1178# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1179# self.test_status = True
1180 return self.test_status
1181
1182
1183
Thangavelu K S8e413082017-07-13 20:02:14 +00001184 def igmp_flow_check_join_change_to_exclude(self, subscriber, multiple_sub = False):
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001185 chan = 2
1186 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1187 self.num_joins += 1
1188 while self.num_joins < self.num_subscribers:
1189 time.sleep(5)
1190 log_test.info('All subscribers have joined the channel')
1191 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1192 time.sleep(5)
1193 chan = 1
1194 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1195 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1196 time.sleep(5)
1197 self.recv_timeout = True
1198 subscriber.recv_timeout = True
1199 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1])
1200 if self.test_status is True:
1201 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0])
1202 if self.test_status is True:
1203 log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port))
1204 self.test_status = False
1205 subscriber.recv_timeout = False
1206 self.recv_timeout = False
1207 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001208 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1209 for i in range(3):
1210 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1211 self.num_joins += 1
1212 while self.num_joins < self.num_subscribers:
1213 time.sleep(5)
1214 log_test.info('All subscribers have joined the channel')
1215 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1216 time.sleep(5)
1217 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]))
1218 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1219 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1220 time.sleep(60)
1221 self.recv_timeout = False
1222 subscriber.recv_timeout = False
1223 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1224 if self.test_status is True:
1225 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1226 if self.test_status is False:
1227 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1228 continue
1229 subscriber.recv_timeout = False
1230 self.recv_timeout = False
1231 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001232# self.test_status = True
1233 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001234
Thangavelu K S8e413082017-07-13 20:02:14 +00001235 def igmp_flow_check_join_change_to_exclude_again_include_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001236 chan = 0
1237 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1238 for i in range(3):
1239 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1240 self.num_joins += 1
1241 while self.num_joins < self.num_subscribers:
1242 time.sleep(5)
1243 log_test.info('All subscribers have joined the channel')
1244 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1245 time.sleep(5)
1246 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]))
1247 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1248 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1249 time.sleep(60)
1250 self.recv_timeout = False
1251 subscriber.recv_timeout = False
1252 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1253 if self.test_status is True:
1254 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1255 if self.test_status is False:
1256 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1257 continue
1258 subscriber.recv_timeout = False
1259 self.recv_timeout = False
1260 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1261 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_INCLUDE)
1262 time.sleep(5)
1263# self.recv_timeout = True
1264# subscriber.recv_timeout = True
1265 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1266 subscriber.recv_timeout = False
1267 self.recv_timeout = False
1268
1269
1270 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1271# self.test_status = True
1272 return self.test_status
1273
Thangavelu K S36edb012017-07-05 18:24:12 +00001274
Thangavelu K S8e413082017-07-13 20:02:14 +00001275 def igmp_flow_check_join_change_to_block(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001276 chan = 0
1277 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1278 for i in range(3):
1279 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1280 self.num_joins += 1
1281 while self.num_joins < self.num_subscribers:
1282 time.sleep(5)
1283 log_test.info('All subscribers have joined the channel')
1284 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1285 time.sleep(5)
1286 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]))
1287 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_BLOCK_OLD)
1288 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1289 time.sleep(60)
1290 self.recv_timeout = False
1291 subscriber.recv_timeout = False
1292 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1293 if self.test_status is True:
1294 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1295 if self.test_status is False:
1296 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1297 continue
1298 subscriber.recv_timeout = False
1299 self.recv_timeout = False
1300 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1301# self.test_status = True
1302 return self.test_status
1303
Thangavelu K S36edb012017-07-05 18:24:12 +00001304
Thangavelu K S8e413082017-07-13 20:02:14 +00001305 def igmp_flow_check_join_change_to_block_again_allow_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001306 chan = 0
1307 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1308 for i in range(3):
1309 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1310 self.num_joins += 1
1311 while self.num_joins < self.num_subscribers:
1312 time.sleep(5)
1313 log_test.info('All subscribers have joined the channel')
1314 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1315 time.sleep(5)
1316 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]))
1317 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1318 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1319 time.sleep(60)
1320 self.recv_timeout = False
1321 subscriber.recv_timeout = False
1322 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1323 if self.test_status is True:
1324 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1325 if self.test_status is False:
1326 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1327 continue
1328 subscriber.recv_timeout = False
1329 self.recv_timeout = False
1330 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1331 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_ALLOW_NEW)
1332 time.sleep(5)
1333# self.recv_timeout = True
1334# subscriber.recv_timeout = True
1335 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1336 subscriber.recv_timeout = False
1337 self.recv_timeout = False
1338
1339
1340 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1341# self.test_status = True
1342 return self.test_status
Thangavelu K S8e413082017-07-13 20:02:14 +00001343
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001344 def igmp_flow_check_group_include_source_empty_list(self, subscriber, multiple_sub = False):
1345 chan = 0
1346 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1347 self.num_joins += 1
1348 while self.num_joins < self.num_subscribers:
1349 time.sleep(5)
1350 log_test.info('All subscribers have joined the channel')
1351 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1352 if self.test_status is True:
1353 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1354 self.test_status = False
1355 else:
1356 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 +00001357 self.test_status = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001358 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1359 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1360 time.sleep(5)
1361 subscriber.recv_timeout = False
1362 self.recv_timeout = False
1363 return self.test_status
1364
1365 def igmp_flow_check_group_exclude_source_empty_list(self, subscriber, multiple_sub = False):
1366 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001367 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1368 self.num_joins += 1
1369 while self.num_joins < self.num_subscribers:
1370 time.sleep(5)
1371 log_test.info('All subscribers have joined the channel')
1372 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1373 if self.test_status is True:
1374 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1375 self.test_status = False
1376 else:
1377 log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port))
1378 self.test_status = True
1379
1380 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1381 log_test.info('Send join to multicast group with exclude empty source list and waited till GMI timer expires')
1382 time.sleep(60)
1383
1384 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1385 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1386 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1387 time.sleep(5)
1388 subscriber.recv_timeout = False
1389 self.recv_timeout = False
1390 return self.test_status
1391
1392 def igmp_flow_check_group_exclude_source_empty_list_1(self, subscriber, multiple_sub = False):
1393 chan = 0
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001394 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list,record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1395 self.num_joins += 1
1396 while self.num_joins < self.num_subscribers:
1397 time.sleep(5)
1398 log_test.info('All subscribers have joined the channel')
1399 for i in range(10):
1400 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1401 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1402 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1403 time.sleep(5)
1404 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1405 #Should not receive packets for this subscriber
1406 self.recv_timeout = True
1407 subscriber.recv_timeout = True
1408 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1409 subscriber.recv_timeout = False
1410 self.recv_timeout = False
1411 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1412 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1413# self.test_status = True
1414 return self.test_status
1415
1416 def igmp_flow_check_during_olt_onu_operational_issues(self, subscriber, multiple_sub = False):
1417 chan = 0
1418 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1419 self.num_joins += 1
1420 while self.num_joins < self.num_subscribers:
1421 time.sleep(5)
1422 log_test.info('All subscribers have joined the channel')
1423 for i in range(2):
1424 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1425 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1426 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1427 time.sleep(5)
1428 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1429 #Should not receive packets for this subscriber
1430 self.recv_timeout = True
1431 subscriber.recv_timeout = True
1432 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1433 subscriber.recv_timeout = False
1434 self.recv_timeout = False
1435 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1436 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1437# self.test_status = True
1438 return self.test_status
1439
Thangavelu K S8e413082017-07-13 20:02:14 +00001440 def voltha_igmp_jump_verify(self, subscriber):
1441 if subscriber.has_service('IGMP'):
1442 for i in xrange(subscriber.num):
1443 log_test.info('Subscriber %s jumping channel' %subscriber.name)
1444 chan = subscriber.channel_jump(delay=0)
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 time.sleep(3)
1448 log_test.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats))
1449 self.test_status = True
1450 return self.test_status
1451
1452 def voltha_igmp_next_verify(self, subscriber):
1453 for c in xrange(self.VOLTHA_IGMP_ITERATIONS):
1454 for i in xrange(subscriber.num):
1455 if i:
1456 chan = subscriber.channel_join_next(delay=0, leave_flag = self.leave_flag)
1457 time.sleep(0.2)
1458 else:
1459 chan = subscriber.channel_join(i, delay=0)
1460 time.sleep(0.2)
1461 if subscriber.num == 1:
1462 subscriber.channel_leave(chan)
1463 log_test.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
1464 #subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
1465 #log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1466 self.test_status = True
1467 return self.test_status
1468
1469 def voltha_subscribers(self, services, cbs = None, num_subscribers = 1, num_channels = 1, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +00001470 """Test subscriber join next for channel surfing"""
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001471 voltha = VolthaCtrl(self.VOLTHA_HOST,
1472 rest_port = self.VOLTHA_REST_PORT,
1473 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S36edb012017-07-05 18:24:12 +00001474 if self.VOLTHA_OLT_TYPE.startswith('ponsim'):
1475 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1476 log_test.info('Enabling ponsim olt')
1477 device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001478 if device_id != '':
1479 self.olt_device_id = device_id
Thangavelu K S36edb012017-07-05 18:24:12 +00001480 else:
1481 log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution')
1482 assert_equal(False, True)
1483
1484 assert_not_equal(device_id, None)
1485 if status == False:
1486 voltha.disable_device(device_id, delete = True)
1487 assert_equal(status, True)
1488 time.sleep(10)
1489 switch_map = None
1490 olt_configured = False
1491 try:
1492 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1493 if not switch_map:
1494 log_test.info('No voltha devices found')
1495 return
1496 log_test.info('Installing OLT app')
1497 OnosCtrl.install_app(self.olt_app_file)
1498 time.sleep(5)
1499 log_test.info('Adding subscribers through OLT app')
1500 self.config_olt(switch_map)
1501 olt_configured = True
1502 time.sleep(5)
1503 self.num_subscribers = num_subscribers
1504 self.num_channels = num_channels
1505 test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers,
1506 num_channels = self.num_channels,
1507 cbs = cbs,
1508 port_list = self.generate_port_list(self.num_subscribers,
1509 self.num_channels),
Thangavelu K S8e413082017-07-13 20:02:14 +00001510 src_list = src_list, services = services)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001511 if test_status is False:
1512 self.success = False
Thangavelu K S36edb012017-07-05 18:24:12 +00001513 assert_equal(test_status, True)
1514 finally:
1515 if switch_map is not None:
1516 if olt_configured is True:
1517 self.remove_olt(switch_map)
1518 voltha.disable_device(device_id, delete = True)
1519 time.sleep(10)
1520 log_test.info('Uninstalling OLT app')
1521 OnosCtrl.uninstall_app(self.olt_app_name)
1522
Thangavelu K S8e413082017-07-13 20:02:14 +00001523 def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1,
1524 channel_start = 0, cbs = None, port_list = [], src_list = None,
Thangavelu K S36edb012017-07-05 18:24:12 +00001525 services = None, negative_subscriber_auth = None):
1526 self.test_status = False
1527 self.ovs_cleanup()
1528 subscribers_count = num_subscribers
1529 sub_loop_count = num_subscribers
1530 if not port_list:
1531 port_list = self.generate_port_list(num_subscribers, num_channels)
1532 subscriber_tx_rx_ports = []
1533 for i in range(num_subscribers):
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001534 subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map[port_list[i][0]],
1535 rx_port = self.port_map[port_list[i][1]],
Thangavelu K S8e413082017-07-13 20:02:14 +00001536 num_channels = num_channels,src_list = src_list,))
Thangavelu K S36edb012017-07-05 18:24:12 +00001537 self.onos_aaa_load()
Thangavelu K S8e413082017-07-13 20:02:14 +00001538 #load the ssm list for all subscriber channels
1539 igmpChannel = IgmpChannel(src_list = src_list)
1540 ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports)
1541 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
Thangavelu K S6432b522017-07-22 00:05:54 +00001542 if src_list is None:
1543 igmpChannel = IgmpChannel()
1544 igmpChannel.igmp_load_ssm_config(ssm_list)
1545 else:
1546 igmpChannel = IgmpChannel(src_list = src_list)
1547 igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001548
Thangavelu K S36edb012017-07-05 18:24:12 +00001549 self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1)
1550
1551 chan_leave = False #for single channel, multiple subscribers
1552 if cbs is None:
1553 cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check)
1554 chan_leave = True
1555 for subscriber in subscriber_tx_rx_ports:
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001556 if 'IGMP' in services:
1557# if src_list:
1558# for i in range(len(src_list)):
1559# subscriber.start(src_ip = src_list[i])
1560# else:
1561# subscriber.start()
1562 subscriber.start()
Thangavelu K S36edb012017-07-05 18:24:12 +00001563 sub_loop_count = sub_loop_count - 1
1564 pool_object = voltha_subscriber_pool(subscriber, cbs)
1565 self.thread_pool.addTask(pool_object.pool_cb)
1566 self.thread_pool.cleanUpThreads()
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001567 for subscriber in subscriber_tx_rx_ports:
1568 if services and 'IGMP' in services:
1569# if src_list:
1570# for i in range(len(src_list)):
1571# subscriber.stop(src_ip = src_list[i])
1572# else:
1573# subscriber.stop()
1574 subscriber.stop()
1575 if chan_leave is True:
1576 subscriber.channel_leave(0)
Thangavelu K S36edb012017-07-05 18:24:12 +00001577 subscribers_count = 0
1578 return self.test_status
1579
1580
1581 def generate_port_list(self, subscribers, channels):
1582 return self.port_list[:subscribers]
1583
Thangavelu K S36edb012017-07-05 18:24:12 +00001584 @classmethod
1585 def ovs_cleanup(cls):
1586 ##For every test case, delete all the OVS groups
1587 cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1'
1588 try:
1589 cord_test_shell(cmd)
1590 ##Since olt config is used for this test, we just fire a careless local cmd as well
1591 os.system(cmd)
1592 finally:
1593 return
1594
A.R Karthick8a507cf2017-06-02 18:44:49 -07001595 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -07001596 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -07001597 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
1598 assert_not_equal(device_id, None)
1599 try:
1600 assert_equal(status, True)
1601 time.sleep(10)
1602 finally:
1603 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001604
A.R Karthick8a507cf2017-06-02 18:44:49 -07001605 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001606 log_test.info('Enabling ponsim_olt')
1607 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -07001608 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1609 assert_not_equal(device_id, None)
1610 try:
1611 assert_equal(status, True)
1612 time.sleep(10)
1613 finally:
1614 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001615
Thangavelu K S008f38e2017-05-15 19:36:55 +00001616 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
1617 """
1618 Test Method:
1619 0. Make sure that voltha is up and running on CORD-POD setup.
1620 1. OLT and ONU is detected and validated.
1621 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1622 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
1623 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
1624 5. Verify that subscriber is authenticated successfully.
1625 """
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001626 ret = voltha_setup(
1627 host = self.VOLTHA_HOST,
1628 rest_port = self.VOLTHA_REST_PORT,
1629 olt_type = 'ponsim_olt',
1630 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP,
1631 uplink_vlan_start = self.VOLTHA_UPLINK_VLAN_START,
1632 config_fake = self.VOLTHA_CONFIG_FAKE,
1633 olt_app = self.olt_app_file)
1634 assert_not_equal(ret, None)
1635 voltha, device_id, switch_map = ret[0], ret[1], ret[2]
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001636 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001637 log_test.info('Adding subscribers through OLT app')
1638 self.config_olt(switch_map)
1639 olt_configured = True
1640 time.sleep(5)
1641 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001642 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001643 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001644 if switch_map is not None:
1645 if olt_configured is True:
1646 self.remove_olt(switch_map)
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001647 voltha_teardown(voltha, device_id, switch_map, olt_app = self.olt_app_file)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001648
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001649 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001650 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
1651 """
1652 Test Method:
1653 0. Make sure that voltha is up and running on CORD-POD setup.
1654 1. OLT and ONU is detected and validated.
1655 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1656 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1657 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
1658 5. Verify that subscriber authentication is unsuccessful..
1659 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001660 df = defer.Deferred()
1661 def tls_flow_check_with_no_cert_scenario(df):
1662 log_test.info('Enabling ponsim_olt')
1663 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1664 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1665 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001666 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001667 time.sleep(10)
1668 switch_map = None
1669 olt_configured = False
1670 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1671 log_test.info('Installing OLT app')
1672 OnosCtrl.install_app(self.olt_app_file)
1673 time.sleep(5)
1674 log_test.info('Adding subscribers through OLT app')
1675 self.config_olt(switch_map)
1676 olt_configured = True
1677 time.sleep(5)
1678 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1679 try:
1680 assert_equal(auth_status, True)
1681 assert_equal(status, True)
1682 time.sleep(10)
1683 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001684 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001685 self.voltha.disable_device(device_id, delete = True)
1686 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001687
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001688 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1689 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001690
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001691 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001692 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
1693 """
1694 Test Method:
1695 0. Make sure that voltha is up and running on CORD-POD setup.
1696 1. OLT and ONU is detected and validated.
1697 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1698 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
1699 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1700 5. Verify that subscriber authentication is unsuccessful..
1701 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001702 df = defer.Deferred()
1703 def tls_flow_check_with_invalid_cert_scenario(df):
1704 log_test.info('Enabling ponsim_olt')
1705 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1706 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1707 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001708 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001709 time.sleep(10)
1710 switch_map = None
1711 olt_configured = False
1712 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1713 log_test.info('Installing OLT app')
1714 OnosCtrl.install_app(self.olt_app_file)
1715 time.sleep(5)
1716 log_test.info('Adding subscribers through OLT app')
1717 self.config_olt(switch_map)
1718 olt_configured = True
1719 time.sleep(5)
1720 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1721 try:
1722 assert_equal(auth_status, True)
1723 assert_equal(status, True)
1724 time.sleep(10)
1725 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001726 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001727 self.voltha.disable_device(device_id, delete = True)
1728 df.callback(0)
1729 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
1730 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001731
Thangavelu K S0d745c82017-06-09 21:56:08 +00001732 @deferred(TESTCASE_TIMEOUT)
1733 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
1734 """
1735 Test Method:
1736 0. Make sure that voltha is up and running on CORD-POD setup.
1737 1. OLT and ONU is detected and validated.
1738 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1739 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
1740 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1741 5. Verify that subscriber authentication is unsuccessful..
1742 """
1743 df = defer.Deferred()
1744 def tls_flow_check_with_no_cert_scenario(df):
1745 log_test.info('Enabling ponsim_olt')
1746 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1747 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1748 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001749 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001750 time.sleep(10)
1751 switch_map = None
1752 olt_configured = False
1753 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1754 log_test.info('Installing OLT app')
1755 OnosCtrl.install_app(self.olt_app_file)
1756 time.sleep(5)
1757 log_test.info('Adding subscribers through OLT app')
1758 self.config_olt(switch_map)
1759 olt_configured = True
1760 time.sleep(5)
1761 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1762 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1763 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1764 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1765 try:
1766 assert_equal(auth_status, True)
1767 assert_equal(status, True)
1768 time.sleep(10)
1769 finally:
1770 self.voltha.disable_device(device_id, delete = True)
1771 df.callback(0)
1772 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1773 return df
1774
1775 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001776 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
1777 """
1778 Test Method:
1779 0. Make sure that voltha is up and running on CORD-POD setup.
1780 1. OLT and ONU is detected and validated.
1781 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1782 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1783 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
1784 5. Verify that subscriber authentication is unsuccessful..
1785 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001786 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001787 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001788 aaa_app = ["org.opencord.aaa"]
1789 log_test.info('Enabling ponsim_olt')
1790 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1791 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1792 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001793 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001794 time.sleep(10)
1795 switch_map = None
1796 olt_configured = False
1797 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1798 log_test.info('Installing OLT app')
1799 OnosCtrl.install_app(self.olt_app_file)
1800 time.sleep(5)
1801 log_test.info('Adding subscribers through OLT app')
1802 self.config_olt(switch_map)
1803 olt_configured = True
1804 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001805
Thangavelu K S0d745c82017-06-09 21:56:08 +00001806 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
1807 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
1808 thread1.start()
1809 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001810 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001811 thread2.start()
1812 time.sleep(10)
1813 thread1.join()
1814 thread2.join()
1815 try:
1816 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001817 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001818 time.sleep(10)
1819 finally:
1820 self.voltha.disable_device(device_id, delete = True)
1821 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001822 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001823 return df
1824
1825 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001826 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
1827 """
1828 Test Method:
1829 0. Make sure that voltha is up and running on CORD-POD setup.
1830 1. OLT and ONU is detected and validated.
1831 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1832 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1833 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
1834 5. Verify that subscriber authentication is unsuccessful..
1835 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001836 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001837 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001838 aaa_app = ["org.opencord.aaa"]
1839 log_test.info('Enabling ponsim_olt')
1840 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1841 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1842 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001843 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001844 time.sleep(10)
1845 switch_map = None
1846 olt_configured = False
1847 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1848 log_test.info('Installing OLT app')
1849 OnosCtrl.install_app(self.olt_app_file)
1850 time.sleep(5)
1851 log_test.info('Adding subscribers through OLT app')
1852 self.config_olt(switch_map)
1853 olt_configured = True
1854 time.sleep(5)
1855
1856 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
1857 thread2 = threading.Thread(target = cord_test_radius_restart)
1858 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001859 time.sleep(randint(1,2))
1860 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001861 thread2.start()
1862 time.sleep(10)
1863 thread1.join()
1864 thread2.join()
1865 try:
1866 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001867 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001868 time.sleep(10)
1869 finally:
1870 self.voltha.disable_device(device_id, delete = True)
1871 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001872 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001873 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001874
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001875 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001876 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
1877 """
1878 Test Method:
1879 0. Make sure that voltha is up and running on CORD-POD setup.
1880 1. OLT and ONU is detected and validated.
1881 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1882 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1883 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1884 6. Verify that subscriber authenticated successfully.
1885 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
1886 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1887 9. Verify that subscriber authentication is unsuccessful..
1888 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001889 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001890 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001891 aaa_app = ["org.opencord.aaa"]
1892 log_test.info('Enabling ponsim_olt')
1893 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1894 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1895 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001896 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001897 time.sleep(10)
1898 switch_map = None
1899 olt_configured = False
1900 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1901 log_test.info('Installing OLT app')
1902 OnosCtrl.install_app(self.olt_app_file)
1903 time.sleep(5)
1904 log_test.info('Adding subscribers through OLT app')
1905 self.config_olt(switch_map)
1906 olt_configured = True
1907 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001908
Thangavelu K S0d745c82017-06-09 21:56:08 +00001909 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001910 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +00001911 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001912 time.sleep(randint(1,2))
1913 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001914 thread2.start()
1915 time.sleep(10)
1916 thread1.join()
1917 thread2.join()
1918 try:
1919 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001920 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001921 time.sleep(10)
1922 finally:
1923 self.voltha.disable_device(device_id, delete = True)
1924 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001925 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001926 return df
1927
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001928 @deferred(TESTCASE_TIMEOUT)
1929 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001930 """
1931 Test Method:
1932 0. Make sure that voltha is up and running on CORD-POD setup.
1933 1. OLT and ONU is detected and validated.
1934 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1935 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1936 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1937 6. Verify that subscriber authenticated successfully.
1938 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1939 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1940 9. Verify that subscriber authentication is unsuccessful..
1941 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001942 df = defer.Deferred()
1943 def tls_flow_check_operating_olt_state(df):
1944 aaa_app = ["org.opencord.aaa"]
1945 log_test.info('Enabling ponsim_olt')
1946 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1947 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1948 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001949 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001950 time.sleep(10)
1951 switch_map = None
1952 olt_configured = False
1953 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1954 log_test.info('Installing OLT app')
1955 OnosCtrl.install_app(self.olt_app_file)
1956 time.sleep(5)
1957 log_test.info('Adding subscribers through OLT app')
1958 self.config_olt(switch_map)
1959 olt_configured = True
1960 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001961
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001962 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1963 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
1964 thread1.start()
1965 time.sleep(randint(1,2))
1966 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1967 thread2.start()
1968 time.sleep(10)
1969 thread1.join()
1970 thread2.join()
1971 try:
1972 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001973 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001974 time.sleep(10)
1975 finally:
1976 self.voltha.disable_device(device_id, delete = True)
1977 df.callback(0)
1978 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1979 return df
1980
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00001981 @deferred(TESTCASE_TIMEOUT +600)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001982 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self):
1983 """
1984 Test Method:
1985 0. Make sure that voltha is up and running on CORD-POD setup.
1986 1. OLT and ONU is detected and validated.
1987 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1988 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1989 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1990 6. Verify that subscriber authenticated successfully.
1991 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1992 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1993 9. Verify that subscriber authentication is unsuccessful..
1994 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1995
1996 """
1997 df = defer.Deferred()
1998 no_iterations = 10
1999 def tls_flow_check_with_disable_olt_device_scenario(df):
2000 aaa_app = ["org.opencord.aaa"]
2001 log_test.info('Enabling ponsim_olt')
2002 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2003 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2004 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002005 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002006 time.sleep(10)
2007 switch_map = None
2008 olt_configured = False
2009 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2010 log_test.info('Installing OLT app')
2011 OnosCtrl.install_app(self.olt_app_file)
2012 time.sleep(5)
2013 log_test.info('Adding subscribers through OLT app')
2014 self.config_olt(switch_map)
2015 olt_configured = True
2016 time.sleep(5)
2017 for i in range(no_iterations):
2018 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002019 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002020 thread1.start()
2021 time.sleep(randint(1,2))
2022 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
2023 thread2.start()
2024 time.sleep(10)
2025 thread1.join()
2026 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002027 time.sleep(60)
2028 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002029 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2030 try:
2031 # assert_equal(status, True)
2032 assert_equal(auth_status, True)
2033 assert_equal(self.success, True)
2034 time.sleep(10)
2035 finally:
2036 self.voltha.disable_device(device_id, delete = True)
2037 df.callback(0)
2038 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2039 return df
2040
2041 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002042 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
2043 """
2044 Test Method:
2045 0. Make sure that voltha is up and running on CORD-POD setup.
2046 1. OLT and ONU is detected and validated.
2047 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2048 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2049 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2050 6. Verify that subscriber authenticated successfully.
2051 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2052 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2053 9. Verify that subscriber authentication is unsuccessful..
2054 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002055 df = defer.Deferred()
2056 def tls_flow_check_operating_olt_state(df):
2057 aaa_app = ["org.opencord.aaa"]
2058 log_test.info('Enabling ponsim_olt')
2059 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2060 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2061 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002062 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002063 time.sleep(10)
2064 switch_map = None
2065 olt_configured = False
2066 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2067 log_test.info('Installing OLT app')
2068 OnosCtrl.install_app(self.olt_app_file)
2069 time.sleep(5)
2070 log_test.info('Adding subscribers through OLT app')
2071 self.config_olt(switch_map)
2072 olt_configured = True
2073 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002074
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002075 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2076 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2077 thread1.start()
2078 time.sleep(randint(1,2))
2079 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2080 thread2.start()
2081 time.sleep(10)
2082 thread1.join()
2083 thread2.join()
2084 try:
2085 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002086 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002087 time.sleep(10)
2088 finally:
2089 self.voltha.disable_device(device_id, delete = True)
2090 df.callback(0)
2091 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2092 return df
2093
2094 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002095 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self):
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002096 """
2097 Test Method:
2098 0. Make sure that voltha is up and running on CORD-POD setup.
2099 1. OLT and ONU is detected and validated.
2100 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2101 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2102 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2103 6. Verify that subscriber authenticated successfully.
2104 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2105 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2106 9. Verify that subscriber authentication is unsuccessful..
2107 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2108 """
2109 df = defer.Deferred()
2110 no_iterations = 10
2111 def tls_flow_check_with_disable_olt_device_scenario(df):
2112 aaa_app = ["org.opencord.aaa"]
2113 log_test.info('Enabling ponsim_olt')
2114 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2115 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2116 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002117 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002118 time.sleep(10)
2119 switch_map = None
2120 olt_configured = False
2121 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2122 log_test.info('Installing OLT app')
2123 OnosCtrl.install_app(self.olt_app_file)
2124 time.sleep(5)
2125 log_test.info('Adding subscribers through OLT app')
2126 self.config_olt(switch_map)
2127 olt_configured = True
2128 time.sleep(5)
2129 for i in range(no_iterations):
2130 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2131 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2132 thread1.start()
2133 time.sleep(randint(1,2))
2134 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2135 thread2.start()
2136 time.sleep(10)
2137 thread1.join()
2138 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002139 time.sleep(60)
2140 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002141 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2142 try:
2143 # assert_equal(status, True)
2144 assert_equal(auth_status, True)
2145 assert_equal(self.success, True)
2146 time.sleep(10)
2147 finally:
2148 self.voltha.disable_device(device_id, delete = True)
2149 df.callback(0)
2150 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2151 return df
2152
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002153 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002154 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
2155 """
2156 Test Method:
2157 0. Make sure that voltha is up and running on CORD-POD setup.
2158 1. OLT and ONU is detected and validated.
2159 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2160 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2161 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2162 6. Verify that subscriber authenticated successfully.
2163 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2164 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2165 9. Verify that subscriber authentication is unsuccessful..
2166 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002167 df = defer.Deferred()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002168 def tls_flow_check_operating_onu_state(df):
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002169 aaa_app = ["org.opencord.aaa"]
2170 log_test.info('Enabling ponsim_olt')
2171 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2172 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2173 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00002174 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2175
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002176 onu_device_id = devices_list['items'][1]['id']
2177 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002178 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002179 time.sleep(10)
2180 switch_map = None
2181 olt_configured = False
2182 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2183 log_test.info('Installing OLT app')
2184 OnosCtrl.install_app(self.olt_app_file)
2185 time.sleep(5)
2186 log_test.info('Adding subscribers through OLT app')
2187 self.config_olt(switch_map)
2188 olt_configured = True
2189 time.sleep(5)
2190 devices_list = self.voltha.get_devices()
2191 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2192 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2193 thread1.start()
2194 time.sleep(randint(1,2))
2195 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2196 thread2.start()
2197 time.sleep(10)
2198 thread1.join()
2199 thread2.join()
2200 try:
2201 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002202 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002203 time.sleep(10)
2204 finally:
2205 self.voltha.disable_device(device_id, delete = True)
2206 df.callback(0)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002207 reactor.callLater(0, tls_flow_check_operating_onu_state, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002208 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002209
Thangavelu K S9648eed2017-06-13 20:15:25 +00002210 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002211 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
2212 """
2213 Test Method:
2214 0. Make sure that voltha is up and running on CORD-POD setup.
2215 1. OLT and ONU is detected and validated.
2216 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2217 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2218 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2219 6. Verify that subscriber authenticated successfully.
2220 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2221 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2222 9. Verify that subscriber authentication is unsuccessful..
2223 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2224 """
2225 df = defer.Deferred()
2226 no_iterations = 10
2227 def tls_flow_check_operating_olt_state(df):
2228 aaa_app = ["org.opencord.aaa"]
2229 log_test.info('Enabling ponsim_olt')
2230 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2231 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2232 devices_list = self.voltha.get_devices()
2233 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2234
2235 onu_device_id = devices_list['items'][1]['id']
2236 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002237 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002238 time.sleep(10)
2239 switch_map = None
2240 olt_configured = False
2241 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2242 log_test.info('Installing OLT app')
2243 OnosCtrl.install_app(self.olt_app_file)
2244 time.sleep(5)
2245 log_test.info('Adding subscribers through OLT app')
2246 self.config_olt(switch_map)
2247 olt_configured = True
2248 time.sleep(5)
2249 devices_list = self.voltha.get_devices()
2250 for i in range(no_iterations):
2251 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2252 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2253 thread1.start()
2254 time.sleep(randint(1,2))
2255 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2256 thread2.start()
2257 time.sleep(10)
2258 thread1.join()
2259 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002260 time.sleep(60)
2261 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002262 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2263 try:
2264 # assert_equal(status, True)
2265 assert_equal(auth_status, True)
2266 assert_equal(self.success, True)
2267 time.sleep(10)
2268 finally:
2269 self.voltha.disable_device(device_id, delete = True)
2270 df.callback(0)
2271 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2272 return df
2273
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002274 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002275 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002276 """
2277 Test Method:
2278 0. Make sure that voltha is up and running on CORD-POD setup.
2279 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2280 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2281 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2282 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
2283 5. Verify that two subscribers are authenticated successfully.
2284 """
2285
Thangavelu K S9648eed2017-06-13 20:15:25 +00002286 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002287 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002288 aaa_app = ["org.opencord.aaa"]
2289 log_test.info('Enabling ponsim_olt')
2290 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2291 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2292 devices_list = self.voltha.get_devices()
2293 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2294
2295 onu_device_id = devices_list['items'][1]['id']
2296 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002297 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002298 time.sleep(10)
2299 switch_map = None
2300 olt_configured = False
2301 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2302 log_test.info('Installing OLT app')
2303 OnosCtrl.install_app(self.olt_app_file)
2304 time.sleep(5)
2305 log_test.info('Adding subscribers through OLT app')
2306 self.config_olt(switch_map)
2307 olt_configured = True
2308 time.sleep(5)
2309 devices_list = self.voltha.get_devices()
2310 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2311 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2312 thread1.start()
2313 time.sleep(randint(1,2))
2314 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2315 thread2.start()
2316 time.sleep(10)
2317 thread1.join()
2318 thread2.join()
2319 try:
2320 # assert_equal(status, True)
2321 assert_equal(self.success, True)
2322 time.sleep(10)
2323 finally:
2324 self.voltha.disable_device(device_id, delete = True)
2325 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002326 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002327 return df
2328
2329 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002330 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002331 """
2332 Test Method:
2333 0. Make sure that voltha is up and running on CORD-POD setup.
2334 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2335 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2336 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2337 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
2338 5. Verify that two subscribers are not authenticated.
2339 """
2340
Thangavelu K S9648eed2017-06-13 20:15:25 +00002341 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002342 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002343 aaa_app = ["org.opencord.aaa"]
2344 log_test.info('Enabling ponsim_olt')
2345 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2346 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2347 devices_list = self.voltha.get_devices()
2348 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2349
2350 onu_device_id = devices_list['items'][1]['id']
2351 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002352 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002353 time.sleep(10)
2354 switch_map = None
2355 olt_configured = False
2356 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2357 log_test.info('Installing OLT app')
2358 OnosCtrl.install_app(self.olt_app_file)
2359 time.sleep(5)
2360 log_test.info('Adding subscribers through OLT app')
2361 self.config_olt(switch_map)
2362 olt_configured = True
2363 time.sleep(5)
2364 devices_list = self.voltha.get_devices()
2365 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2366 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
2367 thread1.start()
2368 time.sleep(randint(1,2))
2369 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2370 thread2.start()
2371 time.sleep(10)
2372 thread1.join()
2373 thread2.join()
2374 try:
2375 # assert_equal(status, True)
2376 assert_equal(self.success, True)
2377 time.sleep(10)
2378 finally:
2379 self.voltha.disable_device(device_id, delete = True)
2380 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002381 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002382 return df
2383
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002384 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002385 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 +00002386 """
2387 Test Method:
2388 0. Make sure that voltha is up and running on CORD-POD setup.
2389 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2390 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2391 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2392 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2393 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
2394 6. Verify that valid subscriber authenticated successfully.
2395 7. Verify that invalid subscriber are not authenticated successfully.
2396 """
2397
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002398 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002399 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002400 aaa_app = ["org.opencord.aaa"]
2401 log_test.info('Enabling ponsim_olt')
2402 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2403 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2404 devices_list = self.voltha.get_devices()
2405 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2406
2407 onu_device_id = devices_list['items'][1]['id']
2408 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002409 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002410 time.sleep(10)
2411 switch_map = None
2412 olt_configured = False
2413 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2414 log_test.info('Installing OLT app')
2415 OnosCtrl.install_app(self.olt_app_file)
2416 time.sleep(5)
2417 log_test.info('Adding subscribers through OLT app')
2418 self.config_olt(switch_map)
2419 olt_configured = True
2420 time.sleep(5)
2421 devices_list = self.voltha.get_devices()
2422 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2423 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
2424 thread1.start()
2425 time.sleep(randint(1,2))
2426 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2427 thread2.start()
2428 time.sleep(10)
2429 thread1.join()
2430 thread2.join()
2431 try:
2432 # assert_equal(status, True)
2433 assert_equal(self.success, True)
2434 time.sleep(10)
2435 finally:
2436 self.voltha.disable_device(device_id, delete = True)
2437 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002438 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002439 return df
2440
2441 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002442 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 +00002443 """
2444 Test Method:
2445 0. Make sure that voltha is up and running on CORD-POD setup.
2446 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2447 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2448 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2449 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2450 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
2451 6. Verify that valid subscriber authenticated successfully.
2452 7. Verify that invalid subscriber are not authenticated successfully.
2453 """
2454
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002455 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002456 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002457 aaa_app = ["org.opencord.aaa"]
2458 log_test.info('Enabling ponsim_olt')
2459 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2460 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2461 devices_list = self.voltha.get_devices()
2462 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2463
2464 onu_device_id = devices_list['items'][1]['id']
2465 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002466 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002467 time.sleep(10)
2468 switch_map = None
2469 olt_configured = False
2470 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2471 log_test.info('Installing OLT app')
2472 OnosCtrl.install_app(self.olt_app_file)
2473 time.sleep(5)
2474 log_test.info('Adding subscribers through OLT app')
2475 self.config_olt(switch_map)
2476 olt_configured = True
2477 time.sleep(5)
2478 devices_list = self.voltha.get_devices()
2479 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2480 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
2481 thread1.start()
2482 time.sleep(randint(1,2))
2483 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2484 thread2.start()
2485 time.sleep(10)
2486 thread1.join()
2487 thread2.join()
2488 try:
2489 # assert_equal(status, True)
2490 assert_equal(self.success, True)
2491 time.sleep(10)
2492 finally:
2493 self.voltha.disable_device(device_id, delete = True)
2494 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002495 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002496 return df
2497
2498 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002499 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002500 """
2501 Test Method:
2502 0. Make sure that voltha is up and running on CORD-POD setup.
2503 1. OLT and ONU is detected and validated.
2504 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2505 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2506 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
2507 6. Verify that subscriber authenticated successfully.
2508 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
2509 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
2510 9. Verify that subscriber authentication is unsuccessful..
2511 10. Verify that other subscriber authenticated successfully.
2512 """
2513
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002514 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002515 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002516 aaa_app = ["org.opencord.aaa"]
2517 log_test.info('Enabling ponsim_olt')
2518 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2519 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2520 devices_list = self.voltha.get_devices()
2521 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2522
2523 onu_device_id = devices_list['items'][1]['id']
2524 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002525 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002526 time.sleep(10)
2527 switch_map = None
2528 olt_configured = False
2529 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2530 log_test.info('Installing OLT app')
2531 OnosCtrl.install_app(self.olt_app_file)
2532 time.sleep(5)
2533 log_test.info('Adding subscribers through OLT app')
2534 self.config_olt(switch_map)
2535 olt_configured = True
2536 time.sleep(5)
2537 devices_list = self.voltha.get_devices()
2538 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2539 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
2540 thread1.start()
2541 time.sleep(randint(1,2))
2542 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2543 thread2.start()
2544 time.sleep(10)
2545 thread1.join()
2546 thread2.join()
2547 try:
2548 # assert_equal(status, True)
2549 assert_equal(self.success, True)
2550 time.sleep(10)
2551 finally:
2552 self.voltha.disable_device(device_id, delete = True)
2553 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002554 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002555 return df
2556
Thangavelu K S36edb012017-07-05 18:24:12 +00002557 def test_3_subscribers_with_voltha_for_eap_tls_authentication(self):
2558 """
2559 Test Method:
2560 0. Make sure that voltha is up and running on CORD-POD setup.
2561 1. OLT and ONU is detected and validated.
2562 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2563 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers)
2564 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2565 5. Verify that subscriber is authenticated successfully.
2566 """
2567 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2568 num_subscribers = 3
2569 num_channels = 1
2570 services = ('TLS')
2571 cbs = (self.tls_flow_check, None, None)
2572 self.voltha_subscribers(services, cbs = cbs,
2573 num_subscribers = num_subscribers,
2574 num_channels = num_channels)
2575
2576 def test_5_subscribers_with_voltha_for_eap_tls_authentication(self):
2577 """
2578 Test Method:
2579 0. Make sure that voltha is up and running on CORD-POD setup.
2580 1. OLT and ONU is detected and validated.
2581 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2582 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber)
2583 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2584 5. Verify that subscriber is authenticated successfully.
2585 """
2586 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2587 num_subscribers = 5
2588 num_channels = 1
2589 services = ('TLS')
2590 cbs = (self.tls_flow_check, None, None)
2591 self.voltha_subscribers(services, cbs = cbs,
2592 num_subscribers = num_subscribers,
2593 num_channels = num_channels)
2594
2595 def test_9_subscribers_with_voltha_for_eap_tls_authentication(self):
2596 """
2597 Test Method:
2598 0. Make sure that voltha is up and running on CORD-POD setup.
2599 1. OLT and ONU is detected and validated.
2600 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2601 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber)
2602 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2603 5. Verify that subscriber is authenticated successfully.
2604 """
2605 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2606 num_subscribers = 9
2607 num_channels = 1
2608 services = ('TLS')
2609 cbs = (self.tls_flow_check, None, None)
2610 self.voltha_subscribers(services, cbs = cbs,
2611 num_subscribers = num_subscribers,
2612 num_channels = num_channels)
2613
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002614 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002615 def test_subscriber_with_voltha_for_dhcp_request(self):
2616 """
2617 Test Method:
2618 0. Make sure that voltha is up and running on CORD-POD setup.
2619 1. OLT and ONU is detected and validated.
2620 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2621 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2622 4. Verify that subscriber get ip from dhcp server successfully.
2623 """
2624
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002625 df = defer.Deferred()
2626 def dhcp_flow_check_scenario(df):
2627 log_test.info('Enabling ponsim_olt')
2628 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2629 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2630 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002631 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002632 time.sleep(10)
2633 switch_map = None
2634 olt_configured = False
2635 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2636 log_test.info('Installing OLT app')
2637 OnosCtrl.install_app(self.olt_app_file)
2638 time.sleep(5)
2639 log_test.info('Adding subscribers through OLT app')
2640 self.config_olt(switch_map)
2641 olt_configured = True
2642 time.sleep(5)
2643 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2644 try:
2645 assert_equal(dhcp_status, True)
2646 #assert_equal(status, True)
2647 time.sleep(10)
2648 finally:
2649 self.remove_olt(switch_map)
2650 self.voltha.disable_device(device_id, delete = True)
2651 df.callback(0)
2652
2653 reactor.callLater(0, dhcp_flow_check_scenario, df)
2654 return df
2655
2656 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002657 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
2658 """
2659 Test Method:
2660 0. Make sure that voltha is up and running on CORD-POD setup.
2661 1. OLT and ONU is detected and validated.
2662 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2663 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
2664 4. Verify that subscriber should not get ip from dhcp server.
2665 """
2666
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002667 df = defer.Deferred()
2668 def dhcp_flow_check_scenario(df):
2669 log_test.info('Enabling ponsim_olt')
2670 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2671 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2672 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002673 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002674 time.sleep(10)
2675 switch_map = None
2676 olt_configured = False
2677 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2678 log_test.info('Installing OLT app')
2679 OnosCtrl.install_app(self.olt_app_file)
2680 time.sleep(5)
2681 log_test.info('Adding subscribers through OLT app')
2682 self.config_olt(switch_map)
2683 olt_configured = True
2684 time.sleep(5)
2685 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
2686 try:
2687 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002688 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002689 #assert_equal(status, True)
2690 time.sleep(10)
2691 finally:
2692 self.voltha.disable_device(device_id, delete = True)
2693 self.remove_olt(switch_map)
2694 df.callback(0)
2695
2696 reactor.callLater(0, dhcp_flow_check_scenario, df)
2697 return df
2698
2699
2700 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002701 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
2702 """
2703 Test Method:
2704 0. Make sure that voltha is up and running on CORD-POD setup.
2705 1. OLT and ONU is detected and validated.
2706 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2707 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
2708 4. Verify that subscriber should not get ip from dhcp server.
2709 """
2710
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002711 df = defer.Deferred()
2712 def dhcp_flow_check_scenario(df):
2713 log_test.info('Enabling ponsim_olt')
2714 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2715 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2716 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002717 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002718 time.sleep(10)
2719 switch_map = None
2720 olt_configured = False
2721 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2722 log_test.info('Installing OLT app')
2723 OnosCtrl.install_app(self.olt_app_file)
2724 time.sleep(5)
2725 log_test.info('Adding subscribers through OLT app')
2726 self.config_olt(switch_map)
2727 olt_configured = True
2728 time.sleep(5)
2729 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
2730 try:
2731 assert_equal(dhcp_status, True)
2732 #assert_equal(status, True)
2733 time.sleep(10)
2734 finally:
2735 self.voltha.disable_device(device_id, delete = True)
2736 self.remove_olt(switch_map)
2737 df.callback(0)
2738
2739 reactor.callLater(0, dhcp_flow_check_scenario, df)
2740 return df
2741
2742 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002743 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
2744 """
2745 Test Method:
2746 0. Make sure that voltha is up and running on CORD-POD setup.
2747 1. OLT and ONU is detected and validated.
2748 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2749 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
2750 4. Verify that subscriber should not get ip from dhcp server.
2751 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002752 df = defer.Deferred()
2753 def dhcp_flow_check_scenario(df):
2754 log_test.info('Enabling ponsim_olt')
2755 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2756 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2757 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002758 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002759 time.sleep(10)
2760 switch_map = None
2761 olt_configured = False
2762 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2763 log_test.info('Installing OLT app')
2764 OnosCtrl.install_app(self.olt_app_file)
2765 time.sleep(5)
2766 log_test.info('Adding subscribers through OLT app')
2767 self.config_olt(switch_map)
2768 olt_configured = True
2769 time.sleep(5)
2770 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
2771 try:
2772 assert_equal(dhcp_status, True)
2773 #assert_equal(status, True)
2774 time.sleep(10)
2775 finally:
2776 self.voltha.disable_device(device_id, delete = True)
2777 self.remove_olt(switch_map)
2778 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002779
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002780 reactor.callLater(0, dhcp_flow_check_scenario, df)
2781 return df
2782
2783 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002784 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
2785 """
2786 Test Method:
2787 0. Make sure that voltha is up and running on CORD-POD setup.
2788 1. OLT and ONU is detected and validated.
2789 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2790 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2791 4. Verify that subscriber get ip from dhcp server successfully.
2792 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
2793 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
2794 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002795 df = defer.Deferred()
2796 def dhcp_flow_check_scenario(df):
2797 log_test.info('Enabling ponsim_olt')
2798 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2799 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2800 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002801 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002802 time.sleep(10)
2803 switch_map = None
2804 olt_configured = False
2805 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2806 log_test.info('Installing OLT app')
2807 OnosCtrl.install_app(self.olt_app_file)
2808 time.sleep(5)
2809 log_test.info('Adding subscribers through OLT app')
2810 self.config_olt(switch_map)
2811 olt_configured = True
2812 time.sleep(5)
2813 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
2814 try:
2815 assert_equal(dhcp_status, True)
2816 #assert_equal(status, True)
2817 time.sleep(10)
2818 finally:
2819 self.voltha.disable_device(device_id, delete = True)
2820 self.remove_olt(switch_map)
2821 df.callback(0)
2822
2823 reactor.callLater(0, dhcp_flow_check_scenario, df)
2824 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002825
Thangavelu K S735a6662017-06-15 18:08:23 +00002826
2827 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07002828 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002829 """
2830 Test Method:
2831 0. Make sure that voltha is up and running on CORD-POD setup.
2832 1. OLT and ONU is detected and validated.
2833 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2834 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2835 4. Verify that subscriber get ip from dhcp server successfully.
2836 5. Repeat step 3 and 4 for 10 times.
2837 6 Verify that subscriber should get ip from dhcp server.
2838 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002839 df = defer.Deferred()
2840 def dhcp_flow_check_scenario(df):
2841 log_test.info('Enabling ponsim_olt')
2842 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2843 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2844 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002845 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002846 time.sleep(10)
2847 switch_map = None
2848 olt_configured = False
2849 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2850 log_test.info('Installing OLT app')
2851 OnosCtrl.install_app(self.olt_app_file)
2852 time.sleep(5)
2853 log_test.info('Adding subscribers through OLT app')
2854 self.config_olt(switch_map)
2855 olt_configured = True
2856 time.sleep(5)
2857 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
2858 try:
2859 assert_equal(dhcp_status, True)
2860 #assert_equal(status, True)
2861 time.sleep(10)
2862 finally:
2863 self.voltha.disable_device(device_id, delete = True)
2864 self.remove_olt(switch_map)
2865 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002866
Thangavelu K S735a6662017-06-15 18:08:23 +00002867 reactor.callLater(0, dhcp_flow_check_scenario, df)
2868 return df
2869
Thangavelu K S735a6662017-06-15 18:08:23 +00002870 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002871 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
2872 """
2873 Test Method:
2874 0. Make sure that voltha is up and running on CORD-POD setup.
2875 1. OLT and ONU is detected and validated.
2876 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2877 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
2878 4. Verify that subscriber should not get ip from dhcp server.
2879 5. Repeat steps 3 and 4 for 10 times.
2880 6 Verify that subscriber should not get ip from dhcp server.
2881 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002882 df = defer.Deferred()
2883 def dhcp_flow_check_scenario(df):
2884 log_test.info('Enabling ponsim_olt')
2885 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2886 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2887 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002888 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002889 time.sleep(10)
2890 switch_map = None
2891 olt_configured = False
2892 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2893 log_test.info('Installing OLT app')
2894 OnosCtrl.install_app(self.olt_app_file)
2895 time.sleep(5)
2896 log_test.info('Adding subscribers through OLT app')
2897 self.config_olt(switch_map)
2898 olt_configured = True
2899 time.sleep(5)
2900 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
2901 try:
2902 assert_equal(dhcp_status, True)
2903 #assert_equal(status, True)
2904 time.sleep(10)
2905 finally:
2906 self.voltha.disable_device(device_id, delete = True)
2907 self.remove_olt(switch_map)
2908 df.callback(0)
2909
2910 reactor.callLater(0, dhcp_flow_check_scenario, df)
2911 return df
2912
Thangavelu K S735a6662017-06-15 18:08:23 +00002913 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002914 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
2915 """
2916 Test Method:
2917 0. Make sure that voltha is up and running on CORD-POD setup.
2918 1. OLT and ONU is detected and validated.
2919 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2920 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2921 4. Verify that subscriber get ip from dhcp server successfully.
2922 5. Repeat step 3 for 50 times.
2923 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2924 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002925 df = defer.Deferred()
2926 def dhcp_flow_check_scenario(df):
2927 log_test.info('Enabling ponsim_olt')
2928 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2929 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2930 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002931 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002932 time.sleep(10)
2933 switch_map = None
2934 olt_configured = False
2935 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2936 log_test.info('Installing OLT app')
2937 OnosCtrl.install_app(self.olt_app_file)
2938 time.sleep(5)
2939 log_test.info('Adding subscribers through OLT app')
2940 self.config_olt(switch_map)
2941 olt_configured = True
2942 time.sleep(5)
2943 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
2944 try:
2945 assert_equal(dhcp_status, True)
2946 #assert_equal(status, True)
2947 time.sleep(10)
2948 finally:
2949 self.voltha.disable_device(device_id, delete = True)
2950 self.remove_olt(switch_map)
2951 df.callback(0)
2952
2953 reactor.callLater(0, dhcp_flow_check_scenario, df)
2954 return df
2955
Thangavelu K S735a6662017-06-15 18:08:23 +00002956 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002957 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
2958 """
2959 Test Method:
2960 0. Make sure that voltha is up and running on CORD-POD setup.
2961 1. OLT and ONU is detected and validated.
2962 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2963 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2964 4. Verify that subscriber get ip from dhcp server successfully.
2965 5. Send DHCP request to dhcp server which is running as onos app.
2966 6. Repeat step 5 for 50 times.
2967 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2968 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002969 df = defer.Deferred()
2970 def dhcp_flow_check_scenario(df):
2971 log_test.info('Enabling ponsim_olt')
2972 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2973 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2974 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002975 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002976 time.sleep(10)
2977 switch_map = None
2978 olt_configured = False
2979 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2980 log_test.info('Installing OLT app')
2981 OnosCtrl.install_app(self.olt_app_file)
2982 time.sleep(5)
2983 log_test.info('Adding subscribers through OLT app')
2984 self.config_olt(switch_map)
2985 olt_configured = True
2986 time.sleep(5)
2987 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
2988 try:
2989 assert_equal(dhcp_status, True)
2990 #assert_equal(status, True)
2991 time.sleep(10)
2992 finally:
2993 self.voltha.disable_device(device_id, delete = True)
2994 self.remove_olt(switch_map)
2995 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002996
Thangavelu K S735a6662017-06-15 18:08:23 +00002997 reactor.callLater(0, dhcp_flow_check_scenario, df)
2998 return df
2999
Thangavelu K S735a6662017-06-15 18:08:23 +00003000 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003001 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
3002 """
3003 Test Method:
3004 0. Make sure that voltha is up and running on CORD-POD setup.
3005 1. OLT and ONU is detected and validated.
3006 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3007 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
3008 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
3009 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003010 df = defer.Deferred()
3011 def dhcp_flow_check_scenario(df):
3012 log_test.info('Enabling ponsim_olt')
3013 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3014 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3015 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003016 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003017 time.sleep(10)
3018 switch_map = None
3019 olt_configured = False
3020 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3021 log_test.info('Installing OLT app')
3022 OnosCtrl.install_app(self.olt_app_file)
3023 time.sleep(5)
3024 log_test.info('Adding subscribers through OLT app')
3025 self.config_olt(switch_map)
3026 olt_configured = True
3027 time.sleep(5)
3028 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
3029 try:
3030 assert_equal(dhcp_status, True)
3031 #assert_equal(status, True)
3032 time.sleep(10)
3033 finally:
3034 self.voltha.disable_device(device_id, delete = True)
3035 self.remove_olt(switch_map)
3036 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003037
Thangavelu K S735a6662017-06-15 18:08:23 +00003038 reactor.callLater(0, dhcp_flow_check_scenario, df)
3039 return df
3040
3041 @deferred(TESTCASE_TIMEOUT)
3042 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003043 """
3044 Test Method:
3045 0. Make sure that voltha is up and running on CORD-POD setup.
3046 1. OLT and ONU is detected and validated.
3047 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3048 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
3049 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.
3050 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003051 df = defer.Deferred()
3052 def dhcp_flow_check_scenario(df):
3053 log_test.info('Enabling ponsim_olt')
3054 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3055 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3056 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003057 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003058 time.sleep(10)
3059 switch_map = None
3060 olt_configured = False
3061 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3062 log_test.info('Installing OLT app')
3063 OnosCtrl.install_app(self.olt_app_file)
3064 time.sleep(5)
3065 log_test.info('Adding subscribers through OLT app')
3066 self.config_olt(switch_map)
3067 olt_configured = True
3068 time.sleep(5)
3069 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
3070 try:
3071 assert_equal(dhcp_status, True)
3072 #assert_equal(status, True)
3073 time.sleep(10)
3074 finally:
3075 self.voltha.disable_device(device_id, delete = True)
3076 self.remove_olt(switch_map)
3077 df.callback(0)
3078
3079 reactor.callLater(0, dhcp_flow_check_scenario, df)
3080 return df
3081
Thangavelu K S735a6662017-06-15 18:08:23 +00003082 @deferred(TESTCASE_TIMEOUT)
3083 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003084 """
3085 Test Method:
3086 0. Make sure that voltha is up and running on CORD-POD setup.
3087 1. OLT and ONU is detected and validated.
3088 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3089 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3090 4. Verify that subscriber get ip from dhcp server successfully.
3091 5. Deactivate dhcp server app in onos.
3092 6. Repeat step 3.
3093 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3094 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003095 df = defer.Deferred()
3096 dhcp_app = 'org.onosproject.dhcp'
3097 def dhcp_flow_check_scenario(df):
3098 log_test.info('Enabling ponsim_olt')
3099 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3100 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3101 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003102 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003103 time.sleep(10)
3104 switch_map = None
3105 olt_configured = False
3106 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3107 log_test.info('Installing OLT app')
3108 OnosCtrl.install_app(self.olt_app_file)
3109 time.sleep(5)
3110 log_test.info('Adding subscribers through OLT app')
3111 self.config_olt(switch_map)
3112 olt_configured = True
3113 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003114 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00003115 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
3116 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3117 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00003118 thread1.start()
3119 time.sleep(10)
3120 thread1.join()
3121 thread2.join()
3122 try:
3123 assert_equal(self.success, True)
3124 #assert_equal(status, True)
3125 time.sleep(10)
3126 finally:
3127 self.voltha.disable_device(device_id, delete = True)
3128 self.remove_olt(switch_map)
3129 df.callback(0)
3130
3131 reactor.callLater(0, dhcp_flow_check_scenario, df)
3132 return df
3133
3134 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003135 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
3136 """
3137 Test Method:
3138 0. Make sure that voltha is up and running on CORD-POD setup.
3139 1. OLT and ONU is detected and validated.
3140 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3141 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3142 4. Verify that subscriber get ip from dhcp server successfully.
3143 5. Send dhcp renew packet to dhcp server which is running as onos app.
3144 6. Repeat step 4.
3145 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003146
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003147 df = defer.Deferred()
3148 def dhcp_flow_check_scenario(df):
3149 log_test.info('Enabling ponsim_olt')
3150 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3151 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3152 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003153 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003154 time.sleep(10)
3155 switch_map = None
3156 olt_configured = False
3157 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3158 log_test.info('Installing OLT app')
3159 OnosCtrl.install_app(self.olt_app_file)
3160 time.sleep(5)
3161 log_test.info('Adding subscribers through OLT app')
3162 self.config_olt(switch_map)
3163 olt_configured = True
3164 time.sleep(5)
3165 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
3166 try:
3167 assert_equal(dhcp_status, True)
3168 #assert_equal(status, True)
3169 time.sleep(10)
3170 finally:
3171 self.voltha.disable_device(device_id, delete = True)
3172 self.remove_olt(switch_map)
3173 df.callback(0)
3174
3175 reactor.callLater(0, dhcp_flow_check_scenario, df)
3176 return df
3177
3178 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003179 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
3180 """
3181 Test Method:
3182 0. Make sure that voltha is up and running on CORD-POD setup.
3183 1. OLT and ONU is detected and validated.
3184 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3185 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3186 4. Verify that subscriber get ip from dhcp server successfully.
3187 5. Send dhcp rebind packet to dhcp server which is running as onos app.
3188 6. Repeat step 4.
3189 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003190 df = defer.Deferred()
3191 def dhcp_flow_check_scenario(df):
3192 log_test.info('Enabling ponsim_olt')
3193 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3194 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3195 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003196 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003197 time.sleep(10)
3198 switch_map = None
3199 olt_configured = False
3200 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3201 log_test.info('Installing OLT app')
3202 OnosCtrl.install_app(self.olt_app_file)
3203 time.sleep(5)
3204 log_test.info('Adding subscribers through OLT app')
3205 self.config_olt(switch_map)
3206 olt_configured = True
3207 time.sleep(5)
3208 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
3209 try:
3210 assert_equal(dhcp_status, True)
3211 #assert_equal(status, True)
3212 time.sleep(10)
3213 finally:
3214 self.voltha.disable_device(device_id, delete = True)
3215 self.remove_olt(switch_map)
3216 df.callback(0)
3217
3218 reactor.callLater(0, dhcp_flow_check_scenario, df)
3219 return df
3220
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003221 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003222 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003223 """
3224 Test Method:
3225 0. Make sure that voltha is up and running on CORD-POD setup.
3226 1. OLT and ONU is detected and validated.
3227 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3228 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3229 4. Verify that subscriber get ip from dhcp server successfully.
3230 5. Disable olt devices which is being detected in voltha CLI.
3231 6. Repeat step 3.
3232 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3233 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003234 df = defer.Deferred()
3235 dhcp_app = 'org.onosproject.dhcp'
3236 def dhcp_flow_check_scenario(df):
3237 log_test.info('Enabling ponsim_olt')
3238 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3239 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3240 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003241 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003242 time.sleep(10)
3243 switch_map = None
3244 olt_configured = False
3245 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3246 log_test.info('Installing OLT app')
3247 OnosCtrl.install_app(self.olt_app_file)
3248 time.sleep(5)
3249 log_test.info('Adding subscribers through OLT app')
3250 self.config_olt(switch_map)
3251 olt_configured = True
3252 time.sleep(5)
3253 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3254 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3255 log_test.info('Disable the olt device in during client send discover to voltha')
3256 thread2.start()
3257# time.sleep(randint(0,1))
3258 thread1.start()
3259 time.sleep(10)
3260 thread1.join()
3261 thread2.join()
3262 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003263 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003264 #assert_equal(status, True)
3265 time.sleep(10)
3266 finally:
3267 self.voltha.disable_device(device_id, delete = True)
3268 self.remove_olt(switch_map)
3269 df.callback(0)
3270
3271 reactor.callLater(0, dhcp_flow_check_scenario, df)
3272 return df
3273
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003274 @deferred(TESTCASE_TIMEOUT)
3275 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
3276 """
3277 Test Method:
3278 0. Make sure that voltha is up and running on CORD-POD setup.
3279 1. OLT and ONU is detected and validated.
3280 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3281 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3282 4. Verify that subscriber get ip from dhcp server successfully.
3283 5. Disable olt devices which is being detected in voltha CLI.
3284 6. Repeat step 3.
3285 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3286 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
3287 """
3288 df = defer.Deferred()
3289 no_iterations = 10
3290 dhcp_app = 'org.onosproject.dhcp'
3291 def dhcp_flow_check_scenario(df):
3292 log_test.info('Enabling ponsim_olt')
3293 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3294 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3295 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003296 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003297 time.sleep(10)
3298 switch_map = None
3299 olt_configured = False
3300 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3301 log_test.info('Installing OLT app')
3302 OnosCtrl.install_app(self.olt_app_file)
3303 time.sleep(5)
3304 log_test.info('Adding subscribers through OLT app')
3305 self.config_olt(switch_map)
3306 olt_configured = True
3307 time.sleep(5)
3308 for i in range(no_iterations):
3309 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3310 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3311 log_test.info('Disable the olt device in during client send discover to voltha')
3312 thread2.start()
3313# time.sleep(randint(0,1))
3314 thread1.start()
3315 time.sleep(10)
3316 thread1.join()
3317 thread2.join()
3318 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3319 try:
3320 assert_equal(self.success, True)
3321 assert_equal(dhcp_status, True)
3322 #assert_equal(status, True)
3323 time.sleep(10)
3324 finally:
3325 self.voltha.disable_device(device_id, delete = True)
3326 self.remove_olt(switch_map)
3327 df.callback(0)
3328
3329 reactor.callLater(0, dhcp_flow_check_scenario, df)
3330 return df
3331
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003332 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003333 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003334 """
3335 Test Method:
3336 0. Make sure that voltha is up and running on CORD-POD setup.
3337 1. OLT and ONU is detected and validated.
3338 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3339 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3340 4. Verify that subscriber get ip from dhcp server successfully.
3341 5. Disable olt devices which is being detected in voltha CLI.
3342 6. Repeat step 3.
3343 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3344 8. Enable olt devices which is being detected in voltha CLI.
3345 9. Repeat steps 3 and 4.
3346 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003347 df = defer.Deferred()
3348 dhcp_app = 'org.onosproject.dhcp'
3349 def dhcp_flow_check_scenario(df):
3350 log_test.info('Enabling ponsim_olt')
3351 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3352 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3353 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003354 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003355 time.sleep(10)
3356 switch_map = None
3357 olt_configured = False
3358 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3359 log_test.info('Installing OLT app')
3360 OnosCtrl.install_app(self.olt_app_file)
3361 time.sleep(5)
3362 log_test.info('Adding subscribers through OLT app')
3363 self.config_olt(switch_map)
3364 olt_configured = True
3365 time.sleep(5)
3366 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3367 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3368 thread2.start()
3369 thread1.start()
3370 time.sleep(10)
3371 thread1.join()
3372 thread2.join()
3373 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003374 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003375 #assert_equal(status, True)
3376 time.sleep(10)
3377 finally:
3378 self.voltha.disable_device(device_id, delete = True)
3379 self.remove_olt(switch_map)
3380 df.callback(0)
3381
3382 reactor.callLater(0, dhcp_flow_check_scenario, df)
3383 return df
3384
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003385 @deferred(TESTCASE_TIMEOUT)
3386 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
3387 """
3388 Test Method:
3389 0. Make sure that voltha is up and running on CORD-POD setup.
3390 1. OLT and ONU is detected and validated.
3391 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3392 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3393 4. Verify that subscriber get ip from dhcp server successfully.
3394 5. Disable olt devices which is being detected in voltha CLI.
3395 6. Repeat step 3.
3396 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3397 8. Enable olt devices which is being detected in voltha CLI.
3398 9. Repeat steps 3 and 4.
3399 """
3400
3401 df = defer.Deferred()
3402 no_iterations = 10
3403 dhcp_app = 'org.onosproject.dhcp'
3404 def dhcp_flow_check_scenario(df):
3405 log_test.info('Enabling ponsim_olt')
3406 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3407 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3408 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003409 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003410 time.sleep(10)
3411 switch_map = None
3412 olt_configured = False
3413 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3414 log_test.info('Installing OLT app')
3415 OnosCtrl.install_app(self.olt_app_file)
3416 time.sleep(5)
3417 log_test.info('Adding subscribers through OLT app')
3418 self.config_olt(switch_map)
3419 olt_configured = True
3420 time.sleep(5)
3421 for i in range(no_iterations):
3422 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3423 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3424 thread2.start()
3425 thread1.start()
3426 time.sleep(10)
3427 thread1.join()
3428 thread2.join()
3429 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3430 try:
3431 assert_equal(dhcp_status, True)
3432 #assert_equal(status, True)
3433 assert_equal(self.success, True)
3434 time.sleep(10)
3435 finally:
3436 self.voltha.disable_device(device_id, delete = True)
3437 self.remove_olt(switch_map)
3438 df.callback(0)
3439
3440 reactor.callLater(0, dhcp_flow_check_scenario, df)
3441 return df
3442
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003443 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003444 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003445 """
3446 Test Method:
3447 0. Make sure that voltha is up and running on CORD-POD setup.
3448 1. OLT and ONU is detected and validated.
3449 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3450 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3451 4. Verify that subscriber get ip from dhcp server successfully.
3452 5. Disable onu port which is being detected in voltha CLI.
3453 6. Repeat step 3.
3454 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3455 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003456 df = defer.Deferred()
3457 dhcp_app = 'org.onosproject.dhcp'
3458 def dhcp_flow_check_scenario(df):
3459 log_test.info('Enabling ponsim_olt')
3460 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3461 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3462 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003463 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003464 time.sleep(10)
3465 switch_map = None
3466 olt_configured = False
3467 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3468 log_test.info('Installing OLT app')
3469 OnosCtrl.install_app(self.olt_app_file)
3470 time.sleep(5)
3471 log_test.info('Adding subscribers through OLT app')
3472 self.config_olt(switch_map)
3473 olt_configured = True
3474 time.sleep(5)
3475 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00003476 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003477 thread1.start()
3478 thread2.start()
3479 time.sleep(10)
3480 thread1.join()
3481 thread2.join()
3482 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003483 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003484 #assert_equal(status, True)
3485 time.sleep(10)
3486 finally:
3487 self.voltha.disable_device(device_id, delete = True)
3488 self.remove_olt(switch_map)
3489 df.callback(0)
3490
3491 reactor.callLater(0, dhcp_flow_check_scenario, df)
3492 return df
3493
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003494 @deferred(TESTCASE_TIMEOUT)
3495 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
3496 """
3497 Test Method:
3498 0. Make sure that voltha is up and running on CORD-POD setup.
3499 1. OLT and ONU is detected and validated.
3500 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3501 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3502 4. Verify that subscriber get ip from dhcp server successfully.
3503 5. Disable onu port which is being detected in voltha CLI.
3504 6. Repeat step 3.
3505 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3506 """
3507 df = defer.Deferred()
3508 no_iterations = 10
3509 dhcp_app = 'org.onosproject.dhcp'
3510 def dhcp_flow_check_scenario(df):
3511 log_test.info('Enabling ponsim_olt')
3512 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3513 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3514 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003515 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003516 time.sleep(10)
3517 switch_map = None
3518 olt_configured = False
3519 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3520 log_test.info('Installing OLT app')
3521 OnosCtrl.install_app(self.olt_app_file)
3522 time.sleep(5)
3523 log_test.info('Adding subscribers through OLT app')
3524 self.config_olt(switch_map)
3525 olt_configured = True
3526 time.sleep(5)
3527 for i in range(no_iterations):
3528 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00003529 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003530 thread1.start()
3531 thread2.start()
3532 time.sleep(10)
3533 thread1.join()
3534 thread2.join()
3535 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3536 try:
3537 #assert_equal(status, True)
3538 assert_equal(dhcp_status, True)
3539 assert_equal(self.success, True)
3540 time.sleep(10)
3541 finally:
3542 self.voltha.disable_device(device_id, delete = True)
3543 self.remove_olt(switch_map)
3544 df.callback(0)
3545
3546 reactor.callLater(0, dhcp_flow_check_scenario, df)
3547 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003548
3549 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003550 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003551 """
3552 Test Method:
3553 0. Make sure that voltha is up and running on CORD-POD setup.
3554 1. OLT and ONU is detected and validated.
3555 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3556 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3557 4. Verify that subscriber get ip from dhcp server successfully.
3558 5. Disable onu port which is being detected in voltha CLI.
3559 6. Repeat step 3.
3560 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3561 8. Enable onu port which is being detected in voltha CLI.
3562 9. Repeat steps 3 and 4.
3563 """
3564
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003565 df = defer.Deferred()
3566 dhcp_app = 'org.onosproject.dhcp'
3567 def dhcp_flow_check_scenario(df):
3568 log_test.info('Enabling ponsim_olt')
3569 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3570 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3571 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003572 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003573 time.sleep(10)
3574 switch_map = None
3575 olt_configured = False
3576 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3577 log_test.info('Installing OLT app')
3578 OnosCtrl.install_app(self.olt_app_file)
3579 time.sleep(5)
3580 log_test.info('Adding subscribers through OLT app')
3581 self.config_olt(switch_map)
3582 olt_configured = True
3583 time.sleep(5)
3584 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00003585 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003586 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3587 thread2.start()
3588 time.sleep(randint(0,1))
3589 thread1.start()
3590 time.sleep(10)
3591 thread1.join()
3592 thread2.join()
3593 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3594 assert_equal(dhcp_status, True)
3595 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003596 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003597 #assert_equal(status, True)
3598 time.sleep(10)
3599 finally:
3600 self.voltha.disable_device(device_id, delete = True)
3601 self.remove_olt(switch_map)
3602 df.callback(0)
3603
3604 reactor.callLater(0, dhcp_flow_check_scenario, df)
3605 return df
3606
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003607 @deferred(TESTCASE_TIMEOUT)
3608 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
3609 """
3610 Test Method:
3611 0. Make sure that voltha is up and running on CORD-POD setup.
3612 1. OLT and ONU is detected and validated.
3613 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3614 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3615 4. Verify that subscriber get ip from dhcp server successfully.
3616 5. Disable onu port which is being detected in voltha CLI.
3617 6. Repeat step 3.
3618 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3619 8. Enable onu port which is being detected in voltha CLI.
3620 9. Repeat steps 3 and 4.
3621 """
3622
3623 df = defer.Deferred()
3624 no_iterations = 10
3625 dhcp_app = 'org.onosproject.dhcp'
3626 def dhcp_flow_check_scenario(df):
3627 log_test.info('Enabling ponsim_olt')
3628 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3629 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3630 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003631 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003632 time.sleep(10)
3633 switch_map = None
3634 olt_configured = False
3635 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3636 log_test.info('Installing OLT app')
3637 OnosCtrl.install_app(self.olt_app_file)
3638 time.sleep(5)
3639 log_test.info('Adding subscribers through OLT app')
3640 self.config_olt(switch_map)
3641 olt_configured = True
3642 time.sleep(5)
3643 for i in range(no_iterations):
3644 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00003645 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003646 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3647 thread2.start()
3648 time.sleep(randint(0,1))
3649 thread1.start()
3650 time.sleep(10)
3651 thread1.join()
3652 thread2.join()
3653 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3654 assert_equal(dhcp_status, True)
3655 try:
3656 assert_equal(self.success, True)
3657 #assert_equal(status, True)
3658 time.sleep(10)
3659 finally:
3660 self.voltha.disable_device(device_id, delete = True)
3661 self.remove_olt(switch_map)
3662 df.callback(0)
3663
3664 reactor.callLater(0, dhcp_flow_check_scenario, df)
3665 return df
3666
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003667 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003668 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003669 """
3670 Test Method:
3671 0. Make sure that voltha is up and running on CORD-POD setup.
3672 1. OLT and ONU is detected and validated.
3673 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3674 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3675 4. Verify that subscribers had got different ips from dhcp server successfully.
3676 """
3677
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003678 df = defer.Deferred()
3679 self.success = True
3680 dhcp_app = 'org.onosproject.dhcp'
3681 def dhcp_flow_check_scenario(df):
3682 log_test.info('Enabling ponsim_olt')
3683 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3684 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3685 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003686 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003687 time.sleep(10)
3688 switch_map = None
3689 olt_configured = False
3690 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3691 log_test.info('Installing OLT app')
3692 OnosCtrl.install_app(self.olt_app_file)
3693 time.sleep(5)
3694 log_test.info('Adding subscribers through OLT app')
3695 self.config_olt(switch_map)
3696 olt_configured = True
3697 time.sleep(5)
3698 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3699 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3700 thread1.start()
3701 thread2.start()
3702 time.sleep(10)
3703 thread1.join()
3704 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003705 dhcp_flow_status = self.success
3706 try:
3707# if self.success is not True:
3708 assert_equal(dhcp_flow_status, True)
3709 #assert_equal(status, True)
3710 time.sleep(10)
3711 finally:
3712 self.voltha.disable_device(device_id, delete = True)
3713 self.remove_olt(switch_map)
3714 df.callback(0)
3715
3716 reactor.callLater(0, dhcp_flow_check_scenario, df)
3717 return df
3718
3719 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003720 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003721 """
3722 Test Method:
3723 0. Make sure that voltha is up and running on CORD-POD setup.
3724 1. OLT and ONU is detected and validated.
3725 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3726 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3727 4. Verify that subscribers had got ip from dhcp server successfully.
3728 5. Repeat step 3 and 4 for 10 times for both subscribers.
3729 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
3730 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003731
3732
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003733 df = defer.Deferred()
3734 self.success = True
3735 dhcp_app = 'org.onosproject.dhcp'
3736 def dhcp_flow_check_scenario(df):
3737 log_test.info('Enabling ponsim_olt')
3738 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3739 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3740 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003741 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003742 time.sleep(10)
3743 switch_map = None
3744 olt_configured = False
3745 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3746 log_test.info('Installing OLT app')
3747 OnosCtrl.install_app(self.olt_app_file)
3748 time.sleep(5)
3749 log_test.info('Adding subscribers through OLT app')
3750 self.config_olt(switch_map)
3751 olt_configured = True
3752 time.sleep(5)
3753 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3754 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
3755 thread1.start()
3756 thread2.start()
3757 time.sleep(10)
3758 thread1.join()
3759 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003760 dhcp_flow_status = self.success
3761 try:
3762# if self.success is not True:
3763 assert_equal(dhcp_flow_status, True)
3764 #assert_equal(status, True)
3765 time.sleep(10)
3766 finally:
3767 self.voltha.disable_device(device_id, delete = True)
3768 self.remove_olt(switch_map)
3769 df.callback(0)
3770
3771 reactor.callLater(0, dhcp_flow_check_scenario, df)
3772 return df
3773
3774 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003775 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003776 """
3777 Test Method:
3778 0. Make sure that voltha is up and running on CORD-POD setup.
3779 1. OLT and ONU is detected and validated.
3780 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3781 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3782 4. Verify that subscribers had got ip from dhcp server successfully.
3783 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3784 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
3785 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003786
3787 df = defer.Deferred()
3788 self.success = True
3789 dhcp_app = 'org.onosproject.dhcp'
3790 def dhcp_flow_check_scenario(df):
3791 log_test.info('Enabling ponsim_olt')
3792 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3793 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3794 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003795 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003796 time.sleep(10)
3797 switch_map = None
3798 olt_configured = False
3799 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3800 log_test.info('Installing OLT app')
3801 OnosCtrl.install_app(self.olt_app_file)
3802 time.sleep(5)
3803 log_test.info('Adding subscribers through OLT app')
3804 self.config_olt(switch_map)
3805 olt_configured = True
3806 time.sleep(5)
3807 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3808 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3809 thread1.start()
3810 thread2.start()
3811 time.sleep(10)
3812 thread1.join()
3813 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003814 dhcp_flow_status = self.success
3815 try:
3816# if self.success is not True:
3817 assert_equal(dhcp_flow_status, True)
3818 #assert_equal(status, True)
3819 time.sleep(10)
3820 finally:
3821 self.voltha.disable_device(device_id, delete = True)
3822 self.remove_olt(switch_map)
3823 df.callback(0)
3824
3825 reactor.callLater(0, dhcp_flow_check_scenario, df)
3826 return df
3827
3828 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003829 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 +00003830 """
3831 Test Method:
3832 0. Make sure that voltha is up and running on CORD-POD setup.
3833 1. OLT and ONU is detected and validated.
3834 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3835 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
3836 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
3837 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
3838 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003839
3840 df = defer.Deferred()
3841 self.success = True
3842 dhcp_app = 'org.onosproject.dhcp'
3843 def dhcp_flow_check_scenario(df):
3844 log_test.info('Enabling ponsim_olt')
3845 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3846 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3847 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003848 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003849 time.sleep(10)
3850 switch_map = None
3851 olt_configured = False
3852 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3853 log_test.info('Installing OLT app')
3854 OnosCtrl.install_app(self.olt_app_file)
3855 time.sleep(5)
3856 log_test.info('Adding subscribers through OLT app')
3857 self.config_olt(switch_map)
3858 olt_configured = True
3859 time.sleep(5)
3860 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3861 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
3862 thread1.start()
3863 thread2.start()
3864 time.sleep(10)
3865 thread1.join()
3866 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003867 dhcp_flow_status = self.success
3868 try:
3869# if self.success is not True:
3870 assert_equal(dhcp_flow_status, True)
3871 #assert_equal(status, True)
3872 time.sleep(10)
3873 finally:
3874 self.voltha.disable_device(device_id, delete = True)
3875 self.remove_olt(switch_map)
3876 df.callback(0)
3877
3878 reactor.callLater(0, dhcp_flow_check_scenario, df)
3879 return df
3880
3881 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003882 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 +00003883 """
3884 Test Method:
3885 0. Make sure that voltha is up and running on CORD-POD setup.
3886 1. OLT and ONU is detected and validated.
3887 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3888 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
3889 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
3890 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
3891 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003892 df = defer.Deferred()
3893 self.success = True
3894 dhcp_app = 'org.onosproject.dhcp'
3895 def dhcp_flow_check_scenario(df):
3896 log_test.info('Enabling ponsim_olt')
3897 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3898 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3899 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003900 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003901 time.sleep(10)
3902 switch_map = None
3903 olt_configured = False
3904 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3905 log_test.info('Installing OLT app')
3906 OnosCtrl.install_app(self.olt_app_file)
3907 time.sleep(5)
3908 log_test.info('Adding subscribers through OLT app')
3909 self.config_olt(switch_map)
3910 olt_configured = True
3911 time.sleep(5)
3912 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3913 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3914 thread1.start()
3915 thread2.start()
3916 time.sleep(10)
3917 thread1.join()
3918 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003919 dhcp_flow_status = self.success
3920 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003921 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003922 time.sleep(10)
3923 finally:
3924 self.voltha.disable_device(device_id, delete = True)
3925 self.remove_olt(switch_map)
3926 df.callback(0)
3927
3928 reactor.callLater(0, dhcp_flow_check_scenario, df)
3929 return df
3930
3931 @deferred(TESTCASE_TIMEOUT)
3932 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003933 """
3934 Test Method:
3935 0. Make sure that voltha is up and running on CORD-POD setup.
3936 1. OLT and ONU is detected and validated.
3937 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3938 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3939 4. Verify that subscribers had got ip from dhcp server successfully.
3940 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3941 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3942 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3943 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003944 df = defer.Deferred()
3945 self.success = True
3946 dhcp_app = 'org.onosproject.dhcp'
3947 def dhcp_flow_check_scenario(df):
3948 log_test.info('Enabling ponsim_olt')
3949 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3950 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3951 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003952 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003953 time.sleep(10)
3954 switch_map = None
3955 olt_configured = False
3956 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3957 log_test.info('Installing OLT app')
3958 OnosCtrl.install_app(self.olt_app_file)
3959 time.sleep(5)
3960 log_test.info('Adding subscribers through OLT app')
3961 self.config_olt(switch_map)
3962 olt_configured = True
3963 time.sleep(5)
3964 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3965 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3966 thread1.start()
3967 thread2.start()
3968 time.sleep(10)
3969 thread1.join()
3970 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003971 dhcp_flow_status = self.success
3972 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003973 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003974 time.sleep(10)
3975 finally:
3976 self.voltha.disable_device(device_id, delete = True)
3977 self.remove_olt(switch_map)
3978 df.callback(0)
3979
3980 reactor.callLater(0, dhcp_flow_check_scenario, df)
3981 return df
3982
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003983 @deferred(TESTCASE_TIMEOUT)
3984 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003985 """
3986 Test Method:
3987 0. Make sure that voltha is up and running on CORD-POD setup.
3988 1. OLT and ONU is detected and validated.
3989 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3990 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3991 4. Verify that subscribers had got ip from dhcp server successfully.
3992 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3993 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3994 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3995 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
3996 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
3997 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
3998 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003999 df = defer.Deferred()
4000 self.success = True
4001 dhcp_app = 'org.onosproject.dhcp'
4002 def dhcp_flow_check_scenario(df):
4003 log_test.info('Enabling ponsim_olt')
4004 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4005 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4006 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004007 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004008 time.sleep(10)
4009 switch_map = None
4010 olt_configured = False
4011 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4012 log_test.info('Installing OLT app')
4013 OnosCtrl.install_app(self.olt_app_file)
4014 time.sleep(5)
4015 log_test.info('Adding subscribers through OLT app')
4016 self.config_olt(switch_map)
4017 olt_configured = True
4018 time.sleep(5)
4019 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4020 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00004021 thread3 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.INTF_2_RX_DEFAULT,))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004022 thread1.start()
4023 thread2.start()
4024 thread3.start()
4025 time.sleep(10)
4026 thread1.join()
4027 thread2.join()
4028 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004029 dhcp_flow_status = self.success
4030 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004031 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004032 time.sleep(10)
4033 finally:
4034 self.voltha.disable_device(device_id, delete = True)
4035 self.remove_olt(switch_map)
4036 df.callback(0)
4037
4038 reactor.callLater(0, dhcp_flow_check_scenario, df)
4039 return df
4040
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004041 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004042 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004043 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004044 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00004045 0. Make sure that voltha is up and running on CORD-POD setup.
4046 1. OLT and ONU is detected and validated.
4047 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4048 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4049 4. Verify that subscribers had got ip from dhcp server successfully.
4050 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4051 6. Disable the olt device which is detected in voltha.
4052 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4053 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004054 df = defer.Deferred()
4055 self.success = True
4056 dhcp_app = 'org.onosproject.dhcp'
4057 def dhcp_flow_check_scenario(df):
4058 log_test.info('Enabling ponsim_olt')
4059 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4060 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4061 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004062 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004063 time.sleep(10)
4064 switch_map = None
4065 olt_configured = False
4066 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4067 log_test.info('Installing OLT app')
4068 OnosCtrl.install_app(self.olt_app_file)
4069 time.sleep(5)
4070 log_test.info('Adding subscribers through OLT app')
4071 self.config_olt(switch_map)
4072 olt_configured = True
4073 time.sleep(5)
4074 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4075 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4076 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
4077
4078 thread1.start()
4079 thread2.start()
4080 thread3.start()
4081 time.sleep(10)
4082 thread1.join()
4083 thread2.join()
4084 thread3.join()
4085 dhcp_flow_status = self.success
4086 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004087 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004088 time.sleep(10)
4089 finally:
4090 self.voltha.disable_device(device_id, delete = True)
4091 self.remove_olt(switch_map)
4092 df.callback(0)
4093
4094 reactor.callLater(0, dhcp_flow_check_scenario, df)
4095 return df
4096
4097 @deferred(TESTCASE_TIMEOUT)
4098 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004099 """
4100 Test Method:
4101 0. Make sure that voltha is up and running on CORD-POD setup.
4102 1. OLT and ONU is detected and validated.
4103 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4104 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4105 4. Verify that subscribers had got ip from dhcp server successfully.
4106 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4107 6. Disable the olt device which is detected in voltha.
4108 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4109 8. Enable the olt device which is detected in voltha.
4110 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 +00004111
Thangavelu K S057b7d22017-05-16 22:03:22 +00004112 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004113 df = defer.Deferred()
4114 self.success = True
4115 dhcp_app = 'org.onosproject.dhcp'
4116 def dhcp_flow_check_scenario(df):
4117 log_test.info('Enabling ponsim_olt')
4118 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4119 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4120 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004121 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004122 time.sleep(10)
4123 switch_map = None
4124 olt_configured = False
4125 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4126 log_test.info('Installing OLT app')
4127 OnosCtrl.install_app(self.olt_app_file)
4128 time.sleep(5)
4129 log_test.info('Adding subscribers through OLT app')
4130 self.config_olt(switch_map)
4131 olt_configured = True
4132 time.sleep(5)
4133 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4134 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4135 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
4136 thread1.start()
4137 thread2.start()
4138 thread3.start()
4139 time.sleep(10)
4140 thread1.join()
4141 thread2.join()
4142 thread3.join()
4143 dhcp_flow_status = self.success
4144 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004145 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004146 time.sleep(10)
4147 finally:
4148 self.voltha.disable_device(device_id, delete = True)
4149 self.remove_olt(switch_map)
4150 df.callback(0)
4151
4152 reactor.callLater(0, dhcp_flow_check_scenario, df)
4153 return df
4154
4155 @deferred(TESTCASE_TIMEOUT)
4156 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004157 """
4158 Test Method:
4159 0. Make sure that voltha is up and running on CORD-POD setup.
4160 1. OLT and ONU is detected and validated.
4161 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4162 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4163 4. Verify that subscribers had got ip from dhcp server successfully.
4164 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4165 6. Pause the olt device which is detected in voltha.
4166 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4167 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004168 df = defer.Deferred()
4169 self.success = True
4170 dhcp_app = 'org.onosproject.dhcp'
4171 def dhcp_flow_check_scenario(df):
4172 log_test.info('Enabling ponsim_olt')
4173 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4174 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4175 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004176 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004177 time.sleep(10)
4178 switch_map = None
4179 olt_configured = False
4180 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4181 log_test.info('Installing OLT app')
4182 OnosCtrl.install_app(self.olt_app_file)
4183 time.sleep(5)
4184 log_test.info('Adding subscribers through OLT app')
4185 self.config_olt(switch_map)
4186 olt_configured = True
4187 time.sleep(5)
4188 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4189 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4190 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
4191 thread1.start()
4192 thread2.start()
4193 thread3.start()
4194 time.sleep(10)
4195 thread1.join()
4196 thread2.join()
4197 thread3.join()
4198 dhcp_flow_status = self.success
4199 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004200 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004201 time.sleep(10)
4202 finally:
4203 self.voltha.disable_device(device_id, delete = True)
4204 self.remove_olt(switch_map)
4205 df.callback(0)
4206
4207 reactor.callLater(0, dhcp_flow_check_scenario, df)
4208 return df
4209
Thangavelu K S36edb012017-07-05 18:24:12 +00004210 def test_3_subscribers_with_voltha_for_dhcp_discover_requests(self):
4211 """
4212 Test Method:
4213 0. Make sure that voltha is up and running on CORD-POD setup.
4214 1. OLT and ONU is detected and validated.
4215 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4216 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4217 4. Verify that subscriber get ip from dhcp server successfully.
4218 """
4219 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4220 num_subscribers = 3
4221 num_channels = 1
4222 services = ('DHCP')
4223 cbs = (self.dhcp_flow_check, None, None)
4224 self.voltha_subscribers(services, cbs = cbs,
4225 num_subscribers = num_subscribers,
4226 num_channels = num_channels)
4227
4228 def test_5_subscribers_with_voltha_for_dhcp_discover_requests(self):
4229 """
4230 Test Method:
4231 0. Make sure that voltha is up and running on CORD-POD setup.
4232 1. OLT and ONU is detected and validated.
4233 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4234 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4235 4. Verify that subscriber get ip from dhcp server successfully.
4236 """
4237 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4238 num_subscribers = 5
4239 num_channels = 1
4240 services = ('DHCP')
4241 cbs = (self.dhcp_flow_check, None, None)
4242 self.voltha_subscribers(services, cbs = cbs,
4243 num_subscribers = num_subscribers,
4244 num_channels = num_channels)
4245
4246 def test_9_subscribers_with_voltha_for_dhcp_discover_requests(self):
4247 """
4248 Test Method:
4249 0. Make sure that voltha is up and running on CORD-POD setup.
4250 1. OLT and ONU is detected and validated.
4251 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4252 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4253 4. Verify that subscriber get ip from dhcp server successfully.
4254 """
4255 """Test subscriber join next for channel surfing with 9 subscribers browsing 1 channels each"""
4256 num_subscribers = 9
4257 num_channels = 1
4258 services = ('DHCP')
4259 cbs = (self.dhcp_flow_check, None, None)
4260 self.voltha_subscribers(services, cbs = cbs,
4261 num_subscribers = num_subscribers,
4262 num_channels = num_channels)
4263
4264 def test_3_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4265 """
4266 Test Method:
4267 0. Make sure that voltha is up and running on CORD-POD setup.
4268 1. OLT and ONU is detected and validated.
4269 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4270 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4271 4. Verify that subscriber get ip from dhcp server successfully.
4272 """
4273 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4274 num_subscribers = 3
4275 num_channels = 1
4276 services = ('TLS','DHCP')
4277 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4278 self.voltha_subscribers(services, cbs = cbs,
4279 num_subscribers = num_subscribers,
4280 num_channels = num_channels)
4281
4282 def test_5_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4283 """
4284 Test Method:
4285 0. Make sure that voltha is up and running on CORD-POD setup.
4286 1. OLT and ONU is detected and validated.
4287 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4288 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4289 4. Verify that subscriber get ip from dhcp server successfully.
4290 """
4291 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4292 num_subscribers = 5
4293 num_channels = 1
4294 services = ('TLS','DHCP')
4295 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4296 self.voltha_subscribers(services, cbs = cbs,
4297 num_subscribers = num_subscribers,
4298 num_channels = num_channels)
4299
4300 def test_9_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4301 """
4302 Test Method:
4303 0. Make sure that voltha is up and running on CORD-POD setup.
4304 1. OLT and ONU is detected and validated.
4305 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4306 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4307 4. Verify that subscriber get ip from dhcp server successfully.
4308 """
4309 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4310 num_subscribers = 9
4311 num_channels = 1
4312 services = ('TLS','DHCP')
4313 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4314 self.voltha_subscribers(services, cbs = cbs,
4315 num_subscribers = num_subscribers,
4316 num_channels = num_channels)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004317
4318 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004319 def test_subscriber_with_voltha_for_dhcprelay_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004320 """
4321 Test Method:
4322 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4323 1. OLT and ONU is detected and validated.
4324 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4325 3. Send dhcp request from residential subscrber to external dhcp server.
4326 4. Verify that subscriber get ip from external dhcp server successfully.
4327 """
Thangavelu K S6432b522017-07-22 00:05:54 +00004328 self.dhcprelay_setUpClass()
4329# if not port_list:
4330 port_list = self.generate_port_list(1, 0)
4331 iface = self.port_map['ports'][port_list[1][1]]
4332 mac = self.get_mac(iface)
4333 self.host_load(iface)
4334 ##we use the defaults for this test that serves as an example for others
4335 ##You don't need to restart dhcpd server if retaining default config
4336 config = self.default_config
4337 options = self.default_options
4338 subnet = self.default_subnet_config
4339 dhcpd_interface_list = self.relay_interfaces
4340 self.dhcpd_start(intf_list = dhcpd_interface_list,
4341 config = config,
4342 options = options,
4343 subnet = subnet)
4344 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4345 self.send_recv(mac=mac)
4346 self.dhcprelay_tearDwonClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004347
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004348 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004349 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004350 """
4351 Test Method:
4352 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4353 1. OLT and ONU is detected and validated.
4354 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4355 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
4356 4. Verify that subscriber should not get ip from external dhcp server.
4357 """
4358
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004359 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004360 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004361 """
4362 Test Method:
4363 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4364 1. OLT and ONU is detected and validated.
4365 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4366 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
4367 4. Verify that subscriber should not get ip from external dhcp server.
4368 """
4369
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004370 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004371 """
4372 Test Method:
4373 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4374 1. OLT and ONU is detected and validated.
4375 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4376 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
4377 4. Verify that subscriber should not get ip from external dhcp server.
4378 """
4379
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004380 def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004381 """
4382 Test Method:
4383 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4384 1. OLT and ONU is detected and validated.
4385 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4386 3. Send dhcp request from residential subscrber to external dhcp server.
4387 4. Verify that subscriber get ip from external dhcp server successfully.
4388 5. Send dhcp release from residential subscrber to external dhcp server.
4389 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
4390 """
4391
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004392 def test_subscriber_with_voltha_for_dhcprelay_starvation(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004393 """
4394 Test Method:
4395 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4396 1. OLT and ONU is detected and validated.
4397 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4398 3. Send dhcp request from residential subscriber to external dhcp server.
4399 4. Verify that subscriber get ip from external dhcp server. successfully.
4400 5. Repeat step 3 and 4 for 10 times.
4401 6 Verify that subscriber should get ip from external dhcp server..
4402 """
4403
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004404 def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004405 """
4406 Test Method:
4407 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4408 1. OLT and ONU is detected and validated.
4409 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4410 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
4411 4. Verify that subscriber should not get ip from external dhcp server..
4412 5. Repeat steps 3 and 4 for 10 times.
4413 6 Verify that subscriber should not get ip from external dhcp server..
4414 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004415 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004416 """
4417 Test Method:
4418 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4419 1. OLT and ONU is detected and validated.
4420 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4421 3. Send dhcp request from residential subscriber to external dhcp server.
4422 4. Verify that subscriber get ip from external dhcp server. successfully.
4423 5. Repeat step 3 for 50 times.
4424 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4425 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004426 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004427 """
4428 Test Method:
4429 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4430 1. OLT and ONU is detected and validated.
4431 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4432 3. Send dhcp request from residential subscriber to external dhcp server.
4433 4. Verify that subscriber get ip from external dhcp server. successfully.
4434 5. Send DHCP request to external dhcp server.
4435 6. Repeat step 5 for 50 times.
4436 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4437 """
4438
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004439 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004440 """
4441 Test Method:
4442 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4443 1. OLT and ONU is detected and validated.
4444 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4445 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
4446 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
4447 """
4448
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004449 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004450 """
4451 Test Method:
4452 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4453 1. OLT and ONU is detected and validated.
4454 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4455 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
4456 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.
4457 """
4458
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004459 def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(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. Deactivate dhcp server app in onos.
4468 6. Repeat step 3.
4469 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4470 """
4471
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004472 def test_subscriber_with_voltha_for_dhcprelay_renew_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004473 """
4474 Test Method:
4475 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4476 1. OLT and ONU is detected and validated.
4477 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4478 3. Send dhcp request from residential subscriber to external dhcp server.
4479 4. Verify that subscriber get ip from external dhcp server. successfully.
4480 5. Send dhcp renew packet to external dhcp server.
4481 6. Repeat step 4.
4482 """
4483
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004484 def test_subscriber_with_voltha_for_dhcprelay_rebind_time(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. Send dhcp rebind packet to external dhcp server.
4493 6. Repeat step 4.
4494 """
4495
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004496 def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004497 """
4498 Test Method:
4499 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4500 1. OLT and ONU is detected and validated.
4501 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4502 3. Send dhcp request from residential subscriber to external dhcp server.
4503 4. Verify that subscriber get ip from external dhcp server. successfully.
4504 5. Disable olt devices which is being detected in voltha CLI.
4505 6. Repeat step 3.
4506 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4507 """
4508
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004509 def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004510 """
4511 Test Method:
4512 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4513 1. OLT and ONU is detected and validated.
4514 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4515 3. Send dhcp request from residential subscriber to external dhcp server.
4516 4. Verify that subscriber get ip from external dhcp server. successfully.
4517 5. Disable olt devices which is being detected in voltha CLI.
4518 6. Repeat step 3.
4519 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4520 8. Enable olt devices which is being detected in voltha CLI.
4521 9. Repeat steps 3 and 4.
4522 """
4523
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004524 def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004525 """
4526 Test Method:
4527 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4528 1. OLT and ONU is detected and validated.
4529 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4530 3. Send dhcp request from residential subscriber to external dhcp server.
4531 4. Verify that subscriber get ip from external dhcp server. successfully.
4532 5. Disable onu port which is being detected in voltha CLI.
4533 6. Repeat step 3.
4534 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4535 """
4536
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004537 def test_subscriber_with_voltha_for_dhcprelay_disable_enable_onu_port_in_voltha(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 residential subscriber to external dhcp server.
4544 4. Verify that subscriber get ip from external dhcp server. successfully.
4545 5. Disable onu port which is being detected in voltha CLI.
4546 6. Repeat step 3.
4547 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4548 8. Enable onu port which is being detected in voltha CLI.
4549 9. Repeat steps 3 and 4.
4550 """
4551
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004552 def test_two_subscribers_with_voltha_for_dhcprelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004553 """
4554 Test Method:
4555 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4556 1. OLT and ONU is detected and validated.
4557 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4558 3. Send dhcp request from two residential subscribers to external dhcp server.
4559 4. Verify that subscribers had got different ips from external dhcp server. successfully.
4560 """
4561
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004562 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004563 """
4564 Test Method:
4565 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4566 1. OLT and ONU is detected and validated.
4567 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4568 3. Send dhcp request from two residential subscribers to external dhcp server.
4569 4. Verify that subscribers had got ip from external dhcp server. successfully.
4570 5. Repeat step 3 and 4 for 10 times for both subscribers.
4571 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
4572 """
4573
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004574 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004575 """
4576 Test Method:
4577 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4578 1. OLT and ONU is detected and validated.
4579 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4580 3. Send dhcp request from two residential subscribers to external dhcp server.
4581 4. Verify that subscribers had got ip from external dhcp server. successfully.
4582 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
4583 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
4584 """
4585
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004586 def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004587 """
4588 Test Method:
4589 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4590 1. OLT and ONU is detected and validated.
4591 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4592 3. Send dhcp request from one residential subscriber to external dhcp server.
4593 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
4594 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
4595 """
4596
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004597 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 +00004598 """
4599 Test Method:
4600 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4601 1. OLT and ONU is detected and validated.
4602 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4603 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
4604 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
4605 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
4606 """
4607
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004608 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004609 """
4610 Test Method:
4611 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4612 1. OLT and ONU is detected and validated.
4613 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4614 3. Send dhcp request from two residential subscribers to external dhcp server.
4615 4. Verify that subscribers had got ip from external dhcp server. successfully.
4616 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4617 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4618 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4619 """
4620
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004621 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004622 """
4623 Test Method:
4624 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4625 1. OLT and ONU is detected and validated.
4626 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4627 3. Send dhcp request from two residential subscribers to external dhcp server.
4628 4. Verify that subscribers had got ip from external dhcp server. successfully.
4629 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4630 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4631 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4632 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
4633 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
4634 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4635 """
4636
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004637 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004638 """
4639 Test Method:
4640 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4641 1. OLT and ONU is detected and validated.
4642 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4643 3. Send dhcp request from two residential subscribers to external dhcp server.
4644 4. Verify that subscribers had got ip from external dhcp server. successfully.
4645 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4646 6. Disable the olt device which is detected in voltha.
4647 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4648 """
4649
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004650 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004651 """
4652 Test Method:
4653 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4654 1. OLT and ONU is detected and validated.
4655 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4656 3. Send dhcp request from two residential subscribers to external dhcp server.
4657 4. Verify that subscribers had got ip from external dhcp server. successfully.
4658 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4659 6. Disable the olt device which is detected in voltha.
4660 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4661 8. Enable the olt device which is detected in voltha.
4662 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4663 """
4664
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004665 def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004666 """
4667 Test Method:
4668 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4669 1. OLT and ONU is detected and validated.
4670 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4671 3. Send dhcp request from two residential subscribers to external dhcp server.
4672 4. Verify that subscribers had got ip from external dhcp server. successfully.
4673 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4674 6. Pause the olt device which is detected in voltha.
4675 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4676 """
Thangavelu K S36edb012017-07-05 18:24:12 +00004677
Thangavelu K S6432b522017-07-22 00:05:54 +00004678 def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004679 """
4680 Test Method:
4681 0. Make sure that voltha is up and running on CORD-POD setup.
4682 1. OLT and ONU is detected and validated.
4683 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4684 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4685 4. Send igmp joins for a multicast group address multi-group-addressA.
4686 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4687 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4688 """
4689
Thangavelu K S8e413082017-07-13 20:02:14 +00004690 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4691 num_subscribers = 1
4692 num_channels = 1
4693 services = ('IGMP')
4694 cbs = (self.igmp_flow_check, None, None)
4695 self.voltha_subscribers(services, cbs = cbs,
4696 num_subscribers = num_subscribers,
4697 num_channels = num_channels)
4698
Thangavelu K S6432b522017-07-22 00:05:54 +00004699 def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004700 """
4701 Test Method:
4702 0. Make sure that voltha is up and running on CORD-POD setup.
4703 1. OLT and ONU is detected and validated.
4704 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4705 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4706 4. Send igmp joins for a multicast group address multi-group-addressA.
4707 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4708 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4709 7. Send igmp leave for a multicast group address multi-group-addressA.
4710 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4711 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004712 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4713 num_subscribers = 1
4714 num_channels = 1
4715 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004716 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00004717 self.voltha_subscribers(services, cbs = cbs,
4718 num_subscribers = num_subscribers,
4719 num_channels = num_channels)
4720
Thangavelu K S6432b522017-07-22 00:05:54 +00004721 def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004722 """
4723 Test Method:
4724 0. Make sure that voltha is up and running on CORD-POD setup.
4725 1. OLT and ONU is detected and validated.
4726 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4727 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4728 4. Send igmp joins for a multicast group address multi-group-addressA.
4729 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4730 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4731 7. Send igmp leave for a multicast group address multi-group-addressA.
4732 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4733 9. Repeat steps 4 to 6.
4734 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004735 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4736 num_subscribers = 1
4737 num_channels = 1
4738 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004739 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00004740 self.voltha_subscribers(services, cbs = cbs,
4741 num_subscribers = num_subscribers,
4742 num_channels = num_channels)
4743
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004744 def test_subscriber_with_voltha_for_igmp_5_groups_joins_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004745 """
4746 Test Method:
4747 0. Make sure that voltha is up and running on CORD-POD setup.
4748 1. OLT and ONU is detected and validated.
4749 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4750 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4751 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4752 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4753 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4754 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004755 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4756 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004757 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00004758 services = ('IGMP')
4759 cbs = (self.igmp_flow_check, None, None)
4760 self.voltha_subscribers(services, cbs = cbs,
4761 num_subscribers = num_subscribers,
4762 num_channels = num_channels)
4763
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004764 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 +00004765 """
4766 Test Method:
4767 0. Make sure that voltha is up and running on CORD-POD setup.
4768 1. OLT and ONU is detected and validated.
4769 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4770 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4771 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4772 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4773 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4774 7. Send igmp leave for a multicast group address multi-group-addressA.
4775 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.
4776 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester.
4777 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004778 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4779 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004780 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00004781 services = ('IGMP')
4782 cbs = (self.igmp_flow_check, None, None)
4783 self.voltha_subscribers(services, cbs = cbs,
4784 num_subscribers = num_subscribers,
4785 num_channels = num_channels)
4786
Thangavelu K S6432b522017-07-22 00:05:54 +00004787 def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004788 """
4789 Test Method:
4790 0. Make sure that voltha is up and running on CORD-POD setup.
4791 1. OLT and ONU is detected and validated.
4792 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4793 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4794 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4795 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4796 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4797 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4798 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4799 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004800 num_subscribers = 1
4801 num_channels = 1
4802 services = ('IGMP')
4803 cbs = (self.igmp_flow_check, None, None)
4804 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4805 num_subscribers = num_subscribers,
4806 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004807
Thangavelu K S6432b522017-07-22 00:05:54 +00004808 def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004809 """
4810 Test Method:
4811 0. Make sure that voltha is up and running on CORD-POD setup.
4812 1. OLT and ONU is detected and validated.
4813 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4814 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4815 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4816 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4817 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4818 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA
4819 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4820 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4821 """
4822
Thangavelu K S8e413082017-07-13 20:02:14 +00004823 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00004824 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00004825 services = ('IGMP')
4826 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4827 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4828 num_subscribers = num_subscribers,
4829 num_channels = num_channels)
4830
Thangavelu K S6432b522017-07-22 00:05:54 +00004831 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 +00004832 """
4833 Test Method:
4834 0. Make sure that voltha is up and running on CORD-POD setup.
4835 1. OLT and ONU is detected and validated.
4836 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4837 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4838 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4839 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4840 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4841 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA
4842 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4843 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4844 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004845 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00004846 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00004847 services = ('IGMP')
4848 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4849 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4850 num_subscribers = num_subscribers,
4851 num_channels = num_channels)
4852
Thangavelu K S6432b522017-07-22 00:05:54 +00004853 def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004854 """
4855 Test Method:
4856 0. Make sure that voltha is up and running on CORD-POD setup.
4857 1. OLT and ONU is detected and validated.
4858 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4859 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4860 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4861 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4862 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4863 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA
4864 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4865 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4866 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004867
4868 num_subscribers = 1
4869 num_channels = 1
4870 services = ('IGMP')
4871 cbs = (self.igmp_flow_check_join_change_to_block, None, None)
4872 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4873 num_subscribers = num_subscribers,
4874 num_channels = num_channels)
4875
Thangavelu K S6432b522017-07-22 00:05:54 +00004876 def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004877 """
4878 Test Method:
4879 0. Make sure that voltha is up and running on CORD-POD setup.
4880 1. OLT and ONU is detected and validated.
4881 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4882 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4883 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4884 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4885 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4886 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB
4887 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4888 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4889 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004890
4891 num_subscribers = 1
4892 num_channels = 1
4893 services = ('IGMP')
4894 cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None)
4895 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4896 num_subscribers = num_subscribers,
4897 num_channels = num_channels)
4898
Thangavelu K S6432b522017-07-22 00:05:54 +00004899 def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004900 """
4901 Test Method:
4902 0. Make sure that voltha is up and running on CORD-POD setup.
4903 1. OLT and ONU is detected and validated.
4904 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4905 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4906 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4907 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4908 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4909 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4910 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4911 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004912
4913 num_subscribers = 1
4914 num_channels = 1
4915 services = ('IGMP')
4916 cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None)
4917 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4918 num_subscribers = num_subscribers,
4919 num_channels = num_channels)
4920
Thangavelu K S6432b522017-07-22 00:05:54 +00004921 def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004922 """
4923 Test Method:
4924 0. Make sure that voltha is up and running on CORD-POD setup.
4925 1. OLT and ONU is detected and validated.
4926 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4927 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4928 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4929 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4930 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4931 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4932 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4933 """
4934
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004935 num_subscribers = 1
4936 num_channels = 1
4937 services = ('IGMP')
4938 cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None)
4939 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4940 num_subscribers = num_subscribers,
4941 num_channels = num_channels)
4942
Thangavelu K S6432b522017-07-22 00:05:54 +00004943 def test_two_subscribers_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004944 """
4945 Test Method:
4946 0. Make sure that voltha is up and running on CORD-POD setup.
4947 1. OLT and ONU is detected and validated.
4948 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4949 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4950 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4951 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4952 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4953 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4954 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4955 """
4956
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004957 num_subscribers = 2
4958 num_channels = 1
4959 services = ('IGMP')
4960 cbs = (self.igmp_flow_check, None, None)
4961 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'],
4962 num_subscribers = num_subscribers,
4963 num_channels = num_channels)
4964
Thangavelu K S36edb012017-07-05 18:24:12 +00004965 def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self):
4966 """
4967 Test Method:
4968 0. Make sure that voltha is up and running on CORD-POD setup.
4969 1. OLT and ONU is detected and validated.
4970 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4971 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4972 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4973 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4974 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4975 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4976 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4977 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4978 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4979 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4980 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004981 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00004982 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004983 services = ('IGMP')
4984 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4985 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'],
4986 num_subscribers = num_subscribers,
4987 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004988
Thangavelu K S6432b522017-07-22 00:05:54 +00004989 def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004990 """
4991 Test Method:
4992 0. Make sure that voltha is up and running on CORD-POD setup.
4993 1. OLT and ONU is detected and validated.
4994 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4995 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4996 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4997 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4998 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4999 7. Verify that multicast group adress (multi-group-addressA) data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5000 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.
5001 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5002 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.
5003 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.
5004 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.
5005 """
5006
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005007 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005008 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005009 services = ('IGMP')
5010 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
5011 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'],
5012 num_subscribers = num_subscribers,
5013 num_channels = num_channels)
5014
5015 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005016 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 +00005017 """
5018 Test Method:
5019 0. Make sure that voltha is up and running on CORD-POD setup.
5020 1. OLT and ONU is detected and validated.
5021 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5022 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5023 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5024 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5025 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5026 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5027 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5028 9. Disable uni_2 port which is being shown on voltha CLI.
5029 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5030 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5031 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005032 #rx_port = self.port_map['ports'][port_list[i][1]]
5033 df = defer.Deferred()
5034 def igmp_flow_check_operating_onu_admin_state(df):
5035 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005036 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005037 services = ('IGMP')
5038 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5039 port_list = self.generate_port_list(num_subscribers, num_channels)
5040
Thangavelu K S9a637332017-08-01 23:22:23 +00005041 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 +00005042 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5043 thread1.start()
5044 time.sleep(randint(40,50))
5045 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
5046 thread2.start()
5047 time.sleep(10)
5048 thread1.join()
5049 thread2.join()
5050 try:
5051 assert_equal(self.success, False)
5052 log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check')
5053 time.sleep(10)
5054 finally:
5055 pass
5056 df.callback(0)
5057 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5058 return df
5059
5060 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00005061 def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self):
5062 """
5063 Test Method:
5064 0. Make sure that voltha is up and running on CORD-POD setup.
5065 1. OLT and ONU is detected and validated.
5066 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5067 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5068 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5069 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5070 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5071 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5072 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5073 9. Disable uni_2 port which is being shown on voltha CLI.
5074 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5075 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5076 12. Enable uni_2 port which we disable at step 9.
5077 13. Repeat step 5,6 and 8.
5078 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005079 df = defer.Deferred()
5080 def igmp_flow_check_operating_onu_admin_state(df):
5081 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005082 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005083 services = ('IGMP')
5084 cbs = (self.igmp_flow_check, None, None)
5085 port_list = self.generate_port_list(num_subscribers, num_channels)
5086
Thangavelu K S9a637332017-08-01 23:22:23 +00005087 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 +00005088 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5089 thread1.start()
5090 time.sleep(randint(50,60))
5091 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
5092 thread2.start()
5093 time.sleep(10)
5094 thread1.join()
5095 thread2.join()
5096 try:
5097 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005098 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 +00005099 time.sleep(10)
5100 finally:
5101 pass
5102 df.callback(0)
5103 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5104 return df
5105
5106 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005107 def test_two_subscribers_with_voltha_for_igmp_disabling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005108 """
5109 Test Method:
5110 0. Make sure that voltha is up and running on CORD-POD setup.
5111 1. OLT and ONU is detected and validated.
5112 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5113 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5114 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5115 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5116 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5117 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5118 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5119 9. Disable olt device which is being shown on voltha CLI.
5120 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5121 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5122 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005123 df = defer.Deferred()
5124 def igmp_flow_check_operating_olt_admin_disble(df):
5125 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005126 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005127 services = ('IGMP')
5128 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5129 port_list = self.generate_port_list(num_subscribers, num_channels)
5130
Thangavelu K S9a637332017-08-01 23:22:23 +00005131 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 +00005132 thread1.start()
5133 time.sleep(randint(50,60))
5134 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5135 thread2.start()
5136 time.sleep(10)
5137 thread1.join()
5138 thread2.join()
5139 try:
5140 assert_equal(self.success, False)
5141 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5142 time.sleep(10)
5143 finally:
5144 pass
5145 df.callback(0)
5146 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5147 return df
5148
5149 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005150 def test_two_subscribers_with_voltha_for_igmp_pausing_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005151 """
5152 Test Method:
5153 0. Make sure that voltha is up and running on CORD-POD setup.
5154 1. OLT and ONU is detected and validated.
5155 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5156 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5157 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5158 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5159 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5160 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5161 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5162 9. Pause olt device which is being shown on voltha CLI.
5163 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5164 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5165 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005166 df = defer.Deferred()
5167 def igmp_flow_check_operating_olt_admin_pause(df):
5168 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005169 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005170 services = ('IGMP')
5171 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5172 port_list = self.generate_port_list(num_subscribers, num_channels)
5173
Thangavelu K S9a637332017-08-01 23:22:23 +00005174 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 +00005175 thread1.start()
5176 time.sleep(randint(50,60))
5177 thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,))
5178 thread2.start()
5179 time.sleep(10)
5180 thread1.join()
5181 thread2.join()
5182 try:
5183 assert_equal(self.success, False)
5184 log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test')
5185 time.sleep(10)
5186 finally:
5187 pass
5188 df.callback(0)
5189 reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df)
5190 return df
5191
5192 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005193 def test_two_subscribers_with_voltha_for_igmp_toggling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005194 """
5195 Test Method:
5196 0. Make sure that voltha is up and running on CORD-POD setup.
5197 1. OLT and ONU is detected and validated.
5198 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5199 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5200 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5201 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5202 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5203 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5204 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5205 9. Disable olt device which is being shown on voltha CLI.
5206 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5207 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5208 12. Enable olt device which is disable at step 9.
5209 13. Repeat steps 4,5, 7 and 8.
5210 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005211 df = defer.Deferred()
5212 def igmp_flow_check_operating_olt_admin_restart(df):
5213 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005214 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005215 services = ('IGMP')
5216 cbs = (self.igmp_flow_check, None, None)
5217 port_list = self.generate_port_list(num_subscribers, num_channels)
5218
Thangavelu K S9a637332017-08-01 23:22:23 +00005219 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 +00005220 thread1.start()
5221 time.sleep(randint(50,60))
5222 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5223 thread2.start()
5224 time.sleep(10)
5225 thread1.join()
5226 thread2.join()
5227 try:
5228 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005229 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 +00005230 time.sleep(10)
5231 finally:
5232 pass
5233 df.callback(0)
5234 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5235 return df
Thangavelu K S6432b522017-07-22 00:05:54 +00005236
5237 @deferred(TESTCASE_TIMEOUT)
5238 def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self):
5239 """
5240 Test Method:
5241 0. Make sure that voltha is up and running on CORD-POD setup.
5242 1. OLT and ONU is detected and validated.
5243 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5244 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5245 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5246 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5247 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5248 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5249 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5250 9. Disable olt device which is being shown on voltha CLI.
5251 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5252 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5253 12. Repeat steps 4 to 11 steps multiple times (example 20 times)
5254 """
5255 df = defer.Deferred()
5256 no_iterations = 20
5257 def igmp_flow_check_operating_olt_admin_disble(df):
5258 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005259 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005260 services = ('IGMP')
5261 cbs = (self.igmp_flow_check, None, None)
5262 port_list = self.generate_port_list(num_subscribers, num_channels)
5263
Thangavelu K S9a637332017-08-01 23:22:23 +00005264 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 +00005265 thread1.start()
5266 time.sleep(randint(30,40))
5267 for i in range(no_iterations):
5268 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5269 thread2.start()
5270 time.sleep(8)
5271 thread2.join()
5272 thread1.join()
5273 thread1.isAlive()
5274 thread2.join()
5275 try:
5276 assert_equal(self.success, False)
5277 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5278 time.sleep(10)
5279 finally:
5280 pass
5281 df.callback(0)
5282 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5283 return df
5284
5285 @deferred(TESTCASE_TIMEOUT + 200)
5286 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self):
5287 """
5288 Test Method:
5289 0. Make sure that voltha is up and running on CORD-POD setup.
5290 1. OLT and ONU is detected and validated.
5291 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5292 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5293 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5294 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5295 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5296 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5297 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5298 9. Disable uni_2 port which is being shown on voltha CLI.
5299 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5300 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5301 12. Enable uni_2 port which we disable at step 9.
5302 13. Repeat step 5,6 and 8.
5303 14. Repeat steps 4 to 13 steps multiple times (example 5 times)
5304 """
5305 df = defer.Deferred()
5306 no_iterations = 5
5307 def igmp_flow_check_operating_onu_admin_state(df):
5308 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005309 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005310 services = ('IGMP')
5311 cbs = (self.igmp_flow_check, None, None)
5312 port_list = self.generate_port_list(num_subscribers, num_channels)
5313
Thangavelu K S9a637332017-08-01 23:22:23 +00005314 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 +00005315 thread1.start()
5316 time.sleep(randint(40,60))
5317 for i in range(no_iterations):
5318 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5319 log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha')
5320 thread2.start()
5321 time.sleep(1)
5322 thread2.join()
5323 thread1.isAlive()
5324 thread1.join()
5325 thread2.join()
5326 try:
5327 assert_equal(self.success, True)
5328 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful')
5329 time.sleep(10)
5330 finally:
5331 pass
5332 df.callback(0)
5333 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5334 return df
5335
5336 @deferred(TESTCASE_TIMEOUT)
5337 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self):
5338 """
5339 Test Method:
5340 0. Make sure that voltha is up and running on CORD-POD setup.
5341 1. OLT and ONU is detected and validated.
5342 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5343 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5344 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5345 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5346 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5347 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5348 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5349 9. Disable olt device which is being shown on voltha CLI.
5350 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5351 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5352 12. Enable olt device which is disable at step 9.
5353 13. Repeat steps 4,5, 7 and 8.
5354 14. Repeat steps 4 to 13 steps multiple times (example 10 times)
5355 """
5356 df = defer.Deferred()
5357 no_iterations = 10
5358 def igmp_flow_check_operating_olt_admin_restart(df):
5359 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005360 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005361 services = ('IGMP')
5362 cbs = (self.igmp_flow_check, None, None)
5363 port_list = self.generate_port_list(num_subscribers, num_channels)
5364
Thangavelu K S9a637332017-08-01 23:22:23 +00005365 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 +00005366 thread1.start()
5367 time.sleep(randint(50,60))
5368 for i in range(no_iterations):
5369 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5370 thread2.start()
5371 time.sleep(10)
5372 thread2.join()
5373 thread1.join()
5374 thread2.join()
5375 try:
5376 assert_equal(self.success, True)
5377 log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful')
5378 time.sleep(10)
5379 finally:
5380 pass
5381 df.callback(0)
5382 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5383 return df
5384
5385 def test_5_subscriber_with_voltha_for_igmp_with_10_group_joins_verifying_traffic(self):
5386 """
5387 Test Method:
5388 0. Make sure that voltha is up and running on CORD-POD setup.
5389 1. OLT and ONU is detected and validated.
5390 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5391 3. Issue multiple dhcp client packets to get IP address from dhcp server for as subscribers and check connectivity.
5392 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5393 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5394 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5395 """
5396
5397 num_subscribers = 5
5398 num_channels = 10
5399 services = ('IGMP')
5400 cbs = (self.igmp_flow_check, None, None)
5401 self.voltha_subscribers(services, cbs = cbs,
5402 num_subscribers = num_subscribers,
5403 num_channels = num_channels)
5404
5405 def test_9_subscriber_with_voltha_for_igmp_with_10_group_joins_and_verify_traffic(self):
5406 """
5407 Test Method:
5408 0. Make sure that voltha is up and running on CORD-POD setup.
5409 1. OLT and ONU is detected and validated.
5410 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5411 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity.
5412 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5413 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5414 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5415 """
5416 num_subscribers = 9
5417 num_channels = 10
5418 services = ('IGMP')
5419 cbs = (self.igmp_flow_check, None, None)
5420 self.voltha_subscribers(services, cbs = cbs,
5421 num_subscribers = num_subscribers,
5422 num_channels = num_channels)