blob: c2789bb3cc39c125ffbbe7b374ff90147e388be8 [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
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +000032from CordTestUtils import get_mac, log_test
A R Karthick168e2342017-08-15 16:13:10 -070033from VolthaCtrl import VolthaCtrl, VolthaService, 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'
A R Karthick168e2342017-08-15 16:13:10 -0700215 VOLTHA_HOST = VolthaService.DOCKER_HOST_IP
216 VOLTHA_PONSIM_HOST = VolthaService.PONSIM_HOST
A R Karthick35495c32017-05-11 14:58:32 -0700217 VOLTHA_REST_PORT = 8881
Thangavelu K S36edb012017-07-05 18:24:12 +0000218 VOLTHA_OLT_TYPE = 'ponsim_olt'
219 VOLTHA_OLT_MAC = '00:0c:e2:31:12:00'
220 VOLTHA_IGMP_ITERATIONS = 100
A R Karthick35495c32017-05-11 14:58:32 -0700221 voltha = None
A R Karthick53442712017-07-27 12:23:30 -0700222 voltha_attrs = None
Thangavelu K S9648eed2017-06-13 20:15:25 +0000223 success = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000224 olt_device_id = None
A R Karthick168e2342017-08-15 16:13:10 -0700225 apps = ('org.opencord.aaa', 'org.onosproject.dhcp',)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000226 #apps = ('org.opencord.aaa', 'org.onosproject.dhcp', 'org.onosproject.dhcprelay')
A R Karthick168e2342017-08-15 16:13:10 -0700227 app_dhcp = ('org.onosproject.dhcp',)
228 app_dhcprelay = ('org.onosproject.dhcprelay',)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000229 olt_apps = () #'org.opencord.cordmcast')
230 vtn_app = 'org.opencord.vtn'
231 table_app = 'org.ciena.cordigmp'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000232 test_path = os.path.dirname(os.path.realpath(__file__))
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000233 dhcp_data_dir = os.path.join(test_path, '..', 'setup')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000234 table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700235 app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000236 olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar')
A.R Karthick3493a572017-06-07 18:28:10 -0700237 olt_app_name = 'org.onosproject.olt'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000238 #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
239 olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
240 onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
A R Karthick9dc6e922017-07-12 14:40:16 -0700241 VOLTHA_AUTO_CONFIGURE = False
Thangavelu K S8e413082017-07-13 20:02:14 +0000242 num_joins = 0
243
Thangavelu K S6432b522017-07-22 00:05:54 +0000244 relay_interfaces_last = ()
245 interface_to_mac_map = {}
246 host_ip_map = {}
247 default_config = { 'default-lease-time' : 600, 'max-lease-time' : 7200, }
248 default_options = [ ('subnet-mask', '255.255.255.0'),
249 ('broadcast-address', '192.168.1.255'),
250 ('domain-name-servers', '192.168.1.1'),
251 ('domain-name', '"mydomain.cord-tester"'),
252 ]
253 ##specify the IP for the dhcp interface matching the subnet and subnet config
254 ##this is done for each interface dhcpd server would be listening on
255 default_subnet_config = [ ('192.168.1.2',
256'''
257subnet 192.168.1.0 netmask 255.255.255.0 {
258 range 192.168.1.10 192.168.1.100;
259}
260'''), ]
261
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000262 configs = {}
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000263 VOLTHA_ENABLED = True
264 INTF_TX_DEFAULT = 'veth2'
265 INTF_RX_DEFAULT = 'veth0'
Thangavelu K S9648eed2017-06-13 20:15:25 +0000266 INTF_2_RX_DEFAULT = 'veth6'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000267 TESTCASE_TIMEOUT = 300
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000268 VOLTHA_IGMP_ITERATIONS = 10
269# VOLTHA_CONFIG_FAKE = True
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000270 VOLTHA_CONFIG_FAKE = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000271 VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
A R Karthick53442712017-07-27 12:23:30 -0700272 VOLTHA_UPLINK_VLAN_START = 444
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000273 VOLTHA_ONU_UNI_PORT = 'veth0'
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000274
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000275 dhcp_server_config = {
276 "ip": "10.1.11.50",
277 "mac": "ca:fe:ca:fe:ca:fe",
278 "subnet": "255.255.252.0",
279 "broadcast": "10.1.11.255",
280 "router": "10.1.8.1",
281 "domain": "8.8.8.8",
282 "ttl": "63",
283 "delay": "2",
284 "startip": "10.1.11.51",
285 "endip": "10.1.11.100"
286 }
287
288
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000289 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
290MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
291CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
292IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
293RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
294MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
295BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
296hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
297gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
298+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
299rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
300VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
301eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
3026tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
303PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
304nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
305-----END CERTIFICATE-----"""
306
307 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
308MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
309CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
310IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
311RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
312MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
313BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
314hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
315AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
3165An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
317tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
318OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
319qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
3202Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
321BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
322eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
323MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
324VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
325RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
326dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
327T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
328yg==
329-----END CERTIFICATE-----'''
A R Karthick35495c32017-05-11 14:58:32 -0700330
A.R Karthick3493a572017-06-07 18:28:10 -0700331 @classmethod
332 def update_apps_version(cls):
333 version = Onos.getVersion()
334 major = int(version.split('.')[0])
335 minor = int(version.split('.')[1])
336 cordigmp_app_version = '2.0-SNAPSHOT'
337 olt_app_version = '1.2-SNAPSHOT'
338 if major > 1:
339 cordigmp_app_version = '3.0-SNAPSHOT'
340 olt_app_version = '2.0-SNAPSHOT'
341 elif major == 1:
342 if minor > 10:
343 cordigmp_app_version = '3.0-SNAPSHOT'
344 olt_app_version = '2.0-SNAPSHOT'
345 elif minor <= 8:
346 olt_app_version = '1.1-SNAPSHOT'
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700347 cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version))
348 cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version))
349 cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
350
A R Karthick35495c32017-05-11 14:58:32 -0700351 @classmethod
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000352 def voltha_dhcprelay_setUpClass(cls):
Thangavelu K S6432b522017-07-22 00:05:54 +0000353 ''' Activate the dhcprelay app'''
354 OnosCtrl(cls.app_dhcp).deactivate()
355 time.sleep(3)
356 cls.onos_ctrl = OnosCtrl('org.onosproject.dhcprelay')
357 status, _ = cls.onos_ctrl.activate()
358 assert_equal(status, True)
359 time.sleep(3)
360 cls.dhcp_relay_setup()
361 ##start dhcpd initially with default config
362 cls.dhcpd_start()
363
364 @classmethod
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000365 def voltha_dhcprelay_tearDownClass(cls):
Thangavelu K S6432b522017-07-22 00:05:54 +0000366 '''Deactivate the dhcp relay app'''
367 try:
368 os.unlink('{}/dhcpd.conf'.format(cls.dhcp_data_dir))
369 os.unlink('{}/dhcpd.leases'.format(cls.dhcp_data_dir))
370 except: pass
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000371 onos_ctrl = OnosCtrl(cls.app_dhcprelay)
372 onos_ctrl.deactivate()
Thangavelu K S6432b522017-07-22 00:05:54 +0000373 cls.dhcpd_stop()
374 cls.dhcp_relay_cleanup()
375
376 @classmethod
A.R Karthickf874d032017-06-07 18:47:51 -0700377 def onos_load_config(cls, app, config):
378 status, code = OnosCtrl.config(config)
379 if status is False:
380 log_test.info('JSON config request for app %s returned status %d' %(app, code))
381 assert_equal(status, True)
382 time.sleep(2)
383
384 @classmethod
385 def onos_aaa_load(cls):
386 aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
387 'radiusIp': '172.17.0.2' } } } }
388 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
389 aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip
390 cls.onos_load_config('org.opencord.aaa', aaa_dict)
391
392 @classmethod
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000393 def onos_dhcp_table_load(self, config = None):
394 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
395 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
396 if config:
397 for k in config.keys():
398 if dhcp_config.has_key(k):
399 dhcp_config[k] = config[k]
400 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
401
Thangavelu K S36edb012017-07-05 18:24:12 +0000402 def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = None):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000403 if validation:
Thangavelu K S735a6662017-06-15 18:08:23 +0000404 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
405 assert_not_equal(cip, None)
406 assert_not_equal(sip, None)
407 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
408 (cip, sip, dhcp.get_mac(cip)[0]))
409 if validation == False:
410 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
411 assert_equal(cip, None)
412 assert_equal(sip, None)
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000413 log_test.info('Dhcp client did not get IP from server')
Thangavelu K S735a6662017-06-15 18:08:23 +0000414
Thangavelu K S36edb012017-07-05 18:24:12 +0000415 if validation == 'skip':
416 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
417
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000418 return cip,sip
419
Thangavelu K S36edb012017-07-05 18:24:12 +0000420 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):
421 config = {'startip':startip, 'endip':'10.10.10.200',
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000422 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
423 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
424 self.onos_dhcp_table_load(config)
425 dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface)
Thangavelu K S36edb012017-07-05 18:24:12 +0000426 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed, validation = validation, mac = mac)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000427 return cip, sip
428
429 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700430 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700431 cls.update_apps_version()
A R Karthick53442712017-07-27 12:23:30 -0700432 cls.voltha_attrs = dict(host = cls.VOLTHA_HOST,
433 rest_port = cls.VOLTHA_REST_PORT,
434 uplink_vlan_map = cls.VOLTHA_UPLINK_VLAN_MAP,
435 uplink_vlan_start = cls.VOLTHA_UPLINK_VLAN_START)
436 cls.voltha = VolthaCtrl(**cls.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000437 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
438 cls.port_map, cls.port_list = cls.olt.olt_port_map()
439 cls.switches = cls.port_map['switches']
Thangavelu K S36edb012017-07-05 18:24:12 +0000440 cls.ponsim_ports = cls.port_map['ponsim']
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000441 cls.num_ports = cls.port_map['num_ports']
442 if cls.num_ports > 1:
443 cls.num_ports -= 1 ##account for the tx port
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000444 cls.activate_apps(cls.apps + cls.olt_apps, deactivate = True)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000445 cls.deactivate_apps(cls.app_dhcprelay)
A.R Karthickf874d032017-06-07 18:47:51 -0700446 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000447
A.R Karthick3493a572017-06-07 18:28:10 -0700448 @classmethod
449 def tearDownClass(cls):
450 '''Deactivate the olt apps and restart OVS back'''
451 apps = cls.olt_apps + ( cls.table_app,)
452 for app in apps:
453 onos_ctrl = OnosCtrl(app)
454 onos_ctrl.deactivate()
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000455 cls.deactivate_apps(cls.app_dhcprelay)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000456 log_test.info('TearDownClass Restarting the Radius Server in the TA setup')
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000457 cord_test_radius_restart()
458
A.R Karthick3493a572017-06-07 18:28:10 -0700459 @classmethod
460 def install_app_igmp(cls):
461 ##Uninstall the table app on class exit
462 OnosCtrl.uninstall_app(cls.table_app)
463 time.sleep(2)
464 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
465 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700466
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000467 def remove_olt(self, switch_map):
468 controller = get_controller()
469 auth = ('karaf', 'karaf')
470 #remove subscriber for every port on all the voltha devices
471 for device, device_map in switch_map.iteritems():
472 uni_ports = device_map['ports']
473 uplink_vlan = device_map['uplink_vlan']
474 for port in uni_ports:
475 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
476 device,
477 port)
478 resp = requests.delete(rest_url, auth = auth)
479 if resp.status_code not in [204, 202, 200]:
480 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
481 else:
482 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
483 OnosCtrl.uninstall_app(self.olt_app_file)
484
485 def config_olt(self, switch_map):
486 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000487 auth = ('karaf', 'karaf')
488 #configure subscriber for every port on all the voltha devices
489 for device, device_map in switch_map.iteritems():
490 uni_ports = device_map['ports']
491 uplink_vlan = device_map['uplink_vlan']
492 for port in uni_ports:
493 vlan = port
494 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
495 device,
496 port,
497 vlan)
498 resp = requests.post(rest_url, auth = auth)
499 #assert_equal(resp.ok, True)
500
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000501 def voltha_uni_port_toggle(self, uni_port = None):
502 ## Admin state of port is down and up
503 if not uni_port:
504 uni_port = self.INTF_RX_DEFAULT
505 cmd = 'ifconfig {} down'.format(uni_port)
506 os.system(cmd)
507 log_test.info('Admin state of uni_port is down')
508 time.sleep(30)
509 cmd = 'ifconfig {} up'.format(uni_port)
510 os.system(cmd)
511 log_test.info('Admin state of uni_port is up now')
512 time.sleep(30)
513 return
514
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000515 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000516 def install_app_table(cls):
517 ##Uninstall the existing app if any
518 OnosCtrl.uninstall_app(cls.table_app)
519 time.sleep(2)
520 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
521 OnosCtrl.install_app(cls.table_app_file)
522 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000523
524 @classmethod
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000525 def activate_apps(cls, apps, deactivate = False):
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000526 for app in apps:
527 onos_ctrl = OnosCtrl(app)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000528 if deactivate is True:
529 onos_ctrl.deactivate()
530 time.sleep(2)
A R Karthick168e2342017-08-15 16:13:10 -0700531 log_test.info('Activating app %s' %app)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000532 status, _ = onos_ctrl.activate()
533 assert_equal(status, True)
534 time.sleep(2)
535
536
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000537
Thangavelu K S735a6662017-06-15 18:08:23 +0000538 @classmethod
539 def deactivate_apps(cls, apps):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000540 cls.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000541 for app in apps:
542 onos_ctrl = OnosCtrl(app)
A R Karthick168e2342017-08-15 16:13:10 -0700543 log_test.info('Deactivating app %s' %app)
Thangavelu K S735a6662017-06-15 18:08:23 +0000544 status, _ = onos_ctrl.deactivate()
545 if status is False:
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000546 cls.success = False
547 # assert_equal(status, True)
Thangavelu K S735a6662017-06-15 18:08:23 +0000548 time.sleep(2)
549
Thangavelu K S36edb012017-07-05 18:24:12 +0000550 def random_ip(self,start_ip = '10.10.10.20', end_ip = '10.10.10.65'):
551 start = list(map(int, start_ip.split(".")))
552 end = list(map(int, end_ip.split(".")))
553 temp = start
554 ip_range = []
555 ip_range.append(start_ip)
556 while temp != end:
557 start[3] += 1
558 for i in (3, 2, 1):
559 if temp[i] == 255:
560 temp[i] = 0
561 temp[i-1] += 1
562 ip_range.append(".".join(map(str, temp)))
563 return random.choice(ip_range)
564
Thangavelu K S8e413082017-07-13 20:02:14 +0000565 def random_mcast_ip(self,start_ip = '224.0.1.0', end_ip = '224.0.1.100'):
566 start = list(map(int, start_ip.split(".")))
567 end = list(map(int, end_ip.split(".")))
568 temp = start
569 ip_range = []
570 ip_range.append(start_ip)
571 while temp != end:
572 start[3] += 1
573 for i in (3, 2, 1):
574 if temp[i] == 255:
575 temp[i] = 0
576 temp[i-1] += 1
577 ip_range.append(".".join(map(str, temp)))
578 return random.choice(ip_range)
579
Thangavelu K S6432b522017-07-22 00:05:54 +0000580 @classmethod
581 def dhcp_relay_setup(cls):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000582 did = OnosCtrl.get_device_id()
583 cls.relay_device_id = did
584 cls.relay_device_id = 'of:0000000000000001'
585 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
586 cls.port_map, _ = cls.olt.olt_port_map()
Thangavelu K S6432b522017-07-22 00:05:54 +0000587 if cls.port_map:
588 ##Per subscriber, we use 1 relay port
589 try:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000590 relay_port = cls.port_map[cls.port_map['relay_ports'][0]]
Thangavelu K S6432b522017-07-22 00:05:54 +0000591 except:
592 relay_port = cls.port_map['uplink']
593 cls.relay_interface_port = relay_port
594 cls.relay_interfaces = (cls.port_map[cls.relay_interface_port],)
595 else:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000596 cls.relay_interface_port = 100
597 cls.relay_interfaces = (g_subscriber_port_map[cls.relay_interface_port],)
Thangavelu K S6432b522017-07-22 00:05:54 +0000598 cls.relay_interfaces_last = cls.relay_interfaces
599 if cls.port_map:
600 ##generate a ip/mac client virtual interface config for onos
601 interface_list = []
602 for port in cls.port_map['ports']:
603 port_num = cls.port_map[port]
604 if port_num == cls.port_map['uplink']:
605 continue
606 ip = cls.get_host_ip(port_num)
607 mac = cls.get_mac(port)
608 interface_list.append((port_num, ip, mac))
609
610 #configure dhcp server virtual interface on the same subnet as first client interface
611 relay_ip = cls.get_host_ip(interface_list[0][0])
612 relay_mac = cls.get_mac(cls.port_map[cls.relay_interface_port])
613 interface_list.append((cls.relay_interface_port, relay_ip, relay_mac))
614 cls.onos_interface_load(interface_list)
615
616 @classmethod
617 def onos_interface_load(cls, interface_list):
618 interface_dict = { 'ports': {} }
619 for port_num, ip, mac in interface_list:
620 port_map = interface_dict['ports']
621 port = '{}/{}'.format(cls.relay_device_id, port_num)
622 port_map[port] = { 'interfaces': [] }
623 interface_list = port_map[port]['interfaces']
624 interface_map = { 'ips' : [ '{}/{}'.format(ip, 24) ],
625 'mac' : mac,
626 'name': 'vir-{}'.format(port_num)
627 }
628 interface_list.append(interface_map)
629
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000630 cls.onos_load_config('org.onosproject.dhcprelay', interface_dict)
Thangavelu K S6432b522017-07-22 00:05:54 +0000631 cls.configs['interface_config'] = interface_dict
632
633 @classmethod
634 def get_host_ip(cls, port):
635 if cls.host_ip_map.has_key(port):
636 return cls.host_ip_map[port]
637 cls.host_ip_map[port] = '192.168.1.{}'.format(port)
638 return cls.host_ip_map[port]
639
640 @classmethod
641 def host_load(cls, iface):
642 '''Have ONOS discover the hosts for dhcp-relay responses'''
643 port = g_subscriber_port_map[iface]
644 host = '173.17.1.{}'.format(port)
645 cmds = ( 'ifconfig {} 0'.format(iface),
646 'ifconfig {0} {1}'.format(iface, host),
647 'arping -I {0} {1} -c 2'.format(iface, host),
648 'ifconfig {} 0'.format(iface), )
649 for c in cmds:
650 os.system(c)
651
652 @classmethod
653 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
654 subnet = default_subnet_config):
655 conf = ''
656 for k, v in config.items():
657 conf += '{} {};\n'.format(k, v)
658
659 opts = ''
660 for k, v in options:
661 opts += 'option {} {};\n'.format(k, v)
662
663 subnet_config = ''
664 for _, v in subnet:
665 subnet_config += '{}\n'.format(v)
666
667 return '{}{}{}'.format(conf, opts, subnet_config)
668
669 @classmethod
670 def dhcpd_start(cls, intf_list = None,
671 config = default_config, options = default_options,
672 subnet = default_subnet_config):
673 '''Start the dhcpd server by generating the conf file'''
674 if intf_list is None:
675 intf_list = cls.relay_interfaces
676 ##stop dhcpd if already running
677 cls.dhcpd_stop()
678 dhcp_conf = cls.dhcpd_conf_generate(config = config, options = options,
679 subnet = subnet)
680 ##first touch dhcpd.leases if it doesn't exist
681 lease_file = '{}/dhcpd.leases'.format(cls.dhcp_data_dir)
682 if os.access(lease_file, os.F_OK) is False:
683 with open(lease_file, 'w') as fd: pass
684
685 conf_file = '{}/dhcpd.conf'.format(cls.dhcp_data_dir)
686 with open(conf_file, 'w') as fd:
687 fd.write(dhcp_conf)
688
689 #now configure the dhcpd interfaces for various subnets
690 index = 0
691 intf_info = []
692 for ip,_ in subnet:
693 intf = intf_list[index]
694 mac = cls.get_mac(intf)
695 intf_info.append((ip, mac))
696 index += 1
697 os.system('ifconfig {} {}'.format(intf, ip))
698
699 intf_str = ','.join(intf_list)
700 dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format(conf_file, lease_file, intf_str)
701 log_test.info('Starting DHCPD server with command: %s' %dhcpd_cmd)
702 ret = os.system(dhcpd_cmd)
703 assert_equal(ret, 0)
704 time.sleep(3)
705 cls.relay_interfaces_last = cls.relay_interfaces
706 cls.relay_interfaces = intf_list
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000707 cls.onos_dhcp_relay_load_1(*intf_info[0])
Thangavelu K S6432b522017-07-22 00:05:54 +0000708
709 @classmethod
710 def dhcpd_stop(cls):
711 os.system('pkill -9 dhcpd')
712 for intf in cls.relay_interfaces:
713 os.system('ifconfig {} 0'.format(intf))
714
715 cls.relay_interfaces = cls.relay_interfaces_last
716
717 @classmethod
718 def get_mac(cls, iface):
719 if cls.interface_to_mac_map.has_key(iface):
720 return cls.interface_to_mac_map[iface]
721 mac = get_mac(iface, pad = 0)
722 cls.interface_to_mac_map[iface] = mac
723 return mac
724
725 def send_recv(self, mac=None, update_seed = False, validate = True):
726 cip, sip = self.dhcp.discover(mac = mac, update_seed = update_seed)
727 if validate:
728 assert_not_equal(cip, None)
729 assert_not_equal(sip, None)
730 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
731 (cip, sip, self.dhcp.get_mac(cip)[0]))
732 return cip,sip
733
734 @classmethod
735 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
736 subnet = default_subnet_config):
737 conf = ''
738 for k, v in config.items():
739 conf += '{} {};\n'.format(k, v)
740
741 opts = ''
742 for k, v in options:
743 opts += 'option {} {};\n'.format(k, v)
744
745 subnet_config = ''
746 for _, v in subnet:
747 subnet_config += '{}\n'.format(v)
748
749 return '{}{}{}'.format(conf, opts, subnet_config)
750
751 @classmethod
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000752 def onos_dhcp_relay_load_1(cls, server_ip, server_mac):
Thangavelu K S6432b522017-07-22 00:05:54 +0000753 relay_device_map = '{}/{}'.format(cls.relay_device_id, cls.relay_interface_port)
754 dhcp_dict = {'apps':{'org.onosproject.dhcp-relay':{'dhcprelay':
755 {'dhcpserverConnectPoint':relay_device_map,
756 'serverip':server_ip,
757 'servermac':server_mac
758 }
759 }
760 }
761 }
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000762 cls.onos_load_config(cls.app_dhcprelay,dhcp_dict)
Thangavelu K S6432b522017-07-22 00:05:54 +0000763 cls.configs['relay_config'] = dhcp_dict
764
765 @classmethod
766 def dhcp_relay_cleanup(cls):
767 ##reset the ONOS port configuration back to default
768 for config in cls.configs.items():
769 OnosCtrl.delete(config)
770 # if cls.onos_restartable is True:
771 # log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
772 # return cord_test_onos_restart(config = {})
773
774
Thangavelu K S8e413082017-07-13 20:02:14 +0000775 def tls_flow_check(self, olt_ports, cert_info = None, multiple_sub = False):
776 if multiple_sub is True:
777 olt_nni_port = olt_ports.tx_port
778 olt_uni_port = olt_ports.rx_port
779 else:
Thangavelu K S36edb012017-07-05 18:24:12 +0000780 olt_uni_port = olt_ports
781
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000782 def tls_fail_cb():
783 log_test.info('TLS verification failed')
784 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700785 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000786 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
787 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000788 if tls.failTest is True:
789 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000790 assert_equal(tls.failTest, False)
791 if cert_info == "no_cert":
792 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
793 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
794 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000795 if tls.failTest is False:
796 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000797 assert_equal(tls.failTest, True)
798 if cert_info == "invalid_cert":
799 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
800 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
801 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000802 if tls.failTest is False:
803 self.success = False
804 assert_equal(tls.failTest, True)
805 if cert_info == "same_cert":
806 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000807 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 +0000808 tls.runTest()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000809 if tls.failTest is True:
Thangavelu K S9648eed2017-06-13 20:15:25 +0000810 self.success = False
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000811 assert_equal(tls.failTest, False)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000812 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 +0000813 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 +0000814 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
815 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
816 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000817 if tls.failTest is False:
818 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000819 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000820 self.test_status = True
821 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700822
Thangavelu K S8e413082017-07-13 20:02:14 +0000823 def dhcp_flow_check(self, olt_ports, negative_test = None, multiple_sub = False):
824 if multiple_sub is True:
825 olt_nni_port = olt_ports.tx_port
826 onu_iface = olt_ports.rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +0000827 dhcp_server_startip = self.random_ip()
828 random_mac = '00:00:00:0a:0a:' + hex(random.randrange(50,254)).split('x')[1]
Thangavelu K S8e413082017-07-13 20:02:14 +0000829 else:
830 onu_iface = olt_ports
831 dhcp_server_startip = '10.10.10.20'
832 random_mac = None
Thangavelu K S735a6662017-06-15 18:08:23 +0000833 self.success = True
834
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000835 if negative_test is None:
Thangavelu K S36edb012017-07-05 18:24:12 +0000836 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = 'skip', startip = dhcp_server_startip, mac = random_mac)
837 if cip == None or sip == None:
Thangavelu K S735a6662017-06-15 18:08:23 +0000838 self.success = False
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000839 self.test_status = False
840 assert_not_equal(cip,None)
841 assert_not_equal(sip,None)
842 else:
843 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
844 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000845
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000846 if negative_test == "interrupting_dhcp_flows":
847 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
Thangavelu K S735a6662017-06-15 18:08:23 +0000848 if cip is not None:
849 self.success = False
850 assert_equal(cip,None)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000851 log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000852 self.test_status = True
853
854 if negative_test == "invalid_src_mac_broadcast":
855 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
856 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
857 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
858 self.onos_dhcp_table_load(config)
859 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
860 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000861
862 if cip is not None:
863 self.success = False
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000864 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 +0000865 assert_equal(cip,None)
866 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
867 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000868
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000869 if negative_test == "invalid_src_mac_multicast":
870 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
871 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
872 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
873 self.onos_dhcp_table_load(config)
874 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
875 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000876 if cip is not None:
877 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000878 assert_equal(cip,None)
879 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
880 self.test_status = True
881
882 if negative_test == "invalid_src_mac_junk":
883 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
884 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
885 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
886 self.onos_dhcp_table_load(config)
887 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
888 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000889 if cip is not None:
890 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000891 assert_equal(cip,None)
892 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
893 self.test_status = True
894
895 if negative_test == "request_release":
896 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
897 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
898 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
899 self.onos_dhcp_table_load(config)
900 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
901 cip, sip = self.dhcp_sndrcv(self.dhcp)
902 log_test.info('Releasing ip %s to server %s' %(cip, sip))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000903 if not self.dhcp.release(cip):
904 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000905 assert_equal(self.dhcp.release(cip), True)
906 log_test.info('Triggering DHCP discover again after release')
907 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
908 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000909 if not cip == cip2:
Thangavelu K S735a6662017-06-15 18:08:23 +0000910 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000911 assert_equal(cip, cip2)
912 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
913 assert_equal(self.dhcp.release(cip2), True)
914 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000915
Thangavelu K S735a6662017-06-15 18:08:23 +0000916 if negative_test == "starvation_positive":
917 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
918 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
919 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
920 self.onos_dhcp_table_load(config)
921 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
922 ip_map = {}
923 for i in range(10):
924 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
925 if ip_map.has_key(cip):
926 self.success = False
927 log_test.info('IP %s given out multiple times' %cip)
928 assert_equal(False, ip_map.has_key(cip))
929 ip_map[cip] = sip
930 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000931
Thangavelu K S735a6662017-06-15 18:08:23 +0000932 if negative_test == "starvation_negative":
933 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
934 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
935 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
936 self.onos_dhcp_table_load(config)
937 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
938 log_test.info('Verifying passitive case')
939 for x in xrange(50):
940 mac = RandMAC()._fix()
941 self.dhcp_sndrcv(self.dhcp,mac = mac)
942 log_test.info('Verifying negative case')
943 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000944 if cip or sip is not None:
945 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000946 assert_equal(cip, None)
947 assert_equal(sip, None)
948 self.test_status = True
949 self.success = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000950
Thangavelu K S735a6662017-06-15 18:08:23 +0000951 if negative_test == "multiple_discover":
952 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
953 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
954 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
955 self.onos_dhcp_table_load(config)
956 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
957 cip, sip, mac, _ = self.dhcp.only_discover()
958 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
959 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000960 if cip is None:
961 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000962 assert_not_equal(cip, None)
963 log_test.info('Triggering DHCP discover again.')
964 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000965 if not new_cip == cip:
966 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000967 assert_equal(new_cip, cip)
968 log_test.info('client got same IP as expected when sent 2nd discovery')
969 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000970 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000971 if negative_test == "multiple_requests":
972 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
973 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
974 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
975 self.onos_dhcp_table_load(config)
976 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
977 log_test.info('Sending DHCP discover and DHCP request.')
978 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
979 mac = self.dhcp.get_mac(cip)[0]
980 log_test.info("Sending DHCP request again.")
981 new_cip, new_sip = self.dhcp.only_request(cip, mac)
982 assert_equal(new_cip,cip)
983 log_test.info('server offered same IP to clain for multiple requests, as expected')
984 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000985# self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000986 if negative_test == "desired_ip_address":
987 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
988 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
989 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
990 self.onos_dhcp_table_load(config)
991 self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface)
992 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000993 if cip or sip is None:
994 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000995 assert_not_equal(cip, None)
996 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
997 (cip, sip, mac))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000998 if not self.dhcp.seed_ip == cip:
999 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001000 assert_equal(cip,self.dhcp.seed_ip)
1001 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
1002 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001003 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +00001004 if negative_test == "desired_out_of_pool_ip_address":
1005 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1006 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1007 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1008 self.onos_dhcp_table_load(config)
1009 self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface)
1010 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001011 if cip or sip is None:
1012 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001013 assert_not_equal(cip, None)
1014 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1015 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001016 if self.dhcp.seed_ip == cip:
1017 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001018 assert_not_equal(cip,self.dhcp.seed_ip)
1019 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
1020 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001021 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001022 if negative_test == "dhcp_renew":
1023 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1024 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1025 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1026 self.onos_dhcp_table_load(config)
1027 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1028 cip, sip, mac, _ = self.dhcp.only_discover()
1029 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1030 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001031 if cip or sip is None:
1032 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001033 assert_not_equal(cip, None)
1034 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
1035 log_test.info('waiting renew time %d seconds to send next request packet'%lval)
1036 time.sleep(lval)
1037 latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001038 if not latest_cip == cip:
1039 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001040 assert_equal(latest_cip,cip)
1041 log_test.info('client got same IP after renew time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001042 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001043 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001044 if negative_test == "dhcp_rebind":
1045 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1046 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1047 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1048 self.onos_dhcp_table_load(config)
1049 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1050 cip, sip, mac, _ = self.dhcp.only_discover()
1051 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1052 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001053 if cip or sip is None:
1054 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001055 assert_not_equal(cip, None)
1056 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
1057 log_test.info('waiting rebind time %d seconds to send next request packet'%lval)
1058 time.sleep(lval)
1059 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001060 if not latest_cip == cip:
1061 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001062 assert_equal(latest_cip,cip)
1063 log_test.info('client got same IP after rebind time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001064 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001065 # self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001066 return self.test_status
1067
Thangavelu K S8e413082017-07-13 20:02:14 +00001068 def recv_channel_cb(self, pkt):
1069 ##First verify that we have received the packet for the joined instance
1070 chan = self.subscriber.caddr(pkt[IP].dst)
1071 assert_equal(chan in self.subscriber.join_map.keys(), True)
1072 recv_time = monotonic.monotonic() * 1000000
1073 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
1074 delta = recv_time - join_time
1075 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
1076 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
1077 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
1078 self.test_status = True
Thangavelu K S36edb012017-07-05 18:24:12 +00001079
Thangavelu K S8e413082017-07-13 20:02:14 +00001080 def traffic_verify(self, subscriber):
1081 # if subscriber.has_service('TRAFFIC'):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001082 url = 'http://www.google.com'
1083 resp = requests.get(url)
1084 self.test_status = resp.ok
1085 if resp.ok == False:
1086 log_test.info('Subscriber %s failed get from url %s with status code %d'
1087 %(subscriber.name, url, resp.status_code))
1088 else:
1089 log_test.info('GET request from %s succeeded for subscriber %s'
1090 %(url, subscriber.name))
1091 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001092
Thangavelu K S8e413082017-07-13 20:02:14 +00001093 def igmp_flow_check(self, subscriber, multiple_sub = False):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001094 chan = 0
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001095 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1096 if subscriber.num_channels == 1:
Thangavelu K S9a637332017-08-01 23:22:23 +00001097 if i != 0:
1098 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001099 chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1100 else:
1101 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1102 self.num_joins += 1
1103 while self.num_joins < self.num_subscribers:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001104 time.sleep(5)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001105 log_test.info('All subscribers have joined the channel')
1106 # for i in range(1):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001107 time.sleep(0.5)
1108 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1109 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1110 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
1111 time.sleep(5)
1112# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001113 if subscriber.num_channels == 1:
1114 pass
1115 elif chan != 0:
1116 #Should not receive packets for this channel
1117 self.recv_timeout = True
1118 subscriber.recv_timeout = True
1119 subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1120 subscriber.recv_timeout = False
1121 self.recv_timeout = False
Thangavelu K S9a637332017-08-01 23:22:23 +00001122 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001123# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K S9a637332017-08-01 23:22:23 +00001124# chan = subscriber.num_channels - i
1125# self.test_status = True
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001126 return self.test_status
Thangavelu K S9a637332017-08-01 23:22:23 +00001127
1128 def igmp_join_next_channel_flow_check(self, subscriber, multiple_sub = False):
1129 chan = 0
1130 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1131# if subscriber.num_channels == 1:
1132# chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1133# else:
1134 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1135 self.num_joins += 1
1136 while self.num_joins < self.num_subscribers:
1137 time.sleep(5)
1138 log_test.info('All subscribers have joined the channel')
1139 # for i in range(1):
1140 time.sleep(0.5)
1141 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1142 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1143 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
1144 time.sleep(5)
1145# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1146# if subscriber.num_channels == 1:
1147# pass
1148# elif chan != 0:
1149# pass
1150 #Should not receive packets for this channel
1151# log_test.info
1152# self.recv_timeout = True
1153# subscriber.recv_timeout = True
1154# subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1155# subscriber.recv_timeout = False
1156# self.recv_timeout = False
1157# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1158# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001159 chan = subscriber.num_channels - i
Thangavelu K S8e413082017-07-13 20:02:14 +00001160# self.test_status = True
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00001161 return self.test_status
1162
Thangavelu K S36edb012017-07-05 18:24:12 +00001163
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001164 def igmp_leave_flow_check(self, subscriber, multiple_sub = False):
1165 chan = 0
1166 for i in range(self.VOLTHA_IGMP_ITERATIONS):
1167 subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1168 self.num_joins += 1
1169 while self.num_joins < self.num_subscribers:
1170 time.sleep(5)
1171 log_test.info('All subscribers have joined the channel')
1172# for i in range(1):
1173 time.sleep(0.5)
1174 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1175 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1176 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1177 time.sleep(10)
1178# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1179 #Should not receive packets for this subscriber
1180 self.recv_timeout = True
1181 subscriber.recv_timeout = True
1182 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1183 subscriber.recv_timeout = False
1184 self.recv_timeout = False
1185# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1186# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1187# self.test_status = True
1188 return self.test_status
1189
1190
1191
Thangavelu K S8e413082017-07-13 20:02:14 +00001192 def igmp_flow_check_join_change_to_exclude(self, subscriber, multiple_sub = False):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001193 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001194 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1195 for i in range(3):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001196 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
Thangavelu K S9a637332017-08-01 23:22:23 +00001197 self.num_joins += 1
1198 while self.num_joins < self.num_subscribers:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001199 time.sleep(5)
Thangavelu K S9a637332017-08-01 23:22:23 +00001200 log_test.info('All subscribers have joined the channel')
1201 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1202 time.sleep(5)
1203 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]))
1204 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1205 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1206 time.sleep(60)
1207 self.recv_timeout = False
1208 subscriber.recv_timeout = False
1209 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1210 if self.test_status is True:
1211 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1212 if self.test_status is False:
1213 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1214 continue
1215 subscriber.recv_timeout = False
1216 self.recv_timeout = False
1217 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001218# self.test_status = True
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001219 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001220
Thangavelu K S8e413082017-07-13 20:02:14 +00001221 def igmp_flow_check_join_change_to_exclude_again_include_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001222 chan = 0
1223 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1224 for i in range(3):
1225 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1226 self.num_joins += 1
1227 while self.num_joins < self.num_subscribers:
1228 time.sleep(5)
1229 log_test.info('All subscribers have joined the channel')
1230 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1231 time.sleep(5)
1232 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]))
1233 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1234 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1235 time.sleep(60)
1236 self.recv_timeout = False
1237 subscriber.recv_timeout = False
1238 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1239 if self.test_status is True:
1240 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1241 if self.test_status is False:
1242 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1243 continue
1244 subscriber.recv_timeout = False
1245 self.recv_timeout = False
1246 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1247 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_INCLUDE)
1248 time.sleep(5)
1249# self.recv_timeout = True
1250# subscriber.recv_timeout = True
1251 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1252 subscriber.recv_timeout = False
1253 self.recv_timeout = False
1254
1255
1256 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1257# self.test_status = True
1258 return self.test_status
1259
Thangavelu K S36edb012017-07-05 18:24:12 +00001260
Thangavelu K S8e413082017-07-13 20:02:14 +00001261 def igmp_flow_check_join_change_to_block(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001262 chan = 0
1263 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1264 for i in range(3):
1265 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1266 self.num_joins += 1
1267 while self.num_joins < self.num_subscribers:
1268 time.sleep(5)
1269 log_test.info('All subscribers have joined the channel')
1270 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1271 time.sleep(5)
1272 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]))
1273 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_BLOCK_OLD)
1274 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1275 time.sleep(60)
1276 self.recv_timeout = False
1277 subscriber.recv_timeout = False
1278 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1279 if self.test_status is True:
1280 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1281 if self.test_status is False:
1282 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1283 continue
1284 subscriber.recv_timeout = False
1285 self.recv_timeout = False
1286 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1287# self.test_status = True
1288 return self.test_status
1289
Thangavelu K S36edb012017-07-05 18:24:12 +00001290
Thangavelu K S8e413082017-07-13 20:02:14 +00001291 def igmp_flow_check_join_change_to_block_again_allow_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001292 chan = 0
1293 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1294 for i in range(3):
1295 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1296 self.num_joins += 1
1297 while self.num_joins < self.num_subscribers:
1298 time.sleep(5)
1299 log_test.info('All subscribers have joined the channel')
1300 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1301 time.sleep(5)
1302 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]))
1303 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1304 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1305 time.sleep(60)
1306 self.recv_timeout = False
1307 subscriber.recv_timeout = False
1308 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1309 if self.test_status is True:
1310 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1311 if self.test_status is False:
1312 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1313 continue
1314 subscriber.recv_timeout = False
1315 self.recv_timeout = False
1316 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1317 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_ALLOW_NEW)
1318 time.sleep(5)
1319# self.recv_timeout = True
1320# subscriber.recv_timeout = True
1321 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1322 subscriber.recv_timeout = False
1323 self.recv_timeout = False
1324
1325
1326 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1327# self.test_status = True
1328 return self.test_status
Thangavelu K S8e413082017-07-13 20:02:14 +00001329
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001330 def igmp_flow_check_group_include_source_empty_list(self, subscriber, multiple_sub = False):
1331 chan = 0
1332 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1333 self.num_joins += 1
1334 while self.num_joins < self.num_subscribers:
1335 time.sleep(5)
1336 log_test.info('All subscribers have joined the channel')
1337 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001338 if self.test_status is True:
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001339 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1340 self.test_status = False
1341 else:
1342 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 +00001343 self.test_status = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001344 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1345 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1346 time.sleep(5)
1347 subscriber.recv_timeout = False
1348 self.recv_timeout = False
1349 return self.test_status
1350
1351 def igmp_flow_check_group_exclude_source_empty_list(self, subscriber, multiple_sub = False):
1352 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001353 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1354 self.num_joins += 1
1355 while self.num_joins < self.num_subscribers:
1356 time.sleep(5)
1357 log_test.info('All subscribers have joined the channel')
1358 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1359 if self.test_status is True:
1360 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1361 self.test_status = False
1362 else:
1363 log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port))
1364 self.test_status = True
1365
1366 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1367 log_test.info('Send join to multicast group with exclude empty source list and waited till GMI timer expires')
1368 time.sleep(60)
1369
1370 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1371 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1372 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1373 time.sleep(5)
1374 subscriber.recv_timeout = False
1375 self.recv_timeout = False
1376 return self.test_status
1377
1378 def igmp_flow_check_group_exclude_source_empty_list_1(self, subscriber, multiple_sub = False):
1379 chan = 0
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001380 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list,record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1381 self.num_joins += 1
1382 while self.num_joins < self.num_subscribers:
1383 time.sleep(5)
1384 log_test.info('All subscribers have joined the channel')
1385 for i in range(10):
1386 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1387 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1388 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1389 time.sleep(5)
1390 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1391 #Should not receive packets for this subscriber
1392 self.recv_timeout = True
1393 subscriber.recv_timeout = True
1394 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1395 subscriber.recv_timeout = False
1396 self.recv_timeout = False
1397 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1398 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1399# self.test_status = True
1400 return self.test_status
1401
1402 def igmp_flow_check_during_olt_onu_operational_issues(self, subscriber, multiple_sub = False):
1403 chan = 0
1404 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1405 self.num_joins += 1
1406 while self.num_joins < self.num_subscribers:
1407 time.sleep(5)
1408 log_test.info('All subscribers have joined the channel')
1409 for i in range(2):
1410 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1411 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1412 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1413 time.sleep(5)
1414 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1415 #Should not receive packets for this subscriber
1416 self.recv_timeout = True
1417 subscriber.recv_timeout = True
1418 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1419 subscriber.recv_timeout = False
1420 self.recv_timeout = False
1421 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1422 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1423# self.test_status = True
1424 return self.test_status
1425
Thangavelu K S8e413082017-07-13 20:02:14 +00001426 def voltha_igmp_jump_verify(self, subscriber):
1427 if subscriber.has_service('IGMP'):
1428 for i in xrange(subscriber.num):
1429 log_test.info('Subscriber %s jumping channel' %subscriber.name)
1430 chan = subscriber.channel_jump(delay=0)
1431 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
1432 log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1433 time.sleep(3)
1434 log_test.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats))
1435 self.test_status = True
1436 return self.test_status
1437
1438 def voltha_igmp_next_verify(self, subscriber):
1439 for c in xrange(self.VOLTHA_IGMP_ITERATIONS):
1440 for i in xrange(subscriber.num):
1441 if i:
1442 chan = subscriber.channel_join_next(delay=0, leave_flag = self.leave_flag)
1443 time.sleep(0.2)
1444 else:
1445 chan = subscriber.channel_join(i, delay=0)
1446 time.sleep(0.2)
1447 if subscriber.num == 1:
1448 subscriber.channel_leave(chan)
1449 log_test.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
1450 #subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
1451 #log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1452 self.test_status = True
1453 return self.test_status
1454
1455 def voltha_subscribers(self, services, cbs = None, num_subscribers = 1, num_channels = 1, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +00001456 """Test subscriber join next for channel surfing"""
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001457 voltha = VolthaCtrl(self.VOLTHA_HOST,
1458 rest_port = self.VOLTHA_REST_PORT,
1459 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S36edb012017-07-05 18:24:12 +00001460 if self.VOLTHA_OLT_TYPE.startswith('ponsim'):
A R Karthick168e2342017-08-15 16:13:10 -07001461 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S36edb012017-07-05 18:24:12 +00001462 log_test.info('Enabling ponsim olt')
1463 device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001464 if device_id != '':
1465 self.olt_device_id = device_id
Thangavelu K S36edb012017-07-05 18:24:12 +00001466 else:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001467 log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution')
1468 assert_equal(False, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00001469
1470 assert_not_equal(device_id, None)
1471 if status == False:
1472 voltha.disable_device(device_id, delete = True)
1473 assert_equal(status, True)
1474 time.sleep(10)
1475 switch_map = None
1476 olt_configured = False
1477 try:
1478 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1479 if not switch_map:
1480 log_test.info('No voltha devices found')
1481 return
1482 log_test.info('Installing OLT app')
1483 OnosCtrl.install_app(self.olt_app_file)
1484 time.sleep(5)
1485 log_test.info('Adding subscribers through OLT app')
1486 self.config_olt(switch_map)
1487 olt_configured = True
1488 time.sleep(5)
1489 self.num_subscribers = num_subscribers
1490 self.num_channels = num_channels
1491 test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers,
1492 num_channels = self.num_channels,
1493 cbs = cbs,
1494 port_list = self.generate_port_list(self.num_subscribers,
1495 self.num_channels),
Thangavelu K S8e413082017-07-13 20:02:14 +00001496 src_list = src_list, services = services)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001497 if test_status is False:
1498 self.success = False
Thangavelu K S36edb012017-07-05 18:24:12 +00001499 assert_equal(test_status, True)
1500 finally:
1501 if switch_map is not None:
1502 if olt_configured is True:
1503 self.remove_olt(switch_map)
1504 voltha.disable_device(device_id, delete = True)
1505 time.sleep(10)
1506 log_test.info('Uninstalling OLT app')
1507 OnosCtrl.uninstall_app(self.olt_app_name)
1508
Thangavelu K S8e413082017-07-13 20:02:14 +00001509 def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1,
1510 channel_start = 0, cbs = None, port_list = [], src_list = None,
Thangavelu K S36edb012017-07-05 18:24:12 +00001511 services = None, negative_subscriber_auth = None):
1512 self.test_status = False
1513 self.ovs_cleanup()
1514 subscribers_count = num_subscribers
1515 sub_loop_count = num_subscribers
1516 if not port_list:
1517 port_list = self.generate_port_list(num_subscribers, num_channels)
1518 subscriber_tx_rx_ports = []
1519 for i in range(num_subscribers):
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001520 subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map[port_list[i][0]],
1521 rx_port = self.port_map[port_list[i][1]],
Thangavelu K S8e413082017-07-13 20:02:14 +00001522 num_channels = num_channels,src_list = src_list,))
Thangavelu K S36edb012017-07-05 18:24:12 +00001523 self.onos_aaa_load()
Thangavelu K S8e413082017-07-13 20:02:14 +00001524 #load the ssm list for all subscriber channels
1525 igmpChannel = IgmpChannel(src_list = src_list)
1526 ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports)
1527 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
Thangavelu K S6432b522017-07-22 00:05:54 +00001528 if src_list is None:
1529 igmpChannel = IgmpChannel()
1530 igmpChannel.igmp_load_ssm_config(ssm_list)
1531 else:
1532 igmpChannel = IgmpChannel(src_list = src_list)
1533 igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001534
Thangavelu K S36edb012017-07-05 18:24:12 +00001535 self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1)
1536
1537 chan_leave = False #for single channel, multiple subscribers
1538 if cbs is None:
1539 cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check)
1540 chan_leave = True
1541 for subscriber in subscriber_tx_rx_ports:
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001542 if 'IGMP' in services:
1543# if src_list:
1544# for i in range(len(src_list)):
1545# subscriber.start(src_ip = src_list[i])
1546# else:
1547# subscriber.start()
1548 subscriber.start()
Thangavelu K S36edb012017-07-05 18:24:12 +00001549 sub_loop_count = sub_loop_count - 1
1550 pool_object = voltha_subscriber_pool(subscriber, cbs)
1551 self.thread_pool.addTask(pool_object.pool_cb)
1552 self.thread_pool.cleanUpThreads()
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001553 for subscriber in subscriber_tx_rx_ports:
1554 if services and 'IGMP' in services:
1555# if src_list:
1556# for i in range(len(src_list)):
1557# subscriber.stop(src_ip = src_list[i])
1558# else:
1559# subscriber.stop()
1560 subscriber.stop()
1561 if chan_leave is True:
1562 subscriber.channel_leave(0)
Thangavelu K S36edb012017-07-05 18:24:12 +00001563 subscribers_count = 0
1564 return self.test_status
1565
1566
1567 def generate_port_list(self, subscribers, channels):
1568 return self.port_list[:subscribers]
1569
Thangavelu K S36edb012017-07-05 18:24:12 +00001570 @classmethod
1571 def ovs_cleanup(cls):
1572 ##For every test case, delete all the OVS groups
1573 cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1'
1574 try:
1575 cord_test_shell(cmd)
1576 ##Since olt config is used for this test, we just fire a careless local cmd as well
1577 os.system(cmd)
1578 finally:
1579 return
1580
A.R Karthick8a507cf2017-06-02 18:44:49 -07001581 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -07001582 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -07001583 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
1584 assert_not_equal(device_id, None)
1585 try:
1586 assert_equal(status, True)
1587 time.sleep(10)
1588 finally:
1589 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001590
A.R Karthick8a507cf2017-06-02 18:44:49 -07001591 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001592 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001593 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -07001594 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1595 assert_not_equal(device_id, None)
1596 try:
1597 assert_equal(status, True)
1598 time.sleep(10)
1599 finally:
1600 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001601
A R Karthick31a40172017-08-14 12:06:09 -07001602 def test_maple_enable_disable(self):
1603 log_test.info('Enabling maple olt')
1604 if self.VOLTHA_OLT_IP:
1605 address = self.VOLTHA_OLT_IP
1606 device_id, status = self.voltha.enable_device('maple_olt', address = address)
1607 assert_not_equal(device_id, None)
1608 try:
1609 assert_equal(status, True)
1610 time.sleep(10)
1611 finally:
1612 self.voltha.disable_device(device_id, delete = True)
1613
Thangavelu K S008f38e2017-05-15 19:36:55 +00001614 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
1615 """
1616 Test Method:
1617 0. Make sure that voltha is up and running on CORD-POD setup.
1618 1. OLT and ONU is detected and validated.
1619 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1620 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
1621 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
1622 5. Verify that subscriber is authenticated successfully.
1623 """
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001624 ret = voltha_setup(
1625 host = self.VOLTHA_HOST,
A R Karthick168e2342017-08-15 16:13:10 -07001626 ponsim_host = self.VOLTHA_PONSIM_HOST,
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001627 rest_port = self.VOLTHA_REST_PORT,
1628 olt_type = 'ponsim_olt',
1629 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP,
1630 uplink_vlan_start = self.VOLTHA_UPLINK_VLAN_START,
1631 config_fake = self.VOLTHA_CONFIG_FAKE,
1632 olt_app = self.olt_app_file)
1633 assert_not_equal(ret, None)
1634 voltha, device_id, switch_map = ret[0], ret[1], ret[2]
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001635 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001636 log_test.info('Adding subscribers through OLT app')
1637 self.config_olt(switch_map)
1638 olt_configured = True
1639 time.sleep(5)
1640 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001641 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001642 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001643 if switch_map is not None:
1644 if olt_configured is True:
1645 self.remove_olt(switch_map)
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001646 voltha_teardown(voltha, device_id, switch_map, olt_app = self.olt_app_file)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001647
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001648 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001649 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
1650 """
1651 Test Method:
1652 0. Make sure that voltha is up and running on CORD-POD setup.
1653 1. OLT and ONU is detected and validated.
1654 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1655 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1656 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
1657 5. Verify that subscriber authentication is unsuccessful..
1658 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001659 df = defer.Deferred()
1660 def tls_flow_check_with_no_cert_scenario(df):
1661 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001662 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001663 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1664 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001665 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001666 time.sleep(10)
1667 switch_map = None
1668 olt_configured = False
1669 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1670 log_test.info('Installing OLT app')
1671 OnosCtrl.install_app(self.olt_app_file)
1672 time.sleep(5)
1673 log_test.info('Adding subscribers through OLT app')
1674 self.config_olt(switch_map)
1675 olt_configured = True
1676 time.sleep(5)
1677 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1678 try:
1679 assert_equal(auth_status, True)
1680 assert_equal(status, True)
1681 time.sleep(10)
1682 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001683 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001684 self.voltha.disable_device(device_id, delete = True)
1685 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001686
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001687 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1688 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001689
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001690 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001691 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
1692 """
1693 Test Method:
1694 0. Make sure that voltha is up and running on CORD-POD setup.
1695 1. OLT and ONU is detected and validated.
1696 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1697 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
1698 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1699 5. Verify that subscriber authentication is unsuccessful..
1700 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001701 df = defer.Deferred()
1702 def tls_flow_check_with_invalid_cert_scenario(df):
1703 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001704 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001705 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1706 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001707 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001708 time.sleep(10)
1709 switch_map = None
1710 olt_configured = False
1711 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1712 log_test.info('Installing OLT app')
1713 OnosCtrl.install_app(self.olt_app_file)
1714 time.sleep(5)
1715 log_test.info('Adding subscribers through OLT app')
1716 self.config_olt(switch_map)
1717 olt_configured = True
1718 time.sleep(5)
1719 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1720 try:
1721 assert_equal(auth_status, True)
1722 assert_equal(status, True)
1723 time.sleep(10)
1724 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001725 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001726 self.voltha.disable_device(device_id, delete = True)
1727 df.callback(0)
1728 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
1729 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001730
Thangavelu K S0d745c82017-06-09 21:56:08 +00001731 @deferred(TESTCASE_TIMEOUT)
1732 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
1733 """
1734 Test Method:
1735 0. Make sure that voltha is up and running on CORD-POD setup.
1736 1. OLT and ONU is detected and validated.
1737 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1738 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
1739 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1740 5. Verify that subscriber authentication is unsuccessful..
1741 """
1742 df = defer.Deferred()
1743 def tls_flow_check_with_no_cert_scenario(df):
1744 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001745 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001746 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1747 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001748 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001749 time.sleep(10)
1750 switch_map = None
1751 olt_configured = False
1752 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1753 log_test.info('Installing OLT app')
1754 OnosCtrl.install_app(self.olt_app_file)
1755 time.sleep(5)
1756 log_test.info('Adding subscribers through OLT app')
1757 self.config_olt(switch_map)
1758 olt_configured = True
1759 time.sleep(5)
1760 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1761 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1762 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1763 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1764 try:
1765 assert_equal(auth_status, True)
1766 assert_equal(status, True)
1767 time.sleep(10)
1768 finally:
1769 self.voltha.disable_device(device_id, delete = True)
1770 df.callback(0)
1771 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1772 return df
1773
1774 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001775 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
1776 """
1777 Test Method:
1778 0. Make sure that voltha is up and running on CORD-POD setup.
1779 1. OLT and ONU is detected and validated.
1780 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1781 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1782 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
1783 5. Verify that subscriber authentication is unsuccessful..
1784 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001785 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001786 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001787 aaa_app = ["org.opencord.aaa"]
1788 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001789 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001790 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1791 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001792 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001793 time.sleep(10)
1794 switch_map = None
1795 olt_configured = False
1796 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1797 log_test.info('Installing OLT app')
1798 OnosCtrl.install_app(self.olt_app_file)
1799 time.sleep(5)
1800 log_test.info('Adding subscribers through OLT app')
1801 self.config_olt(switch_map)
1802 olt_configured = True
1803 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001804
Thangavelu K S0d745c82017-06-09 21:56:08 +00001805 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
1806 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
1807 thread1.start()
1808 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001809 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001810 thread2.start()
1811 time.sleep(10)
1812 thread1.join()
1813 thread2.join()
1814 try:
1815 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001816 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001817 time.sleep(10)
1818 finally:
1819 self.voltha.disable_device(device_id, delete = True)
1820 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001821 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001822 return df
1823
1824 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001825 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
1826 """
1827 Test Method:
1828 0. Make sure that voltha is up and running on CORD-POD setup.
1829 1. OLT and ONU is detected and validated.
1830 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1831 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1832 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
1833 5. Verify that subscriber authentication is unsuccessful..
1834 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001835 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001836 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001837 aaa_app = ["org.opencord.aaa"]
1838 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001839 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001840 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1841 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001842 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001843 time.sleep(10)
1844 switch_map = None
1845 olt_configured = False
1846 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1847 log_test.info('Installing OLT app')
1848 OnosCtrl.install_app(self.olt_app_file)
1849 time.sleep(5)
1850 log_test.info('Adding subscribers through OLT app')
1851 self.config_olt(switch_map)
1852 olt_configured = True
1853 time.sleep(5)
1854
1855 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
1856 thread2 = threading.Thread(target = cord_test_radius_restart)
1857 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001858 time.sleep(randint(1,2))
1859 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001860 thread2.start()
1861 time.sleep(10)
1862 thread1.join()
1863 thread2.join()
1864 try:
1865 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001866 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001867 time.sleep(10)
1868 finally:
1869 self.voltha.disable_device(device_id, delete = True)
1870 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001871 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001872 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001873
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001874 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001875 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
1876 """
1877 Test Method:
1878 0. Make sure that voltha is up and running on CORD-POD setup.
1879 1. OLT and ONU is detected and validated.
1880 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1881 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1882 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1883 6. Verify that subscriber authenticated successfully.
1884 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
1885 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1886 9. Verify that subscriber authentication is unsuccessful..
1887 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001888 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001889 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001890 aaa_app = ["org.opencord.aaa"]
1891 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001892 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001893 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1894 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001895 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001896 time.sleep(10)
1897 switch_map = None
1898 olt_configured = False
1899 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1900 log_test.info('Installing OLT app')
1901 OnosCtrl.install_app(self.olt_app_file)
1902 time.sleep(5)
1903 log_test.info('Adding subscribers through OLT app')
1904 self.config_olt(switch_map)
1905 olt_configured = True
1906 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001907
Thangavelu K S0d745c82017-06-09 21:56:08 +00001908 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001909 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +00001910 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001911 time.sleep(randint(1,2))
1912 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001913 thread2.start()
1914 time.sleep(10)
1915 thread1.join()
1916 thread2.join()
1917 try:
1918 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001919 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001920 time.sleep(10)
1921 finally:
1922 self.voltha.disable_device(device_id, delete = True)
1923 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001924 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001925 return df
1926
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001927 @deferred(TESTCASE_TIMEOUT)
1928 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001929 """
1930 Test Method:
1931 0. Make sure that voltha is up and running on CORD-POD setup.
1932 1. OLT and ONU is detected and validated.
1933 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1934 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1935 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1936 6. Verify that subscriber authenticated successfully.
1937 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1938 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1939 9. Verify that subscriber authentication is unsuccessful..
1940 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001941 df = defer.Deferred()
1942 def tls_flow_check_operating_olt_state(df):
1943 aaa_app = ["org.opencord.aaa"]
1944 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001945 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001946 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1947 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001948 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001949 time.sleep(10)
1950 switch_map = None
1951 olt_configured = False
1952 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1953 log_test.info('Installing OLT app')
1954 OnosCtrl.install_app(self.olt_app_file)
1955 time.sleep(5)
1956 log_test.info('Adding subscribers through OLT app')
1957 self.config_olt(switch_map)
1958 olt_configured = True
1959 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001960
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001961 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
1962 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
1963 thread1.start()
1964 time.sleep(randint(1,2))
1965 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
1966 thread2.start()
1967 time.sleep(10)
1968 thread1.join()
1969 thread2.join()
1970 try:
1971 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001972 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001973 time.sleep(10)
1974 finally:
1975 self.voltha.disable_device(device_id, delete = True)
1976 df.callback(0)
1977 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
1978 return df
1979
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00001980 @deferred(TESTCASE_TIMEOUT +600)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001981 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self):
1982 """
1983 Test Method:
1984 0. Make sure that voltha is up and running on CORD-POD setup.
1985 1. OLT and ONU is detected and validated.
1986 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1987 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1988 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1989 6. Verify that subscriber authenticated successfully.
1990 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1991 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1992 9. Verify that subscriber authentication is unsuccessful..
1993 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
1994
1995 """
1996 df = defer.Deferred()
1997 no_iterations = 10
1998 def tls_flow_check_with_disable_olt_device_scenario(df):
1999 aaa_app = ["org.opencord.aaa"]
2000 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002001 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002002 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2003 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002004 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002005 time.sleep(10)
2006 switch_map = None
2007 olt_configured = False
2008 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2009 log_test.info('Installing OLT app')
2010 OnosCtrl.install_app(self.olt_app_file)
2011 time.sleep(5)
2012 log_test.info('Adding subscribers through OLT app')
2013 self.config_olt(switch_map)
2014 olt_configured = True
2015 time.sleep(5)
2016 for i in range(no_iterations):
2017 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 +00002018 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002019 thread1.start()
2020 time.sleep(randint(1,2))
2021 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
2022 thread2.start()
2023 time.sleep(10)
2024 thread1.join()
2025 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002026 time.sleep(60)
2027 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002028 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2029 try:
2030 # assert_equal(status, True)
2031 assert_equal(auth_status, True)
2032 assert_equal(self.success, True)
2033 time.sleep(10)
2034 finally:
2035 self.voltha.disable_device(device_id, delete = True)
2036 df.callback(0)
2037 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2038 return df
2039
2040 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002041 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
2042 """
2043 Test Method:
2044 0. Make sure that voltha is up and running on CORD-POD setup.
2045 1. OLT and ONU is detected and validated.
2046 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2047 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2048 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2049 6. Verify that subscriber authenticated successfully.
2050 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2051 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2052 9. Verify that subscriber authentication is unsuccessful..
2053 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002054 df = defer.Deferred()
2055 def tls_flow_check_operating_olt_state(df):
2056 aaa_app = ["org.opencord.aaa"]
2057 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002058 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002059 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2060 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002061 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002062 time.sleep(10)
2063 switch_map = None
2064 olt_configured = False
2065 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2066 log_test.info('Installing OLT app')
2067 OnosCtrl.install_app(self.olt_app_file)
2068 time.sleep(5)
2069 log_test.info('Adding subscribers through OLT app')
2070 self.config_olt(switch_map)
2071 olt_configured = True
2072 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002073
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002074 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2075 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2076 thread1.start()
2077 time.sleep(randint(1,2))
2078 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2079 thread2.start()
2080 time.sleep(10)
2081 thread1.join()
2082 thread2.join()
2083 try:
2084 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002085 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002086 time.sleep(10)
2087 finally:
2088 self.voltha.disable_device(device_id, delete = True)
2089 df.callback(0)
2090 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2091 return df
2092
2093 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002094 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self):
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002095 """
2096 Test Method:
2097 0. Make sure that voltha is up and running on CORD-POD setup.
2098 1. OLT and ONU is detected and validated.
2099 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2100 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2101 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2102 6. Verify that subscriber authenticated successfully.
2103 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2104 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2105 9. Verify that subscriber authentication is unsuccessful..
2106 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2107 """
2108 df = defer.Deferred()
2109 no_iterations = 10
2110 def tls_flow_check_with_disable_olt_device_scenario(df):
2111 aaa_app = ["org.opencord.aaa"]
2112 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002113 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002114 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2115 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002116 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002117 time.sleep(10)
2118 switch_map = None
2119 olt_configured = False
2120 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2121 log_test.info('Installing OLT app')
2122 OnosCtrl.install_app(self.olt_app_file)
2123 time.sleep(5)
2124 log_test.info('Adding subscribers through OLT app')
2125 self.config_olt(switch_map)
2126 olt_configured = True
2127 time.sleep(5)
2128 for i in range(no_iterations):
2129 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2130 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2131 thread1.start()
2132 time.sleep(randint(1,2))
2133 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2134 thread2.start()
2135 time.sleep(10)
2136 thread1.join()
2137 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002138 time.sleep(60)
2139 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002140 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2141 try:
2142 # assert_equal(status, True)
2143 assert_equal(auth_status, True)
2144 assert_equal(self.success, True)
2145 time.sleep(10)
2146 finally:
2147 self.voltha.disable_device(device_id, delete = True)
2148 df.callback(0)
2149 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2150 return df
2151
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002152 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002153 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
2154 """
2155 Test Method:
2156 0. Make sure that voltha is up and running on CORD-POD setup.
2157 1. OLT and ONU is detected and validated.
2158 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2159 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2160 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2161 6. Verify that subscriber authenticated successfully.
2162 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2163 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2164 9. Verify that subscriber authentication is unsuccessful..
2165 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002166 df = defer.Deferred()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002167 def tls_flow_check_operating_onu_state(df):
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002168 aaa_app = ["org.opencord.aaa"]
2169 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002170 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002171 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2172 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00002173 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2174
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002175 onu_device_id = devices_list['items'][1]['id']
2176 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002177 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002178 time.sleep(10)
2179 switch_map = None
2180 olt_configured = False
2181 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2182 log_test.info('Installing OLT app')
2183 OnosCtrl.install_app(self.olt_app_file)
2184 time.sleep(5)
2185 log_test.info('Adding subscribers through OLT app')
2186 self.config_olt(switch_map)
2187 olt_configured = True
2188 time.sleep(5)
2189 devices_list = self.voltha.get_devices()
2190 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2191 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2192 thread1.start()
2193 time.sleep(randint(1,2))
2194 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2195 thread2.start()
2196 time.sleep(10)
2197 thread1.join()
2198 thread2.join()
2199 try:
2200 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002201 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002202 time.sleep(10)
2203 finally:
2204 self.voltha.disable_device(device_id, delete = True)
2205 df.callback(0)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002206 reactor.callLater(0, tls_flow_check_operating_onu_state, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002207 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002208
Thangavelu K S9648eed2017-06-13 20:15:25 +00002209 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002210 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
2211 """
2212 Test Method:
2213 0. Make sure that voltha is up and running on CORD-POD setup.
2214 1. OLT and ONU is detected and validated.
2215 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2216 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2217 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2218 6. Verify that subscriber authenticated successfully.
2219 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2220 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2221 9. Verify that subscriber authentication is unsuccessful..
2222 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2223 """
2224 df = defer.Deferred()
2225 no_iterations = 10
2226 def tls_flow_check_operating_olt_state(df):
2227 aaa_app = ["org.opencord.aaa"]
2228 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002229 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002230 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2231 devices_list = self.voltha.get_devices()
2232 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2233
2234 onu_device_id = devices_list['items'][1]['id']
2235 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002236 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002237 time.sleep(10)
2238 switch_map = None
2239 olt_configured = False
2240 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2241 log_test.info('Installing OLT app')
2242 OnosCtrl.install_app(self.olt_app_file)
2243 time.sleep(5)
2244 log_test.info('Adding subscribers through OLT app')
2245 self.config_olt(switch_map)
2246 olt_configured = True
2247 time.sleep(5)
2248 devices_list = self.voltha.get_devices()
2249 for i in range(no_iterations):
2250 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2251 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2252 thread1.start()
2253 time.sleep(randint(1,2))
2254 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2255 thread2.start()
2256 time.sleep(10)
2257 thread1.join()
2258 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002259 time.sleep(60)
2260 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002261 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2262 try:
2263 # assert_equal(status, True)
2264 assert_equal(auth_status, True)
2265 assert_equal(self.success, True)
2266 time.sleep(10)
2267 finally:
2268 self.voltha.disable_device(device_id, delete = True)
2269 df.callback(0)
2270 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2271 return df
2272
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002273 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002274 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002275 """
2276 Test Method:
2277 0. Make sure that voltha is up and running on CORD-POD setup.
2278 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2279 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2280 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2281 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
2282 5. Verify that two subscribers are authenticated successfully.
2283 """
2284
Thangavelu K S9648eed2017-06-13 20:15:25 +00002285 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002286 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002287 aaa_app = ["org.opencord.aaa"]
2288 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002289 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002290 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2291 devices_list = self.voltha.get_devices()
2292 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2293
2294 onu_device_id = devices_list['items'][1]['id']
2295 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002296 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002297 time.sleep(10)
2298 switch_map = None
2299 olt_configured = False
2300 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2301 log_test.info('Installing OLT app')
2302 OnosCtrl.install_app(self.olt_app_file)
2303 time.sleep(5)
2304 log_test.info('Adding subscribers through OLT app')
2305 self.config_olt(switch_map)
2306 olt_configured = True
2307 time.sleep(5)
2308 devices_list = self.voltha.get_devices()
2309 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2310 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2311 thread1.start()
2312 time.sleep(randint(1,2))
2313 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2314 thread2.start()
2315 time.sleep(10)
2316 thread1.join()
2317 thread2.join()
2318 try:
2319 # assert_equal(status, True)
2320 assert_equal(self.success, True)
2321 time.sleep(10)
2322 finally:
2323 self.voltha.disable_device(device_id, delete = True)
2324 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002325 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002326 return df
2327
2328 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002329 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002330 """
2331 Test Method:
2332 0. Make sure that voltha is up and running on CORD-POD setup.
2333 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2334 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2335 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2336 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
2337 5. Verify that two subscribers are not authenticated.
2338 """
2339
Thangavelu K S9648eed2017-06-13 20:15:25 +00002340 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002341 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002342 aaa_app = ["org.opencord.aaa"]
2343 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002344 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002345 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2346 devices_list = self.voltha.get_devices()
2347 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2348
2349 onu_device_id = devices_list['items'][1]['id']
2350 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002351 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002352 time.sleep(10)
2353 switch_map = None
2354 olt_configured = False
2355 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2356 log_test.info('Installing OLT app')
2357 OnosCtrl.install_app(self.olt_app_file)
2358 time.sleep(5)
2359 log_test.info('Adding subscribers through OLT app')
2360 self.config_olt(switch_map)
2361 olt_configured = True
2362 time.sleep(5)
2363 devices_list = self.voltha.get_devices()
2364 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2365 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
2366 thread1.start()
2367 time.sleep(randint(1,2))
2368 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2369 thread2.start()
2370 time.sleep(10)
2371 thread1.join()
2372 thread2.join()
2373 try:
2374 # assert_equal(status, True)
2375 assert_equal(self.success, True)
2376 time.sleep(10)
2377 finally:
2378 self.voltha.disable_device(device_id, delete = True)
2379 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002380 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002381 return df
2382
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002383 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002384 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 +00002385 """
2386 Test Method:
2387 0. Make sure that voltha is up and running on CORD-POD setup.
2388 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2389 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2390 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2391 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2392 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
2393 6. Verify that valid subscriber authenticated successfully.
2394 7. Verify that invalid subscriber are not authenticated successfully.
2395 """
2396
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002397 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002398 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002399 aaa_app = ["org.opencord.aaa"]
2400 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002401 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002402 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2403 devices_list = self.voltha.get_devices()
2404 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2405
2406 onu_device_id = devices_list['items'][1]['id']
2407 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002408 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002409 time.sleep(10)
2410 switch_map = None
2411 olt_configured = False
2412 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2413 log_test.info('Installing OLT app')
2414 OnosCtrl.install_app(self.olt_app_file)
2415 time.sleep(5)
2416 log_test.info('Adding subscribers through OLT app')
2417 self.config_olt(switch_map)
2418 olt_configured = True
2419 time.sleep(5)
2420 devices_list = self.voltha.get_devices()
2421 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2422 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
2423 thread1.start()
2424 time.sleep(randint(1,2))
2425 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2426 thread2.start()
2427 time.sleep(10)
2428 thread1.join()
2429 thread2.join()
2430 try:
2431 # assert_equal(status, True)
2432 assert_equal(self.success, True)
2433 time.sleep(10)
2434 finally:
2435 self.voltha.disable_device(device_id, delete = True)
2436 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002437 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002438 return df
2439
2440 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002441 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 +00002442 """
2443 Test Method:
2444 0. Make sure that voltha is up and running on CORD-POD setup.
2445 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2446 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2447 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2448 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2449 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
2450 6. Verify that valid subscriber authenticated successfully.
2451 7. Verify that invalid subscriber are not authenticated successfully.
2452 """
2453
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002454 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002455 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002456 aaa_app = ["org.opencord.aaa"]
2457 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002458 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002459 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2460 devices_list = self.voltha.get_devices()
2461 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2462
2463 onu_device_id = devices_list['items'][1]['id']
2464 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002465 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002466 time.sleep(10)
2467 switch_map = None
2468 olt_configured = False
2469 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2470 log_test.info('Installing OLT app')
2471 OnosCtrl.install_app(self.olt_app_file)
2472 time.sleep(5)
2473 log_test.info('Adding subscribers through OLT app')
2474 self.config_olt(switch_map)
2475 olt_configured = True
2476 time.sleep(5)
2477 devices_list = self.voltha.get_devices()
2478 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2479 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
2480 thread1.start()
2481 time.sleep(randint(1,2))
2482 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2483 thread2.start()
2484 time.sleep(10)
2485 thread1.join()
2486 thread2.join()
2487 try:
2488 # assert_equal(status, True)
2489 assert_equal(self.success, True)
2490 time.sleep(10)
2491 finally:
2492 self.voltha.disable_device(device_id, delete = True)
2493 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002494 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002495 return df
2496
2497 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002498 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002499 """
2500 Test Method:
2501 0. Make sure that voltha is up and running on CORD-POD setup.
2502 1. OLT and ONU is detected and validated.
2503 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2504 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2505 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
2506 6. Verify that subscriber authenticated successfully.
2507 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
2508 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
2509 9. Verify that subscriber authentication is unsuccessful..
2510 10. Verify that other subscriber authenticated successfully.
2511 """
2512
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002513 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002514 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002515 aaa_app = ["org.opencord.aaa"]
2516 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002517 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002518 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2519 devices_list = self.voltha.get_devices()
2520 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2521
2522 onu_device_id = devices_list['items'][1]['id']
2523 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002524 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002525 time.sleep(10)
2526 switch_map = None
2527 olt_configured = False
2528 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2529 log_test.info('Installing OLT app')
2530 OnosCtrl.install_app(self.olt_app_file)
2531 time.sleep(5)
2532 log_test.info('Adding subscribers through OLT app')
2533 self.config_olt(switch_map)
2534 olt_configured = True
2535 time.sleep(5)
2536 devices_list = self.voltha.get_devices()
2537 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2538 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
2539 thread1.start()
2540 time.sleep(randint(1,2))
2541 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2542 thread2.start()
2543 time.sleep(10)
2544 thread1.join()
2545 thread2.join()
2546 try:
2547 # assert_equal(status, True)
2548 assert_equal(self.success, True)
2549 time.sleep(10)
2550 finally:
2551 self.voltha.disable_device(device_id, delete = True)
2552 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002553 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002554 return df
2555
Thangavelu K S36edb012017-07-05 18:24:12 +00002556 def test_3_subscribers_with_voltha_for_eap_tls_authentication(self):
2557 """
2558 Test Method:
2559 0. Make sure that voltha is up and running on CORD-POD setup.
2560 1. OLT and ONU is detected and validated.
2561 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2562 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers)
2563 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2564 5. Verify that subscriber is authenticated successfully.
2565 """
2566 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2567 num_subscribers = 3
2568 num_channels = 1
2569 services = ('TLS')
2570 cbs = (self.tls_flow_check, None, None)
2571 self.voltha_subscribers(services, cbs = cbs,
2572 num_subscribers = num_subscribers,
2573 num_channels = num_channels)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00002574 assert_equal(self.success, True)
2575
Thangavelu K S36edb012017-07-05 18:24:12 +00002576
2577 def test_5_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 (5 subscriber)
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 = 5
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)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00002595 assert_equal(self.success, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00002596
2597 def test_9_subscribers_with_voltha_for_eap_tls_authentication(self):
2598 """
2599 Test Method:
2600 0. Make sure that voltha is up and running on CORD-POD setup.
2601 1. OLT and ONU is detected and validated.
2602 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2603 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber)
2604 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2605 5. Verify that subscriber is authenticated successfully.
2606 """
2607 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2608 num_subscribers = 9
2609 num_channels = 1
2610 services = ('TLS')
2611 cbs = (self.tls_flow_check, None, None)
2612 self.voltha_subscribers(services, cbs = cbs,
2613 num_subscribers = num_subscribers,
2614 num_channels = num_channels)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00002615 assert_equal(self.success, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00002616
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002617 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002618 def test_subscriber_with_voltha_for_dhcp_request(self):
2619 """
2620 Test Method:
2621 0. Make sure that voltha is up and running on CORD-POD setup.
2622 1. OLT and ONU is detected and validated.
2623 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2624 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2625 4. Verify that subscriber get ip from dhcp server successfully.
2626 """
2627
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002628 df = defer.Deferred()
2629 def dhcp_flow_check_scenario(df):
2630 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002631 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002632 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2633 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002634 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002635 time.sleep(10)
2636 switch_map = None
2637 olt_configured = False
2638 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2639 log_test.info('Installing OLT app')
2640 OnosCtrl.install_app(self.olt_app_file)
2641 time.sleep(5)
2642 log_test.info('Adding subscribers through OLT app')
2643 self.config_olt(switch_map)
2644 olt_configured = True
2645 time.sleep(5)
2646 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2647 try:
2648 assert_equal(dhcp_status, True)
2649 #assert_equal(status, True)
2650 time.sleep(10)
2651 finally:
2652 self.remove_olt(switch_map)
2653 self.voltha.disable_device(device_id, delete = True)
2654 df.callback(0)
2655
2656 reactor.callLater(0, dhcp_flow_check_scenario, df)
2657 return df
2658
2659 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002660 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
2661 """
2662 Test Method:
2663 0. Make sure that voltha is up and running on CORD-POD setup.
2664 1. OLT and ONU is detected and validated.
2665 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2666 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
2667 4. Verify that subscriber should not get ip from dhcp server.
2668 """
2669
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002670 df = defer.Deferred()
2671 def dhcp_flow_check_scenario(df):
2672 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002673 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002674 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2675 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002676 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002677 time.sleep(10)
2678 switch_map = None
2679 olt_configured = False
2680 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2681 log_test.info('Installing OLT app')
2682 OnosCtrl.install_app(self.olt_app_file)
2683 time.sleep(5)
2684 log_test.info('Adding subscribers through OLT app')
2685 self.config_olt(switch_map)
2686 olt_configured = True
2687 time.sleep(5)
2688 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
2689 try:
2690 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002691 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002692 #assert_equal(status, True)
2693 time.sleep(10)
2694 finally:
2695 self.voltha.disable_device(device_id, delete = True)
2696 self.remove_olt(switch_map)
2697 df.callback(0)
2698
2699 reactor.callLater(0, dhcp_flow_check_scenario, df)
2700 return df
2701
2702
2703 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002704 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
2705 """
2706 Test Method:
2707 0. Make sure that voltha is up and running on CORD-POD setup.
2708 1. OLT and ONU is detected and validated.
2709 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2710 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
2711 4. Verify that subscriber should not get ip from dhcp server.
2712 """
2713
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002714 df = defer.Deferred()
2715 def dhcp_flow_check_scenario(df):
2716 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002717 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002718 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2719 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002720 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002721 time.sleep(10)
2722 switch_map = None
2723 olt_configured = False
2724 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2725 log_test.info('Installing OLT app')
2726 OnosCtrl.install_app(self.olt_app_file)
2727 time.sleep(5)
2728 log_test.info('Adding subscribers through OLT app')
2729 self.config_olt(switch_map)
2730 olt_configured = True
2731 time.sleep(5)
2732 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
2733 try:
2734 assert_equal(dhcp_status, True)
2735 #assert_equal(status, True)
2736 time.sleep(10)
2737 finally:
2738 self.voltha.disable_device(device_id, delete = True)
2739 self.remove_olt(switch_map)
2740 df.callback(0)
2741
2742 reactor.callLater(0, dhcp_flow_check_scenario, df)
2743 return df
2744
2745 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002746 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
2747 """
2748 Test Method:
2749 0. Make sure that voltha is up and running on CORD-POD setup.
2750 1. OLT and ONU is detected and validated.
2751 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2752 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
2753 4. Verify that subscriber should not get ip from dhcp server.
2754 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002755 df = defer.Deferred()
2756 def dhcp_flow_check_scenario(df):
2757 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002758 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002759 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2760 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002761 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002762 time.sleep(10)
2763 switch_map = None
2764 olt_configured = False
2765 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2766 log_test.info('Installing OLT app')
2767 OnosCtrl.install_app(self.olt_app_file)
2768 time.sleep(5)
2769 log_test.info('Adding subscribers through OLT app')
2770 self.config_olt(switch_map)
2771 olt_configured = True
2772 time.sleep(5)
2773 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
2774 try:
2775 assert_equal(dhcp_status, True)
2776 #assert_equal(status, True)
2777 time.sleep(10)
2778 finally:
2779 self.voltha.disable_device(device_id, delete = True)
2780 self.remove_olt(switch_map)
2781 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002782
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002783 reactor.callLater(0, dhcp_flow_check_scenario, df)
2784 return df
2785
2786 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002787 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
2788 """
2789 Test Method:
2790 0. Make sure that voltha is up and running on CORD-POD setup.
2791 1. OLT and ONU is detected and validated.
2792 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2793 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2794 4. Verify that subscriber get ip from dhcp server successfully.
2795 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
2796 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
2797 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002798 df = defer.Deferred()
2799 def dhcp_flow_check_scenario(df):
2800 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002801 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002802 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2803 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002804 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002805 time.sleep(10)
2806 switch_map = None
2807 olt_configured = False
2808 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2809 log_test.info('Installing OLT app')
2810 OnosCtrl.install_app(self.olt_app_file)
2811 time.sleep(5)
2812 log_test.info('Adding subscribers through OLT app')
2813 self.config_olt(switch_map)
2814 olt_configured = True
2815 time.sleep(5)
2816 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
2817 try:
2818 assert_equal(dhcp_status, True)
2819 #assert_equal(status, True)
2820 time.sleep(10)
2821 finally:
2822 self.voltha.disable_device(device_id, delete = True)
2823 self.remove_olt(switch_map)
2824 df.callback(0)
2825
2826 reactor.callLater(0, dhcp_flow_check_scenario, df)
2827 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002828
Thangavelu K S735a6662017-06-15 18:08:23 +00002829 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07002830 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002831 """
2832 Test Method:
2833 0. Make sure that voltha is up and running on CORD-POD setup.
2834 1. OLT and ONU is detected and validated.
2835 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2836 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2837 4. Verify that subscriber get ip from dhcp server successfully.
2838 5. Repeat step 3 and 4 for 10 times.
2839 6 Verify that subscriber should get ip from dhcp server.
2840 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002841 df = defer.Deferred()
2842 def dhcp_flow_check_scenario(df):
2843 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002844 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00002845 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2846 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002847 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002848 time.sleep(10)
2849 switch_map = None
2850 olt_configured = False
2851 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2852 log_test.info('Installing OLT app')
2853 OnosCtrl.install_app(self.olt_app_file)
2854 time.sleep(5)
2855 log_test.info('Adding subscribers through OLT app')
2856 self.config_olt(switch_map)
2857 olt_configured = True
2858 time.sleep(5)
2859 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
2860 try:
2861 assert_equal(dhcp_status, True)
2862 #assert_equal(status, True)
2863 time.sleep(10)
2864 finally:
2865 self.voltha.disable_device(device_id, delete = True)
2866 self.remove_olt(switch_map)
2867 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002868
Thangavelu K S735a6662017-06-15 18:08:23 +00002869 reactor.callLater(0, dhcp_flow_check_scenario, df)
2870 return df
2871
Thangavelu K S735a6662017-06-15 18:08:23 +00002872 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002873 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
2874 """
2875 Test Method:
2876 0. Make sure that voltha is up and running on CORD-POD setup.
2877 1. OLT and ONU is detected and validated.
2878 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2879 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
2880 4. Verify that subscriber should not get ip from dhcp server.
2881 5. Repeat steps 3 and 4 for 10 times.
2882 6 Verify that subscriber should not get ip from dhcp server.
2883 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002884 df = defer.Deferred()
2885 def dhcp_flow_check_scenario(df):
2886 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002887 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00002888 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2889 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002890 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002891 time.sleep(10)
2892 switch_map = None
2893 olt_configured = False
2894 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2895 log_test.info('Installing OLT app')
2896 OnosCtrl.install_app(self.olt_app_file)
2897 time.sleep(5)
2898 log_test.info('Adding subscribers through OLT app')
2899 self.config_olt(switch_map)
2900 olt_configured = True
2901 time.sleep(5)
2902 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
2903 try:
2904 assert_equal(dhcp_status, True)
2905 #assert_equal(status, True)
2906 time.sleep(10)
2907 finally:
2908 self.voltha.disable_device(device_id, delete = True)
2909 self.remove_olt(switch_map)
2910 df.callback(0)
2911
2912 reactor.callLater(0, dhcp_flow_check_scenario, df)
2913 return df
2914
Thangavelu K S735a6662017-06-15 18:08:23 +00002915 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002916 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
2917 """
2918 Test Method:
2919 0. Make sure that voltha is up and running on CORD-POD setup.
2920 1. OLT and ONU is detected and validated.
2921 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2922 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2923 4. Verify that subscriber get ip from dhcp server successfully.
2924 5. Repeat step 3 for 50 times.
2925 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2926 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002927 df = defer.Deferred()
2928 def dhcp_flow_check_scenario(df):
2929 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002930 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00002931 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2932 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002933 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002934 time.sleep(10)
2935 switch_map = None
2936 olt_configured = False
2937 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2938 log_test.info('Installing OLT app')
2939 OnosCtrl.install_app(self.olt_app_file)
2940 time.sleep(5)
2941 log_test.info('Adding subscribers through OLT app')
2942 self.config_olt(switch_map)
2943 olt_configured = True
2944 time.sleep(5)
2945 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
2946 try:
2947 assert_equal(dhcp_status, True)
2948 #assert_equal(status, True)
2949 time.sleep(10)
2950 finally:
2951 self.voltha.disable_device(device_id, delete = True)
2952 self.remove_olt(switch_map)
2953 df.callback(0)
2954
2955 reactor.callLater(0, dhcp_flow_check_scenario, df)
2956 return df
2957
Thangavelu K S735a6662017-06-15 18:08:23 +00002958 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002959 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
2960 """
2961 Test Method:
2962 0. Make sure that voltha is up and running on CORD-POD setup.
2963 1. OLT and ONU is detected and validated.
2964 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2965 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2966 4. Verify that subscriber get ip from dhcp server successfully.
2967 5. Send DHCP request to dhcp server which is running as onos app.
2968 6. Repeat step 5 for 50 times.
2969 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2970 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002971 df = defer.Deferred()
2972 def dhcp_flow_check_scenario(df):
2973 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002974 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00002975 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2976 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002977 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002978 time.sleep(10)
2979 switch_map = None
2980 olt_configured = False
2981 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2982 log_test.info('Installing OLT app')
2983 OnosCtrl.install_app(self.olt_app_file)
2984 time.sleep(5)
2985 log_test.info('Adding subscribers through OLT app')
2986 self.config_olt(switch_map)
2987 olt_configured = True
2988 time.sleep(5)
2989 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
2990 try:
2991 assert_equal(dhcp_status, True)
2992 #assert_equal(status, True)
2993 time.sleep(10)
2994 finally:
2995 self.voltha.disable_device(device_id, delete = True)
2996 self.remove_olt(switch_map)
2997 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002998
Thangavelu K S735a6662017-06-15 18:08:23 +00002999 reactor.callLater(0, dhcp_flow_check_scenario, df)
3000 return df
3001
Thangavelu K S735a6662017-06-15 18:08:23 +00003002 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003003 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
3004 """
3005 Test Method:
3006 0. Make sure that voltha is up and running on CORD-POD setup.
3007 1. OLT and ONU is detected and validated.
3008 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3009 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
3010 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
3011 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003012 df = defer.Deferred()
3013 def dhcp_flow_check_scenario(df):
3014 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003015 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003016 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3017 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003018 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003019 time.sleep(10)
3020 switch_map = None
3021 olt_configured = False
3022 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3023 log_test.info('Installing OLT app')
3024 OnosCtrl.install_app(self.olt_app_file)
3025 time.sleep(5)
3026 log_test.info('Adding subscribers through OLT app')
3027 self.config_olt(switch_map)
3028 olt_configured = True
3029 time.sleep(5)
3030 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
3031 try:
3032 assert_equal(dhcp_status, True)
3033 #assert_equal(status, True)
3034 time.sleep(10)
3035 finally:
3036 self.voltha.disable_device(device_id, delete = True)
3037 self.remove_olt(switch_map)
3038 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003039
Thangavelu K S735a6662017-06-15 18:08:23 +00003040 reactor.callLater(0, dhcp_flow_check_scenario, df)
3041 return df
3042
3043 @deferred(TESTCASE_TIMEOUT)
3044 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003045 """
3046 Test Method:
3047 0. Make sure that voltha is up and running on CORD-POD setup.
3048 1. OLT and ONU is detected and validated.
3049 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3050 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
3051 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.
3052 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003053 df = defer.Deferred()
3054 def dhcp_flow_check_scenario(df):
3055 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003056 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003057 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3058 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003059 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003060 time.sleep(10)
3061 switch_map = None
3062 olt_configured = False
3063 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3064 log_test.info('Installing OLT app')
3065 OnosCtrl.install_app(self.olt_app_file)
3066 time.sleep(5)
3067 log_test.info('Adding subscribers through OLT app')
3068 self.config_olt(switch_map)
3069 olt_configured = True
3070 time.sleep(5)
3071 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
3072 try:
3073 assert_equal(dhcp_status, True)
3074 #assert_equal(status, True)
3075 time.sleep(10)
3076 finally:
3077 self.voltha.disable_device(device_id, delete = True)
3078 self.remove_olt(switch_map)
3079 df.callback(0)
3080
3081 reactor.callLater(0, dhcp_flow_check_scenario, df)
3082 return df
3083
Thangavelu K S735a6662017-06-15 18:08:23 +00003084 @deferred(TESTCASE_TIMEOUT)
3085 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003086 """
3087 Test Method:
3088 0. Make sure that voltha is up and running on CORD-POD setup.
3089 1. OLT and ONU is detected and validated.
3090 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3091 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3092 4. Verify that subscriber get ip from dhcp server successfully.
3093 5. Deactivate dhcp server app in onos.
3094 6. Repeat step 3.
3095 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3096 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003097 df = defer.Deferred()
3098 dhcp_app = 'org.onosproject.dhcp'
3099 def dhcp_flow_check_scenario(df):
3100 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003101 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003102 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3103 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003104 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003105 time.sleep(10)
3106 switch_map = None
3107 olt_configured = False
3108 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3109 log_test.info('Installing OLT app')
3110 OnosCtrl.install_app(self.olt_app_file)
3111 time.sleep(5)
3112 log_test.info('Adding subscribers through OLT app')
3113 self.config_olt(switch_map)
3114 olt_configured = True
3115 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003116 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00003117 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
3118 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3119 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00003120 thread1.start()
3121 time.sleep(10)
3122 thread1.join()
3123 thread2.join()
3124 try:
3125 assert_equal(self.success, True)
3126 #assert_equal(status, True)
3127 time.sleep(10)
3128 finally:
3129 self.voltha.disable_device(device_id, delete = True)
3130 self.remove_olt(switch_map)
3131 df.callback(0)
3132
3133 reactor.callLater(0, dhcp_flow_check_scenario, df)
3134 return df
3135
3136 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003137 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
3138 """
3139 Test Method:
3140 0. Make sure that voltha is up and running on CORD-POD setup.
3141 1. OLT and ONU is detected and validated.
3142 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3143 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3144 4. Verify that subscriber get ip from dhcp server successfully.
3145 5. Send dhcp renew packet to dhcp server which is running as onos app.
3146 6. Repeat step 4.
3147 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003148
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003149 df = defer.Deferred()
3150 def dhcp_flow_check_scenario(df):
3151 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003152 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003153 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3154 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003155 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003156 time.sleep(10)
3157 switch_map = None
3158 olt_configured = False
3159 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3160 log_test.info('Installing OLT app')
3161 OnosCtrl.install_app(self.olt_app_file)
3162 time.sleep(5)
3163 log_test.info('Adding subscribers through OLT app')
3164 self.config_olt(switch_map)
3165 olt_configured = True
3166 time.sleep(5)
3167 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
3168 try:
3169 assert_equal(dhcp_status, True)
3170 #assert_equal(status, True)
3171 time.sleep(10)
3172 finally:
3173 self.voltha.disable_device(device_id, delete = True)
3174 self.remove_olt(switch_map)
3175 df.callback(0)
3176
3177 reactor.callLater(0, dhcp_flow_check_scenario, df)
3178 return df
3179
3180 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003181 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
3182 """
3183 Test Method:
3184 0. Make sure that voltha is up and running on CORD-POD setup.
3185 1. OLT and ONU is detected and validated.
3186 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3187 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3188 4. Verify that subscriber get ip from dhcp server successfully.
3189 5. Send dhcp rebind packet to dhcp server which is running as onos app.
3190 6. Repeat step 4.
3191 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003192 df = defer.Deferred()
3193 def dhcp_flow_check_scenario(df):
3194 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003195 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003196 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3197 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003198 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003199 time.sleep(10)
3200 switch_map = None
3201 olt_configured = False
3202 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3203 log_test.info('Installing OLT app')
3204 OnosCtrl.install_app(self.olt_app_file)
3205 time.sleep(5)
3206 log_test.info('Adding subscribers through OLT app')
3207 self.config_olt(switch_map)
3208 olt_configured = True
3209 time.sleep(5)
3210 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
3211 try:
3212 assert_equal(dhcp_status, True)
3213 #assert_equal(status, True)
3214 time.sleep(10)
3215 finally:
3216 self.voltha.disable_device(device_id, delete = True)
3217 self.remove_olt(switch_map)
3218 df.callback(0)
3219
3220 reactor.callLater(0, dhcp_flow_check_scenario, df)
3221 return df
3222
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003223 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003224 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003225 """
3226 Test Method:
3227 0. Make sure that voltha is up and running on CORD-POD setup.
3228 1. OLT and ONU is detected and validated.
3229 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3230 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3231 4. Verify that subscriber get ip from dhcp server successfully.
3232 5. Disable olt devices which is being detected in voltha CLI.
3233 6. Repeat step 3.
3234 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3235 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003236 df = defer.Deferred()
3237 dhcp_app = 'org.onosproject.dhcp'
3238 def dhcp_flow_check_scenario(df):
3239 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003240 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003241 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3242 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003243 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003244 time.sleep(10)
3245 switch_map = None
3246 olt_configured = False
3247 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3248 log_test.info('Installing OLT app')
3249 OnosCtrl.install_app(self.olt_app_file)
3250 time.sleep(5)
3251 log_test.info('Adding subscribers through OLT app')
3252 self.config_olt(switch_map)
3253 olt_configured = True
3254 time.sleep(5)
3255 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3256 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3257 log_test.info('Disable the olt device in during client send discover to voltha')
3258 thread2.start()
3259# time.sleep(randint(0,1))
3260 thread1.start()
3261 time.sleep(10)
3262 thread1.join()
3263 thread2.join()
3264 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003265 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003266 #assert_equal(status, True)
3267 time.sleep(10)
3268 finally:
3269 self.voltha.disable_device(device_id, delete = True)
3270 self.remove_olt(switch_map)
3271 df.callback(0)
3272
3273 reactor.callLater(0, dhcp_flow_check_scenario, df)
3274 return df
3275
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003276 @deferred(TESTCASE_TIMEOUT)
3277 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
3278 """
3279 Test Method:
3280 0. Make sure that voltha is up and running on CORD-POD setup.
3281 1. OLT and ONU is detected and validated.
3282 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3283 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3284 4. Verify that subscriber get ip from dhcp server successfully.
3285 5. Disable olt devices which is being detected in voltha CLI.
3286 6. Repeat step 3.
3287 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3288 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
3289 """
3290 df = defer.Deferred()
3291 no_iterations = 10
3292 dhcp_app = 'org.onosproject.dhcp'
3293 def dhcp_flow_check_scenario(df):
3294 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003295 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003296 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3297 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003298 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003299 time.sleep(10)
3300 switch_map = None
3301 olt_configured = False
3302 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3303 log_test.info('Installing OLT app')
3304 OnosCtrl.install_app(self.olt_app_file)
3305 time.sleep(5)
3306 log_test.info('Adding subscribers through OLT app')
3307 self.config_olt(switch_map)
3308 olt_configured = True
3309 time.sleep(5)
3310 for i in range(no_iterations):
3311 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3312 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3313 log_test.info('Disable the olt device in during client send discover to voltha')
3314 thread2.start()
3315# time.sleep(randint(0,1))
3316 thread1.start()
3317 time.sleep(10)
3318 thread1.join()
3319 thread2.join()
3320 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3321 try:
3322 assert_equal(self.success, True)
3323 assert_equal(dhcp_status, True)
3324 #assert_equal(status, True)
3325 time.sleep(10)
3326 finally:
3327 self.voltha.disable_device(device_id, delete = True)
3328 self.remove_olt(switch_map)
3329 df.callback(0)
3330
3331 reactor.callLater(0, dhcp_flow_check_scenario, df)
3332 return df
3333
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003334 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003335 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003336 """
3337 Test Method:
3338 0. Make sure that voltha is up and running on CORD-POD setup.
3339 1. OLT and ONU is detected and validated.
3340 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3341 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3342 4. Verify that subscriber get ip from dhcp server successfully.
3343 5. Disable olt devices which is being detected in voltha CLI.
3344 6. Repeat step 3.
3345 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3346 8. Enable olt devices which is being detected in voltha CLI.
3347 9. Repeat steps 3 and 4.
3348 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003349 df = defer.Deferred()
3350 dhcp_app = 'org.onosproject.dhcp'
3351 def dhcp_flow_check_scenario(df):
3352 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003353 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003354 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3355 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003356 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003357 time.sleep(10)
3358 switch_map = None
3359 olt_configured = False
3360 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3361 log_test.info('Installing OLT app')
3362 OnosCtrl.install_app(self.olt_app_file)
3363 time.sleep(5)
3364 log_test.info('Adding subscribers through OLT app')
3365 self.config_olt(switch_map)
3366 olt_configured = True
3367 time.sleep(5)
3368 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3369 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3370 thread2.start()
3371 thread1.start()
3372 time.sleep(10)
3373 thread1.join()
3374 thread2.join()
3375 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003376 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003377 #assert_equal(status, True)
3378 time.sleep(10)
3379 finally:
3380 self.voltha.disable_device(device_id, delete = True)
3381 self.remove_olt(switch_map)
3382 df.callback(0)
3383
3384 reactor.callLater(0, dhcp_flow_check_scenario, df)
3385 return df
3386
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003387 @deferred(TESTCASE_TIMEOUT)
3388 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
3389 """
3390 Test Method:
3391 0. Make sure that voltha is up and running on CORD-POD setup.
3392 1. OLT and ONU is detected and validated.
3393 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3394 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3395 4. Verify that subscriber get ip from dhcp server successfully.
3396 5. Disable olt devices which is being detected in voltha CLI.
3397 6. Repeat step 3.
3398 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3399 8. Enable olt devices which is being detected in voltha CLI.
3400 9. Repeat steps 3 and 4.
3401 """
3402
3403 df = defer.Deferred()
3404 no_iterations = 10
3405 dhcp_app = 'org.onosproject.dhcp'
3406 def dhcp_flow_check_scenario(df):
3407 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003408 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003409 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3410 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003411 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003412 time.sleep(10)
3413 switch_map = None
3414 olt_configured = False
3415 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3416 log_test.info('Installing OLT app')
3417 OnosCtrl.install_app(self.olt_app_file)
3418 time.sleep(5)
3419 log_test.info('Adding subscribers through OLT app')
3420 self.config_olt(switch_map)
3421 olt_configured = True
3422 time.sleep(5)
3423 for i in range(no_iterations):
3424 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3425 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3426 thread2.start()
3427 thread1.start()
3428 time.sleep(10)
3429 thread1.join()
3430 thread2.join()
3431 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3432 try:
3433 assert_equal(dhcp_status, True)
3434 #assert_equal(status, True)
3435 assert_equal(self.success, True)
3436 time.sleep(10)
3437 finally:
3438 self.voltha.disable_device(device_id, delete = True)
3439 self.remove_olt(switch_map)
3440 df.callback(0)
3441
3442 reactor.callLater(0, dhcp_flow_check_scenario, df)
3443 return df
3444
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003445 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003446 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003447 """
3448 Test Method:
3449 0. Make sure that voltha is up and running on CORD-POD setup.
3450 1. OLT and ONU is detected and validated.
3451 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3452 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3453 4. Verify that subscriber get ip from dhcp server successfully.
3454 5. Disable onu port which is being detected in voltha CLI.
3455 6. Repeat step 3.
3456 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3457 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003458 df = defer.Deferred()
3459 dhcp_app = 'org.onosproject.dhcp'
3460 def dhcp_flow_check_scenario(df):
3461 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003462 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003463 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3464 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003465 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003466 time.sleep(10)
3467 switch_map = None
3468 olt_configured = False
3469 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3470 log_test.info('Installing OLT app')
3471 OnosCtrl.install_app(self.olt_app_file)
3472 time.sleep(5)
3473 log_test.info('Adding subscribers through OLT app')
3474 self.config_olt(switch_map)
3475 olt_configured = True
3476 time.sleep(5)
3477 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 +00003478 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003479 thread1.start()
3480 thread2.start()
3481 time.sleep(10)
3482 thread1.join()
3483 thread2.join()
3484 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003485 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003486 #assert_equal(status, True)
3487 time.sleep(10)
3488 finally:
3489 self.voltha.disable_device(device_id, delete = True)
3490 self.remove_olt(switch_map)
3491 df.callback(0)
3492
3493 reactor.callLater(0, dhcp_flow_check_scenario, df)
3494 return df
3495
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003496 @deferred(TESTCASE_TIMEOUT)
3497 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
3498 """
3499 Test Method:
3500 0. Make sure that voltha is up and running on CORD-POD setup.
3501 1. OLT and ONU is detected and validated.
3502 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3503 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3504 4. Verify that subscriber get ip from dhcp server successfully.
3505 5. Disable onu port which is being detected in voltha CLI.
3506 6. Repeat step 3.
3507 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3508 """
3509 df = defer.Deferred()
3510 no_iterations = 10
3511 dhcp_app = 'org.onosproject.dhcp'
3512 def dhcp_flow_check_scenario(df):
3513 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003514 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003515 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3516 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003517 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003518 time.sleep(10)
3519 switch_map = None
3520 olt_configured = False
3521 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3522 log_test.info('Installing OLT app')
3523 OnosCtrl.install_app(self.olt_app_file)
3524 time.sleep(5)
3525 log_test.info('Adding subscribers through OLT app')
3526 self.config_olt(switch_map)
3527 olt_configured = True
3528 time.sleep(5)
3529 for i in range(no_iterations):
3530 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 +00003531 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003532 thread1.start()
3533 thread2.start()
3534 time.sleep(10)
3535 thread1.join()
3536 thread2.join()
3537 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3538 try:
3539 #assert_equal(status, True)
3540 assert_equal(dhcp_status, True)
3541 assert_equal(self.success, True)
3542 time.sleep(10)
3543 finally:
3544 self.voltha.disable_device(device_id, delete = True)
3545 self.remove_olt(switch_map)
3546 df.callback(0)
3547
3548 reactor.callLater(0, dhcp_flow_check_scenario, df)
3549 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003550
3551 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003552 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003553 """
3554 Test Method:
3555 0. Make sure that voltha is up and running on CORD-POD setup.
3556 1. OLT and ONU is detected and validated.
3557 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3558 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3559 4. Verify that subscriber get ip from dhcp server successfully.
3560 5. Disable onu port which is being detected in voltha CLI.
3561 6. Repeat step 3.
3562 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3563 8. Enable onu port which is being detected in voltha CLI.
3564 9. Repeat steps 3 and 4.
3565 """
3566
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003567 df = defer.Deferred()
3568 dhcp_app = 'org.onosproject.dhcp'
3569 def dhcp_flow_check_scenario(df):
3570 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003571 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003572 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3573 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003574 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003575 time.sleep(10)
3576 switch_map = None
3577 olt_configured = False
3578 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3579 log_test.info('Installing OLT app')
3580 OnosCtrl.install_app(self.olt_app_file)
3581 time.sleep(5)
3582 log_test.info('Adding subscribers through OLT app')
3583 self.config_olt(switch_map)
3584 olt_configured = True
3585 time.sleep(5)
3586 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 +00003587 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003588 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3589 thread2.start()
3590 time.sleep(randint(0,1))
3591 thread1.start()
3592 time.sleep(10)
3593 thread1.join()
3594 thread2.join()
3595 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3596 assert_equal(dhcp_status, True)
3597 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003598 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003599 #assert_equal(status, True)
3600 time.sleep(10)
3601 finally:
3602 self.voltha.disable_device(device_id, delete = True)
3603 self.remove_olt(switch_map)
3604 df.callback(0)
3605
3606 reactor.callLater(0, dhcp_flow_check_scenario, df)
3607 return df
3608
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003609 @deferred(TESTCASE_TIMEOUT)
3610 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
3611 """
3612 Test Method:
3613 0. Make sure that voltha is up and running on CORD-POD setup.
3614 1. OLT and ONU is detected and validated.
3615 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3616 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3617 4. Verify that subscriber get ip from dhcp server successfully.
3618 5. Disable onu port which is being detected in voltha CLI.
3619 6. Repeat step 3.
3620 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3621 8. Enable onu port which is being detected in voltha CLI.
3622 9. Repeat steps 3 and 4.
3623 """
3624
3625 df = defer.Deferred()
3626 no_iterations = 10
3627 dhcp_app = 'org.onosproject.dhcp'
3628 def dhcp_flow_check_scenario(df):
3629 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003630 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003631 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3632 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003633 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003634 time.sleep(10)
3635 switch_map = None
3636 olt_configured = False
3637 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3638 log_test.info('Installing OLT app')
3639 OnosCtrl.install_app(self.olt_app_file)
3640 time.sleep(5)
3641 log_test.info('Adding subscribers through OLT app')
3642 self.config_olt(switch_map)
3643 olt_configured = True
3644 time.sleep(5)
3645 for i in range(no_iterations):
3646 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 +00003647 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003648 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3649 thread2.start()
3650 time.sleep(randint(0,1))
3651 thread1.start()
3652 time.sleep(10)
3653 thread1.join()
3654 thread2.join()
3655 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3656 assert_equal(dhcp_status, True)
3657 try:
3658 assert_equal(self.success, True)
3659 #assert_equal(status, True)
3660 time.sleep(10)
3661 finally:
3662 self.voltha.disable_device(device_id, delete = True)
3663 self.remove_olt(switch_map)
3664 df.callback(0)
3665
3666 reactor.callLater(0, dhcp_flow_check_scenario, df)
3667 return df
3668
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003669 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003670 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003671 """
3672 Test Method:
3673 0. Make sure that voltha is up and running on CORD-POD setup.
3674 1. OLT and ONU is detected and validated.
3675 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3676 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3677 4. Verify that subscribers had got different ips from dhcp server successfully.
3678 """
3679
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003680 df = defer.Deferred()
3681 self.success = True
3682 dhcp_app = 'org.onosproject.dhcp'
3683 def dhcp_flow_check_scenario(df):
3684 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003685 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003686 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3687 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003688 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003689 time.sleep(10)
3690 switch_map = None
3691 olt_configured = False
3692 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3693 log_test.info('Installing OLT app')
3694 OnosCtrl.install_app(self.olt_app_file)
3695 time.sleep(5)
3696 log_test.info('Adding subscribers through OLT app')
3697 self.config_olt(switch_map)
3698 olt_configured = True
3699 time.sleep(5)
3700 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3701 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3702 thread1.start()
3703 thread2.start()
3704 time.sleep(10)
3705 thread1.join()
3706 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003707 dhcp_flow_status = self.success
3708 try:
3709# if self.success is not True:
3710 assert_equal(dhcp_flow_status, True)
3711 #assert_equal(status, True)
3712 time.sleep(10)
3713 finally:
3714 self.voltha.disable_device(device_id, delete = True)
3715 self.remove_olt(switch_map)
3716 df.callback(0)
3717
3718 reactor.callLater(0, dhcp_flow_check_scenario, df)
3719 return df
3720
3721 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003722 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003723 """
3724 Test Method:
3725 0. Make sure that voltha is up and running on CORD-POD setup.
3726 1. OLT and ONU is detected and validated.
3727 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3728 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3729 4. Verify that subscribers had got ip from dhcp server successfully.
3730 5. Repeat step 3 and 4 for 10 times for both subscribers.
3731 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
3732 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003733
3734
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003735 df = defer.Deferred()
3736 self.success = True
3737 dhcp_app = 'org.onosproject.dhcp'
3738 def dhcp_flow_check_scenario(df):
3739 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003740 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003741 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3742 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003743 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003744 time.sleep(10)
3745 switch_map = None
3746 olt_configured = False
3747 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3748 log_test.info('Installing OLT app')
3749 OnosCtrl.install_app(self.olt_app_file)
3750 time.sleep(5)
3751 log_test.info('Adding subscribers through OLT app')
3752 self.config_olt(switch_map)
3753 olt_configured = True
3754 time.sleep(5)
3755 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3756 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
3757 thread1.start()
3758 thread2.start()
3759 time.sleep(10)
3760 thread1.join()
3761 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003762 dhcp_flow_status = self.success
3763 try:
3764# if self.success is not True:
3765 assert_equal(dhcp_flow_status, True)
3766 #assert_equal(status, True)
3767 time.sleep(10)
3768 finally:
3769 self.voltha.disable_device(device_id, delete = True)
3770 self.remove_olt(switch_map)
3771 df.callback(0)
3772
3773 reactor.callLater(0, dhcp_flow_check_scenario, df)
3774 return df
3775
3776 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003777 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003778 """
3779 Test Method:
3780 0. Make sure that voltha is up and running on CORD-POD setup.
3781 1. OLT and ONU is detected and validated.
3782 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3783 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3784 4. Verify that subscribers had got ip from dhcp server successfully.
3785 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3786 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
3787 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003788
3789 df = defer.Deferred()
3790 self.success = True
3791 dhcp_app = 'org.onosproject.dhcp'
3792 def dhcp_flow_check_scenario(df):
3793 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003794 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003795 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3796 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003797 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003798 time.sleep(10)
3799 switch_map = None
3800 olt_configured = False
3801 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3802 log_test.info('Installing OLT app')
3803 OnosCtrl.install_app(self.olt_app_file)
3804 time.sleep(5)
3805 log_test.info('Adding subscribers through OLT app')
3806 self.config_olt(switch_map)
3807 olt_configured = True
3808 time.sleep(5)
3809 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3810 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3811 thread1.start()
3812 thread2.start()
3813 time.sleep(10)
3814 thread1.join()
3815 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003816 dhcp_flow_status = self.success
3817 try:
3818# if self.success is not True:
3819 assert_equal(dhcp_flow_status, True)
3820 #assert_equal(status, True)
3821 time.sleep(10)
3822 finally:
3823 self.voltha.disable_device(device_id, delete = True)
3824 self.remove_olt(switch_map)
3825 df.callback(0)
3826
3827 reactor.callLater(0, dhcp_flow_check_scenario, df)
3828 return df
3829
3830 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003831 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 +00003832 """
3833 Test Method:
3834 0. Make sure that voltha is up and running on CORD-POD setup.
3835 1. OLT and ONU is detected and validated.
3836 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3837 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
3838 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
3839 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
3840 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003841
3842 df = defer.Deferred()
3843 self.success = True
3844 dhcp_app = 'org.onosproject.dhcp'
3845 def dhcp_flow_check_scenario(df):
3846 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003847 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003848 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3849 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003850 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003851 time.sleep(10)
3852 switch_map = None
3853 olt_configured = False
3854 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3855 log_test.info('Installing OLT app')
3856 OnosCtrl.install_app(self.olt_app_file)
3857 time.sleep(5)
3858 log_test.info('Adding subscribers through OLT app')
3859 self.config_olt(switch_map)
3860 olt_configured = True
3861 time.sleep(5)
3862 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3863 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
3864 thread1.start()
3865 thread2.start()
3866 time.sleep(10)
3867 thread1.join()
3868 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003869 dhcp_flow_status = self.success
3870 try:
3871# if self.success is not True:
3872 assert_equal(dhcp_flow_status, True)
3873 #assert_equal(status, True)
3874 time.sleep(10)
3875 finally:
3876 self.voltha.disable_device(device_id, delete = True)
3877 self.remove_olt(switch_map)
3878 df.callback(0)
3879
3880 reactor.callLater(0, dhcp_flow_check_scenario, df)
3881 return df
3882
3883 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003884 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 +00003885 """
3886 Test Method:
3887 0. Make sure that voltha is up and running on CORD-POD setup.
3888 1. OLT and ONU is detected and validated.
3889 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3890 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
3891 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
3892 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
3893 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003894 df = defer.Deferred()
3895 self.success = True
3896 dhcp_app = 'org.onosproject.dhcp'
3897 def dhcp_flow_check_scenario(df):
3898 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003899 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003900 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3901 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003902 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003903 time.sleep(10)
3904 switch_map = None
3905 olt_configured = False
3906 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3907 log_test.info('Installing OLT app')
3908 OnosCtrl.install_app(self.olt_app_file)
3909 time.sleep(5)
3910 log_test.info('Adding subscribers through OLT app')
3911 self.config_olt(switch_map)
3912 olt_configured = True
3913 time.sleep(5)
3914 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3915 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3916 thread1.start()
3917 thread2.start()
3918 time.sleep(10)
3919 thread1.join()
3920 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003921 dhcp_flow_status = self.success
3922 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003923 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003924 time.sleep(10)
3925 finally:
3926 self.voltha.disable_device(device_id, delete = True)
3927 self.remove_olt(switch_map)
3928 df.callback(0)
3929
3930 reactor.callLater(0, dhcp_flow_check_scenario, df)
3931 return df
3932
3933 @deferred(TESTCASE_TIMEOUT)
3934 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003935 """
3936 Test Method:
3937 0. Make sure that voltha is up and running on CORD-POD setup.
3938 1. OLT and ONU is detected and validated.
3939 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3940 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3941 4. Verify that subscribers had got ip from dhcp server successfully.
3942 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3943 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3944 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3945 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003946 df = defer.Deferred()
3947 self.success = True
3948 dhcp_app = 'org.onosproject.dhcp'
3949 def dhcp_flow_check_scenario(df):
3950 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003951 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003952 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3953 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003954 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003955 time.sleep(10)
3956 switch_map = None
3957 olt_configured = False
3958 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3959 log_test.info('Installing OLT app')
3960 OnosCtrl.install_app(self.olt_app_file)
3961 time.sleep(5)
3962 log_test.info('Adding subscribers through OLT app')
3963 self.config_olt(switch_map)
3964 olt_configured = True
3965 time.sleep(5)
3966 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3967 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3968 thread1.start()
3969 thread2.start()
3970 time.sleep(10)
3971 thread1.join()
3972 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003973 dhcp_flow_status = self.success
3974 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003975 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003976 time.sleep(10)
3977 finally:
3978 self.voltha.disable_device(device_id, delete = True)
3979 self.remove_olt(switch_map)
3980 df.callback(0)
3981
3982 reactor.callLater(0, dhcp_flow_check_scenario, df)
3983 return df
3984
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003985 @deferred(TESTCASE_TIMEOUT)
3986 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003987 """
3988 Test Method:
3989 0. Make sure that voltha is up and running on CORD-POD setup.
3990 1. OLT and ONU is detected and validated.
3991 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3992 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3993 4. Verify that subscribers had got ip from dhcp server successfully.
3994 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3995 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3996 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3997 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
3998 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
3999 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
4000 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004001 df = defer.Deferred()
4002 self.success = True
4003 dhcp_app = 'org.onosproject.dhcp'
4004 def dhcp_flow_check_scenario(df):
4005 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004006 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004007 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4008 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004009 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004010 time.sleep(10)
4011 switch_map = None
4012 olt_configured = False
4013 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4014 log_test.info('Installing OLT app')
4015 OnosCtrl.install_app(self.olt_app_file)
4016 time.sleep(5)
4017 log_test.info('Adding subscribers through OLT app')
4018 self.config_olt(switch_map)
4019 olt_configured = True
4020 time.sleep(5)
4021 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4022 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 +00004023 thread3 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.INTF_2_RX_DEFAULT,))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004024 thread1.start()
4025 thread2.start()
4026 thread3.start()
4027 time.sleep(10)
4028 thread1.join()
4029 thread2.join()
4030 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004031 dhcp_flow_status = self.success
4032 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004033 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004034 time.sleep(10)
4035 finally:
4036 self.voltha.disable_device(device_id, delete = True)
4037 self.remove_olt(switch_map)
4038 df.callback(0)
4039
4040 reactor.callLater(0, dhcp_flow_check_scenario, df)
4041 return df
4042
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004043 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004044 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004045 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004046 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00004047 0. Make sure that voltha is up and running on CORD-POD setup.
4048 1. OLT and ONU is detected and validated.
4049 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4050 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4051 4. Verify that subscribers had got ip from dhcp server successfully.
4052 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4053 6. Disable the olt device which is detected in voltha.
4054 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4055 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004056 df = defer.Deferred()
4057 self.success = True
4058 dhcp_app = 'org.onosproject.dhcp'
4059 def dhcp_flow_check_scenario(df):
4060 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004061 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004062 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4063 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004064 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004065 time.sleep(10)
4066 switch_map = None
4067 olt_configured = False
4068 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4069 log_test.info('Installing OLT app')
4070 OnosCtrl.install_app(self.olt_app_file)
4071 time.sleep(5)
4072 log_test.info('Adding subscribers through OLT app')
4073 self.config_olt(switch_map)
4074 olt_configured = True
4075 time.sleep(5)
4076 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4077 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4078 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
4079
4080 thread1.start()
4081 thread2.start()
4082 thread3.start()
4083 time.sleep(10)
4084 thread1.join()
4085 thread2.join()
4086 thread3.join()
4087 dhcp_flow_status = self.success
4088 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004089 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004090 time.sleep(10)
4091 finally:
4092 self.voltha.disable_device(device_id, delete = True)
4093 self.remove_olt(switch_map)
4094 df.callback(0)
4095
4096 reactor.callLater(0, dhcp_flow_check_scenario, df)
4097 return df
4098
4099 @deferred(TESTCASE_TIMEOUT)
4100 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004101 """
4102 Test Method:
4103 0. Make sure that voltha is up and running on CORD-POD setup.
4104 1. OLT and ONU is detected and validated.
4105 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4106 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4107 4. Verify that subscribers had got ip from dhcp server successfully.
4108 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4109 6. Disable the olt device which is detected in voltha.
4110 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4111 8. Enable the olt device which is detected in voltha.
4112 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 +00004113
Thangavelu K S057b7d22017-05-16 22:03:22 +00004114 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004115 df = defer.Deferred()
4116 self.success = True
4117 dhcp_app = 'org.onosproject.dhcp'
4118 def dhcp_flow_check_scenario(df):
4119 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004120 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004121 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4122 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004123 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004124 time.sleep(10)
4125 switch_map = None
4126 olt_configured = False
4127 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4128 log_test.info('Installing OLT app')
4129 OnosCtrl.install_app(self.olt_app_file)
4130 time.sleep(5)
4131 log_test.info('Adding subscribers through OLT app')
4132 self.config_olt(switch_map)
4133 olt_configured = True
4134 time.sleep(5)
4135 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4136 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4137 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
4138 thread1.start()
4139 thread2.start()
4140 thread3.start()
4141 time.sleep(10)
4142 thread1.join()
4143 thread2.join()
4144 thread3.join()
4145 dhcp_flow_status = self.success
4146 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004147 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004148 time.sleep(10)
4149 finally:
4150 self.voltha.disable_device(device_id, delete = True)
4151 self.remove_olt(switch_map)
4152 df.callback(0)
4153
4154 reactor.callLater(0, dhcp_flow_check_scenario, df)
4155 return df
4156
4157 @deferred(TESTCASE_TIMEOUT)
4158 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004159 """
4160 Test Method:
4161 0. Make sure that voltha is up and running on CORD-POD setup.
4162 1. OLT and ONU is detected and validated.
4163 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4164 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4165 4. Verify that subscribers had got ip from dhcp server successfully.
4166 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4167 6. Pause the olt device which is detected in voltha.
4168 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4169 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004170 df = defer.Deferred()
4171 self.success = True
4172 dhcp_app = 'org.onosproject.dhcp'
4173 def dhcp_flow_check_scenario(df):
4174 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004175 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004176 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4177 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004178 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004179 time.sleep(10)
4180 switch_map = None
4181 olt_configured = False
4182 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4183 log_test.info('Installing OLT app')
4184 OnosCtrl.install_app(self.olt_app_file)
4185 time.sleep(5)
4186 log_test.info('Adding subscribers through OLT app')
4187 self.config_olt(switch_map)
4188 olt_configured = True
4189 time.sleep(5)
4190 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4191 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4192 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
4193 thread1.start()
4194 thread2.start()
4195 thread3.start()
4196 time.sleep(10)
4197 thread1.join()
4198 thread2.join()
4199 thread3.join()
4200 dhcp_flow_status = self.success
4201 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004202 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004203 time.sleep(10)
4204 finally:
4205 self.voltha.disable_device(device_id, delete = True)
4206 self.remove_olt(switch_map)
4207 df.callback(0)
4208
4209 reactor.callLater(0, dhcp_flow_check_scenario, df)
4210 return df
4211
Thangavelu K S36edb012017-07-05 18:24:12 +00004212 def test_3_subscribers_with_voltha_for_dhcp_discover_requests(self):
4213 """
4214 Test Method:
4215 0. Make sure that voltha is up and running on CORD-POD setup.
4216 1. OLT and ONU is detected and validated.
4217 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4218 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4219 4. Verify that subscriber get ip from dhcp server successfully.
4220 """
4221 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4222 num_subscribers = 3
4223 num_channels = 1
4224 services = ('DHCP')
4225 cbs = (self.dhcp_flow_check, None, None)
4226 self.voltha_subscribers(services, cbs = cbs,
4227 num_subscribers = num_subscribers,
4228 num_channels = num_channels)
4229
4230 def test_5_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 (5 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 = 5
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_9_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 (9 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 9 subscribers browsing 1 channels each"""
4258 num_subscribers = 9
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_3_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
4267 """
4268 Test Method:
4269 0. Make sure that voltha is up and running on CORD-POD setup.
4270 1. OLT and ONU is detected and validated.
4271 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4272 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4273 4. Verify that subscriber get ip from dhcp server successfully.
4274 """
4275 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4276 num_subscribers = 3
4277 num_channels = 1
4278 services = ('TLS','DHCP')
4279 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4280 self.voltha_subscribers(services, cbs = cbs,
4281 num_subscribers = num_subscribers,
4282 num_channels = num_channels)
4283
4284 def test_5_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 (5 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 = 5
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_9_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 (9 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 = 9
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)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004319
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004320# @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004321 def test_subscriber_with_voltha_for_dhcprelay_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004322 """
4323 Test Method:
4324 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4325 1. OLT and ONU is detected and validated.
4326 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4327 3. Send dhcp request from residential subscrber to external dhcp server.
4328 4. Verify that subscriber get ip from external dhcp server successfully.
4329 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004330 self.voltha_dhcprelay_setUpClass()
Thangavelu K S6432b522017-07-22 00:05:54 +00004331# if not port_list:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004332# port_list = self.generate_port_list(1, 0)
4333 iface = self.port_map[self.port_list[0][1]]
Thangavelu K S6432b522017-07-22 00:05:54 +00004334 mac = self.get_mac(iface)
4335 self.host_load(iface)
4336 ##we use the defaults for this test that serves as an example for others
4337 ##You don't need to restart dhcpd server if retaining default config
4338 config = self.default_config
4339 options = self.default_options
4340 subnet = self.default_subnet_config
4341 dhcpd_interface_list = self.relay_interfaces
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004342 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004343 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004344 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4345 assert_not_equal(device_id, None)
4346 voltha = VolthaCtrl(**self.voltha_attrs)
4347 time.sleep(10)
4348 switch_map = None
4349 olt_configured = False
4350 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4351 log_test.info('Installing OLT app')
4352 OnosCtrl.install_app(self.olt_app_file)
4353 time.sleep(5)
4354 log_test.info('Adding subscribers through OLT app')
4355 self.config_olt(switch_map)
4356 olt_configured = True
4357 time.sleep(5)
Thangavelu K S6432b522017-07-22 00:05:54 +00004358 self.dhcpd_start(intf_list = dhcpd_interface_list,
4359 config = config,
4360 options = options,
4361 subnet = subnet)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004362 try:
4363 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4364 self.send_recv(mac=mac)
4365 finally:
4366 self.voltha.disable_device(device_id, delete = True)
4367 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004368
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004369 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004370 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004371 """
4372 Test Method:
4373 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4374 1. OLT and ONU is detected and validated.
4375 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4376 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
4377 4. Verify that subscriber should not get ip from external dhcp server.
4378 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004379 self.voltha_dhcprelay_setUpClass()
4380# if not port_list:
4381# port_list = self.generate_port_list(1, 0)
4382 iface = self.port_map[self.port_list[0][1]]
4383 mac = self.get_mac(iface)
4384 self.host_load(iface)
4385 ##we use the defaults for this test that serves as an example for others
4386 ##You don't need to restart dhcpd server if retaining default config
4387 config = self.default_config
4388 options = self.default_options
4389 subnet = self.default_subnet_config
4390 dhcpd_interface_list = self.relay_interfaces
4391 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004392 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004393 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4394 assert_not_equal(device_id, None)
4395 voltha = VolthaCtrl(**self.voltha_attrs)
4396 time.sleep(10)
4397 switch_map = None
4398 olt_configured = False
4399 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4400 log_test.info('Installing OLT app')
4401 OnosCtrl.install_app(self.olt_app_file)
4402 time.sleep(5)
4403 log_test.info('Adding subscribers through OLT app')
4404 self.config_olt(switch_map)
4405 olt_configured = True
4406 time.sleep(5)
4407 self.dhcpd_start(intf_list = dhcpd_interface_list,
4408 config = config,
4409 options = options,
4410 subnet = subnet)
4411 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4412 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
4413 try:
4414 assert_equal(cip,None)
4415 log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
4416 finally:
4417 self.voltha.disable_device(device_id, delete = True)
4418 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004419
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004420# @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004421 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004422 """
4423 Test Method:
4424 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4425 1. OLT and ONU is detected and validated.
4426 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4427 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
4428 4. Verify that subscriber should not get ip from external dhcp server.
4429 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004430 self.voltha_dhcprelay_setUpClass()
4431# if not port_list:
4432# port_list = self.generate_port_list(1, 0)
4433 iface = self.port_map[self.port_list[0][1]]
4434 mac = self.get_mac(iface)
4435 self.host_load(iface)
4436 ##we use the defaults for this test that serves as an example for others
4437 ##You don't need to restart dhcpd server if retaining default config
4438 config = self.default_config
4439 options = self.default_options
4440 subnet = self.default_subnet_config
4441 dhcpd_interface_list = self.relay_interfaces
4442 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004443 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004444 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4445 assert_not_equal(device_id, None)
4446 voltha = VolthaCtrl(**self.voltha_attrs)
4447 time.sleep(10)
4448 switch_map = None
4449 olt_configured = False
4450 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4451 log_test.info('Installing OLT app')
4452 OnosCtrl.install_app(self.olt_app_file)
4453 time.sleep(5)
4454 log_test.info('Adding subscribers through OLT app')
4455 self.config_olt(switch_map)
4456 olt_configured = True
4457 time.sleep(5)
4458 self.dhcpd_start(intf_list = dhcpd_interface_list,
4459 config = config,
4460 options = options,
4461 subnet = subnet)
4462 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4463 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:01:98:05')
4464 try:
4465 assert_equal(cip,None)
4466 log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
4467 finally:
4468 self.voltha.disable_device(device_id, delete = True)
4469 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004470
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004471 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004472 """
4473 Test Method:
4474 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4475 1. OLT and ONU is detected and validated.
4476 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4477 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
4478 4. Verify that subscriber should not get ip from external dhcp server.
4479 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004480 self.voltha_dhcprelay_setUpClass()
4481# if not port_list:
4482# port_list = self.generate_port_list(1, 0)
4483 iface = self.port_map[self.port_list[0][1]]
4484 mac = self.get_mac(iface)
4485 self.host_load(iface)
4486 ##we use the defaults for this test that serves as an example for others
4487 ##You don't need to restart dhcpd server if retaining default config
4488 config = self.default_config
4489 options = self.default_options
4490 subnet = self.default_subnet_config
4491 dhcpd_interface_list = self.relay_interfaces
4492 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004493 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004494 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4495 assert_not_equal(device_id, None)
4496 voltha = VolthaCtrl(**self.voltha_attrs)
4497 time.sleep(10)
4498 switch_map = None
4499 olt_configured = False
4500 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4501 log_test.info('Installing OLT app')
4502 OnosCtrl.install_app(self.olt_app_file)
4503 time.sleep(5)
4504 log_test.info('Adding subscribers through OLT app')
4505 self.config_olt(switch_map)
4506 olt_configured = True
4507 time.sleep(5)
4508 self.dhcpd_start(intf_list = dhcpd_interface_list,
4509 config = config,
4510 options = options,
4511 subnet = subnet)
4512 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4513 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
4514 try:
4515 assert_equal(cip,None)
4516 log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
4517 finally:
4518 self.voltha.disable_device(device_id, delete = True)
4519 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004520
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004521 def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004522 """
4523 Test Method:
4524 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4525 1. OLT and ONU is detected and validated.
4526 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4527 3. Send dhcp request from residential subscrber to external dhcp server.
4528 4. Verify that subscriber get ip from external dhcp server successfully.
4529 5. Send dhcp release from residential subscrber to external dhcp server.
4530 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
4531 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004532 self.voltha_dhcprelay_setUpClass()
4533# if not port_list:
4534# port_list = self.generate_port_list(1, 0)
4535 iface = self.port_map[self.port_list[0][1]]
4536 mac = self.get_mac(iface)
4537 self.host_load(iface)
4538 ##we use the defaults for this test that serves as an example for others
4539 ##You don't need to restart dhcpd server if retaining default config
4540 config = self.default_config
4541 options = self.default_options
4542 subnet = self.default_subnet_config
4543 dhcpd_interface_list = self.relay_interfaces
4544 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004545 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004546 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4547 assert_not_equal(device_id, None)
4548 voltha = VolthaCtrl(**self.voltha_attrs)
4549 time.sleep(10)
4550 switch_map = None
4551 olt_configured = False
4552 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4553 log_test.info('Installing OLT app')
4554 OnosCtrl.install_app(self.olt_app_file)
4555 time.sleep(5)
4556 log_test.info('Adding subscribers through OLT app')
4557 self.config_olt(switch_map)
4558 olt_configured = True
4559 time.sleep(5)
4560 self.dhcpd_start(intf_list = dhcpd_interface_list,
4561 config = config,
4562 options = options,
4563 subnet = subnet)
4564 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = iface)
4565 cip, sip = self.send_recv(mac=mac)
4566 log_test.info('Releasing ip %s to server %s' %(cip, sip))
4567 try:
4568 assert_equal(self.dhcp.release(cip), True)
4569 log_test.info('Triggering DHCP discover again after release')
4570 cip2, sip2 = self.send_recv(mac=mac)
4571 log_test.info('Verifying released IP was given back on rediscover')
4572 assert_equal(cip, cip2)
4573 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
4574 assert_equal(self.dhcp.release(cip2), True)
4575 finally:
4576 self.voltha.disable_device(device_id, delete = True)
4577 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004578
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004579 def test_subscriber_with_voltha_for_dhcprelay_starvation(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004580 """
4581 Test Method:
4582 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4583 1. OLT and ONU is detected and validated.
4584 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4585 3. Send dhcp request from residential subscriber to external dhcp server.
4586 4. Verify that subscriber get ip from external dhcp server. successfully.
4587 5. Repeat step 3 and 4 for 10 times.
4588 6 Verify that subscriber should get ip from external dhcp server..
4589 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004590 self.voltha_dhcprelay_setUpClass()
4591# if not port_list:
4592# port_list = self.generate_port_list(1, 0)
4593 iface = self.port_map[self.port_list[0][1]]
4594 mac = self.get_mac(iface)
4595 self.host_load(iface)
4596 ##we use the defaults for this test that serves as an example for others
4597 ##You don't need to restart dhcpd server if retaining default config
4598 config = self.default_config
4599 options = self.default_options
4600 subnet = self.default_subnet_config
4601 dhcpd_interface_list = self.relay_interfaces
4602 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004603 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004604 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4605 assert_not_equal(device_id, None)
4606 voltha = VolthaCtrl(**self.voltha_attrs)
4607 time.sleep(10)
4608 switch_map = None
4609 olt_configured = False
4610 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4611 log_test.info('Installing OLT app')
4612 OnosCtrl.install_app(self.olt_app_file)
4613 time.sleep(5)
4614 log_test.info('Adding subscribers through OLT app')
4615 self.config_olt(switch_map)
4616 olt_configured = True
4617 time.sleep(5)
4618 self.dhcpd_start(intf_list = dhcpd_interface_list,
4619 config = config,
4620 options = options,
4621 subnet = subnet)
4622 #self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = iface)
4623 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4624 log_test.info('Verifying 1 ')
4625 count = 0
4626 while True:
4627 #mac = RandMAC()._fix()
4628 cip, sip = self.send_recv(mac=mac,update_seed = True,validate = False)
4629 if cip is None:
4630 break
4631 else:
4632 count += 1
4633 assert_equal(count,91)
4634 log_test.info('Verifying 2 ')
4635 cip, sip = self.send_recv(mac=mac, update_seed = True, validate = False)
4636 try:
4637 assert_equal(cip, None)
4638 assert_equal(sip, None)
4639 finally:
4640 self.voltha.disable_device(device_id, delete = True)
4641 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004642
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004643 def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004644 """
4645 Test Method:
4646 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4647 1. OLT and ONU is detected and validated.
4648 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4649 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
4650 4. Verify that subscriber should not get ip from external dhcp server..
4651 5. Repeat steps 3 and 4 for 10 times.
4652 6 Verify that subscriber should not get ip from external dhcp server..
4653 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004654 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004655 """
4656 Test Method:
4657 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4658 1. OLT and ONU is detected and validated.
4659 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4660 3. Send dhcp request from residential subscriber to external dhcp server.
4661 4. Verify that subscriber get ip from external dhcp server. successfully.
4662 5. Repeat step 3 for 50 times.
4663 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4664 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004665 self.voltha_dhcprelay_setUpClass()
4666# if not port_list:
4667# port_list = self.generate_port_list(1, 0)
4668 iface = self.port_map[self.port_list[0][1]]
4669 mac = self.get_mac(iface)
4670 self.host_load(iface)
4671 ##we use the defaults for this test that serves as an example for others
4672 ##You don't need to restart dhcpd server if retaining default config
4673 config = self.default_config
4674 options = self.default_options
4675 subnet = self.default_subnet_config
4676 dhcpd_interface_list = self.relay_interfaces
4677 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004678 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004679 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4680 assert_not_equal(device_id, None)
4681 voltha = VolthaCtrl(**self.voltha_attrs)
4682 time.sleep(10)
4683 switch_map = None
4684 olt_configured = False
4685 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4686 log_test.info('Installing OLT app')
4687 OnosCtrl.install_app(self.olt_app_file)
4688 time.sleep(5)
4689 log_test.info('Adding subscribers through OLT app')
4690 self.config_olt(switch_map)
4691 olt_configured = True
4692 time.sleep(5)
4693 self.dhcpd_start(intf_list = dhcpd_interface_list,
4694 config = config,
4695 options = options,
4696 subnet = subnet)
4697 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4698 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
4699 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCP REQUEST.' %
4700 (cip, sip, mac) )
4701 try:
4702 assert_not_equal(cip, None)
4703 log_test.info('Triggering DHCP discover again.')
4704 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover(mac=mac)
4705 assert_equal(new_cip, cip)
4706 log_test.info('Got same ip to same the client when sent discover again, as expected')
4707 finally:
4708 self.voltha.disable_device(device_id, delete = True)
4709 self.voltha_dhcprelay_tearDownClass()
4710
4711 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_requests(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004712 """
4713 Test Method:
4714 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4715 1. OLT and ONU is detected and validated.
4716 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4717 3. Send dhcp request from residential subscriber to external dhcp server.
4718 4. Verify that subscriber get ip from external dhcp server. successfully.
4719 5. Send DHCP request to external dhcp server.
4720 6. Repeat step 5 for 50 times.
4721 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4722 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004723 self.voltha_dhcprelay_setUpClass()
4724# if not port_list:
4725# port_list = self.generate_port_list(1, 0)
4726 iface = self.port_map[self.port_list[0][1]]
4727 mac = self.get_mac(iface)
4728 self.host_load(iface)
4729 ##we use the defaults for this test that serves as an example for others
4730 ##You don't need to restart dhcpd server if retaining default config
4731 config = self.default_config
4732 options = self.default_options
4733 subnet = self.default_subnet_config
4734 dhcpd_interface_list = self.relay_interfaces
4735 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004736 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004737 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4738 assert_not_equal(device_id, None)
4739 voltha = VolthaCtrl(**self.voltha_attrs)
4740 time.sleep(10)
4741 switch_map = None
4742 olt_configured = False
4743 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4744 log_test.info('Installing OLT app')
4745 OnosCtrl.install_app(self.olt_app_file)
4746 time.sleep(5)
4747 log_test.info('Adding subscribers through OLT app')
4748 self.config_olt(switch_map)
4749 olt_configured = True
4750 time.sleep(5)
4751 self.dhcpd_start(intf_list = dhcpd_interface_list,
4752 config = config,
4753 options = options,
4754 subnet = subnet)
4755 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4756 log_test.info('Sending DHCP discover and DHCP request.')
4757 cip, sip = self.send_recv(mac=mac)
4758 mac = self.dhcp.get_mac(cip)[0]
4759 log_test.info("Sending DHCP request again.")
4760 new_cip, new_sip = self.dhcp.only_request(cip, mac)
4761 try:
4762 assert_equal(new_cip, cip)
4763 log_test.info('got same ip to smae the client when sent request again, as expected')
4764 finally:
4765 self.voltha.disable_device(device_id, delete = True)
4766 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004767
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004768 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004769 """
4770 Test Method:
4771 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4772 1. OLT and ONU is detected and validated.
4773 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4774 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
4775 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
4776 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004777 self.voltha_dhcprelay_setUpClass()
4778# if not port_list:
4779# port_list = self.generate_port_list(1, 0)
4780 iface = self.port_map[self.port_list[0][1]]
4781 mac = self.get_mac(iface)
4782 self.host_load(iface)
4783 ##we use the defaults for this test that serves as an example for others
4784 ##You don't need to restart dhcpd server if retaining default config
4785 config = self.default_config
4786 options = self.default_options
4787 subnet = self.default_subnet_config
4788 dhcpd_interface_list = self.relay_interfaces
4789 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004790 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004791 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4792 assert_not_equal(device_id, None)
4793 voltha = VolthaCtrl(**self.voltha_attrs)
4794 time.sleep(10)
4795 switch_map = None
4796 olt_configured = False
4797 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4798 log_test.info('Installing OLT app')
4799 OnosCtrl.install_app(self.olt_app_file)
4800 time.sleep(5)
4801 log_test.info('Adding subscribers through OLT app')
4802 self.config_olt(switch_map)
4803 olt_configured = True
4804 time.sleep(5)
4805 self.dhcpd_start(intf_list = dhcpd_interface_list,
4806 config = config,
4807 options = options,
4808 subnet = subnet)
4809 self.dhcp = DHCPTest(seed_ip = '192.168.1.31', iface = iface)
4810 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac,desired = True)
4811 try:
4812 assert_equal(cip,self.dhcp.seed_ip)
4813 log_test.info('Got dhcp client desired IP %s from server %s for mac %s as expected' %
4814 (cip, sip, mac) )
4815 finally:
4816 self.voltha.disable_device(device_id, delete = True)
4817 self.voltha_dhcprelay_tearDownClass()
4818
Thangavelu K S057b7d22017-05-16 22:03:22 +00004819
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004820 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004821 """
4822 Test Method:
4823 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4824 1. OLT and ONU is detected and validated.
4825 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4826 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
4827 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.
4828 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004829 self.voltha_dhcprelay_setUpClass()
4830# if not port_list:
4831# port_list = self.generate_port_list(1, 0)
4832 iface = self.port_map[self.port_list[0][1]]
4833 mac = self.get_mac(iface)
4834 self.host_load(iface)
4835 ##we use the defaults for this test that serves as an example for others
4836 ##You don't need to restart dhcpd server if retaining default config
4837 config = self.default_config
4838 options = self.default_options
4839 subnet = self.default_subnet_config
4840 dhcpd_interface_list = self.relay_interfaces
4841 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004842 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004843 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4844 assert_not_equal(device_id, None)
4845 voltha = VolthaCtrl(**self.voltha_attrs)
4846 time.sleep(10)
4847 switch_map = None
4848 olt_configured = False
4849 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4850 log_test.info('Installing OLT app')
4851 OnosCtrl.install_app(self.olt_app_file)
4852 time.sleep(5)
4853 log_test.info('Adding subscribers through OLT app')
4854 self.config_olt(switch_map)
4855 olt_configured = True
4856 time.sleep(5)
4857 self.dhcpd_start(intf_list = dhcpd_interface_list,
4858 config = config,
4859 options = options,
4860 subnet = subnet)
4861 self.dhcp = DHCPTest(seed_ip = '20.20.20.35', iface = iface)
4862 cip, sip, mac, _ = self.dhcp.only_discover(mac= mac,desired = True)
4863 try:
4864 assert_not_equal(cip,None)
4865 assert_not_equal(cip,self.dhcp.seed_ip)
4866 log_test.info('server offered IP from its pool when requested out of pool IP, as expected')
4867 finally:
4868 self.voltha.disable_device(device_id, delete = True)
4869 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004870
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004871 def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004872 """
4873 Test Method:
4874 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4875 1. OLT and ONU is detected and validated.
4876 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4877 3. Send dhcp request from residential subscriber to external dhcp server.
4878 4. Verify that subscriber get ip from external dhcp server. successfully.
4879 5. Deactivate dhcp server app in onos.
4880 6. Repeat step 3.
4881 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4882 """
4883
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004884 def test_subscriber_with_voltha_for_dhcprelay_renew_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004885 """
4886 Test Method:
4887 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4888 1. OLT and ONU is detected and validated.
4889 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4890 3. Send dhcp request from residential subscriber to external dhcp server.
4891 4. Verify that subscriber get ip from external dhcp server. successfully.
4892 5. Send dhcp renew packet to external dhcp server.
4893 6. Repeat step 4.
4894 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004895 self.voltha_dhcprelay_setUpClass()
4896# if not port_list:
4897# port_list = self.generate_port_list(1, 0)
4898 iface = self.port_map[self.port_list[0][1]]
4899 mac = self.get_mac(iface)
4900 self.host_load(iface)
4901 ##we use the defaults for this test that serves as an example for others
4902 ##You don't need to restart dhcpd server if retaining default config
4903 config = self.default_config
4904 new_options = [('dhcp-renewal-time', 100), ('dhcp-rebinding-time', 125)]
4905 options = self.default_options + new_options
4906 subnet = self.default_subnet_config
4907 dhcpd_interface_list = self.relay_interfaces
4908 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004909 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004910 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4911 assert_not_equal(device_id, None)
4912 voltha = VolthaCtrl(**self.voltha_attrs)
4913 time.sleep(10)
4914 switch_map = None
4915 olt_configured = False
4916 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4917 log_test.info('Installing OLT app')
4918 OnosCtrl.install_app(self.olt_app_file)
4919 time.sleep(5)
4920 log_test.info('Adding subscribers through OLT app')
4921 self.config_olt(switch_map)
4922 olt_configured = True
4923 time.sleep(5)
4924 self.dhcpd_start(intf_list = dhcpd_interface_list,
4925 config = config,
4926 options = options,
4927 subnet = subnet)
4928 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
4929 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
4930 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
4931 (cip, sip, mac) )
4932 try:
4933 assert_not_equal(cip,None)
4934 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
4935 log_test.info('Waiting for renew time..')
4936 time.sleep(lval)
4937 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac, unicast = True)
4938 assert_equal(latest_cip, cip)
4939 log_test.info('Server renewed client IP when client sends request after renew time, as expected')
4940 finally:
4941 self.voltha.disable_device(device_id, delete = True)
4942 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004943
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004944 def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004945 """
4946 Test Method:
4947 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4948 1. OLT and ONU is detected and validated.
4949 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4950 3. Send dhcp request from residential subscriber to external dhcp server.
4951 4. Verify that subscriber get ip from external dhcp server. successfully.
4952 5. Send dhcp rebind packet to external dhcp server.
4953 6. Repeat step 4.
4954 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004955 self.voltha_dhcprelay_setUpClass()
4956# if not port_list:
4957# port_list = self.generate_port_list(1, 0)
4958 iface = self.port_map[self.port_list[0][1]]
4959 mac = self.get_mac(iface)
4960 self.host_load(iface)
4961 ##we use the defaults for this test that serves as an example for others
4962 ##You don't need to restart dhcpd server if retaining default config
4963 config = self.default_config
4964 new_options = [('dhcp-renewal-time', 100), ('dhcp-rebinding-time', 125)]
4965 options = self.default_options + new_options
4966 subnet = self.default_subnet_config
4967 dhcpd_interface_list = self.relay_interfaces
4968 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004969 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004970 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4971 assert_not_equal(device_id, None)
4972 voltha = VolthaCtrl(**self.voltha_attrs)
4973 time.sleep(10)
4974 switch_map = None
4975 olt_configured = False
4976 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4977 log_test.info('Installing OLT app')
4978 OnosCtrl.install_app(self.olt_app_file)
4979 time.sleep(5)
4980 log_test.info('Adding subscribers through OLT app')
4981 self.config_olt(switch_map)
4982 olt_configured = True
4983 time.sleep(5)
4984 self.dhcpd_start(intf_list = dhcpd_interface_list,
4985 config = config,
4986 options = options,
4987 subnet = subnet)
4988 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
4989 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
4990 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
4991 (cip, sip, mac) )
4992 try:
4993 assert_not_equal(cip,None)
4994 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
4995 log_test.info('Waiting for rebind time..')
4996 time.sleep(lval)
4997 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
4998 assert_equal(latest_cip, cip)
4999 log_test.info('Server renewed client IP when client sends request after rebind time, as expected')
5000 finally:
5001 self.voltha.disable_device(device_id, delete = True)
5002 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005003
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005004 def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005005 """
5006 Test Method:
5007 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5008 1. OLT and ONU is detected and validated.
5009 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5010 3. Send dhcp request from residential subscriber to external dhcp server.
5011 4. Verify that subscriber get ip from external dhcp server. successfully.
5012 5. Disable olt devices which is being detected in voltha CLI.
5013 6. Repeat step 3.
5014 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5015 """
5016
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005017 def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005018 """
5019 Test Method:
5020 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5021 1. OLT and ONU is detected and validated.
5022 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5023 3. Send dhcp request from residential subscriber to external dhcp server.
5024 4. Verify that subscriber get ip from external dhcp server. successfully.
5025 5. Disable olt devices which is being detected in voltha CLI.
5026 6. Repeat step 3.
5027 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5028 8. Enable olt devices which is being detected in voltha CLI.
5029 9. Repeat steps 3 and 4.
5030 """
5031
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005032 def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005033 """
5034 Test Method:
5035 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5036 1. OLT and ONU is detected and validated.
5037 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5038 3. Send dhcp request from residential subscriber to external dhcp server.
5039 4. Verify that subscriber get ip from external dhcp server. successfully.
5040 5. Disable onu port which is being detected in voltha CLI.
5041 6. Repeat step 3.
5042 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5043 """
5044
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005045 def test_subscriber_with_voltha_for_dhcprelay_disable_enable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005046 """
5047 Test Method:
5048 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5049 1. OLT and ONU is detected and validated.
5050 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5051 3. Send dhcp request from residential subscriber to external dhcp server.
5052 4. Verify that subscriber get ip from external dhcp server. successfully.
5053 5. Disable onu port which is being detected in voltha CLI.
5054 6. Repeat step 3.
5055 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5056 8. Enable onu port which is being detected in voltha CLI.
5057 9. Repeat steps 3 and 4.
5058 """
5059
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005060 def test_two_subscribers_with_voltha_for_dhcprelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005061 """
5062 Test Method:
5063 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5064 1. OLT and ONU is detected and validated.
5065 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5066 3. Send dhcp request from two residential subscribers to external dhcp server.
5067 4. Verify that subscribers had got different ips from external dhcp server. successfully.
5068 """
5069
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005070 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005071 """
5072 Test Method:
5073 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5074 1. OLT and ONU is detected and validated.
5075 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5076 3. Send dhcp request from two residential subscribers to external dhcp server.
5077 4. Verify that subscribers had got ip from external dhcp server. successfully.
5078 5. Repeat step 3 and 4 for 10 times for both subscribers.
5079 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
5080 """
5081
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005082 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005083 """
5084 Test Method:
5085 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5086 1. OLT and ONU is detected and validated.
5087 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5088 3. Send dhcp request from two residential subscribers to external dhcp server.
5089 4. Verify that subscribers had got ip from external dhcp server. successfully.
5090 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
5091 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
5092 """
5093
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005094 def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005095 """
5096 Test Method:
5097 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5098 1. OLT and ONU is detected and validated.
5099 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5100 3. Send dhcp request from one residential subscriber to external dhcp server.
5101 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
5102 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
5103 """
5104
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005105 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 +00005106 """
5107 Test Method:
5108 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5109 1. OLT and ONU is detected and validated.
5110 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5111 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
5112 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
5113 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
5114 """
5115
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005116 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005117 """
5118 Test Method:
5119 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5120 1. OLT and ONU is detected and validated.
5121 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5122 3. Send dhcp request from two residential subscribers to external dhcp server.
5123 4. Verify that subscribers had got ip from external dhcp server. successfully.
5124 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
5125 6. Repeat step 3 and 4 for one subscriber where uni port is down.
5126 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5127 """
5128
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005129 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005130 """
5131 Test Method:
5132 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5133 1. OLT and ONU is detected and validated.
5134 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5135 3. Send dhcp request from two residential subscribers to external dhcp server.
5136 4. Verify that subscribers had got ip from external dhcp server. successfully.
5137 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
5138 6. Repeat step 3 and 4 for one subscriber where uni port is down.
5139 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5140 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
5141 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
5142 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5143 """
5144
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005145 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005146 """
5147 Test Method:
5148 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5149 1. OLT and ONU is detected and validated.
5150 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5151 3. Send dhcp request from two residential subscribers to external dhcp server.
5152 4. Verify that subscribers had got ip from external dhcp server. successfully.
5153 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
5154 6. Disable the olt device which is detected in voltha.
5155 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
5156 """
5157
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005158 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005159 """
5160 Test Method:
5161 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5162 1. OLT and ONU is detected and validated.
5163 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5164 3. Send dhcp request from two residential subscribers to external dhcp server.
5165 4. Verify that subscribers had got ip from external dhcp server. successfully.
5166 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
5167 6. Disable the olt device which is detected in voltha.
5168 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
5169 8. Enable the olt device which is detected in voltha.
5170 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5171 """
5172
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005173 def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005174 """
5175 Test Method:
5176 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5177 1. OLT and ONU is detected and validated.
5178 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5179 3. Send dhcp request from two residential subscribers to external dhcp server.
5180 4. Verify that subscribers had got ip from external dhcp server. successfully.
5181 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
5182 6. Pause the olt device which is detected in voltha.
5183 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
5184 """
Thangavelu K S36edb012017-07-05 18:24:12 +00005185
Thangavelu K S6432b522017-07-22 00:05:54 +00005186 def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005187 """
5188 Test Method:
5189 0. Make sure that voltha is up and running on CORD-POD setup.
5190 1. OLT and ONU is detected and validated.
5191 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5192 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5193 4. Send igmp joins for a multicast group address multi-group-addressA.
5194 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
5195 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5196 """
5197
Thangavelu K S8e413082017-07-13 20:02:14 +00005198 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5199 num_subscribers = 1
5200 num_channels = 1
5201 services = ('IGMP')
5202 cbs = (self.igmp_flow_check, None, None)
5203 self.voltha_subscribers(services, cbs = cbs,
5204 num_subscribers = num_subscribers,
5205 num_channels = num_channels)
5206
Thangavelu K S6432b522017-07-22 00:05:54 +00005207 def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005208 """
5209 Test Method:
5210 0. Make sure that voltha is up and running on CORD-POD setup.
5211 1. OLT and ONU is detected and validated.
5212 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5213 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5214 4. Send igmp joins for a multicast group address multi-group-addressA.
5215 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
5216 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
5217 7. Send igmp leave for a multicast group address multi-group-addressA.
5218 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
5219 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005220 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5221 num_subscribers = 1
5222 num_channels = 1
5223 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005224 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00005225 self.voltha_subscribers(services, cbs = cbs,
5226 num_subscribers = num_subscribers,
5227 num_channels = num_channels)
5228
Thangavelu K S6432b522017-07-22 00:05:54 +00005229 def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005230 """
5231 Test Method:
5232 0. Make sure that voltha is up and running on CORD-POD setup.
5233 1. OLT and ONU is detected and validated.
5234 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5235 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5236 4. Send igmp joins for a multicast group address multi-group-addressA.
5237 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
5238 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
5239 7. Send igmp leave for a multicast group address multi-group-addressA.
5240 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
5241 9. Repeat steps 4 to 6.
5242 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005243 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5244 num_subscribers = 1
5245 num_channels = 1
5246 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005247 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00005248 self.voltha_subscribers(services, cbs = cbs,
5249 num_subscribers = num_subscribers,
5250 num_channels = num_channels)
5251
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005252 def test_subscriber_with_voltha_for_igmp_5_groups_joins_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005253 """
5254 Test Method:
5255 0. Make sure that voltha is up and running on CORD-POD setup.
5256 1. OLT and ONU is detected and validated.
5257 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5258 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5259 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
5260 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5261 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5262 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005263 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5264 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005265 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00005266 services = ('IGMP')
5267 cbs = (self.igmp_flow_check, None, None)
5268 self.voltha_subscribers(services, cbs = cbs,
5269 num_subscribers = num_subscribers,
5270 num_channels = num_channels)
5271
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005272 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 +00005273 """
5274 Test Method:
5275 0. Make sure that voltha is up and running on CORD-POD setup.
5276 1. OLT and ONU is detected and validated.
5277 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5278 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5279 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
5280 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5281 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5282 7. Send igmp leave for a multicast group address multi-group-addressA.
5283 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.
5284 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester.
5285 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005286 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5287 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005288 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00005289 services = ('IGMP')
5290 cbs = (self.igmp_flow_check, None, None)
5291 self.voltha_subscribers(services, cbs = cbs,
5292 num_subscribers = num_subscribers,
5293 num_channels = num_channels)
5294
Thangavelu K S6432b522017-07-22 00:05:54 +00005295 def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005296 """
5297 Test Method:
5298 0. Make sure that voltha is up and running on CORD-POD setup.
5299 1. OLT and ONU is detected and validated.
5300 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5301 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5302 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
5303 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5304 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5305 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
5306 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5307 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005308 num_subscribers = 1
5309 num_channels = 1
5310 services = ('IGMP')
5311 cbs = (self.igmp_flow_check, None, None)
5312 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5313 num_subscribers = num_subscribers,
5314 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00005315
Thangavelu K S6432b522017-07-22 00:05:54 +00005316 def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005317 """
5318 Test Method:
5319 0. Make sure that voltha is up and running on CORD-POD setup.
5320 1. OLT and ONU is detected and validated.
5321 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5322 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5323 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
5324 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5325 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5326 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA
5327 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5328 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5329 """
5330
Thangavelu K S8e413082017-07-13 20:02:14 +00005331 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00005332 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00005333 services = ('IGMP')
5334 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
5335 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5336 num_subscribers = num_subscribers,
5337 num_channels = num_channels)
5338
Thangavelu K S6432b522017-07-22 00:05:54 +00005339 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 +00005340 """
5341 Test Method:
5342 0. Make sure that voltha is up and running on CORD-POD setup.
5343 1. OLT and ONU is detected and validated.
5344 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5345 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5346 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
5347 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5348 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
5349 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA
5350 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5351 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
5352 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005353 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00005354 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00005355 services = ('IGMP')
5356 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
5357 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5358 num_subscribers = num_subscribers,
5359 num_channels = num_channels)
5360
Thangavelu K S6432b522017-07-22 00:05:54 +00005361 def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005362 """
5363 Test Method:
5364 0. Make sure that voltha is up and running on CORD-POD setup.
5365 1. OLT and ONU is detected and validated.
5366 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5367 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5368 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
5369 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5370 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5371 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA
5372 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5373 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5374 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005375
5376 num_subscribers = 1
5377 num_channels = 1
5378 services = ('IGMP')
5379 cbs = (self.igmp_flow_check_join_change_to_block, None, None)
5380 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5381 num_subscribers = num_subscribers,
5382 num_channels = num_channels)
5383
Thangavelu K S6432b522017-07-22 00:05:54 +00005384 def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005385 """
5386 Test Method:
5387 0. Make sure that voltha is up and running on CORD-POD setup.
5388 1. OLT and ONU is detected and validated.
5389 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5390 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5391 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
5392 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5393 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5394 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB
5395 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
5396 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
5397 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005398
5399 num_subscribers = 1
5400 num_channels = 1
5401 services = ('IGMP')
5402 cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None)
5403 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5404 num_subscribers = num_subscribers,
5405 num_channels = num_channels)
5406
Thangavelu K S6432b522017-07-22 00:05:54 +00005407 def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005408 """
5409 Test Method:
5410 0. Make sure that voltha is up and running on CORD-POD setup.
5411 1. OLT and ONU is detected and validated.
5412 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5413 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5414 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
5415 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5416 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
5417 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
5418 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5419 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005420
5421 num_subscribers = 1
5422 num_channels = 1
5423 services = ('IGMP')
5424 cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None)
5425 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
5426 num_subscribers = num_subscribers,
5427 num_channels = num_channels)
5428
Thangavelu K S6432b522017-07-22 00:05:54 +00005429 def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005430 """
5431 Test Method:
5432 0. Make sure that voltha is up and running on CORD-POD setup.
5433 1. OLT and ONU is detected and validated.
5434 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5435 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5436 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
5437 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5438 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5439 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
5440 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
5441 """
5442
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005443 num_subscribers = 1
5444 num_channels = 1
5445 services = ('IGMP')
5446 cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None)
5447 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
5448 num_subscribers = num_subscribers,
5449 num_channels = num_channels)
5450
Thangavelu K S6432b522017-07-22 00:05:54 +00005451 def test_two_subscribers_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005452 """
5453 Test Method:
5454 0. Make sure that voltha is up and running on CORD-POD setup.
5455 1. OLT and ONU is detected and validated.
5456 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5457 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5458 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5459 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
5460 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5461 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5462 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5463 """
5464
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005465 num_subscribers = 2
5466 num_channels = 1
5467 services = ('IGMP')
5468 cbs = (self.igmp_flow_check, None, None)
5469 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'],
5470 num_subscribers = num_subscribers,
5471 num_channels = num_channels)
5472
Thangavelu K S36edb012017-07-05 18:24:12 +00005473 def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self):
5474 """
5475 Test Method:
5476 0. Make sure that voltha is up and running on CORD-POD setup.
5477 1. OLT and ONU is detected and validated.
5478 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5479 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5480 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5481 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5482 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5483 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5484 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5485 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5486 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5487 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5488 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005489 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005490 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005491 services = ('IGMP')
5492 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
5493 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'],
5494 num_subscribers = num_subscribers,
5495 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00005496
Thangavelu K S6432b522017-07-22 00:05:54 +00005497 def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005498 """
5499 Test Method:
5500 0. Make sure that voltha is up and running on CORD-POD setup.
5501 1. OLT and ONU is detected and validated.
5502 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5503 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5504 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5505 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
5506 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5507 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.
5508 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.
5509 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5510 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.
5511 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.
5512 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.
5513 """
5514
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005515 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005516 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005517 services = ('IGMP')
5518 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
5519 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'],
5520 num_subscribers = num_subscribers,
5521 num_channels = num_channels)
5522
5523 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005524 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 +00005525 """
5526 Test Method:
5527 0. Make sure that voltha is up and running on CORD-POD setup.
5528 1. OLT and ONU is detected and validated.
5529 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5530 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5531 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5532 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5533 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5534 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5535 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5536 9. Disable uni_2 port which is being shown on voltha CLI.
5537 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5538 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5539 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005540 #rx_port = self.port_map['ports'][port_list[i][1]]
5541 df = defer.Deferred()
5542 def igmp_flow_check_operating_onu_admin_state(df):
5543 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005544 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005545 services = ('IGMP')
5546 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5547 port_list = self.generate_port_list(num_subscribers, num_channels)
5548
Thangavelu K S9a637332017-08-01 23:22:23 +00005549 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 +00005550 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5551 thread1.start()
5552 time.sleep(randint(40,50))
5553 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
5554 thread2.start()
5555 time.sleep(10)
5556 thread1.join()
5557 thread2.join()
5558 try:
5559 assert_equal(self.success, False)
5560 log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check')
5561 time.sleep(10)
5562 finally:
5563 pass
5564 df.callback(0)
5565 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5566 return df
5567
5568 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00005569 def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self):
5570 """
5571 Test Method:
5572 0. Make sure that voltha is up and running on CORD-POD setup.
5573 1. OLT and ONU is detected and validated.
5574 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5575 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5576 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5577 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5578 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5579 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5580 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5581 9. Disable uni_2 port which is being shown on voltha CLI.
5582 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5583 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5584 12. Enable uni_2 port which we disable at step 9.
5585 13. Repeat step 5,6 and 8.
5586 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005587 df = defer.Deferred()
5588 def igmp_flow_check_operating_onu_admin_state(df):
5589 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005590 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005591 services = ('IGMP')
5592 cbs = (self.igmp_flow_check, None, None)
5593 port_list = self.generate_port_list(num_subscribers, num_channels)
5594
Thangavelu K S9a637332017-08-01 23:22:23 +00005595 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 +00005596 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5597 thread1.start()
5598 time.sleep(randint(50,60))
5599 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
5600 thread2.start()
5601 time.sleep(10)
5602 thread1.join()
5603 thread2.join()
5604 try:
5605 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005606 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 +00005607 time.sleep(10)
5608 finally:
5609 pass
5610 df.callback(0)
5611 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5612 return df
5613
5614 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005615 def test_two_subscribers_with_voltha_for_igmp_disabling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005616 """
5617 Test Method:
5618 0. Make sure that voltha is up and running on CORD-POD setup.
5619 1. OLT and ONU is detected and validated.
5620 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5621 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5622 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5623 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5624 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5625 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5626 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5627 9. Disable olt device which is being shown on voltha CLI.
5628 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5629 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5630 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005631 df = defer.Deferred()
5632 def igmp_flow_check_operating_olt_admin_disble(df):
5633 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005634 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005635 services = ('IGMP')
5636 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5637 port_list = self.generate_port_list(num_subscribers, num_channels)
5638
Thangavelu K S9a637332017-08-01 23:22:23 +00005639 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 +00005640 thread1.start()
5641 time.sleep(randint(50,60))
5642 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5643 thread2.start()
5644 time.sleep(10)
5645 thread1.join()
5646 thread2.join()
5647 try:
5648 assert_equal(self.success, False)
5649 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5650 time.sleep(10)
5651 finally:
5652 pass
5653 df.callback(0)
5654 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5655 return df
5656
5657 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005658 def test_two_subscribers_with_voltha_for_igmp_pausing_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005659 """
5660 Test Method:
5661 0. Make sure that voltha is up and running on CORD-POD setup.
5662 1. OLT and ONU is detected and validated.
5663 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5664 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5665 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5666 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5667 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5668 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5669 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5670 9. Pause olt device which is being shown on voltha CLI.
5671 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5672 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5673 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005674 df = defer.Deferred()
5675 def igmp_flow_check_operating_olt_admin_pause(df):
5676 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005677 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005678 services = ('IGMP')
5679 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
5680 port_list = self.generate_port_list(num_subscribers, num_channels)
5681
Thangavelu K S9a637332017-08-01 23:22:23 +00005682 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 +00005683 thread1.start()
5684 time.sleep(randint(50,60))
5685 thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,))
5686 thread2.start()
5687 time.sleep(10)
5688 thread1.join()
5689 thread2.join()
5690 try:
5691 assert_equal(self.success, False)
5692 log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test')
5693 time.sleep(10)
5694 finally:
5695 pass
5696 df.callback(0)
5697 reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df)
5698 return df
5699
5700 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00005701 def test_two_subscribers_with_voltha_for_igmp_toggling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005702 """
5703 Test Method:
5704 0. Make sure that voltha is up and running on CORD-POD setup.
5705 1. OLT and ONU is detected and validated.
5706 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5707 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5708 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5709 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5710 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5711 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5712 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5713 9. Disable olt device which is being shown on voltha CLI.
5714 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5715 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5716 12. Enable olt device which is disable at step 9.
5717 13. Repeat steps 4,5, 7 and 8.
5718 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005719 df = defer.Deferred()
5720 def igmp_flow_check_operating_olt_admin_restart(df):
5721 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005722 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005723 services = ('IGMP')
5724 cbs = (self.igmp_flow_check, None, None)
5725 port_list = self.generate_port_list(num_subscribers, num_channels)
5726
Thangavelu K S9a637332017-08-01 23:22:23 +00005727 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 +00005728 thread1.start()
5729 time.sleep(randint(50,60))
5730 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5731 thread2.start()
5732 time.sleep(10)
5733 thread1.join()
5734 thread2.join()
5735 try:
5736 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00005737 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 +00005738 time.sleep(10)
5739 finally:
5740 pass
5741 df.callback(0)
5742 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5743 return df
Thangavelu K S6432b522017-07-22 00:05:54 +00005744
5745 @deferred(TESTCASE_TIMEOUT)
5746 def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self):
5747 """
5748 Test Method:
5749 0. Make sure that voltha is up and running on CORD-POD setup.
5750 1. OLT and ONU is detected and validated.
5751 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5752 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5753 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5754 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5755 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5756 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5757 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5758 9. Disable olt device which is being shown on voltha CLI.
5759 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5760 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5761 12. Repeat steps 4 to 11 steps multiple times (example 20 times)
5762 """
5763 df = defer.Deferred()
5764 no_iterations = 20
5765 def igmp_flow_check_operating_olt_admin_disble(df):
5766 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005767 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005768 services = ('IGMP')
5769 cbs = (self.igmp_flow_check, None, None)
5770 port_list = self.generate_port_list(num_subscribers, num_channels)
5771
Thangavelu K S9a637332017-08-01 23:22:23 +00005772 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 +00005773 thread1.start()
5774 time.sleep(randint(30,40))
5775 for i in range(no_iterations):
5776 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
5777 thread2.start()
5778 time.sleep(8)
5779 thread2.join()
5780 thread1.join()
5781 thread1.isAlive()
5782 thread2.join()
5783 try:
5784 assert_equal(self.success, False)
5785 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
5786 time.sleep(10)
5787 finally:
5788 pass
5789 df.callback(0)
5790 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
5791 return df
5792
5793 @deferred(TESTCASE_TIMEOUT + 200)
5794 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self):
5795 """
5796 Test Method:
5797 0. Make sure that voltha is up and running on CORD-POD setup.
5798 1. OLT and ONU is detected and validated.
5799 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5800 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5801 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5802 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5803 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5804 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5805 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5806 9. Disable uni_2 port which is being shown on voltha CLI.
5807 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5808 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5809 12. Enable uni_2 port which we disable at step 9.
5810 13. Repeat step 5,6 and 8.
5811 14. Repeat steps 4 to 13 steps multiple times (example 5 times)
5812 """
5813 df = defer.Deferred()
5814 no_iterations = 5
5815 def igmp_flow_check_operating_onu_admin_state(df):
5816 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005817 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005818 services = ('IGMP')
5819 cbs = (self.igmp_flow_check, None, None)
5820 port_list = self.generate_port_list(num_subscribers, num_channels)
5821
Thangavelu K S9a637332017-08-01 23:22:23 +00005822 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 +00005823 thread1.start()
5824 time.sleep(randint(40,60))
5825 for i in range(no_iterations):
5826 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
5827 log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha')
5828 thread2.start()
5829 time.sleep(1)
5830 thread2.join()
5831 thread1.isAlive()
5832 thread1.join()
5833 thread2.join()
5834 try:
5835 assert_equal(self.success, True)
5836 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful')
5837 time.sleep(10)
5838 finally:
5839 pass
5840 df.callback(0)
5841 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
5842 return df
5843
5844 @deferred(TESTCASE_TIMEOUT)
5845 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self):
5846 """
5847 Test Method:
5848 0. Make sure that voltha is up and running on CORD-POD setup.
5849 1. OLT and ONU is detected and validated.
5850 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5851 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5852 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
5853 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
5854 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
5855 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5856 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5857 9. Disable olt device which is being shown on voltha CLI.
5858 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
5859 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
5860 12. Enable olt device which is disable at step 9.
5861 13. Repeat steps 4,5, 7 and 8.
5862 14. Repeat steps 4 to 13 steps multiple times (example 10 times)
5863 """
5864 df = defer.Deferred()
5865 no_iterations = 10
5866 def igmp_flow_check_operating_olt_admin_restart(df):
5867 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00005868 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00005869 services = ('IGMP')
5870 cbs = (self.igmp_flow_check, None, None)
5871 port_list = self.generate_port_list(num_subscribers, num_channels)
5872
Thangavelu K S9a637332017-08-01 23:22:23 +00005873 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 +00005874 thread1.start()
5875 time.sleep(randint(50,60))
5876 for i in range(no_iterations):
5877 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
5878 thread2.start()
5879 time.sleep(10)
5880 thread2.join()
5881 thread1.join()
5882 thread2.join()
5883 try:
5884 assert_equal(self.success, True)
5885 log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful')
5886 time.sleep(10)
5887 finally:
5888 pass
5889 df.callback(0)
5890 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
5891 return df
5892
5893 def test_5_subscriber_with_voltha_for_igmp_with_10_group_joins_verifying_traffic(self):
5894 """
5895 Test Method:
5896 0. Make sure that voltha is up and running on CORD-POD setup.
5897 1. OLT and ONU is detected and validated.
5898 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5899 3. Issue multiple dhcp client packets to get IP address from dhcp server for as subscribers and check connectivity.
5900 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5901 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5902 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5903 """
5904
5905 num_subscribers = 5
5906 num_channels = 10
5907 services = ('IGMP')
5908 cbs = (self.igmp_flow_check, None, None)
5909 self.voltha_subscribers(services, cbs = cbs,
5910 num_subscribers = num_subscribers,
5911 num_channels = num_channels)
5912
5913 def test_9_subscriber_with_voltha_for_igmp_with_10_group_joins_and_verify_traffic(self):
5914 """
5915 Test Method:
5916 0. Make sure that voltha is up and running on CORD-POD setup.
5917 1. OLT and ONU is detected and validated.
5918 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
5919 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity.
5920 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
5921 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5922 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5923 """
5924 num_subscribers = 9
5925 num_channels = 10
5926 services = ('IGMP')
5927 cbs = (self.igmp_flow_check, None, None)
5928 self.voltha_subscribers(services, cbs = cbs,
5929 num_subscribers = num_subscribers,
5930 num_channels = num_channels)