blob: 39de31244836d9ebc95eeeac471e893164c2e97a [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
Thangavelu K S8e413082017-07-13 20:02:14 +0000166 def recv_channel_cb(self, pkt, src_list = None):
167
Thangavelu K S36edb012017-07-05 18:24:12 +0000168 ##First verify that we have received the packet for the joined instance
Thangavelu K S9a637332017-08-01 23:22:23 +0000169 log_test.info('Packet received for group %s, subscriber, port %s and from source ip %s showing full packet %s'%
170 (pkt[IP].dst, self.rx_intf, pkt[IP].src, pkt.show))
171 if src_list is not None:
172 for i in src_list:
173 if pkt[IP].src == src_list[i]:
174 pass
175 else:
176 log_test.info('Packet received for group %s, subscriber, port %s and from source ip %s which is not expcted on that port'%
177 (pkt[IP].dst, self.rx_intf, pkt[IP].src))
178
179 self.recv_timeout = True
180
Thangavelu K S36edb012017-07-05 18:24:12 +0000181 if self.recv_timeout:
182 return
183 chan = self.caddr(pkt[IP].dst)
184 assert_equal(chan in self.join_map.keys(), True)
185 recv_time = monotonic.monotonic() * 1000000
186 join_time = self.join_map[chan][self.STATS_JOIN].start
187 delta = recv_time - join_time
188 self.join_rx_stats.update(packets=1, t = delta, usecs = True)
189 self.channel_update(chan, self.STATS_RX, 1, t = delta)
190 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
191
Thangavelu K S36edb012017-07-05 18:24:12 +0000192class voltha_subscriber_pool:
193
194 def __init__(self, subscriber, test_cbs):
195 self.subscriber = subscriber
196 self.test_cbs = test_cbs
197
198 def pool_cb(self):
199 for cb in self.test_cbs:
200 if cb:
Thangavelu K S8e413082017-07-13 20:02:14 +0000201 self.test_status = cb(self.subscriber, multiple_sub = True)
Thangavelu K S36edb012017-07-05 18:24:12 +0000202 if self.test_status is not True:
Thangavelu K S6432b522017-07-22 00:05:54 +0000203 ## This is chaining for other sub status has to check again
Thangavelu K S36edb012017-07-05 18:24:12 +0000204 self.test_status = True
205 log_test.info('This service is failed and other services will not run for this subscriber')
206 break
207 log_test.info('This Subscriber is tested for multiple service eligibility ')
208 self.test_status = True
209
A R Karthick35495c32017-05-11 14:58:32 -0700210class voltha_exchange(unittest.TestCase):
211
212 OLT_TYPE = 'tibit_olt'
213 OLT_MAC = '00:0c:e2:31:12:00'
A R Karthick168e2342017-08-15 16:13:10 -0700214 VOLTHA_HOST = VolthaService.DOCKER_HOST_IP
215 VOLTHA_PONSIM_HOST = VolthaService.PONSIM_HOST
A R Karthicke7232092017-09-07 18:01:33 -0700216 VOLTHA_REST_PORT = VolthaCtrl.REST_PORT
Thangavelu K S36edb012017-07-05 18:24:12 +0000217 VOLTHA_OLT_TYPE = 'ponsim_olt'
218 VOLTHA_OLT_MAC = '00:0c:e2:31:12:00'
219 VOLTHA_IGMP_ITERATIONS = 100
A R Karthick18d0fb62017-09-01 18:49:07 -0700220 VOLTHA_TEARDOWN = True
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):
A R Karthick1555c7c2017-09-07 14:59:41 -0700386 OnosCtrl.aaa_load_config()
A.R Karthickf874d032017-06-07 18:47:51 -0700387
388 @classmethod
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000389 def onos_dhcp_table_load(self, config = None):
390 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
391 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
392 if config:
393 for k in config.keys():
394 if dhcp_config.has_key(k):
395 dhcp_config[k] = config[k]
396 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
397
Thangavelu K S36edb012017-07-05 18:24:12 +0000398 def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = None):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000399 if validation:
Thangavelu K S735a6662017-06-15 18:08:23 +0000400 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
401 assert_not_equal(cip, None)
402 assert_not_equal(sip, None)
403 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
404 (cip, sip, dhcp.get_mac(cip)[0]))
405 if validation == False:
406 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
407 assert_equal(cip, None)
408 assert_equal(sip, None)
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000409 log_test.info('Dhcp client did not get IP from server')
Thangavelu K S735a6662017-06-15 18:08:23 +0000410
Thangavelu K S36edb012017-07-05 18:24:12 +0000411 if validation == 'skip':
412 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
413
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000414 return cip,sip
415
Thangavelu K S36edb012017-07-05 18:24:12 +0000416 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):
417 config = {'startip':startip, 'endip':'10.10.10.200',
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000418 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
419 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
420 self.onos_dhcp_table_load(config)
421 dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface)
Thangavelu K S36edb012017-07-05 18:24:12 +0000422 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed, validation = validation, mac = mac)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000423 return cip, sip
424
425 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700426 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700427 cls.update_apps_version()
A R Karthick53442712017-07-27 12:23:30 -0700428 cls.voltha_attrs = dict(host = cls.VOLTHA_HOST,
429 rest_port = cls.VOLTHA_REST_PORT,
430 uplink_vlan_map = cls.VOLTHA_UPLINK_VLAN_MAP,
431 uplink_vlan_start = cls.VOLTHA_UPLINK_VLAN_START)
432 cls.voltha = VolthaCtrl(**cls.voltha_attrs)
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000433 cls.install_app_table()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000434 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
435 cls.port_map, cls.port_list = cls.olt.olt_port_map()
436 cls.switches = cls.port_map['switches']
Thangavelu K S36edb012017-07-05 18:24:12 +0000437 cls.ponsim_ports = cls.port_map['ponsim']
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000438 cls.num_ports = cls.port_map['num_ports']
439 if cls.num_ports > 1:
440 cls.num_ports -= 1 ##account for the tx port
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000441 cls.activate_apps(cls.apps + cls.olt_apps, deactivate = True)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000442 cls.deactivate_apps(cls.app_dhcprelay)
A.R Karthickf874d032017-06-07 18:47:51 -0700443 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000444
A.R Karthick3493a572017-06-07 18:28:10 -0700445 @classmethod
446 def tearDownClass(cls):
447 '''Deactivate the olt apps and restart OVS back'''
448 apps = cls.olt_apps + ( cls.table_app,)
449 for app in apps:
450 onos_ctrl = OnosCtrl(app)
451 onos_ctrl.deactivate()
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000452 cls.deactivate_apps(cls.app_dhcprelay)
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000453 cls.install_app_igmp()
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000454 log_test.info('TearDownClass Restarting the Radius Server in the TA setup')
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000455 cord_test_radius_restart()
456
A.R Karthick3493a572017-06-07 18:28:10 -0700457 @classmethod
458 def install_app_igmp(cls):
459 ##Uninstall the table app on class exit
460 OnosCtrl.uninstall_app(cls.table_app)
461 time.sleep(2)
462 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
463 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700464
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000465 def remove_olt(self, switch_map):
466 controller = get_controller()
467 auth = ('karaf', 'karaf')
468 #remove subscriber for every port on all the voltha devices
469 for device, device_map in switch_map.iteritems():
470 uni_ports = device_map['ports']
471 uplink_vlan = device_map['uplink_vlan']
472 for port in uni_ports:
473 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
474 device,
475 port)
476 resp = requests.delete(rest_url, auth = auth)
477 if resp.status_code not in [204, 202, 200]:
478 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
479 else:
480 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
481 OnosCtrl.uninstall_app(self.olt_app_file)
482
483 def config_olt(self, switch_map):
484 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000485 auth = ('karaf', 'karaf')
486 #configure subscriber for every port on all the voltha devices
487 for device, device_map in switch_map.iteritems():
488 uni_ports = device_map['ports']
489 uplink_vlan = device_map['uplink_vlan']
490 for port in uni_ports:
491 vlan = port
492 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
493 device,
494 port,
495 vlan)
496 resp = requests.post(rest_url, auth = auth)
497 #assert_equal(resp.ok, True)
498
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000499 def voltha_uni_port_toggle(self, uni_port = None):
500 ## Admin state of port is down and up
501 if not uni_port:
502 uni_port = self.INTF_RX_DEFAULT
503 cmd = 'ifconfig {} down'.format(uni_port)
504 os.system(cmd)
505 log_test.info('Admin state of uni_port is down')
506 time.sleep(30)
507 cmd = 'ifconfig {} up'.format(uni_port)
508 os.system(cmd)
509 log_test.info('Admin state of uni_port is up now')
510 time.sleep(30)
511 return
512
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000513 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000514 def install_app_table(cls):
515 ##Uninstall the existing app if any
516 OnosCtrl.uninstall_app(cls.table_app)
517 time.sleep(2)
518 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
519 OnosCtrl.install_app(cls.table_app_file)
520 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000521
522 @classmethod
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000523 def activate_apps(cls, apps, deactivate = False):
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000524 for app in apps:
525 onos_ctrl = OnosCtrl(app)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000526 if deactivate is True:
527 onos_ctrl.deactivate()
528 time.sleep(2)
A R Karthick168e2342017-08-15 16:13:10 -0700529 log_test.info('Activating app %s' %app)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000530 status, _ = onos_ctrl.activate()
531 assert_equal(status, True)
532 time.sleep(2)
533
Thangavelu K S735a6662017-06-15 18:08:23 +0000534 @classmethod
535 def deactivate_apps(cls, apps):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000536 cls.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000537 for app in apps:
538 onos_ctrl = OnosCtrl(app)
A R Karthick168e2342017-08-15 16:13:10 -0700539 log_test.info('Deactivating app %s' %app)
Thangavelu K S735a6662017-06-15 18:08:23 +0000540 status, _ = onos_ctrl.deactivate()
541 if status is False:
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000542 cls.success = False
543 # assert_equal(status, True)
Thangavelu K S735a6662017-06-15 18:08:23 +0000544 time.sleep(2)
545
Thangavelu K S36edb012017-07-05 18:24:12 +0000546 def random_ip(self,start_ip = '10.10.10.20', end_ip = '10.10.10.65'):
547 start = list(map(int, start_ip.split(".")))
548 end = list(map(int, end_ip.split(".")))
549 temp = start
550 ip_range = []
551 ip_range.append(start_ip)
552 while temp != end:
553 start[3] += 1
554 for i in (3, 2, 1):
555 if temp[i] == 255:
556 temp[i] = 0
557 temp[i-1] += 1
558 ip_range.append(".".join(map(str, temp)))
559 return random.choice(ip_range)
560
Thangavelu K S8e413082017-07-13 20:02:14 +0000561 def random_mcast_ip(self,start_ip = '224.0.1.0', end_ip = '224.0.1.100'):
562 start = list(map(int, start_ip.split(".")))
563 end = list(map(int, end_ip.split(".")))
564 temp = start
565 ip_range = []
566 ip_range.append(start_ip)
567 while temp != end:
568 start[3] += 1
569 for i in (3, 2, 1):
570 if temp[i] == 255:
571 temp[i] = 0
572 temp[i-1] += 1
573 ip_range.append(".".join(map(str, temp)))
574 return random.choice(ip_range)
575
Thangavelu K S6432b522017-07-22 00:05:54 +0000576 @classmethod
577 def dhcp_relay_setup(cls):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000578 did = OnosCtrl.get_device_id()
579 cls.relay_device_id = did
580 cls.relay_device_id = 'of:0000000000000001'
581 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
582 cls.port_map, _ = cls.olt.olt_port_map()
Thangavelu K S6432b522017-07-22 00:05:54 +0000583 if cls.port_map:
584 ##Per subscriber, we use 1 relay port
585 try:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000586 relay_port = cls.port_map[cls.port_map['relay_ports'][0]]
Thangavelu K S6432b522017-07-22 00:05:54 +0000587 except:
588 relay_port = cls.port_map['uplink']
589 cls.relay_interface_port = relay_port
590 cls.relay_interfaces = (cls.port_map[cls.relay_interface_port],)
591 else:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000592 cls.relay_interface_port = 100
593 cls.relay_interfaces = (g_subscriber_port_map[cls.relay_interface_port],)
Thangavelu K S6432b522017-07-22 00:05:54 +0000594 cls.relay_interfaces_last = cls.relay_interfaces
595 if cls.port_map:
596 ##generate a ip/mac client virtual interface config for onos
597 interface_list = []
598 for port in cls.port_map['ports']:
599 port_num = cls.port_map[port]
600 if port_num == cls.port_map['uplink']:
601 continue
602 ip = cls.get_host_ip(port_num)
603 mac = cls.get_mac(port)
604 interface_list.append((port_num, ip, mac))
605
606 #configure dhcp server virtual interface on the same subnet as first client interface
607 relay_ip = cls.get_host_ip(interface_list[0][0])
608 relay_mac = cls.get_mac(cls.port_map[cls.relay_interface_port])
609 interface_list.append((cls.relay_interface_port, relay_ip, relay_mac))
610 cls.onos_interface_load(interface_list)
611
612 @classmethod
613 def onos_interface_load(cls, interface_list):
614 interface_dict = { 'ports': {} }
615 for port_num, ip, mac in interface_list:
616 port_map = interface_dict['ports']
617 port = '{}/{}'.format(cls.relay_device_id, port_num)
618 port_map[port] = { 'interfaces': [] }
619 interface_list = port_map[port]['interfaces']
620 interface_map = { 'ips' : [ '{}/{}'.format(ip, 24) ],
621 'mac' : mac,
622 'name': 'vir-{}'.format(port_num)
623 }
624 interface_list.append(interface_map)
625
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000626 cls.onos_load_config('org.onosproject.dhcprelay', interface_dict)
Thangavelu K S6432b522017-07-22 00:05:54 +0000627 cls.configs['interface_config'] = interface_dict
628
629 @classmethod
630 def get_host_ip(cls, port):
631 if cls.host_ip_map.has_key(port):
632 return cls.host_ip_map[port]
633 cls.host_ip_map[port] = '192.168.1.{}'.format(port)
634 return cls.host_ip_map[port]
635
636 @classmethod
637 def host_load(cls, iface):
638 '''Have ONOS discover the hosts for dhcp-relay responses'''
639 port = g_subscriber_port_map[iface]
640 host = '173.17.1.{}'.format(port)
641 cmds = ( 'ifconfig {} 0'.format(iface),
642 'ifconfig {0} {1}'.format(iface, host),
643 'arping -I {0} {1} -c 2'.format(iface, host),
644 'ifconfig {} 0'.format(iface), )
645 for c in cmds:
646 os.system(c)
647
648 @classmethod
649 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
650 subnet = default_subnet_config):
651 conf = ''
652 for k, v in config.items():
653 conf += '{} {};\n'.format(k, v)
654
655 opts = ''
656 for k, v in options:
657 opts += 'option {} {};\n'.format(k, v)
658
659 subnet_config = ''
660 for _, v in subnet:
661 subnet_config += '{}\n'.format(v)
662
663 return '{}{}{}'.format(conf, opts, subnet_config)
664
665 @classmethod
666 def dhcpd_start(cls, intf_list = None,
667 config = default_config, options = default_options,
668 subnet = default_subnet_config):
669 '''Start the dhcpd server by generating the conf file'''
670 if intf_list is None:
671 intf_list = cls.relay_interfaces
672 ##stop dhcpd if already running
673 cls.dhcpd_stop()
674 dhcp_conf = cls.dhcpd_conf_generate(config = config, options = options,
675 subnet = subnet)
676 ##first touch dhcpd.leases if it doesn't exist
677 lease_file = '{}/dhcpd.leases'.format(cls.dhcp_data_dir)
678 if os.access(lease_file, os.F_OK) is False:
679 with open(lease_file, 'w') as fd: pass
680
681 conf_file = '{}/dhcpd.conf'.format(cls.dhcp_data_dir)
682 with open(conf_file, 'w') as fd:
683 fd.write(dhcp_conf)
684
685 #now configure the dhcpd interfaces for various subnets
686 index = 0
687 intf_info = []
688 for ip,_ in subnet:
689 intf = intf_list[index]
690 mac = cls.get_mac(intf)
691 intf_info.append((ip, mac))
692 index += 1
693 os.system('ifconfig {} {}'.format(intf, ip))
694
695 intf_str = ','.join(intf_list)
696 dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format(conf_file, lease_file, intf_str)
697 log_test.info('Starting DHCPD server with command: %s' %dhcpd_cmd)
698 ret = os.system(dhcpd_cmd)
699 assert_equal(ret, 0)
700 time.sleep(3)
701 cls.relay_interfaces_last = cls.relay_interfaces
702 cls.relay_interfaces = intf_list
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000703 cls.onos_dhcp_relay_load_1(*intf_info[0])
Thangavelu K S6432b522017-07-22 00:05:54 +0000704
705 @classmethod
706 def dhcpd_stop(cls):
707 os.system('pkill -9 dhcpd')
708 for intf in cls.relay_interfaces:
709 os.system('ifconfig {} 0'.format(intf))
710
711 cls.relay_interfaces = cls.relay_interfaces_last
712
713 @classmethod
714 def get_mac(cls, iface):
715 if cls.interface_to_mac_map.has_key(iface):
716 return cls.interface_to_mac_map[iface]
717 mac = get_mac(iface, pad = 0)
718 cls.interface_to_mac_map[iface] = mac
719 return mac
720
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000721 def send_recv(self, mac=None, update_seed = False, validate = True, dhcp_obj = None):
722 if dhcp_obj is None:
723 dhcp_obj = self.dhcp
724 cip, sip = dhcp_obj.discover(mac = mac, update_seed = update_seed)
Thangavelu K S6432b522017-07-22 00:05:54 +0000725 if validate:
726 assert_not_equal(cip, None)
727 assert_not_equal(sip, None)
728 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000729 (cip, sip, dhcp_obj.get_mac(cip)[0]))
Thangavelu K S6432b522017-07-22 00:05:54 +0000730 return cip,sip
731
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000732 def send_recv_function_in_thread(self, mac=None, update_seed = False, validate = False, dhcp_obj = None):
733 self.success = True
734 cip, sip = self.send_recv(mac=mac,update_seed=update_seed,validate=validate,dhcp_obj = dhcp_obj)
735 if cip is None or sip is None:
736 self.success = False
737
Thangavelu K S6432b522017-07-22 00:05:54 +0000738 @classmethod
739 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
740 subnet = default_subnet_config):
741 conf = ''
742 for k, v in config.items():
743 conf += '{} {};\n'.format(k, v)
744
745 opts = ''
746 for k, v in options:
747 opts += 'option {} {};\n'.format(k, v)
748
749 subnet_config = ''
750 for _, v in subnet:
751 subnet_config += '{}\n'.format(v)
752
753 return '{}{}{}'.format(conf, opts, subnet_config)
754
755 @classmethod
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000756 def onos_dhcp_relay_load_1(cls, server_ip, server_mac):
Thangavelu K S6432b522017-07-22 00:05:54 +0000757 relay_device_map = '{}/{}'.format(cls.relay_device_id, cls.relay_interface_port)
758 dhcp_dict = {'apps':{'org.onosproject.dhcp-relay':{'dhcprelay':
759 {'dhcpserverConnectPoint':relay_device_map,
760 'serverip':server_ip,
761 'servermac':server_mac
762 }
763 }
764 }
765 }
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000766 cls.onos_load_config(cls.app_dhcprelay,dhcp_dict)
Thangavelu K S6432b522017-07-22 00:05:54 +0000767 cls.configs['relay_config'] = dhcp_dict
768
769 @classmethod
770 def dhcp_relay_cleanup(cls):
771 ##reset the ONOS port configuration back to default
772 for config in cls.configs.items():
773 OnosCtrl.delete(config)
774 # if cls.onos_restartable is True:
775 # log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
776 # return cord_test_onos_restart(config = {})
777
778
Thangavelu K S8e413082017-07-13 20:02:14 +0000779 def tls_flow_check(self, olt_ports, cert_info = None, multiple_sub = False):
780 if multiple_sub is True:
781 olt_nni_port = olt_ports.tx_port
782 olt_uni_port = olt_ports.rx_port
783 else:
Thangavelu K S36edb012017-07-05 18:24:12 +0000784 olt_uni_port = olt_ports
785
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000786 def tls_fail_cb():
787 log_test.info('TLS verification failed')
788 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700789 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000790 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
791 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000792 if tls.failTest is True:
793 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000794 assert_equal(tls.failTest, False)
795 if cert_info == "no_cert":
796 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
797 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
798 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000799 if tls.failTest is False:
800 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000801 assert_equal(tls.failTest, True)
802 if cert_info == "invalid_cert":
803 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
804 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
805 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000806 if tls.failTest is False:
807 self.success = False
808 assert_equal(tls.failTest, True)
809 if cert_info == "same_cert":
810 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000811 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 +0000812 tls.runTest()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000813 if tls.failTest is True:
Thangavelu K S9648eed2017-06-13 20:15:25 +0000814 self.success = False
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000815 assert_equal(tls.failTest, False)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000816 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 +0000817 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 +0000818 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
819 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
820 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000821 if tls.failTest is False:
822 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000823 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000824 self.test_status = True
825 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700826
Thangavelu K S8e413082017-07-13 20:02:14 +0000827 def dhcp_flow_check(self, olt_ports, negative_test = None, multiple_sub = False):
828 if multiple_sub is True:
829 olt_nni_port = olt_ports.tx_port
830 onu_iface = olt_ports.rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +0000831 dhcp_server_startip = self.random_ip()
832 random_mac = '00:00:00:0a:0a:' + hex(random.randrange(50,254)).split('x')[1]
Thangavelu K S8e413082017-07-13 20:02:14 +0000833 else:
834 onu_iface = olt_ports
835 dhcp_server_startip = '10.10.10.20'
836 random_mac = None
Thangavelu K S735a6662017-06-15 18:08:23 +0000837 self.success = True
838
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000839 if negative_test is None:
Thangavelu K S36edb012017-07-05 18:24:12 +0000840 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = 'skip', startip = dhcp_server_startip, mac = random_mac)
841 if cip == None or sip == None:
Thangavelu K S735a6662017-06-15 18:08:23 +0000842 self.success = False
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000843 self.test_status = False
844 assert_not_equal(cip,None)
845 assert_not_equal(sip,None)
846 else:
847 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
848 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000849
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000850 if negative_test == "interrupting_dhcp_flows":
851 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
Thangavelu K S735a6662017-06-15 18:08:23 +0000852 if cip is not None:
853 self.success = False
854 assert_equal(cip,None)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000855 log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000856 self.test_status = True
857
858 if negative_test == "invalid_src_mac_broadcast":
859 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
860 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
861 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
862 self.onos_dhcp_table_load(config)
863 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
864 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000865
866 if cip is not None:
867 self.success = False
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000868 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 +0000869 assert_equal(cip,None)
870 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
871 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000872
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000873 if negative_test == "invalid_src_mac_multicast":
874 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
875 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
876 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
877 self.onos_dhcp_table_load(config)
878 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
879 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000880 if cip is not None:
881 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000882 assert_equal(cip,None)
883 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
884 self.test_status = True
885
886 if negative_test == "invalid_src_mac_junk":
887 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
888 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
889 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
890 self.onos_dhcp_table_load(config)
891 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
892 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000893 if cip is not None:
894 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000895 assert_equal(cip,None)
896 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
897 self.test_status = True
898
899 if negative_test == "request_release":
900 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
901 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
902 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
903 self.onos_dhcp_table_load(config)
904 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
905 cip, sip = self.dhcp_sndrcv(self.dhcp)
906 log_test.info('Releasing ip %s to server %s' %(cip, sip))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000907 if not self.dhcp.release(cip):
908 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000909 assert_equal(self.dhcp.release(cip), True)
910 log_test.info('Triggering DHCP discover again after release')
911 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
912 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000913 if not cip == cip2:
Thangavelu K S735a6662017-06-15 18:08:23 +0000914 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000915 assert_equal(cip, cip2)
916 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
917 assert_equal(self.dhcp.release(cip2), True)
918 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000919
Thangavelu K S735a6662017-06-15 18:08:23 +0000920 if negative_test == "starvation_positive":
921 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
922 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
923 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
924 self.onos_dhcp_table_load(config)
925 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
926 ip_map = {}
927 for i in range(10):
928 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
929 if ip_map.has_key(cip):
930 self.success = False
931 log_test.info('IP %s given out multiple times' %cip)
932 assert_equal(False, ip_map.has_key(cip))
933 ip_map[cip] = sip
934 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000935
Thangavelu K S735a6662017-06-15 18:08:23 +0000936 if negative_test == "starvation_negative":
937 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
938 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
939 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
940 self.onos_dhcp_table_load(config)
941 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
942 log_test.info('Verifying passitive case')
943 for x in xrange(50):
944 mac = RandMAC()._fix()
945 self.dhcp_sndrcv(self.dhcp,mac = mac)
946 log_test.info('Verifying negative case')
947 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000948 if cip or sip is not None:
949 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000950 assert_equal(cip, None)
951 assert_equal(sip, None)
952 self.test_status = True
953 self.success = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000954
Thangavelu K S735a6662017-06-15 18:08:23 +0000955 if negative_test == "multiple_discover":
956 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
957 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
958 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
959 self.onos_dhcp_table_load(config)
960 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
961 cip, sip, mac, _ = self.dhcp.only_discover()
962 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
963 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000964 if cip is None:
965 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000966 assert_not_equal(cip, None)
967 log_test.info('Triggering DHCP discover again.')
968 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000969 if not new_cip == cip:
970 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000971 assert_equal(new_cip, cip)
972 log_test.info('client got same IP as expected when sent 2nd discovery')
973 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000974 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000975 if negative_test == "multiple_requests":
976 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
977 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
978 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
979 self.onos_dhcp_table_load(config)
980 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
981 log_test.info('Sending DHCP discover and DHCP request.')
982 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
983 mac = self.dhcp.get_mac(cip)[0]
984 log_test.info("Sending DHCP request again.")
985 new_cip, new_sip = self.dhcp.only_request(cip, mac)
986 assert_equal(new_cip,cip)
987 log_test.info('server offered same IP to clain for multiple requests, as expected')
988 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000989# self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000990 if negative_test == "desired_ip_address":
991 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
992 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
993 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
994 self.onos_dhcp_table_load(config)
995 self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface)
996 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000997 if cip or sip is None:
998 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000999 assert_not_equal(cip, None)
1000 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1001 (cip, sip, mac))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001002 if not self.dhcp.seed_ip == cip:
1003 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001004 assert_equal(cip,self.dhcp.seed_ip)
1005 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
1006 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001007 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +00001008 if negative_test == "desired_out_of_pool_ip_address":
1009 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1010 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1011 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1012 self.onos_dhcp_table_load(config)
1013 self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface)
1014 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001015 if cip or sip is None:
1016 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001017 assert_not_equal(cip, None)
1018 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1019 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001020 if self.dhcp.seed_ip == cip:
1021 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001022 assert_not_equal(cip,self.dhcp.seed_ip)
1023 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
1024 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001025 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001026 if negative_test == "dhcp_renew":
1027 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1028 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1029 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1030 self.onos_dhcp_table_load(config)
1031 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1032 cip, sip, mac, _ = self.dhcp.only_discover()
1033 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1034 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001035 if cip or sip is None:
1036 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001037 assert_not_equal(cip, None)
1038 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
1039 log_test.info('waiting renew time %d seconds to send next request packet'%lval)
1040 time.sleep(lval)
1041 latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001042 if not latest_cip == cip:
1043 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001044 assert_equal(latest_cip,cip)
1045 log_test.info('client got same IP after renew time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001046 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001047 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001048 if negative_test == "dhcp_rebind":
1049 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1050 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1051 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1052 self.onos_dhcp_table_load(config)
1053 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1054 cip, sip, mac, _ = self.dhcp.only_discover()
1055 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1056 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001057 if cip or sip is None:
1058 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001059 assert_not_equal(cip, None)
1060 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
1061 log_test.info('waiting rebind time %d seconds to send next request packet'%lval)
1062 time.sleep(lval)
1063 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001064 if not latest_cip == cip:
1065 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001066 assert_equal(latest_cip,cip)
1067 log_test.info('client got same IP after rebind time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001068 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001069 # self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001070 return self.test_status
1071
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00001072 def dhcprelay_flow_check(self, seed_ip = None, iface = None, mac= None, test_scenario = None):
1073 self.success = True
1074 if test_scenario is None:
1075 self.dhcp = DHCPTest(seed_ip = seed_ip, iface = iface)
1076 self.send_recv(mac=mac)
1077 elif test_scenario == 'multiple_discover':
1078 self.dhcp_2 = DHCPTest(seed_ip = seed_ip, iface = iface)
1079 cip, sip, mac, _ = self.dhcp_2.only_discover(mac=mac)
1080 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCP REQUEST.' %
1081 (cip, sip, mac) )
1082 if cip is None:
1083 self.success = False
1084 assert_not_equal(cip, None)
1085 log_test.info('Triggering DHCP discover again.')
1086 new_cip, new_sip, new_mac, _ = self.dhcp_2.only_discover(mac=mac)
1087 if new_cip != cip:
1088 self.success = False
1089 assert_equal(new_cip, cip)
1090 log_test.info('Got same ip to same the client when sent discover again, as expected')
1091
1092 elif test_scenario == 'desired_ip':
1093 self.dhcp_3 = DHCPTest(seed_ip = '192.168.1.31', iface = iface)
1094 cip, sip, mac, _ = self.dhcp_3.only_discover(mac=mac,desired = True)
1095 if cip != self.dhcp_3.seed_ip:
1096 self.success = False
1097 assert_equal(cip,self.dhcp_3.seed_ip)
1098 log_test.info('Got dhcp client desired IP %s from server %s for mac %s as expected' %
1099 (cip, sip, mac) )
1100
1101 elif test_scenario == 'out_of_pool_ip':
1102 self.dhcp = DHCPTest(seed_ip = '20.20.20.35', iface = iface)
1103 cip, sip, mac, _ = self.dhcp.only_discover(mac= mac,desired = True)
1104 if cip is None or cip == self.dhcp.seed_ip:
1105 self.success = False
1106 assert_not_equal(cip,None)
1107 assert_not_equal(cip,self.dhcp.seed_ip)
1108 log_test.info('server offered IP from its pool when requested out of pool IP, as expected')
1109 elif test_scenario == 'multiple_discover_1':
1110 pass
1111 return self.success
1112
Thangavelu K S8e413082017-07-13 20:02:14 +00001113 def recv_channel_cb(self, pkt):
1114 ##First verify that we have received the packet for the joined instance
1115 chan = self.subscriber.caddr(pkt[IP].dst)
1116 assert_equal(chan in self.subscriber.join_map.keys(), True)
1117 recv_time = monotonic.monotonic() * 1000000
1118 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
1119 delta = recv_time - join_time
1120 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
1121 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
1122 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
1123 self.test_status = True
Thangavelu K S36edb012017-07-05 18:24:12 +00001124
Thangavelu K S8e413082017-07-13 20:02:14 +00001125 def traffic_verify(self, subscriber):
1126 # if subscriber.has_service('TRAFFIC'):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001127 url = 'http://www.google.com'
1128 resp = requests.get(url)
1129 self.test_status = resp.ok
1130 if resp.ok == False:
1131 log_test.info('Subscriber %s failed get from url %s with status code %d'
1132 %(subscriber.name, url, resp.status_code))
1133 else:
1134 log_test.info('GET request from %s succeeded for subscriber %s'
1135 %(url, subscriber.name))
1136 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001137
Thangavelu K S8e413082017-07-13 20:02:14 +00001138 def igmp_flow_check(self, subscriber, multiple_sub = False):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001139 chan = 0
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001140 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1141 if subscriber.num_channels == 1:
Thangavelu K S9a637332017-08-01 23:22:23 +00001142 if i != 0:
1143 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001144 chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1145 else:
1146 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1147 self.num_joins += 1
1148 while self.num_joins < self.num_subscribers:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001149 time.sleep(5)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001150 log_test.info('All subscribers have joined the channel')
1151 # for i in range(1):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001152 time.sleep(0.5)
1153 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1154 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1155 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
1156 time.sleep(5)
1157# 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 +00001158 if subscriber.num_channels == 1:
1159 pass
1160 elif chan != 0:
1161 #Should not receive packets for this channel
1162 self.recv_timeout = True
1163 subscriber.recv_timeout = True
1164 subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1165 subscriber.recv_timeout = False
1166 self.recv_timeout = False
Thangavelu K S9a637332017-08-01 23:22:23 +00001167 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 +00001168# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K S9a637332017-08-01 23:22:23 +00001169# chan = subscriber.num_channels - i
1170# self.test_status = True
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001171 return self.test_status
Thangavelu K S9a637332017-08-01 23:22:23 +00001172
1173 def igmp_join_next_channel_flow_check(self, subscriber, multiple_sub = False):
1174 chan = 0
1175 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1176# if subscriber.num_channels == 1:
1177# chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1178# else:
1179 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1180 self.num_joins += 1
1181 while self.num_joins < self.num_subscribers:
1182 time.sleep(5)
1183 log_test.info('All subscribers have joined the channel')
1184 # for i in range(1):
1185 time.sleep(0.5)
1186 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1187 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1188 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
1189 time.sleep(5)
1190# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1191# if subscriber.num_channels == 1:
1192# pass
1193# elif chan != 0:
1194# pass
1195 #Should not receive packets for this channel
1196# log_test.info
1197# self.recv_timeout = True
1198# subscriber.recv_timeout = True
1199# subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1200# subscriber.recv_timeout = False
1201# self.recv_timeout = False
1202# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1203# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001204 chan = subscriber.num_channels - i
Thangavelu K S8e413082017-07-13 20:02:14 +00001205# self.test_status = True
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00001206 return self.test_status
1207
Thangavelu K S36edb012017-07-05 18:24:12 +00001208
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001209 def igmp_leave_flow_check(self, subscriber, multiple_sub = False):
1210 chan = 0
1211 for i in range(self.VOLTHA_IGMP_ITERATIONS):
1212 subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1213 self.num_joins += 1
1214 while self.num_joins < self.num_subscribers:
1215 time.sleep(5)
1216 log_test.info('All subscribers have joined the channel')
1217# for i in range(1):
1218 time.sleep(0.5)
1219 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1220 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1221 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1222 time.sleep(10)
1223# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1224 #Should not receive packets for this subscriber
1225 self.recv_timeout = True
1226 subscriber.recv_timeout = True
1227 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1228 subscriber.recv_timeout = False
1229 self.recv_timeout = False
1230# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1231# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1232# self.test_status = True
1233 return self.test_status
1234
1235
Thangavelu K S8e413082017-07-13 20:02:14 +00001236 def igmp_flow_check_join_change_to_exclude(self, subscriber, multiple_sub = False):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001237 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001238 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1239 for i in range(3):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001240 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
Thangavelu K S9a637332017-08-01 23:22:23 +00001241 self.num_joins += 1
1242 while self.num_joins < self.num_subscribers:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001243 time.sleep(5)
Thangavelu K S9a637332017-08-01 23:22:23 +00001244 log_test.info('All subscribers have joined the channel')
1245 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1246 time.sleep(5)
1247 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]))
1248 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1249 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1250 time.sleep(60)
1251 self.recv_timeout = False
1252 subscriber.recv_timeout = False
1253 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1254 if self.test_status is True:
1255 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1256 if self.test_status is False:
1257 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1258 continue
1259 subscriber.recv_timeout = False
1260 self.recv_timeout = False
1261 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001262# self.test_status = True
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001263 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001264
Thangavelu K S8e413082017-07-13 20:02:14 +00001265 def igmp_flow_check_join_change_to_exclude_again_include_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001266 chan = 0
1267 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1268 for i in range(3):
1269 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1270 self.num_joins += 1
1271 while self.num_joins < self.num_subscribers:
1272 time.sleep(5)
1273 log_test.info('All subscribers have joined the channel')
1274 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1275 time.sleep(5)
1276 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]))
1277 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1278 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1279 time.sleep(60)
1280 self.recv_timeout = False
1281 subscriber.recv_timeout = False
1282 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1283 if self.test_status is True:
1284 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1285 if self.test_status is False:
1286 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1287 continue
1288 subscriber.recv_timeout = False
1289 self.recv_timeout = False
1290 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1291 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_INCLUDE)
1292 time.sleep(5)
1293# self.recv_timeout = True
1294# subscriber.recv_timeout = True
1295 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1296 subscriber.recv_timeout = False
1297 self.recv_timeout = False
1298
1299
1300 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1301# self.test_status = True
1302 return self.test_status
1303
Thangavelu K S8e413082017-07-13 20:02:14 +00001304 def igmp_flow_check_join_change_to_block(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001305 chan = 0
1306 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1307 for i in range(3):
1308 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1309 self.num_joins += 1
1310 while self.num_joins < self.num_subscribers:
1311 time.sleep(5)
1312 log_test.info('All subscribers have joined the channel')
1313 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1314 time.sleep(5)
1315 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]))
1316 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_BLOCK_OLD)
1317 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1318 time.sleep(60)
1319 self.recv_timeout = False
1320 subscriber.recv_timeout = False
1321 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1322 if self.test_status is True:
1323 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1324 if self.test_status is False:
1325 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1326 continue
1327 subscriber.recv_timeout = False
1328 self.recv_timeout = False
1329 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1330# self.test_status = True
1331 return self.test_status
1332
Thangavelu K S36edb012017-07-05 18:24:12 +00001333
Thangavelu K S8e413082017-07-13 20:02:14 +00001334 def igmp_flow_check_join_change_to_block_again_allow_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001335 chan = 0
1336 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1337 for i in range(3):
1338 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1339 self.num_joins += 1
1340 while self.num_joins < self.num_subscribers:
1341 time.sleep(5)
1342 log_test.info('All subscribers have joined the channel')
1343 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1344 time.sleep(5)
1345 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]))
1346 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1347 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1348 time.sleep(60)
1349 self.recv_timeout = False
1350 subscriber.recv_timeout = False
1351 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1352 if self.test_status is True:
1353 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1354 if self.test_status is False:
1355 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1356 continue
1357 subscriber.recv_timeout = False
1358 self.recv_timeout = False
1359 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1360 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_ALLOW_NEW)
1361 time.sleep(5)
1362# self.recv_timeout = True
1363# subscriber.recv_timeout = True
1364 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1365 subscriber.recv_timeout = False
1366 self.recv_timeout = False
1367
1368
1369 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1370# self.test_status = True
1371 return self.test_status
Thangavelu K S8e413082017-07-13 20:02:14 +00001372
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001373 def igmp_flow_check_group_include_source_empty_list(self, subscriber, multiple_sub = False):
1374 chan = 0
1375 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1376 self.num_joins += 1
1377 while self.num_joins < self.num_subscribers:
1378 time.sleep(5)
1379 log_test.info('All subscribers have joined the channel')
1380 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 +00001381 if self.test_status is True:
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001382 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1383 self.test_status = False
1384 else:
1385 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 +00001386 self.test_status = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001387 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 subscriber.recv_timeout = False
1391 self.recv_timeout = False
1392 return self.test_status
1393
1394 def igmp_flow_check_group_exclude_source_empty_list(self, subscriber, multiple_sub = False):
1395 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001396 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1397 self.num_joins += 1
1398 while self.num_joins < self.num_subscribers:
1399 time.sleep(5)
1400 log_test.info('All subscribers have joined the channel')
1401 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1402 if self.test_status is True:
1403 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1404 self.test_status = False
1405 else:
1406 log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port))
1407 self.test_status = True
1408
1409 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1410 log_test.info('Send join to multicast group with exclude empty source list and waited till GMI timer expires')
1411 time.sleep(60)
1412
1413 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1414 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1415 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1416 time.sleep(5)
1417 subscriber.recv_timeout = False
1418 self.recv_timeout = False
1419 return self.test_status
1420
1421 def igmp_flow_check_group_exclude_source_empty_list_1(self, subscriber, multiple_sub = False):
1422 chan = 0
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001423 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list,record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1424 self.num_joins += 1
1425 while self.num_joins < self.num_subscribers:
1426 time.sleep(5)
1427 log_test.info('All subscribers have joined the channel')
1428 for i in range(10):
1429 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1430 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1431 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1432 time.sleep(5)
1433 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1434 #Should not receive packets for this subscriber
1435 self.recv_timeout = True
1436 subscriber.recv_timeout = True
1437 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1438 subscriber.recv_timeout = False
1439 self.recv_timeout = False
1440 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1441 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1442# self.test_status = True
1443 return self.test_status
1444
1445 def igmp_flow_check_during_olt_onu_operational_issues(self, subscriber, multiple_sub = False):
1446 chan = 0
1447 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1448 self.num_joins += 1
1449 while self.num_joins < self.num_subscribers:
1450 time.sleep(5)
1451 log_test.info('All subscribers have joined the channel')
1452 for i in range(2):
1453 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1454 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1455 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1456 time.sleep(5)
1457 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1458 #Should not receive packets for this subscriber
1459 self.recv_timeout = True
1460 subscriber.recv_timeout = True
1461 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1462 subscriber.recv_timeout = False
1463 self.recv_timeout = False
1464 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1465 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1466# self.test_status = True
1467 return self.test_status
1468
Thangavelu K S8e413082017-07-13 20:02:14 +00001469 def voltha_igmp_jump_verify(self, subscriber):
1470 if subscriber.has_service('IGMP'):
1471 for i in xrange(subscriber.num):
1472 log_test.info('Subscriber %s jumping channel' %subscriber.name)
1473 chan = subscriber.channel_jump(delay=0)
1474 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
1475 log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1476 time.sleep(3)
1477 log_test.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats))
1478 self.test_status = True
1479 return self.test_status
1480
1481 def voltha_igmp_next_verify(self, subscriber):
1482 for c in xrange(self.VOLTHA_IGMP_ITERATIONS):
1483 for i in xrange(subscriber.num):
1484 if i:
1485 chan = subscriber.channel_join_next(delay=0, leave_flag = self.leave_flag)
1486 time.sleep(0.2)
1487 else:
1488 chan = subscriber.channel_join(i, delay=0)
1489 time.sleep(0.2)
1490 if subscriber.num == 1:
1491 subscriber.channel_leave(chan)
1492 log_test.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
1493 #subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
1494 #log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1495 self.test_status = True
1496 return self.test_status
1497
1498 def voltha_subscribers(self, services, cbs = None, num_subscribers = 1, num_channels = 1, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +00001499 """Test subscriber join next for channel surfing"""
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001500 voltha = VolthaCtrl(self.VOLTHA_HOST,
1501 rest_port = self.VOLTHA_REST_PORT,
1502 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S36edb012017-07-05 18:24:12 +00001503 if self.VOLTHA_OLT_TYPE.startswith('ponsim'):
A R Karthick168e2342017-08-15 16:13:10 -07001504 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S36edb012017-07-05 18:24:12 +00001505 log_test.info('Enabling ponsim olt')
1506 device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001507 if device_id != '':
1508 self.olt_device_id = device_id
Thangavelu K S36edb012017-07-05 18:24:12 +00001509 else:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001510 log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution')
1511 assert_equal(False, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00001512
1513 assert_not_equal(device_id, None)
1514 if status == False:
1515 voltha.disable_device(device_id, delete = True)
1516 assert_equal(status, True)
1517 time.sleep(10)
1518 switch_map = None
1519 olt_configured = False
1520 try:
1521 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1522 if not switch_map:
1523 log_test.info('No voltha devices found')
1524 return
1525 log_test.info('Installing OLT app')
1526 OnosCtrl.install_app(self.olt_app_file)
1527 time.sleep(5)
1528 log_test.info('Adding subscribers through OLT app')
1529 self.config_olt(switch_map)
1530 olt_configured = True
1531 time.sleep(5)
1532 self.num_subscribers = num_subscribers
1533 self.num_channels = num_channels
1534 test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers,
1535 num_channels = self.num_channels,
1536 cbs = cbs,
1537 port_list = self.generate_port_list(self.num_subscribers,
1538 self.num_channels),
Thangavelu K S8e413082017-07-13 20:02:14 +00001539 src_list = src_list, services = services)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001540 if test_status is False:
1541 self.success = False
Thangavelu K S36edb012017-07-05 18:24:12 +00001542 assert_equal(test_status, True)
1543 finally:
1544 if switch_map is not None:
1545 if olt_configured is True:
1546 self.remove_olt(switch_map)
1547 voltha.disable_device(device_id, delete = True)
1548 time.sleep(10)
1549 log_test.info('Uninstalling OLT app')
1550 OnosCtrl.uninstall_app(self.olt_app_name)
1551
Thangavelu K S8e413082017-07-13 20:02:14 +00001552 def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1,
1553 channel_start = 0, cbs = None, port_list = [], src_list = None,
Thangavelu K S36edb012017-07-05 18:24:12 +00001554 services = None, negative_subscriber_auth = None):
1555 self.test_status = False
1556 self.ovs_cleanup()
1557 subscribers_count = num_subscribers
1558 sub_loop_count = num_subscribers
1559 if not port_list:
1560 port_list = self.generate_port_list(num_subscribers, num_channels)
1561 subscriber_tx_rx_ports = []
1562 for i in range(num_subscribers):
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001563 subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map[port_list[i][0]],
1564 rx_port = self.port_map[port_list[i][1]],
Thangavelu K S8e413082017-07-13 20:02:14 +00001565 num_channels = num_channels,src_list = src_list,))
Thangavelu K S36edb012017-07-05 18:24:12 +00001566 self.onos_aaa_load()
Thangavelu K S8e413082017-07-13 20:02:14 +00001567 #load the ssm list for all subscriber channels
1568 igmpChannel = IgmpChannel(src_list = src_list)
1569 ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports)
1570 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
Thangavelu K S6432b522017-07-22 00:05:54 +00001571 if src_list is None:
1572 igmpChannel = IgmpChannel()
1573 igmpChannel.igmp_load_ssm_config(ssm_list)
1574 else:
1575 igmpChannel = IgmpChannel(src_list = src_list)
1576 igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001577
Thangavelu K S36edb012017-07-05 18:24:12 +00001578 self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1)
1579
1580 chan_leave = False #for single channel, multiple subscribers
1581 if cbs is None:
1582 cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check)
1583 chan_leave = True
1584 for subscriber in subscriber_tx_rx_ports:
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001585 if 'IGMP' in services:
1586# if src_list:
1587# for i in range(len(src_list)):
1588# subscriber.start(src_ip = src_list[i])
1589# else:
1590# subscriber.start()
1591 subscriber.start()
Thangavelu K S36edb012017-07-05 18:24:12 +00001592 sub_loop_count = sub_loop_count - 1
1593 pool_object = voltha_subscriber_pool(subscriber, cbs)
1594 self.thread_pool.addTask(pool_object.pool_cb)
1595 self.thread_pool.cleanUpThreads()
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001596 for subscriber in subscriber_tx_rx_ports:
1597 if services and 'IGMP' in services:
1598# if src_list:
1599# for i in range(len(src_list)):
1600# subscriber.stop(src_ip = src_list[i])
1601# else:
1602# subscriber.stop()
1603 subscriber.stop()
1604 if chan_leave is True:
1605 subscriber.channel_leave(0)
Thangavelu K S36edb012017-07-05 18:24:12 +00001606 subscribers_count = 0
1607 return self.test_status
1608
1609
1610 def generate_port_list(self, subscribers, channels):
1611 return self.port_list[:subscribers]
1612
Thangavelu K S36edb012017-07-05 18:24:12 +00001613 @classmethod
1614 def ovs_cleanup(cls):
1615 ##For every test case, delete all the OVS groups
1616 cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1'
1617 try:
1618 cord_test_shell(cmd)
1619 ##Since olt config is used for this test, we just fire a careless local cmd as well
1620 os.system(cmd)
1621 finally:
1622 return
1623
A.R Karthick8a507cf2017-06-02 18:44:49 -07001624 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -07001625 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -07001626 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
1627 assert_not_equal(device_id, None)
1628 try:
1629 assert_equal(status, True)
1630 time.sleep(10)
1631 finally:
1632 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001633
A.R Karthick8a507cf2017-06-02 18:44:49 -07001634 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001635 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001636 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -07001637 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1638 assert_not_equal(device_id, None)
1639 try:
1640 assert_equal(status, True)
1641 time.sleep(10)
1642 finally:
1643 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001644
A R Karthick31a40172017-08-14 12:06:09 -07001645 def test_maple_enable_disable(self):
1646 log_test.info('Enabling maple olt')
1647 if self.VOLTHA_OLT_IP:
1648 address = self.VOLTHA_OLT_IP
1649 device_id, status = self.voltha.enable_device('maple_olt', address = address)
1650 assert_not_equal(device_id, None)
1651 try:
1652 assert_equal(status, True)
1653 time.sleep(10)
1654 finally:
1655 self.voltha.disable_device(device_id, delete = True)
1656
Thangavelu K S008f38e2017-05-15 19:36:55 +00001657 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
1658 """
1659 Test Method:
1660 0. Make sure that voltha is up and running on CORD-POD setup.
1661 1. OLT and ONU is detected and validated.
1662 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1663 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
1664 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
1665 5. Verify that subscriber is authenticated successfully.
1666 """
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001667 ret = voltha_setup(
1668 host = self.VOLTHA_HOST,
A R Karthick168e2342017-08-15 16:13:10 -07001669 ponsim_host = self.VOLTHA_PONSIM_HOST,
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001670 rest_port = self.VOLTHA_REST_PORT,
1671 olt_type = 'ponsim_olt',
1672 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP,
1673 uplink_vlan_start = self.VOLTHA_UPLINK_VLAN_START,
1674 config_fake = self.VOLTHA_CONFIG_FAKE,
1675 olt_app = self.olt_app_file)
1676 assert_not_equal(ret, None)
A R Karthick18d0fb62017-09-01 18:49:07 -07001677 voltha, device_id, switch_map, preconfigured = ret[0], ret[1], ret[2], ret[3]
1678 if self.VOLTHA_TEARDOWN is False:
1679 preconfigured = True
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001680 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001681 log_test.info('Adding subscribers through OLT app')
1682 self.config_olt(switch_map)
1683 olt_configured = True
1684 time.sleep(5)
1685 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001686 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001687 finally:
A R Karthick18d0fb62017-09-01 18:49:07 -07001688 if switch_map is not None and preconfigured is False:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001689 if olt_configured is True:
1690 self.remove_olt(switch_map)
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001691 voltha_teardown(voltha, device_id, switch_map, olt_app = self.olt_app_file)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001692
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001693 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001694 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
1695 """
1696 Test Method:
1697 0. Make sure that voltha is up and running on CORD-POD setup.
1698 1. OLT and ONU is detected and validated.
1699 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1700 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1701 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
1702 5. Verify that subscriber authentication is unsuccessful..
1703 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001704 df = defer.Deferred()
1705 def tls_flow_check_with_no_cert_scenario(df):
1706 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001707 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001708 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1709 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001710 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001711 time.sleep(10)
1712 switch_map = None
1713 olt_configured = False
1714 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1715 log_test.info('Installing OLT app')
1716 OnosCtrl.install_app(self.olt_app_file)
1717 time.sleep(5)
1718 log_test.info('Adding subscribers through OLT app')
1719 self.config_olt(switch_map)
1720 olt_configured = True
1721 time.sleep(5)
1722 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1723 try:
1724 assert_equal(auth_status, True)
1725 assert_equal(status, True)
1726 time.sleep(10)
1727 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001728 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001729 self.voltha.disable_device(device_id, delete = True)
1730 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001731
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001732 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1733 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001734
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001735 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001736 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
1737 """
1738 Test Method:
1739 0. Make sure that voltha is up and running on CORD-POD setup.
1740 1. OLT and ONU is detected and validated.
1741 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1742 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
1743 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1744 5. Verify that subscriber authentication is unsuccessful..
1745 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001746 df = defer.Deferred()
1747 def tls_flow_check_with_invalid_cert_scenario(df):
1748 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001749 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001750 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1751 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001752 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001753 time.sleep(10)
1754 switch_map = None
1755 olt_configured = False
1756 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1757 log_test.info('Installing OLT app')
1758 OnosCtrl.install_app(self.olt_app_file)
1759 time.sleep(5)
1760 log_test.info('Adding subscribers through OLT app')
1761 self.config_olt(switch_map)
1762 olt_configured = True
1763 time.sleep(5)
1764 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1765 try:
1766 assert_equal(auth_status, True)
1767 assert_equal(status, True)
1768 time.sleep(10)
1769 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001770 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001771 self.voltha.disable_device(device_id, delete = True)
1772 df.callback(0)
1773 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
1774 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001775
Thangavelu K S0d745c82017-06-09 21:56:08 +00001776 @deferred(TESTCASE_TIMEOUT)
1777 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
1778 """
1779 Test Method:
1780 0. Make sure that voltha is up and running on CORD-POD setup.
1781 1. OLT and ONU is detected and validated.
1782 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1783 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
1784 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1785 5. Verify that subscriber authentication is unsuccessful..
1786 """
1787 df = defer.Deferred()
1788 def tls_flow_check_with_no_cert_scenario(df):
1789 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001790 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001791 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1792 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001793 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001794 time.sleep(10)
1795 switch_map = None
1796 olt_configured = False
1797 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1798 log_test.info('Installing OLT app')
1799 OnosCtrl.install_app(self.olt_app_file)
1800 time.sleep(5)
1801 log_test.info('Adding subscribers through OLT app')
1802 self.config_olt(switch_map)
1803 olt_configured = True
1804 time.sleep(5)
1805 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1806 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1807 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1808 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1809 try:
1810 assert_equal(auth_status, True)
1811 assert_equal(status, True)
1812 time.sleep(10)
1813 finally:
1814 self.voltha.disable_device(device_id, delete = True)
1815 df.callback(0)
1816 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1817 return df
1818
1819 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001820 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
1821 """
1822 Test Method:
1823 0. Make sure that voltha is up and running on CORD-POD setup.
1824 1. OLT and ONU is detected and validated.
1825 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1826 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1827 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
1828 5. Verify that subscriber authentication is unsuccessful..
1829 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001830 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001831 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001832 aaa_app = ["org.opencord.aaa"]
1833 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001834 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001835 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1836 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001837 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001838 time.sleep(10)
1839 switch_map = None
1840 olt_configured = False
1841 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1842 log_test.info('Installing OLT app')
1843 OnosCtrl.install_app(self.olt_app_file)
1844 time.sleep(5)
1845 log_test.info('Adding subscribers through OLT app')
1846 self.config_olt(switch_map)
1847 olt_configured = True
1848 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001849
Thangavelu K S0d745c82017-06-09 21:56:08 +00001850 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
1851 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
1852 thread1.start()
1853 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001854 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001855 thread2.start()
1856 time.sleep(10)
1857 thread1.join()
1858 thread2.join()
1859 try:
1860 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001861 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001862 time.sleep(10)
1863 finally:
1864 self.voltha.disable_device(device_id, delete = True)
1865 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001866 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001867 return df
1868
1869 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001870 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
1871 """
1872 Test Method:
1873 0. Make sure that voltha is up and running on CORD-POD setup.
1874 1. OLT and ONU is detected and validated.
1875 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1876 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1877 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
1878 5. Verify that subscriber authentication is unsuccessful..
1879 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001880 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001881 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001882 aaa_app = ["org.opencord.aaa"]
1883 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001884 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001885 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1886 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001887 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001888 time.sleep(10)
1889 switch_map = None
1890 olt_configured = False
1891 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1892 log_test.info('Installing OLT app')
1893 OnosCtrl.install_app(self.olt_app_file)
1894 time.sleep(5)
1895 log_test.info('Adding subscribers through OLT app')
1896 self.config_olt(switch_map)
1897 olt_configured = True
1898 time.sleep(5)
1899
1900 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
1901 thread2 = threading.Thread(target = cord_test_radius_restart)
1902 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001903 time.sleep(randint(1,2))
1904 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001905 thread2.start()
1906 time.sleep(10)
1907 thread1.join()
1908 thread2.join()
1909 try:
1910 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001911 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001912 time.sleep(10)
1913 finally:
1914 self.voltha.disable_device(device_id, delete = True)
1915 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001916 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001917 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001918
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001919 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001920 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
1921 """
1922 Test Method:
1923 0. Make sure that voltha is up and running on CORD-POD setup.
1924 1. OLT and ONU is detected and validated.
1925 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1926 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1927 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1928 6. Verify that subscriber authenticated successfully.
1929 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
1930 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1931 9. Verify that subscriber authentication is unsuccessful..
1932 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001933 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001934 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001935 aaa_app = ["org.opencord.aaa"]
1936 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001937 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001938 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1939 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001940 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001941 time.sleep(10)
1942 switch_map = None
1943 olt_configured = False
1944 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1945 log_test.info('Installing OLT app')
1946 OnosCtrl.install_app(self.olt_app_file)
1947 time.sleep(5)
1948 log_test.info('Adding subscribers through OLT app')
1949 self.config_olt(switch_map)
1950 olt_configured = True
1951 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001952
Thangavelu K S0d745c82017-06-09 21:56:08 +00001953 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001954 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +00001955 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001956 time.sleep(randint(1,2))
1957 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001958 thread2.start()
1959 time.sleep(10)
1960 thread1.join()
1961 thread2.join()
1962 try:
1963 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001964 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001965 time.sleep(10)
1966 finally:
1967 self.voltha.disable_device(device_id, delete = True)
1968 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001969 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001970 return df
1971
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001972 @deferred(TESTCASE_TIMEOUT)
1973 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001974 """
1975 Test Method:
1976 0. Make sure that voltha is up and running on CORD-POD setup.
1977 1. OLT and ONU is detected and validated.
1978 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1979 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1980 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1981 6. Verify that subscriber authenticated successfully.
1982 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1983 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1984 9. Verify that subscriber authentication is unsuccessful..
1985 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001986 df = defer.Deferred()
1987 def tls_flow_check_operating_olt_state(df):
1988 aaa_app = ["org.opencord.aaa"]
1989 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001990 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001991 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1992 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001993 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001994 time.sleep(10)
1995 switch_map = None
1996 olt_configured = False
1997 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1998 log_test.info('Installing OLT app')
1999 OnosCtrl.install_app(self.olt_app_file)
2000 time.sleep(5)
2001 log_test.info('Adding subscribers through OLT app')
2002 self.config_olt(switch_map)
2003 olt_configured = True
2004 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002005
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002006 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
2007 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
2008 thread1.start()
2009 time.sleep(randint(1,2))
2010 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
2011 thread2.start()
2012 time.sleep(10)
2013 thread1.join()
2014 thread2.join()
2015 try:
2016 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002017 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002018 time.sleep(10)
2019 finally:
2020 self.voltha.disable_device(device_id, delete = True)
2021 df.callback(0)
2022 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2023 return df
2024
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002025 @deferred(TESTCASE_TIMEOUT +600)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002026 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self):
2027 """
2028 Test Method:
2029 0. Make sure that voltha is up and running on CORD-POD setup.
2030 1. OLT and ONU is detected and validated.
2031 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2032 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2033 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2034 6. Verify that subscriber authenticated successfully.
2035 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
2036 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2037 9. Verify that subscriber authentication is unsuccessful..
2038 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2039
2040 """
2041 df = defer.Deferred()
2042 no_iterations = 10
2043 def tls_flow_check_with_disable_olt_device_scenario(df):
2044 aaa_app = ["org.opencord.aaa"]
2045 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002046 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002047 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2048 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002049 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002050 time.sleep(10)
2051 switch_map = None
2052 olt_configured = False
2053 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2054 log_test.info('Installing OLT app')
2055 OnosCtrl.install_app(self.olt_app_file)
2056 time.sleep(5)
2057 log_test.info('Adding subscribers through OLT app')
2058 self.config_olt(switch_map)
2059 olt_configured = True
2060 time.sleep(5)
2061 for i in range(no_iterations):
2062 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 +00002063 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002064 thread1.start()
2065 time.sleep(randint(1,2))
2066 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
2067 thread2.start()
2068 time.sleep(10)
2069 thread1.join()
2070 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002071 time.sleep(60)
2072 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002073 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2074 try:
2075 # assert_equal(status, True)
2076 assert_equal(auth_status, True)
2077 assert_equal(self.success, True)
2078 time.sleep(10)
2079 finally:
2080 self.voltha.disable_device(device_id, delete = True)
2081 df.callback(0)
2082 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2083 return df
2084
2085 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002086 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
2087 """
2088 Test Method:
2089 0. Make sure that voltha is up and running on CORD-POD setup.
2090 1. OLT and ONU is detected and validated.
2091 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2092 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2093 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2094 6. Verify that subscriber authenticated successfully.
2095 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2096 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2097 9. Verify that subscriber authentication is unsuccessful..
2098 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002099 df = defer.Deferred()
2100 def tls_flow_check_operating_olt_state(df):
2101 aaa_app = ["org.opencord.aaa"]
2102 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002103 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002104 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2105 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002106 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002107 time.sleep(10)
2108 switch_map = None
2109 olt_configured = False
2110 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2111 log_test.info('Installing OLT app')
2112 OnosCtrl.install_app(self.olt_app_file)
2113 time.sleep(5)
2114 log_test.info('Adding subscribers through OLT app')
2115 self.config_olt(switch_map)
2116 olt_configured = True
2117 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002118
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002119 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2120 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2121 thread1.start()
2122 time.sleep(randint(1,2))
2123 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2124 thread2.start()
2125 time.sleep(10)
2126 thread1.join()
2127 thread2.join()
2128 try:
2129 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002130 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002131 time.sleep(10)
2132 finally:
2133 self.voltha.disable_device(device_id, delete = True)
2134 df.callback(0)
2135 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2136 return df
2137
2138 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002139 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self):
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002140 """
2141 Test Method:
2142 0. Make sure that voltha is up and running on CORD-POD setup.
2143 1. OLT and ONU is detected and validated.
2144 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2145 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2146 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2147 6. Verify that subscriber authenticated successfully.
2148 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2149 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2150 9. Verify that subscriber authentication is unsuccessful..
2151 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2152 """
2153 df = defer.Deferred()
2154 no_iterations = 10
2155 def tls_flow_check_with_disable_olt_device_scenario(df):
2156 aaa_app = ["org.opencord.aaa"]
2157 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002158 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002159 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2160 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002161 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002162 time.sleep(10)
2163 switch_map = None
2164 olt_configured = False
2165 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2166 log_test.info('Installing OLT app')
2167 OnosCtrl.install_app(self.olt_app_file)
2168 time.sleep(5)
2169 log_test.info('Adding subscribers through OLT app')
2170 self.config_olt(switch_map)
2171 olt_configured = True
2172 time.sleep(5)
2173 for i in range(no_iterations):
2174 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2175 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2176 thread1.start()
2177 time.sleep(randint(1,2))
2178 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2179 thread2.start()
2180 time.sleep(10)
2181 thread1.join()
2182 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002183 time.sleep(60)
2184 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002185 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2186 try:
2187 # assert_equal(status, True)
2188 assert_equal(auth_status, True)
2189 assert_equal(self.success, True)
2190 time.sleep(10)
2191 finally:
2192 self.voltha.disable_device(device_id, delete = True)
2193 df.callback(0)
2194 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2195 return df
2196
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002197 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002198 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
2199 """
2200 Test Method:
2201 0. Make sure that voltha is up and running on CORD-POD setup.
2202 1. OLT and ONU is detected and validated.
2203 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2204 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2205 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2206 6. Verify that subscriber authenticated successfully.
2207 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2208 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2209 9. Verify that subscriber authentication is unsuccessful..
2210 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002211 df = defer.Deferred()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002212 def tls_flow_check_operating_onu_state(df):
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002213 aaa_app = ["org.opencord.aaa"]
2214 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002215 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002216 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2217 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00002218 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2219
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002220 onu_device_id = devices_list['items'][1]['id']
2221 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002222 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002223 time.sleep(10)
2224 switch_map = None
2225 olt_configured = False
2226 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2227 log_test.info('Installing OLT app')
2228 OnosCtrl.install_app(self.olt_app_file)
2229 time.sleep(5)
2230 log_test.info('Adding subscribers through OLT app')
2231 self.config_olt(switch_map)
2232 olt_configured = True
2233 time.sleep(5)
2234 devices_list = self.voltha.get_devices()
2235 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2236 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2237 thread1.start()
2238 time.sleep(randint(1,2))
2239 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2240 thread2.start()
2241 time.sleep(10)
2242 thread1.join()
2243 thread2.join()
2244 try:
2245 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002246 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002247 time.sleep(10)
2248 finally:
2249 self.voltha.disable_device(device_id, delete = True)
2250 df.callback(0)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002251 reactor.callLater(0, tls_flow_check_operating_onu_state, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002252 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002253
Thangavelu K S9648eed2017-06-13 20:15:25 +00002254 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002255 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
2256 """
2257 Test Method:
2258 0. Make sure that voltha is up and running on CORD-POD setup.
2259 1. OLT and ONU is detected and validated.
2260 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2261 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2262 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2263 6. Verify that subscriber authenticated successfully.
2264 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2265 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2266 9. Verify that subscriber authentication is unsuccessful..
2267 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2268 """
2269 df = defer.Deferred()
2270 no_iterations = 10
2271 def tls_flow_check_operating_olt_state(df):
2272 aaa_app = ["org.opencord.aaa"]
2273 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002274 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002275 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2276 devices_list = self.voltha.get_devices()
2277 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2278
2279 onu_device_id = devices_list['items'][1]['id']
2280 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002281 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002282 time.sleep(10)
2283 switch_map = None
2284 olt_configured = False
2285 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2286 log_test.info('Installing OLT app')
2287 OnosCtrl.install_app(self.olt_app_file)
2288 time.sleep(5)
2289 log_test.info('Adding subscribers through OLT app')
2290 self.config_olt(switch_map)
2291 olt_configured = True
2292 time.sleep(5)
2293 devices_list = self.voltha.get_devices()
2294 for i in range(no_iterations):
2295 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2296 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2297 thread1.start()
2298 time.sleep(randint(1,2))
2299 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2300 thread2.start()
2301 time.sleep(10)
2302 thread1.join()
2303 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002304 time.sleep(60)
2305 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002306 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2307 try:
2308 # assert_equal(status, True)
2309 assert_equal(auth_status, True)
2310 assert_equal(self.success, True)
2311 time.sleep(10)
2312 finally:
2313 self.voltha.disable_device(device_id, delete = True)
2314 df.callback(0)
2315 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2316 return df
2317
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002318 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002319 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002320 """
2321 Test Method:
2322 0. Make sure that voltha is up and running on CORD-POD setup.
2323 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2324 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2325 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2326 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
2327 5. Verify that two subscribers are authenticated successfully.
2328 """
2329
Thangavelu K S9648eed2017-06-13 20:15:25 +00002330 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002331 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002332 aaa_app = ["org.opencord.aaa"]
2333 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002334 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002335 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2336 devices_list = self.voltha.get_devices()
2337 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2338
2339 onu_device_id = devices_list['items'][1]['id']
2340 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002341 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002342 time.sleep(10)
2343 switch_map = None
2344 olt_configured = False
2345 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2346 log_test.info('Installing OLT app')
2347 OnosCtrl.install_app(self.olt_app_file)
2348 time.sleep(5)
2349 log_test.info('Adding subscribers through OLT app')
2350 self.config_olt(switch_map)
2351 olt_configured = True
2352 time.sleep(5)
2353 devices_list = self.voltha.get_devices()
2354 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2355 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2356 thread1.start()
2357 time.sleep(randint(1,2))
2358 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2359 thread2.start()
2360 time.sleep(10)
2361 thread1.join()
2362 thread2.join()
2363 try:
2364 # assert_equal(status, True)
2365 assert_equal(self.success, True)
2366 time.sleep(10)
2367 finally:
2368 self.voltha.disable_device(device_id, delete = True)
2369 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002370 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002371 return df
2372
2373 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002374 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002375 """
2376 Test Method:
2377 0. Make sure that voltha is up and running on CORD-POD setup.
2378 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2379 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2380 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2381 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
2382 5. Verify that two subscribers are not authenticated.
2383 """
Thangavelu K S9648eed2017-06-13 20:15:25 +00002384 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002385 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002386 aaa_app = ["org.opencord.aaa"]
2387 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002388 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002389 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2390 devices_list = self.voltha.get_devices()
2391 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2392
2393 onu_device_id = devices_list['items'][1]['id']
2394 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002395 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002396 time.sleep(10)
2397 switch_map = None
2398 olt_configured = False
2399 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2400 log_test.info('Installing OLT app')
2401 OnosCtrl.install_app(self.olt_app_file)
2402 time.sleep(5)
2403 log_test.info('Adding subscribers through OLT app')
2404 self.config_olt(switch_map)
2405 olt_configured = True
2406 time.sleep(5)
2407 devices_list = self.voltha.get_devices()
2408 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2409 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
2410 thread1.start()
2411 time.sleep(randint(1,2))
2412 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2413 thread2.start()
2414 time.sleep(10)
2415 thread1.join()
2416 thread2.join()
2417 try:
2418 # assert_equal(status, True)
2419 assert_equal(self.success, True)
2420 time.sleep(10)
2421 finally:
2422 self.voltha.disable_device(device_id, delete = True)
2423 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002424 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002425 return df
2426
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002427 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002428 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 +00002429 """
2430 Test Method:
2431 0. Make sure that voltha is up and running on CORD-POD setup.
2432 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2433 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2434 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2435 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2436 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
2437 6. Verify that valid subscriber authenticated successfully.
2438 7. Verify that invalid subscriber are not authenticated successfully.
2439 """
2440
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002441 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002442 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002443 aaa_app = ["org.opencord.aaa"]
2444 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002445 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002446 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2447 devices_list = self.voltha.get_devices()
2448 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2449
2450 onu_device_id = devices_list['items'][1]['id']
2451 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002452 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002453 time.sleep(10)
2454 switch_map = None
2455 olt_configured = False
2456 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2457 log_test.info('Installing OLT app')
2458 OnosCtrl.install_app(self.olt_app_file)
2459 time.sleep(5)
2460 log_test.info('Adding subscribers through OLT app')
2461 self.config_olt(switch_map)
2462 olt_configured = True
2463 time.sleep(5)
2464 devices_list = self.voltha.get_devices()
2465 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2466 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
2467 thread1.start()
2468 time.sleep(randint(1,2))
2469 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2470 thread2.start()
2471 time.sleep(10)
2472 thread1.join()
2473 thread2.join()
2474 try:
2475 # assert_equal(status, True)
2476 assert_equal(self.success, True)
2477 time.sleep(10)
2478 finally:
2479 self.voltha.disable_device(device_id, delete = True)
2480 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002481 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002482 return df
2483
2484 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002485 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 +00002486 """
2487 Test Method:
2488 0. Make sure that voltha is up and running on CORD-POD setup.
2489 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2490 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2491 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2492 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2493 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
2494 6. Verify that valid subscriber authenticated successfully.
2495 7. Verify that invalid subscriber are not authenticated successfully.
2496 """
2497
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002498 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002499 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002500 aaa_app = ["org.opencord.aaa"]
2501 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002502 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002503 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2504 devices_list = self.voltha.get_devices()
2505 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2506
2507 onu_device_id = devices_list['items'][1]['id']
2508 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002509 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002510 time.sleep(10)
2511 switch_map = None
2512 olt_configured = False
2513 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2514 log_test.info('Installing OLT app')
2515 OnosCtrl.install_app(self.olt_app_file)
2516 time.sleep(5)
2517 log_test.info('Adding subscribers through OLT app')
2518 self.config_olt(switch_map)
2519 olt_configured = True
2520 time.sleep(5)
2521 devices_list = self.voltha.get_devices()
2522 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2523 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
2524 thread1.start()
2525 time.sleep(randint(1,2))
2526 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2527 thread2.start()
2528 time.sleep(10)
2529 thread1.join()
2530 thread2.join()
2531 try:
2532 # assert_equal(status, True)
2533 assert_equal(self.success, True)
2534 time.sleep(10)
2535 finally:
2536 self.voltha.disable_device(device_id, delete = True)
2537 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002538 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002539 return df
2540
2541 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002542 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002543 """
2544 Test Method:
2545 0. Make sure that voltha is up and running on CORD-POD setup.
2546 1. OLT and ONU is detected and validated.
2547 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2548 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2549 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
2550 6. Verify that subscriber authenticated successfully.
2551 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
2552 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
2553 9. Verify that subscriber authentication is unsuccessful..
2554 10. Verify that other subscriber authenticated successfully.
2555 """
2556
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002557 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002558 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002559 aaa_app = ["org.opencord.aaa"]
2560 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002561 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002562 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2563 devices_list = self.voltha.get_devices()
2564 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2565
2566 onu_device_id = devices_list['items'][1]['id']
2567 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002568 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002569 time.sleep(10)
2570 switch_map = None
2571 olt_configured = False
2572 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2573 log_test.info('Installing OLT app')
2574 OnosCtrl.install_app(self.olt_app_file)
2575 time.sleep(5)
2576 log_test.info('Adding subscribers through OLT app')
2577 self.config_olt(switch_map)
2578 olt_configured = True
2579 time.sleep(5)
2580 devices_list = self.voltha.get_devices()
2581 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2582 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
2583 thread1.start()
2584 time.sleep(randint(1,2))
2585 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2586 thread2.start()
2587 time.sleep(10)
2588 thread1.join()
2589 thread2.join()
2590 try:
2591 # assert_equal(status, True)
2592 assert_equal(self.success, True)
2593 time.sleep(10)
2594 finally:
2595 self.voltha.disable_device(device_id, delete = True)
2596 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002597 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002598 return df
2599
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00002600 def test_three_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00002601 """
2602 Test Method:
2603 0. Make sure that voltha is up and running on CORD-POD setup.
2604 1. OLT and ONU is detected and validated.
2605 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2606 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers)
2607 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2608 5. Verify that subscriber is authenticated successfully.
2609 """
2610 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2611 num_subscribers = 3
2612 num_channels = 1
2613 services = ('TLS')
2614 cbs = (self.tls_flow_check, None, None)
2615 self.voltha_subscribers(services, cbs = cbs,
2616 num_subscribers = num_subscribers,
2617 num_channels = num_channels)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00002618 assert_equal(self.success, True)
2619
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00002620 def test_five_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00002621 """
2622 Test Method:
2623 0. Make sure that voltha is up and running on CORD-POD setup.
2624 1. OLT and ONU is detected and validated.
2625 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2626 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber)
2627 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2628 5. Verify that subscriber is authenticated successfully.
2629 """
2630 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2631 num_subscribers = 5
2632 num_channels = 1
2633 services = ('TLS')
2634 cbs = (self.tls_flow_check, None, None)
2635 self.voltha_subscribers(services, cbs = cbs,
2636 num_subscribers = num_subscribers,
2637 num_channels = num_channels)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00002638 assert_equal(self.success, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00002639
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00002640 def test_nine_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00002641 """
2642 Test Method:
2643 0. Make sure that voltha is up and running on CORD-POD setup.
2644 1. OLT and ONU is detected and validated.
2645 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2646 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber)
2647 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2648 5. Verify that subscriber is authenticated successfully.
2649 """
2650 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2651 num_subscribers = 9
2652 num_channels = 1
2653 services = ('TLS')
2654 cbs = (self.tls_flow_check, None, None)
2655 self.voltha_subscribers(services, cbs = cbs,
2656 num_subscribers = num_subscribers,
2657 num_channels = num_channels)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00002658 assert_equal(self.success, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00002659
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002660 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002661 def test_subscriber_with_voltha_for_dhcp_request(self):
2662 """
2663 Test Method:
2664 0. Make sure that voltha is up and running on CORD-POD setup.
2665 1. OLT and ONU is detected and validated.
2666 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2667 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2668 4. Verify that subscriber get ip from dhcp server successfully.
2669 """
2670
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002671 df = defer.Deferred()
2672 def dhcp_flow_check_scenario(df):
2673 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002674 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002675 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2676 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002677 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002678 time.sleep(10)
2679 switch_map = None
2680 olt_configured = False
2681 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2682 log_test.info('Installing OLT app')
2683 OnosCtrl.install_app(self.olt_app_file)
2684 time.sleep(5)
2685 log_test.info('Adding subscribers through OLT app')
2686 self.config_olt(switch_map)
2687 olt_configured = True
2688 time.sleep(5)
2689 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2690 try:
2691 assert_equal(dhcp_status, True)
2692 #assert_equal(status, True)
2693 time.sleep(10)
2694 finally:
2695 self.remove_olt(switch_map)
2696 self.voltha.disable_device(device_id, delete = True)
2697 df.callback(0)
2698
2699 reactor.callLater(0, dhcp_flow_check_scenario, df)
2700 return df
2701
2702 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002703 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
2704 """
2705 Test Method:
2706 0. Make sure that voltha is up and running on CORD-POD setup.
2707 1. OLT and ONU is detected and validated.
2708 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2709 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
2710 4. Verify that subscriber should not get ip from dhcp server.
2711 """
2712
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002713 df = defer.Deferred()
2714 def dhcp_flow_check_scenario(df):
2715 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002716 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002717 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2718 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002719 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002720 time.sleep(10)
2721 switch_map = None
2722 olt_configured = False
2723 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2724 log_test.info('Installing OLT app')
2725 OnosCtrl.install_app(self.olt_app_file)
2726 time.sleep(5)
2727 log_test.info('Adding subscribers through OLT app')
2728 self.config_olt(switch_map)
2729 olt_configured = True
2730 time.sleep(5)
2731 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
2732 try:
2733 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002734 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002735 #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
2746 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002747 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
2748 """
2749 Test Method:
2750 0. Make sure that voltha is up and running on CORD-POD setup.
2751 1. OLT and ONU is detected and validated.
2752 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2753 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
2754 4. Verify that subscriber should not get ip from dhcp server.
2755 """
2756
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002757 df = defer.Deferred()
2758 def dhcp_flow_check_scenario(df):
2759 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002760 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002761 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2762 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002763 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002764 time.sleep(10)
2765 switch_map = None
2766 olt_configured = False
2767 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2768 log_test.info('Installing OLT app')
2769 OnosCtrl.install_app(self.olt_app_file)
2770 time.sleep(5)
2771 log_test.info('Adding subscribers through OLT app')
2772 self.config_olt(switch_map)
2773 olt_configured = True
2774 time.sleep(5)
2775 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
2776 try:
2777 assert_equal(dhcp_status, True)
2778 #assert_equal(status, True)
2779 time.sleep(10)
2780 finally:
2781 self.voltha.disable_device(device_id, delete = True)
2782 self.remove_olt(switch_map)
2783 df.callback(0)
2784
2785 reactor.callLater(0, dhcp_flow_check_scenario, df)
2786 return df
2787
2788 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002789 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
2790 """
2791 Test Method:
2792 0. Make sure that voltha is up and running on CORD-POD setup.
2793 1. OLT and ONU is detected and validated.
2794 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2795 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
2796 4. Verify that subscriber should not get ip from dhcp server.
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, "invalid_src_mac_junk")
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)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002825
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002826 reactor.callLater(0, dhcp_flow_check_scenario, df)
2827 return df
2828
2829 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002830 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
2831 """
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 subscrber to dhcp server which is running as onos app.
2837 4. Verify that subscriber get ip from dhcp server successfully.
2838 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
2839 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
2840 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +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 Sa1c71b42017-06-14 18:13:21 +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 Sa1c71b42017-06-14 18:13:21 +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, "request_release")
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)
2868
2869 reactor.callLater(0, dhcp_flow_check_scenario, df)
2870 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002871
Thangavelu K S735a6662017-06-15 18:08:23 +00002872 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07002873 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002874 """
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 to dhcp server which is running as onos app.
2880 4. Verify that subscriber get ip from dhcp server successfully.
2881 5. Repeat step 3 and 4 for 10 times.
2882 6 Verify that subscriber should 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_positive")
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)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002911
Thangavelu K S735a6662017-06-15 18:08:23 +00002912 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_starvation_negative_scenario(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 without of pool ip to dhcp server which is running as onos app.
2923 4. Verify that subscriber should not get ip from dhcp server.
2924 5. Repeat steps 3 and 4 for 10 times.
2925 6 Verify that subscriber should not get ip 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, "starvation_negative")
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_discover(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. Repeat step 3 for 50 times.
2968 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2969 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002970 df = defer.Deferred()
2971 def dhcp_flow_check_scenario(df):
2972 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002973 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00002974 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2975 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002976 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002977 time.sleep(10)
2978 switch_map = None
2979 olt_configured = False
2980 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2981 log_test.info('Installing OLT app')
2982 OnosCtrl.install_app(self.olt_app_file)
2983 time.sleep(5)
2984 log_test.info('Adding subscribers through OLT app')
2985 self.config_olt(switch_map)
2986 olt_configured = True
2987 time.sleep(5)
2988 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
2989 try:
2990 assert_equal(dhcp_status, True)
2991 #assert_equal(status, True)
2992 time.sleep(10)
2993 finally:
2994 self.voltha.disable_device(device_id, delete = True)
2995 self.remove_olt(switch_map)
2996 df.callback(0)
2997
2998 reactor.callLater(0, dhcp_flow_check_scenario, df)
2999 return df
3000
Thangavelu K S735a6662017-06-15 18:08:23 +00003001 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003002 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
3003 """
3004 Test Method:
3005 0. Make sure that voltha is up and running on CORD-POD setup.
3006 1. OLT and ONU is detected and validated.
3007 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3008 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3009 4. Verify that subscriber get ip from dhcp server successfully.
3010 5. Send DHCP request to dhcp server which is running as onos app.
3011 6. Repeat step 5 for 50 times.
3012 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
3013 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003014 df = defer.Deferred()
3015 def dhcp_flow_check_scenario(df):
3016 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003017 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003018 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3019 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003020 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003021 time.sleep(10)
3022 switch_map = None
3023 olt_configured = False
3024 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3025 log_test.info('Installing OLT app')
3026 OnosCtrl.install_app(self.olt_app_file)
3027 time.sleep(5)
3028 log_test.info('Adding subscribers through OLT app')
3029 self.config_olt(switch_map)
3030 olt_configured = True
3031 time.sleep(5)
3032 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
3033 try:
3034 assert_equal(dhcp_status, True)
3035 #assert_equal(status, True)
3036 time.sleep(10)
3037 finally:
3038 self.voltha.disable_device(device_id, delete = True)
3039 self.remove_olt(switch_map)
3040 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003041
Thangavelu K S735a6662017-06-15 18:08:23 +00003042 reactor.callLater(0, dhcp_flow_check_scenario, df)
3043 return df
3044
Thangavelu K S735a6662017-06-15 18:08:23 +00003045 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003046 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
3047 """
3048 Test Method:
3049 0. Make sure that voltha is up and running on CORD-POD setup.
3050 1. OLT and ONU is detected and validated.
3051 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3052 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
3053 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
3054 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003055 df = defer.Deferred()
3056 def dhcp_flow_check_scenario(df):
3057 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003058 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003059 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3060 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003061 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003062 time.sleep(10)
3063 switch_map = None
3064 olt_configured = False
3065 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3066 log_test.info('Installing OLT app')
3067 OnosCtrl.install_app(self.olt_app_file)
3068 time.sleep(5)
3069 log_test.info('Adding subscribers through OLT app')
3070 self.config_olt(switch_map)
3071 olt_configured = True
3072 time.sleep(5)
3073 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
3074 try:
3075 assert_equal(dhcp_status, True)
3076 #assert_equal(status, True)
3077 time.sleep(10)
3078 finally:
3079 self.voltha.disable_device(device_id, delete = True)
3080 self.remove_olt(switch_map)
3081 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003082
Thangavelu K S735a6662017-06-15 18:08:23 +00003083 reactor.callLater(0, dhcp_flow_check_scenario, df)
3084 return df
3085
3086 @deferred(TESTCASE_TIMEOUT)
3087 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003088 """
3089 Test Method:
3090 0. Make sure that voltha is up and running on CORD-POD setup.
3091 1. OLT and ONU is detected and validated.
3092 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3093 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
3094 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.
3095 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003096 df = defer.Deferred()
3097 def dhcp_flow_check_scenario(df):
3098 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003099 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003100 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3101 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003102 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003103 time.sleep(10)
3104 switch_map = None
3105 olt_configured = False
3106 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3107 log_test.info('Installing OLT app')
3108 OnosCtrl.install_app(self.olt_app_file)
3109 time.sleep(5)
3110 log_test.info('Adding subscribers through OLT app')
3111 self.config_olt(switch_map)
3112 olt_configured = True
3113 time.sleep(5)
3114 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
3115 try:
3116 assert_equal(dhcp_status, True)
3117 #assert_equal(status, True)
3118 time.sleep(10)
3119 finally:
3120 self.voltha.disable_device(device_id, delete = True)
3121 self.remove_olt(switch_map)
3122 df.callback(0)
3123
3124 reactor.callLater(0, dhcp_flow_check_scenario, df)
3125 return df
3126
Thangavelu K S735a6662017-06-15 18:08:23 +00003127 @deferred(TESTCASE_TIMEOUT)
3128 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003129 """
3130 Test Method:
3131 0. Make sure that voltha is up and running on CORD-POD setup.
3132 1. OLT and ONU is detected and validated.
3133 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3134 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3135 4. Verify that subscriber get ip from dhcp server successfully.
3136 5. Deactivate dhcp server app in onos.
3137 6. Repeat step 3.
3138 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3139 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003140 df = defer.Deferred()
3141 dhcp_app = 'org.onosproject.dhcp'
3142 def dhcp_flow_check_scenario(df):
3143 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003144 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003145 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3146 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003147 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003148 time.sleep(10)
3149 switch_map = None
3150 olt_configured = False
3151 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3152 log_test.info('Installing OLT app')
3153 OnosCtrl.install_app(self.olt_app_file)
3154 time.sleep(5)
3155 log_test.info('Adding subscribers through OLT app')
3156 self.config_olt(switch_map)
3157 olt_configured = True
3158 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003159 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00003160 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
3161 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3162 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00003163 thread1.start()
3164 time.sleep(10)
3165 thread1.join()
3166 thread2.join()
3167 try:
3168 assert_equal(self.success, True)
3169 #assert_equal(status, True)
3170 time.sleep(10)
3171 finally:
3172 self.voltha.disable_device(device_id, delete = True)
3173 self.remove_olt(switch_map)
3174 df.callback(0)
3175
3176 reactor.callLater(0, dhcp_flow_check_scenario, df)
3177 return df
3178
3179 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003180 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
3181 """
3182 Test Method:
3183 0. Make sure that voltha is up and running on CORD-POD setup.
3184 1. OLT and ONU is detected and validated.
3185 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3186 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3187 4. Verify that subscriber get ip from dhcp server successfully.
3188 5. Send dhcp renew packet to dhcp server which is running as onos app.
3189 6. Repeat step 4.
3190 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003191
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_renew")
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
3223 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003224 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
3225 """
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. Send dhcp rebind packet to dhcp server which is running as onos app.
3233 6. Repeat step 4.
3234 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003235 df = defer.Deferred()
3236 def dhcp_flow_check_scenario(df):
3237 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003238 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003239 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3240 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003241 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003242 time.sleep(10)
3243 switch_map = None
3244 olt_configured = False
3245 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3246 log_test.info('Installing OLT app')
3247 OnosCtrl.install_app(self.olt_app_file)
3248 time.sleep(5)
3249 log_test.info('Adding subscribers through OLT app')
3250 self.config_olt(switch_map)
3251 olt_configured = True
3252 time.sleep(5)
3253 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
3254 try:
3255 assert_equal(dhcp_status, True)
3256 #assert_equal(status, True)
3257 time.sleep(10)
3258 finally:
3259 self.voltha.disable_device(device_id, delete = True)
3260 self.remove_olt(switch_map)
3261 df.callback(0)
3262
3263 reactor.callLater(0, dhcp_flow_check_scenario, df)
3264 return df
3265
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003266 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003267 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003268 """
3269 Test Method:
3270 0. Make sure that voltha is up and running on CORD-POD setup.
3271 1. OLT and ONU is detected and validated.
3272 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3273 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3274 4. Verify that subscriber get ip from dhcp server successfully.
3275 5. Disable olt devices which is being detected in voltha CLI.
3276 6. Repeat step 3.
3277 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3278 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003279 df = defer.Deferred()
3280 dhcp_app = 'org.onosproject.dhcp'
3281 def dhcp_flow_check_scenario(df):
3282 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003283 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003284 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3285 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003286 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003287 time.sleep(10)
3288 switch_map = None
3289 olt_configured = False
3290 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3291 log_test.info('Installing OLT app')
3292 OnosCtrl.install_app(self.olt_app_file)
3293 time.sleep(5)
3294 log_test.info('Adding subscribers through OLT app')
3295 self.config_olt(switch_map)
3296 olt_configured = True
3297 time.sleep(5)
3298 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3299 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3300 log_test.info('Disable the olt device in during client send discover to voltha')
3301 thread2.start()
3302# time.sleep(randint(0,1))
3303 thread1.start()
3304 time.sleep(10)
3305 thread1.join()
3306 thread2.join()
3307 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003308 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003309 #assert_equal(status, True)
3310 time.sleep(10)
3311 finally:
3312 self.voltha.disable_device(device_id, delete = True)
3313 self.remove_olt(switch_map)
3314 df.callback(0)
3315
3316 reactor.callLater(0, dhcp_flow_check_scenario, df)
3317 return df
3318
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003319 @deferred(TESTCASE_TIMEOUT)
3320 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
3321 """
3322 Test Method:
3323 0. Make sure that voltha is up and running on CORD-POD setup.
3324 1. OLT and ONU is detected and validated.
3325 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3326 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3327 4. Verify that subscriber get ip from dhcp server successfully.
3328 5. Disable olt devices which is being detected in voltha CLI.
3329 6. Repeat step 3.
3330 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3331 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
3332 """
3333 df = defer.Deferred()
3334 no_iterations = 10
3335 dhcp_app = 'org.onosproject.dhcp'
3336 def dhcp_flow_check_scenario(df):
3337 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003338 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003339 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3340 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003341 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003342 time.sleep(10)
3343 switch_map = None
3344 olt_configured = False
3345 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3346 log_test.info('Installing OLT app')
3347 OnosCtrl.install_app(self.olt_app_file)
3348 time.sleep(5)
3349 log_test.info('Adding subscribers through OLT app')
3350 self.config_olt(switch_map)
3351 olt_configured = True
3352 time.sleep(5)
3353 for i in range(no_iterations):
3354 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3355 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3356 log_test.info('Disable the olt device in during client send discover to voltha')
3357 thread2.start()
3358# time.sleep(randint(0,1))
3359 thread1.start()
3360 time.sleep(10)
3361 thread1.join()
3362 thread2.join()
3363 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3364 try:
3365 assert_equal(self.success, True)
3366 assert_equal(dhcp_status, True)
3367 #assert_equal(status, True)
3368 time.sleep(10)
3369 finally:
3370 self.voltha.disable_device(device_id, delete = True)
3371 self.remove_olt(switch_map)
3372 df.callback(0)
3373
3374 reactor.callLater(0, dhcp_flow_check_scenario, df)
3375 return df
3376
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003377 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003378 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003379 """
3380 Test Method:
3381 0. Make sure that voltha is up and running on CORD-POD setup.
3382 1. OLT and ONU is detected and validated.
3383 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3384 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3385 4. Verify that subscriber get ip from dhcp server successfully.
3386 5. Disable olt devices which is being detected in voltha CLI.
3387 6. Repeat step 3.
3388 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3389 8. Enable olt devices which is being detected in voltha CLI.
3390 9. Repeat steps 3 and 4.
3391 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003392 df = defer.Deferred()
3393 dhcp_app = 'org.onosproject.dhcp'
3394 def dhcp_flow_check_scenario(df):
3395 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003396 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003397 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3398 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003399 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003400 time.sleep(10)
3401 switch_map = None
3402 olt_configured = False
3403 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3404 log_test.info('Installing OLT app')
3405 OnosCtrl.install_app(self.olt_app_file)
3406 time.sleep(5)
3407 log_test.info('Adding subscribers through OLT app')
3408 self.config_olt(switch_map)
3409 olt_configured = True
3410 time.sleep(5)
3411 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3412 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3413 thread2.start()
3414 thread1.start()
3415 time.sleep(10)
3416 thread1.join()
3417 thread2.join()
3418 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003419 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003420 #assert_equal(status, True)
3421 time.sleep(10)
3422 finally:
3423 self.voltha.disable_device(device_id, delete = True)
3424 self.remove_olt(switch_map)
3425 df.callback(0)
3426
3427 reactor.callLater(0, dhcp_flow_check_scenario, df)
3428 return df
3429
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003430 @deferred(TESTCASE_TIMEOUT)
3431 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
3432 """
3433 Test Method:
3434 0. Make sure that voltha is up and running on CORD-POD setup.
3435 1. OLT and ONU is detected and validated.
3436 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3437 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3438 4. Verify that subscriber get ip from dhcp server successfully.
3439 5. Disable olt devices which is being detected in voltha CLI.
3440 6. Repeat step 3.
3441 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3442 8. Enable olt devices which is being detected in voltha CLI.
3443 9. Repeat steps 3 and 4.
3444 """
3445
3446 df = defer.Deferred()
3447 no_iterations = 10
3448 dhcp_app = 'org.onosproject.dhcp'
3449 def dhcp_flow_check_scenario(df):
3450 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003451 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003452 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3453 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003454 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003455 time.sleep(10)
3456 switch_map = None
3457 olt_configured = False
3458 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3459 log_test.info('Installing OLT app')
3460 OnosCtrl.install_app(self.olt_app_file)
3461 time.sleep(5)
3462 log_test.info('Adding subscribers through OLT app')
3463 self.config_olt(switch_map)
3464 olt_configured = True
3465 time.sleep(5)
3466 for i in range(no_iterations):
3467 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3468 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3469 thread2.start()
3470 thread1.start()
3471 time.sleep(10)
3472 thread1.join()
3473 thread2.join()
3474 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3475 try:
3476 assert_equal(dhcp_status, True)
3477 #assert_equal(status, True)
3478 assert_equal(self.success, True)
3479 time.sleep(10)
3480 finally:
3481 self.voltha.disable_device(device_id, delete = True)
3482 self.remove_olt(switch_map)
3483 df.callback(0)
3484
3485 reactor.callLater(0, dhcp_flow_check_scenario, df)
3486 return df
3487
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003488 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003489 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003490 """
3491 Test Method:
3492 0. Make sure that voltha is up and running on CORD-POD setup.
3493 1. OLT and ONU is detected and validated.
3494 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3495 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3496 4. Verify that subscriber get ip from dhcp server successfully.
3497 5. Disable onu port which is being detected in voltha CLI.
3498 6. Repeat step 3.
3499 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3500 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003501 df = defer.Deferred()
3502 dhcp_app = 'org.onosproject.dhcp'
3503 def dhcp_flow_check_scenario(df):
3504 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003505 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003506 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3507 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003508 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003509 time.sleep(10)
3510 switch_map = None
3511 olt_configured = False
3512 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3513 log_test.info('Installing OLT app')
3514 OnosCtrl.install_app(self.olt_app_file)
3515 time.sleep(5)
3516 log_test.info('Adding subscribers through OLT app')
3517 self.config_olt(switch_map)
3518 olt_configured = True
3519 time.sleep(5)
3520 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 +00003521 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003522 thread1.start()
3523 thread2.start()
3524 time.sleep(10)
3525 thread1.join()
3526 thread2.join()
3527 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003528 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003529 #assert_equal(status, True)
3530 time.sleep(10)
3531 finally:
3532 self.voltha.disable_device(device_id, delete = True)
3533 self.remove_olt(switch_map)
3534 df.callback(0)
3535
3536 reactor.callLater(0, dhcp_flow_check_scenario, df)
3537 return df
3538
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003539 @deferred(TESTCASE_TIMEOUT)
3540 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
3541 """
3542 Test Method:
3543 0. Make sure that voltha is up and running on CORD-POD setup.
3544 1. OLT and ONU is detected and validated.
3545 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3546 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3547 4. Verify that subscriber get ip from dhcp server successfully.
3548 5. Disable onu port which is being detected in voltha CLI.
3549 6. Repeat step 3.
3550 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3551 """
3552 df = defer.Deferred()
3553 no_iterations = 10
3554 dhcp_app = 'org.onosproject.dhcp'
3555 def dhcp_flow_check_scenario(df):
3556 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003557 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003558 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3559 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003560 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003561 time.sleep(10)
3562 switch_map = None
3563 olt_configured = False
3564 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3565 log_test.info('Installing OLT app')
3566 OnosCtrl.install_app(self.olt_app_file)
3567 time.sleep(5)
3568 log_test.info('Adding subscribers through OLT app')
3569 self.config_olt(switch_map)
3570 olt_configured = True
3571 time.sleep(5)
3572 for i in range(no_iterations):
3573 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 +00003574 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003575 thread1.start()
3576 thread2.start()
3577 time.sleep(10)
3578 thread1.join()
3579 thread2.join()
3580 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3581 try:
3582 #assert_equal(status, True)
3583 assert_equal(dhcp_status, True)
3584 assert_equal(self.success, True)
3585 time.sleep(10)
3586 finally:
3587 self.voltha.disable_device(device_id, delete = True)
3588 self.remove_olt(switch_map)
3589 df.callback(0)
3590
3591 reactor.callLater(0, dhcp_flow_check_scenario, df)
3592 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003593
3594 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003595 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003596 """
3597 Test Method:
3598 0. Make sure that voltha is up and running on CORD-POD setup.
3599 1. OLT and ONU is detected and validated.
3600 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3601 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3602 4. Verify that subscriber get ip from dhcp server successfully.
3603 5. Disable onu port which is being detected in voltha CLI.
3604 6. Repeat step 3.
3605 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3606 8. Enable onu port which is being detected in voltha CLI.
3607 9. Repeat steps 3 and 4.
3608 """
3609
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003610 df = defer.Deferred()
3611 dhcp_app = 'org.onosproject.dhcp'
3612 def dhcp_flow_check_scenario(df):
3613 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003614 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003615 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3616 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003617 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003618 time.sleep(10)
3619 switch_map = None
3620 olt_configured = False
3621 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3622 log_test.info('Installing OLT app')
3623 OnosCtrl.install_app(self.olt_app_file)
3624 time.sleep(5)
3625 log_test.info('Adding subscribers through OLT app')
3626 self.config_olt(switch_map)
3627 olt_configured = True
3628 time.sleep(5)
3629 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 +00003630 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003631 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3632 thread2.start()
3633 time.sleep(randint(0,1))
3634 thread1.start()
3635 time.sleep(10)
3636 thread1.join()
3637 thread2.join()
3638 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3639 assert_equal(dhcp_status, True)
3640 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003641 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003642 #assert_equal(status, True)
3643 time.sleep(10)
3644 finally:
3645 self.voltha.disable_device(device_id, delete = True)
3646 self.remove_olt(switch_map)
3647 df.callback(0)
3648
3649 reactor.callLater(0, dhcp_flow_check_scenario, df)
3650 return df
3651
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003652 @deferred(TESTCASE_TIMEOUT)
3653 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
3654 """
3655 Test Method:
3656 0. Make sure that voltha is up and running on CORD-POD setup.
3657 1. OLT and ONU is detected and validated.
3658 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3659 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3660 4. Verify that subscriber get ip from dhcp server successfully.
3661 5. Disable onu port which is being detected in voltha CLI.
3662 6. Repeat step 3.
3663 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3664 8. Enable onu port which is being detected in voltha CLI.
3665 9. Repeat steps 3 and 4.
3666 """
3667
3668 df = defer.Deferred()
3669 no_iterations = 10
3670 dhcp_app = 'org.onosproject.dhcp'
3671 def dhcp_flow_check_scenario(df):
3672 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003673 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003674 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3675 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003676 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003677 time.sleep(10)
3678 switch_map = None
3679 olt_configured = False
3680 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3681 log_test.info('Installing OLT app')
3682 OnosCtrl.install_app(self.olt_app_file)
3683 time.sleep(5)
3684 log_test.info('Adding subscribers through OLT app')
3685 self.config_olt(switch_map)
3686 olt_configured = True
3687 time.sleep(5)
3688 for i in range(no_iterations):
3689 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 +00003690 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003691 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3692 thread2.start()
3693 time.sleep(randint(0,1))
3694 thread1.start()
3695 time.sleep(10)
3696 thread1.join()
3697 thread2.join()
3698 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3699 assert_equal(dhcp_status, True)
3700 try:
3701 assert_equal(self.success, True)
3702 #assert_equal(status, True)
3703 time.sleep(10)
3704 finally:
3705 self.voltha.disable_device(device_id, delete = True)
3706 self.remove_olt(switch_map)
3707 df.callback(0)
3708
3709 reactor.callLater(0, dhcp_flow_check_scenario, df)
3710 return df
3711
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003712 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003713 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003714 """
3715 Test Method:
3716 0. Make sure that voltha is up and running on CORD-POD setup.
3717 1. OLT and ONU is detected and validated.
3718 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3719 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3720 4. Verify that subscribers had got different ips from dhcp server successfully.
3721 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003722 df = defer.Deferred()
3723 self.success = True
3724 dhcp_app = 'org.onosproject.dhcp'
3725 def dhcp_flow_check_scenario(df):
3726 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003727 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003728 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3729 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003730 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003731 time.sleep(10)
3732 switch_map = None
3733 olt_configured = False
3734 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3735 log_test.info('Installing OLT app')
3736 OnosCtrl.install_app(self.olt_app_file)
3737 time.sleep(5)
3738 log_test.info('Adding subscribers through OLT app')
3739 self.config_olt(switch_map)
3740 olt_configured = True
3741 time.sleep(5)
3742 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3743 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3744 thread1.start()
3745 thread2.start()
3746 time.sleep(10)
3747 thread1.join()
3748 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003749 dhcp_flow_status = self.success
3750 try:
3751# if self.success is not True:
3752 assert_equal(dhcp_flow_status, True)
3753 #assert_equal(status, True)
3754 time.sleep(10)
3755 finally:
3756 self.voltha.disable_device(device_id, delete = True)
3757 self.remove_olt(switch_map)
3758 df.callback(0)
3759
3760 reactor.callLater(0, dhcp_flow_check_scenario, df)
3761 return df
3762
3763 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003764 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003765 """
3766 Test Method:
3767 0. Make sure that voltha is up and running on CORD-POD setup.
3768 1. OLT and ONU is detected and validated.
3769 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3770 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3771 4. Verify that subscribers had got ip from dhcp server successfully.
3772 5. Repeat step 3 and 4 for 10 times for both subscribers.
3773 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
3774 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003775 df = defer.Deferred()
3776 self.success = True
3777 dhcp_app = 'org.onosproject.dhcp'
3778 def dhcp_flow_check_scenario(df):
3779 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003780 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003781 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3782 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003783 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003784 time.sleep(10)
3785 switch_map = None
3786 olt_configured = False
3787 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3788 log_test.info('Installing OLT app')
3789 OnosCtrl.install_app(self.olt_app_file)
3790 time.sleep(5)
3791 log_test.info('Adding subscribers through OLT app')
3792 self.config_olt(switch_map)
3793 olt_configured = True
3794 time.sleep(5)
3795 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3796 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
3797 thread1.start()
3798 thread2.start()
3799 time.sleep(10)
3800 thread1.join()
3801 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003802 dhcp_flow_status = self.success
3803 try:
3804# if self.success is not True:
3805 assert_equal(dhcp_flow_status, True)
3806 #assert_equal(status, True)
3807 time.sleep(10)
3808 finally:
3809 self.voltha.disable_device(device_id, delete = True)
3810 self.remove_olt(switch_map)
3811 df.callback(0)
3812
3813 reactor.callLater(0, dhcp_flow_check_scenario, df)
3814 return df
3815
3816 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003817 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003818 """
3819 Test Method:
3820 0. Make sure that voltha is up and running on CORD-POD setup.
3821 1. OLT and ONU is detected and validated.
3822 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3823 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3824 4. Verify that subscribers had got ip from dhcp server successfully.
3825 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3826 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
3827 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003828 df = defer.Deferred()
3829 self.success = True
3830 dhcp_app = 'org.onosproject.dhcp'
3831 def dhcp_flow_check_scenario(df):
3832 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003833 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003834 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3835 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003836 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003837 time.sleep(10)
3838 switch_map = None
3839 olt_configured = False
3840 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3841 log_test.info('Installing OLT app')
3842 OnosCtrl.install_app(self.olt_app_file)
3843 time.sleep(5)
3844 log_test.info('Adding subscribers through OLT app')
3845 self.config_olt(switch_map)
3846 olt_configured = True
3847 time.sleep(5)
3848 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3849 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3850 thread1.start()
3851 thread2.start()
3852 time.sleep(10)
3853 thread1.join()
3854 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003855 dhcp_flow_status = self.success
3856 try:
3857# if self.success is not True:
3858 assert_equal(dhcp_flow_status, True)
3859 #assert_equal(status, True)
3860 time.sleep(10)
3861 finally:
3862 self.voltha.disable_device(device_id, delete = True)
3863 self.remove_olt(switch_map)
3864 df.callback(0)
3865
3866 reactor.callLater(0, dhcp_flow_check_scenario, df)
3867 return df
3868
3869 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003870 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 +00003871 """
3872 Test Method:
3873 0. Make sure that voltha is up and running on CORD-POD setup.
3874 1. OLT and ONU is detected and validated.
3875 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3876 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
3877 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
3878 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
3879 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003880
3881 df = defer.Deferred()
3882 self.success = True
3883 dhcp_app = 'org.onosproject.dhcp'
3884 def dhcp_flow_check_scenario(df):
3885 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003886 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003887 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3888 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003889 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003890 time.sleep(10)
3891 switch_map = None
3892 olt_configured = False
3893 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3894 log_test.info('Installing OLT app')
3895 OnosCtrl.install_app(self.olt_app_file)
3896 time.sleep(5)
3897 log_test.info('Adding subscribers through OLT app')
3898 self.config_olt(switch_map)
3899 olt_configured = True
3900 time.sleep(5)
3901 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3902 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
3903 thread1.start()
3904 thread2.start()
3905 time.sleep(10)
3906 thread1.join()
3907 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003908 dhcp_flow_status = self.success
3909 try:
3910# if self.success is not True:
3911 assert_equal(dhcp_flow_status, True)
3912 #assert_equal(status, True)
3913 time.sleep(10)
3914 finally:
3915 self.voltha.disable_device(device_id, delete = True)
3916 self.remove_olt(switch_map)
3917 df.callback(0)
3918
3919 reactor.callLater(0, dhcp_flow_check_scenario, df)
3920 return df
3921
3922 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003923 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 +00003924 """
3925 Test Method:
3926 0. Make sure that voltha is up and running on CORD-POD setup.
3927 1. OLT and ONU is detected and validated.
3928 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3929 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
3930 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
3931 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
3932 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003933 df = defer.Deferred()
3934 self.success = True
3935 dhcp_app = 'org.onosproject.dhcp'
3936 def dhcp_flow_check_scenario(df):
3937 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003938 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003939 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3940 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003941 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003942 time.sleep(10)
3943 switch_map = None
3944 olt_configured = False
3945 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3946 log_test.info('Installing OLT app')
3947 OnosCtrl.install_app(self.olt_app_file)
3948 time.sleep(5)
3949 log_test.info('Adding subscribers through OLT app')
3950 self.config_olt(switch_map)
3951 olt_configured = True
3952 time.sleep(5)
3953 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3954 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3955 thread1.start()
3956 thread2.start()
3957 time.sleep(10)
3958 thread1.join()
3959 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003960 dhcp_flow_status = self.success
3961 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003962 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003963 time.sleep(10)
3964 finally:
3965 self.voltha.disable_device(device_id, delete = True)
3966 self.remove_olt(switch_map)
3967 df.callback(0)
3968
3969 reactor.callLater(0, dhcp_flow_check_scenario, df)
3970 return df
3971
3972 @deferred(TESTCASE_TIMEOUT)
3973 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003974 """
3975 Test Method:
3976 0. Make sure that voltha is up and running on CORD-POD setup.
3977 1. OLT and ONU is detected and validated.
3978 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3979 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3980 4. Verify that subscribers had got ip from dhcp server successfully.
3981 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3982 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3983 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3984 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003985 df = defer.Deferred()
3986 self.success = True
3987 dhcp_app = 'org.onosproject.dhcp'
3988 def dhcp_flow_check_scenario(df):
3989 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003990 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003991 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3992 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003993 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003994 time.sleep(10)
3995 switch_map = None
3996 olt_configured = False
3997 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3998 log_test.info('Installing OLT app')
3999 OnosCtrl.install_app(self.olt_app_file)
4000 time.sleep(5)
4001 log_test.info('Adding subscribers through OLT app')
4002 self.config_olt(switch_map)
4003 olt_configured = True
4004 time.sleep(5)
4005 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
4006 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
4007 thread1.start()
4008 thread2.start()
4009 time.sleep(10)
4010 thread1.join()
4011 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004012 dhcp_flow_status = self.success
4013 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004014 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004015 time.sleep(10)
4016 finally:
4017 self.voltha.disable_device(device_id, delete = True)
4018 self.remove_olt(switch_map)
4019 df.callback(0)
4020
4021 reactor.callLater(0, dhcp_flow_check_scenario, df)
4022 return df
4023
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004024 @deferred(TESTCASE_TIMEOUT)
4025 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004026 """
4027 Test Method:
4028 0. Make sure that voltha is up and running on CORD-POD setup.
4029 1. OLT and ONU is detected and validated.
4030 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4031 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4032 4. Verify that subscribers had got ip from dhcp server successfully.
4033 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4034 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4035 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
4036 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
4037 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
4038 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
4039 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004040 df = defer.Deferred()
4041 self.success = True
4042 dhcp_app = 'org.onosproject.dhcp'
4043 def dhcp_flow_check_scenario(df):
4044 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004045 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004046 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4047 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004048 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004049 time.sleep(10)
4050 switch_map = None
4051 olt_configured = False
4052 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4053 log_test.info('Installing OLT app')
4054 OnosCtrl.install_app(self.olt_app_file)
4055 time.sleep(5)
4056 log_test.info('Adding subscribers through OLT app')
4057 self.config_olt(switch_map)
4058 olt_configured = True
4059 time.sleep(5)
4060 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4061 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 +00004062 thread3 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.INTF_2_RX_DEFAULT,))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004063 thread1.start()
4064 thread2.start()
4065 thread3.start()
4066 time.sleep(10)
4067 thread1.join()
4068 thread2.join()
4069 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004070 dhcp_flow_status = self.success
4071 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004072 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004073 time.sleep(10)
4074 finally:
4075 self.voltha.disable_device(device_id, delete = True)
4076 self.remove_olt(switch_map)
4077 df.callback(0)
4078
4079 reactor.callLater(0, dhcp_flow_check_scenario, df)
4080 return df
4081
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004082 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004083 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004084 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004085 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00004086 0. Make sure that voltha is up and running on CORD-POD setup.
4087 1. OLT and ONU is detected and validated.
4088 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4089 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4090 4. Verify that subscribers had got ip from dhcp server successfully.
4091 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4092 6. Disable the olt device which is detected in voltha.
4093 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4094 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004095 df = defer.Deferred()
4096 self.success = True
4097 dhcp_app = 'org.onosproject.dhcp'
4098 def dhcp_flow_check_scenario(df):
4099 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004100 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004101 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4102 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004103 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004104 time.sleep(10)
4105 switch_map = None
4106 olt_configured = False
4107 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4108 log_test.info('Installing OLT app')
4109 OnosCtrl.install_app(self.olt_app_file)
4110 time.sleep(5)
4111 log_test.info('Adding subscribers through OLT app')
4112 self.config_olt(switch_map)
4113 olt_configured = True
4114 time.sleep(5)
4115 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4116 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4117 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
4118
4119 thread1.start()
4120 thread2.start()
4121 thread3.start()
4122 time.sleep(10)
4123 thread1.join()
4124 thread2.join()
4125 thread3.join()
4126 dhcp_flow_status = self.success
4127 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004128 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004129 time.sleep(10)
4130 finally:
4131 self.voltha.disable_device(device_id, delete = True)
4132 self.remove_olt(switch_map)
4133 df.callback(0)
4134
4135 reactor.callLater(0, dhcp_flow_check_scenario, df)
4136 return df
4137
4138 @deferred(TESTCASE_TIMEOUT)
4139 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004140 """
4141 Test Method:
4142 0. Make sure that voltha is up and running on CORD-POD setup.
4143 1. OLT and ONU is detected and validated.
4144 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4145 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4146 4. Verify that subscribers had got ip from dhcp server successfully.
4147 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4148 6. Disable the olt device which is detected in voltha.
4149 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4150 8. Enable the olt device which is detected in voltha.
4151 9. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
4152 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004153 df = defer.Deferred()
4154 self.success = True
4155 dhcp_app = 'org.onosproject.dhcp'
4156 def dhcp_flow_check_scenario(df):
4157 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004158 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004159 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4160 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004161 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004162 time.sleep(10)
4163 switch_map = None
4164 olt_configured = False
4165 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4166 log_test.info('Installing OLT app')
4167 OnosCtrl.install_app(self.olt_app_file)
4168 time.sleep(5)
4169 log_test.info('Adding subscribers through OLT app')
4170 self.config_olt(switch_map)
4171 olt_configured = True
4172 time.sleep(5)
4173 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4174 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4175 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
4176 thread1.start()
4177 thread2.start()
4178 thread3.start()
4179 time.sleep(10)
4180 thread1.join()
4181 thread2.join()
4182 thread3.join()
4183 dhcp_flow_status = self.success
4184 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004185 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004186 time.sleep(10)
4187 finally:
4188 self.voltha.disable_device(device_id, delete = True)
4189 self.remove_olt(switch_map)
4190 df.callback(0)
4191
4192 reactor.callLater(0, dhcp_flow_check_scenario, df)
4193 return df
4194
4195 @deferred(TESTCASE_TIMEOUT)
4196 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004197 """
4198 Test Method:
4199 0. Make sure that voltha is up and running on CORD-POD setup.
4200 1. OLT and ONU is detected and validated.
4201 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4202 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4203 4. Verify that subscribers had got ip from dhcp server successfully.
4204 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4205 6. Pause the olt device which is detected in voltha.
4206 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4207 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004208 df = defer.Deferred()
4209 self.success = True
4210 dhcp_app = 'org.onosproject.dhcp'
4211 def dhcp_flow_check_scenario(df):
4212 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004213 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004214 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4215 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004216 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004217 time.sleep(10)
4218 switch_map = None
4219 olt_configured = False
4220 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4221 log_test.info('Installing OLT app')
4222 OnosCtrl.install_app(self.olt_app_file)
4223 time.sleep(5)
4224 log_test.info('Adding subscribers through OLT app')
4225 self.config_olt(switch_map)
4226 olt_configured = True
4227 time.sleep(5)
4228 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4229 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4230 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
4231 thread1.start()
4232 thread2.start()
4233 thread3.start()
4234 time.sleep(10)
4235 thread1.join()
4236 thread2.join()
4237 thread3.join()
4238 dhcp_flow_status = self.success
4239 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004240 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004241 time.sleep(10)
4242 finally:
4243 self.voltha.disable_device(device_id, delete = True)
4244 self.remove_olt(switch_map)
4245 df.callback(0)
4246
4247 reactor.callLater(0, dhcp_flow_check_scenario, df)
4248 return df
4249
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004250 def test_three_subscribers_with_voltha_for_dhcp_discover_requests(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004251 """
4252 Test Method:
4253 0. Make sure that voltha is up and running on CORD-POD setup.
4254 1. OLT and ONU is detected and validated.
4255 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4256 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4257 4. Verify that subscriber get ip from dhcp server successfully.
4258 """
4259 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4260 num_subscribers = 3
4261 num_channels = 1
4262 services = ('DHCP')
4263 cbs = (self.dhcp_flow_check, None, None)
4264 self.voltha_subscribers(services, cbs = cbs,
4265 num_subscribers = num_subscribers,
4266 num_channels = num_channels)
4267
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004268 def test_five_subscribers_with_voltha_for_dhcp_discover_requests(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004269 """
4270 Test Method:
4271 0. Make sure that voltha is up and running on CORD-POD setup.
4272 1. OLT and ONU is detected and validated.
4273 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4274 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4275 4. Verify that subscriber get ip from dhcp server successfully.
4276 """
4277 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4278 num_subscribers = 5
4279 num_channels = 1
4280 services = ('DHCP')
4281 cbs = (self.dhcp_flow_check, None, None)
4282 self.voltha_subscribers(services, cbs = cbs,
4283 num_subscribers = num_subscribers,
4284 num_channels = num_channels)
4285
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004286 def test_nine_subscribers_with_voltha_for_dhcp_discover_requests(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004287 """
4288 Test Method:
4289 0. Make sure that voltha is up and running on CORD-POD setup.
4290 1. OLT and ONU is detected and validated.
4291 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4292 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4293 4. Verify that subscriber get ip from dhcp server successfully.
4294 """
4295 """Test subscriber join next for channel surfing with 9 subscribers browsing 1 channels each"""
4296 num_subscribers = 9
4297 num_channels = 1
4298 services = ('DHCP')
4299 cbs = (self.dhcp_flow_check, None, None)
4300 self.voltha_subscribers(services, cbs = cbs,
4301 num_subscribers = num_subscribers,
4302 num_channels = num_channels)
4303
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004304 def test_three_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004305 """
4306 Test Method:
4307 0. Make sure that voltha is up and running on CORD-POD setup.
4308 1. OLT and ONU is detected and validated.
4309 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4310 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4311 4. Verify that subscriber get ip from dhcp server successfully.
4312 """
4313 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4314 num_subscribers = 3
4315 num_channels = 1
4316 services = ('TLS','DHCP')
4317 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4318 self.voltha_subscribers(services, cbs = cbs,
4319 num_subscribers = num_subscribers,
4320 num_channels = num_channels)
4321
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004322 def test_five_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004323 """
4324 Test Method:
4325 0. Make sure that voltha is up and running on CORD-POD setup.
4326 1. OLT and ONU is detected and validated.
4327 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4328 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4329 4. Verify that subscriber get ip from dhcp server successfully.
4330 """
4331 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4332 num_subscribers = 5
4333 num_channels = 1
4334 services = ('TLS','DHCP')
4335 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4336 self.voltha_subscribers(services, cbs = cbs,
4337 num_subscribers = num_subscribers,
4338 num_channels = num_channels)
4339
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004340 def test_nine_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004341 """
4342 Test Method:
4343 0. Make sure that voltha is up and running on CORD-POD setup.
4344 1. OLT and ONU is detected and validated.
4345 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4346 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4347 4. Verify that subscriber get ip from dhcp server successfully.
4348 """
4349 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4350 num_subscribers = 9
4351 num_channels = 1
4352 services = ('TLS','DHCP')
4353 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4354 self.voltha_subscribers(services, cbs = cbs,
4355 num_subscribers = num_subscribers,
4356 num_channels = num_channels)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004357
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004358# @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004359 def test_subscriber_with_voltha_for_dhcprelay_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004360 """
4361 Test Method:
4362 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4363 1. OLT and ONU is detected and validated.
4364 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4365 3. Send dhcp request from residential subscrber to external dhcp server.
4366 4. Verify that subscriber get ip from external dhcp server successfully.
4367 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004368 self.voltha_dhcprelay_setUpClass()
Thangavelu K S6432b522017-07-22 00:05:54 +00004369# if not port_list:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004370# port_list = self.generate_port_list(1, 0)
4371 iface = self.port_map[self.port_list[0][1]]
Thangavelu K S6432b522017-07-22 00:05:54 +00004372 mac = self.get_mac(iface)
4373 self.host_load(iface)
4374 ##we use the defaults for this test that serves as an example for others
4375 ##You don't need to restart dhcpd server if retaining default config
4376 config = self.default_config
4377 options = self.default_options
4378 subnet = self.default_subnet_config
4379 dhcpd_interface_list = self.relay_interfaces
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004380 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004381 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004382 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4383 assert_not_equal(device_id, None)
4384 voltha = VolthaCtrl(**self.voltha_attrs)
4385 time.sleep(10)
4386 switch_map = None
4387 olt_configured = False
4388 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4389 log_test.info('Installing OLT app')
4390 OnosCtrl.install_app(self.olt_app_file)
4391 time.sleep(5)
4392 log_test.info('Adding subscribers through OLT app')
4393 self.config_olt(switch_map)
4394 olt_configured = True
4395 time.sleep(5)
Thangavelu K S6432b522017-07-22 00:05:54 +00004396 self.dhcpd_start(intf_list = dhcpd_interface_list,
4397 config = config,
4398 options = options,
4399 subnet = subnet)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004400 try:
4401 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4402 self.send_recv(mac=mac)
4403 finally:
4404 self.voltha.disable_device(device_id, delete = True)
4405 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004406
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004407 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004408 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004409 """
4410 Test Method:
4411 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4412 1. OLT and ONU is detected and validated.
4413 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4414 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
4415 4. Verify that subscriber should not get ip from external dhcp server.
4416 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004417 self.voltha_dhcprelay_setUpClass()
4418# if not port_list:
4419# port_list = self.generate_port_list(1, 0)
4420 iface = self.port_map[self.port_list[0][1]]
4421 mac = self.get_mac(iface)
4422 self.host_load(iface)
4423 ##we use the defaults for this test that serves as an example for others
4424 ##You don't need to restart dhcpd server if retaining default config
4425 config = self.default_config
4426 options = self.default_options
4427 subnet = self.default_subnet_config
4428 dhcpd_interface_list = self.relay_interfaces
4429 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004430 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004431 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4432 assert_not_equal(device_id, None)
4433 voltha = VolthaCtrl(**self.voltha_attrs)
4434 time.sleep(10)
4435 switch_map = None
4436 olt_configured = False
4437 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4438 log_test.info('Installing OLT app')
4439 OnosCtrl.install_app(self.olt_app_file)
4440 time.sleep(5)
4441 log_test.info('Adding subscribers through OLT app')
4442 self.config_olt(switch_map)
4443 olt_configured = True
4444 time.sleep(5)
4445 self.dhcpd_start(intf_list = dhcpd_interface_list,
4446 config = config,
4447 options = options,
4448 subnet = subnet)
4449 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4450 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
4451 try:
4452 assert_equal(cip,None)
4453 log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
4454 finally:
4455 self.voltha.disable_device(device_id, delete = True)
4456 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004457
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004458# @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004459 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004460 """
4461 Test Method:
4462 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4463 1. OLT and ONU is detected and validated.
4464 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4465 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
4466 4. Verify that subscriber should not get ip from external dhcp server.
4467 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004468 self.voltha_dhcprelay_setUpClass()
4469# if not port_list:
4470# port_list = self.generate_port_list(1, 0)
4471 iface = self.port_map[self.port_list[0][1]]
4472 mac = self.get_mac(iface)
4473 self.host_load(iface)
4474 ##we use the defaults for this test that serves as an example for others
4475 ##You don't need to restart dhcpd server if retaining default config
4476 config = self.default_config
4477 options = self.default_options
4478 subnet = self.default_subnet_config
4479 dhcpd_interface_list = self.relay_interfaces
4480 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004481 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004482 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4483 assert_not_equal(device_id, None)
4484 voltha = VolthaCtrl(**self.voltha_attrs)
4485 time.sleep(10)
4486 switch_map = None
4487 olt_configured = False
4488 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4489 log_test.info('Installing OLT app')
4490 OnosCtrl.install_app(self.olt_app_file)
4491 time.sleep(5)
4492 log_test.info('Adding subscribers through OLT app')
4493 self.config_olt(switch_map)
4494 olt_configured = True
4495 time.sleep(5)
4496 self.dhcpd_start(intf_list = dhcpd_interface_list,
4497 config = config,
4498 options = options,
4499 subnet = subnet)
4500 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4501 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:01:98:05')
4502 try:
4503 assert_equal(cip,None)
4504 log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
4505 finally:
4506 self.voltha.disable_device(device_id, delete = True)
4507 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004508
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004509 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004510 """
4511 Test Method:
4512 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4513 1. OLT and ONU is detected and validated.
4514 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4515 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
4516 4. Verify that subscriber should not get ip from external dhcp server.
4517 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004518 self.voltha_dhcprelay_setUpClass()
4519# if not port_list:
4520# port_list = self.generate_port_list(1, 0)
4521 iface = self.port_map[self.port_list[0][1]]
4522 mac = self.get_mac(iface)
4523 self.host_load(iface)
4524 ##we use the defaults for this test that serves as an example for others
4525 ##You don't need to restart dhcpd server if retaining default config
4526 config = self.default_config
4527 options = self.default_options
4528 subnet = self.default_subnet_config
4529 dhcpd_interface_list = self.relay_interfaces
4530 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004531 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004532 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4533 assert_not_equal(device_id, None)
4534 voltha = VolthaCtrl(**self.voltha_attrs)
4535 time.sleep(10)
4536 switch_map = None
4537 olt_configured = False
4538 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4539 log_test.info('Installing OLT app')
4540 OnosCtrl.install_app(self.olt_app_file)
4541 time.sleep(5)
4542 log_test.info('Adding subscribers through OLT app')
4543 self.config_olt(switch_map)
4544 olt_configured = True
4545 time.sleep(5)
4546 self.dhcpd_start(intf_list = dhcpd_interface_list,
4547 config = config,
4548 options = options,
4549 subnet = subnet)
4550 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4551 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
4552 try:
4553 assert_equal(cip,None)
4554 log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
4555 finally:
4556 self.voltha.disable_device(device_id, delete = True)
4557 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004558
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004559 def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004560 """
4561 Test Method:
4562 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4563 1. OLT and ONU is detected and validated.
4564 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4565 3. Send dhcp request from residential subscrber to external dhcp server.
4566 4. Verify that subscriber get ip from external dhcp server successfully.
4567 5. Send dhcp release from residential subscrber to external dhcp server.
4568 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
4569 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004570 self.voltha_dhcprelay_setUpClass()
4571# if not port_list:
4572# port_list = self.generate_port_list(1, 0)
4573 iface = self.port_map[self.port_list[0][1]]
4574 mac = self.get_mac(iface)
4575 self.host_load(iface)
4576 ##we use the defaults for this test that serves as an example for others
4577 ##You don't need to restart dhcpd server if retaining default config
4578 config = self.default_config
4579 options = self.default_options
4580 subnet = self.default_subnet_config
4581 dhcpd_interface_list = self.relay_interfaces
4582 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004583 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004584 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4585 assert_not_equal(device_id, None)
4586 voltha = VolthaCtrl(**self.voltha_attrs)
4587 time.sleep(10)
4588 switch_map = None
4589 olt_configured = False
4590 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4591 log_test.info('Installing OLT app')
4592 OnosCtrl.install_app(self.olt_app_file)
4593 time.sleep(5)
4594 log_test.info('Adding subscribers through OLT app')
4595 self.config_olt(switch_map)
4596 olt_configured = True
4597 time.sleep(5)
4598 self.dhcpd_start(intf_list = dhcpd_interface_list,
4599 config = config,
4600 options = options,
4601 subnet = subnet)
4602 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = iface)
4603 cip, sip = self.send_recv(mac=mac)
4604 log_test.info('Releasing ip %s to server %s' %(cip, sip))
4605 try:
4606 assert_equal(self.dhcp.release(cip), True)
4607 log_test.info('Triggering DHCP discover again after release')
4608 cip2, sip2 = self.send_recv(mac=mac)
4609 log_test.info('Verifying released IP was given back on rediscover')
4610 assert_equal(cip, cip2)
4611 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
4612 assert_equal(self.dhcp.release(cip2), True)
4613 finally:
4614 self.voltha.disable_device(device_id, delete = True)
4615 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004616
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004617 ##Not yet validated
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004618 def test_subscriber_with_voltha_for_dhcprelay_starvation(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004619 """
4620 Test Method:
4621 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4622 1. OLT and ONU is detected and validated.
4623 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4624 3. Send dhcp request from residential subscriber to external dhcp server.
4625 4. Verify that subscriber get ip from external dhcp server. successfully.
4626 5. Repeat step 3 and 4 for 10 times.
4627 6 Verify that subscriber should get ip from external dhcp server..
4628 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004629 self.voltha_dhcprelay_setUpClass()
4630# if not port_list:
4631# port_list = self.generate_port_list(1, 0)
4632 iface = self.port_map[self.port_list[0][1]]
4633 mac = self.get_mac(iface)
4634 self.host_load(iface)
4635 ##we use the defaults for this test that serves as an example for others
4636 ##You don't need to restart dhcpd server if retaining default config
4637 config = self.default_config
4638 options = self.default_options
4639 subnet = self.default_subnet_config
4640 dhcpd_interface_list = self.relay_interfaces
4641 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004642 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004643 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4644 assert_not_equal(device_id, None)
4645 voltha = VolthaCtrl(**self.voltha_attrs)
4646 time.sleep(10)
4647 switch_map = None
4648 olt_configured = False
4649 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4650 log_test.info('Installing OLT app')
4651 OnosCtrl.install_app(self.olt_app_file)
4652 time.sleep(5)
4653 log_test.info('Adding subscribers through OLT app')
4654 self.config_olt(switch_map)
4655 olt_configured = True
4656 time.sleep(5)
4657 self.dhcpd_start(intf_list = dhcpd_interface_list,
4658 config = config,
4659 options = options,
4660 subnet = subnet)
4661 #self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = iface)
4662 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4663 log_test.info('Verifying 1 ')
4664 count = 0
4665 while True:
4666 #mac = RandMAC()._fix()
4667 cip, sip = self.send_recv(mac=mac,update_seed = True,validate = False)
4668 if cip is None:
4669 break
4670 else:
4671 count += 1
4672 assert_equal(count,91)
4673 log_test.info('Verifying 2 ')
4674 cip, sip = self.send_recv(mac=mac, update_seed = True, validate = False)
4675 try:
4676 assert_equal(cip, None)
4677 assert_equal(sip, None)
4678 finally:
4679 self.voltha.disable_device(device_id, delete = True)
4680 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004681
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004682 def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004683 """
4684 Test Method:
4685 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4686 1. OLT and ONU is detected and validated.
4687 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4688 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
4689 4. Verify that subscriber should not get ip from external dhcp server..
4690 5. Repeat steps 3 and 4 for 10 times.
4691 6 Verify that subscriber should not get ip from external dhcp server..
4692 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004693 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004694 """
4695 Test Method:
4696 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4697 1. OLT and ONU is detected and validated.
4698 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4699 3. Send dhcp request from residential subscriber to external dhcp server.
4700 4. Verify that subscriber get ip from external dhcp server. successfully.
4701 5. Repeat step 3 for 50 times.
4702 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4703 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004704 self.voltha_dhcprelay_setUpClass()
4705# if not port_list:
4706# port_list = self.generate_port_list(1, 0)
4707 iface = self.port_map[self.port_list[0][1]]
4708 mac = self.get_mac(iface)
4709 self.host_load(iface)
4710 ##we use the defaults for this test that serves as an example for others
4711 ##You don't need to restart dhcpd server if retaining default config
4712 config = self.default_config
4713 options = self.default_options
4714 subnet = self.default_subnet_config
4715 dhcpd_interface_list = self.relay_interfaces
4716 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004717 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004718 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4719 assert_not_equal(device_id, None)
4720 voltha = VolthaCtrl(**self.voltha_attrs)
4721 time.sleep(10)
4722 switch_map = None
4723 olt_configured = False
4724 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4725 log_test.info('Installing OLT app')
4726 OnosCtrl.install_app(self.olt_app_file)
4727 time.sleep(5)
4728 log_test.info('Adding subscribers through OLT app')
4729 self.config_olt(switch_map)
4730 olt_configured = True
4731 time.sleep(5)
4732 self.dhcpd_start(intf_list = dhcpd_interface_list,
4733 config = config,
4734 options = options,
4735 subnet = subnet)
4736 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4737 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
4738 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCP REQUEST.' %
4739 (cip, sip, mac) )
4740 try:
4741 assert_not_equal(cip, None)
4742 log_test.info('Triggering DHCP discover again.')
4743 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover(mac=mac)
4744 assert_equal(new_cip, cip)
4745 log_test.info('Got same ip to same the client when sent discover again, as expected')
4746 finally:
4747 self.voltha.disable_device(device_id, delete = True)
4748 self.voltha_dhcprelay_tearDownClass()
4749
4750 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_requests(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004751 """
4752 Test Method:
4753 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4754 1. OLT and ONU is detected and validated.
4755 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4756 3. Send dhcp request from residential subscriber to external dhcp server.
4757 4. Verify that subscriber get ip from external dhcp server. successfully.
4758 5. Send DHCP request to external dhcp server.
4759 6. Repeat step 5 for 50 times.
4760 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4761 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004762 self.voltha_dhcprelay_setUpClass()
4763# if not port_list:
4764# port_list = self.generate_port_list(1, 0)
4765 iface = self.port_map[self.port_list[0][1]]
4766 mac = self.get_mac(iface)
4767 self.host_load(iface)
4768 ##we use the defaults for this test that serves as an example for others
4769 ##You don't need to restart dhcpd server if retaining default config
4770 config = self.default_config
4771 options = self.default_options
4772 subnet = self.default_subnet_config
4773 dhcpd_interface_list = self.relay_interfaces
4774 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004775 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004776 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4777 assert_not_equal(device_id, None)
4778 voltha = VolthaCtrl(**self.voltha_attrs)
4779 time.sleep(10)
4780 switch_map = None
4781 olt_configured = False
4782 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4783 log_test.info('Installing OLT app')
4784 OnosCtrl.install_app(self.olt_app_file)
4785 time.sleep(5)
4786 log_test.info('Adding subscribers through OLT app')
4787 self.config_olt(switch_map)
4788 olt_configured = True
4789 time.sleep(5)
4790 self.dhcpd_start(intf_list = dhcpd_interface_list,
4791 config = config,
4792 options = options,
4793 subnet = subnet)
4794 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4795 log_test.info('Sending DHCP discover and DHCP request.')
4796 cip, sip = self.send_recv(mac=mac)
4797 mac = self.dhcp.get_mac(cip)[0]
4798 log_test.info("Sending DHCP request again.")
4799 new_cip, new_sip = self.dhcp.only_request(cip, mac)
4800 try:
4801 assert_equal(new_cip, cip)
4802 log_test.info('got same ip to smae the client when sent request again, as expected')
4803 finally:
4804 self.voltha.disable_device(device_id, delete = True)
4805 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004806
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004807 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004808 """
4809 Test Method:
4810 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4811 1. OLT and ONU is detected and validated.
4812 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4813 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
4814 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
4815 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004816 self.voltha_dhcprelay_setUpClass()
4817# if not port_list:
4818# port_list = self.generate_port_list(1, 0)
4819 iface = self.port_map[self.port_list[0][1]]
4820 mac = self.get_mac(iface)
4821 self.host_load(iface)
4822 ##we use the defaults for this test that serves as an example for others
4823 ##You don't need to restart dhcpd server if retaining default config
4824 config = self.default_config
4825 options = self.default_options
4826 subnet = self.default_subnet_config
4827 dhcpd_interface_list = self.relay_interfaces
4828 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004829 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004830 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4831 assert_not_equal(device_id, None)
4832 voltha = VolthaCtrl(**self.voltha_attrs)
4833 time.sleep(10)
4834 switch_map = None
4835 olt_configured = False
4836 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4837 log_test.info('Installing OLT app')
4838 OnosCtrl.install_app(self.olt_app_file)
4839 time.sleep(5)
4840 log_test.info('Adding subscribers through OLT app')
4841 self.config_olt(switch_map)
4842 olt_configured = True
4843 time.sleep(5)
4844 self.dhcpd_start(intf_list = dhcpd_interface_list,
4845 config = config,
4846 options = options,
4847 subnet = subnet)
4848 self.dhcp = DHCPTest(seed_ip = '192.168.1.31', iface = iface)
4849 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac,desired = True)
4850 try:
4851 assert_equal(cip,self.dhcp.seed_ip)
4852 log_test.info('Got dhcp client desired IP %s from server %s for mac %s as expected' %
4853 (cip, sip, mac) )
4854 finally:
4855 self.voltha.disable_device(device_id, delete = True)
4856 self.voltha_dhcprelay_tearDownClass()
4857
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004858 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004859 """
4860 Test Method:
4861 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4862 1. OLT and ONU is detected and validated.
4863 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4864 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
4865 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.
4866 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004867 self.voltha_dhcprelay_setUpClass()
4868# if not port_list:
4869# port_list = self.generate_port_list(1, 0)
4870 iface = self.port_map[self.port_list[0][1]]
4871 mac = self.get_mac(iface)
4872 self.host_load(iface)
4873 ##we use the defaults for this test that serves as an example for others
4874 ##You don't need to restart dhcpd server if retaining default config
4875 config = self.default_config
4876 options = self.default_options
4877 subnet = self.default_subnet_config
4878 dhcpd_interface_list = self.relay_interfaces
4879 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004880 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004881 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4882 assert_not_equal(device_id, None)
4883 voltha = VolthaCtrl(**self.voltha_attrs)
4884 time.sleep(10)
4885 switch_map = None
4886 olt_configured = False
4887 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4888 log_test.info('Installing OLT app')
4889 OnosCtrl.install_app(self.olt_app_file)
4890 time.sleep(5)
4891 log_test.info('Adding subscribers through OLT app')
4892 self.config_olt(switch_map)
4893 olt_configured = True
4894 time.sleep(5)
4895 self.dhcpd_start(intf_list = dhcpd_interface_list,
4896 config = config,
4897 options = options,
4898 subnet = subnet)
4899 self.dhcp = DHCPTest(seed_ip = '20.20.20.35', iface = iface)
4900 cip, sip, mac, _ = self.dhcp.only_discover(mac= mac,desired = True)
4901 try:
4902 assert_not_equal(cip,None)
4903 assert_not_equal(cip,self.dhcp.seed_ip)
4904 log_test.info('server offered IP from its pool when requested out of pool IP, as expected')
4905 finally:
4906 self.voltha.disable_device(device_id, delete = True)
4907 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004908
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004909 def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004910 """
4911 Test Method:
4912 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4913 1. OLT and ONU is detected and validated.
4914 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4915 3. Send dhcp request from residential subscriber to external dhcp server.
4916 4. Verify that subscriber get ip from external dhcp server. successfully.
4917 5. Deactivate dhcp server app in onos.
4918 6. Repeat step 3.
4919 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4920 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004921 self.voltha_dhcprelay_setUpClass()
4922# if not port_list:
4923# port_list = self.generate_port_list(1, 0)
4924 iface = self.port_map[self.port_list[0][1]]
4925 mac = self.get_mac(iface)
4926 self.host_load(iface)
4927 ##we use the defaults for this test that serves as an example for others
4928 ##You don't need to restart dhcpd server if retaining default config
4929 config = self.default_config
4930 options = self.default_options
4931 subnet = self.default_subnet_config
4932 dhcpd_interface_list = self.relay_interfaces
4933 log_test.info('Enabling ponsim_olt')
4934 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4935 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4936 assert_not_equal(device_id, None)
4937 voltha = VolthaCtrl(**self.voltha_attrs)
4938 time.sleep(10)
4939 switch_map = None
4940 olt_configured = False
4941 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4942 log_test.info('Installing OLT app')
4943 OnosCtrl.install_app(self.olt_app_file)
4944 time.sleep(5)
4945 log_test.info('Adding subscribers through OLT app')
4946 self.config_olt(switch_map)
4947 olt_configured = True
4948 time.sleep(5)
4949 self.dhcpd_start(intf_list = dhcpd_interface_list,
4950 config = config,
4951 options = options,
4952 subnet = subnet)
4953 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4954 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
4955 thread2 = threading.Thread(target = self.deactivate_apps, args = (self.app_dhcprelay,))
4956 log_test.info('Restart dhcprelay app in onos during client send discover to voltha')
4957 thread2.start()
4958 thread1.start()
4959 time.sleep(10)
4960 thread1.join()
4961 thread2.join()
4962 try:
4963 assert_equal(self.success, False)
4964 #assert_equal(status, True)
4965 time.sleep(10)
4966 finally:
4967 self.voltha.disable_device(device_id, delete = True)
4968 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004969
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004970 def test_subscriber_with_voltha_for_dhcprelay_renew_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004971 """
4972 Test Method:
4973 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4974 1. OLT and ONU is detected and validated.
4975 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4976 3. Send dhcp request from residential subscriber to external dhcp server.
4977 4. Verify that subscriber get ip from external dhcp server. successfully.
4978 5. Send dhcp renew packet to external dhcp server.
4979 6. Repeat step 4.
4980 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004981 self.voltha_dhcprelay_setUpClass()
4982# if not port_list:
4983# port_list = self.generate_port_list(1, 0)
4984 iface = self.port_map[self.port_list[0][1]]
4985 mac = self.get_mac(iface)
4986 self.host_load(iface)
4987 ##we use the defaults for this test that serves as an example for others
4988 ##You don't need to restart dhcpd server if retaining default config
4989 config = self.default_config
4990 new_options = [('dhcp-renewal-time', 100), ('dhcp-rebinding-time', 125)]
4991 options = self.default_options + new_options
4992 subnet = self.default_subnet_config
4993 dhcpd_interface_list = self.relay_interfaces
4994 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004995 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004996 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4997 assert_not_equal(device_id, None)
4998 voltha = VolthaCtrl(**self.voltha_attrs)
4999 time.sleep(10)
5000 switch_map = None
5001 olt_configured = False
5002 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5003 log_test.info('Installing OLT app')
5004 OnosCtrl.install_app(self.olt_app_file)
5005 time.sleep(5)
5006 log_test.info('Adding subscribers through OLT app')
5007 self.config_olt(switch_map)
5008 olt_configured = True
5009 time.sleep(5)
5010 self.dhcpd_start(intf_list = dhcpd_interface_list,
5011 config = config,
5012 options = options,
5013 subnet = subnet)
5014 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
5015 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
5016 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
5017 (cip, sip, mac) )
5018 try:
5019 assert_not_equal(cip,None)
5020 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
5021 log_test.info('Waiting for renew time..')
5022 time.sleep(lval)
5023 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac, unicast = True)
5024 assert_equal(latest_cip, cip)
5025 log_test.info('Server renewed client IP when client sends request after renew time, as expected')
5026 finally:
5027 self.voltha.disable_device(device_id, delete = True)
5028 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005029
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005030 def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005031 """
5032 Test Method:
5033 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5034 1. OLT and ONU is detected and validated.
5035 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5036 3. Send dhcp request from residential subscriber to external dhcp server.
5037 4. Verify that subscriber get ip from external dhcp server. successfully.
5038 5. Send dhcp rebind packet to external dhcp server.
5039 6. Repeat step 4.
5040 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00005041 self.voltha_dhcprelay_setUpClass()
5042# if not port_list:
5043# port_list = self.generate_port_list(1, 0)
5044 iface = self.port_map[self.port_list[0][1]]
5045 mac = self.get_mac(iface)
5046 self.host_load(iface)
5047 ##we use the defaults for this test that serves as an example for others
5048 ##You don't need to restart dhcpd server if retaining default config
5049 config = self.default_config
5050 new_options = [('dhcp-renewal-time', 100), ('dhcp-rebinding-time', 125)]
5051 options = self.default_options + new_options
5052 subnet = self.default_subnet_config
5053 dhcpd_interface_list = self.relay_interfaces
5054 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07005055 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00005056 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5057 assert_not_equal(device_id, None)
5058 voltha = VolthaCtrl(**self.voltha_attrs)
5059 time.sleep(10)
5060 switch_map = None
5061 olt_configured = False
5062 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5063 log_test.info('Installing OLT app')
5064 OnosCtrl.install_app(self.olt_app_file)
5065 time.sleep(5)
5066 log_test.info('Adding subscribers through OLT app')
5067 self.config_olt(switch_map)
5068 olt_configured = True
5069 time.sleep(5)
5070 self.dhcpd_start(intf_list = dhcpd_interface_list,
5071 config = config,
5072 options = options,
5073 subnet = subnet)
5074 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
5075 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
5076 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
5077 (cip, sip, mac) )
5078 try:
5079 assert_not_equal(cip,None)
5080 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
5081 log_test.info('Waiting for rebind time..')
5082 time.sleep(lval)
5083 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
5084 assert_equal(latest_cip, cip)
5085 log_test.info('Server renewed client IP when client sends request after rebind time, as expected')
5086 finally:
5087 self.voltha.disable_device(device_id, delete = True)
5088 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005089
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005090 def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005091 """
5092 Test Method:
5093 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5094 1. OLT and ONU is detected and validated.
5095 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5096 3. Send dhcp request from residential subscriber to external dhcp server.
5097 4. Verify that subscriber get ip from external dhcp server. successfully.
5098 5. Disable olt devices which is being detected in voltha CLI.
5099 6. Repeat step 3.
5100 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5101 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005102 self.voltha_dhcprelay_setUpClass()
5103# if not port_list:
5104# port_list = self.generate_port_list(1, 0)
5105 iface = self.port_map[self.port_list[0][1]]
5106 mac = self.get_mac(iface)
5107 self.host_load(iface)
5108 ##we use the defaults for this test that serves as an example for others
5109 ##You don't need to restart dhcpd server if retaining default config
5110 config = self.default_config
5111 options = self.default_options
5112 subnet = self.default_subnet_config
5113 dhcpd_interface_list = self.relay_interfaces
5114 log_test.info('Enabling ponsim_olt')
5115 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5116 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5117 assert_not_equal(device_id, None)
5118 voltha = VolthaCtrl(**self.voltha_attrs)
5119 time.sleep(10)
5120 switch_map = None
5121 olt_configured = False
5122 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5123 log_test.info('Installing OLT app')
5124 OnosCtrl.install_app(self.olt_app_file)
5125 time.sleep(5)
5126 log_test.info('Adding subscribers through OLT app')
5127 self.config_olt(switch_map)
5128 olt_configured = True
5129 time.sleep(5)
5130 self.dhcpd_start(intf_list = dhcpd_interface_list,
5131 config = config,
5132 options = options,
5133 subnet = subnet)
5134 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
5135 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
5136 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
5137 log_test.info('Disable olt devices during client send discover to voltha')
5138 thread2.start()
5139 time.sleep(4)
5140 thread1.start()
5141 time.sleep(10)
5142 thread1.join()
5143 thread2.join()
5144 try:
5145 assert_equal(self.success, False)
5146 #assert_equal(status, True)
5147 time.sleep(10)
5148 finally:
5149 self.voltha.disable_device(device_id, delete = True)
5150 self.voltha_dhcprelay_tearDownClass()
5151
Thangavelu K S057b7d22017-05-16 22:03:22 +00005152
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005153 def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005154 """
5155 Test Method:
5156 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5157 1. OLT and ONU is detected and validated.
5158 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5159 3. Send dhcp request from residential subscriber to external dhcp server.
5160 4. Verify that subscriber get ip from external dhcp server. successfully.
5161 5. Disable olt devices which is being detected in voltha CLI.
5162 6. Repeat step 3.
5163 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5164 8. Enable olt devices which is being detected in voltha CLI.
5165 9. Repeat steps 3 and 4.
5166 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005167 self.voltha_dhcprelay_setUpClass()
5168# if not port_list:
5169# port_list = self.generate_port_list(1, 0)
5170 iface = self.port_map[self.port_list[0][1]]
5171 mac = self.get_mac(iface)
5172 self.host_load(iface)
5173 ##we use the defaults for this test that serves as an example for others
5174 ##You don't need to restart dhcpd server if retaining default config
5175 config = self.default_config
5176 options = self.default_options
5177 subnet = self.default_subnet_config
5178 dhcpd_interface_list = self.relay_interfaces
5179 log_test.info('Enabling ponsim_olt')
5180 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5181 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5182 assert_not_equal(device_id, None)
5183 voltha = VolthaCtrl(**self.voltha_attrs)
5184 time.sleep(10)
5185 switch_map = None
5186 olt_configured = False
5187 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5188 log_test.info('Installing OLT app')
5189 OnosCtrl.install_app(self.olt_app_file)
5190 time.sleep(5)
5191 log_test.info('Adding subscribers through OLT app')
5192 self.config_olt(switch_map)
5193 olt_configured = True
5194 time.sleep(5)
5195 self.dhcpd_start(intf_list = dhcpd_interface_list,
5196 config = config,
5197 options = options,
5198 subnet = subnet)
5199 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
5200 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
5201 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
5202 log_test.info('Restart olt devices during client send discover to voltha')
5203 thread2.start()
5204 time.sleep(4)
5205 thread1.start()
5206 time.sleep(10)
5207 thread1.join()
5208 thread2.join()
5209 try:
5210 assert_equal(self.success, False)
5211 #assert_equal(status, True)
5212 time.sleep(10)
5213 finally:
5214 self.voltha.disable_device(device_id, delete = True)
5215 self.voltha_dhcprelay_tearDownClass()
5216
Thangavelu K S057b7d22017-05-16 22:03:22 +00005217
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005218 def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005219 """
5220 Test Method:
5221 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5222 1. OLT and ONU is detected and validated.
5223 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5224 3. Send dhcp request from residential subscriber to external dhcp server.
5225 4. Verify that subscriber get ip from external dhcp server. successfully.
5226 5. Disable onu port which is being detected in voltha CLI.
5227 6. Repeat step 3.
5228 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5229 """
5230
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005231 self.voltha_dhcprelay_setUpClass()
5232# if not port_list:
5233# port_list = self.generate_port_list(1, 0)
5234 iface = self.port_map[self.port_list[0][1]]
5235 mac = self.get_mac(iface)
5236 self.host_load(iface)
5237 ##we use the defaults for this test that serves as an example for others
5238 ##You don't need to restart dhcpd server if retaining default config
5239 config = self.default_config
5240 options = self.default_options
5241 subnet = self.default_subnet_config
5242 dhcpd_interface_list = self.relay_interfaces
5243 log_test.info('Enabling ponsim_olt')
5244 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5245 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5246 assert_not_equal(device_id, None)
5247 voltha = VolthaCtrl(**self.voltha_attrs)
5248 time.sleep(10)
5249 switch_map = None
5250 olt_configured = False
5251 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5252 log_test.info('Installing OLT app')
5253 OnosCtrl.install_app(self.olt_app_file)
5254 time.sleep(5)
5255 log_test.info('Adding subscribers through OLT app')
5256 self.config_olt(switch_map)
5257 olt_configured = True
5258 time.sleep(5)
5259 self.dhcpd_start(intf_list = dhcpd_interface_list,
5260 config = config,
5261 options = options,
5262 subnet = subnet)
5263 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
5264 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
5265 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
5266 log_test.info('Restart olt devices during client send discover to voltha')
5267 thread2.start()
5268 time.sleep(4)
5269 thread1.start()
5270 time.sleep(10)
5271 thread1.join()
5272 thread2.join()
5273 try:
5274 assert_equal(self.success, False)
5275 #assert_equal(status, True)
5276 time.sleep(10)
5277 finally:
5278 self.voltha.disable_device(device_id, delete = True)
5279 self.voltha_dhcprelay_tearDownClass()
5280
5281 def test_subscriber_with_voltha_for_dhcprelay_toggle_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005282 """
5283 Test Method:
5284 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5285 1. OLT and ONU is detected and validated.
5286 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5287 3. Send dhcp request from residential subscriber to external dhcp server.
5288 4. Verify that subscriber get ip from external dhcp server. successfully.
5289 5. Disable onu port which is being detected in voltha CLI.
5290 6. Repeat step 3.
5291 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5292 8. Enable onu port which is being detected in voltha CLI.
5293 9. Repeat steps 3 and 4.
5294 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005295 self.voltha_dhcprelay_setUpClass()
5296# if not port_list:
5297# port_list = self.generate_port_list(1, 0)
5298 iface = self.port_map[self.port_list[0][1]]
5299 mac = self.get_mac(iface)
5300 self.host_load(iface)
5301 ##we use the defaults for this test that serves as an example for others
5302 ##You don't need to restart dhcpd server if retaining default config
5303 config = self.default_config
5304 options = self.default_options
5305 subnet = self.default_subnet_config
5306 dhcpd_interface_list = self.relay_interfaces
5307 log_test.info('Enabling ponsim_olt')
5308 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5309 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5310 assert_not_equal(device_id, None)
5311 voltha = VolthaCtrl(**self.voltha_attrs)
5312 time.sleep(10)
5313 switch_map = None
5314 olt_configured = False
5315 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5316 log_test.info('Installing OLT app')
5317 OnosCtrl.install_app(self.olt_app_file)
5318 time.sleep(5)
5319 log_test.info('Adding subscribers through OLT app')
5320 self.config_olt(switch_map)
5321 olt_configured = True
5322 time.sleep(5)
5323 self.dhcpd_start(intf_list = dhcpd_interface_list,
5324 config = config,
5325 options = options,
5326 subnet = subnet)
5327 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
5328 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
5329 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
5330 log_test.info('Restart olt devices during client send discover to voltha')
5331 thread2.start()
5332 time.sleep(4)
5333 thread1.start()
5334 time.sleep(10)
5335 thread1.join()
5336 thread2.join()
5337 try:
5338 assert_equal(self.success, False)
5339 #assert_equal(status, True)
5340 time.sleep(10)
5341 cip, sip = self.send_recv(mac=mac)
5342 finally:
5343 self.voltha.disable_device(device_id, delete = True)
5344 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005345
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005346 def test_two_subscribers_with_voltha_for_dhcprelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005347 """
5348 Test Method:
5349 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5350 1. OLT and ONU is detected and validated.
5351 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5352 3. Send dhcp request from two residential subscribers to external dhcp server.
5353 4. Verify that subscribers had got different ips from external dhcp server. successfully.
5354 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005355 self.voltha_dhcprelay_setUpClass()
5356# if not port_list:
5357# port_list = self.generate_port_list(1, 0)
5358 iface_1 = self.port_map[self.port_list[0][1]]
5359 iface_2 = self.port_map[self.port_list[3][1]]
5360 mac_1 = self.get_mac(iface_1)
5361 mac_2 = self.get_mac(iface_2)
5362 self.host_load(iface_1)
5363 self.host_load(iface_2)
5364 ##we use the defaults for this test that serves as an example for others
5365 ##You don't need to restart dhcpd server if retaining default config
5366 config = self.default_config
5367 options = self.default_options
5368 subnet = self.default_subnet_config
5369 dhcpd_interface_list = self.relay_interfaces
5370 log_test.info('Enabling ponsim_olt')
5371 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5372 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5373 assert_not_equal(device_id, None)
5374 voltha = VolthaCtrl(**self.voltha_attrs)
5375 time.sleep(10)
5376 switch_map = None
5377 olt_configured = False
5378 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5379 log_test.info('Installing OLT app')
5380 OnosCtrl.install_app(self.olt_app_file)
5381 time.sleep(5)
5382 log_test.info('Adding subscribers through OLT app')
5383 self.config_olt(switch_map)
5384 olt_configured = True
5385 time.sleep(5)
5386 self.dhcpd_start(intf_list = dhcpd_interface_list,
5387 config = config,
5388 options = options,
5389 subnet = subnet)
5390 self.dhcp_1 = DHCPTest(seed_ip = '10.10.10.1', iface = iface_1)
5391 self.dhcp_2 = DHCPTest(seed_ip = '20.20.20.1', iface = iface_2)
5392 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac_1,False,True,self.dhcp_1,))
5393 thread2 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac_2,False,True,self.dhcp_2,))
5394# log_test.info('Restart olt devices during client send discover to voltha')
5395 thread2.start()
5396 time.sleep(4)
5397 thread1.start()
5398 time.sleep(10)
5399 thread1.join()
5400 thread2.join()
5401 try:
5402 assert_equal(self.success, True)
5403 #assert_equal(status, True)
5404 time.sleep(10)
5405 finally:
5406 self.voltha.disable_device(device_id, delete = True)
5407 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005408
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005409 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005410 """
5411 Test Method:
5412 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5413 1. OLT and ONU is detected and validated.
5414 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5415 3. Send dhcp request from two residential subscribers to external dhcp server.
5416 4. Verify that subscribers had got ip from external dhcp server. successfully.
5417 5. Repeat step 3 and 4 for 10 times for both subscribers.
5418 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
5419 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005420 self.voltha_dhcprelay_setUpClass()
5421# if not port_list:
5422# port_list = self.generate_port_list(1, 0)
5423 iface_1 = self.port_map[self.port_list[0][1]]
5424 iface_2 = self.port_map[self.port_list[3][1]]
5425 mac_1 = self.get_mac(iface_1)
5426 mac_2 = self.get_mac(iface_2)
5427 self.host_load(iface_1)
5428 self.host_load(iface_2)
5429 ##we use the defaults for this test that serves as an example for others
5430 ##You don't need to restart dhcpd server if retaining default config
5431 config = self.default_config
5432 options = self.default_options
5433 subnet = self.default_subnet_config
5434 dhcpd_interface_list = self.relay_interfaces
5435 log_test.info('Enabling ponsim_olt')
5436 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5437 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5438 assert_not_equal(device_id, None)
5439 voltha = VolthaCtrl(**self.voltha_attrs)
5440 time.sleep(10)
5441 switch_map = None
5442 olt_configured = False
5443 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5444 log_test.info('Installing OLT app')
5445 OnosCtrl.install_app(self.olt_app_file)
5446 time.sleep(5)
5447 log_test.info('Adding subscribers through OLT app')
5448 self.config_olt(switch_map)
5449 olt_configured = True
5450 time.sleep(5)
5451 self.dhcpd_start(intf_list = dhcpd_interface_list,
5452 config = config,
5453 options = options,
5454 subnet = subnet)
5455
5456 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,'multiple_discover',))
5457 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'multiple_discover',))
5458 #log_test.info('Restart olt devices during client send discover to voltha')
5459 thread2.start()
5460 time.sleep(4)
5461 thread1.start()
5462 time.sleep(10)
5463 thread1.join()
5464 thread2.join()
5465 try:
5466 assert_equal(self.success, True)
5467 #assert_equal(status, True)
5468 time.sleep(10)
5469 finally:
5470 self.voltha.disable_device(device_id, delete = True)
5471 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005472
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005473 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005474 """
5475 Test Method:
5476 0. Make sure that voltha and external dhcp server are 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. Send dhcp request from two residential subscribers to external dhcp server.
5480 4. Verify that subscribers had got ip from external dhcp server. successfully.
5481 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
5482 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
5483 """
5484
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005485 self.voltha_dhcprelay_setUpClass()
5486# if not port_list:
5487# port_list = self.generate_port_list(1, 0)
5488 iface_1 = self.port_map[self.port_list[0][1]]
5489 iface_2 = self.port_map[self.port_list[3][1]]
5490 mac_1 = self.get_mac(iface_1)
5491 mac_2 = self.get_mac(iface_2)
5492 self.host_load(iface_1)
5493 self.host_load(iface_2)
5494 ##we use the defaults for this test that serves as an example for others
5495 ##You don't need to restart dhcpd server if retaining default config
5496 config = self.default_config
5497 options = self.default_options
5498 subnet = self.default_subnet_config
5499 dhcpd_interface_list = self.relay_interfaces
5500 log_test.info('Enabling ponsim_olt')
5501 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5502 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5503 assert_not_equal(device_id, None)
5504 voltha = VolthaCtrl(**self.voltha_attrs)
5505 time.sleep(10)
5506 switch_map = None
5507 olt_configured = False
5508 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5509 log_test.info('Installing OLT app')
5510 OnosCtrl.install_app(self.olt_app_file)
5511 time.sleep(5)
5512 log_test.info('Adding subscribers through OLT app')
5513 self.config_olt(switch_map)
5514 olt_configured = True
5515 time.sleep(5)
5516 self.dhcpd_start(intf_list = dhcpd_interface_list,
5517 config = config,
5518 options = options,
5519 subnet = subnet)
5520
5521 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,))
5522 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'multiple_discover',))
5523 #log_test.info('Restart olt devices during client send discover to voltha')
5524 thread2.start()
5525 time.sleep(4)
5526 thread1.start()
5527 time.sleep(10)
5528 thread1.join()
5529 thread2.join()
5530 try:
5531 assert_equal(self.success, True)
5532 #assert_equal(status, True)
5533 time.sleep(10)
5534 finally:
5535 self.voltha.disable_device(device_id, delete = True)
5536 self.voltha_dhcprelay_tearDownClass()
5537
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005538 def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005539 """
5540 Test Method:
5541 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5542 1. OLT and ONU is detected and validated.
5543 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5544 3. Send dhcp request from one residential subscriber to external dhcp server.
5545 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
5546 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
5547 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005548 self.voltha_dhcprelay_setUpClass()
5549# if not port_list:
5550# port_list = self.generate_port_list(1, 0)
5551 iface_1 = self.port_map[self.port_list[0][1]]
5552 iface_2 = self.port_map[self.port_list[3][1]]
5553 mac_1 = self.get_mac(iface_1)
5554 mac_2 = self.get_mac(iface_2)
5555 self.host_load(iface_1)
5556 self.host_load(iface_2)
5557 ##we use the defaults for this test that serves as an example for others
5558 ##You don't need to restart dhcpd server if retaining default config
5559 config = self.default_config
5560 options = self.default_options
5561 subnet = self.default_subnet_config
5562 dhcpd_interface_list = self.relay_interfaces
5563 log_test.info('Enabling ponsim_olt')
5564 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5565 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5566 assert_not_equal(device_id, None)
5567 voltha = VolthaCtrl(**self.voltha_attrs)
5568 time.sleep(10)
5569 switch_map = None
5570 olt_configured = False
5571 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5572 log_test.info('Installing OLT app')
5573 OnosCtrl.install_app(self.olt_app_file)
5574 time.sleep(5)
5575 log_test.info('Adding subscribers through OLT app')
5576 self.config_olt(switch_map)
5577 olt_configured = True
5578 time.sleep(5)
5579 self.dhcpd_start(intf_list = dhcpd_interface_list,
5580 config = config,
5581 options = options,
5582 subnet = subnet)
5583
5584 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,))
5585 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'desired_ip',))
5586 #log_test.info('Restart olt devices during client send discover to voltha')
5587 thread2.start()
5588 time.sleep(4)
5589 thread1.start()
5590 time.sleep(10)
5591 thread1.join()
5592 thread2.join()
5593 try:
5594 assert_equal(self.success, True)
5595 #assert_equal(status, True)
5596 time.sleep(10)
5597 finally:
5598 self.voltha.disable_device(device_id, delete = True)
5599 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005600
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005601 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 +00005602 """
5603 Test Method:
5604 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5605 1. OLT and ONU is detected and validated.
5606 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5607 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
5608 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
5609 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
5610 """
5611
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005612 self.voltha_dhcprelay_setUpClass()
5613# if not port_list:
5614# port_list = self.generate_port_list(1, 0)
5615 iface_1 = self.port_map[self.port_list[0][1]]
5616 iface_2 = self.port_map[self.port_list[3][1]]
5617 mac_1 = self.get_mac(iface_1)
5618 mac_2 = self.get_mac(iface_2)
5619 self.host_load(iface_1)
5620 self.host_load(iface_2)
5621 ##we use the defaults for this test that serves as an example for others
5622 ##You don't need to restart dhcpd server if retaining default config
5623 config = self.default_config
5624 options = self.default_options
5625 subnet = self.default_subnet_config
5626 dhcpd_interface_list = self.relay_interfaces
5627 log_test.info('Enabling ponsim_olt')
5628 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5629 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5630 assert_not_equal(device_id, None)
5631 voltha = VolthaCtrl(**self.voltha_attrs)
5632 time.sleep(10)
5633 switch_map = None
5634 olt_configured = False
5635 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5636 log_test.info('Installing OLT app')
5637 OnosCtrl.install_app(self.olt_app_file)
5638 time.sleep(5)
5639 log_test.info('Adding subscribers through OLT app')
5640 self.config_olt(switch_map)
5641 olt_configured = True
5642 time.sleep(5)
5643 self.dhcpd_start(intf_list = dhcpd_interface_list,
5644 config = config,
5645 options = options,
5646 subnet = subnet)
5647
5648 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,))
5649 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'out_of_pool_ip',))
5650 #log_test.info('Restart olt devices during client send discover to voltha')
5651 thread2.start()
5652 time.sleep(4)
5653 thread1.start()
5654 time.sleep(10)
5655 thread1.join()
5656 thread2.join()
5657 try:
5658 assert_equal(self.success, True)
5659 #assert_equal(status, True)
5660 time.sleep(10)
5661 finally:
5662 self.voltha.disable_device(device_id, delete = True)
5663 self.voltha_dhcprelay_tearDownClass()
5664
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005665 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005666 """
5667 Test Method:
5668 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5669 1. OLT and ONU is detected and validated.
5670 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5671 3. Send dhcp request from two residential subscribers to external dhcp server.
5672 4. Verify that subscribers had got ip from external dhcp server. successfully.
5673 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
5674 6. Repeat step 3 and 4 for one subscriber where uni port is down.
5675 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5676 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005677 self.voltha_dhcprelay_setUpClass()
5678# if not port_list:
5679# port_list = self.generate_port_list(1, 0)
5680 iface_1 = self.port_map[self.port_list[0][1]]
5681 iface_2 = self.port_map[self.port_list[3][1]]
5682 mac_1 = self.get_mac(iface_1)
5683 mac_2 = self.get_mac(iface_2)
5684 self.host_load(iface_1)
5685 self.host_load(iface_2)
5686 ##we use the defaults for this test that serves as an example for others
5687 ##You don't need to restart dhcpd server if retaining default config
5688 config = self.default_config
5689 options = self.default_options
5690 subnet = self.default_subnet_config
5691 dhcpd_interface_list = self.relay_interfaces
5692 log_test.info('Enabling ponsim_olt')
5693 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5694 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5695 assert_not_equal(device_id, None)
5696 voltha = VolthaCtrl(**self.voltha_attrs)
5697 time.sleep(10)
5698 switch_map = None
5699 olt_configured = False
5700 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5701 log_test.info('Installing OLT app')
5702 OnosCtrl.install_app(self.olt_app_file)
5703 time.sleep(5)
5704 log_test.info('Adding subscribers through OLT app')
5705 self.config_olt(switch_map)
5706 olt_configured = True
5707 time.sleep(5)
5708 self.dhcpd_start(intf_list = dhcpd_interface_list,
5709 config = config,
5710 options = options,
5711 subnet = subnet)
5712
5713 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,))
5714 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'desired_ip',))
5715 thread3 = threading.Thread(target = self.voltha_uni_port_toggle, args = (iface_2,))
5716 #log_test.info('Restart olt devices during client send discover to voltha')
5717 thread2.start()
5718 time.sleep(8)
5719 thread1.start()
5720 thread3.start()
5721 time.sleep(10)
5722 thread1.join()
5723 thread2.join()
5724 thread3.join()
5725 try:
5726 assert_equal(self.success, False)
5727 #assert_equal(status, True)
5728 time.sleep(10)
5729 finally:
5730 self.voltha.disable_device(device_id, delete = True)
5731 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005732
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005733 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005734 """
5735 Test Method:
5736 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5737 1. OLT and ONU is detected and validated.
5738 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5739 3. Send dhcp request from two residential subscribers to external dhcp server.
5740 4. Verify that subscribers had got ip from external dhcp server. successfully.
5741 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
5742 6. Repeat step 3 and 4 for one subscriber where uni port is down.
5743 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5744 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
5745 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
5746 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5747 """
5748
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005749 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005750 """
5751 Test Method:
5752 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5753 1. OLT and ONU is detected and validated.
5754 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5755 3. Send dhcp request from two residential subscribers to external dhcp server.
5756 4. Verify that subscribers had got ip from external dhcp server. successfully.
5757 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
5758 6. Disable the olt device which is detected in voltha.
5759 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
5760 """
5761
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005762 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005763 """
5764 Test Method:
5765 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5766 1. OLT and ONU is detected and validated.
5767 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5768 3. Send dhcp request from two residential subscribers to external dhcp server.
5769 4. Verify that subscribers had got ip from external dhcp server. successfully.
5770 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
5771 6. Disable the olt device which is detected in voltha.
5772 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
5773 8. Enable the olt device which is detected in voltha.
5774 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5775 """
5776
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005777 def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005778 """
5779 Test Method:
5780 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5781 1. OLT and ONU is detected and validated.
5782 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5783 3. Send dhcp request from two residential subscribers to external dhcp server.
5784 4. Verify that subscribers had got ip from external dhcp server. successfully.
5785 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
5786 6. Pause the olt device which is detected in voltha.
5787 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
5788 """
Thangavelu K S36edb012017-07-05 18:24:12 +00005789
Thangavelu K S6432b522017-07-22 00:05:54 +00005790 def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005791 """
5792 Test Method:
5793 0. Make sure that voltha is up and running on CORD-POD setup.
5794 1. OLT and ONU is detected and validated.
5795 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5796 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5797 4. Send igmp joins for a multicast group address multi-group-addressA.
5798 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
5799 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5800 """
5801
Thangavelu K S8e413082017-07-13 20:02:14 +00005802 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5803 num_subscribers = 1
5804 num_channels = 1
5805 services = ('IGMP')
5806 cbs = (self.igmp_flow_check, None, None)
5807 self.voltha_subscribers(services, cbs = cbs,
5808 num_subscribers = num_subscribers,
5809 num_channels = num_channels)
5810
Thangavelu K S6432b522017-07-22 00:05:54 +00005811 def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005812 """
5813 Test Method:
5814 0. Make sure that voltha is up and running on CORD-POD setup.
5815 1. OLT and ONU is detected and validated.
5816 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5817 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5818 4. Send igmp joins for a multicast group address multi-group-addressA.
5819 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
5820 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
5821 7. Send igmp leave for a multicast group address multi-group-addressA.
5822 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
5823 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005824 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5825 num_subscribers = 1
5826 num_channels = 1
5827 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005828 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00005829 self.voltha_subscribers(services, cbs = cbs,
5830 num_subscribers = num_subscribers,
5831 num_channels = num_channels)
5832
Thangavelu K S6432b522017-07-22 00:05:54 +00005833 def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005834 """
5835 Test Method:
5836 0. Make sure that voltha is up and running on CORD-POD setup.
5837 1. OLT and ONU is detected and validated.
5838 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5839 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5840 4. Send igmp joins for a multicast group address multi-group-addressA.
5841 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
5842 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
5843 7. Send igmp leave for a multicast group address multi-group-addressA.
5844 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
5845 9. Repeat steps 4 to 6.
5846 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005847 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5848 num_subscribers = 1
5849 num_channels = 1
5850 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005851 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00005852 self.voltha_subscribers(services, cbs = cbs,
5853 num_subscribers = num_subscribers,
5854 num_channels = num_channels)
5855
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005856 def test_subscriber_with_voltha_for_igmp_with_five_groups_joins_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005857 """
5858 Test Method:
5859 0. Make sure that voltha is up and running on CORD-POD setup.
5860 1. OLT and ONU is detected and validated.
5861 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5862 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5863 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
5864 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5865 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5866 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005867 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5868 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005869 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00005870 services = ('IGMP')
5871 cbs = (self.igmp_flow_check, None, None)
5872 self.voltha_subscribers(services, cbs = cbs,
5873 num_subscribers = num_subscribers,
5874 num_channels = num_channels)
5875
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005876 def test_subscriber_with_voltha_for_igmp_with_five_groups_joins_and_leave_for_one_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005877 """
5878 Test Method:
5879 0. Make sure that voltha is up and running on CORD-POD setup.
5880 1. OLT and ONU is detected and validated.
5881 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5882 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5883 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
5884 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5885 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5886 7. Send igmp leave for a multicast group address multi-group-addressA.
5887 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.
5888 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester.
5889 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005890 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5891 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005892 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00005893 services = ('IGMP')
5894 cbs = (self.igmp_flow_check, None, None)
5895 self.voltha_subscribers(services, cbs = cbs,
5896 num_subscribers = num_subscribers,
5897 num_channels = num_channels)
5898
Thangavelu K S6432b522017-07-22 00:05:54 +00005899 def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005900 """
5901 Test Method:
5902 0. Make sure that voltha is up and running on CORD-POD setup.
5903 1. OLT and ONU is detected and validated.
5904 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5905 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5906 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
5907 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5908 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5909 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
5910 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5911 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005912 num_subscribers = 1
5913 num_channels = 1
5914 services = ('IGMP')
5915 cbs = (self.igmp_flow_check, None, None)
5916 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5917 num_subscribers = num_subscribers,
5918 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00005919
Thangavelu K S6432b522017-07-22 00:05:54 +00005920 def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005921 """
5922 Test Method:
5923 0. Make sure that voltha is up and running on CORD-POD setup.
5924 1. OLT and ONU is detected and validated.
5925 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5926 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5927 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
5928 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5929 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5930 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA
5931 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5932 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5933 """
5934
Thangavelu K S8e413082017-07-13 20:02:14 +00005935 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00005936 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00005937 services = ('IGMP')
5938 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
5939 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5940 num_subscribers = num_subscribers,
5941 num_channels = num_channels)
5942
Thangavelu K S6432b522017-07-22 00:05:54 +00005943 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 +00005944 """
5945 Test Method:
5946 0. Make sure that voltha is up and running on CORD-POD setup.
5947 1. OLT and ONU is detected and validated.
5948 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5949 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5950 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
5951 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5952 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
5953 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA
5954 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5955 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
5956 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005957 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00005958 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00005959 services = ('IGMP')
5960 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
5961 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5962 num_subscribers = num_subscribers,
5963 num_channels = num_channels)
5964
Thangavelu K S6432b522017-07-22 00:05:54 +00005965 def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005966 """
5967 Test Method:
5968 0. Make sure that voltha is up and running on CORD-POD setup.
5969 1. OLT and ONU is detected and validated.
5970 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5971 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5972 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
5973 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5974 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5975 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA
5976 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5977 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5978 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005979
5980 num_subscribers = 1
5981 num_channels = 1
5982 services = ('IGMP')
5983 cbs = (self.igmp_flow_check_join_change_to_block, None, None)
5984 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5985 num_subscribers = num_subscribers,
5986 num_channels = num_channels)
5987
Thangavelu K S6432b522017-07-22 00:05:54 +00005988 def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005989 """
5990 Test Method:
5991 0. Make sure that voltha is up and running on CORD-POD setup.
5992 1. OLT and ONU is detected and validated.
5993 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5994 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5995 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
5996 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5997 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5998 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB
5999 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
6000 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
6001 """
Thangavelu K S8e413082017-07-13 20:02:14 +00006002
6003 num_subscribers = 1
6004 num_channels = 1
6005 services = ('IGMP')
6006 cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None)
6007 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
6008 num_subscribers = num_subscribers,
6009 num_channels = num_channels)
6010
Thangavelu K S6432b522017-07-22 00:05:54 +00006011 def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006012 """
6013 Test Method:
6014 0. Make sure that voltha is up and running on CORD-POD setup.
6015 1. OLT and ONU is detected and validated.
6016 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6017 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6018 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
6019 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
6020 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
6021 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
6022 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
6023 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006024
6025 num_subscribers = 1
6026 num_channels = 1
6027 services = ('IGMP')
6028 cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None)
6029 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
6030 num_subscribers = num_subscribers,
6031 num_channels = num_channels)
6032
Thangavelu K S6432b522017-07-22 00:05:54 +00006033 def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006034 """
6035 Test Method:
6036 0. Make sure that voltha is up and running on CORD-POD setup.
6037 1. OLT and ONU is detected and validated.
6038 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6039 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6040 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
6041 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
6042 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
6043 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
6044 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
6045 """
6046
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006047 num_subscribers = 1
6048 num_channels = 1
6049 services = ('IGMP')
6050 cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None)
6051 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
6052 num_subscribers = num_subscribers,
6053 num_channels = num_channels)
6054
Thangavelu K S6432b522017-07-22 00:05:54 +00006055 def test_two_subscribers_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006056 """
6057 Test Method:
6058 0. Make sure that voltha is up and running on CORD-POD setup.
6059 1. OLT and ONU is detected and validated.
6060 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6061 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6062 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6063 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
6064 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6065 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6066 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6067 """
6068
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006069 num_subscribers = 2
6070 num_channels = 1
6071 services = ('IGMP')
6072 cbs = (self.igmp_flow_check, None, None)
6073 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'],
6074 num_subscribers = num_subscribers,
6075 num_channels = num_channels)
6076
Thangavelu K S36edb012017-07-05 18:24:12 +00006077 def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self):
6078 """
6079 Test Method:
6080 0. Make sure that voltha is up and running on CORD-POD setup.
6081 1. OLT and ONU is detected and validated.
6082 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6083 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6084 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6085 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6086 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6087 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6088 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6089 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6090 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6091 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6092 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006093 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006094 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006095 services = ('IGMP')
6096 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
6097 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'],
6098 num_subscribers = num_subscribers,
6099 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00006100
Thangavelu K S6432b522017-07-22 00:05:54 +00006101 def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006102 """
6103 Test Method:
6104 0. Make sure that voltha is up and running on CORD-POD setup.
6105 1. OLT and ONU is detected and validated.
6106 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6107 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6108 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6109 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
6110 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6111 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.
6112 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.
6113 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6114 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.
6115 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.
6116 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.
6117 """
6118
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006119 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006120 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006121 services = ('IGMP')
6122 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
6123 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'],
6124 num_subscribers = num_subscribers,
6125 num_channels = num_channels)
6126
6127 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00006128 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 +00006129 """
6130 Test Method:
6131 0. Make sure that voltha is up and running on CORD-POD setup.
6132 1. OLT and ONU is detected and validated.
6133 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6134 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6135 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6136 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6137 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6138 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6139 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6140 9. Disable uni_2 port which is being shown on voltha CLI.
6141 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6142 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6143 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006144 #rx_port = self.port_map['ports'][port_list[i][1]]
6145 df = defer.Deferred()
6146 def igmp_flow_check_operating_onu_admin_state(df):
6147 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006148 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006149 services = ('IGMP')
6150 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
6151 port_list = self.generate_port_list(num_subscribers, num_channels)
6152
Thangavelu K S9a637332017-08-01 23:22:23 +00006153 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 +00006154 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
6155 thread1.start()
6156 time.sleep(randint(40,50))
6157 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
6158 thread2.start()
6159 time.sleep(10)
6160 thread1.join()
6161 thread2.join()
6162 try:
6163 assert_equal(self.success, False)
6164 log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check')
6165 time.sleep(10)
6166 finally:
6167 pass
6168 df.callback(0)
6169 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
6170 return df
6171
6172 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00006173 def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self):
6174 """
6175 Test Method:
6176 0. Make sure that voltha is up and running on CORD-POD setup.
6177 1. OLT and ONU is detected and validated.
6178 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6179 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6180 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6181 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6182 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6183 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6184 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6185 9. Disable uni_2 port which is being shown on voltha CLI.
6186 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6187 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6188 12. Enable uni_2 port which we disable at step 9.
6189 13. Repeat step 5,6 and 8.
6190 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006191 df = defer.Deferred()
6192 def igmp_flow_check_operating_onu_admin_state(df):
6193 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006194 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006195 services = ('IGMP')
6196 cbs = (self.igmp_flow_check, None, None)
6197 port_list = self.generate_port_list(num_subscribers, num_channels)
6198
Thangavelu K S9a637332017-08-01 23:22:23 +00006199 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 +00006200 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
6201 thread1.start()
6202 time.sleep(randint(50,60))
6203 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
6204 thread2.start()
6205 time.sleep(10)
6206 thread1.join()
6207 thread2.join()
6208 try:
6209 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00006210 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 +00006211 time.sleep(10)
6212 finally:
6213 pass
6214 df.callback(0)
6215 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
6216 return df
6217
6218 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00006219 def test_two_subscribers_with_voltha_for_igmp_disabling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006220 """
6221 Test Method:
6222 0. Make sure that voltha is up and running on CORD-POD setup.
6223 1. OLT and ONU is detected and validated.
6224 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6225 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6226 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6227 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6228 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6229 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6230 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6231 9. Disable olt device which is being shown on voltha CLI.
6232 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6233 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6234 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006235 df = defer.Deferred()
6236 def igmp_flow_check_operating_olt_admin_disble(df):
6237 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006238 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006239 services = ('IGMP')
6240 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
6241 port_list = self.generate_port_list(num_subscribers, num_channels)
6242
Thangavelu K S9a637332017-08-01 23:22:23 +00006243 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 +00006244 thread1.start()
6245 time.sleep(randint(50,60))
6246 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
6247 thread2.start()
6248 time.sleep(10)
6249 thread1.join()
6250 thread2.join()
6251 try:
6252 assert_equal(self.success, False)
6253 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
6254 time.sleep(10)
6255 finally:
6256 pass
6257 df.callback(0)
6258 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
6259 return df
6260
6261 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00006262 def test_two_subscribers_with_voltha_for_igmp_pausing_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006263 """
6264 Test Method:
6265 0. Make sure that voltha is up and running on CORD-POD setup.
6266 1. OLT and ONU is detected and validated.
6267 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6268 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6269 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6270 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6271 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6272 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6273 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6274 9. Pause olt device which is being shown on voltha CLI.
6275 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6276 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6277 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006278 df = defer.Deferred()
6279 def igmp_flow_check_operating_olt_admin_pause(df):
6280 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006281 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006282 services = ('IGMP')
6283 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
6284 port_list = self.generate_port_list(num_subscribers, num_channels)
6285
Thangavelu K S9a637332017-08-01 23:22:23 +00006286 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 +00006287 thread1.start()
6288 time.sleep(randint(50,60))
6289 thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,))
6290 thread2.start()
6291 time.sleep(10)
6292 thread1.join()
6293 thread2.join()
6294 try:
6295 assert_equal(self.success, False)
6296 log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test')
6297 time.sleep(10)
6298 finally:
6299 pass
6300 df.callback(0)
6301 reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df)
6302 return df
6303
6304 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00006305 def test_two_subscribers_with_voltha_for_igmp_toggling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006306 """
6307 Test Method:
6308 0. Make sure that voltha is up and running on CORD-POD setup.
6309 1. OLT and ONU is detected and validated.
6310 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6311 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6312 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6313 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6314 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6315 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6316 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6317 9. Disable olt device which is being shown on voltha CLI.
6318 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6319 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6320 12. Enable olt device which is disable at step 9.
6321 13. Repeat steps 4,5, 7 and 8.
6322 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006323 df = defer.Deferred()
6324 def igmp_flow_check_operating_olt_admin_restart(df):
6325 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006326 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006327 services = ('IGMP')
6328 cbs = (self.igmp_flow_check, None, None)
6329 port_list = self.generate_port_list(num_subscribers, num_channels)
6330
Thangavelu K S9a637332017-08-01 23:22:23 +00006331 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 +00006332 thread1.start()
6333 time.sleep(randint(50,60))
6334 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
6335 thread2.start()
6336 time.sleep(10)
6337 thread1.join()
6338 thread2.join()
6339 try:
6340 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00006341 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 +00006342 time.sleep(10)
6343 finally:
6344 pass
6345 df.callback(0)
6346 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
6347 return df
Thangavelu K S6432b522017-07-22 00:05:54 +00006348
6349 @deferred(TESTCASE_TIMEOUT)
6350 def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self):
6351 """
6352 Test Method:
6353 0. Make sure that voltha is up and running on CORD-POD setup.
6354 1. OLT and ONU is detected and validated.
6355 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6356 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6357 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6358 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6359 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6360 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6361 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6362 9. Disable olt device which is being shown on voltha CLI.
6363 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6364 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6365 12. Repeat steps 4 to 11 steps multiple times (example 20 times)
6366 """
6367 df = defer.Deferred()
6368 no_iterations = 20
6369 def igmp_flow_check_operating_olt_admin_disble(df):
6370 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006371 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00006372 services = ('IGMP')
6373 cbs = (self.igmp_flow_check, None, None)
6374 port_list = self.generate_port_list(num_subscribers, num_channels)
6375
Thangavelu K S9a637332017-08-01 23:22:23 +00006376 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 +00006377 thread1.start()
6378 time.sleep(randint(30,40))
6379 for i in range(no_iterations):
6380 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
6381 thread2.start()
6382 time.sleep(8)
6383 thread2.join()
6384 thread1.join()
6385 thread1.isAlive()
6386 thread2.join()
6387 try:
6388 assert_equal(self.success, False)
6389 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
6390 time.sleep(10)
6391 finally:
6392 pass
6393 df.callback(0)
6394 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
6395 return df
6396
6397 @deferred(TESTCASE_TIMEOUT + 200)
6398 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self):
6399 """
6400 Test Method:
6401 0. Make sure that voltha is up and running on CORD-POD setup.
6402 1. OLT and ONU is detected and validated.
6403 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6404 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6405 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6406 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6407 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6408 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6409 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6410 9. Disable uni_2 port which is being shown on voltha CLI.
6411 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6412 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6413 12. Enable uni_2 port which we disable at step 9.
6414 13. Repeat step 5,6 and 8.
6415 14. Repeat steps 4 to 13 steps multiple times (example 5 times)
6416 """
6417 df = defer.Deferred()
6418 no_iterations = 5
6419 def igmp_flow_check_operating_onu_admin_state(df):
6420 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006421 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00006422 services = ('IGMP')
6423 cbs = (self.igmp_flow_check, None, None)
6424 port_list = self.generate_port_list(num_subscribers, num_channels)
6425
Thangavelu K S9a637332017-08-01 23:22:23 +00006426 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 +00006427 thread1.start()
6428 time.sleep(randint(40,60))
6429 for i in range(no_iterations):
6430 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
6431 log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha')
6432 thread2.start()
6433 time.sleep(1)
6434 thread2.join()
6435 thread1.isAlive()
6436 thread1.join()
6437 thread2.join()
6438 try:
6439 assert_equal(self.success, True)
6440 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful')
6441 time.sleep(10)
6442 finally:
6443 pass
6444 df.callback(0)
6445 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
6446 return df
6447
6448 @deferred(TESTCASE_TIMEOUT)
6449 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self):
6450 """
6451 Test Method:
6452 0. Make sure that voltha is up and running on CORD-POD setup.
6453 1. OLT and ONU is detected and validated.
6454 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6455 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6456 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6457 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6458 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6459 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6460 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6461 9. Disable olt device which is being shown on voltha CLI.
6462 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6463 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6464 12. Enable olt device which is disable at step 9.
6465 13. Repeat steps 4,5, 7 and 8.
6466 14. Repeat steps 4 to 13 steps multiple times (example 10 times)
6467 """
6468 df = defer.Deferred()
6469 no_iterations = 10
6470 def igmp_flow_check_operating_olt_admin_restart(df):
6471 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006472 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00006473 services = ('IGMP')
6474 cbs = (self.igmp_flow_check, None, None)
6475 port_list = self.generate_port_list(num_subscribers, num_channels)
6476
Thangavelu K S9a637332017-08-01 23:22:23 +00006477 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 +00006478 thread1.start()
6479 time.sleep(randint(50,60))
6480 for i in range(no_iterations):
6481 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
6482 thread2.start()
6483 time.sleep(10)
6484 thread2.join()
6485 thread1.join()
6486 thread2.join()
6487 try:
6488 assert_equal(self.success, True)
6489 log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful')
6490 time.sleep(10)
6491 finally:
6492 pass
6493 df.callback(0)
6494 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
6495 return df
6496
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00006497 def test_five_subscribers_with_voltha_for_igmp_with_ten_group_joins_verifying_traffic(self):
Thangavelu K S6432b522017-07-22 00:05:54 +00006498 """
6499 Test Method:
6500 0. Make sure that voltha is up and running on CORD-POD setup.
6501 1. OLT and ONU is detected and validated.
6502 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
6503 3. Issue multiple dhcp client packets to get IP address from dhcp server for as subscribers and check connectivity.
6504 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
6505 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
6506 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
6507 """
6508
6509 num_subscribers = 5
6510 num_channels = 10
6511 services = ('IGMP')
6512 cbs = (self.igmp_flow_check, None, None)
6513 self.voltha_subscribers(services, cbs = cbs,
6514 num_subscribers = num_subscribers,
6515 num_channels = num_channels)
6516
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00006517 def test_nine_subscribers_with_voltha_for_igmp_with_ten_group_joins_and_verify_traffic(self):
Thangavelu K S6432b522017-07-22 00:05:54 +00006518 """
6519 Test Method:
6520 0. Make sure that voltha is up and running on CORD-POD setup.
6521 1. OLT and ONU is detected and validated.
6522 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
6523 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity.
6524 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
6525 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
6526 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
6527 """
6528 num_subscribers = 9
6529 num_channels = 10
6530 services = ('IGMP')
6531 cbs = (self.igmp_flow_check, None, None)
6532 self.voltha_subscribers(services, cbs = cbs,
6533 num_subscribers = num_subscribers,
6534 num_channels = num_channels)