blob: a705519024f55cc579fd478e995166d0337be063 [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'
A R Karthick31a40172017-08-14 12:06:09 -0700270 VOLTHA_OLT_IP = None
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:
A R Karthick31a40172017-08-14 12:06:09 -07001481 if self.VOLTHA_OLT_TYPE.startswith('maple'):
1482 if self.VOLTHA_OLT_IP:
1483 address = self.VOLTHA_OLT_IP
1484 log_test.info('Enabling maple olt')
1485 device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = address)
1486 else:
1487 log_test.info('VOLTHA OLT IP needs to be specified for maple olt')
1488 else:
1489 log_test.info('This setup test cases is developed for ponsim or maple olt only, hence stop execution')
1490 assert_equal(False, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00001491
1492 assert_not_equal(device_id, None)
1493 if status == False:
1494 voltha.disable_device(device_id, delete = True)
1495 assert_equal(status, True)
1496 time.sleep(10)
1497 switch_map = None
1498 olt_configured = False
1499 try:
1500 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1501 if not switch_map:
1502 log_test.info('No voltha devices found')
1503 return
1504 log_test.info('Installing OLT app')
1505 OnosCtrl.install_app(self.olt_app_file)
1506 time.sleep(5)
1507 log_test.info('Adding subscribers through OLT app')
1508 self.config_olt(switch_map)
1509 olt_configured = True
1510 time.sleep(5)
1511 self.num_subscribers = num_subscribers
1512 self.num_channels = num_channels
1513 test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers,
1514 num_channels = self.num_channels,
1515 cbs = cbs,
1516 port_list = self.generate_port_list(self.num_subscribers,
1517 self.num_channels),
Thangavelu K S8e413082017-07-13 20:02:14 +00001518 src_list = src_list, services = services)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001519 if test_status is False:
1520 self.success = False
Thangavelu K S36edb012017-07-05 18:24:12 +00001521 assert_equal(test_status, True)
1522 finally:
1523 if switch_map is not None:
1524 if olt_configured is True:
1525 self.remove_olt(switch_map)
1526 voltha.disable_device(device_id, delete = True)
1527 time.sleep(10)
1528 log_test.info('Uninstalling OLT app')
1529 OnosCtrl.uninstall_app(self.olt_app_name)
1530
Thangavelu K S8e413082017-07-13 20:02:14 +00001531 def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1,
1532 channel_start = 0, cbs = None, port_list = [], src_list = None,
Thangavelu K S36edb012017-07-05 18:24:12 +00001533 services = None, negative_subscriber_auth = None):
1534 self.test_status = False
1535 self.ovs_cleanup()
1536 subscribers_count = num_subscribers
1537 sub_loop_count = num_subscribers
1538 if not port_list:
1539 port_list = self.generate_port_list(num_subscribers, num_channels)
1540 subscriber_tx_rx_ports = []
1541 for i in range(num_subscribers):
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001542 subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map[port_list[i][0]],
1543 rx_port = self.port_map[port_list[i][1]],
Thangavelu K S8e413082017-07-13 20:02:14 +00001544 num_channels = num_channels,src_list = src_list,))
Thangavelu K S36edb012017-07-05 18:24:12 +00001545 self.onos_aaa_load()
Thangavelu K S8e413082017-07-13 20:02:14 +00001546 #load the ssm list for all subscriber channels
1547 igmpChannel = IgmpChannel(src_list = src_list)
1548 ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports)
1549 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
Thangavelu K S6432b522017-07-22 00:05:54 +00001550 if src_list is None:
1551 igmpChannel = IgmpChannel()
1552 igmpChannel.igmp_load_ssm_config(ssm_list)
1553 else:
1554 igmpChannel = IgmpChannel(src_list = src_list)
1555 igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001556
Thangavelu K S36edb012017-07-05 18:24:12 +00001557 self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1)
1558
1559 chan_leave = False #for single channel, multiple subscribers
1560 if cbs is None:
1561 cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check)
1562 chan_leave = True
1563 for subscriber in subscriber_tx_rx_ports:
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001564 if 'IGMP' in services:
1565# if src_list:
1566# for i in range(len(src_list)):
1567# subscriber.start(src_ip = src_list[i])
1568# else:
1569# subscriber.start()
1570 subscriber.start()
Thangavelu K S36edb012017-07-05 18:24:12 +00001571 sub_loop_count = sub_loop_count - 1
1572 pool_object = voltha_subscriber_pool(subscriber, cbs)
1573 self.thread_pool.addTask(pool_object.pool_cb)
1574 self.thread_pool.cleanUpThreads()
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001575 for subscriber in subscriber_tx_rx_ports:
1576 if services and 'IGMP' in services:
1577# if src_list:
1578# for i in range(len(src_list)):
1579# subscriber.stop(src_ip = src_list[i])
1580# else:
1581# subscriber.stop()
1582 subscriber.stop()
1583 if chan_leave is True:
1584 subscriber.channel_leave(0)
Thangavelu K S36edb012017-07-05 18:24:12 +00001585 subscribers_count = 0
1586 return self.test_status
1587
1588
1589 def generate_port_list(self, subscribers, channels):
1590 return self.port_list[:subscribers]
1591
Thangavelu K S36edb012017-07-05 18:24:12 +00001592 @classmethod
1593 def ovs_cleanup(cls):
1594 ##For every test case, delete all the OVS groups
1595 cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1'
1596 try:
1597 cord_test_shell(cmd)
1598 ##Since olt config is used for this test, we just fire a careless local cmd as well
1599 os.system(cmd)
1600 finally:
1601 return
1602
A.R Karthick8a507cf2017-06-02 18:44:49 -07001603 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -07001604 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -07001605 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
1606 assert_not_equal(device_id, None)
1607 try:
1608 assert_equal(status, True)
1609 time.sleep(10)
1610 finally:
1611 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001612
A.R Karthick8a507cf2017-06-02 18:44:49 -07001613 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001614 log_test.info('Enabling ponsim_olt')
1615 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -07001616 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1617 assert_not_equal(device_id, None)
1618 try:
1619 assert_equal(status, True)
1620 time.sleep(10)
1621 finally:
1622 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001623
A R Karthick31a40172017-08-14 12:06:09 -07001624 def test_maple_enable_disable(self):
1625 log_test.info('Enabling maple olt')
1626 if self.VOLTHA_OLT_IP:
1627 address = self.VOLTHA_OLT_IP
1628 device_id, status = self.voltha.enable_device('maple_olt', address = address)
1629 assert_not_equal(device_id, None)
1630 try:
1631 assert_equal(status, True)
1632 time.sleep(10)
1633 finally:
1634 self.voltha.disable_device(device_id, delete = True)
1635
Thangavelu K S008f38e2017-05-15 19:36:55 +00001636 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
1637 """
1638 Test Method:
1639 0. Make sure that voltha is up and running on CORD-POD setup.
1640 1. OLT and ONU is detected and validated.
1641 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1642 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
1643 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
1644 5. Verify that subscriber is authenticated successfully.
1645 """
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001646 ret = voltha_setup(
1647 host = self.VOLTHA_HOST,
1648 rest_port = self.VOLTHA_REST_PORT,
1649 olt_type = 'ponsim_olt',
1650 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP,
1651 uplink_vlan_start = self.VOLTHA_UPLINK_VLAN_START,
1652 config_fake = self.VOLTHA_CONFIG_FAKE,
1653 olt_app = self.olt_app_file)
1654 assert_not_equal(ret, None)
1655 voltha, device_id, switch_map = ret[0], ret[1], ret[2]
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001656 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001657 log_test.info('Adding subscribers through OLT app')
1658 self.config_olt(switch_map)
1659 olt_configured = True
1660 time.sleep(5)
1661 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001662 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001663 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001664 if switch_map is not None:
1665 if olt_configured is True:
1666 self.remove_olt(switch_map)
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001667 voltha_teardown(voltha, device_id, switch_map, olt_app = self.olt_app_file)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001668
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001669 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001670 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
1671 """
1672 Test Method:
1673 0. Make sure that voltha is up and running on CORD-POD setup.
1674 1. OLT and ONU is detected and validated.
1675 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1676 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1677 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
1678 5. Verify that subscriber authentication is unsuccessful..
1679 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001680 df = defer.Deferred()
1681 def tls_flow_check_with_no_cert_scenario(df):
1682 log_test.info('Enabling ponsim_olt')
1683 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1684 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1685 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001686 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001687 time.sleep(10)
1688 switch_map = None
1689 olt_configured = False
1690 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1691 log_test.info('Installing OLT app')
1692 OnosCtrl.install_app(self.olt_app_file)
1693 time.sleep(5)
1694 log_test.info('Adding subscribers through OLT app')
1695 self.config_olt(switch_map)
1696 olt_configured = True
1697 time.sleep(5)
1698 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1699 try:
1700 assert_equal(auth_status, True)
1701 assert_equal(status, True)
1702 time.sleep(10)
1703 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001704 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001705 self.voltha.disable_device(device_id, delete = True)
1706 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001707
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001708 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1709 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001710
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001711 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001712 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
1713 """
1714 Test Method:
1715 0. Make sure that voltha is up and running on CORD-POD setup.
1716 1. OLT and ONU is detected and validated.
1717 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1718 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
1719 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1720 5. Verify that subscriber authentication is unsuccessful..
1721 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001722 df = defer.Deferred()
1723 def tls_flow_check_with_invalid_cert_scenario(df):
1724 log_test.info('Enabling ponsim_olt')
1725 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1726 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1727 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001728 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001729 time.sleep(10)
1730 switch_map = None
1731 olt_configured = False
1732 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1733 log_test.info('Installing OLT app')
1734 OnosCtrl.install_app(self.olt_app_file)
1735 time.sleep(5)
1736 log_test.info('Adding subscribers through OLT app')
1737 self.config_olt(switch_map)
1738 olt_configured = True
1739 time.sleep(5)
1740 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1741 try:
1742 assert_equal(auth_status, True)
1743 assert_equal(status, True)
1744 time.sleep(10)
1745 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001746 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001747 self.voltha.disable_device(device_id, delete = True)
1748 df.callback(0)
1749 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
1750 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001751
Thangavelu K S0d745c82017-06-09 21:56:08 +00001752 @deferred(TESTCASE_TIMEOUT)
1753 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
1754 """
1755 Test Method:
1756 0. Make sure that voltha is up and running on CORD-POD setup.
1757 1. OLT and ONU is detected and validated.
1758 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1759 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
1760 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1761 5. Verify that subscriber authentication is unsuccessful..
1762 """
1763 df = defer.Deferred()
1764 def tls_flow_check_with_no_cert_scenario(df):
1765 log_test.info('Enabling ponsim_olt')
1766 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1767 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1768 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001769 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001770 time.sleep(10)
1771 switch_map = None
1772 olt_configured = False
1773 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1774 log_test.info('Installing OLT app')
1775 OnosCtrl.install_app(self.olt_app_file)
1776 time.sleep(5)
1777 log_test.info('Adding subscribers through OLT app')
1778 self.config_olt(switch_map)
1779 olt_configured = True
1780 time.sleep(5)
1781 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1782 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1783 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1784 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1785 try:
1786 assert_equal(auth_status, True)
1787 assert_equal(status, True)
1788 time.sleep(10)
1789 finally:
1790 self.voltha.disable_device(device_id, delete = True)
1791 df.callback(0)
1792 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1793 return df
1794
1795 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001796 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
1797 """
1798 Test Method:
1799 0. Make sure that voltha is up and running on CORD-POD setup.
1800 1. OLT and ONU is detected and validated.
1801 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1802 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1803 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
1804 5. Verify that subscriber authentication is unsuccessful..
1805 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001806 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001807 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001808 aaa_app = ["org.opencord.aaa"]
1809 log_test.info('Enabling ponsim_olt')
1810 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1811 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1812 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001813 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001814 time.sleep(10)
1815 switch_map = None
1816 olt_configured = False
1817 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1818 log_test.info('Installing OLT app')
1819 OnosCtrl.install_app(self.olt_app_file)
1820 time.sleep(5)
1821 log_test.info('Adding subscribers through OLT app')
1822 self.config_olt(switch_map)
1823 olt_configured = True
1824 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001825
Thangavelu K S0d745c82017-06-09 21:56:08 +00001826 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
1827 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
1828 thread1.start()
1829 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001830 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001831 thread2.start()
1832 time.sleep(10)
1833 thread1.join()
1834 thread2.join()
1835 try:
1836 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001837 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001838 time.sleep(10)
1839 finally:
1840 self.voltha.disable_device(device_id, delete = True)
1841 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001842 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001843 return df
1844
1845 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001846 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
1847 """
1848 Test Method:
1849 0. Make sure that voltha is up and running on CORD-POD setup.
1850 1. OLT and ONU is detected and validated.
1851 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1852 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1853 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
1854 5. Verify that subscriber authentication is unsuccessful..
1855 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001856 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001857 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001858 aaa_app = ["org.opencord.aaa"]
1859 log_test.info('Enabling ponsim_olt')
1860 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1861 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1862 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001863 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001864 time.sleep(10)
1865 switch_map = None
1866 olt_configured = False
1867 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1868 log_test.info('Installing OLT app')
1869 OnosCtrl.install_app(self.olt_app_file)
1870 time.sleep(5)
1871 log_test.info('Adding subscribers through OLT app')
1872 self.config_olt(switch_map)
1873 olt_configured = True
1874 time.sleep(5)
1875
1876 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
1877 thread2 = threading.Thread(target = cord_test_radius_restart)
1878 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001879 time.sleep(randint(1,2))
1880 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001881 thread2.start()
1882 time.sleep(10)
1883 thread1.join()
1884 thread2.join()
1885 try:
1886 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001887 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001888 time.sleep(10)
1889 finally:
1890 self.voltha.disable_device(device_id, delete = True)
1891 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001892 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001893 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001894
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001895 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001896 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
1897 """
1898 Test Method:
1899 0. Make sure that voltha is up and running on CORD-POD setup.
1900 1. OLT and ONU is detected and validated.
1901 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1902 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1903 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1904 6. Verify that subscriber authenticated successfully.
1905 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
1906 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1907 9. Verify that subscriber authentication is unsuccessful..
1908 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001909 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001910 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001911 aaa_app = ["org.opencord.aaa"]
1912 log_test.info('Enabling ponsim_olt')
1913 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1914 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1915 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001916 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001917 time.sleep(10)
1918 switch_map = None
1919 olt_configured = False
1920 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1921 log_test.info('Installing OLT app')
1922 OnosCtrl.install_app(self.olt_app_file)
1923 time.sleep(5)
1924 log_test.info('Adding subscribers through OLT app')
1925 self.config_olt(switch_map)
1926 olt_configured = True
1927 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001928
Thangavelu K S0d745c82017-06-09 21:56:08 +00001929 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001930 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +00001931 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001932 time.sleep(randint(1,2))
1933 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001934 thread2.start()
1935 time.sleep(10)
1936 thread1.join()
1937 thread2.join()
1938 try:
1939 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001940 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001941 time.sleep(10)
1942 finally:
1943 self.voltha.disable_device(device_id, delete = True)
1944 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001945 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001946 return df
1947
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001948 @deferred(TESTCASE_TIMEOUT)
1949 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001950 """
1951 Test Method:
1952 0. Make sure that voltha is up and running on CORD-POD setup.
1953 1. OLT and ONU is detected and validated.
1954 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1955 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1956 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1957 6. Verify that subscriber authenticated successfully.
1958 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1959 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1960 9. Verify that subscriber authentication is unsuccessful..
1961 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001962 df = defer.Deferred()
1963 def tls_flow_check_operating_olt_state(df):
1964 aaa_app = ["org.opencord.aaa"]
1965 log_test.info('Enabling ponsim_olt')
1966 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
1967 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1968 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001969 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001970 time.sleep(10)
1971 switch_map = None
1972 olt_configured = False
1973 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1974 log_test.info('Installing OLT app')
1975 OnosCtrl.install_app(self.olt_app_file)
1976 time.sleep(5)
1977 log_test.info('Adding subscribers through OLT app')
1978 self.config_olt(switch_map)
1979 olt_configured = True
1980 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001981
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001982 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1983 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
1984 thread1.start()
1985 time.sleep(randint(1,2))
1986 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1987 thread2.start()
1988 time.sleep(10)
1989 thread1.join()
1990 thread2.join()
1991 try:
1992 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001993 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001994 time.sleep(10)
1995 finally:
1996 self.voltha.disable_device(device_id, delete = True)
1997 df.callback(0)
1998 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1999 return df
2000
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002001 @deferred(TESTCASE_TIMEOUT +600)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002002 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self):
2003 """
2004 Test Method:
2005 0. Make sure that voltha is up and running on CORD-POD setup.
2006 1. OLT and ONU is detected and validated.
2007 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2008 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2009 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2010 6. Verify that subscriber authenticated successfully.
2011 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
2012 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2013 9. Verify that subscriber authentication is unsuccessful..
2014 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2015
2016 """
2017 df = defer.Deferred()
2018 no_iterations = 10
2019 def tls_flow_check_with_disable_olt_device_scenario(df):
2020 aaa_app = ["org.opencord.aaa"]
2021 log_test.info('Enabling ponsim_olt')
2022 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2023 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2024 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002025 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002026 time.sleep(10)
2027 switch_map = None
2028 olt_configured = False
2029 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2030 log_test.info('Installing OLT app')
2031 OnosCtrl.install_app(self.olt_app_file)
2032 time.sleep(5)
2033 log_test.info('Adding subscribers through OLT app')
2034 self.config_olt(switch_map)
2035 olt_configured = True
2036 time.sleep(5)
2037 for i in range(no_iterations):
2038 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 +00002039 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002040 thread1.start()
2041 time.sleep(randint(1,2))
2042 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
2043 thread2.start()
2044 time.sleep(10)
2045 thread1.join()
2046 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002047 time.sleep(60)
2048 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002049 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2050 try:
2051 # assert_equal(status, True)
2052 assert_equal(auth_status, True)
2053 assert_equal(self.success, True)
2054 time.sleep(10)
2055 finally:
2056 self.voltha.disable_device(device_id, delete = True)
2057 df.callback(0)
2058 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2059 return df
2060
2061 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002062 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
2063 """
2064 Test Method:
2065 0. Make sure that voltha is up and running on CORD-POD setup.
2066 1. OLT and ONU is detected and validated.
2067 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2068 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2069 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2070 6. Verify that subscriber authenticated successfully.
2071 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2072 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2073 9. Verify that subscriber authentication is unsuccessful..
2074 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002075 df = defer.Deferred()
2076 def tls_flow_check_operating_olt_state(df):
2077 aaa_app = ["org.opencord.aaa"]
2078 log_test.info('Enabling ponsim_olt')
2079 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2080 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2081 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002082 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002083 time.sleep(10)
2084 switch_map = None
2085 olt_configured = False
2086 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2087 log_test.info('Installing OLT app')
2088 OnosCtrl.install_app(self.olt_app_file)
2089 time.sleep(5)
2090 log_test.info('Adding subscribers through OLT app')
2091 self.config_olt(switch_map)
2092 olt_configured = True
2093 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002094
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002095 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2096 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2097 thread1.start()
2098 time.sleep(randint(1,2))
2099 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2100 thread2.start()
2101 time.sleep(10)
2102 thread1.join()
2103 thread2.join()
2104 try:
2105 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002106 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002107 time.sleep(10)
2108 finally:
2109 self.voltha.disable_device(device_id, delete = True)
2110 df.callback(0)
2111 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2112 return df
2113
2114 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002115 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self):
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002116 """
2117 Test Method:
2118 0. Make sure that voltha is up and running on CORD-POD setup.
2119 1. OLT and ONU is detected and validated.
2120 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2121 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2122 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2123 6. Verify that subscriber authenticated successfully.
2124 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2125 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2126 9. Verify that subscriber authentication is unsuccessful..
2127 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2128 """
2129 df = defer.Deferred()
2130 no_iterations = 10
2131 def tls_flow_check_with_disable_olt_device_scenario(df):
2132 aaa_app = ["org.opencord.aaa"]
2133 log_test.info('Enabling ponsim_olt')
2134 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2135 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2136 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002137 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002138 time.sleep(10)
2139 switch_map = None
2140 olt_configured = False
2141 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2142 log_test.info('Installing OLT app')
2143 OnosCtrl.install_app(self.olt_app_file)
2144 time.sleep(5)
2145 log_test.info('Adding subscribers through OLT app')
2146 self.config_olt(switch_map)
2147 olt_configured = True
2148 time.sleep(5)
2149 for i in range(no_iterations):
2150 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2151 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2152 thread1.start()
2153 time.sleep(randint(1,2))
2154 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2155 thread2.start()
2156 time.sleep(10)
2157 thread1.join()
2158 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002159 time.sleep(60)
2160 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002161 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2162 try:
2163 # assert_equal(status, True)
2164 assert_equal(auth_status, True)
2165 assert_equal(self.success, True)
2166 time.sleep(10)
2167 finally:
2168 self.voltha.disable_device(device_id, delete = True)
2169 df.callback(0)
2170 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2171 return df
2172
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002173 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002174 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
2175 """
2176 Test Method:
2177 0. Make sure that voltha is up and running on CORD-POD setup.
2178 1. OLT and ONU is detected and validated.
2179 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2180 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2181 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2182 6. Verify that subscriber authenticated successfully.
2183 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2184 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2185 9. Verify that subscriber authentication is unsuccessful..
2186 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002187 df = defer.Deferred()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002188 def tls_flow_check_operating_onu_state(df):
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002189 aaa_app = ["org.opencord.aaa"]
2190 log_test.info('Enabling ponsim_olt')
2191 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2192 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2193 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00002194 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2195
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002196 onu_device_id = devices_list['items'][1]['id']
2197 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002198 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002199 time.sleep(10)
2200 switch_map = None
2201 olt_configured = False
2202 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2203 log_test.info('Installing OLT app')
2204 OnosCtrl.install_app(self.olt_app_file)
2205 time.sleep(5)
2206 log_test.info('Adding subscribers through OLT app')
2207 self.config_olt(switch_map)
2208 olt_configured = True
2209 time.sleep(5)
2210 devices_list = self.voltha.get_devices()
2211 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2212 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2213 thread1.start()
2214 time.sleep(randint(1,2))
2215 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2216 thread2.start()
2217 time.sleep(10)
2218 thread1.join()
2219 thread2.join()
2220 try:
2221 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002222 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002223 time.sleep(10)
2224 finally:
2225 self.voltha.disable_device(device_id, delete = True)
2226 df.callback(0)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002227 reactor.callLater(0, tls_flow_check_operating_onu_state, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002228 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002229
Thangavelu K S9648eed2017-06-13 20:15:25 +00002230 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002231 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
2232 """
2233 Test Method:
2234 0. Make sure that voltha is up and running on CORD-POD setup.
2235 1. OLT and ONU is detected and validated.
2236 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2237 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2238 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2239 6. Verify that subscriber authenticated successfully.
2240 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2241 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2242 9. Verify that subscriber authentication is unsuccessful..
2243 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2244 """
2245 df = defer.Deferred()
2246 no_iterations = 10
2247 def tls_flow_check_operating_olt_state(df):
2248 aaa_app = ["org.opencord.aaa"]
2249 log_test.info('Enabling ponsim_olt')
2250 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2251 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2252 devices_list = self.voltha.get_devices()
2253 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2254
2255 onu_device_id = devices_list['items'][1]['id']
2256 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002257 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002258 time.sleep(10)
2259 switch_map = None
2260 olt_configured = False
2261 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2262 log_test.info('Installing OLT app')
2263 OnosCtrl.install_app(self.olt_app_file)
2264 time.sleep(5)
2265 log_test.info('Adding subscribers through OLT app')
2266 self.config_olt(switch_map)
2267 olt_configured = True
2268 time.sleep(5)
2269 devices_list = self.voltha.get_devices()
2270 for i in range(no_iterations):
2271 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2272 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2273 thread1.start()
2274 time.sleep(randint(1,2))
2275 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2276 thread2.start()
2277 time.sleep(10)
2278 thread1.join()
2279 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002280 time.sleep(60)
2281 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002282 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2283 try:
2284 # assert_equal(status, True)
2285 assert_equal(auth_status, True)
2286 assert_equal(self.success, True)
2287 time.sleep(10)
2288 finally:
2289 self.voltha.disable_device(device_id, delete = True)
2290 df.callback(0)
2291 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2292 return df
2293
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002294 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002295 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002296 """
2297 Test Method:
2298 0. Make sure that voltha is up and running on CORD-POD setup.
2299 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2300 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2301 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2302 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
2303 5. Verify that two subscribers are authenticated successfully.
2304 """
2305
Thangavelu K S9648eed2017-06-13 20:15:25 +00002306 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002307 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002308 aaa_app = ["org.opencord.aaa"]
2309 log_test.info('Enabling ponsim_olt')
2310 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2311 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2312 devices_list = self.voltha.get_devices()
2313 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2314
2315 onu_device_id = devices_list['items'][1]['id']
2316 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002317 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002318 time.sleep(10)
2319 switch_map = None
2320 olt_configured = False
2321 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2322 log_test.info('Installing OLT app')
2323 OnosCtrl.install_app(self.olt_app_file)
2324 time.sleep(5)
2325 log_test.info('Adding subscribers through OLT app')
2326 self.config_olt(switch_map)
2327 olt_configured = True
2328 time.sleep(5)
2329 devices_list = self.voltha.get_devices()
2330 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2331 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2332 thread1.start()
2333 time.sleep(randint(1,2))
2334 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2335 thread2.start()
2336 time.sleep(10)
2337 thread1.join()
2338 thread2.join()
2339 try:
2340 # assert_equal(status, True)
2341 assert_equal(self.success, True)
2342 time.sleep(10)
2343 finally:
2344 self.voltha.disable_device(device_id, delete = True)
2345 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002346 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002347 return df
2348
2349 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002350 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002351 """
2352 Test Method:
2353 0. Make sure that voltha is up and running on CORD-POD setup.
2354 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2355 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2356 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2357 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
2358 5. Verify that two subscribers are not authenticated.
2359 """
2360
Thangavelu K S9648eed2017-06-13 20:15:25 +00002361 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002362 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002363 aaa_app = ["org.opencord.aaa"]
2364 log_test.info('Enabling ponsim_olt')
2365 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2366 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2367 devices_list = self.voltha.get_devices()
2368 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2369
2370 onu_device_id = devices_list['items'][1]['id']
2371 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002372 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002373 time.sleep(10)
2374 switch_map = None
2375 olt_configured = False
2376 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2377 log_test.info('Installing OLT app')
2378 OnosCtrl.install_app(self.olt_app_file)
2379 time.sleep(5)
2380 log_test.info('Adding subscribers through OLT app')
2381 self.config_olt(switch_map)
2382 olt_configured = True
2383 time.sleep(5)
2384 devices_list = self.voltha.get_devices()
2385 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2386 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
2387 thread1.start()
2388 time.sleep(randint(1,2))
2389 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2390 thread2.start()
2391 time.sleep(10)
2392 thread1.join()
2393 thread2.join()
2394 try:
2395 # assert_equal(status, True)
2396 assert_equal(self.success, True)
2397 time.sleep(10)
2398 finally:
2399 self.voltha.disable_device(device_id, delete = True)
2400 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002401 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002402 return df
2403
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002404 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002405 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 +00002406 """
2407 Test Method:
2408 0. Make sure that voltha is up and running on CORD-POD setup.
2409 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2410 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2411 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2412 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2413 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
2414 6. Verify that valid subscriber authenticated successfully.
2415 7. Verify that invalid subscriber are not authenticated successfully.
2416 """
2417
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002418 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002419 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002420 aaa_app = ["org.opencord.aaa"]
2421 log_test.info('Enabling ponsim_olt')
2422 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2423 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2424 devices_list = self.voltha.get_devices()
2425 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2426
2427 onu_device_id = devices_list['items'][1]['id']
2428 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002429 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002430 time.sleep(10)
2431 switch_map = None
2432 olt_configured = False
2433 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2434 log_test.info('Installing OLT app')
2435 OnosCtrl.install_app(self.olt_app_file)
2436 time.sleep(5)
2437 log_test.info('Adding subscribers through OLT app')
2438 self.config_olt(switch_map)
2439 olt_configured = True
2440 time.sleep(5)
2441 devices_list = self.voltha.get_devices()
2442 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2443 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
2444 thread1.start()
2445 time.sleep(randint(1,2))
2446 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2447 thread2.start()
2448 time.sleep(10)
2449 thread1.join()
2450 thread2.join()
2451 try:
2452 # assert_equal(status, True)
2453 assert_equal(self.success, True)
2454 time.sleep(10)
2455 finally:
2456 self.voltha.disable_device(device_id, delete = True)
2457 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002458 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002459 return df
2460
2461 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002462 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 +00002463 """
2464 Test Method:
2465 0. Make sure that voltha is up and running on CORD-POD setup.
2466 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2467 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2468 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2469 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2470 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
2471 6. Verify that valid subscriber authenticated successfully.
2472 7. Verify that invalid subscriber are not authenticated successfully.
2473 """
2474
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002475 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002476 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002477 aaa_app = ["org.opencord.aaa"]
2478 log_test.info('Enabling ponsim_olt')
2479 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2480 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2481 devices_list = self.voltha.get_devices()
2482 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2483
2484 onu_device_id = devices_list['items'][1]['id']
2485 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002486 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002487 time.sleep(10)
2488 switch_map = None
2489 olt_configured = False
2490 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2491 log_test.info('Installing OLT app')
2492 OnosCtrl.install_app(self.olt_app_file)
2493 time.sleep(5)
2494 log_test.info('Adding subscribers through OLT app')
2495 self.config_olt(switch_map)
2496 olt_configured = True
2497 time.sleep(5)
2498 devices_list = self.voltha.get_devices()
2499 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2500 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
2501 thread1.start()
2502 time.sleep(randint(1,2))
2503 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2504 thread2.start()
2505 time.sleep(10)
2506 thread1.join()
2507 thread2.join()
2508 try:
2509 # assert_equal(status, True)
2510 assert_equal(self.success, True)
2511 time.sleep(10)
2512 finally:
2513 self.voltha.disable_device(device_id, delete = True)
2514 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002515 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002516 return df
2517
2518 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002519 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002520 """
2521 Test Method:
2522 0. Make sure that voltha is up and running on CORD-POD setup.
2523 1. OLT and ONU is detected and validated.
2524 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2525 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2526 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
2527 6. Verify that subscriber authenticated successfully.
2528 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
2529 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
2530 9. Verify that subscriber authentication is unsuccessful..
2531 10. Verify that other subscriber authenticated successfully.
2532 """
2533
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002534 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002535 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002536 aaa_app = ["org.opencord.aaa"]
2537 log_test.info('Enabling ponsim_olt')
2538 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2539 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2540 devices_list = self.voltha.get_devices()
2541 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2542
2543 onu_device_id = devices_list['items'][1]['id']
2544 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002545 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002546 time.sleep(10)
2547 switch_map = None
2548 olt_configured = False
2549 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2550 log_test.info('Installing OLT app')
2551 OnosCtrl.install_app(self.olt_app_file)
2552 time.sleep(5)
2553 log_test.info('Adding subscribers through OLT app')
2554 self.config_olt(switch_map)
2555 olt_configured = True
2556 time.sleep(5)
2557 devices_list = self.voltha.get_devices()
2558 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2559 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
2560 thread1.start()
2561 time.sleep(randint(1,2))
2562 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2563 thread2.start()
2564 time.sleep(10)
2565 thread1.join()
2566 thread2.join()
2567 try:
2568 # assert_equal(status, True)
2569 assert_equal(self.success, True)
2570 time.sleep(10)
2571 finally:
2572 self.voltha.disable_device(device_id, delete = True)
2573 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002574 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002575 return df
2576
Thangavelu K S36edb012017-07-05 18:24:12 +00002577 def test_3_subscribers_with_voltha_for_eap_tls_authentication(self):
2578 """
2579 Test Method:
2580 0. Make sure that voltha is up and running on CORD-POD setup.
2581 1. OLT and ONU is detected and validated.
2582 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2583 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers)
2584 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2585 5. Verify that subscriber is authenticated successfully.
2586 """
2587 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2588 num_subscribers = 3
2589 num_channels = 1
2590 services = ('TLS')
2591 cbs = (self.tls_flow_check, None, None)
2592 self.voltha_subscribers(services, cbs = cbs,
2593 num_subscribers = num_subscribers,
2594 num_channels = num_channels)
2595
2596 def test_5_subscribers_with_voltha_for_eap_tls_authentication(self):
2597 """
2598 Test Method:
2599 0. Make sure that voltha is up and running on CORD-POD setup.
2600 1. OLT and ONU is detected and validated.
2601 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2602 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber)
2603 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2604 5. Verify that subscriber is authenticated successfully.
2605 """
2606 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2607 num_subscribers = 5
2608 num_channels = 1
2609 services = ('TLS')
2610 cbs = (self.tls_flow_check, None, None)
2611 self.voltha_subscribers(services, cbs = cbs,
2612 num_subscribers = num_subscribers,
2613 num_channels = num_channels)
2614
2615 def test_9_subscribers_with_voltha_for_eap_tls_authentication(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. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2621 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber)
2622 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2623 5. Verify that subscriber is authenticated successfully.
2624 """
2625 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2626 num_subscribers = 9
2627 num_channels = 1
2628 services = ('TLS')
2629 cbs = (self.tls_flow_check, None, None)
2630 self.voltha_subscribers(services, cbs = cbs,
2631 num_subscribers = num_subscribers,
2632 num_channels = num_channels)
2633
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002634 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002635 def test_subscriber_with_voltha_for_dhcp_request(self):
2636 """
2637 Test Method:
2638 0. Make sure that voltha is up and running on CORD-POD setup.
2639 1. OLT and ONU is detected and validated.
2640 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2641 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2642 4. Verify that subscriber get ip from dhcp server successfully.
2643 """
2644
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002645 df = defer.Deferred()
2646 def dhcp_flow_check_scenario(df):
2647 log_test.info('Enabling ponsim_olt')
2648 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2649 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2650 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002651 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002652 time.sleep(10)
2653 switch_map = None
2654 olt_configured = False
2655 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2656 log_test.info('Installing OLT app')
2657 OnosCtrl.install_app(self.olt_app_file)
2658 time.sleep(5)
2659 log_test.info('Adding subscribers through OLT app')
2660 self.config_olt(switch_map)
2661 olt_configured = True
2662 time.sleep(5)
2663 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2664 try:
2665 assert_equal(dhcp_status, True)
2666 #assert_equal(status, True)
2667 time.sleep(10)
2668 finally:
2669 self.remove_olt(switch_map)
2670 self.voltha.disable_device(device_id, delete = True)
2671 df.callback(0)
2672
2673 reactor.callLater(0, dhcp_flow_check_scenario, df)
2674 return df
2675
2676 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002677 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
2678 """
2679 Test Method:
2680 0. Make sure that voltha is up and running on CORD-POD setup.
2681 1. OLT and ONU is detected and validated.
2682 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2683 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
2684 4. Verify that subscriber should not get ip from dhcp server.
2685 """
2686
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002687 df = defer.Deferred()
2688 def dhcp_flow_check_scenario(df):
2689 log_test.info('Enabling ponsim_olt')
2690 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2691 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2692 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002693 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002694 time.sleep(10)
2695 switch_map = None
2696 olt_configured = False
2697 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2698 log_test.info('Installing OLT app')
2699 OnosCtrl.install_app(self.olt_app_file)
2700 time.sleep(5)
2701 log_test.info('Adding subscribers through OLT app')
2702 self.config_olt(switch_map)
2703 olt_configured = True
2704 time.sleep(5)
2705 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
2706 try:
2707 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002708 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002709 #assert_equal(status, True)
2710 time.sleep(10)
2711 finally:
2712 self.voltha.disable_device(device_id, delete = True)
2713 self.remove_olt(switch_map)
2714 df.callback(0)
2715
2716 reactor.callLater(0, dhcp_flow_check_scenario, df)
2717 return df
2718
2719
2720 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002721 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
2722 """
2723 Test Method:
2724 0. Make sure that voltha is up and running on CORD-POD setup.
2725 1. OLT and ONU is detected and validated.
2726 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2727 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
2728 4. Verify that subscriber should not get ip from dhcp server.
2729 """
2730
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002731 df = defer.Deferred()
2732 def dhcp_flow_check_scenario(df):
2733 log_test.info('Enabling ponsim_olt')
2734 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2735 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2736 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002737 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002738 time.sleep(10)
2739 switch_map = None
2740 olt_configured = False
2741 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2742 log_test.info('Installing OLT app')
2743 OnosCtrl.install_app(self.olt_app_file)
2744 time.sleep(5)
2745 log_test.info('Adding subscribers through OLT app')
2746 self.config_olt(switch_map)
2747 olt_configured = True
2748 time.sleep(5)
2749 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
2750 try:
2751 assert_equal(dhcp_status, True)
2752 #assert_equal(status, True)
2753 time.sleep(10)
2754 finally:
2755 self.voltha.disable_device(device_id, delete = True)
2756 self.remove_olt(switch_map)
2757 df.callback(0)
2758
2759 reactor.callLater(0, dhcp_flow_check_scenario, df)
2760 return df
2761
2762 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002763 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
2764 """
2765 Test Method:
2766 0. Make sure that voltha is up and running on CORD-POD setup.
2767 1. OLT and ONU is detected and validated.
2768 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2769 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
2770 4. Verify that subscriber should not get ip from dhcp server.
2771 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002772 df = defer.Deferred()
2773 def dhcp_flow_check_scenario(df):
2774 log_test.info('Enabling ponsim_olt')
2775 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2776 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2777 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002778 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002779 time.sleep(10)
2780 switch_map = None
2781 olt_configured = False
2782 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2783 log_test.info('Installing OLT app')
2784 OnosCtrl.install_app(self.olt_app_file)
2785 time.sleep(5)
2786 log_test.info('Adding subscribers through OLT app')
2787 self.config_olt(switch_map)
2788 olt_configured = True
2789 time.sleep(5)
2790 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
2791 try:
2792 assert_equal(dhcp_status, True)
2793 #assert_equal(status, True)
2794 time.sleep(10)
2795 finally:
2796 self.voltha.disable_device(device_id, delete = True)
2797 self.remove_olt(switch_map)
2798 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002799
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002800 reactor.callLater(0, dhcp_flow_check_scenario, df)
2801 return df
2802
2803 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002804 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
2805 """
2806 Test Method:
2807 0. Make sure that voltha is up and running on CORD-POD setup.
2808 1. OLT and ONU is detected and validated.
2809 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2810 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2811 4. Verify that subscriber get ip from dhcp server successfully.
2812 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
2813 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
2814 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002815 df = defer.Deferred()
2816 def dhcp_flow_check_scenario(df):
2817 log_test.info('Enabling ponsim_olt')
2818 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2819 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2820 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002821 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002822 time.sleep(10)
2823 switch_map = None
2824 olt_configured = False
2825 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2826 log_test.info('Installing OLT app')
2827 OnosCtrl.install_app(self.olt_app_file)
2828 time.sleep(5)
2829 log_test.info('Adding subscribers through OLT app')
2830 self.config_olt(switch_map)
2831 olt_configured = True
2832 time.sleep(5)
2833 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
2834 try:
2835 assert_equal(dhcp_status, True)
2836 #assert_equal(status, True)
2837 time.sleep(10)
2838 finally:
2839 self.voltha.disable_device(device_id, delete = True)
2840 self.remove_olt(switch_map)
2841 df.callback(0)
2842
2843 reactor.callLater(0, dhcp_flow_check_scenario, df)
2844 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002845
Thangavelu K S735a6662017-06-15 18:08:23 +00002846
2847 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07002848 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002849 """
2850 Test Method:
2851 0. Make sure that voltha is up and running on CORD-POD setup.
2852 1. OLT and ONU is detected and validated.
2853 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2854 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2855 4. Verify that subscriber get ip from dhcp server successfully.
2856 5. Repeat step 3 and 4 for 10 times.
2857 6 Verify that subscriber should get ip from dhcp server.
2858 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002859 df = defer.Deferred()
2860 def dhcp_flow_check_scenario(df):
2861 log_test.info('Enabling ponsim_olt')
2862 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2863 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2864 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002865 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002866 time.sleep(10)
2867 switch_map = None
2868 olt_configured = False
2869 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2870 log_test.info('Installing OLT app')
2871 OnosCtrl.install_app(self.olt_app_file)
2872 time.sleep(5)
2873 log_test.info('Adding subscribers through OLT app')
2874 self.config_olt(switch_map)
2875 olt_configured = True
2876 time.sleep(5)
2877 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
2878 try:
2879 assert_equal(dhcp_status, True)
2880 #assert_equal(status, True)
2881 time.sleep(10)
2882 finally:
2883 self.voltha.disable_device(device_id, delete = True)
2884 self.remove_olt(switch_map)
2885 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002886
Thangavelu K S735a6662017-06-15 18:08:23 +00002887 reactor.callLater(0, dhcp_flow_check_scenario, df)
2888 return df
2889
Thangavelu K S735a6662017-06-15 18:08:23 +00002890 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002891 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
2892 """
2893 Test Method:
2894 0. Make sure that voltha is up and running on CORD-POD setup.
2895 1. OLT and ONU is detected and validated.
2896 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2897 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
2898 4. Verify that subscriber should not get ip from dhcp server.
2899 5. Repeat steps 3 and 4 for 10 times.
2900 6 Verify that subscriber should not get ip from dhcp server.
2901 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002902 df = defer.Deferred()
2903 def dhcp_flow_check_scenario(df):
2904 log_test.info('Enabling ponsim_olt')
2905 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2906 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2907 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002908 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002909 time.sleep(10)
2910 switch_map = None
2911 olt_configured = False
2912 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2913 log_test.info('Installing OLT app')
2914 OnosCtrl.install_app(self.olt_app_file)
2915 time.sleep(5)
2916 log_test.info('Adding subscribers through OLT app')
2917 self.config_olt(switch_map)
2918 olt_configured = True
2919 time.sleep(5)
2920 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
2921 try:
2922 assert_equal(dhcp_status, True)
2923 #assert_equal(status, True)
2924 time.sleep(10)
2925 finally:
2926 self.voltha.disable_device(device_id, delete = True)
2927 self.remove_olt(switch_map)
2928 df.callback(0)
2929
2930 reactor.callLater(0, dhcp_flow_check_scenario, df)
2931 return df
2932
Thangavelu K S735a6662017-06-15 18:08:23 +00002933 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002934 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
2935 """
2936 Test Method:
2937 0. Make sure that voltha is up and running on CORD-POD setup.
2938 1. OLT and ONU is detected and validated.
2939 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2940 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2941 4. Verify that subscriber get ip from dhcp server successfully.
2942 5. Repeat step 3 for 50 times.
2943 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2944 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002945 df = defer.Deferred()
2946 def dhcp_flow_check_scenario(df):
2947 log_test.info('Enabling ponsim_olt')
2948 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2949 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2950 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002951 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002952 time.sleep(10)
2953 switch_map = None
2954 olt_configured = False
2955 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2956 log_test.info('Installing OLT app')
2957 OnosCtrl.install_app(self.olt_app_file)
2958 time.sleep(5)
2959 log_test.info('Adding subscribers through OLT app')
2960 self.config_olt(switch_map)
2961 olt_configured = True
2962 time.sleep(5)
2963 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
2964 try:
2965 assert_equal(dhcp_status, True)
2966 #assert_equal(status, True)
2967 time.sleep(10)
2968 finally:
2969 self.voltha.disable_device(device_id, delete = True)
2970 self.remove_olt(switch_map)
2971 df.callback(0)
2972
2973 reactor.callLater(0, dhcp_flow_check_scenario, df)
2974 return df
2975
Thangavelu K S735a6662017-06-15 18:08:23 +00002976 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002977 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
2978 """
2979 Test Method:
2980 0. Make sure that voltha is up and running on CORD-POD setup.
2981 1. OLT and ONU is detected and validated.
2982 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2983 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2984 4. Verify that subscriber get ip from dhcp server successfully.
2985 5. Send DHCP request to dhcp server which is running as onos app.
2986 6. Repeat step 5 for 50 times.
2987 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2988 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002989 df = defer.Deferred()
2990 def dhcp_flow_check_scenario(df):
2991 log_test.info('Enabling ponsim_olt')
2992 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
2993 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2994 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002995 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002996 time.sleep(10)
2997 switch_map = None
2998 olt_configured = False
2999 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3000 log_test.info('Installing OLT app')
3001 OnosCtrl.install_app(self.olt_app_file)
3002 time.sleep(5)
3003 log_test.info('Adding subscribers through OLT app')
3004 self.config_olt(switch_map)
3005 olt_configured = True
3006 time.sleep(5)
3007 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
3008 try:
3009 assert_equal(dhcp_status, True)
3010 #assert_equal(status, True)
3011 time.sleep(10)
3012 finally:
3013 self.voltha.disable_device(device_id, delete = True)
3014 self.remove_olt(switch_map)
3015 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003016
Thangavelu K S735a6662017-06-15 18:08:23 +00003017 reactor.callLater(0, dhcp_flow_check_scenario, df)
3018 return df
3019
Thangavelu K S735a6662017-06-15 18:08:23 +00003020 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003021 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
3022 """
3023 Test Method:
3024 0. Make sure that voltha is up and running on CORD-POD setup.
3025 1. OLT and ONU is detected and validated.
3026 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3027 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
3028 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
3029 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003030 df = defer.Deferred()
3031 def dhcp_flow_check_scenario(df):
3032 log_test.info('Enabling ponsim_olt')
3033 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3034 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3035 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003036 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003037 time.sleep(10)
3038 switch_map = None
3039 olt_configured = False
3040 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3041 log_test.info('Installing OLT app')
3042 OnosCtrl.install_app(self.olt_app_file)
3043 time.sleep(5)
3044 log_test.info('Adding subscribers through OLT app')
3045 self.config_olt(switch_map)
3046 olt_configured = True
3047 time.sleep(5)
3048 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
3049 try:
3050 assert_equal(dhcp_status, True)
3051 #assert_equal(status, True)
3052 time.sleep(10)
3053 finally:
3054 self.voltha.disable_device(device_id, delete = True)
3055 self.remove_olt(switch_map)
3056 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003057
Thangavelu K S735a6662017-06-15 18:08:23 +00003058 reactor.callLater(0, dhcp_flow_check_scenario, df)
3059 return df
3060
3061 @deferred(TESTCASE_TIMEOUT)
3062 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003063 """
3064 Test Method:
3065 0. Make sure that voltha is up and running on CORD-POD setup.
3066 1. OLT and ONU is detected and validated.
3067 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3068 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
3069 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.
3070 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003071 df = defer.Deferred()
3072 def dhcp_flow_check_scenario(df):
3073 log_test.info('Enabling ponsim_olt')
3074 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3075 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3076 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003077 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003078 time.sleep(10)
3079 switch_map = None
3080 olt_configured = False
3081 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3082 log_test.info('Installing OLT app')
3083 OnosCtrl.install_app(self.olt_app_file)
3084 time.sleep(5)
3085 log_test.info('Adding subscribers through OLT app')
3086 self.config_olt(switch_map)
3087 olt_configured = True
3088 time.sleep(5)
3089 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
3090 try:
3091 assert_equal(dhcp_status, True)
3092 #assert_equal(status, True)
3093 time.sleep(10)
3094 finally:
3095 self.voltha.disable_device(device_id, delete = True)
3096 self.remove_olt(switch_map)
3097 df.callback(0)
3098
3099 reactor.callLater(0, dhcp_flow_check_scenario, df)
3100 return df
3101
Thangavelu K S735a6662017-06-15 18:08:23 +00003102 @deferred(TESTCASE_TIMEOUT)
3103 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003104 """
3105 Test Method:
3106 0. Make sure that voltha is up and running on CORD-POD setup.
3107 1. OLT and ONU is detected and validated.
3108 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3109 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3110 4. Verify that subscriber get ip from dhcp server successfully.
3111 5. Deactivate dhcp server app in onos.
3112 6. Repeat step 3.
3113 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3114 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003115 df = defer.Deferred()
3116 dhcp_app = 'org.onosproject.dhcp'
3117 def dhcp_flow_check_scenario(df):
3118 log_test.info('Enabling ponsim_olt')
3119 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3120 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3121 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003122 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003123 time.sleep(10)
3124 switch_map = None
3125 olt_configured = False
3126 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3127 log_test.info('Installing OLT app')
3128 OnosCtrl.install_app(self.olt_app_file)
3129 time.sleep(5)
3130 log_test.info('Adding subscribers through OLT app')
3131 self.config_olt(switch_map)
3132 olt_configured = True
3133 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003134 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00003135 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
3136 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3137 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00003138 thread1.start()
3139 time.sleep(10)
3140 thread1.join()
3141 thread2.join()
3142 try:
3143 assert_equal(self.success, True)
3144 #assert_equal(status, True)
3145 time.sleep(10)
3146 finally:
3147 self.voltha.disable_device(device_id, delete = True)
3148 self.remove_olt(switch_map)
3149 df.callback(0)
3150
3151 reactor.callLater(0, dhcp_flow_check_scenario, df)
3152 return df
3153
3154 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003155 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
3156 """
3157 Test Method:
3158 0. Make sure that voltha is up and running on CORD-POD setup.
3159 1. OLT and ONU is detected and validated.
3160 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3161 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3162 4. Verify that subscriber get ip from dhcp server successfully.
3163 5. Send dhcp renew packet to dhcp server which is running as onos app.
3164 6. Repeat step 4.
3165 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003166
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003167 df = defer.Deferred()
3168 def dhcp_flow_check_scenario(df):
3169 log_test.info('Enabling ponsim_olt')
3170 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3171 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3172 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003173 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003174 time.sleep(10)
3175 switch_map = None
3176 olt_configured = False
3177 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3178 log_test.info('Installing OLT app')
3179 OnosCtrl.install_app(self.olt_app_file)
3180 time.sleep(5)
3181 log_test.info('Adding subscribers through OLT app')
3182 self.config_olt(switch_map)
3183 olt_configured = True
3184 time.sleep(5)
3185 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
3186 try:
3187 assert_equal(dhcp_status, True)
3188 #assert_equal(status, True)
3189 time.sleep(10)
3190 finally:
3191 self.voltha.disable_device(device_id, delete = True)
3192 self.remove_olt(switch_map)
3193 df.callback(0)
3194
3195 reactor.callLater(0, dhcp_flow_check_scenario, df)
3196 return df
3197
3198 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003199 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
3200 """
3201 Test Method:
3202 0. Make sure that voltha is up and running on CORD-POD setup.
3203 1. OLT and ONU is detected and validated.
3204 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3205 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3206 4. Verify that subscriber get ip from dhcp server successfully.
3207 5. Send dhcp rebind packet to dhcp server which is running as onos app.
3208 6. Repeat step 4.
3209 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003210 df = defer.Deferred()
3211 def dhcp_flow_check_scenario(df):
3212 log_test.info('Enabling ponsim_olt')
3213 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3214 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3215 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003216 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003217 time.sleep(10)
3218 switch_map = None
3219 olt_configured = False
3220 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3221 log_test.info('Installing OLT app')
3222 OnosCtrl.install_app(self.olt_app_file)
3223 time.sleep(5)
3224 log_test.info('Adding subscribers through OLT app')
3225 self.config_olt(switch_map)
3226 olt_configured = True
3227 time.sleep(5)
3228 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
3229 try:
3230 assert_equal(dhcp_status, True)
3231 #assert_equal(status, True)
3232 time.sleep(10)
3233 finally:
3234 self.voltha.disable_device(device_id, delete = True)
3235 self.remove_olt(switch_map)
3236 df.callback(0)
3237
3238 reactor.callLater(0, dhcp_flow_check_scenario, df)
3239 return df
3240
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003241 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003242 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003243 """
3244 Test Method:
3245 0. Make sure that voltha is up and running on CORD-POD setup.
3246 1. OLT and ONU is detected and validated.
3247 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3248 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3249 4. Verify that subscriber get ip from dhcp server successfully.
3250 5. Disable olt devices which is being detected in voltha CLI.
3251 6. Repeat step 3.
3252 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3253 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003254 df = defer.Deferred()
3255 dhcp_app = 'org.onosproject.dhcp'
3256 def dhcp_flow_check_scenario(df):
3257 log_test.info('Enabling ponsim_olt')
3258 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3259 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3260 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003261 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003262 time.sleep(10)
3263 switch_map = None
3264 olt_configured = False
3265 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3266 log_test.info('Installing OLT app')
3267 OnosCtrl.install_app(self.olt_app_file)
3268 time.sleep(5)
3269 log_test.info('Adding subscribers through OLT app')
3270 self.config_olt(switch_map)
3271 olt_configured = True
3272 time.sleep(5)
3273 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3274 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3275 log_test.info('Disable the olt device in during client send discover to voltha')
3276 thread2.start()
3277# time.sleep(randint(0,1))
3278 thread1.start()
3279 time.sleep(10)
3280 thread1.join()
3281 thread2.join()
3282 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003283 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003284 #assert_equal(status, True)
3285 time.sleep(10)
3286 finally:
3287 self.voltha.disable_device(device_id, delete = True)
3288 self.remove_olt(switch_map)
3289 df.callback(0)
3290
3291 reactor.callLater(0, dhcp_flow_check_scenario, df)
3292 return df
3293
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003294 @deferred(TESTCASE_TIMEOUT)
3295 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
3296 """
3297 Test Method:
3298 0. Make sure that voltha is up and running on CORD-POD setup.
3299 1. OLT and ONU is detected and validated.
3300 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3301 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3302 4. Verify that subscriber get ip from dhcp server successfully.
3303 5. Disable olt devices which is being detected in voltha CLI.
3304 6. Repeat step 3.
3305 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3306 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
3307 """
3308 df = defer.Deferred()
3309 no_iterations = 10
3310 dhcp_app = 'org.onosproject.dhcp'
3311 def dhcp_flow_check_scenario(df):
3312 log_test.info('Enabling ponsim_olt')
3313 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3314 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3315 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003316 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003317 time.sleep(10)
3318 switch_map = None
3319 olt_configured = False
3320 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3321 log_test.info('Installing OLT app')
3322 OnosCtrl.install_app(self.olt_app_file)
3323 time.sleep(5)
3324 log_test.info('Adding subscribers through OLT app')
3325 self.config_olt(switch_map)
3326 olt_configured = True
3327 time.sleep(5)
3328 for i in range(no_iterations):
3329 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3330 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3331 log_test.info('Disable the olt device in during client send discover to voltha')
3332 thread2.start()
3333# time.sleep(randint(0,1))
3334 thread1.start()
3335 time.sleep(10)
3336 thread1.join()
3337 thread2.join()
3338 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3339 try:
3340 assert_equal(self.success, True)
3341 assert_equal(dhcp_status, True)
3342 #assert_equal(status, True)
3343 time.sleep(10)
3344 finally:
3345 self.voltha.disable_device(device_id, delete = True)
3346 self.remove_olt(switch_map)
3347 df.callback(0)
3348
3349 reactor.callLater(0, dhcp_flow_check_scenario, df)
3350 return df
3351
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003352 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003353 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003354 """
3355 Test Method:
3356 0. Make sure that voltha is up and running on CORD-POD setup.
3357 1. OLT and ONU is detected and validated.
3358 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3359 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3360 4. Verify that subscriber get ip from dhcp server successfully.
3361 5. Disable olt devices which is being detected in voltha CLI.
3362 6. Repeat step 3.
3363 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3364 8. Enable olt devices which is being detected in voltha CLI.
3365 9. Repeat steps 3 and 4.
3366 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003367 df = defer.Deferred()
3368 dhcp_app = 'org.onosproject.dhcp'
3369 def dhcp_flow_check_scenario(df):
3370 log_test.info('Enabling ponsim_olt')
3371 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3372 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3373 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003374 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003375 time.sleep(10)
3376 switch_map = None
3377 olt_configured = False
3378 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3379 log_test.info('Installing OLT app')
3380 OnosCtrl.install_app(self.olt_app_file)
3381 time.sleep(5)
3382 log_test.info('Adding subscribers through OLT app')
3383 self.config_olt(switch_map)
3384 olt_configured = True
3385 time.sleep(5)
3386 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3387 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3388 thread2.start()
3389 thread1.start()
3390 time.sleep(10)
3391 thread1.join()
3392 thread2.join()
3393 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003394 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003395 #assert_equal(status, True)
3396 time.sleep(10)
3397 finally:
3398 self.voltha.disable_device(device_id, delete = True)
3399 self.remove_olt(switch_map)
3400 df.callback(0)
3401
3402 reactor.callLater(0, dhcp_flow_check_scenario, df)
3403 return df
3404
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003405 @deferred(TESTCASE_TIMEOUT)
3406 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
3407 """
3408 Test Method:
3409 0. Make sure that voltha is up and running on CORD-POD setup.
3410 1. OLT and ONU is detected and validated.
3411 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3412 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3413 4. Verify that subscriber get ip from dhcp server successfully.
3414 5. Disable olt devices which is being detected in voltha CLI.
3415 6. Repeat step 3.
3416 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3417 8. Enable olt devices which is being detected in voltha CLI.
3418 9. Repeat steps 3 and 4.
3419 """
3420
3421 df = defer.Deferred()
3422 no_iterations = 10
3423 dhcp_app = 'org.onosproject.dhcp'
3424 def dhcp_flow_check_scenario(df):
3425 log_test.info('Enabling ponsim_olt')
3426 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3427 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3428 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003429 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003430 time.sleep(10)
3431 switch_map = None
3432 olt_configured = False
3433 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3434 log_test.info('Installing OLT app')
3435 OnosCtrl.install_app(self.olt_app_file)
3436 time.sleep(5)
3437 log_test.info('Adding subscribers through OLT app')
3438 self.config_olt(switch_map)
3439 olt_configured = True
3440 time.sleep(5)
3441 for i in range(no_iterations):
3442 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3443 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3444 thread2.start()
3445 thread1.start()
3446 time.sleep(10)
3447 thread1.join()
3448 thread2.join()
3449 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3450 try:
3451 assert_equal(dhcp_status, True)
3452 #assert_equal(status, True)
3453 assert_equal(self.success, True)
3454 time.sleep(10)
3455 finally:
3456 self.voltha.disable_device(device_id, delete = True)
3457 self.remove_olt(switch_map)
3458 df.callback(0)
3459
3460 reactor.callLater(0, dhcp_flow_check_scenario, df)
3461 return df
3462
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003463 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003464 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003465 """
3466 Test Method:
3467 0. Make sure that voltha is up and running on CORD-POD setup.
3468 1. OLT and ONU is detected and validated.
3469 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3470 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3471 4. Verify that subscriber get ip from dhcp server successfully.
3472 5. Disable onu port which is being detected in voltha CLI.
3473 6. Repeat step 3.
3474 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3475 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003476 df = defer.Deferred()
3477 dhcp_app = 'org.onosproject.dhcp'
3478 def dhcp_flow_check_scenario(df):
3479 log_test.info('Enabling ponsim_olt')
3480 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3481 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3482 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003483 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003484 time.sleep(10)
3485 switch_map = None
3486 olt_configured = False
3487 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3488 log_test.info('Installing OLT app')
3489 OnosCtrl.install_app(self.olt_app_file)
3490 time.sleep(5)
3491 log_test.info('Adding subscribers through OLT app')
3492 self.config_olt(switch_map)
3493 olt_configured = True
3494 time.sleep(5)
3495 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 +00003496 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003497 thread1.start()
3498 thread2.start()
3499 time.sleep(10)
3500 thread1.join()
3501 thread2.join()
3502 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003503 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003504 #assert_equal(status, True)
3505 time.sleep(10)
3506 finally:
3507 self.voltha.disable_device(device_id, delete = True)
3508 self.remove_olt(switch_map)
3509 df.callback(0)
3510
3511 reactor.callLater(0, dhcp_flow_check_scenario, df)
3512 return df
3513
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003514 @deferred(TESTCASE_TIMEOUT)
3515 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
3516 """
3517 Test Method:
3518 0. Make sure that voltha is up and running on CORD-POD setup.
3519 1. OLT and ONU is detected and validated.
3520 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3521 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3522 4. Verify that subscriber get ip from dhcp server successfully.
3523 5. Disable onu port which is being detected in voltha CLI.
3524 6. Repeat step 3.
3525 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3526 """
3527 df = defer.Deferred()
3528 no_iterations = 10
3529 dhcp_app = 'org.onosproject.dhcp'
3530 def dhcp_flow_check_scenario(df):
3531 log_test.info('Enabling ponsim_olt')
3532 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3533 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3534 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003535 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003536 time.sleep(10)
3537 switch_map = None
3538 olt_configured = False
3539 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3540 log_test.info('Installing OLT app')
3541 OnosCtrl.install_app(self.olt_app_file)
3542 time.sleep(5)
3543 log_test.info('Adding subscribers through OLT app')
3544 self.config_olt(switch_map)
3545 olt_configured = True
3546 time.sleep(5)
3547 for i in range(no_iterations):
3548 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 +00003549 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003550 thread1.start()
3551 thread2.start()
3552 time.sleep(10)
3553 thread1.join()
3554 thread2.join()
3555 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3556 try:
3557 #assert_equal(status, True)
3558 assert_equal(dhcp_status, True)
3559 assert_equal(self.success, True)
3560 time.sleep(10)
3561 finally:
3562 self.voltha.disable_device(device_id, delete = True)
3563 self.remove_olt(switch_map)
3564 df.callback(0)
3565
3566 reactor.callLater(0, dhcp_flow_check_scenario, df)
3567 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003568
3569 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003570 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003571 """
3572 Test Method:
3573 0. Make sure that voltha is up and running on CORD-POD setup.
3574 1. OLT and ONU is detected and validated.
3575 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3576 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3577 4. Verify that subscriber get ip from dhcp server successfully.
3578 5. Disable onu port which is being detected in voltha CLI.
3579 6. Repeat step 3.
3580 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3581 8. Enable onu port which is being detected in voltha CLI.
3582 9. Repeat steps 3 and 4.
3583 """
3584
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003585 df = defer.Deferred()
3586 dhcp_app = 'org.onosproject.dhcp'
3587 def dhcp_flow_check_scenario(df):
3588 log_test.info('Enabling ponsim_olt')
3589 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3590 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3591 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003592 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003593 time.sleep(10)
3594 switch_map = None
3595 olt_configured = False
3596 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3597 log_test.info('Installing OLT app')
3598 OnosCtrl.install_app(self.olt_app_file)
3599 time.sleep(5)
3600 log_test.info('Adding subscribers through OLT app')
3601 self.config_olt(switch_map)
3602 olt_configured = True
3603 time.sleep(5)
3604 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 +00003605 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003606 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3607 thread2.start()
3608 time.sleep(randint(0,1))
3609 thread1.start()
3610 time.sleep(10)
3611 thread1.join()
3612 thread2.join()
3613 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3614 assert_equal(dhcp_status, True)
3615 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003616 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003617 #assert_equal(status, True)
3618 time.sleep(10)
3619 finally:
3620 self.voltha.disable_device(device_id, delete = True)
3621 self.remove_olt(switch_map)
3622 df.callback(0)
3623
3624 reactor.callLater(0, dhcp_flow_check_scenario, df)
3625 return df
3626
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003627 @deferred(TESTCASE_TIMEOUT)
3628 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
3629 """
3630 Test Method:
3631 0. Make sure that voltha is up and running on CORD-POD setup.
3632 1. OLT and ONU is detected and validated.
3633 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3634 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3635 4. Verify that subscriber get ip from dhcp server successfully.
3636 5. Disable onu port which is being detected in voltha CLI.
3637 6. Repeat step 3.
3638 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3639 8. Enable onu port which is being detected in voltha CLI.
3640 9. Repeat steps 3 and 4.
3641 """
3642
3643 df = defer.Deferred()
3644 no_iterations = 10
3645 dhcp_app = 'org.onosproject.dhcp'
3646 def dhcp_flow_check_scenario(df):
3647 log_test.info('Enabling ponsim_olt')
3648 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3649 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3650 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003651 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003652 time.sleep(10)
3653 switch_map = None
3654 olt_configured = False
3655 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3656 log_test.info('Installing OLT app')
3657 OnosCtrl.install_app(self.olt_app_file)
3658 time.sleep(5)
3659 log_test.info('Adding subscribers through OLT app')
3660 self.config_olt(switch_map)
3661 olt_configured = True
3662 time.sleep(5)
3663 for i in range(no_iterations):
3664 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 +00003665 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003666 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3667 thread2.start()
3668 time.sleep(randint(0,1))
3669 thread1.start()
3670 time.sleep(10)
3671 thread1.join()
3672 thread2.join()
3673 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3674 assert_equal(dhcp_status, True)
3675 try:
3676 assert_equal(self.success, True)
3677 #assert_equal(status, True)
3678 time.sleep(10)
3679 finally:
3680 self.voltha.disable_device(device_id, delete = True)
3681 self.remove_olt(switch_map)
3682 df.callback(0)
3683
3684 reactor.callLater(0, dhcp_flow_check_scenario, df)
3685 return df
3686
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003687 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003688 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003689 """
3690 Test Method:
3691 0. Make sure that voltha is up and running on CORD-POD setup.
3692 1. OLT and ONU is detected and validated.
3693 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3694 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3695 4. Verify that subscribers had got different ips from dhcp server successfully.
3696 """
3697
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003698 df = defer.Deferred()
3699 self.success = True
3700 dhcp_app = 'org.onosproject.dhcp'
3701 def dhcp_flow_check_scenario(df):
3702 log_test.info('Enabling ponsim_olt')
3703 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3704 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3705 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003706 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003707 time.sleep(10)
3708 switch_map = None
3709 olt_configured = False
3710 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3711 log_test.info('Installing OLT app')
3712 OnosCtrl.install_app(self.olt_app_file)
3713 time.sleep(5)
3714 log_test.info('Adding subscribers through OLT app')
3715 self.config_olt(switch_map)
3716 olt_configured = True
3717 time.sleep(5)
3718 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3719 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3720 thread1.start()
3721 thread2.start()
3722 time.sleep(10)
3723 thread1.join()
3724 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003725 dhcp_flow_status = self.success
3726 try:
3727# if self.success is not True:
3728 assert_equal(dhcp_flow_status, True)
3729 #assert_equal(status, True)
3730 time.sleep(10)
3731 finally:
3732 self.voltha.disable_device(device_id, delete = True)
3733 self.remove_olt(switch_map)
3734 df.callback(0)
3735
3736 reactor.callLater(0, dhcp_flow_check_scenario, df)
3737 return df
3738
3739 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003740 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003741 """
3742 Test Method:
3743 0. Make sure that voltha is up and running on CORD-POD setup.
3744 1. OLT and ONU is detected and validated.
3745 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3746 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3747 4. Verify that subscribers had got ip from dhcp server successfully.
3748 5. Repeat step 3 and 4 for 10 times for both subscribers.
3749 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
3750 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003751
3752
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003753 df = defer.Deferred()
3754 self.success = True
3755 dhcp_app = 'org.onosproject.dhcp'
3756 def dhcp_flow_check_scenario(df):
3757 log_test.info('Enabling ponsim_olt')
3758 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3759 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3760 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003761 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003762 time.sleep(10)
3763 switch_map = None
3764 olt_configured = False
3765 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3766 log_test.info('Installing OLT app')
3767 OnosCtrl.install_app(self.olt_app_file)
3768 time.sleep(5)
3769 log_test.info('Adding subscribers through OLT app')
3770 self.config_olt(switch_map)
3771 olt_configured = True
3772 time.sleep(5)
3773 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3774 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
3775 thread1.start()
3776 thread2.start()
3777 time.sleep(10)
3778 thread1.join()
3779 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003780 dhcp_flow_status = self.success
3781 try:
3782# if self.success is not True:
3783 assert_equal(dhcp_flow_status, True)
3784 #assert_equal(status, True)
3785 time.sleep(10)
3786 finally:
3787 self.voltha.disable_device(device_id, delete = True)
3788 self.remove_olt(switch_map)
3789 df.callback(0)
3790
3791 reactor.callLater(0, dhcp_flow_check_scenario, df)
3792 return df
3793
3794 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003795 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003796 """
3797 Test Method:
3798 0. Make sure that voltha is up and running on CORD-POD setup.
3799 1. OLT and ONU is detected and validated.
3800 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3801 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3802 4. Verify that subscribers had got ip from dhcp server successfully.
3803 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3804 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
3805 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003806
3807 df = defer.Deferred()
3808 self.success = True
3809 dhcp_app = 'org.onosproject.dhcp'
3810 def dhcp_flow_check_scenario(df):
3811 log_test.info('Enabling ponsim_olt')
3812 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3813 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3814 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003815 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003816 time.sleep(10)
3817 switch_map = None
3818 olt_configured = False
3819 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3820 log_test.info('Installing OLT app')
3821 OnosCtrl.install_app(self.olt_app_file)
3822 time.sleep(5)
3823 log_test.info('Adding subscribers through OLT app')
3824 self.config_olt(switch_map)
3825 olt_configured = True
3826 time.sleep(5)
3827 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3828 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3829 thread1.start()
3830 thread2.start()
3831 time.sleep(10)
3832 thread1.join()
3833 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003834 dhcp_flow_status = self.success
3835 try:
3836# if self.success is not True:
3837 assert_equal(dhcp_flow_status, True)
3838 #assert_equal(status, True)
3839 time.sleep(10)
3840 finally:
3841 self.voltha.disable_device(device_id, delete = True)
3842 self.remove_olt(switch_map)
3843 df.callback(0)
3844
3845 reactor.callLater(0, dhcp_flow_check_scenario, df)
3846 return df
3847
3848 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003849 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 +00003850 """
3851 Test Method:
3852 0. Make sure that voltha is up and running on CORD-POD setup.
3853 1. OLT and ONU is detected and validated.
3854 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3855 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
3856 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
3857 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
3858 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003859
3860 df = defer.Deferred()
3861 self.success = True
3862 dhcp_app = 'org.onosproject.dhcp'
3863 def dhcp_flow_check_scenario(df):
3864 log_test.info('Enabling ponsim_olt')
3865 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3866 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3867 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003868 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003869 time.sleep(10)
3870 switch_map = None
3871 olt_configured = False
3872 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3873 log_test.info('Installing OLT app')
3874 OnosCtrl.install_app(self.olt_app_file)
3875 time.sleep(5)
3876 log_test.info('Adding subscribers through OLT app')
3877 self.config_olt(switch_map)
3878 olt_configured = True
3879 time.sleep(5)
3880 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3881 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
3882 thread1.start()
3883 thread2.start()
3884 time.sleep(10)
3885 thread1.join()
3886 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003887 dhcp_flow_status = self.success
3888 try:
3889# if self.success is not True:
3890 assert_equal(dhcp_flow_status, True)
3891 #assert_equal(status, True)
3892 time.sleep(10)
3893 finally:
3894 self.voltha.disable_device(device_id, delete = True)
3895 self.remove_olt(switch_map)
3896 df.callback(0)
3897
3898 reactor.callLater(0, dhcp_flow_check_scenario, df)
3899 return df
3900
3901 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003902 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 +00003903 """
3904 Test Method:
3905 0. Make sure that voltha is up and running on CORD-POD setup.
3906 1. OLT and ONU is detected and validated.
3907 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3908 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
3909 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
3910 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
3911 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003912 df = defer.Deferred()
3913 self.success = True
3914 dhcp_app = 'org.onosproject.dhcp'
3915 def dhcp_flow_check_scenario(df):
3916 log_test.info('Enabling ponsim_olt')
3917 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3918 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3919 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003920 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003921 time.sleep(10)
3922 switch_map = None
3923 olt_configured = False
3924 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3925 log_test.info('Installing OLT app')
3926 OnosCtrl.install_app(self.olt_app_file)
3927 time.sleep(5)
3928 log_test.info('Adding subscribers through OLT app')
3929 self.config_olt(switch_map)
3930 olt_configured = True
3931 time.sleep(5)
3932 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3933 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3934 thread1.start()
3935 thread2.start()
3936 time.sleep(10)
3937 thread1.join()
3938 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003939 dhcp_flow_status = self.success
3940 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003941 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003942 time.sleep(10)
3943 finally:
3944 self.voltha.disable_device(device_id, delete = True)
3945 self.remove_olt(switch_map)
3946 df.callback(0)
3947
3948 reactor.callLater(0, dhcp_flow_check_scenario, df)
3949 return df
3950
3951 @deferred(TESTCASE_TIMEOUT)
3952 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003953 """
3954 Test Method:
3955 0. Make sure that voltha is up and running on CORD-POD setup.
3956 1. OLT and ONU is detected and validated.
3957 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3958 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3959 4. Verify that subscribers had got ip from dhcp server successfully.
3960 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3961 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3962 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3963 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003964 df = defer.Deferred()
3965 self.success = True
3966 dhcp_app = 'org.onosproject.dhcp'
3967 def dhcp_flow_check_scenario(df):
3968 log_test.info('Enabling ponsim_olt')
3969 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
3970 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3971 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003972 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003973 time.sleep(10)
3974 switch_map = None
3975 olt_configured = False
3976 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3977 log_test.info('Installing OLT app')
3978 OnosCtrl.install_app(self.olt_app_file)
3979 time.sleep(5)
3980 log_test.info('Adding subscribers through OLT app')
3981 self.config_olt(switch_map)
3982 olt_configured = True
3983 time.sleep(5)
3984 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3985 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3986 thread1.start()
3987 thread2.start()
3988 time.sleep(10)
3989 thread1.join()
3990 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003991 dhcp_flow_status = self.success
3992 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003993 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003994 time.sleep(10)
3995 finally:
3996 self.voltha.disable_device(device_id, delete = True)
3997 self.remove_olt(switch_map)
3998 df.callback(0)
3999
4000 reactor.callLater(0, dhcp_flow_check_scenario, df)
4001 return df
4002
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004003 @deferred(TESTCASE_TIMEOUT)
4004 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004005 """
4006 Test Method:
4007 0. Make sure that voltha is up and running on CORD-POD setup.
4008 1. OLT and ONU is detected and validated.
4009 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4010 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4011 4. Verify that subscribers had got ip from dhcp server successfully.
4012 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4013 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4014 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
4015 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
4016 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
4017 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
4018 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004019 df = defer.Deferred()
4020 self.success = True
4021 dhcp_app = 'org.onosproject.dhcp'
4022 def dhcp_flow_check_scenario(df):
4023 log_test.info('Enabling ponsim_olt')
4024 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4025 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4026 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004027 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004028 time.sleep(10)
4029 switch_map = None
4030 olt_configured = False
4031 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4032 log_test.info('Installing OLT app')
4033 OnosCtrl.install_app(self.olt_app_file)
4034 time.sleep(5)
4035 log_test.info('Adding subscribers through OLT app')
4036 self.config_olt(switch_map)
4037 olt_configured = True
4038 time.sleep(5)
4039 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4040 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 +00004041 thread3 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.INTF_2_RX_DEFAULT,))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004042 thread1.start()
4043 thread2.start()
4044 thread3.start()
4045 time.sleep(10)
4046 thread1.join()
4047 thread2.join()
4048 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004049 dhcp_flow_status = self.success
4050 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004051 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004052 time.sleep(10)
4053 finally:
4054 self.voltha.disable_device(device_id, delete = True)
4055 self.remove_olt(switch_map)
4056 df.callback(0)
4057
4058 reactor.callLater(0, dhcp_flow_check_scenario, df)
4059 return df
4060
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004061 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004062 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004063 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004064 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00004065 0. Make sure that voltha is up and running on CORD-POD setup.
4066 1. OLT and ONU is detected and validated.
4067 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4068 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4069 4. Verify that subscribers had got ip from dhcp server successfully.
4070 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4071 6. Disable the olt device which is detected in voltha.
4072 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4073 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004074 df = defer.Deferred()
4075 self.success = True
4076 dhcp_app = 'org.onosproject.dhcp'
4077 def dhcp_flow_check_scenario(df):
4078 log_test.info('Enabling ponsim_olt')
4079 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4080 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4081 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004082 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004083 time.sleep(10)
4084 switch_map = None
4085 olt_configured = False
4086 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4087 log_test.info('Installing OLT app')
4088 OnosCtrl.install_app(self.olt_app_file)
4089 time.sleep(5)
4090 log_test.info('Adding subscribers through OLT app')
4091 self.config_olt(switch_map)
4092 olt_configured = True
4093 time.sleep(5)
4094 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4095 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4096 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
4097
4098 thread1.start()
4099 thread2.start()
4100 thread3.start()
4101 time.sleep(10)
4102 thread1.join()
4103 thread2.join()
4104 thread3.join()
4105 dhcp_flow_status = self.success
4106 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004107 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004108 time.sleep(10)
4109 finally:
4110 self.voltha.disable_device(device_id, delete = True)
4111 self.remove_olt(switch_map)
4112 df.callback(0)
4113
4114 reactor.callLater(0, dhcp_flow_check_scenario, df)
4115 return df
4116
4117 @deferred(TESTCASE_TIMEOUT)
4118 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004119 """
4120 Test Method:
4121 0. Make sure that voltha is up and running on CORD-POD setup.
4122 1. OLT and ONU is detected and validated.
4123 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4124 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4125 4. Verify that subscribers had got ip from dhcp server successfully.
4126 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4127 6. Disable the olt device which is detected in voltha.
4128 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4129 8. Enable the olt device which is detected in voltha.
4130 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 +00004131
Thangavelu K S057b7d22017-05-16 22:03:22 +00004132 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004133 df = defer.Deferred()
4134 self.success = True
4135 dhcp_app = 'org.onosproject.dhcp'
4136 def dhcp_flow_check_scenario(df):
4137 log_test.info('Enabling ponsim_olt')
4138 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4139 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4140 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004141 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004142 time.sleep(10)
4143 switch_map = None
4144 olt_configured = False
4145 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4146 log_test.info('Installing OLT app')
4147 OnosCtrl.install_app(self.olt_app_file)
4148 time.sleep(5)
4149 log_test.info('Adding subscribers through OLT app')
4150 self.config_olt(switch_map)
4151 olt_configured = True
4152 time.sleep(5)
4153 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4154 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4155 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
4156 thread1.start()
4157 thread2.start()
4158 thread3.start()
4159 time.sleep(10)
4160 thread1.join()
4161 thread2.join()
4162 thread3.join()
4163 dhcp_flow_status = self.success
4164 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004165 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004166 time.sleep(10)
4167 finally:
4168 self.voltha.disable_device(device_id, delete = True)
4169 self.remove_olt(switch_map)
4170 df.callback(0)
4171
4172 reactor.callLater(0, dhcp_flow_check_scenario, df)
4173 return df
4174
4175 @deferred(TESTCASE_TIMEOUT)
4176 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004177 """
4178 Test Method:
4179 0. Make sure that voltha is up and running on CORD-POD setup.
4180 1. OLT and ONU is detected and validated.
4181 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4182 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4183 4. Verify that subscribers had got ip from dhcp server successfully.
4184 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4185 6. Pause the olt device which is detected in voltha.
4186 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4187 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004188 df = defer.Deferred()
4189 self.success = True
4190 dhcp_app = 'org.onosproject.dhcp'
4191 def dhcp_flow_check_scenario(df):
4192 log_test.info('Enabling ponsim_olt')
4193 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4194 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4195 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004196 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004197 time.sleep(10)
4198 switch_map = None
4199 olt_configured = False
4200 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4201 log_test.info('Installing OLT app')
4202 OnosCtrl.install_app(self.olt_app_file)
4203 time.sleep(5)
4204 log_test.info('Adding subscribers through OLT app')
4205 self.config_olt(switch_map)
4206 olt_configured = True
4207 time.sleep(5)
4208 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4209 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4210 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
4211 thread1.start()
4212 thread2.start()
4213 thread3.start()
4214 time.sleep(10)
4215 thread1.join()
4216 thread2.join()
4217 thread3.join()
4218 dhcp_flow_status = self.success
4219 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004220 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004221 time.sleep(10)
4222 finally:
4223 self.voltha.disable_device(device_id, delete = True)
4224 self.remove_olt(switch_map)
4225 df.callback(0)
4226
4227 reactor.callLater(0, dhcp_flow_check_scenario, df)
4228 return df
4229
Thangavelu K S36edb012017-07-05 18:24:12 +00004230 def test_3_subscribers_with_voltha_for_dhcp_discover_requests(self):
4231 """
4232 Test Method:
4233 0. Make sure that voltha is up and running on CORD-POD setup.
4234 1. OLT and ONU is detected and validated.
4235 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4236 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4237 4. Verify that subscriber get ip from dhcp server successfully.
4238 """
4239 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4240 num_subscribers = 3
4241 num_channels = 1
4242 services = ('DHCP')
4243 cbs = (self.dhcp_flow_check, None, None)
4244 self.voltha_subscribers(services, cbs = cbs,
4245 num_subscribers = num_subscribers,
4246 num_channels = num_channels)
4247
4248 def test_5_subscribers_with_voltha_for_dhcp_discover_requests(self):
4249 """
4250 Test Method:
4251 0. Make sure that voltha is up and running on CORD-POD setup.
4252 1. OLT and ONU is detected and validated.
4253 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4254 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4255 4. Verify that subscriber get ip from dhcp server successfully.
4256 """
4257 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4258 num_subscribers = 5
4259 num_channels = 1
4260 services = ('DHCP')
4261 cbs = (self.dhcp_flow_check, None, None)
4262 self.voltha_subscribers(services, cbs = cbs,
4263 num_subscribers = num_subscribers,
4264 num_channels = num_channels)
4265
4266 def test_9_subscribers_with_voltha_for_dhcp_discover_requests(self):
4267 """
4268 Test Method:
4269 0. Make sure that voltha is up and running on CORD-POD setup.
4270 1. OLT and ONU is detected and validated.
4271 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4272 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4273 4. Verify that subscriber get ip from dhcp server successfully.
4274 """
4275 """Test subscriber join next for channel surfing with 9 subscribers browsing 1 channels each"""
4276 num_subscribers = 9
4277 num_channels = 1
4278 services = ('DHCP')
4279 cbs = (self.dhcp_flow_check, None, None)
4280 self.voltha_subscribers(services, cbs = cbs,
4281 num_subscribers = num_subscribers,
4282 num_channels = num_channels)
4283
4284 def test_3_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4285 """
4286 Test Method:
4287 0. Make sure that voltha is up and running on CORD-POD setup.
4288 1. OLT and ONU is detected and validated.
4289 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4290 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4291 4. Verify that subscriber get ip from dhcp server successfully.
4292 """
4293 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4294 num_subscribers = 3
4295 num_channels = 1
4296 services = ('TLS','DHCP')
4297 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4298 self.voltha_subscribers(services, cbs = cbs,
4299 num_subscribers = num_subscribers,
4300 num_channels = num_channels)
4301
4302 def test_5_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4303 """
4304 Test Method:
4305 0. Make sure that voltha is up and running on CORD-POD setup.
4306 1. OLT and ONU is detected and validated.
4307 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4308 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4309 4. Verify that subscriber get ip from dhcp server successfully.
4310 """
4311 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4312 num_subscribers = 5
4313 num_channels = 1
4314 services = ('TLS','DHCP')
4315 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4316 self.voltha_subscribers(services, cbs = cbs,
4317 num_subscribers = num_subscribers,
4318 num_channels = num_channels)
4319
4320 def test_9_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4321 """
4322 Test Method:
4323 0. Make sure that voltha is up and running on CORD-POD setup.
4324 1. OLT and ONU is detected and validated.
4325 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4326 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4327 4. Verify that subscriber get ip from dhcp server successfully.
4328 """
4329 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4330 num_subscribers = 9
4331 num_channels = 1
4332 services = ('TLS','DHCP')
4333 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4334 self.voltha_subscribers(services, cbs = cbs,
4335 num_subscribers = num_subscribers,
4336 num_channels = num_channels)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004337
4338 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004339 def test_subscriber_with_voltha_for_dhcprelay_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004340 """
4341 Test Method:
4342 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4343 1. OLT and ONU is detected and validated.
4344 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4345 3. Send dhcp request from residential subscrber to external dhcp server.
4346 4. Verify that subscriber get ip from external dhcp server successfully.
4347 """
Thangavelu K S6432b522017-07-22 00:05:54 +00004348 self.dhcprelay_setUpClass()
4349# if not port_list:
4350 port_list = self.generate_port_list(1, 0)
4351 iface = self.port_map['ports'][port_list[1][1]]
4352 mac = self.get_mac(iface)
4353 self.host_load(iface)
4354 ##we use the defaults for this test that serves as an example for others
4355 ##You don't need to restart dhcpd server if retaining default config
4356 config = self.default_config
4357 options = self.default_options
4358 subnet = self.default_subnet_config
4359 dhcpd_interface_list = self.relay_interfaces
4360 self.dhcpd_start(intf_list = dhcpd_interface_list,
4361 config = config,
4362 options = options,
4363 subnet = subnet)
4364 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4365 self.send_recv(mac=mac)
4366 self.dhcprelay_tearDwonClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004367
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004368 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004369 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004370 """
4371 Test Method:
4372 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4373 1. OLT and ONU is detected and validated.
4374 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4375 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
4376 4. Verify that subscriber should not get ip from external dhcp server.
4377 """
4378
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004379 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004380 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004381 """
4382 Test Method:
4383 0. Make sure that voltha and external dhcp server are is 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 with invalid source mac multicast from residential subscrber to external dhcp server.
4387 4. Verify that subscriber should not get ip from external dhcp server.
4388 """
4389
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004390 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004391 """
4392 Test Method:
4393 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4394 1. OLT and ONU is detected and validated.
4395 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4396 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
4397 4. Verify that subscriber should not get ip from external dhcp server.
4398 """
4399
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004400 def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004401 """
4402 Test Method:
4403 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4404 1. OLT and ONU is detected and validated.
4405 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4406 3. Send dhcp request from residential subscrber to external dhcp server.
4407 4. Verify that subscriber get ip from external dhcp server successfully.
4408 5. Send dhcp release from residential subscrber to external dhcp server.
4409 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
4410 """
4411
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004412 def test_subscriber_with_voltha_for_dhcprelay_starvation(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004413 """
4414 Test Method:
4415 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4416 1. OLT and ONU is detected and validated.
4417 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4418 3. Send dhcp request from residential subscriber to external dhcp server.
4419 4. Verify that subscriber get ip from external dhcp server. successfully.
4420 5. Repeat step 3 and 4 for 10 times.
4421 6 Verify that subscriber should get ip from external dhcp server..
4422 """
4423
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004424 def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004425 """
4426 Test Method:
4427 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4428 1. OLT and ONU is detected and validated.
4429 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4430 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
4431 4. Verify that subscriber should not get ip from external dhcp server..
4432 5. Repeat steps 3 and 4 for 10 times.
4433 6 Verify that subscriber should not get ip from external dhcp server..
4434 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004435 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004436 """
4437 Test Method:
4438 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4439 1. OLT and ONU is detected and validated.
4440 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4441 3. Send dhcp request from residential subscriber to external dhcp server.
4442 4. Verify that subscriber get ip from external dhcp server. successfully.
4443 5. Repeat step 3 for 50 times.
4444 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4445 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004446 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004447 """
4448 Test Method:
4449 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4450 1. OLT and ONU is detected and validated.
4451 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4452 3. Send dhcp request from residential subscriber to external dhcp server.
4453 4. Verify that subscriber get ip from external dhcp server. successfully.
4454 5. Send DHCP request to external dhcp server.
4455 6. Repeat step 5 for 50 times.
4456 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4457 """
4458
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004459 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(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 with desired ip address from residential subscriber to external dhcp server.
4466 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
4467 """
4468
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004469 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004470 """
4471 Test Method:
4472 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4473 1. OLT and ONU is detected and validated.
4474 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4475 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
4476 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.
4477 """
4478
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004479 def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004480 """
4481 Test Method:
4482 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4483 1. OLT and ONU is detected and validated.
4484 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4485 3. Send dhcp request from residential subscriber to external dhcp server.
4486 4. Verify that subscriber get ip from external dhcp server. successfully.
4487 5. Deactivate dhcp server app in onos.
4488 6. Repeat step 3.
4489 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4490 """
4491
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004492 def test_subscriber_with_voltha_for_dhcprelay_renew_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004493 """
4494 Test Method:
4495 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4496 1. OLT and ONU is detected and validated.
4497 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4498 3. Send dhcp request from residential subscriber to external dhcp server.
4499 4. Verify that subscriber get ip from external dhcp server. successfully.
4500 5. Send dhcp renew packet to external dhcp server.
4501 6. Repeat step 4.
4502 """
4503
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004504 def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004505 """
4506 Test Method:
4507 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4508 1. OLT and ONU is detected and validated.
4509 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4510 3. Send dhcp request from residential subscriber to external dhcp server.
4511 4. Verify that subscriber get ip from external dhcp server. successfully.
4512 5. Send dhcp rebind packet to external dhcp server.
4513 6. Repeat step 4.
4514 """
4515
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004516 def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004517 """
4518 Test Method:
4519 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4520 1. OLT and ONU is detected and validated.
4521 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4522 3. Send dhcp request from residential subscriber to external dhcp server.
4523 4. Verify that subscriber get ip from external dhcp server. successfully.
4524 5. Disable olt devices which is being detected in voltha CLI.
4525 6. Repeat step 3.
4526 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4527 """
4528
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004529 def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004530 """
4531 Test Method:
4532 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4533 1. OLT and ONU is detected and validated.
4534 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4535 3. Send dhcp request from residential subscriber to external dhcp server.
4536 4. Verify that subscriber get ip from external dhcp server. successfully.
4537 5. Disable olt devices which is being detected in voltha CLI.
4538 6. Repeat step 3.
4539 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4540 8. Enable olt devices which is being detected in voltha CLI.
4541 9. Repeat steps 3 and 4.
4542 """
4543
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004544 def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004545 """
4546 Test Method:
4547 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4548 1. OLT and ONU is detected and validated.
4549 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4550 3. Send dhcp request from residential subscriber to external dhcp server.
4551 4. Verify that subscriber get ip from external dhcp server. successfully.
4552 5. Disable onu port which is being detected in voltha CLI.
4553 6. Repeat step 3.
4554 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4555 """
4556
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004557 def test_subscriber_with_voltha_for_dhcprelay_disable_enable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004558 """
4559 Test Method:
4560 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4561 1. OLT and ONU is detected and validated.
4562 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4563 3. Send dhcp request from residential subscriber to external dhcp server.
4564 4. Verify that subscriber get ip from external dhcp server. successfully.
4565 5. Disable onu port which is being detected in voltha CLI.
4566 6. Repeat step 3.
4567 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4568 8. Enable onu port which is being detected in voltha CLI.
4569 9. Repeat steps 3 and 4.
4570 """
4571
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004572 def test_two_subscribers_with_voltha_for_dhcprelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004573 """
4574 Test Method:
4575 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4576 1. OLT and ONU is detected and validated.
4577 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4578 3. Send dhcp request from two residential subscribers to external dhcp server.
4579 4. Verify that subscribers had got different ips from external dhcp server. successfully.
4580 """
4581
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004582 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004583 """
4584 Test Method:
4585 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4586 1. OLT and ONU is detected and validated.
4587 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4588 3. Send dhcp request from two residential subscribers to external dhcp server.
4589 4. Verify that subscribers had got ip from external dhcp server. successfully.
4590 5. Repeat step 3 and 4 for 10 times for both subscribers.
4591 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
4592 """
4593
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004594 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004595 """
4596 Test Method:
4597 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4598 1. OLT and ONU is detected and validated.
4599 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4600 3. Send dhcp request from two residential subscribers to external dhcp server.
4601 4. Verify that subscribers had got ip from external dhcp server. successfully.
4602 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
4603 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
4604 """
4605
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004606 def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004607 """
4608 Test Method:
4609 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4610 1. OLT and ONU is detected and validated.
4611 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4612 3. Send dhcp request from one residential subscriber to external dhcp server.
4613 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
4614 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
4615 """
4616
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004617 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 +00004618 """
4619 Test Method:
4620 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4621 1. OLT and ONU is detected and validated.
4622 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4623 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
4624 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
4625 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
4626 """
4627
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004628 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004629 """
4630 Test Method:
4631 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4632 1. OLT and ONU is detected and validated.
4633 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4634 3. Send dhcp request from two residential subscribers to external dhcp server.
4635 4. Verify that subscribers had got ip from external dhcp server. successfully.
4636 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4637 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4638 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4639 """
4640
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004641 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004642 """
4643 Test Method:
4644 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4645 1. OLT and ONU is detected and validated.
4646 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4647 3. Send dhcp request from two residential subscribers to external dhcp server.
4648 4. Verify that subscribers had got ip from external dhcp server. successfully.
4649 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4650 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4651 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4652 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
4653 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
4654 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4655 """
4656
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004657 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004658 """
4659 Test Method:
4660 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4661 1. OLT and ONU is detected and validated.
4662 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4663 3. Send dhcp request from two residential subscribers to external dhcp server.
4664 4. Verify that subscribers had got ip from external dhcp server. successfully.
4665 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4666 6. Disable the olt device which is detected in voltha.
4667 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4668 """
4669
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004670 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004671 """
4672 Test Method:
4673 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4674 1. OLT and ONU is detected and validated.
4675 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4676 3. Send dhcp request from two residential subscribers to external dhcp server.
4677 4. Verify that subscribers had got ip from external dhcp server. successfully.
4678 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4679 6. Disable the olt device which is detected in voltha.
4680 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4681 8. Enable the olt device which is detected in voltha.
4682 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
4683 """
4684
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004685 def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004686 """
4687 Test Method:
4688 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4689 1. OLT and ONU is detected and validated.
4690 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4691 3. Send dhcp request from two residential subscribers to external dhcp server.
4692 4. Verify that subscribers had got ip from external dhcp server. successfully.
4693 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4694 6. Pause the olt device which is detected in voltha.
4695 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
4696 """
Thangavelu K S36edb012017-07-05 18:24:12 +00004697
Thangavelu K S6432b522017-07-22 00:05:54 +00004698 def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004699 """
4700 Test Method:
4701 0. Make sure that voltha is up and running on CORD-POD setup.
4702 1. OLT and ONU is detected and validated.
4703 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4704 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4705 4. Send igmp joins for a multicast group address multi-group-addressA.
4706 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4707 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4708 """
4709
Thangavelu K S8e413082017-07-13 20:02:14 +00004710 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4711 num_subscribers = 1
4712 num_channels = 1
4713 services = ('IGMP')
4714 cbs = (self.igmp_flow_check, None, None)
4715 self.voltha_subscribers(services, cbs = cbs,
4716 num_subscribers = num_subscribers,
4717 num_channels = num_channels)
4718
Thangavelu K S6432b522017-07-22 00:05:54 +00004719 def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004720 """
4721 Test Method:
4722 0. Make sure that voltha is up and running on CORD-POD setup.
4723 1. OLT and ONU is detected and validated.
4724 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4725 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4726 4. Send igmp joins for a multicast group address multi-group-addressA.
4727 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4728 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4729 7. Send igmp leave for a multicast group address multi-group-addressA.
4730 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4731 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004732 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4733 num_subscribers = 1
4734 num_channels = 1
4735 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004736 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00004737 self.voltha_subscribers(services, cbs = cbs,
4738 num_subscribers = num_subscribers,
4739 num_channels = num_channels)
4740
Thangavelu K S6432b522017-07-22 00:05:54 +00004741 def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004742 """
4743 Test Method:
4744 0. Make sure that voltha is up and running on CORD-POD setup.
4745 1. OLT and ONU is detected and validated.
4746 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4747 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4748 4. Send igmp joins for a multicast group address multi-group-addressA.
4749 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
4750 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
4751 7. Send igmp leave for a multicast group address multi-group-addressA.
4752 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
4753 9. Repeat steps 4 to 6.
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
4757 num_channels = 1
4758 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004759 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00004760 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_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 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004775 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4776 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004777 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00004778 services = ('IGMP')
4779 cbs = (self.igmp_flow_check, None, None)
4780 self.voltha_subscribers(services, cbs = cbs,
4781 num_subscribers = num_subscribers,
4782 num_channels = num_channels)
4783
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004784 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 +00004785 """
4786 Test Method:
4787 0. Make sure that voltha is up and running on CORD-POD setup.
4788 1. OLT and ONU is detected and validated.
4789 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4790 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4791 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
4792 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
4793 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4794 7. Send igmp leave for a multicast group address multi-group-addressA.
4795 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.
4796 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester.
4797 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004798 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4799 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00004800 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00004801 services = ('IGMP')
4802 cbs = (self.igmp_flow_check, None, None)
4803 self.voltha_subscribers(services, cbs = cbs,
4804 num_subscribers = num_subscribers,
4805 num_channels = num_channels)
4806
Thangavelu K S6432b522017-07-22 00:05:54 +00004807 def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004808 """
4809 Test Method:
4810 0. Make sure that voltha is up and running on CORD-POD setup.
4811 1. OLT and ONU is detected and validated.
4812 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4813 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4814 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4815 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4816 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4817 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4818 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4819 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004820 num_subscribers = 1
4821 num_channels = 1
4822 services = ('IGMP')
4823 cbs = (self.igmp_flow_check, None, None)
4824 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4825 num_subscribers = num_subscribers,
4826 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00004827
Thangavelu K S6432b522017-07-22 00:05:54 +00004828 def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004829 """
4830 Test Method:
4831 0. Make sure that voltha is up and running on CORD-POD setup.
4832 1. OLT and ONU is detected and validated.
4833 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4834 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4835 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4836 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4837 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4838 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA
4839 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4840 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4841 """
4842
Thangavelu K S8e413082017-07-13 20:02:14 +00004843 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00004844 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00004845 services = ('IGMP')
4846 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
4847 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4848 num_subscribers = num_subscribers,
4849 num_channels = num_channels)
4850
Thangavelu K S6432b522017-07-22 00:05:54 +00004851 def test_subscriber_with_voltha_for_igmp_change_to_include_back_from_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004852 """
4853 Test Method:
4854 0. Make sure that voltha is up and running on CORD-POD setup.
4855 1. OLT and ONU is detected and validated.
4856 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4857 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4858 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4859 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4860 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4861 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA
4862 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4863 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4864 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004865 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00004866 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00004867 services = ('IGMP')
4868 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
4869 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4870 num_subscribers = num_subscribers,
4871 num_channels = num_channels)
4872
Thangavelu K S6432b522017-07-22 00:05:54 +00004873 def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004874 """
4875 Test Method:
4876 0. Make sure that voltha is up and running on CORD-POD setup.
4877 1. OLT and ONU is detected and validated.
4878 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4879 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4880 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
4881 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4882 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4883 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA
4884 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4885 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4886 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004887
4888 num_subscribers = 1
4889 num_channels = 1
4890 services = ('IGMP')
4891 cbs = (self.igmp_flow_check_join_change_to_block, None, None)
4892 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4893 num_subscribers = num_subscribers,
4894 num_channels = num_channels)
4895
Thangavelu K S6432b522017-07-22 00:05:54 +00004896 def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004897 """
4898 Test Method:
4899 0. Make sure that voltha is up and running on CORD-POD setup.
4900 1. OLT and ONU is detected and validated.
4901 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4902 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4903 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4904 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4905 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4906 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB
4907 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4908 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4909 """
Thangavelu K S8e413082017-07-13 20:02:14 +00004910
4911 num_subscribers = 1
4912 num_channels = 1
4913 services = ('IGMP')
4914 cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None)
4915 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
4916 num_subscribers = num_subscribers,
4917 num_channels = num_channels)
4918
Thangavelu K S6432b522017-07-22 00:05:54 +00004919 def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004920 """
4921 Test Method:
4922 0. Make sure that voltha is up and running on CORD-POD setup.
4923 1. OLT and ONU is detected and validated.
4924 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4925 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4926 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4927 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4928 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
4929 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4930 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
4931 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004932
4933 num_subscribers = 1
4934 num_channels = 1
4935 services = ('IGMP')
4936 cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None)
4937 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4938 num_subscribers = num_subscribers,
4939 num_channels = num_channels)
4940
Thangavelu K S6432b522017-07-22 00:05:54 +00004941 def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004942 """
4943 Test Method:
4944 0. Make sure that voltha is up and running on CORD-POD setup.
4945 1. OLT and ONU is detected and validated.
4946 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4947 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4948 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
4949 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
4950 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
4951 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
4952 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
4953 """
4954
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004955 num_subscribers = 1
4956 num_channels = 1
4957 services = ('IGMP')
4958 cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None)
4959 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
4960 num_subscribers = num_subscribers,
4961 num_channels = num_channels)
4962
Thangavelu K S6432b522017-07-22 00:05:54 +00004963 def test_two_subscribers_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004964 """
4965 Test Method:
4966 0. Make sure that voltha is up and running on CORD-POD setup.
4967 1. OLT and ONU is detected and validated.
4968 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4969 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4970 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4971 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
4972 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4973 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4974 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4975 """
4976
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004977 num_subscribers = 2
4978 num_channels = 1
4979 services = ('IGMP')
4980 cbs = (self.igmp_flow_check, None, None)
4981 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'],
4982 num_subscribers = num_subscribers,
4983 num_channels = num_channels)
4984
Thangavelu K S36edb012017-07-05 18:24:12 +00004985 def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self):
4986 """
4987 Test Method:
4988 0. Make sure that voltha is up and running on CORD-POD setup.
4989 1. OLT and ONU is detected and validated.
4990 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4991 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
4992 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
4993 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4994 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
4995 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4996 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
4997 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
4998 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
4999 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5000 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005001 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005002 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005003 services = ('IGMP')
5004 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
5005 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'],
5006 num_subscribers = num_subscribers,
5007 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00005008
Thangavelu K S6432b522017-07-22 00:05:54 +00005009 def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005010 """
5011 Test Method:
5012 0. Make sure that voltha is up and running on CORD-POD setup.
5013 1. OLT and ONU is detected and validated.
5014 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5015 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5016 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5017 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
5018 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5019 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.
5020 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.
5021 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5022 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.
5023 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.
5024 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.
5025 """
5026
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005027 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005028 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005029 services = ('IGMP')
5030 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
5031 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'],
5032 num_subscribers = num_subscribers,
5033 num_channels = num_channels)
5034
5035 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005036 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 +00005037 """
5038 Test Method:
5039 0. Make sure that voltha is up and running on CORD-POD setup.
5040 1. OLT and ONU is detected and validated.
5041 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5042 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5043 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5044 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5045 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5046 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5047 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5048 9. Disable uni_2 port which is being shown on voltha CLI.
5049 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5050 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5051 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005052 #rx_port = self.port_map['ports'][port_list[i][1]]
5053 df = defer.Deferred()
5054 def igmp_flow_check_operating_onu_admin_state(df):
5055 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005056 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005057 services = ('IGMP')
5058 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5059 port_list = self.generate_port_list(num_subscribers, num_channels)
5060
Thangavelu K S9a637332017-08-01 23:22:23 +00005061 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 +00005062 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5063 thread1.start()
5064 time.sleep(randint(40,50))
5065 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
5066 thread2.start()
5067 time.sleep(10)
5068 thread1.join()
5069 thread2.join()
5070 try:
5071 assert_equal(self.success, False)
5072 log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check')
5073 time.sleep(10)
5074 finally:
5075 pass
5076 df.callback(0)
5077 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5078 return df
5079
5080 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00005081 def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self):
5082 """
5083 Test Method:
5084 0. Make sure that voltha is up and running on CORD-POD setup.
5085 1. OLT and ONU is detected and validated.
5086 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5087 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5088 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5089 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5090 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5091 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5092 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5093 9. Disable uni_2 port which is being shown on voltha CLI.
5094 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5095 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5096 12. Enable uni_2 port which we disable at step 9.
5097 13. Repeat step 5,6 and 8.
5098 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005099 df = defer.Deferred()
5100 def igmp_flow_check_operating_onu_admin_state(df):
5101 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005102 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005103 services = ('IGMP')
5104 cbs = (self.igmp_flow_check, None, None)
5105 port_list = self.generate_port_list(num_subscribers, num_channels)
5106
Thangavelu K S9a637332017-08-01 23:22:23 +00005107 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 +00005108 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5109 thread1.start()
5110 time.sleep(randint(50,60))
5111 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
5112 thread2.start()
5113 time.sleep(10)
5114 thread1.join()
5115 thread2.join()
5116 try:
5117 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005118 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 +00005119 time.sleep(10)
5120 finally:
5121 pass
5122 df.callback(0)
5123 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5124 return df
5125
5126 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005127 def test_two_subscribers_with_voltha_for_igmp_disabling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005128 """
5129 Test Method:
5130 0. Make sure that voltha is up and running on CORD-POD setup.
5131 1. OLT and ONU is detected and validated.
5132 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5133 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5134 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5135 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5136 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5137 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5138 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5139 9. Disable olt device which is being shown on voltha CLI.
5140 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5141 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5142 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005143 df = defer.Deferred()
5144 def igmp_flow_check_operating_olt_admin_disble(df):
5145 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005146 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005147 services = ('IGMP')
5148 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5149 port_list = self.generate_port_list(num_subscribers, num_channels)
5150
Thangavelu K S9a637332017-08-01 23:22:23 +00005151 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 +00005152 thread1.start()
5153 time.sleep(randint(50,60))
5154 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5155 thread2.start()
5156 time.sleep(10)
5157 thread1.join()
5158 thread2.join()
5159 try:
5160 assert_equal(self.success, False)
5161 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5162 time.sleep(10)
5163 finally:
5164 pass
5165 df.callback(0)
5166 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5167 return df
5168
5169 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005170 def test_two_subscribers_with_voltha_for_igmp_pausing_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005171 """
5172 Test Method:
5173 0. Make sure that voltha is up and running on CORD-POD setup.
5174 1. OLT and ONU is detected and validated.
5175 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5176 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5177 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5178 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5179 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5180 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5181 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5182 9. Pause olt device which is being shown on voltha CLI.
5183 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5184 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5185 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005186 df = defer.Deferred()
5187 def igmp_flow_check_operating_olt_admin_pause(df):
5188 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005189 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005190 services = ('IGMP')
5191 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5192 port_list = self.generate_port_list(num_subscribers, num_channels)
5193
Thangavelu K S9a637332017-08-01 23:22:23 +00005194 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],))
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005195 thread1.start()
5196 time.sleep(randint(50,60))
5197 thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,))
5198 thread2.start()
5199 time.sleep(10)
5200 thread1.join()
5201 thread2.join()
5202 try:
5203 assert_equal(self.success, False)
5204 log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test')
5205 time.sleep(10)
5206 finally:
5207 pass
5208 df.callback(0)
5209 reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df)
5210 return df
5211
5212 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005213 def test_two_subscribers_with_voltha_for_igmp_toggling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005214 """
5215 Test Method:
5216 0. Make sure that voltha is up and running on CORD-POD setup.
5217 1. OLT and ONU is detected and validated.
5218 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5219 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5220 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5221 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5222 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5223 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5224 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5225 9. Disable olt device which is being shown on voltha CLI.
5226 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5227 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5228 12. Enable olt device which is disable at step 9.
5229 13. Repeat steps 4,5, 7 and 8.
5230 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005231 df = defer.Deferred()
5232 def igmp_flow_check_operating_olt_admin_restart(df):
5233 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005234 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005235 services = ('IGMP')
5236 cbs = (self.igmp_flow_check, None, None)
5237 port_list = self.generate_port_list(num_subscribers, num_channels)
5238
Thangavelu K S9a637332017-08-01 23:22:23 +00005239 thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],))
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005240 thread1.start()
5241 time.sleep(randint(50,60))
5242 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5243 thread2.start()
5244 time.sleep(10)
5245 thread1.join()
5246 thread2.join()
5247 try:
5248 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005249 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 +00005250 time.sleep(10)
5251 finally:
5252 pass
5253 df.callback(0)
5254 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5255 return df
Thangavelu K S6432b522017-07-22 00:05:54 +00005256
5257 @deferred(TESTCASE_TIMEOUT)
5258 def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self):
5259 """
5260 Test Method:
5261 0. Make sure that voltha is up and running on CORD-POD setup.
5262 1. OLT and ONU is detected and validated.
5263 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5264 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5265 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5266 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5267 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5268 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5269 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5270 9. Disable olt device which is being shown on voltha CLI.
5271 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5272 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5273 12. Repeat steps 4 to 11 steps multiple times (example 20 times)
5274 """
5275 df = defer.Deferred()
5276 no_iterations = 20
5277 def igmp_flow_check_operating_olt_admin_disble(df):
5278 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005279 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005280 services = ('IGMP')
5281 cbs = (self.igmp_flow_check, None, None)
5282 port_list = self.generate_port_list(num_subscribers, num_channels)
5283
Thangavelu K S9a637332017-08-01 23:22:23 +00005284 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 +00005285 thread1.start()
5286 time.sleep(randint(30,40))
5287 for i in range(no_iterations):
5288 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5289 thread2.start()
5290 time.sleep(8)
5291 thread2.join()
5292 thread1.join()
5293 thread1.isAlive()
5294 thread2.join()
5295 try:
5296 assert_equal(self.success, False)
5297 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5298 time.sleep(10)
5299 finally:
5300 pass
5301 df.callback(0)
5302 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5303 return df
5304
5305 @deferred(TESTCASE_TIMEOUT + 200)
5306 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self):
5307 """
5308 Test Method:
5309 0. Make sure that voltha is up and running on CORD-POD setup.
5310 1. OLT and ONU is detected and validated.
5311 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5312 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5313 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5314 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5315 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5316 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5317 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5318 9. Disable uni_2 port which is being shown on voltha CLI.
5319 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5320 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5321 12. Enable uni_2 port which we disable at step 9.
5322 13. Repeat step 5,6 and 8.
5323 14. Repeat steps 4 to 13 steps multiple times (example 5 times)
5324 """
5325 df = defer.Deferred()
5326 no_iterations = 5
5327 def igmp_flow_check_operating_onu_admin_state(df):
5328 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005329 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005330 services = ('IGMP')
5331 cbs = (self.igmp_flow_check, None, None)
5332 port_list = self.generate_port_list(num_subscribers, num_channels)
5333
Thangavelu K S9a637332017-08-01 23:22:23 +00005334 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 +00005335 thread1.start()
5336 time.sleep(randint(40,60))
5337 for i in range(no_iterations):
5338 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5339 log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha')
5340 thread2.start()
5341 time.sleep(1)
5342 thread2.join()
5343 thread1.isAlive()
5344 thread1.join()
5345 thread2.join()
5346 try:
5347 assert_equal(self.success, True)
5348 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful')
5349 time.sleep(10)
5350 finally:
5351 pass
5352 df.callback(0)
5353 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5354 return df
5355
5356 @deferred(TESTCASE_TIMEOUT)
5357 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self):
5358 """
5359 Test Method:
5360 0. Make sure that voltha is up and running on CORD-POD setup.
5361 1. OLT and ONU is detected and validated.
5362 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5363 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5364 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5365 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5366 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5367 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5368 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5369 9. Disable olt device which is being shown on voltha CLI.
5370 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5371 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5372 12. Enable olt device which is disable at step 9.
5373 13. Repeat steps 4,5, 7 and 8.
5374 14. Repeat steps 4 to 13 steps multiple times (example 10 times)
5375 """
5376 df = defer.Deferred()
5377 no_iterations = 10
5378 def igmp_flow_check_operating_olt_admin_restart(df):
5379 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005380 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005381 services = ('IGMP')
5382 cbs = (self.igmp_flow_check, None, None)
5383 port_list = self.generate_port_list(num_subscribers, num_channels)
5384
Thangavelu K S9a637332017-08-01 23:22:23 +00005385 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 +00005386 thread1.start()
5387 time.sleep(randint(50,60))
5388 for i in range(no_iterations):
5389 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5390 thread2.start()
5391 time.sleep(10)
5392 thread2.join()
5393 thread1.join()
5394 thread2.join()
5395 try:
5396 assert_equal(self.success, True)
5397 log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful')
5398 time.sleep(10)
5399 finally:
5400 pass
5401 df.callback(0)
5402 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5403 return df
5404
5405 def test_5_subscriber_with_voltha_for_igmp_with_10_group_joins_verifying_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 as 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
5417 num_subscribers = 5
5418 num_channels = 10
5419 services = ('IGMP')
5420 cbs = (self.igmp_flow_check, None, None)
5421 self.voltha_subscribers(services, cbs = cbs,
5422 num_subscribers = num_subscribers,
5423 num_channels = num_channels)
5424
5425 def test_9_subscriber_with_voltha_for_igmp_with_10_group_joins_and_verify_traffic(self):
5426 """
5427 Test Method:
5428 0. Make sure that voltha is up and running on CORD-POD setup.
5429 1. OLT and ONU is detected and validated.
5430 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5431 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity.
5432 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5433 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5434 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5435 """
5436 num_subscribers = 9
5437 num_channels = 10
5438 services = ('IGMP')
5439 cbs = (self.igmp_flow_check, None, None)
5440 self.voltha_subscribers(services, cbs = cbs,
5441 num_subscribers = num_subscribers,
5442 num_channels = num_channels)