blob: 215291086de88e4c733437ac86cc93e1b3624727 [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 Karthick35495c32017-05-11 14:58:32 -0700216 VOLTHA_REST_PORT = 8881
Thangavelu K S36edb012017-07-05 18:24:12 +0000217 VOLTHA_OLT_TYPE = 'ponsim_olt'
218 VOLTHA_OLT_MAC = '00:0c:e2:31:12:00'
219 VOLTHA_IGMP_ITERATIONS = 100
A R Karthick35495c32017-05-11 14:58:32 -0700220 voltha = None
A R Karthick53442712017-07-27 12:23:30 -0700221 voltha_attrs = None
Thangavelu K S9648eed2017-06-13 20:15:25 +0000222 success = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000223 olt_device_id = None
A R Karthick168e2342017-08-15 16:13:10 -0700224 apps = ('org.opencord.aaa', 'org.onosproject.dhcp',)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000225 #apps = ('org.opencord.aaa', 'org.onosproject.dhcp', 'org.onosproject.dhcprelay')
A R Karthick168e2342017-08-15 16:13:10 -0700226 app_dhcp = ('org.onosproject.dhcp',)
227 app_dhcprelay = ('org.onosproject.dhcprelay',)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000228 olt_apps = () #'org.opencord.cordmcast')
229 vtn_app = 'org.opencord.vtn'
230 table_app = 'org.ciena.cordigmp'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000231 test_path = os.path.dirname(os.path.realpath(__file__))
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000232 dhcp_data_dir = os.path.join(test_path, '..', 'setup')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000233 table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700234 app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000235 olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar')
A.R Karthick3493a572017-06-07 18:28:10 -0700236 olt_app_name = 'org.onosproject.olt'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000237 #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
238 olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
239 onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
A R Karthick9dc6e922017-07-12 14:40:16 -0700240 VOLTHA_AUTO_CONFIGURE = False
Thangavelu K S8e413082017-07-13 20:02:14 +0000241 num_joins = 0
242
Thangavelu K S6432b522017-07-22 00:05:54 +0000243 relay_interfaces_last = ()
244 interface_to_mac_map = {}
245 host_ip_map = {}
246 default_config = { 'default-lease-time' : 600, 'max-lease-time' : 7200, }
247 default_options = [ ('subnet-mask', '255.255.255.0'),
248 ('broadcast-address', '192.168.1.255'),
249 ('domain-name-servers', '192.168.1.1'),
250 ('domain-name', '"mydomain.cord-tester"'),
251 ]
252 ##specify the IP for the dhcp interface matching the subnet and subnet config
253 ##this is done for each interface dhcpd server would be listening on
254 default_subnet_config = [ ('192.168.1.2',
255'''
256subnet 192.168.1.0 netmask 255.255.255.0 {
257 range 192.168.1.10 192.168.1.100;
258}
259'''), ]
260
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000261 configs = {}
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000262 VOLTHA_ENABLED = True
263 INTF_TX_DEFAULT = 'veth2'
264 INTF_RX_DEFAULT = 'veth0'
Thangavelu K S9648eed2017-06-13 20:15:25 +0000265 INTF_2_RX_DEFAULT = 'veth6'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000266 TESTCASE_TIMEOUT = 300
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000267 VOLTHA_IGMP_ITERATIONS = 10
268# VOLTHA_CONFIG_FAKE = True
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000269 VOLTHA_CONFIG_FAKE = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000270 VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
A R Karthick53442712017-07-27 12:23:30 -0700271 VOLTHA_UPLINK_VLAN_START = 444
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000272 VOLTHA_ONU_UNI_PORT = 'veth0'
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000273
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000274 dhcp_server_config = {
275 "ip": "10.1.11.50",
276 "mac": "ca:fe:ca:fe:ca:fe",
277 "subnet": "255.255.252.0",
278 "broadcast": "10.1.11.255",
279 "router": "10.1.8.1",
280 "domain": "8.8.8.8",
281 "ttl": "63",
282 "delay": "2",
283 "startip": "10.1.11.51",
284 "endip": "10.1.11.100"
285 }
286
287
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000288 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
289MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
290CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
291IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
292RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
293MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
294BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
295hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
296gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
297+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
298rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
299VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
300eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
3016tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
302PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
303nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
304-----END CERTIFICATE-----"""
305
306 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
307MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
308CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
309IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
310RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
311MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
312BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
313hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
314AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
3155An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
316tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
317OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
318qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
3192Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
320BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
321eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
322MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
323VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
324RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
325dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
326T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
327yg==
328-----END CERTIFICATE-----'''
A R Karthick35495c32017-05-11 14:58:32 -0700329
A.R Karthick3493a572017-06-07 18:28:10 -0700330 @classmethod
331 def update_apps_version(cls):
332 version = Onos.getVersion()
333 major = int(version.split('.')[0])
334 minor = int(version.split('.')[1])
335 cordigmp_app_version = '2.0-SNAPSHOT'
336 olt_app_version = '1.2-SNAPSHOT'
337 if major > 1:
338 cordigmp_app_version = '3.0-SNAPSHOT'
339 olt_app_version = '2.0-SNAPSHOT'
340 elif major == 1:
341 if minor > 10:
342 cordigmp_app_version = '3.0-SNAPSHOT'
343 olt_app_version = '2.0-SNAPSHOT'
344 elif minor <= 8:
345 olt_app_version = '1.1-SNAPSHOT'
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700346 cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version))
347 cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version))
348 cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
349
A R Karthick35495c32017-05-11 14:58:32 -0700350 @classmethod
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000351 def voltha_dhcprelay_setUpClass(cls):
Thangavelu K S6432b522017-07-22 00:05:54 +0000352 ''' Activate the dhcprelay app'''
353 OnosCtrl(cls.app_dhcp).deactivate()
354 time.sleep(3)
355 cls.onos_ctrl = OnosCtrl('org.onosproject.dhcprelay')
356 status, _ = cls.onos_ctrl.activate()
357 assert_equal(status, True)
358 time.sleep(3)
359 cls.dhcp_relay_setup()
360 ##start dhcpd initially with default config
361 cls.dhcpd_start()
362
363 @classmethod
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000364 def voltha_dhcprelay_tearDownClass(cls):
Thangavelu K S6432b522017-07-22 00:05:54 +0000365 '''Deactivate the dhcp relay app'''
366 try:
367 os.unlink('{}/dhcpd.conf'.format(cls.dhcp_data_dir))
368 os.unlink('{}/dhcpd.leases'.format(cls.dhcp_data_dir))
369 except: pass
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000370 onos_ctrl = OnosCtrl(cls.app_dhcprelay)
371 onos_ctrl.deactivate()
Thangavelu K S6432b522017-07-22 00:05:54 +0000372 cls.dhcpd_stop()
373 cls.dhcp_relay_cleanup()
374
375 @classmethod
A.R Karthickf874d032017-06-07 18:47:51 -0700376 def onos_load_config(cls, app, config):
377 status, code = OnosCtrl.config(config)
378 if status is False:
379 log_test.info('JSON config request for app %s returned status %d' %(app, code))
380 assert_equal(status, True)
381 time.sleep(2)
382
383 @classmethod
384 def onos_aaa_load(cls):
385 aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
386 'radiusIp': '172.17.0.2' } } } }
387 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
388 aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip
389 cls.onos_load_config('org.opencord.aaa', aaa_dict)
390
391 @classmethod
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000392 def onos_dhcp_table_load(self, config = None):
393 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
394 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
395 if config:
396 for k in config.keys():
397 if dhcp_config.has_key(k):
398 dhcp_config[k] = config[k]
399 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
400
Thangavelu K S36edb012017-07-05 18:24:12 +0000401 def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = None):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000402 if validation:
Thangavelu K S735a6662017-06-15 18:08:23 +0000403 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
404 assert_not_equal(cip, None)
405 assert_not_equal(sip, None)
406 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
407 (cip, sip, dhcp.get_mac(cip)[0]))
408 if validation == False:
409 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
410 assert_equal(cip, None)
411 assert_equal(sip, None)
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000412 log_test.info('Dhcp client did not get IP from server')
Thangavelu K S735a6662017-06-15 18:08:23 +0000413
Thangavelu K S36edb012017-07-05 18:24:12 +0000414 if validation == 'skip':
415 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
416
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000417 return cip,sip
418
Thangavelu K S36edb012017-07-05 18:24:12 +0000419 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):
420 config = {'startip':startip, 'endip':'10.10.10.200',
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000421 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
422 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
423 self.onos_dhcp_table_load(config)
424 dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface)
Thangavelu K S36edb012017-07-05 18:24:12 +0000425 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed, validation = validation, mac = mac)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000426 return cip, sip
427
428 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700429 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700430 cls.update_apps_version()
A R Karthick53442712017-07-27 12:23:30 -0700431 cls.voltha_attrs = dict(host = cls.VOLTHA_HOST,
432 rest_port = cls.VOLTHA_REST_PORT,
433 uplink_vlan_map = cls.VOLTHA_UPLINK_VLAN_MAP,
434 uplink_vlan_start = cls.VOLTHA_UPLINK_VLAN_START)
435 cls.voltha = VolthaCtrl(**cls.voltha_attrs)
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000436 cls.install_app_table()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000437 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
438 cls.port_map, cls.port_list = cls.olt.olt_port_map()
439 cls.switches = cls.port_map['switches']
Thangavelu K S36edb012017-07-05 18:24:12 +0000440 cls.ponsim_ports = cls.port_map['ponsim']
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000441 cls.num_ports = cls.port_map['num_ports']
442 if cls.num_ports > 1:
443 cls.num_ports -= 1 ##account for the tx port
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000444 cls.activate_apps(cls.apps + cls.olt_apps, deactivate = True)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000445 cls.deactivate_apps(cls.app_dhcprelay)
A.R Karthickf874d032017-06-07 18:47:51 -0700446 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000447
A.R Karthick3493a572017-06-07 18:28:10 -0700448 @classmethod
449 def tearDownClass(cls):
450 '''Deactivate the olt apps and restart OVS back'''
451 apps = cls.olt_apps + ( cls.table_app,)
452 for app in apps:
453 onos_ctrl = OnosCtrl(app)
454 onos_ctrl.deactivate()
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000455 cls.deactivate_apps(cls.app_dhcprelay)
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000456 cls.install_app_igmp()
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000457 log_test.info('TearDownClass Restarting the Radius Server in the TA setup')
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000458 cord_test_radius_restart()
459
A.R Karthick3493a572017-06-07 18:28:10 -0700460 @classmethod
461 def install_app_igmp(cls):
462 ##Uninstall the table app on class exit
463 OnosCtrl.uninstall_app(cls.table_app)
464 time.sleep(2)
465 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
466 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700467
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000468 def remove_olt(self, switch_map):
469 controller = get_controller()
470 auth = ('karaf', 'karaf')
471 #remove subscriber for every port on all the voltha devices
472 for device, device_map in switch_map.iteritems():
473 uni_ports = device_map['ports']
474 uplink_vlan = device_map['uplink_vlan']
475 for port in uni_ports:
476 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
477 device,
478 port)
479 resp = requests.delete(rest_url, auth = auth)
480 if resp.status_code not in [204, 202, 200]:
481 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
482 else:
483 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
484 OnosCtrl.uninstall_app(self.olt_app_file)
485
486 def config_olt(self, switch_map):
487 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000488 auth = ('karaf', 'karaf')
489 #configure subscriber for every port on all the voltha devices
490 for device, device_map in switch_map.iteritems():
491 uni_ports = device_map['ports']
492 uplink_vlan = device_map['uplink_vlan']
493 for port in uni_ports:
494 vlan = port
495 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
496 device,
497 port,
498 vlan)
499 resp = requests.post(rest_url, auth = auth)
500 #assert_equal(resp.ok, True)
501
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000502 def voltha_uni_port_toggle(self, uni_port = None):
503 ## Admin state of port is down and up
504 if not uni_port:
505 uni_port = self.INTF_RX_DEFAULT
506 cmd = 'ifconfig {} down'.format(uni_port)
507 os.system(cmd)
508 log_test.info('Admin state of uni_port is down')
509 time.sleep(30)
510 cmd = 'ifconfig {} up'.format(uni_port)
511 os.system(cmd)
512 log_test.info('Admin state of uni_port is up now')
513 time.sleep(30)
514 return
515
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000516 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000517 def install_app_table(cls):
518 ##Uninstall the existing app if any
519 OnosCtrl.uninstall_app(cls.table_app)
520 time.sleep(2)
521 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
522 OnosCtrl.install_app(cls.table_app_file)
523 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000524
525 @classmethod
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000526 def activate_apps(cls, apps, deactivate = False):
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000527 for app in apps:
528 onos_ctrl = OnosCtrl(app)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000529 if deactivate is True:
530 onos_ctrl.deactivate()
531 time.sleep(2)
A R Karthick168e2342017-08-15 16:13:10 -0700532 log_test.info('Activating app %s' %app)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000533 status, _ = onos_ctrl.activate()
534 assert_equal(status, True)
535 time.sleep(2)
536
Thangavelu K S735a6662017-06-15 18:08:23 +0000537 @classmethod
538 def deactivate_apps(cls, apps):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000539 cls.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000540 for app in apps:
541 onos_ctrl = OnosCtrl(app)
A R Karthick168e2342017-08-15 16:13:10 -0700542 log_test.info('Deactivating app %s' %app)
Thangavelu K S735a6662017-06-15 18:08:23 +0000543 status, _ = onos_ctrl.deactivate()
544 if status is False:
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000545 cls.success = False
546 # assert_equal(status, True)
Thangavelu K S735a6662017-06-15 18:08:23 +0000547 time.sleep(2)
548
Thangavelu K S36edb012017-07-05 18:24:12 +0000549 def random_ip(self,start_ip = '10.10.10.20', end_ip = '10.10.10.65'):
550 start = list(map(int, start_ip.split(".")))
551 end = list(map(int, end_ip.split(".")))
552 temp = start
553 ip_range = []
554 ip_range.append(start_ip)
555 while temp != end:
556 start[3] += 1
557 for i in (3, 2, 1):
558 if temp[i] == 255:
559 temp[i] = 0
560 temp[i-1] += 1
561 ip_range.append(".".join(map(str, temp)))
562 return random.choice(ip_range)
563
Thangavelu K S8e413082017-07-13 20:02:14 +0000564 def random_mcast_ip(self,start_ip = '224.0.1.0', end_ip = '224.0.1.100'):
565 start = list(map(int, start_ip.split(".")))
566 end = list(map(int, end_ip.split(".")))
567 temp = start
568 ip_range = []
569 ip_range.append(start_ip)
570 while temp != end:
571 start[3] += 1
572 for i in (3, 2, 1):
573 if temp[i] == 255:
574 temp[i] = 0
575 temp[i-1] += 1
576 ip_range.append(".".join(map(str, temp)))
577 return random.choice(ip_range)
578
Thangavelu K S6432b522017-07-22 00:05:54 +0000579 @classmethod
580 def dhcp_relay_setup(cls):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000581 did = OnosCtrl.get_device_id()
582 cls.relay_device_id = did
583 cls.relay_device_id = 'of:0000000000000001'
584 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
585 cls.port_map, _ = cls.olt.olt_port_map()
Thangavelu K S6432b522017-07-22 00:05:54 +0000586 if cls.port_map:
587 ##Per subscriber, we use 1 relay port
588 try:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000589 relay_port = cls.port_map[cls.port_map['relay_ports'][0]]
Thangavelu K S6432b522017-07-22 00:05:54 +0000590 except:
591 relay_port = cls.port_map['uplink']
592 cls.relay_interface_port = relay_port
593 cls.relay_interfaces = (cls.port_map[cls.relay_interface_port],)
594 else:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000595 cls.relay_interface_port = 100
596 cls.relay_interfaces = (g_subscriber_port_map[cls.relay_interface_port],)
Thangavelu K S6432b522017-07-22 00:05:54 +0000597 cls.relay_interfaces_last = cls.relay_interfaces
598 if cls.port_map:
599 ##generate a ip/mac client virtual interface config for onos
600 interface_list = []
601 for port in cls.port_map['ports']:
602 port_num = cls.port_map[port]
603 if port_num == cls.port_map['uplink']:
604 continue
605 ip = cls.get_host_ip(port_num)
606 mac = cls.get_mac(port)
607 interface_list.append((port_num, ip, mac))
608
609 #configure dhcp server virtual interface on the same subnet as first client interface
610 relay_ip = cls.get_host_ip(interface_list[0][0])
611 relay_mac = cls.get_mac(cls.port_map[cls.relay_interface_port])
612 interface_list.append((cls.relay_interface_port, relay_ip, relay_mac))
613 cls.onos_interface_load(interface_list)
614
615 @classmethod
616 def onos_interface_load(cls, interface_list):
617 interface_dict = { 'ports': {} }
618 for port_num, ip, mac in interface_list:
619 port_map = interface_dict['ports']
620 port = '{}/{}'.format(cls.relay_device_id, port_num)
621 port_map[port] = { 'interfaces': [] }
622 interface_list = port_map[port]['interfaces']
623 interface_map = { 'ips' : [ '{}/{}'.format(ip, 24) ],
624 'mac' : mac,
625 'name': 'vir-{}'.format(port_num)
626 }
627 interface_list.append(interface_map)
628
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000629 cls.onos_load_config('org.onosproject.dhcprelay', interface_dict)
Thangavelu K S6432b522017-07-22 00:05:54 +0000630 cls.configs['interface_config'] = interface_dict
631
632 @classmethod
633 def get_host_ip(cls, port):
634 if cls.host_ip_map.has_key(port):
635 return cls.host_ip_map[port]
636 cls.host_ip_map[port] = '192.168.1.{}'.format(port)
637 return cls.host_ip_map[port]
638
639 @classmethod
640 def host_load(cls, iface):
641 '''Have ONOS discover the hosts for dhcp-relay responses'''
642 port = g_subscriber_port_map[iface]
643 host = '173.17.1.{}'.format(port)
644 cmds = ( 'ifconfig {} 0'.format(iface),
645 'ifconfig {0} {1}'.format(iface, host),
646 'arping -I {0} {1} -c 2'.format(iface, host),
647 'ifconfig {} 0'.format(iface), )
648 for c in cmds:
649 os.system(c)
650
651 @classmethod
652 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
653 subnet = default_subnet_config):
654 conf = ''
655 for k, v in config.items():
656 conf += '{} {};\n'.format(k, v)
657
658 opts = ''
659 for k, v in options:
660 opts += 'option {} {};\n'.format(k, v)
661
662 subnet_config = ''
663 for _, v in subnet:
664 subnet_config += '{}\n'.format(v)
665
666 return '{}{}{}'.format(conf, opts, subnet_config)
667
668 @classmethod
669 def dhcpd_start(cls, intf_list = None,
670 config = default_config, options = default_options,
671 subnet = default_subnet_config):
672 '''Start the dhcpd server by generating the conf file'''
673 if intf_list is None:
674 intf_list = cls.relay_interfaces
675 ##stop dhcpd if already running
676 cls.dhcpd_stop()
677 dhcp_conf = cls.dhcpd_conf_generate(config = config, options = options,
678 subnet = subnet)
679 ##first touch dhcpd.leases if it doesn't exist
680 lease_file = '{}/dhcpd.leases'.format(cls.dhcp_data_dir)
681 if os.access(lease_file, os.F_OK) is False:
682 with open(lease_file, 'w') as fd: pass
683
684 conf_file = '{}/dhcpd.conf'.format(cls.dhcp_data_dir)
685 with open(conf_file, 'w') as fd:
686 fd.write(dhcp_conf)
687
688 #now configure the dhcpd interfaces for various subnets
689 index = 0
690 intf_info = []
691 for ip,_ in subnet:
692 intf = intf_list[index]
693 mac = cls.get_mac(intf)
694 intf_info.append((ip, mac))
695 index += 1
696 os.system('ifconfig {} {}'.format(intf, ip))
697
698 intf_str = ','.join(intf_list)
699 dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format(conf_file, lease_file, intf_str)
700 log_test.info('Starting DHCPD server with command: %s' %dhcpd_cmd)
701 ret = os.system(dhcpd_cmd)
702 assert_equal(ret, 0)
703 time.sleep(3)
704 cls.relay_interfaces_last = cls.relay_interfaces
705 cls.relay_interfaces = intf_list
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000706 cls.onos_dhcp_relay_load_1(*intf_info[0])
Thangavelu K S6432b522017-07-22 00:05:54 +0000707
708 @classmethod
709 def dhcpd_stop(cls):
710 os.system('pkill -9 dhcpd')
711 for intf in cls.relay_interfaces:
712 os.system('ifconfig {} 0'.format(intf))
713
714 cls.relay_interfaces = cls.relay_interfaces_last
715
716 @classmethod
717 def get_mac(cls, iface):
718 if cls.interface_to_mac_map.has_key(iface):
719 return cls.interface_to_mac_map[iface]
720 mac = get_mac(iface, pad = 0)
721 cls.interface_to_mac_map[iface] = mac
722 return mac
723
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000724 def send_recv(self, mac=None, update_seed = False, validate = True, dhcp_obj = None):
725 if dhcp_obj is None:
726 dhcp_obj = self.dhcp
727 cip, sip = dhcp_obj.discover(mac = mac, update_seed = update_seed)
Thangavelu K S6432b522017-07-22 00:05:54 +0000728 if validate:
729 assert_not_equal(cip, None)
730 assert_not_equal(sip, None)
731 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 +0000732 (cip, sip, dhcp_obj.get_mac(cip)[0]))
Thangavelu K S6432b522017-07-22 00:05:54 +0000733 return cip,sip
734
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000735 def send_recv_function_in_thread(self, mac=None, update_seed = False, validate = False, dhcp_obj = None):
736 self.success = True
737 cip, sip = self.send_recv(mac=mac,update_seed=update_seed,validate=validate,dhcp_obj = dhcp_obj)
738 if cip is None or sip is None:
739 self.success = False
740
Thangavelu K S6432b522017-07-22 00:05:54 +0000741 @classmethod
742 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
743 subnet = default_subnet_config):
744 conf = ''
745 for k, v in config.items():
746 conf += '{} {};\n'.format(k, v)
747
748 opts = ''
749 for k, v in options:
750 opts += 'option {} {};\n'.format(k, v)
751
752 subnet_config = ''
753 for _, v in subnet:
754 subnet_config += '{}\n'.format(v)
755
756 return '{}{}{}'.format(conf, opts, subnet_config)
757
758 @classmethod
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000759 def onos_dhcp_relay_load_1(cls, server_ip, server_mac):
Thangavelu K S6432b522017-07-22 00:05:54 +0000760 relay_device_map = '{}/{}'.format(cls.relay_device_id, cls.relay_interface_port)
761 dhcp_dict = {'apps':{'org.onosproject.dhcp-relay':{'dhcprelay':
762 {'dhcpserverConnectPoint':relay_device_map,
763 'serverip':server_ip,
764 'servermac':server_mac
765 }
766 }
767 }
768 }
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000769 cls.onos_load_config(cls.app_dhcprelay,dhcp_dict)
Thangavelu K S6432b522017-07-22 00:05:54 +0000770 cls.configs['relay_config'] = dhcp_dict
771
772 @classmethod
773 def dhcp_relay_cleanup(cls):
774 ##reset the ONOS port configuration back to default
775 for config in cls.configs.items():
776 OnosCtrl.delete(config)
777 # if cls.onos_restartable is True:
778 # log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
779 # return cord_test_onos_restart(config = {})
780
781
Thangavelu K S8e413082017-07-13 20:02:14 +0000782 def tls_flow_check(self, olt_ports, cert_info = None, multiple_sub = False):
783 if multiple_sub is True:
784 olt_nni_port = olt_ports.tx_port
785 olt_uni_port = olt_ports.rx_port
786 else:
Thangavelu K S36edb012017-07-05 18:24:12 +0000787 olt_uni_port = olt_ports
788
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000789 def tls_fail_cb():
790 log_test.info('TLS verification failed')
791 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700792 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000793 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
794 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000795 if tls.failTest is True:
796 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000797 assert_equal(tls.failTest, False)
798 if cert_info == "no_cert":
799 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
800 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
801 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000802 if tls.failTest is False:
803 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000804 assert_equal(tls.failTest, True)
805 if cert_info == "invalid_cert":
806 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
807 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
808 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000809 if tls.failTest is False:
810 self.success = False
811 assert_equal(tls.failTest, True)
812 if cert_info == "same_cert":
813 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000814 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 +0000815 tls.runTest()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000816 if tls.failTest is True:
Thangavelu K S9648eed2017-06-13 20:15:25 +0000817 self.success = False
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000818 assert_equal(tls.failTest, False)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000819 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 +0000820 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 +0000821 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
822 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
823 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000824 if tls.failTest is False:
825 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000826 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000827 self.test_status = True
828 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700829
Thangavelu K S8e413082017-07-13 20:02:14 +0000830 def dhcp_flow_check(self, olt_ports, negative_test = None, multiple_sub = False):
831 if multiple_sub is True:
832 olt_nni_port = olt_ports.tx_port
833 onu_iface = olt_ports.rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +0000834 dhcp_server_startip = self.random_ip()
835 random_mac = '00:00:00:0a:0a:' + hex(random.randrange(50,254)).split('x')[1]
Thangavelu K S8e413082017-07-13 20:02:14 +0000836 else:
837 onu_iface = olt_ports
838 dhcp_server_startip = '10.10.10.20'
839 random_mac = None
Thangavelu K S735a6662017-06-15 18:08:23 +0000840 self.success = True
841
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000842 if negative_test is None:
Thangavelu K S36edb012017-07-05 18:24:12 +0000843 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = 'skip', startip = dhcp_server_startip, mac = random_mac)
844 if cip == None or sip == None:
Thangavelu K S735a6662017-06-15 18:08:23 +0000845 self.success = False
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000846 self.test_status = False
847 assert_not_equal(cip,None)
848 assert_not_equal(sip,None)
849 else:
850 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
851 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000852
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000853 if negative_test == "interrupting_dhcp_flows":
854 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
Thangavelu K S735a6662017-06-15 18:08:23 +0000855 if cip is not None:
856 self.success = False
857 assert_equal(cip,None)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000858 log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000859 self.test_status = True
860
861 if negative_test == "invalid_src_mac_broadcast":
862 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
863 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
864 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
865 self.onos_dhcp_table_load(config)
866 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
867 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000868
869 if cip is not None:
870 self.success = False
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000871 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 +0000872 assert_equal(cip,None)
873 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
874 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000875
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000876 if negative_test == "invalid_src_mac_multicast":
877 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
878 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
879 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
880 self.onos_dhcp_table_load(config)
881 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
882 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000883 if cip is not None:
884 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000885 assert_equal(cip,None)
886 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
887 self.test_status = True
888
889 if negative_test == "invalid_src_mac_junk":
890 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
891 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
892 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
893 self.onos_dhcp_table_load(config)
894 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
895 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000896 if cip is not None:
897 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000898 assert_equal(cip,None)
899 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
900 self.test_status = True
901
902 if negative_test == "request_release":
903 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
904 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
905 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
906 self.onos_dhcp_table_load(config)
907 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
908 cip, sip = self.dhcp_sndrcv(self.dhcp)
909 log_test.info('Releasing ip %s to server %s' %(cip, sip))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000910 if not self.dhcp.release(cip):
911 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000912 assert_equal(self.dhcp.release(cip), True)
913 log_test.info('Triggering DHCP discover again after release')
914 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
915 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000916 if not cip == cip2:
Thangavelu K S735a6662017-06-15 18:08:23 +0000917 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000918 assert_equal(cip, cip2)
919 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
920 assert_equal(self.dhcp.release(cip2), True)
921 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000922
Thangavelu K S735a6662017-06-15 18:08:23 +0000923 if negative_test == "starvation_positive":
924 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
925 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
926 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
927 self.onos_dhcp_table_load(config)
928 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
929 ip_map = {}
930 for i in range(10):
931 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
932 if ip_map.has_key(cip):
933 self.success = False
934 log_test.info('IP %s given out multiple times' %cip)
935 assert_equal(False, ip_map.has_key(cip))
936 ip_map[cip] = sip
937 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000938
Thangavelu K S735a6662017-06-15 18:08:23 +0000939 if negative_test == "starvation_negative":
940 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
941 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
942 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
943 self.onos_dhcp_table_load(config)
944 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
945 log_test.info('Verifying passitive case')
946 for x in xrange(50):
947 mac = RandMAC()._fix()
948 self.dhcp_sndrcv(self.dhcp,mac = mac)
949 log_test.info('Verifying negative case')
950 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000951 if cip or sip is not None:
952 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000953 assert_equal(cip, None)
954 assert_equal(sip, None)
955 self.test_status = True
956 self.success = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000957
Thangavelu K S735a6662017-06-15 18:08:23 +0000958 if negative_test == "multiple_discover":
959 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
960 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
961 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
962 self.onos_dhcp_table_load(config)
963 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
964 cip, sip, mac, _ = self.dhcp.only_discover()
965 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
966 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000967 if cip is None:
968 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000969 assert_not_equal(cip, None)
970 log_test.info('Triggering DHCP discover again.')
971 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000972 if not new_cip == cip:
973 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000974 assert_equal(new_cip, cip)
975 log_test.info('client got same IP as expected when sent 2nd discovery')
976 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000977 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000978 if negative_test == "multiple_requests":
979 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
980 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
981 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
982 self.onos_dhcp_table_load(config)
983 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
984 log_test.info('Sending DHCP discover and DHCP request.')
985 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
986 mac = self.dhcp.get_mac(cip)[0]
987 log_test.info("Sending DHCP request again.")
988 new_cip, new_sip = self.dhcp.only_request(cip, mac)
989 assert_equal(new_cip,cip)
990 log_test.info('server offered same IP to clain for multiple requests, as expected')
991 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000992# self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000993 if negative_test == "desired_ip_address":
994 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
995 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
996 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
997 self.onos_dhcp_table_load(config)
998 self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface)
999 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001000 if cip or sip is None:
1001 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001002 assert_not_equal(cip, None)
1003 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1004 (cip, sip, mac))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001005 if not self.dhcp.seed_ip == cip:
1006 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001007 assert_equal(cip,self.dhcp.seed_ip)
1008 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
1009 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001010 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +00001011 if negative_test == "desired_out_of_pool_ip_address":
1012 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1013 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1014 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1015 self.onos_dhcp_table_load(config)
1016 self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface)
1017 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001018 if cip or sip is None:
1019 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001020 assert_not_equal(cip, None)
1021 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1022 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001023 if self.dhcp.seed_ip == cip:
1024 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001025 assert_not_equal(cip,self.dhcp.seed_ip)
1026 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
1027 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001028 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001029 if negative_test == "dhcp_renew":
1030 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1031 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1032 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1033 self.onos_dhcp_table_load(config)
1034 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1035 cip, sip, mac, _ = self.dhcp.only_discover()
1036 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1037 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001038 if cip or sip is None:
1039 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001040 assert_not_equal(cip, None)
1041 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
1042 log_test.info('waiting renew time %d seconds to send next request packet'%lval)
1043 time.sleep(lval)
1044 latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001045 if not latest_cip == cip:
1046 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001047 assert_equal(latest_cip,cip)
1048 log_test.info('client got same IP after renew time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001049 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001050 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001051 if negative_test == "dhcp_rebind":
1052 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1053 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1054 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1055 self.onos_dhcp_table_load(config)
1056 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1057 cip, sip, mac, _ = self.dhcp.only_discover()
1058 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1059 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001060 if cip or sip is None:
1061 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001062 assert_not_equal(cip, None)
1063 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
1064 log_test.info('waiting rebind time %d seconds to send next request packet'%lval)
1065 time.sleep(lval)
1066 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001067 if not latest_cip == cip:
1068 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001069 assert_equal(latest_cip,cip)
1070 log_test.info('client got same IP after rebind time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001071 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001072 # self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001073 return self.test_status
1074
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00001075 def dhcprelay_flow_check(self, seed_ip = None, iface = None, mac= None, test_scenario = None):
1076 self.success = True
1077 if test_scenario is None:
1078 self.dhcp = DHCPTest(seed_ip = seed_ip, iface = iface)
1079 self.send_recv(mac=mac)
1080 elif test_scenario == 'multiple_discover':
1081 self.dhcp_2 = DHCPTest(seed_ip = seed_ip, iface = iface)
1082 cip, sip, mac, _ = self.dhcp_2.only_discover(mac=mac)
1083 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCP REQUEST.' %
1084 (cip, sip, mac) )
1085 if cip is None:
1086 self.success = False
1087 assert_not_equal(cip, None)
1088 log_test.info('Triggering DHCP discover again.')
1089 new_cip, new_sip, new_mac, _ = self.dhcp_2.only_discover(mac=mac)
1090 if new_cip != cip:
1091 self.success = False
1092 assert_equal(new_cip, cip)
1093 log_test.info('Got same ip to same the client when sent discover again, as expected')
1094
1095 elif test_scenario == 'desired_ip':
1096 self.dhcp_3 = DHCPTest(seed_ip = '192.168.1.31', iface = iface)
1097 cip, sip, mac, _ = self.dhcp_3.only_discover(mac=mac,desired = True)
1098 if cip != self.dhcp_3.seed_ip:
1099 self.success = False
1100 assert_equal(cip,self.dhcp_3.seed_ip)
1101 log_test.info('Got dhcp client desired IP %s from server %s for mac %s as expected' %
1102 (cip, sip, mac) )
1103
1104 elif test_scenario == 'out_of_pool_ip':
1105 self.dhcp = DHCPTest(seed_ip = '20.20.20.35', iface = iface)
1106 cip, sip, mac, _ = self.dhcp.only_discover(mac= mac,desired = True)
1107 if cip is None or cip == self.dhcp.seed_ip:
1108 self.success = False
1109 assert_not_equal(cip,None)
1110 assert_not_equal(cip,self.dhcp.seed_ip)
1111 log_test.info('server offered IP from its pool when requested out of pool IP, as expected')
1112 elif test_scenario == 'multiple_discover_1':
1113 pass
1114 return self.success
1115
Thangavelu K S8e413082017-07-13 20:02:14 +00001116 def recv_channel_cb(self, pkt):
1117 ##First verify that we have received the packet for the joined instance
1118 chan = self.subscriber.caddr(pkt[IP].dst)
1119 assert_equal(chan in self.subscriber.join_map.keys(), True)
1120 recv_time = monotonic.monotonic() * 1000000
1121 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
1122 delta = recv_time - join_time
1123 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
1124 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
1125 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
1126 self.test_status = True
Thangavelu K S36edb012017-07-05 18:24:12 +00001127
Thangavelu K S8e413082017-07-13 20:02:14 +00001128 def traffic_verify(self, subscriber):
1129 # if subscriber.has_service('TRAFFIC'):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001130 url = 'http://www.google.com'
1131 resp = requests.get(url)
1132 self.test_status = resp.ok
1133 if resp.ok == False:
1134 log_test.info('Subscriber %s failed get from url %s with status code %d'
1135 %(subscriber.name, url, resp.status_code))
1136 else:
1137 log_test.info('GET request from %s succeeded for subscriber %s'
1138 %(url, subscriber.name))
1139 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001140
Thangavelu K S8e413082017-07-13 20:02:14 +00001141 def igmp_flow_check(self, subscriber, multiple_sub = False):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001142 chan = 0
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001143 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1144 if subscriber.num_channels == 1:
Thangavelu K S9a637332017-08-01 23:22:23 +00001145 if i != 0:
1146 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001147 chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1148 else:
1149 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1150 self.num_joins += 1
1151 while self.num_joins < self.num_subscribers:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001152 time.sleep(5)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001153 log_test.info('All subscribers have joined the channel')
1154 # for i in range(1):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001155 time.sleep(0.5)
1156 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1157 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1158 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
1159 time.sleep(5)
1160# 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 +00001161 if subscriber.num_channels == 1:
1162 pass
1163 elif chan != 0:
1164 #Should not receive packets for this channel
1165 self.recv_timeout = True
1166 subscriber.recv_timeout = True
1167 subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1168 subscriber.recv_timeout = False
1169 self.recv_timeout = False
Thangavelu K S9a637332017-08-01 23:22:23 +00001170 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 +00001171# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K S9a637332017-08-01 23:22:23 +00001172# chan = subscriber.num_channels - i
1173# self.test_status = True
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001174 return self.test_status
Thangavelu K S9a637332017-08-01 23:22:23 +00001175
1176 def igmp_join_next_channel_flow_check(self, subscriber, multiple_sub = False):
1177 chan = 0
1178 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1179# if subscriber.num_channels == 1:
1180# chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1181# else:
1182 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1183 self.num_joins += 1
1184 while self.num_joins < self.num_subscribers:
1185 time.sleep(5)
1186 log_test.info('All subscribers have joined the channel')
1187 # for i in range(1):
1188 time.sleep(0.5)
1189 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1190 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1191 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
1192 time.sleep(5)
1193# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1194# if subscriber.num_channels == 1:
1195# pass
1196# elif chan != 0:
1197# pass
1198 #Should not receive packets for this channel
1199# log_test.info
1200# self.recv_timeout = True
1201# subscriber.recv_timeout = True
1202# subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1203# subscriber.recv_timeout = False
1204# self.recv_timeout = False
1205# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1206# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001207 chan = subscriber.num_channels - i
Thangavelu K S8e413082017-07-13 20:02:14 +00001208# self.test_status = True
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00001209 return self.test_status
1210
Thangavelu K S36edb012017-07-05 18:24:12 +00001211
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001212 def igmp_leave_flow_check(self, subscriber, multiple_sub = False):
1213 chan = 0
1214 for i in range(self.VOLTHA_IGMP_ITERATIONS):
1215 subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1216 self.num_joins += 1
1217 while self.num_joins < self.num_subscribers:
1218 time.sleep(5)
1219 log_test.info('All subscribers have joined the channel')
1220# for i in range(1):
1221 time.sleep(0.5)
1222 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1223 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1224 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1225 time.sleep(10)
1226# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1227 #Should not receive packets for this subscriber
1228 self.recv_timeout = True
1229 subscriber.recv_timeout = True
1230 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1231 subscriber.recv_timeout = False
1232 self.recv_timeout = False
1233# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1234# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1235# self.test_status = True
1236 return self.test_status
1237
1238
Thangavelu K S8e413082017-07-13 20:02:14 +00001239 def igmp_flow_check_join_change_to_exclude(self, subscriber, multiple_sub = False):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001240 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001241 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1242 for i in range(3):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001243 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
Thangavelu K S9a637332017-08-01 23:22:23 +00001244 self.num_joins += 1
1245 while self.num_joins < self.num_subscribers:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001246 time.sleep(5)
Thangavelu K S9a637332017-08-01 23:22:23 +00001247 log_test.info('All subscribers have joined the channel')
1248 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1249 time.sleep(5)
1250 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]))
1251 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1252 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1253 time.sleep(60)
1254 self.recv_timeout = False
1255 subscriber.recv_timeout = False
1256 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1257 if self.test_status is True:
1258 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1259 if self.test_status is False:
1260 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1261 continue
1262 subscriber.recv_timeout = False
1263 self.recv_timeout = False
1264 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001265# self.test_status = True
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001266 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001267
Thangavelu K S8e413082017-07-13 20:02:14 +00001268 def igmp_flow_check_join_change_to_exclude_again_include_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001269 chan = 0
1270 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1271 for i in range(3):
1272 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1273 self.num_joins += 1
1274 while self.num_joins < self.num_subscribers:
1275 time.sleep(5)
1276 log_test.info('All subscribers have joined the channel')
1277 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1278 time.sleep(5)
1279 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]))
1280 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1281 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1282 time.sleep(60)
1283 self.recv_timeout = False
1284 subscriber.recv_timeout = False
1285 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1286 if self.test_status is True:
1287 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1288 if self.test_status is False:
1289 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1290 continue
1291 subscriber.recv_timeout = False
1292 self.recv_timeout = False
1293 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1294 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_INCLUDE)
1295 time.sleep(5)
1296# self.recv_timeout = True
1297# subscriber.recv_timeout = True
1298 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1299 subscriber.recv_timeout = False
1300 self.recv_timeout = False
1301
1302
1303 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1304# self.test_status = True
1305 return self.test_status
1306
Thangavelu K S8e413082017-07-13 20:02:14 +00001307 def igmp_flow_check_join_change_to_block(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001308 chan = 0
1309 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1310 for i in range(3):
1311 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1312 self.num_joins += 1
1313 while self.num_joins < self.num_subscribers:
1314 time.sleep(5)
1315 log_test.info('All subscribers have joined the channel')
1316 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1317 time.sleep(5)
1318 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]))
1319 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_BLOCK_OLD)
1320 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1321 time.sleep(60)
1322 self.recv_timeout = False
1323 subscriber.recv_timeout = False
1324 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1325 if self.test_status is True:
1326 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1327 if self.test_status is False:
1328 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1329 continue
1330 subscriber.recv_timeout = False
1331 self.recv_timeout = False
1332 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1333# self.test_status = True
1334 return self.test_status
1335
Thangavelu K S36edb012017-07-05 18:24:12 +00001336
Thangavelu K S8e413082017-07-13 20:02:14 +00001337 def igmp_flow_check_join_change_to_block_again_allow_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001338 chan = 0
1339 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1340 for i in range(3):
1341 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1342 self.num_joins += 1
1343 while self.num_joins < self.num_subscribers:
1344 time.sleep(5)
1345 log_test.info('All subscribers have joined the channel')
1346 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1347 time.sleep(5)
1348 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]))
1349 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1350 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1351 time.sleep(60)
1352 self.recv_timeout = False
1353 subscriber.recv_timeout = False
1354 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1355 if self.test_status is True:
1356 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1357 if self.test_status is False:
1358 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1359 continue
1360 subscriber.recv_timeout = False
1361 self.recv_timeout = False
1362 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1363 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_ALLOW_NEW)
1364 time.sleep(5)
1365# self.recv_timeout = True
1366# subscriber.recv_timeout = True
1367 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1368 subscriber.recv_timeout = False
1369 self.recv_timeout = False
1370
1371
1372 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1373# self.test_status = True
1374 return self.test_status
Thangavelu K S8e413082017-07-13 20:02:14 +00001375
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001376 def igmp_flow_check_group_include_source_empty_list(self, subscriber, multiple_sub = False):
1377 chan = 0
1378 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1379 self.num_joins += 1
1380 while self.num_joins < self.num_subscribers:
1381 time.sleep(5)
1382 log_test.info('All subscribers have joined the channel')
1383 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 +00001384 if self.test_status is True:
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001385 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1386 self.test_status = False
1387 else:
1388 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 +00001389 self.test_status = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001390 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1391 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1392 time.sleep(5)
1393 subscriber.recv_timeout = False
1394 self.recv_timeout = False
1395 return self.test_status
1396
1397 def igmp_flow_check_group_exclude_source_empty_list(self, subscriber, multiple_sub = False):
1398 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001399 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1400 self.num_joins += 1
1401 while self.num_joins < self.num_subscribers:
1402 time.sleep(5)
1403 log_test.info('All subscribers have joined the channel')
1404 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1405 if self.test_status is True:
1406 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1407 self.test_status = False
1408 else:
1409 log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port))
1410 self.test_status = True
1411
1412 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1413 log_test.info('Send join to multicast group with exclude empty source list and waited till GMI timer expires')
1414 time.sleep(60)
1415
1416 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1417 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1418 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1419 time.sleep(5)
1420 subscriber.recv_timeout = False
1421 self.recv_timeout = False
1422 return self.test_status
1423
1424 def igmp_flow_check_group_exclude_source_empty_list_1(self, subscriber, multiple_sub = False):
1425 chan = 0
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001426 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list,record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1427 self.num_joins += 1
1428 while self.num_joins < self.num_subscribers:
1429 time.sleep(5)
1430 log_test.info('All subscribers have joined the channel')
1431 for i in range(10):
1432 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1433 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1434 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1435 time.sleep(5)
1436 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1437 #Should not receive packets for this subscriber
1438 self.recv_timeout = True
1439 subscriber.recv_timeout = True
1440 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1441 subscriber.recv_timeout = False
1442 self.recv_timeout = False
1443 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1444 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1445# self.test_status = True
1446 return self.test_status
1447
1448 def igmp_flow_check_during_olt_onu_operational_issues(self, subscriber, multiple_sub = False):
1449 chan = 0
1450 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1451 self.num_joins += 1
1452 while self.num_joins < self.num_subscribers:
1453 time.sleep(5)
1454 log_test.info('All subscribers have joined the channel')
1455 for i in range(2):
1456 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1457 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1458 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1459 time.sleep(5)
1460 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1461 #Should not receive packets for this subscriber
1462 self.recv_timeout = True
1463 subscriber.recv_timeout = True
1464 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1465 subscriber.recv_timeout = False
1466 self.recv_timeout = False
1467 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1468 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1469# self.test_status = True
1470 return self.test_status
1471
Thangavelu K S8e413082017-07-13 20:02:14 +00001472 def voltha_igmp_jump_verify(self, subscriber):
1473 if subscriber.has_service('IGMP'):
1474 for i in xrange(subscriber.num):
1475 log_test.info('Subscriber %s jumping channel' %subscriber.name)
1476 chan = subscriber.channel_jump(delay=0)
1477 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
1478 log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1479 time.sleep(3)
1480 log_test.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats))
1481 self.test_status = True
1482 return self.test_status
1483
1484 def voltha_igmp_next_verify(self, subscriber):
1485 for c in xrange(self.VOLTHA_IGMP_ITERATIONS):
1486 for i in xrange(subscriber.num):
1487 if i:
1488 chan = subscriber.channel_join_next(delay=0, leave_flag = self.leave_flag)
1489 time.sleep(0.2)
1490 else:
1491 chan = subscriber.channel_join(i, delay=0)
1492 time.sleep(0.2)
1493 if subscriber.num == 1:
1494 subscriber.channel_leave(chan)
1495 log_test.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
1496 #subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
1497 #log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1498 self.test_status = True
1499 return self.test_status
1500
1501 def voltha_subscribers(self, services, cbs = None, num_subscribers = 1, num_channels = 1, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +00001502 """Test subscriber join next for channel surfing"""
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001503 voltha = VolthaCtrl(self.VOLTHA_HOST,
1504 rest_port = self.VOLTHA_REST_PORT,
1505 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S36edb012017-07-05 18:24:12 +00001506 if self.VOLTHA_OLT_TYPE.startswith('ponsim'):
A R Karthick168e2342017-08-15 16:13:10 -07001507 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S36edb012017-07-05 18:24:12 +00001508 log_test.info('Enabling ponsim olt')
1509 device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001510 if device_id != '':
1511 self.olt_device_id = device_id
Thangavelu K S36edb012017-07-05 18:24:12 +00001512 else:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001513 log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution')
1514 assert_equal(False, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00001515
1516 assert_not_equal(device_id, None)
1517 if status == False:
1518 voltha.disable_device(device_id, delete = True)
1519 assert_equal(status, True)
1520 time.sleep(10)
1521 switch_map = None
1522 olt_configured = False
1523 try:
1524 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1525 if not switch_map:
1526 log_test.info('No voltha devices found')
1527 return
1528 log_test.info('Installing OLT app')
1529 OnosCtrl.install_app(self.olt_app_file)
1530 time.sleep(5)
1531 log_test.info('Adding subscribers through OLT app')
1532 self.config_olt(switch_map)
1533 olt_configured = True
1534 time.sleep(5)
1535 self.num_subscribers = num_subscribers
1536 self.num_channels = num_channels
1537 test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers,
1538 num_channels = self.num_channels,
1539 cbs = cbs,
1540 port_list = self.generate_port_list(self.num_subscribers,
1541 self.num_channels),
Thangavelu K S8e413082017-07-13 20:02:14 +00001542 src_list = src_list, services = services)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001543 if test_status is False:
1544 self.success = False
Thangavelu K S36edb012017-07-05 18:24:12 +00001545 assert_equal(test_status, True)
1546 finally:
1547 if switch_map is not None:
1548 if olt_configured is True:
1549 self.remove_olt(switch_map)
1550 voltha.disable_device(device_id, delete = True)
1551 time.sleep(10)
1552 log_test.info('Uninstalling OLT app')
1553 OnosCtrl.uninstall_app(self.olt_app_name)
1554
Thangavelu K S8e413082017-07-13 20:02:14 +00001555 def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1,
1556 channel_start = 0, cbs = None, port_list = [], src_list = None,
Thangavelu K S36edb012017-07-05 18:24:12 +00001557 services = None, negative_subscriber_auth = None):
1558 self.test_status = False
1559 self.ovs_cleanup()
1560 subscribers_count = num_subscribers
1561 sub_loop_count = num_subscribers
1562 if not port_list:
1563 port_list = self.generate_port_list(num_subscribers, num_channels)
1564 subscriber_tx_rx_ports = []
1565 for i in range(num_subscribers):
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001566 subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map[port_list[i][0]],
1567 rx_port = self.port_map[port_list[i][1]],
Thangavelu K S8e413082017-07-13 20:02:14 +00001568 num_channels = num_channels,src_list = src_list,))
Thangavelu K S36edb012017-07-05 18:24:12 +00001569 self.onos_aaa_load()
Thangavelu K S8e413082017-07-13 20:02:14 +00001570 #load the ssm list for all subscriber channels
1571 igmpChannel = IgmpChannel(src_list = src_list)
1572 ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports)
1573 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
Thangavelu K S6432b522017-07-22 00:05:54 +00001574 if src_list is None:
1575 igmpChannel = IgmpChannel()
1576 igmpChannel.igmp_load_ssm_config(ssm_list)
1577 else:
1578 igmpChannel = IgmpChannel(src_list = src_list)
1579 igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001580
Thangavelu K S36edb012017-07-05 18:24:12 +00001581 self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1)
1582
1583 chan_leave = False #for single channel, multiple subscribers
1584 if cbs is None:
1585 cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check)
1586 chan_leave = True
1587 for subscriber in subscriber_tx_rx_ports:
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001588 if 'IGMP' in services:
1589# if src_list:
1590# for i in range(len(src_list)):
1591# subscriber.start(src_ip = src_list[i])
1592# else:
1593# subscriber.start()
1594 subscriber.start()
Thangavelu K S36edb012017-07-05 18:24:12 +00001595 sub_loop_count = sub_loop_count - 1
1596 pool_object = voltha_subscriber_pool(subscriber, cbs)
1597 self.thread_pool.addTask(pool_object.pool_cb)
1598 self.thread_pool.cleanUpThreads()
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001599 for subscriber in subscriber_tx_rx_ports:
1600 if services and 'IGMP' in services:
1601# if src_list:
1602# for i in range(len(src_list)):
1603# subscriber.stop(src_ip = src_list[i])
1604# else:
1605# subscriber.stop()
1606 subscriber.stop()
1607 if chan_leave is True:
1608 subscriber.channel_leave(0)
Thangavelu K S36edb012017-07-05 18:24:12 +00001609 subscribers_count = 0
1610 return self.test_status
1611
1612
1613 def generate_port_list(self, subscribers, channels):
1614 return self.port_list[:subscribers]
1615
Thangavelu K S36edb012017-07-05 18:24:12 +00001616 @classmethod
1617 def ovs_cleanup(cls):
1618 ##For every test case, delete all the OVS groups
1619 cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1'
1620 try:
1621 cord_test_shell(cmd)
1622 ##Since olt config is used for this test, we just fire a careless local cmd as well
1623 os.system(cmd)
1624 finally:
1625 return
1626
A.R Karthick8a507cf2017-06-02 18:44:49 -07001627 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -07001628 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -07001629 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
1630 assert_not_equal(device_id, None)
1631 try:
1632 assert_equal(status, True)
1633 time.sleep(10)
1634 finally:
1635 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001636
A.R Karthick8a507cf2017-06-02 18:44:49 -07001637 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001638 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001639 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -07001640 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1641 assert_not_equal(device_id, None)
1642 try:
1643 assert_equal(status, True)
1644 time.sleep(10)
1645 finally:
1646 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001647
A R Karthick31a40172017-08-14 12:06:09 -07001648 def test_maple_enable_disable(self):
1649 log_test.info('Enabling maple olt')
1650 if self.VOLTHA_OLT_IP:
1651 address = self.VOLTHA_OLT_IP
1652 device_id, status = self.voltha.enable_device('maple_olt', address = address)
1653 assert_not_equal(device_id, None)
1654 try:
1655 assert_equal(status, True)
1656 time.sleep(10)
1657 finally:
1658 self.voltha.disable_device(device_id, delete = True)
1659
Thangavelu K S008f38e2017-05-15 19:36:55 +00001660 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
1661 """
1662 Test Method:
1663 0. Make sure that voltha is up and running on CORD-POD setup.
1664 1. OLT and ONU is detected and validated.
1665 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1666 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
1667 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
1668 5. Verify that subscriber is authenticated successfully.
1669 """
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001670 ret = voltha_setup(
1671 host = self.VOLTHA_HOST,
A R Karthick168e2342017-08-15 16:13:10 -07001672 ponsim_host = self.VOLTHA_PONSIM_HOST,
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001673 rest_port = self.VOLTHA_REST_PORT,
1674 olt_type = 'ponsim_olt',
1675 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP,
1676 uplink_vlan_start = self.VOLTHA_UPLINK_VLAN_START,
1677 config_fake = self.VOLTHA_CONFIG_FAKE,
1678 olt_app = self.olt_app_file)
1679 assert_not_equal(ret, None)
1680 voltha, device_id, switch_map = ret[0], ret[1], ret[2]
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001681 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001682 log_test.info('Adding subscribers through OLT app')
1683 self.config_olt(switch_map)
1684 olt_configured = True
1685 time.sleep(5)
1686 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001687 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001688 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001689 if switch_map is not None:
1690 if olt_configured is True:
1691 self.remove_olt(switch_map)
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001692 voltha_teardown(voltha, device_id, switch_map, olt_app = self.olt_app_file)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001693
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001694 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001695 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
1696 """
1697 Test Method:
1698 0. Make sure that voltha is up and running on CORD-POD setup.
1699 1. OLT and ONU is detected and validated.
1700 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1701 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1702 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
1703 5. Verify that subscriber authentication is unsuccessful..
1704 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001705 df = defer.Deferred()
1706 def tls_flow_check_with_no_cert_scenario(df):
1707 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001708 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001709 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1710 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001711 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001712 time.sleep(10)
1713 switch_map = None
1714 olt_configured = False
1715 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1716 log_test.info('Installing OLT app')
1717 OnosCtrl.install_app(self.olt_app_file)
1718 time.sleep(5)
1719 log_test.info('Adding subscribers through OLT app')
1720 self.config_olt(switch_map)
1721 olt_configured = True
1722 time.sleep(5)
1723 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1724 try:
1725 assert_equal(auth_status, True)
1726 assert_equal(status, True)
1727 time.sleep(10)
1728 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001729 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001730 self.voltha.disable_device(device_id, delete = True)
1731 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001732
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001733 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1734 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001735
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001736 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001737 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
1738 """
1739 Test Method:
1740 0. Make sure that voltha is up and running on CORD-POD setup.
1741 1. OLT and ONU is detected and validated.
1742 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1743 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
1744 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1745 5. Verify that subscriber authentication is unsuccessful..
1746 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001747 df = defer.Deferred()
1748 def tls_flow_check_with_invalid_cert_scenario(df):
1749 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001750 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001751 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1752 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001753 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001754 time.sleep(10)
1755 switch_map = None
1756 olt_configured = False
1757 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1758 log_test.info('Installing OLT app')
1759 OnosCtrl.install_app(self.olt_app_file)
1760 time.sleep(5)
1761 log_test.info('Adding subscribers through OLT app')
1762 self.config_olt(switch_map)
1763 olt_configured = True
1764 time.sleep(5)
1765 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1766 try:
1767 assert_equal(auth_status, True)
1768 assert_equal(status, True)
1769 time.sleep(10)
1770 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001771 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001772 self.voltha.disable_device(device_id, delete = True)
1773 df.callback(0)
1774 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
1775 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001776
Thangavelu K S0d745c82017-06-09 21:56:08 +00001777 @deferred(TESTCASE_TIMEOUT)
1778 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
1779 """
1780 Test Method:
1781 0. Make sure that voltha is up and running on CORD-POD setup.
1782 1. OLT and ONU is detected and validated.
1783 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1784 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
1785 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1786 5. Verify that subscriber authentication is unsuccessful..
1787 """
1788 df = defer.Deferred()
1789 def tls_flow_check_with_no_cert_scenario(df):
1790 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001791 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001792 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1793 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001794 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001795 time.sleep(10)
1796 switch_map = None
1797 olt_configured = False
1798 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1799 log_test.info('Installing OLT app')
1800 OnosCtrl.install_app(self.olt_app_file)
1801 time.sleep(5)
1802 log_test.info('Adding subscribers through OLT app')
1803 self.config_olt(switch_map)
1804 olt_configured = True
1805 time.sleep(5)
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 = "invalid_cert")
1808 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1809 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1810 try:
1811 assert_equal(auth_status, True)
1812 assert_equal(status, True)
1813 time.sleep(10)
1814 finally:
1815 self.voltha.disable_device(device_id, delete = True)
1816 df.callback(0)
1817 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1818 return df
1819
1820 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001821 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
1822 """
1823 Test Method:
1824 0. Make sure that voltha is up and running on CORD-POD setup.
1825 1. OLT and ONU is detected and validated.
1826 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1827 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1828 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
1829 5. Verify that subscriber authentication is unsuccessful..
1830 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001831 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001832 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001833 aaa_app = ["org.opencord.aaa"]
1834 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001835 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001836 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1837 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001838 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001839 time.sleep(10)
1840 switch_map = None
1841 olt_configured = False
1842 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1843 log_test.info('Installing OLT app')
1844 OnosCtrl.install_app(self.olt_app_file)
1845 time.sleep(5)
1846 log_test.info('Adding subscribers through OLT app')
1847 self.config_olt(switch_map)
1848 olt_configured = True
1849 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001850
Thangavelu K S0d745c82017-06-09 21:56:08 +00001851 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
1852 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
1853 thread1.start()
1854 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001855 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001856 thread2.start()
1857 time.sleep(10)
1858 thread1.join()
1859 thread2.join()
1860 try:
1861 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001862 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001863 time.sleep(10)
1864 finally:
1865 self.voltha.disable_device(device_id, delete = True)
1866 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001867 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001868 return df
1869
1870 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001871 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
1872 """
1873 Test Method:
1874 0. Make sure that voltha is up and running on CORD-POD setup.
1875 1. OLT and ONU is detected and validated.
1876 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1877 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1878 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
1879 5. Verify that subscriber authentication is unsuccessful..
1880 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001881 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001882 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001883 aaa_app = ["org.opencord.aaa"]
1884 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001885 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001886 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1887 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001888 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001889 time.sleep(10)
1890 switch_map = None
1891 olt_configured = False
1892 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1893 log_test.info('Installing OLT app')
1894 OnosCtrl.install_app(self.olt_app_file)
1895 time.sleep(5)
1896 log_test.info('Adding subscribers through OLT app')
1897 self.config_olt(switch_map)
1898 olt_configured = True
1899 time.sleep(5)
1900
1901 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
1902 thread2 = threading.Thread(target = cord_test_radius_restart)
1903 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001904 time.sleep(randint(1,2))
1905 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001906 thread2.start()
1907 time.sleep(10)
1908 thread1.join()
1909 thread2.join()
1910 try:
1911 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001912 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001913 time.sleep(10)
1914 finally:
1915 self.voltha.disable_device(device_id, delete = True)
1916 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001917 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001918 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001919
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001920 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001921 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
1922 """
1923 Test Method:
1924 0. Make sure that voltha is up and running on CORD-POD setup.
1925 1. OLT and ONU is detected and validated.
1926 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1927 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1928 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1929 6. Verify that subscriber authenticated successfully.
1930 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
1931 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1932 9. Verify that subscriber authentication is unsuccessful..
1933 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001934 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001935 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001936 aaa_app = ["org.opencord.aaa"]
1937 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001938 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001939 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1940 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001941 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001942 time.sleep(10)
1943 switch_map = None
1944 olt_configured = False
1945 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1946 log_test.info('Installing OLT app')
1947 OnosCtrl.install_app(self.olt_app_file)
1948 time.sleep(5)
1949 log_test.info('Adding subscribers through OLT app')
1950 self.config_olt(switch_map)
1951 olt_configured = True
1952 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001953
Thangavelu K S0d745c82017-06-09 21:56:08 +00001954 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001955 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +00001956 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001957 time.sleep(randint(1,2))
1958 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001959 thread2.start()
1960 time.sleep(10)
1961 thread1.join()
1962 thread2.join()
1963 try:
1964 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001965 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001966 time.sleep(10)
1967 finally:
1968 self.voltha.disable_device(device_id, delete = True)
1969 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001970 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001971 return df
1972
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001973 @deferred(TESTCASE_TIMEOUT)
1974 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001975 """
1976 Test Method:
1977 0. Make sure that voltha is up and running on CORD-POD setup.
1978 1. OLT and ONU is detected and validated.
1979 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1980 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1981 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1982 6. Verify that subscriber authenticated successfully.
1983 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1984 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1985 9. Verify that subscriber authentication is unsuccessful..
1986 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001987 df = defer.Deferred()
1988 def tls_flow_check_operating_olt_state(df):
1989 aaa_app = ["org.opencord.aaa"]
1990 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001991 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001992 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1993 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001994 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001995 time.sleep(10)
1996 switch_map = None
1997 olt_configured = False
1998 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1999 log_test.info('Installing OLT app')
2000 OnosCtrl.install_app(self.olt_app_file)
2001 time.sleep(5)
2002 log_test.info('Adding subscribers through OLT app')
2003 self.config_olt(switch_map)
2004 olt_configured = True
2005 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002006
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002007 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
2008 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
2009 thread1.start()
2010 time.sleep(randint(1,2))
2011 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
2012 thread2.start()
2013 time.sleep(10)
2014 thread1.join()
2015 thread2.join()
2016 try:
2017 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002018 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002019 time.sleep(10)
2020 finally:
2021 self.voltha.disable_device(device_id, delete = True)
2022 df.callback(0)
2023 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2024 return df
2025
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002026 @deferred(TESTCASE_TIMEOUT +600)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002027 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self):
2028 """
2029 Test Method:
2030 0. Make sure that voltha is up and running on CORD-POD setup.
2031 1. OLT and ONU is detected and validated.
2032 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2033 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2034 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2035 6. Verify that subscriber authenticated successfully.
2036 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
2037 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2038 9. Verify that subscriber authentication is unsuccessful..
2039 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2040
2041 """
2042 df = defer.Deferred()
2043 no_iterations = 10
2044 def tls_flow_check_with_disable_olt_device_scenario(df):
2045 aaa_app = ["org.opencord.aaa"]
2046 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002047 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002048 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2049 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002050 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002051 time.sleep(10)
2052 switch_map = None
2053 olt_configured = False
2054 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2055 log_test.info('Installing OLT app')
2056 OnosCtrl.install_app(self.olt_app_file)
2057 time.sleep(5)
2058 log_test.info('Adding subscribers through OLT app')
2059 self.config_olt(switch_map)
2060 olt_configured = True
2061 time.sleep(5)
2062 for i in range(no_iterations):
2063 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 +00002064 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002065 thread1.start()
2066 time.sleep(randint(1,2))
2067 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
2068 thread2.start()
2069 time.sleep(10)
2070 thread1.join()
2071 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002072 time.sleep(60)
2073 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002074 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2075 try:
2076 # assert_equal(status, True)
2077 assert_equal(auth_status, True)
2078 assert_equal(self.success, True)
2079 time.sleep(10)
2080 finally:
2081 self.voltha.disable_device(device_id, delete = True)
2082 df.callback(0)
2083 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2084 return df
2085
2086 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002087 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
2088 """
2089 Test Method:
2090 0. Make sure that voltha is up and running on CORD-POD setup.
2091 1. OLT and ONU is detected and validated.
2092 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2093 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2094 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2095 6. Verify that subscriber authenticated successfully.
2096 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2097 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2098 9. Verify that subscriber authentication is unsuccessful..
2099 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002100 df = defer.Deferred()
2101 def tls_flow_check_operating_olt_state(df):
2102 aaa_app = ["org.opencord.aaa"]
2103 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002104 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002105 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2106 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002107 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002108 time.sleep(10)
2109 switch_map = None
2110 olt_configured = False
2111 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2112 log_test.info('Installing OLT app')
2113 OnosCtrl.install_app(self.olt_app_file)
2114 time.sleep(5)
2115 log_test.info('Adding subscribers through OLT app')
2116 self.config_olt(switch_map)
2117 olt_configured = True
2118 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002119
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002120 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2121 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2122 thread1.start()
2123 time.sleep(randint(1,2))
2124 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2125 thread2.start()
2126 time.sleep(10)
2127 thread1.join()
2128 thread2.join()
2129 try:
2130 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002131 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002132 time.sleep(10)
2133 finally:
2134 self.voltha.disable_device(device_id, delete = True)
2135 df.callback(0)
2136 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2137 return df
2138
2139 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002140 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self):
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002141 """
2142 Test Method:
2143 0. Make sure that voltha is up and running on CORD-POD setup.
2144 1. OLT and ONU is detected and validated.
2145 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2146 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2147 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2148 6. Verify that subscriber authenticated successfully.
2149 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2150 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2151 9. Verify that subscriber authentication is unsuccessful..
2152 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2153 """
2154 df = defer.Deferred()
2155 no_iterations = 10
2156 def tls_flow_check_with_disable_olt_device_scenario(df):
2157 aaa_app = ["org.opencord.aaa"]
2158 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002159 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002160 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2161 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002162 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002163 time.sleep(10)
2164 switch_map = None
2165 olt_configured = False
2166 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2167 log_test.info('Installing OLT app')
2168 OnosCtrl.install_app(self.olt_app_file)
2169 time.sleep(5)
2170 log_test.info('Adding subscribers through OLT app')
2171 self.config_olt(switch_map)
2172 olt_configured = True
2173 time.sleep(5)
2174 for i in range(no_iterations):
2175 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2176 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2177 thread1.start()
2178 time.sleep(randint(1,2))
2179 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2180 thread2.start()
2181 time.sleep(10)
2182 thread1.join()
2183 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002184 time.sleep(60)
2185 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002186 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2187 try:
2188 # assert_equal(status, True)
2189 assert_equal(auth_status, True)
2190 assert_equal(self.success, True)
2191 time.sleep(10)
2192 finally:
2193 self.voltha.disable_device(device_id, delete = True)
2194 df.callback(0)
2195 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2196 return df
2197
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002198 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002199 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
2200 """
2201 Test Method:
2202 0. Make sure that voltha is up and running on CORD-POD setup.
2203 1. OLT and ONU is detected and validated.
2204 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2205 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2206 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2207 6. Verify that subscriber authenticated successfully.
2208 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2209 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2210 9. Verify that subscriber authentication is unsuccessful..
2211 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002212 df = defer.Deferred()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002213 def tls_flow_check_operating_onu_state(df):
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002214 aaa_app = ["org.opencord.aaa"]
2215 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002216 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002217 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2218 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00002219 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2220
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002221 onu_device_id = devices_list['items'][1]['id']
2222 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002223 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002224 time.sleep(10)
2225 switch_map = None
2226 olt_configured = False
2227 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2228 log_test.info('Installing OLT app')
2229 OnosCtrl.install_app(self.olt_app_file)
2230 time.sleep(5)
2231 log_test.info('Adding subscribers through OLT app')
2232 self.config_olt(switch_map)
2233 olt_configured = True
2234 time.sleep(5)
2235 devices_list = self.voltha.get_devices()
2236 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2237 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2238 thread1.start()
2239 time.sleep(randint(1,2))
2240 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2241 thread2.start()
2242 time.sleep(10)
2243 thread1.join()
2244 thread2.join()
2245 try:
2246 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002247 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002248 time.sleep(10)
2249 finally:
2250 self.voltha.disable_device(device_id, delete = True)
2251 df.callback(0)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002252 reactor.callLater(0, tls_flow_check_operating_onu_state, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002253 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002254
Thangavelu K S9648eed2017-06-13 20:15:25 +00002255 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002256 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
2257 """
2258 Test Method:
2259 0. Make sure that voltha is up and running on CORD-POD setup.
2260 1. OLT and ONU is detected and validated.
2261 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2262 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2263 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2264 6. Verify that subscriber authenticated successfully.
2265 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2266 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2267 9. Verify that subscriber authentication is unsuccessful..
2268 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2269 """
2270 df = defer.Deferred()
2271 no_iterations = 10
2272 def tls_flow_check_operating_olt_state(df):
2273 aaa_app = ["org.opencord.aaa"]
2274 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002275 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002276 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2277 devices_list = self.voltha.get_devices()
2278 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2279
2280 onu_device_id = devices_list['items'][1]['id']
2281 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002282 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002283 time.sleep(10)
2284 switch_map = None
2285 olt_configured = False
2286 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2287 log_test.info('Installing OLT app')
2288 OnosCtrl.install_app(self.olt_app_file)
2289 time.sleep(5)
2290 log_test.info('Adding subscribers through OLT app')
2291 self.config_olt(switch_map)
2292 olt_configured = True
2293 time.sleep(5)
2294 devices_list = self.voltha.get_devices()
2295 for i in range(no_iterations):
2296 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2297 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2298 thread1.start()
2299 time.sleep(randint(1,2))
2300 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2301 thread2.start()
2302 time.sleep(10)
2303 thread1.join()
2304 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002305 time.sleep(60)
2306 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002307 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2308 try:
2309 # assert_equal(status, True)
2310 assert_equal(auth_status, True)
2311 assert_equal(self.success, True)
2312 time.sleep(10)
2313 finally:
2314 self.voltha.disable_device(device_id, delete = True)
2315 df.callback(0)
2316 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2317 return df
2318
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002319 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002320 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002321 """
2322 Test Method:
2323 0. Make sure that voltha is up and running on CORD-POD setup.
2324 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2325 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2326 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2327 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
2328 5. Verify that two subscribers are authenticated successfully.
2329 """
2330
Thangavelu K S9648eed2017-06-13 20:15:25 +00002331 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002332 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002333 aaa_app = ["org.opencord.aaa"]
2334 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002335 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002336 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2337 devices_list = self.voltha.get_devices()
2338 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2339
2340 onu_device_id = devices_list['items'][1]['id']
2341 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002342 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002343 time.sleep(10)
2344 switch_map = None
2345 olt_configured = False
2346 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2347 log_test.info('Installing OLT app')
2348 OnosCtrl.install_app(self.olt_app_file)
2349 time.sleep(5)
2350 log_test.info('Adding subscribers through OLT app')
2351 self.config_olt(switch_map)
2352 olt_configured = True
2353 time.sleep(5)
2354 devices_list = self.voltha.get_devices()
2355 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2356 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2357 thread1.start()
2358 time.sleep(randint(1,2))
2359 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2360 thread2.start()
2361 time.sleep(10)
2362 thread1.join()
2363 thread2.join()
2364 try:
2365 # assert_equal(status, True)
2366 assert_equal(self.success, True)
2367 time.sleep(10)
2368 finally:
2369 self.voltha.disable_device(device_id, delete = True)
2370 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002371 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002372 return df
2373
2374 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002375 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002376 """
2377 Test Method:
2378 0. Make sure that voltha is up and running on CORD-POD setup.
2379 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2380 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2381 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2382 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
2383 5. Verify that two subscribers are not authenticated.
2384 """
Thangavelu K S9648eed2017-06-13 20:15:25 +00002385 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002386 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002387 aaa_app = ["org.opencord.aaa"]
2388 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002389 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002390 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2391 devices_list = self.voltha.get_devices()
2392 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2393
2394 onu_device_id = devices_list['items'][1]['id']
2395 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002396 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002397 time.sleep(10)
2398 switch_map = None
2399 olt_configured = False
2400 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2401 log_test.info('Installing OLT app')
2402 OnosCtrl.install_app(self.olt_app_file)
2403 time.sleep(5)
2404 log_test.info('Adding subscribers through OLT app')
2405 self.config_olt(switch_map)
2406 olt_configured = True
2407 time.sleep(5)
2408 devices_list = self.voltha.get_devices()
2409 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2410 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
2411 thread1.start()
2412 time.sleep(randint(1,2))
2413 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2414 thread2.start()
2415 time.sleep(10)
2416 thread1.join()
2417 thread2.join()
2418 try:
2419 # assert_equal(status, True)
2420 assert_equal(self.success, True)
2421 time.sleep(10)
2422 finally:
2423 self.voltha.disable_device(device_id, delete = True)
2424 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002425 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002426 return df
2427
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002428 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002429 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 +00002430 """
2431 Test Method:
2432 0. Make sure that voltha is up and running on CORD-POD setup.
2433 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2434 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2435 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2436 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2437 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
2438 6. Verify that valid subscriber authenticated successfully.
2439 7. Verify that invalid subscriber are not authenticated successfully.
2440 """
2441
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002442 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002443 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002444 aaa_app = ["org.opencord.aaa"]
2445 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002446 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002447 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2448 devices_list = self.voltha.get_devices()
2449 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2450
2451 onu_device_id = devices_list['items'][1]['id']
2452 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002453 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002454 time.sleep(10)
2455 switch_map = None
2456 olt_configured = False
2457 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2458 log_test.info('Installing OLT app')
2459 OnosCtrl.install_app(self.olt_app_file)
2460 time.sleep(5)
2461 log_test.info('Adding subscribers through OLT app')
2462 self.config_olt(switch_map)
2463 olt_configured = True
2464 time.sleep(5)
2465 devices_list = self.voltha.get_devices()
2466 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2467 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
2468 thread1.start()
2469 time.sleep(randint(1,2))
2470 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2471 thread2.start()
2472 time.sleep(10)
2473 thread1.join()
2474 thread2.join()
2475 try:
2476 # assert_equal(status, True)
2477 assert_equal(self.success, True)
2478 time.sleep(10)
2479 finally:
2480 self.voltha.disable_device(device_id, delete = True)
2481 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002482 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002483 return df
2484
2485 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002486 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 +00002487 """
2488 Test Method:
2489 0. Make sure that voltha is up and running on CORD-POD setup.
2490 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2491 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2492 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2493 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2494 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
2495 6. Verify that valid subscriber authenticated successfully.
2496 7. Verify that invalid subscriber are not authenticated successfully.
2497 """
2498
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002499 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002500 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002501 aaa_app = ["org.opencord.aaa"]
2502 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002503 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002504 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2505 devices_list = self.voltha.get_devices()
2506 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2507
2508 onu_device_id = devices_list['items'][1]['id']
2509 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002510 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002511 time.sleep(10)
2512 switch_map = None
2513 olt_configured = False
2514 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2515 log_test.info('Installing OLT app')
2516 OnosCtrl.install_app(self.olt_app_file)
2517 time.sleep(5)
2518 log_test.info('Adding subscribers through OLT app')
2519 self.config_olt(switch_map)
2520 olt_configured = True
2521 time.sleep(5)
2522 devices_list = self.voltha.get_devices()
2523 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2524 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
2525 thread1.start()
2526 time.sleep(randint(1,2))
2527 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2528 thread2.start()
2529 time.sleep(10)
2530 thread1.join()
2531 thread2.join()
2532 try:
2533 # assert_equal(status, True)
2534 assert_equal(self.success, True)
2535 time.sleep(10)
2536 finally:
2537 self.voltha.disable_device(device_id, delete = True)
2538 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002539 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002540 return df
2541
2542 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002543 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002544 """
2545 Test Method:
2546 0. Make sure that voltha is up and running on CORD-POD setup.
2547 1. OLT and ONU is detected and validated.
2548 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2549 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2550 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
2551 6. Verify that subscriber authenticated successfully.
2552 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
2553 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
2554 9. Verify that subscriber authentication is unsuccessful..
2555 10. Verify that other subscriber authenticated successfully.
2556 """
2557
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002558 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002559 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002560 aaa_app = ["org.opencord.aaa"]
2561 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002562 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002563 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2564 devices_list = self.voltha.get_devices()
2565 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2566
2567 onu_device_id = devices_list['items'][1]['id']
2568 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002569 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002570 time.sleep(10)
2571 switch_map = None
2572 olt_configured = False
2573 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2574 log_test.info('Installing OLT app')
2575 OnosCtrl.install_app(self.olt_app_file)
2576 time.sleep(5)
2577 log_test.info('Adding subscribers through OLT app')
2578 self.config_olt(switch_map)
2579 olt_configured = True
2580 time.sleep(5)
2581 devices_list = self.voltha.get_devices()
2582 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2583 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
2584 thread1.start()
2585 time.sleep(randint(1,2))
2586 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2587 thread2.start()
2588 time.sleep(10)
2589 thread1.join()
2590 thread2.join()
2591 try:
2592 # assert_equal(status, True)
2593 assert_equal(self.success, True)
2594 time.sleep(10)
2595 finally:
2596 self.voltha.disable_device(device_id, delete = True)
2597 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002598 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002599 return df
2600
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00002601 def test_three_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00002602 """
2603 Test Method:
2604 0. Make sure that voltha is up and running on CORD-POD setup.
2605 1. OLT and ONU is detected and validated.
2606 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2607 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers)
2608 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2609 5. Verify that subscriber is authenticated successfully.
2610 """
2611 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2612 num_subscribers = 3
2613 num_channels = 1
2614 services = ('TLS')
2615 cbs = (self.tls_flow_check, None, None)
2616 self.voltha_subscribers(services, cbs = cbs,
2617 num_subscribers = num_subscribers,
2618 num_channels = num_channels)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00002619 assert_equal(self.success, True)
2620
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00002621 def test_five_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00002622 """
2623 Test Method:
2624 0. Make sure that voltha is up and running on CORD-POD setup.
2625 1. OLT and ONU is detected and validated.
2626 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2627 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber)
2628 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2629 5. Verify that subscriber is authenticated successfully.
2630 """
2631 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2632 num_subscribers = 5
2633 num_channels = 1
2634 services = ('TLS')
2635 cbs = (self.tls_flow_check, None, None)
2636 self.voltha_subscribers(services, cbs = cbs,
2637 num_subscribers = num_subscribers,
2638 num_channels = num_channels)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00002639 assert_equal(self.success, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00002640
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00002641 def test_nine_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00002642 """
2643 Test Method:
2644 0. Make sure that voltha is up and running on CORD-POD setup.
2645 1. OLT and ONU is detected and validated.
2646 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2647 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber)
2648 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2649 5. Verify that subscriber is authenticated successfully.
2650 """
2651 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2652 num_subscribers = 9
2653 num_channels = 1
2654 services = ('TLS')
2655 cbs = (self.tls_flow_check, None, None)
2656 self.voltha_subscribers(services, cbs = cbs,
2657 num_subscribers = num_subscribers,
2658 num_channels = num_channels)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00002659 assert_equal(self.success, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00002660
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002661 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002662 def test_subscriber_with_voltha_for_dhcp_request(self):
2663 """
2664 Test Method:
2665 0. Make sure that voltha is up and running on CORD-POD setup.
2666 1. OLT and ONU is detected and validated.
2667 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2668 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2669 4. Verify that subscriber get ip from dhcp server successfully.
2670 """
2671
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002672 df = defer.Deferred()
2673 def dhcp_flow_check_scenario(df):
2674 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002675 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002676 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2677 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002678 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002679 time.sleep(10)
2680 switch_map = None
2681 olt_configured = False
2682 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2683 log_test.info('Installing OLT app')
2684 OnosCtrl.install_app(self.olt_app_file)
2685 time.sleep(5)
2686 log_test.info('Adding subscribers through OLT app')
2687 self.config_olt(switch_map)
2688 olt_configured = True
2689 time.sleep(5)
2690 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2691 try:
2692 assert_equal(dhcp_status, True)
2693 #assert_equal(status, True)
2694 time.sleep(10)
2695 finally:
2696 self.remove_olt(switch_map)
2697 self.voltha.disable_device(device_id, delete = True)
2698 df.callback(0)
2699
2700 reactor.callLater(0, dhcp_flow_check_scenario, df)
2701 return df
2702
2703 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002704 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
2705 """
2706 Test Method:
2707 0. Make sure that voltha is up and running on CORD-POD setup.
2708 1. OLT and ONU is detected and validated.
2709 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2710 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
2711 4. Verify that subscriber should not get ip from dhcp server.
2712 """
2713
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002714 df = defer.Deferred()
2715 def dhcp_flow_check_scenario(df):
2716 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002717 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002718 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2719 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002720 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002721 time.sleep(10)
2722 switch_map = None
2723 olt_configured = False
2724 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2725 log_test.info('Installing OLT app')
2726 OnosCtrl.install_app(self.olt_app_file)
2727 time.sleep(5)
2728 log_test.info('Adding subscribers through OLT app')
2729 self.config_olt(switch_map)
2730 olt_configured = True
2731 time.sleep(5)
2732 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
2733 try:
2734 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002735 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002736 #assert_equal(status, True)
2737 time.sleep(10)
2738 finally:
2739 self.voltha.disable_device(device_id, delete = True)
2740 self.remove_olt(switch_map)
2741 df.callback(0)
2742
2743 reactor.callLater(0, dhcp_flow_check_scenario, df)
2744 return df
2745
2746
2747 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002748 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
2749 """
2750 Test Method:
2751 0. Make sure that voltha is up and running on CORD-POD setup.
2752 1. OLT and ONU is detected and validated.
2753 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2754 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
2755 4. Verify that subscriber should not get ip from dhcp server.
2756 """
2757
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002758 df = defer.Deferred()
2759 def dhcp_flow_check_scenario(df):
2760 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002761 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002762 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2763 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002764 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002765 time.sleep(10)
2766 switch_map = None
2767 olt_configured = False
2768 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2769 log_test.info('Installing OLT app')
2770 OnosCtrl.install_app(self.olt_app_file)
2771 time.sleep(5)
2772 log_test.info('Adding subscribers through OLT app')
2773 self.config_olt(switch_map)
2774 olt_configured = True
2775 time.sleep(5)
2776 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
2777 try:
2778 assert_equal(dhcp_status, True)
2779 #assert_equal(status, True)
2780 time.sleep(10)
2781 finally:
2782 self.voltha.disable_device(device_id, delete = True)
2783 self.remove_olt(switch_map)
2784 df.callback(0)
2785
2786 reactor.callLater(0, dhcp_flow_check_scenario, df)
2787 return df
2788
2789 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002790 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
2791 """
2792 Test Method:
2793 0. Make sure that voltha is up and running on CORD-POD setup.
2794 1. OLT and ONU is detected and validated.
2795 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2796 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
2797 4. Verify that subscriber should not get ip from dhcp server.
2798 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002799 df = defer.Deferred()
2800 def dhcp_flow_check_scenario(df):
2801 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002802 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002803 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2804 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002805 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002806 time.sleep(10)
2807 switch_map = None
2808 olt_configured = False
2809 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2810 log_test.info('Installing OLT app')
2811 OnosCtrl.install_app(self.olt_app_file)
2812 time.sleep(5)
2813 log_test.info('Adding subscribers through OLT app')
2814 self.config_olt(switch_map)
2815 olt_configured = True
2816 time.sleep(5)
2817 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
2818 try:
2819 assert_equal(dhcp_status, True)
2820 #assert_equal(status, True)
2821 time.sleep(10)
2822 finally:
2823 self.voltha.disable_device(device_id, delete = True)
2824 self.remove_olt(switch_map)
2825 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002826
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002827 reactor.callLater(0, dhcp_flow_check_scenario, df)
2828 return df
2829
2830 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002831 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
2832 """
2833 Test Method:
2834 0. Make sure that voltha is up and running on CORD-POD setup.
2835 1. OLT and ONU is detected and validated.
2836 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2837 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2838 4. Verify that subscriber get ip from dhcp server successfully.
2839 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
2840 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
2841 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002842 df = defer.Deferred()
2843 def dhcp_flow_check_scenario(df):
2844 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002845 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002846 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2847 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002848 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002849 time.sleep(10)
2850 switch_map = None
2851 olt_configured = False
2852 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2853 log_test.info('Installing OLT app')
2854 OnosCtrl.install_app(self.olt_app_file)
2855 time.sleep(5)
2856 log_test.info('Adding subscribers through OLT app')
2857 self.config_olt(switch_map)
2858 olt_configured = True
2859 time.sleep(5)
2860 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
2861 try:
2862 assert_equal(dhcp_status, True)
2863 #assert_equal(status, True)
2864 time.sleep(10)
2865 finally:
2866 self.voltha.disable_device(device_id, delete = True)
2867 self.remove_olt(switch_map)
2868 df.callback(0)
2869
2870 reactor.callLater(0, dhcp_flow_check_scenario, df)
2871 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002872
Thangavelu K S735a6662017-06-15 18:08:23 +00002873 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07002874 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002875 """
2876 Test Method:
2877 0. Make sure that voltha is up and running on CORD-POD setup.
2878 1. OLT and ONU is detected and validated.
2879 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2880 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2881 4. Verify that subscriber get ip from dhcp server successfully.
2882 5. Repeat step 3 and 4 for 10 times.
2883 6 Verify that subscriber should get ip from dhcp server.
2884 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002885 df = defer.Deferred()
2886 def dhcp_flow_check_scenario(df):
2887 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002888 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00002889 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2890 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002891 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002892 time.sleep(10)
2893 switch_map = None
2894 olt_configured = False
2895 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2896 log_test.info('Installing OLT app')
2897 OnosCtrl.install_app(self.olt_app_file)
2898 time.sleep(5)
2899 log_test.info('Adding subscribers through OLT app')
2900 self.config_olt(switch_map)
2901 olt_configured = True
2902 time.sleep(5)
2903 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
2904 try:
2905 assert_equal(dhcp_status, True)
2906 #assert_equal(status, True)
2907 time.sleep(10)
2908 finally:
2909 self.voltha.disable_device(device_id, delete = True)
2910 self.remove_olt(switch_map)
2911 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002912
Thangavelu K S735a6662017-06-15 18:08:23 +00002913 reactor.callLater(0, dhcp_flow_check_scenario, df)
2914 return df
2915
Thangavelu K S735a6662017-06-15 18:08:23 +00002916 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002917 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
2918 """
2919 Test Method:
2920 0. Make sure that voltha is up and running on CORD-POD setup.
2921 1. OLT and ONU is detected and validated.
2922 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2923 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
2924 4. Verify that subscriber should not get ip from dhcp server.
2925 5. Repeat steps 3 and 4 for 10 times.
2926 6 Verify that subscriber should not get ip from dhcp server.
2927 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002928 df = defer.Deferred()
2929 def dhcp_flow_check_scenario(df):
2930 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002931 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00002932 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2933 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002934 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002935 time.sleep(10)
2936 switch_map = None
2937 olt_configured = False
2938 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2939 log_test.info('Installing OLT app')
2940 OnosCtrl.install_app(self.olt_app_file)
2941 time.sleep(5)
2942 log_test.info('Adding subscribers through OLT app')
2943 self.config_olt(switch_map)
2944 olt_configured = True
2945 time.sleep(5)
2946 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
2947 try:
2948 assert_equal(dhcp_status, True)
2949 #assert_equal(status, True)
2950 time.sleep(10)
2951 finally:
2952 self.voltha.disable_device(device_id, delete = True)
2953 self.remove_olt(switch_map)
2954 df.callback(0)
2955
2956 reactor.callLater(0, dhcp_flow_check_scenario, df)
2957 return df
2958
Thangavelu K S735a6662017-06-15 18:08:23 +00002959 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002960 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
2961 """
2962 Test Method:
2963 0. Make sure that voltha is up and running on CORD-POD setup.
2964 1. OLT and ONU is detected and validated.
2965 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2966 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2967 4. Verify that subscriber get ip from dhcp server successfully.
2968 5. Repeat step 3 for 50 times.
2969 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2970 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002971 df = defer.Deferred()
2972 def dhcp_flow_check_scenario(df):
2973 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002974 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00002975 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2976 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002977 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002978 time.sleep(10)
2979 switch_map = None
2980 olt_configured = False
2981 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2982 log_test.info('Installing OLT app')
2983 OnosCtrl.install_app(self.olt_app_file)
2984 time.sleep(5)
2985 log_test.info('Adding subscribers through OLT app')
2986 self.config_olt(switch_map)
2987 olt_configured = True
2988 time.sleep(5)
2989 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
2990 try:
2991 assert_equal(dhcp_status, True)
2992 #assert_equal(status, True)
2993 time.sleep(10)
2994 finally:
2995 self.voltha.disable_device(device_id, delete = True)
2996 self.remove_olt(switch_map)
2997 df.callback(0)
2998
2999 reactor.callLater(0, dhcp_flow_check_scenario, df)
3000 return df
3001
Thangavelu K S735a6662017-06-15 18:08:23 +00003002 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003003 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
3004 """
3005 Test Method:
3006 0. Make sure that voltha is up and running on CORD-POD setup.
3007 1. OLT and ONU is detected and validated.
3008 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3009 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3010 4. Verify that subscriber get ip from dhcp server successfully.
3011 5. Send DHCP request to dhcp server which is running as onos app.
3012 6. Repeat step 5 for 50 times.
3013 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
3014 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003015 df = defer.Deferred()
3016 def dhcp_flow_check_scenario(df):
3017 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003018 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003019 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3020 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003021 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003022 time.sleep(10)
3023 switch_map = None
3024 olt_configured = False
3025 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3026 log_test.info('Installing OLT app')
3027 OnosCtrl.install_app(self.olt_app_file)
3028 time.sleep(5)
3029 log_test.info('Adding subscribers through OLT app')
3030 self.config_olt(switch_map)
3031 olt_configured = True
3032 time.sleep(5)
3033 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
3034 try:
3035 assert_equal(dhcp_status, True)
3036 #assert_equal(status, True)
3037 time.sleep(10)
3038 finally:
3039 self.voltha.disable_device(device_id, delete = True)
3040 self.remove_olt(switch_map)
3041 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003042
Thangavelu K S735a6662017-06-15 18:08:23 +00003043 reactor.callLater(0, dhcp_flow_check_scenario, df)
3044 return df
3045
Thangavelu K S735a6662017-06-15 18:08:23 +00003046 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003047 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
3048 """
3049 Test Method:
3050 0. Make sure that voltha is up and running on CORD-POD setup.
3051 1. OLT and ONU is detected and validated.
3052 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3053 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
3054 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
3055 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003056 df = defer.Deferred()
3057 def dhcp_flow_check_scenario(df):
3058 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003059 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003060 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3061 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003062 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003063 time.sleep(10)
3064 switch_map = None
3065 olt_configured = False
3066 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3067 log_test.info('Installing OLT app')
3068 OnosCtrl.install_app(self.olt_app_file)
3069 time.sleep(5)
3070 log_test.info('Adding subscribers through OLT app')
3071 self.config_olt(switch_map)
3072 olt_configured = True
3073 time.sleep(5)
3074 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
3075 try:
3076 assert_equal(dhcp_status, True)
3077 #assert_equal(status, True)
3078 time.sleep(10)
3079 finally:
3080 self.voltha.disable_device(device_id, delete = True)
3081 self.remove_olt(switch_map)
3082 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003083
Thangavelu K S735a6662017-06-15 18:08:23 +00003084 reactor.callLater(0, dhcp_flow_check_scenario, df)
3085 return df
3086
3087 @deferred(TESTCASE_TIMEOUT)
3088 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003089 """
3090 Test Method:
3091 0. Make sure that voltha is up and running on CORD-POD setup.
3092 1. OLT and ONU is detected and validated.
3093 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3094 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
3095 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.
3096 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003097 df = defer.Deferred()
3098 def dhcp_flow_check_scenario(df):
3099 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003100 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003101 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3102 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003103 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003104 time.sleep(10)
3105 switch_map = None
3106 olt_configured = False
3107 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3108 log_test.info('Installing OLT app')
3109 OnosCtrl.install_app(self.olt_app_file)
3110 time.sleep(5)
3111 log_test.info('Adding subscribers through OLT app')
3112 self.config_olt(switch_map)
3113 olt_configured = True
3114 time.sleep(5)
3115 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
3116 try:
3117 assert_equal(dhcp_status, True)
3118 #assert_equal(status, True)
3119 time.sleep(10)
3120 finally:
3121 self.voltha.disable_device(device_id, delete = True)
3122 self.remove_olt(switch_map)
3123 df.callback(0)
3124
3125 reactor.callLater(0, dhcp_flow_check_scenario, df)
3126 return df
3127
Thangavelu K S735a6662017-06-15 18:08:23 +00003128 @deferred(TESTCASE_TIMEOUT)
3129 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003130 """
3131 Test Method:
3132 0. Make sure that voltha is up and running on CORD-POD setup.
3133 1. OLT and ONU is detected and validated.
3134 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3135 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3136 4. Verify that subscriber get ip from dhcp server successfully.
3137 5. Deactivate dhcp server app in onos.
3138 6. Repeat step 3.
3139 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3140 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003141 df = defer.Deferred()
3142 dhcp_app = 'org.onosproject.dhcp'
3143 def dhcp_flow_check_scenario(df):
3144 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003145 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003146 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3147 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003148 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003149 time.sleep(10)
3150 switch_map = None
3151 olt_configured = False
3152 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3153 log_test.info('Installing OLT app')
3154 OnosCtrl.install_app(self.olt_app_file)
3155 time.sleep(5)
3156 log_test.info('Adding subscribers through OLT app')
3157 self.config_olt(switch_map)
3158 olt_configured = True
3159 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003160 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00003161 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
3162 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3163 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00003164 thread1.start()
3165 time.sleep(10)
3166 thread1.join()
3167 thread2.join()
3168 try:
3169 assert_equal(self.success, True)
3170 #assert_equal(status, True)
3171 time.sleep(10)
3172 finally:
3173 self.voltha.disable_device(device_id, delete = True)
3174 self.remove_olt(switch_map)
3175 df.callback(0)
3176
3177 reactor.callLater(0, dhcp_flow_check_scenario, df)
3178 return df
3179
3180 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003181 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
3182 """
3183 Test Method:
3184 0. Make sure that voltha is up and running on CORD-POD setup.
3185 1. OLT and ONU is detected and validated.
3186 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3187 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3188 4. Verify that subscriber get ip from dhcp server successfully.
3189 5. Send dhcp renew packet to dhcp server which is running as onos app.
3190 6. Repeat step 4.
3191 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003192
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003193 df = defer.Deferred()
3194 def dhcp_flow_check_scenario(df):
3195 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003196 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003197 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3198 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003199 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003200 time.sleep(10)
3201 switch_map = None
3202 olt_configured = False
3203 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3204 log_test.info('Installing OLT app')
3205 OnosCtrl.install_app(self.olt_app_file)
3206 time.sleep(5)
3207 log_test.info('Adding subscribers through OLT app')
3208 self.config_olt(switch_map)
3209 olt_configured = True
3210 time.sleep(5)
3211 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
3212 try:
3213 assert_equal(dhcp_status, True)
3214 #assert_equal(status, True)
3215 time.sleep(10)
3216 finally:
3217 self.voltha.disable_device(device_id, delete = True)
3218 self.remove_olt(switch_map)
3219 df.callback(0)
3220
3221 reactor.callLater(0, dhcp_flow_check_scenario, df)
3222 return df
3223
3224 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003225 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
3226 """
3227 Test Method:
3228 0. Make sure that voltha is up and running on CORD-POD setup.
3229 1. OLT and ONU is detected and validated.
3230 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3231 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3232 4. Verify that subscriber get ip from dhcp server successfully.
3233 5. Send dhcp rebind packet to dhcp server which is running as onos app.
3234 6. Repeat step 4.
3235 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003236 df = defer.Deferred()
3237 def dhcp_flow_check_scenario(df):
3238 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003239 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003240 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3241 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003242 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003243 time.sleep(10)
3244 switch_map = None
3245 olt_configured = False
3246 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3247 log_test.info('Installing OLT app')
3248 OnosCtrl.install_app(self.olt_app_file)
3249 time.sleep(5)
3250 log_test.info('Adding subscribers through OLT app')
3251 self.config_olt(switch_map)
3252 olt_configured = True
3253 time.sleep(5)
3254 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
3255 try:
3256 assert_equal(dhcp_status, True)
3257 #assert_equal(status, True)
3258 time.sleep(10)
3259 finally:
3260 self.voltha.disable_device(device_id, delete = True)
3261 self.remove_olt(switch_map)
3262 df.callback(0)
3263
3264 reactor.callLater(0, dhcp_flow_check_scenario, df)
3265 return df
3266
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003267 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003268 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003269 """
3270 Test Method:
3271 0. Make sure that voltha is up and running on CORD-POD setup.
3272 1. OLT and ONU is detected and validated.
3273 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3274 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3275 4. Verify that subscriber get ip from dhcp server successfully.
3276 5. Disable olt devices which is being detected in voltha CLI.
3277 6. Repeat step 3.
3278 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3279 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003280 df = defer.Deferred()
3281 dhcp_app = 'org.onosproject.dhcp'
3282 def dhcp_flow_check_scenario(df):
3283 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003284 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003285 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3286 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003287 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003288 time.sleep(10)
3289 switch_map = None
3290 olt_configured = False
3291 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3292 log_test.info('Installing OLT app')
3293 OnosCtrl.install_app(self.olt_app_file)
3294 time.sleep(5)
3295 log_test.info('Adding subscribers through OLT app')
3296 self.config_olt(switch_map)
3297 olt_configured = True
3298 time.sleep(5)
3299 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3300 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3301 log_test.info('Disable the olt device in during client send discover to voltha')
3302 thread2.start()
3303# time.sleep(randint(0,1))
3304 thread1.start()
3305 time.sleep(10)
3306 thread1.join()
3307 thread2.join()
3308 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003309 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003310 #assert_equal(status, True)
3311 time.sleep(10)
3312 finally:
3313 self.voltha.disable_device(device_id, delete = True)
3314 self.remove_olt(switch_map)
3315 df.callback(0)
3316
3317 reactor.callLater(0, dhcp_flow_check_scenario, df)
3318 return df
3319
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003320 @deferred(TESTCASE_TIMEOUT)
3321 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
3322 """
3323 Test Method:
3324 0. Make sure that voltha is up and running on CORD-POD setup.
3325 1. OLT and ONU is detected and validated.
3326 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3327 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3328 4. Verify that subscriber get ip from dhcp server successfully.
3329 5. Disable olt devices which is being detected in voltha CLI.
3330 6. Repeat step 3.
3331 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3332 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
3333 """
3334 df = defer.Deferred()
3335 no_iterations = 10
3336 dhcp_app = 'org.onosproject.dhcp'
3337 def dhcp_flow_check_scenario(df):
3338 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003339 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003340 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3341 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003342 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003343 time.sleep(10)
3344 switch_map = None
3345 olt_configured = False
3346 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3347 log_test.info('Installing OLT app')
3348 OnosCtrl.install_app(self.olt_app_file)
3349 time.sleep(5)
3350 log_test.info('Adding subscribers through OLT app')
3351 self.config_olt(switch_map)
3352 olt_configured = True
3353 time.sleep(5)
3354 for i in range(no_iterations):
3355 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3356 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3357 log_test.info('Disable the olt device in during client send discover to voltha')
3358 thread2.start()
3359# time.sleep(randint(0,1))
3360 thread1.start()
3361 time.sleep(10)
3362 thread1.join()
3363 thread2.join()
3364 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3365 try:
3366 assert_equal(self.success, True)
3367 assert_equal(dhcp_status, True)
3368 #assert_equal(status, True)
3369 time.sleep(10)
3370 finally:
3371 self.voltha.disable_device(device_id, delete = True)
3372 self.remove_olt(switch_map)
3373 df.callback(0)
3374
3375 reactor.callLater(0, dhcp_flow_check_scenario, df)
3376 return df
3377
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003378 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003379 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003380 """
3381 Test Method:
3382 0. Make sure that voltha is up and running on CORD-POD setup.
3383 1. OLT and ONU is detected and validated.
3384 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3385 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3386 4. Verify that subscriber get ip from dhcp server successfully.
3387 5. Disable olt devices which is being detected in voltha CLI.
3388 6. Repeat step 3.
3389 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3390 8. Enable olt devices which is being detected in voltha CLI.
3391 9. Repeat steps 3 and 4.
3392 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003393 df = defer.Deferred()
3394 dhcp_app = 'org.onosproject.dhcp'
3395 def dhcp_flow_check_scenario(df):
3396 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003397 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003398 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3399 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003400 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003401 time.sleep(10)
3402 switch_map = None
3403 olt_configured = False
3404 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3405 log_test.info('Installing OLT app')
3406 OnosCtrl.install_app(self.olt_app_file)
3407 time.sleep(5)
3408 log_test.info('Adding subscribers through OLT app')
3409 self.config_olt(switch_map)
3410 olt_configured = True
3411 time.sleep(5)
3412 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3413 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3414 thread2.start()
3415 thread1.start()
3416 time.sleep(10)
3417 thread1.join()
3418 thread2.join()
3419 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003420 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003421 #assert_equal(status, True)
3422 time.sleep(10)
3423 finally:
3424 self.voltha.disable_device(device_id, delete = True)
3425 self.remove_olt(switch_map)
3426 df.callback(0)
3427
3428 reactor.callLater(0, dhcp_flow_check_scenario, df)
3429 return df
3430
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003431 @deferred(TESTCASE_TIMEOUT)
3432 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
3433 """
3434 Test Method:
3435 0. Make sure that voltha is up and running on CORD-POD setup.
3436 1. OLT and ONU is detected and validated.
3437 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3438 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3439 4. Verify that subscriber get ip from dhcp server successfully.
3440 5. Disable olt devices which is being detected in voltha CLI.
3441 6. Repeat step 3.
3442 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3443 8. Enable olt devices which is being detected in voltha CLI.
3444 9. Repeat steps 3 and 4.
3445 """
3446
3447 df = defer.Deferred()
3448 no_iterations = 10
3449 dhcp_app = 'org.onosproject.dhcp'
3450 def dhcp_flow_check_scenario(df):
3451 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003452 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003453 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3454 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003455 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003456 time.sleep(10)
3457 switch_map = None
3458 olt_configured = False
3459 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3460 log_test.info('Installing OLT app')
3461 OnosCtrl.install_app(self.olt_app_file)
3462 time.sleep(5)
3463 log_test.info('Adding subscribers through OLT app')
3464 self.config_olt(switch_map)
3465 olt_configured = True
3466 time.sleep(5)
3467 for i in range(no_iterations):
3468 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3469 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3470 thread2.start()
3471 thread1.start()
3472 time.sleep(10)
3473 thread1.join()
3474 thread2.join()
3475 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3476 try:
3477 assert_equal(dhcp_status, True)
3478 #assert_equal(status, True)
3479 assert_equal(self.success, True)
3480 time.sleep(10)
3481 finally:
3482 self.voltha.disable_device(device_id, delete = True)
3483 self.remove_olt(switch_map)
3484 df.callback(0)
3485
3486 reactor.callLater(0, dhcp_flow_check_scenario, df)
3487 return df
3488
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003489 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003490 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003491 """
3492 Test Method:
3493 0. Make sure that voltha is up and running on CORD-POD setup.
3494 1. OLT and ONU is detected and validated.
3495 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3496 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3497 4. Verify that subscriber get ip from dhcp server successfully.
3498 5. Disable onu port which is being detected in voltha CLI.
3499 6. Repeat step 3.
3500 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3501 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003502 df = defer.Deferred()
3503 dhcp_app = 'org.onosproject.dhcp'
3504 def dhcp_flow_check_scenario(df):
3505 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003506 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003507 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3508 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003509 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003510 time.sleep(10)
3511 switch_map = None
3512 olt_configured = False
3513 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3514 log_test.info('Installing OLT app')
3515 OnosCtrl.install_app(self.olt_app_file)
3516 time.sleep(5)
3517 log_test.info('Adding subscribers through OLT app')
3518 self.config_olt(switch_map)
3519 olt_configured = True
3520 time.sleep(5)
3521 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 +00003522 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003523 thread1.start()
3524 thread2.start()
3525 time.sleep(10)
3526 thread1.join()
3527 thread2.join()
3528 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003529 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003530 #assert_equal(status, True)
3531 time.sleep(10)
3532 finally:
3533 self.voltha.disable_device(device_id, delete = True)
3534 self.remove_olt(switch_map)
3535 df.callback(0)
3536
3537 reactor.callLater(0, dhcp_flow_check_scenario, df)
3538 return df
3539
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003540 @deferred(TESTCASE_TIMEOUT)
3541 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
3542 """
3543 Test Method:
3544 0. Make sure that voltha is up and running on CORD-POD setup.
3545 1. OLT and ONU is detected and validated.
3546 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3547 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3548 4. Verify that subscriber get ip from dhcp server successfully.
3549 5. Disable onu port which is being detected in voltha CLI.
3550 6. Repeat step 3.
3551 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3552 """
3553 df = defer.Deferred()
3554 no_iterations = 10
3555 dhcp_app = 'org.onosproject.dhcp'
3556 def dhcp_flow_check_scenario(df):
3557 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003558 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003559 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3560 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003561 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003562 time.sleep(10)
3563 switch_map = None
3564 olt_configured = False
3565 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3566 log_test.info('Installing OLT app')
3567 OnosCtrl.install_app(self.olt_app_file)
3568 time.sleep(5)
3569 log_test.info('Adding subscribers through OLT app')
3570 self.config_olt(switch_map)
3571 olt_configured = True
3572 time.sleep(5)
3573 for i in range(no_iterations):
3574 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 +00003575 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003576 thread1.start()
3577 thread2.start()
3578 time.sleep(10)
3579 thread1.join()
3580 thread2.join()
3581 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3582 try:
3583 #assert_equal(status, True)
3584 assert_equal(dhcp_status, True)
3585 assert_equal(self.success, True)
3586 time.sleep(10)
3587 finally:
3588 self.voltha.disable_device(device_id, delete = True)
3589 self.remove_olt(switch_map)
3590 df.callback(0)
3591
3592 reactor.callLater(0, dhcp_flow_check_scenario, df)
3593 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003594
3595 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003596 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003597 """
3598 Test Method:
3599 0. Make sure that voltha is up and running on CORD-POD setup.
3600 1. OLT and ONU is detected and validated.
3601 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3602 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3603 4. Verify that subscriber get ip from dhcp server successfully.
3604 5. Disable onu port which is being detected in voltha CLI.
3605 6. Repeat step 3.
3606 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3607 8. Enable onu port which is being detected in voltha CLI.
3608 9. Repeat steps 3 and 4.
3609 """
3610
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003611 df = defer.Deferred()
3612 dhcp_app = 'org.onosproject.dhcp'
3613 def dhcp_flow_check_scenario(df):
3614 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003615 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003616 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3617 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003618 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003619 time.sleep(10)
3620 switch_map = None
3621 olt_configured = False
3622 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3623 log_test.info('Installing OLT app')
3624 OnosCtrl.install_app(self.olt_app_file)
3625 time.sleep(5)
3626 log_test.info('Adding subscribers through OLT app')
3627 self.config_olt(switch_map)
3628 olt_configured = True
3629 time.sleep(5)
3630 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 +00003631 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003632 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3633 thread2.start()
3634 time.sleep(randint(0,1))
3635 thread1.start()
3636 time.sleep(10)
3637 thread1.join()
3638 thread2.join()
3639 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3640 assert_equal(dhcp_status, True)
3641 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003642 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003643 #assert_equal(status, True)
3644 time.sleep(10)
3645 finally:
3646 self.voltha.disable_device(device_id, delete = True)
3647 self.remove_olt(switch_map)
3648 df.callback(0)
3649
3650 reactor.callLater(0, dhcp_flow_check_scenario, df)
3651 return df
3652
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003653 @deferred(TESTCASE_TIMEOUT)
3654 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
3655 """
3656 Test Method:
3657 0. Make sure that voltha is up and running on CORD-POD setup.
3658 1. OLT and ONU is detected and validated.
3659 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3660 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3661 4. Verify that subscriber get ip from dhcp server successfully.
3662 5. Disable onu port which is being detected in voltha CLI.
3663 6. Repeat step 3.
3664 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3665 8. Enable onu port which is being detected in voltha CLI.
3666 9. Repeat steps 3 and 4.
3667 """
3668
3669 df = defer.Deferred()
3670 no_iterations = 10
3671 dhcp_app = 'org.onosproject.dhcp'
3672 def dhcp_flow_check_scenario(df):
3673 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003674 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003675 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3676 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003677 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003678 time.sleep(10)
3679 switch_map = None
3680 olt_configured = False
3681 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3682 log_test.info('Installing OLT app')
3683 OnosCtrl.install_app(self.olt_app_file)
3684 time.sleep(5)
3685 log_test.info('Adding subscribers through OLT app')
3686 self.config_olt(switch_map)
3687 olt_configured = True
3688 time.sleep(5)
3689 for i in range(no_iterations):
3690 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 +00003691 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003692 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3693 thread2.start()
3694 time.sleep(randint(0,1))
3695 thread1.start()
3696 time.sleep(10)
3697 thread1.join()
3698 thread2.join()
3699 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3700 assert_equal(dhcp_status, True)
3701 try:
3702 assert_equal(self.success, True)
3703 #assert_equal(status, True)
3704 time.sleep(10)
3705 finally:
3706 self.voltha.disable_device(device_id, delete = True)
3707 self.remove_olt(switch_map)
3708 df.callback(0)
3709
3710 reactor.callLater(0, dhcp_flow_check_scenario, df)
3711 return df
3712
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003713 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003714 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003715 """
3716 Test Method:
3717 0. Make sure that voltha is up and running on CORD-POD setup.
3718 1. OLT and ONU is detected and validated.
3719 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3720 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3721 4. Verify that subscribers had got different ips from dhcp server successfully.
3722 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003723 df = defer.Deferred()
3724 self.success = True
3725 dhcp_app = 'org.onosproject.dhcp'
3726 def dhcp_flow_check_scenario(df):
3727 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003728 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003729 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3730 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003731 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003732 time.sleep(10)
3733 switch_map = None
3734 olt_configured = False
3735 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3736 log_test.info('Installing OLT app')
3737 OnosCtrl.install_app(self.olt_app_file)
3738 time.sleep(5)
3739 log_test.info('Adding subscribers through OLT app')
3740 self.config_olt(switch_map)
3741 olt_configured = True
3742 time.sleep(5)
3743 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3744 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3745 thread1.start()
3746 thread2.start()
3747 time.sleep(10)
3748 thread1.join()
3749 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003750 dhcp_flow_status = self.success
3751 try:
3752# if self.success is not True:
3753 assert_equal(dhcp_flow_status, True)
3754 #assert_equal(status, True)
3755 time.sleep(10)
3756 finally:
3757 self.voltha.disable_device(device_id, delete = True)
3758 self.remove_olt(switch_map)
3759 df.callback(0)
3760
3761 reactor.callLater(0, dhcp_flow_check_scenario, df)
3762 return df
3763
3764 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003765 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003766 """
3767 Test Method:
3768 0. Make sure that voltha is up and running on CORD-POD setup.
3769 1. OLT and ONU is detected and validated.
3770 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3771 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3772 4. Verify that subscribers had got ip from dhcp server successfully.
3773 5. Repeat step 3 and 4 for 10 times for both subscribers.
3774 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
3775 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003776 df = defer.Deferred()
3777 self.success = True
3778 dhcp_app = 'org.onosproject.dhcp'
3779 def dhcp_flow_check_scenario(df):
3780 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003781 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003782 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3783 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003784 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003785 time.sleep(10)
3786 switch_map = None
3787 olt_configured = False
3788 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3789 log_test.info('Installing OLT app')
3790 OnosCtrl.install_app(self.olt_app_file)
3791 time.sleep(5)
3792 log_test.info('Adding subscribers through OLT app')
3793 self.config_olt(switch_map)
3794 olt_configured = True
3795 time.sleep(5)
3796 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3797 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
3798 thread1.start()
3799 thread2.start()
3800 time.sleep(10)
3801 thread1.join()
3802 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003803 dhcp_flow_status = self.success
3804 try:
3805# if self.success is not True:
3806 assert_equal(dhcp_flow_status, True)
3807 #assert_equal(status, True)
3808 time.sleep(10)
3809 finally:
3810 self.voltha.disable_device(device_id, delete = True)
3811 self.remove_olt(switch_map)
3812 df.callback(0)
3813
3814 reactor.callLater(0, dhcp_flow_check_scenario, df)
3815 return df
3816
3817 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003818 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003819 """
3820 Test Method:
3821 0. Make sure that voltha is up and running on CORD-POD setup.
3822 1. OLT and ONU is detected and validated.
3823 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3824 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3825 4. Verify that subscribers had got ip from dhcp server successfully.
3826 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3827 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
3828 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003829 df = defer.Deferred()
3830 self.success = True
3831 dhcp_app = 'org.onosproject.dhcp'
3832 def dhcp_flow_check_scenario(df):
3833 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003834 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003835 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3836 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003837 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003838 time.sleep(10)
3839 switch_map = None
3840 olt_configured = False
3841 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3842 log_test.info('Installing OLT app')
3843 OnosCtrl.install_app(self.olt_app_file)
3844 time.sleep(5)
3845 log_test.info('Adding subscribers through OLT app')
3846 self.config_olt(switch_map)
3847 olt_configured = True
3848 time.sleep(5)
3849 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3850 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3851 thread1.start()
3852 thread2.start()
3853 time.sleep(10)
3854 thread1.join()
3855 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003856 dhcp_flow_status = self.success
3857 try:
3858# if self.success is not True:
3859 assert_equal(dhcp_flow_status, True)
3860 #assert_equal(status, True)
3861 time.sleep(10)
3862 finally:
3863 self.voltha.disable_device(device_id, delete = True)
3864 self.remove_olt(switch_map)
3865 df.callback(0)
3866
3867 reactor.callLater(0, dhcp_flow_check_scenario, df)
3868 return df
3869
3870 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003871 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 +00003872 """
3873 Test Method:
3874 0. Make sure that voltha is up and running on CORD-POD setup.
3875 1. OLT and ONU is detected and validated.
3876 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3877 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
3878 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
3879 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
3880 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003881
3882 df = defer.Deferred()
3883 self.success = True
3884 dhcp_app = 'org.onosproject.dhcp'
3885 def dhcp_flow_check_scenario(df):
3886 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003887 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003888 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3889 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003890 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003891 time.sleep(10)
3892 switch_map = None
3893 olt_configured = False
3894 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3895 log_test.info('Installing OLT app')
3896 OnosCtrl.install_app(self.olt_app_file)
3897 time.sleep(5)
3898 log_test.info('Adding subscribers through OLT app')
3899 self.config_olt(switch_map)
3900 olt_configured = True
3901 time.sleep(5)
3902 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3903 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
3904 thread1.start()
3905 thread2.start()
3906 time.sleep(10)
3907 thread1.join()
3908 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003909 dhcp_flow_status = self.success
3910 try:
3911# if self.success is not True:
3912 assert_equal(dhcp_flow_status, True)
3913 #assert_equal(status, True)
3914 time.sleep(10)
3915 finally:
3916 self.voltha.disable_device(device_id, delete = True)
3917 self.remove_olt(switch_map)
3918 df.callback(0)
3919
3920 reactor.callLater(0, dhcp_flow_check_scenario, df)
3921 return df
3922
3923 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003924 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 +00003925 """
3926 Test Method:
3927 0. Make sure that voltha is up and running on CORD-POD setup.
3928 1. OLT and ONU is detected and validated.
3929 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3930 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
3931 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
3932 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
3933 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003934 df = defer.Deferred()
3935 self.success = True
3936 dhcp_app = 'org.onosproject.dhcp'
3937 def dhcp_flow_check_scenario(df):
3938 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003939 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003940 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3941 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003942 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003943 time.sleep(10)
3944 switch_map = None
3945 olt_configured = False
3946 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3947 log_test.info('Installing OLT app')
3948 OnosCtrl.install_app(self.olt_app_file)
3949 time.sleep(5)
3950 log_test.info('Adding subscribers through OLT app')
3951 self.config_olt(switch_map)
3952 olt_configured = True
3953 time.sleep(5)
3954 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3955 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3956 thread1.start()
3957 thread2.start()
3958 time.sleep(10)
3959 thread1.join()
3960 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003961 dhcp_flow_status = self.success
3962 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003963 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003964 time.sleep(10)
3965 finally:
3966 self.voltha.disable_device(device_id, delete = True)
3967 self.remove_olt(switch_map)
3968 df.callback(0)
3969
3970 reactor.callLater(0, dhcp_flow_check_scenario, df)
3971 return df
3972
3973 @deferred(TESTCASE_TIMEOUT)
3974 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003975 """
3976 Test Method:
3977 0. Make sure that voltha is up and running on CORD-POD setup.
3978 1. OLT and ONU is detected and validated.
3979 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3980 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3981 4. Verify that subscribers had got ip from dhcp server successfully.
3982 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3983 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3984 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3985 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003986 df = defer.Deferred()
3987 self.success = True
3988 dhcp_app = 'org.onosproject.dhcp'
3989 def dhcp_flow_check_scenario(df):
3990 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003991 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003992 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3993 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003994 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003995 time.sleep(10)
3996 switch_map = None
3997 olt_configured = False
3998 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3999 log_test.info('Installing OLT app')
4000 OnosCtrl.install_app(self.olt_app_file)
4001 time.sleep(5)
4002 log_test.info('Adding subscribers through OLT app')
4003 self.config_olt(switch_map)
4004 olt_configured = True
4005 time.sleep(5)
4006 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
4007 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
4008 thread1.start()
4009 thread2.start()
4010 time.sleep(10)
4011 thread1.join()
4012 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004013 dhcp_flow_status = self.success
4014 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004015 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004016 time.sleep(10)
4017 finally:
4018 self.voltha.disable_device(device_id, delete = True)
4019 self.remove_olt(switch_map)
4020 df.callback(0)
4021
4022 reactor.callLater(0, dhcp_flow_check_scenario, df)
4023 return df
4024
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004025 @deferred(TESTCASE_TIMEOUT)
4026 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004027 """
4028 Test Method:
4029 0. Make sure that voltha is up and running on CORD-POD setup.
4030 1. OLT and ONU is detected and validated.
4031 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4032 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4033 4. Verify that subscribers had got ip from dhcp server successfully.
4034 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4035 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4036 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
4037 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
4038 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
4039 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
4040 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004041 df = defer.Deferred()
4042 self.success = True
4043 dhcp_app = 'org.onosproject.dhcp'
4044 def dhcp_flow_check_scenario(df):
4045 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004046 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004047 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4048 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004049 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004050 time.sleep(10)
4051 switch_map = None
4052 olt_configured = False
4053 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4054 log_test.info('Installing OLT app')
4055 OnosCtrl.install_app(self.olt_app_file)
4056 time.sleep(5)
4057 log_test.info('Adding subscribers through OLT app')
4058 self.config_olt(switch_map)
4059 olt_configured = True
4060 time.sleep(5)
4061 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4062 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 +00004063 thread3 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.INTF_2_RX_DEFAULT,))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004064 thread1.start()
4065 thread2.start()
4066 thread3.start()
4067 time.sleep(10)
4068 thread1.join()
4069 thread2.join()
4070 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004071 dhcp_flow_status = self.success
4072 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004073 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004074 time.sleep(10)
4075 finally:
4076 self.voltha.disable_device(device_id, delete = True)
4077 self.remove_olt(switch_map)
4078 df.callback(0)
4079
4080 reactor.callLater(0, dhcp_flow_check_scenario, df)
4081 return df
4082
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004083 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004084 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004085 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004086 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00004087 0. Make sure that voltha is up and running on CORD-POD setup.
4088 1. OLT and ONU is detected and validated.
4089 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4090 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4091 4. Verify that subscribers had got ip from dhcp server successfully.
4092 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4093 6. Disable the olt device which is detected in voltha.
4094 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4095 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004096 df = defer.Deferred()
4097 self.success = True
4098 dhcp_app = 'org.onosproject.dhcp'
4099 def dhcp_flow_check_scenario(df):
4100 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004101 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004102 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4103 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004104 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004105 time.sleep(10)
4106 switch_map = None
4107 olt_configured = False
4108 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4109 log_test.info('Installing OLT app')
4110 OnosCtrl.install_app(self.olt_app_file)
4111 time.sleep(5)
4112 log_test.info('Adding subscribers through OLT app')
4113 self.config_olt(switch_map)
4114 olt_configured = True
4115 time.sleep(5)
4116 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4117 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4118 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
4119
4120 thread1.start()
4121 thread2.start()
4122 thread3.start()
4123 time.sleep(10)
4124 thread1.join()
4125 thread2.join()
4126 thread3.join()
4127 dhcp_flow_status = self.success
4128 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004129 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004130 time.sleep(10)
4131 finally:
4132 self.voltha.disable_device(device_id, delete = True)
4133 self.remove_olt(switch_map)
4134 df.callback(0)
4135
4136 reactor.callLater(0, dhcp_flow_check_scenario, df)
4137 return df
4138
4139 @deferred(TESTCASE_TIMEOUT)
4140 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004141 """
4142 Test Method:
4143 0. Make sure that voltha is up and running on CORD-POD setup.
4144 1. OLT and ONU is detected and validated.
4145 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4146 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4147 4. Verify that subscribers had got ip from dhcp server successfully.
4148 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4149 6. Disable the olt device which is detected in voltha.
4150 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4151 8. Enable the olt device which is detected in voltha.
4152 9. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
4153 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004154 df = defer.Deferred()
4155 self.success = True
4156 dhcp_app = 'org.onosproject.dhcp'
4157 def dhcp_flow_check_scenario(df):
4158 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004159 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004160 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4161 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004162 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004163 time.sleep(10)
4164 switch_map = None
4165 olt_configured = False
4166 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4167 log_test.info('Installing OLT app')
4168 OnosCtrl.install_app(self.olt_app_file)
4169 time.sleep(5)
4170 log_test.info('Adding subscribers through OLT app')
4171 self.config_olt(switch_map)
4172 olt_configured = True
4173 time.sleep(5)
4174 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4175 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4176 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
4177 thread1.start()
4178 thread2.start()
4179 thread3.start()
4180 time.sleep(10)
4181 thread1.join()
4182 thread2.join()
4183 thread3.join()
4184 dhcp_flow_status = self.success
4185 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004186 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004187 time.sleep(10)
4188 finally:
4189 self.voltha.disable_device(device_id, delete = True)
4190 self.remove_olt(switch_map)
4191 df.callback(0)
4192
4193 reactor.callLater(0, dhcp_flow_check_scenario, df)
4194 return df
4195
4196 @deferred(TESTCASE_TIMEOUT)
4197 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004198 """
4199 Test Method:
4200 0. Make sure that voltha is up and running on CORD-POD setup.
4201 1. OLT and ONU is detected and validated.
4202 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4203 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4204 4. Verify that subscribers had got ip from dhcp server successfully.
4205 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4206 6. Pause the olt device which is detected in voltha.
4207 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4208 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004209 df = defer.Deferred()
4210 self.success = True
4211 dhcp_app = 'org.onosproject.dhcp'
4212 def dhcp_flow_check_scenario(df):
4213 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004214 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004215 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4216 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004217 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004218 time.sleep(10)
4219 switch_map = None
4220 olt_configured = False
4221 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4222 log_test.info('Installing OLT app')
4223 OnosCtrl.install_app(self.olt_app_file)
4224 time.sleep(5)
4225 log_test.info('Adding subscribers through OLT app')
4226 self.config_olt(switch_map)
4227 olt_configured = True
4228 time.sleep(5)
4229 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4230 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4231 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
4232 thread1.start()
4233 thread2.start()
4234 thread3.start()
4235 time.sleep(10)
4236 thread1.join()
4237 thread2.join()
4238 thread3.join()
4239 dhcp_flow_status = self.success
4240 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004241 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004242 time.sleep(10)
4243 finally:
4244 self.voltha.disable_device(device_id, delete = True)
4245 self.remove_olt(switch_map)
4246 df.callback(0)
4247
4248 reactor.callLater(0, dhcp_flow_check_scenario, df)
4249 return df
4250
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004251 def test_three_subscribers_with_voltha_for_dhcp_discover_requests(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004252 """
4253 Test Method:
4254 0. Make sure that voltha is up and running on CORD-POD setup.
4255 1. OLT and ONU is detected and validated.
4256 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4257 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4258 4. Verify that subscriber get ip from dhcp server successfully.
4259 """
4260 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4261 num_subscribers = 3
4262 num_channels = 1
4263 services = ('DHCP')
4264 cbs = (self.dhcp_flow_check, None, None)
4265 self.voltha_subscribers(services, cbs = cbs,
4266 num_subscribers = num_subscribers,
4267 num_channels = num_channels)
4268
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004269 def test_five_subscribers_with_voltha_for_dhcp_discover_requests(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004270 """
4271 Test Method:
4272 0. Make sure that voltha is up and running on CORD-POD setup.
4273 1. OLT and ONU is detected and validated.
4274 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4275 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4276 4. Verify that subscriber get ip from dhcp server successfully.
4277 """
4278 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4279 num_subscribers = 5
4280 num_channels = 1
4281 services = ('DHCP')
4282 cbs = (self.dhcp_flow_check, None, None)
4283 self.voltha_subscribers(services, cbs = cbs,
4284 num_subscribers = num_subscribers,
4285 num_channels = num_channels)
4286
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004287 def test_nine_subscribers_with_voltha_for_dhcp_discover_requests(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004288 """
4289 Test Method:
4290 0. Make sure that voltha is up and running on CORD-POD setup.
4291 1. OLT and ONU is detected and validated.
4292 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4293 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4294 4. Verify that subscriber get ip from dhcp server successfully.
4295 """
4296 """Test subscriber join next for channel surfing with 9 subscribers browsing 1 channels each"""
4297 num_subscribers = 9
4298 num_channels = 1
4299 services = ('DHCP')
4300 cbs = (self.dhcp_flow_check, None, None)
4301 self.voltha_subscribers(services, cbs = cbs,
4302 num_subscribers = num_subscribers,
4303 num_channels = num_channels)
4304
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004305 def test_three_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004306 """
4307 Test Method:
4308 0. Make sure that voltha is up and running on CORD-POD setup.
4309 1. OLT and ONU is detected and validated.
4310 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4311 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4312 4. Verify that subscriber get ip from dhcp server successfully.
4313 """
4314 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4315 num_subscribers = 3
4316 num_channels = 1
4317 services = ('TLS','DHCP')
4318 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4319 self.voltha_subscribers(services, cbs = cbs,
4320 num_subscribers = num_subscribers,
4321 num_channels = num_channels)
4322
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004323 def test_five_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004324 """
4325 Test Method:
4326 0. Make sure that voltha is up and running on CORD-POD setup.
4327 1. OLT and ONU is detected and validated.
4328 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4329 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4330 4. Verify that subscriber get ip from dhcp server successfully.
4331 """
4332 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4333 num_subscribers = 5
4334 num_channels = 1
4335 services = ('TLS','DHCP')
4336 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4337 self.voltha_subscribers(services, cbs = cbs,
4338 num_subscribers = num_subscribers,
4339 num_channels = num_channels)
4340
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004341 def test_nine_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004342 """
4343 Test Method:
4344 0. Make sure that voltha is up and running on CORD-POD setup.
4345 1. OLT and ONU is detected and validated.
4346 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4347 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4348 4. Verify that subscriber get ip from dhcp server successfully.
4349 """
4350 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4351 num_subscribers = 9
4352 num_channels = 1
4353 services = ('TLS','DHCP')
4354 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4355 self.voltha_subscribers(services, cbs = cbs,
4356 num_subscribers = num_subscribers,
4357 num_channels = num_channels)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004358
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004359# @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004360 def test_subscriber_with_voltha_for_dhcprelay_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004361 """
4362 Test Method:
4363 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4364 1. OLT and ONU is detected and validated.
4365 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4366 3. Send dhcp request from residential subscrber to external dhcp server.
4367 4. Verify that subscriber get ip from external dhcp server successfully.
4368 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004369 self.voltha_dhcprelay_setUpClass()
Thangavelu K S6432b522017-07-22 00:05:54 +00004370# if not port_list:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004371# port_list = self.generate_port_list(1, 0)
4372 iface = self.port_map[self.port_list[0][1]]
Thangavelu K S6432b522017-07-22 00:05:54 +00004373 mac = self.get_mac(iface)
4374 self.host_load(iface)
4375 ##we use the defaults for this test that serves as an example for others
4376 ##You don't need to restart dhcpd server if retaining default config
4377 config = self.default_config
4378 options = self.default_options
4379 subnet = self.default_subnet_config
4380 dhcpd_interface_list = self.relay_interfaces
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004381 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004382 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004383 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4384 assert_not_equal(device_id, None)
4385 voltha = VolthaCtrl(**self.voltha_attrs)
4386 time.sleep(10)
4387 switch_map = None
4388 olt_configured = False
4389 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4390 log_test.info('Installing OLT app')
4391 OnosCtrl.install_app(self.olt_app_file)
4392 time.sleep(5)
4393 log_test.info('Adding subscribers through OLT app')
4394 self.config_olt(switch_map)
4395 olt_configured = True
4396 time.sleep(5)
Thangavelu K S6432b522017-07-22 00:05:54 +00004397 self.dhcpd_start(intf_list = dhcpd_interface_list,
4398 config = config,
4399 options = options,
4400 subnet = subnet)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004401 try:
4402 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4403 self.send_recv(mac=mac)
4404 finally:
4405 self.voltha.disable_device(device_id, delete = True)
4406 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004407
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004408 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004409 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004410 """
4411 Test Method:
4412 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4413 1. OLT and ONU is detected and validated.
4414 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4415 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
4416 4. Verify that subscriber should not get ip from external dhcp server.
4417 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004418 self.voltha_dhcprelay_setUpClass()
4419# if not port_list:
4420# port_list = self.generate_port_list(1, 0)
4421 iface = self.port_map[self.port_list[0][1]]
4422 mac = self.get_mac(iface)
4423 self.host_load(iface)
4424 ##we use the defaults for this test that serves as an example for others
4425 ##You don't need to restart dhcpd server if retaining default config
4426 config = self.default_config
4427 options = self.default_options
4428 subnet = self.default_subnet_config
4429 dhcpd_interface_list = self.relay_interfaces
4430 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004431 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004432 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4433 assert_not_equal(device_id, None)
4434 voltha = VolthaCtrl(**self.voltha_attrs)
4435 time.sleep(10)
4436 switch_map = None
4437 olt_configured = False
4438 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4439 log_test.info('Installing OLT app')
4440 OnosCtrl.install_app(self.olt_app_file)
4441 time.sleep(5)
4442 log_test.info('Adding subscribers through OLT app')
4443 self.config_olt(switch_map)
4444 olt_configured = True
4445 time.sleep(5)
4446 self.dhcpd_start(intf_list = dhcpd_interface_list,
4447 config = config,
4448 options = options,
4449 subnet = subnet)
4450 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4451 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
4452 try:
4453 assert_equal(cip,None)
4454 log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
4455 finally:
4456 self.voltha.disable_device(device_id, delete = True)
4457 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004458
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004459# @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004460 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004461 """
4462 Test Method:
4463 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4464 1. OLT and ONU is detected and validated.
4465 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4466 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
4467 4. Verify that subscriber should not get ip from external dhcp server.
4468 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004469 self.voltha_dhcprelay_setUpClass()
4470# if not port_list:
4471# port_list = self.generate_port_list(1, 0)
4472 iface = self.port_map[self.port_list[0][1]]
4473 mac = self.get_mac(iface)
4474 self.host_load(iface)
4475 ##we use the defaults for this test that serves as an example for others
4476 ##You don't need to restart dhcpd server if retaining default config
4477 config = self.default_config
4478 options = self.default_options
4479 subnet = self.default_subnet_config
4480 dhcpd_interface_list = self.relay_interfaces
4481 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004482 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004483 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4484 assert_not_equal(device_id, None)
4485 voltha = VolthaCtrl(**self.voltha_attrs)
4486 time.sleep(10)
4487 switch_map = None
4488 olt_configured = False
4489 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4490 log_test.info('Installing OLT app')
4491 OnosCtrl.install_app(self.olt_app_file)
4492 time.sleep(5)
4493 log_test.info('Adding subscribers through OLT app')
4494 self.config_olt(switch_map)
4495 olt_configured = True
4496 time.sleep(5)
4497 self.dhcpd_start(intf_list = dhcpd_interface_list,
4498 config = config,
4499 options = options,
4500 subnet = subnet)
4501 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4502 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:01:98:05')
4503 try:
4504 assert_equal(cip,None)
4505 log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
4506 finally:
4507 self.voltha.disable_device(device_id, delete = True)
4508 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004509
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004510 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004511 """
4512 Test Method:
4513 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4514 1. OLT and ONU is detected and validated.
4515 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4516 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
4517 4. Verify that subscriber should not get ip from external dhcp server.
4518 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004519 self.voltha_dhcprelay_setUpClass()
4520# if not port_list:
4521# port_list = self.generate_port_list(1, 0)
4522 iface = self.port_map[self.port_list[0][1]]
4523 mac = self.get_mac(iface)
4524 self.host_load(iface)
4525 ##we use the defaults for this test that serves as an example for others
4526 ##You don't need to restart dhcpd server if retaining default config
4527 config = self.default_config
4528 options = self.default_options
4529 subnet = self.default_subnet_config
4530 dhcpd_interface_list = self.relay_interfaces
4531 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004532 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004533 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4534 assert_not_equal(device_id, None)
4535 voltha = VolthaCtrl(**self.voltha_attrs)
4536 time.sleep(10)
4537 switch_map = None
4538 olt_configured = False
4539 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4540 log_test.info('Installing OLT app')
4541 OnosCtrl.install_app(self.olt_app_file)
4542 time.sleep(5)
4543 log_test.info('Adding subscribers through OLT app')
4544 self.config_olt(switch_map)
4545 olt_configured = True
4546 time.sleep(5)
4547 self.dhcpd_start(intf_list = dhcpd_interface_list,
4548 config = config,
4549 options = options,
4550 subnet = subnet)
4551 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4552 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
4553 try:
4554 assert_equal(cip,None)
4555 log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
4556 finally:
4557 self.voltha.disable_device(device_id, delete = True)
4558 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004559
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004560 def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004561 """
4562 Test Method:
4563 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4564 1. OLT and ONU is detected and validated.
4565 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4566 3. Send dhcp request from residential subscrber to external dhcp server.
4567 4. Verify that subscriber get ip from external dhcp server successfully.
4568 5. Send dhcp release from residential subscrber to external dhcp server.
4569 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
4570 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004571 self.voltha_dhcprelay_setUpClass()
4572# if not port_list:
4573# port_list = self.generate_port_list(1, 0)
4574 iface = self.port_map[self.port_list[0][1]]
4575 mac = self.get_mac(iface)
4576 self.host_load(iface)
4577 ##we use the defaults for this test that serves as an example for others
4578 ##You don't need to restart dhcpd server if retaining default config
4579 config = self.default_config
4580 options = self.default_options
4581 subnet = self.default_subnet_config
4582 dhcpd_interface_list = self.relay_interfaces
4583 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004584 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004585 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4586 assert_not_equal(device_id, None)
4587 voltha = VolthaCtrl(**self.voltha_attrs)
4588 time.sleep(10)
4589 switch_map = None
4590 olt_configured = False
4591 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4592 log_test.info('Installing OLT app')
4593 OnosCtrl.install_app(self.olt_app_file)
4594 time.sleep(5)
4595 log_test.info('Adding subscribers through OLT app')
4596 self.config_olt(switch_map)
4597 olt_configured = True
4598 time.sleep(5)
4599 self.dhcpd_start(intf_list = dhcpd_interface_list,
4600 config = config,
4601 options = options,
4602 subnet = subnet)
4603 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = iface)
4604 cip, sip = self.send_recv(mac=mac)
4605 log_test.info('Releasing ip %s to server %s' %(cip, sip))
4606 try:
4607 assert_equal(self.dhcp.release(cip), True)
4608 log_test.info('Triggering DHCP discover again after release')
4609 cip2, sip2 = self.send_recv(mac=mac)
4610 log_test.info('Verifying released IP was given back on rediscover')
4611 assert_equal(cip, cip2)
4612 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
4613 assert_equal(self.dhcp.release(cip2), True)
4614 finally:
4615 self.voltha.disable_device(device_id, delete = True)
4616 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004617
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004618 ##Not yet validated
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004619 def test_subscriber_with_voltha_for_dhcprelay_starvation(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004620 """
4621 Test Method:
4622 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4623 1. OLT and ONU is detected and validated.
4624 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4625 3. Send dhcp request from residential subscriber to external dhcp server.
4626 4. Verify that subscriber get ip from external dhcp server. successfully.
4627 5. Repeat step 3 and 4 for 10 times.
4628 6 Verify that subscriber should get ip from external dhcp server..
4629 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004630 self.voltha_dhcprelay_setUpClass()
4631# if not port_list:
4632# port_list = self.generate_port_list(1, 0)
4633 iface = self.port_map[self.port_list[0][1]]
4634 mac = self.get_mac(iface)
4635 self.host_load(iface)
4636 ##we use the defaults for this test that serves as an example for others
4637 ##You don't need to restart dhcpd server if retaining default config
4638 config = self.default_config
4639 options = self.default_options
4640 subnet = self.default_subnet_config
4641 dhcpd_interface_list = self.relay_interfaces
4642 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004643 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004644 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4645 assert_not_equal(device_id, None)
4646 voltha = VolthaCtrl(**self.voltha_attrs)
4647 time.sleep(10)
4648 switch_map = None
4649 olt_configured = False
4650 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4651 log_test.info('Installing OLT app')
4652 OnosCtrl.install_app(self.olt_app_file)
4653 time.sleep(5)
4654 log_test.info('Adding subscribers through OLT app')
4655 self.config_olt(switch_map)
4656 olt_configured = True
4657 time.sleep(5)
4658 self.dhcpd_start(intf_list = dhcpd_interface_list,
4659 config = config,
4660 options = options,
4661 subnet = subnet)
4662 #self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = iface)
4663 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4664 log_test.info('Verifying 1 ')
4665 count = 0
4666 while True:
4667 #mac = RandMAC()._fix()
4668 cip, sip = self.send_recv(mac=mac,update_seed = True,validate = False)
4669 if cip is None:
4670 break
4671 else:
4672 count += 1
4673 assert_equal(count,91)
4674 log_test.info('Verifying 2 ')
4675 cip, sip = self.send_recv(mac=mac, update_seed = True, validate = False)
4676 try:
4677 assert_equal(cip, None)
4678 assert_equal(sip, None)
4679 finally:
4680 self.voltha.disable_device(device_id, delete = True)
4681 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004682
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004683 def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004684 """
4685 Test Method:
4686 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4687 1. OLT and ONU is detected and validated.
4688 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4689 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
4690 4. Verify that subscriber should not get ip from external dhcp server..
4691 5. Repeat steps 3 and 4 for 10 times.
4692 6 Verify that subscriber should not get ip from external dhcp server..
4693 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004694 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004695 """
4696 Test Method:
4697 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4698 1. OLT and ONU is detected and validated.
4699 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4700 3. Send dhcp request from residential subscriber to external dhcp server.
4701 4. Verify that subscriber get ip from external dhcp server. successfully.
4702 5. Repeat step 3 for 50 times.
4703 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4704 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004705 self.voltha_dhcprelay_setUpClass()
4706# if not port_list:
4707# port_list = self.generate_port_list(1, 0)
4708 iface = self.port_map[self.port_list[0][1]]
4709 mac = self.get_mac(iface)
4710 self.host_load(iface)
4711 ##we use the defaults for this test that serves as an example for others
4712 ##You don't need to restart dhcpd server if retaining default config
4713 config = self.default_config
4714 options = self.default_options
4715 subnet = self.default_subnet_config
4716 dhcpd_interface_list = self.relay_interfaces
4717 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004718 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004719 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4720 assert_not_equal(device_id, None)
4721 voltha = VolthaCtrl(**self.voltha_attrs)
4722 time.sleep(10)
4723 switch_map = None
4724 olt_configured = False
4725 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4726 log_test.info('Installing OLT app')
4727 OnosCtrl.install_app(self.olt_app_file)
4728 time.sleep(5)
4729 log_test.info('Adding subscribers through OLT app')
4730 self.config_olt(switch_map)
4731 olt_configured = True
4732 time.sleep(5)
4733 self.dhcpd_start(intf_list = dhcpd_interface_list,
4734 config = config,
4735 options = options,
4736 subnet = subnet)
4737 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4738 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
4739 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCP REQUEST.' %
4740 (cip, sip, mac) )
4741 try:
4742 assert_not_equal(cip, None)
4743 log_test.info('Triggering DHCP discover again.')
4744 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover(mac=mac)
4745 assert_equal(new_cip, cip)
4746 log_test.info('Got same ip to same the client when sent discover again, as expected')
4747 finally:
4748 self.voltha.disable_device(device_id, delete = True)
4749 self.voltha_dhcprelay_tearDownClass()
4750
4751 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_requests(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004752 """
4753 Test Method:
4754 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4755 1. OLT and ONU is detected and validated.
4756 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4757 3. Send dhcp request from residential subscriber to external dhcp server.
4758 4. Verify that subscriber get ip from external dhcp server. successfully.
4759 5. Send DHCP request to external dhcp server.
4760 6. Repeat step 5 for 50 times.
4761 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4762 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004763 self.voltha_dhcprelay_setUpClass()
4764# if not port_list:
4765# port_list = self.generate_port_list(1, 0)
4766 iface = self.port_map[self.port_list[0][1]]
4767 mac = self.get_mac(iface)
4768 self.host_load(iface)
4769 ##we use the defaults for this test that serves as an example for others
4770 ##You don't need to restart dhcpd server if retaining default config
4771 config = self.default_config
4772 options = self.default_options
4773 subnet = self.default_subnet_config
4774 dhcpd_interface_list = self.relay_interfaces
4775 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004776 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004777 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4778 assert_not_equal(device_id, None)
4779 voltha = VolthaCtrl(**self.voltha_attrs)
4780 time.sleep(10)
4781 switch_map = None
4782 olt_configured = False
4783 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4784 log_test.info('Installing OLT app')
4785 OnosCtrl.install_app(self.olt_app_file)
4786 time.sleep(5)
4787 log_test.info('Adding subscribers through OLT app')
4788 self.config_olt(switch_map)
4789 olt_configured = True
4790 time.sleep(5)
4791 self.dhcpd_start(intf_list = dhcpd_interface_list,
4792 config = config,
4793 options = options,
4794 subnet = subnet)
4795 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4796 log_test.info('Sending DHCP discover and DHCP request.')
4797 cip, sip = self.send_recv(mac=mac)
4798 mac = self.dhcp.get_mac(cip)[0]
4799 log_test.info("Sending DHCP request again.")
4800 new_cip, new_sip = self.dhcp.only_request(cip, mac)
4801 try:
4802 assert_equal(new_cip, cip)
4803 log_test.info('got same ip to smae the client when sent request again, as expected')
4804 finally:
4805 self.voltha.disable_device(device_id, delete = True)
4806 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004807
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004808 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004809 """
4810 Test Method:
4811 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4812 1. OLT and ONU is detected and validated.
4813 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4814 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
4815 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
4816 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004817 self.voltha_dhcprelay_setUpClass()
4818# if not port_list:
4819# port_list = self.generate_port_list(1, 0)
4820 iface = self.port_map[self.port_list[0][1]]
4821 mac = self.get_mac(iface)
4822 self.host_load(iface)
4823 ##we use the defaults for this test that serves as an example for others
4824 ##You don't need to restart dhcpd server if retaining default config
4825 config = self.default_config
4826 options = self.default_options
4827 subnet = self.default_subnet_config
4828 dhcpd_interface_list = self.relay_interfaces
4829 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004830 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004831 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4832 assert_not_equal(device_id, None)
4833 voltha = VolthaCtrl(**self.voltha_attrs)
4834 time.sleep(10)
4835 switch_map = None
4836 olt_configured = False
4837 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4838 log_test.info('Installing OLT app')
4839 OnosCtrl.install_app(self.olt_app_file)
4840 time.sleep(5)
4841 log_test.info('Adding subscribers through OLT app')
4842 self.config_olt(switch_map)
4843 olt_configured = True
4844 time.sleep(5)
4845 self.dhcpd_start(intf_list = dhcpd_interface_list,
4846 config = config,
4847 options = options,
4848 subnet = subnet)
4849 self.dhcp = DHCPTest(seed_ip = '192.168.1.31', iface = iface)
4850 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac,desired = True)
4851 try:
4852 assert_equal(cip,self.dhcp.seed_ip)
4853 log_test.info('Got dhcp client desired IP %s from server %s for mac %s as expected' %
4854 (cip, sip, mac) )
4855 finally:
4856 self.voltha.disable_device(device_id, delete = True)
4857 self.voltha_dhcprelay_tearDownClass()
4858
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004859 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004860 """
4861 Test Method:
4862 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4863 1. OLT and ONU is detected and validated.
4864 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4865 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
4866 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.
4867 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004868 self.voltha_dhcprelay_setUpClass()
4869# if not port_list:
4870# port_list = self.generate_port_list(1, 0)
4871 iface = self.port_map[self.port_list[0][1]]
4872 mac = self.get_mac(iface)
4873 self.host_load(iface)
4874 ##we use the defaults for this test that serves as an example for others
4875 ##You don't need to restart dhcpd server if retaining default config
4876 config = self.default_config
4877 options = self.default_options
4878 subnet = self.default_subnet_config
4879 dhcpd_interface_list = self.relay_interfaces
4880 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004881 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004882 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4883 assert_not_equal(device_id, None)
4884 voltha = VolthaCtrl(**self.voltha_attrs)
4885 time.sleep(10)
4886 switch_map = None
4887 olt_configured = False
4888 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4889 log_test.info('Installing OLT app')
4890 OnosCtrl.install_app(self.olt_app_file)
4891 time.sleep(5)
4892 log_test.info('Adding subscribers through OLT app')
4893 self.config_olt(switch_map)
4894 olt_configured = True
4895 time.sleep(5)
4896 self.dhcpd_start(intf_list = dhcpd_interface_list,
4897 config = config,
4898 options = options,
4899 subnet = subnet)
4900 self.dhcp = DHCPTest(seed_ip = '20.20.20.35', iface = iface)
4901 cip, sip, mac, _ = self.dhcp.only_discover(mac= mac,desired = True)
4902 try:
4903 assert_not_equal(cip,None)
4904 assert_not_equal(cip,self.dhcp.seed_ip)
4905 log_test.info('server offered IP from its pool when requested out of pool IP, as expected')
4906 finally:
4907 self.voltha.disable_device(device_id, delete = True)
4908 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004909
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004910 def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004911 """
4912 Test Method:
4913 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4914 1. OLT and ONU is detected and validated.
4915 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4916 3. Send dhcp request from residential subscriber to external dhcp server.
4917 4. Verify that subscriber get ip from external dhcp server. successfully.
4918 5. Deactivate dhcp server app in onos.
4919 6. Repeat step 3.
4920 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4921 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004922 self.voltha_dhcprelay_setUpClass()
4923# if not port_list:
4924# port_list = self.generate_port_list(1, 0)
4925 iface = self.port_map[self.port_list[0][1]]
4926 mac = self.get_mac(iface)
4927 self.host_load(iface)
4928 ##we use the defaults for this test that serves as an example for others
4929 ##You don't need to restart dhcpd server if retaining default config
4930 config = self.default_config
4931 options = self.default_options
4932 subnet = self.default_subnet_config
4933 dhcpd_interface_list = self.relay_interfaces
4934 log_test.info('Enabling ponsim_olt')
4935 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4936 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4937 assert_not_equal(device_id, None)
4938 voltha = VolthaCtrl(**self.voltha_attrs)
4939 time.sleep(10)
4940 switch_map = None
4941 olt_configured = False
4942 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4943 log_test.info('Installing OLT app')
4944 OnosCtrl.install_app(self.olt_app_file)
4945 time.sleep(5)
4946 log_test.info('Adding subscribers through OLT app')
4947 self.config_olt(switch_map)
4948 olt_configured = True
4949 time.sleep(5)
4950 self.dhcpd_start(intf_list = dhcpd_interface_list,
4951 config = config,
4952 options = options,
4953 subnet = subnet)
4954 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4955 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
4956 thread2 = threading.Thread(target = self.deactivate_apps, args = (self.app_dhcprelay,))
4957 log_test.info('Restart dhcprelay app in onos during client send discover to voltha')
4958 thread2.start()
4959 thread1.start()
4960 time.sleep(10)
4961 thread1.join()
4962 thread2.join()
4963 try:
4964 assert_equal(self.success, False)
4965 #assert_equal(status, True)
4966 time.sleep(10)
4967 finally:
4968 self.voltha.disable_device(device_id, delete = True)
4969 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004970
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004971 def test_subscriber_with_voltha_for_dhcprelay_renew_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004972 """
4973 Test Method:
4974 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4975 1. OLT and ONU is detected and validated.
4976 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4977 3. Send dhcp request from residential subscriber to external dhcp server.
4978 4. Verify that subscriber get ip from external dhcp server. successfully.
4979 5. Send dhcp renew packet to external dhcp server.
4980 6. Repeat step 4.
4981 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004982 self.voltha_dhcprelay_setUpClass()
4983# if not port_list:
4984# port_list = self.generate_port_list(1, 0)
4985 iface = self.port_map[self.port_list[0][1]]
4986 mac = self.get_mac(iface)
4987 self.host_load(iface)
4988 ##we use the defaults for this test that serves as an example for others
4989 ##You don't need to restart dhcpd server if retaining default config
4990 config = self.default_config
4991 new_options = [('dhcp-renewal-time', 100), ('dhcp-rebinding-time', 125)]
4992 options = self.default_options + new_options
4993 subnet = self.default_subnet_config
4994 dhcpd_interface_list = self.relay_interfaces
4995 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004996 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004997 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4998 assert_not_equal(device_id, None)
4999 voltha = VolthaCtrl(**self.voltha_attrs)
5000 time.sleep(10)
5001 switch_map = None
5002 olt_configured = False
5003 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5004 log_test.info('Installing OLT app')
5005 OnosCtrl.install_app(self.olt_app_file)
5006 time.sleep(5)
5007 log_test.info('Adding subscribers through OLT app')
5008 self.config_olt(switch_map)
5009 olt_configured = True
5010 time.sleep(5)
5011 self.dhcpd_start(intf_list = dhcpd_interface_list,
5012 config = config,
5013 options = options,
5014 subnet = subnet)
5015 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
5016 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
5017 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
5018 (cip, sip, mac) )
5019 try:
5020 assert_not_equal(cip,None)
5021 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
5022 log_test.info('Waiting for renew time..')
5023 time.sleep(lval)
5024 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac, unicast = True)
5025 assert_equal(latest_cip, cip)
5026 log_test.info('Server renewed client IP when client sends request after renew time, as expected')
5027 finally:
5028 self.voltha.disable_device(device_id, delete = True)
5029 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005030
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005031 def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005032 """
5033 Test Method:
5034 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5035 1. OLT and ONU is detected and validated.
5036 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5037 3. Send dhcp request from residential subscriber to external dhcp server.
5038 4. Verify that subscriber get ip from external dhcp server. successfully.
5039 5. Send dhcp rebind packet to external dhcp server.
5040 6. Repeat step 4.
5041 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00005042 self.voltha_dhcprelay_setUpClass()
5043# if not port_list:
5044# port_list = self.generate_port_list(1, 0)
5045 iface = self.port_map[self.port_list[0][1]]
5046 mac = self.get_mac(iface)
5047 self.host_load(iface)
5048 ##we use the defaults for this test that serves as an example for others
5049 ##You don't need to restart dhcpd server if retaining default config
5050 config = self.default_config
5051 new_options = [('dhcp-renewal-time', 100), ('dhcp-rebinding-time', 125)]
5052 options = self.default_options + new_options
5053 subnet = self.default_subnet_config
5054 dhcpd_interface_list = self.relay_interfaces
5055 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07005056 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00005057 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5058 assert_not_equal(device_id, None)
5059 voltha = VolthaCtrl(**self.voltha_attrs)
5060 time.sleep(10)
5061 switch_map = None
5062 olt_configured = False
5063 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5064 log_test.info('Installing OLT app')
5065 OnosCtrl.install_app(self.olt_app_file)
5066 time.sleep(5)
5067 log_test.info('Adding subscribers through OLT app')
5068 self.config_olt(switch_map)
5069 olt_configured = True
5070 time.sleep(5)
5071 self.dhcpd_start(intf_list = dhcpd_interface_list,
5072 config = config,
5073 options = options,
5074 subnet = subnet)
5075 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
5076 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
5077 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
5078 (cip, sip, mac) )
5079 try:
5080 assert_not_equal(cip,None)
5081 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
5082 log_test.info('Waiting for rebind time..')
5083 time.sleep(lval)
5084 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
5085 assert_equal(latest_cip, cip)
5086 log_test.info('Server renewed client IP when client sends request after rebind time, as expected')
5087 finally:
5088 self.voltha.disable_device(device_id, delete = True)
5089 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005090
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005091 def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005092 """
5093 Test Method:
5094 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5095 1. OLT and ONU is detected and validated.
5096 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5097 3. Send dhcp request from residential subscriber to external dhcp server.
5098 4. Verify that subscriber get ip from external dhcp server. successfully.
5099 5. Disable olt devices which is being detected in voltha CLI.
5100 6. Repeat step 3.
5101 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5102 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005103 self.voltha_dhcprelay_setUpClass()
5104# if not port_list:
5105# port_list = self.generate_port_list(1, 0)
5106 iface = self.port_map[self.port_list[0][1]]
5107 mac = self.get_mac(iface)
5108 self.host_load(iface)
5109 ##we use the defaults for this test that serves as an example for others
5110 ##You don't need to restart dhcpd server if retaining default config
5111 config = self.default_config
5112 options = self.default_options
5113 subnet = self.default_subnet_config
5114 dhcpd_interface_list = self.relay_interfaces
5115 log_test.info('Enabling ponsim_olt')
5116 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5117 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5118 assert_not_equal(device_id, None)
5119 voltha = VolthaCtrl(**self.voltha_attrs)
5120 time.sleep(10)
5121 switch_map = None
5122 olt_configured = False
5123 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5124 log_test.info('Installing OLT app')
5125 OnosCtrl.install_app(self.olt_app_file)
5126 time.sleep(5)
5127 log_test.info('Adding subscribers through OLT app')
5128 self.config_olt(switch_map)
5129 olt_configured = True
5130 time.sleep(5)
5131 self.dhcpd_start(intf_list = dhcpd_interface_list,
5132 config = config,
5133 options = options,
5134 subnet = subnet)
5135 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
5136 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
5137 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
5138 log_test.info('Disable olt devices during client send discover to voltha')
5139 thread2.start()
5140 time.sleep(4)
5141 thread1.start()
5142 time.sleep(10)
5143 thread1.join()
5144 thread2.join()
5145 try:
5146 assert_equal(self.success, False)
5147 #assert_equal(status, True)
5148 time.sleep(10)
5149 finally:
5150 self.voltha.disable_device(device_id, delete = True)
5151 self.voltha_dhcprelay_tearDownClass()
5152
Thangavelu K S057b7d22017-05-16 22:03:22 +00005153
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005154 def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005155 """
5156 Test Method:
5157 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5158 1. OLT and ONU is detected and validated.
5159 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5160 3. Send dhcp request from residential subscriber to external dhcp server.
5161 4. Verify that subscriber get ip from external dhcp server. successfully.
5162 5. Disable olt devices which is being detected in voltha CLI.
5163 6. Repeat step 3.
5164 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5165 8. Enable olt devices which is being detected in voltha CLI.
5166 9. Repeat steps 3 and 4.
5167 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005168 self.voltha_dhcprelay_setUpClass()
5169# if not port_list:
5170# port_list = self.generate_port_list(1, 0)
5171 iface = self.port_map[self.port_list[0][1]]
5172 mac = self.get_mac(iface)
5173 self.host_load(iface)
5174 ##we use the defaults for this test that serves as an example for others
5175 ##You don't need to restart dhcpd server if retaining default config
5176 config = self.default_config
5177 options = self.default_options
5178 subnet = self.default_subnet_config
5179 dhcpd_interface_list = self.relay_interfaces
5180 log_test.info('Enabling ponsim_olt')
5181 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5182 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5183 assert_not_equal(device_id, None)
5184 voltha = VolthaCtrl(**self.voltha_attrs)
5185 time.sleep(10)
5186 switch_map = None
5187 olt_configured = False
5188 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5189 log_test.info('Installing OLT app')
5190 OnosCtrl.install_app(self.olt_app_file)
5191 time.sleep(5)
5192 log_test.info('Adding subscribers through OLT app')
5193 self.config_olt(switch_map)
5194 olt_configured = True
5195 time.sleep(5)
5196 self.dhcpd_start(intf_list = dhcpd_interface_list,
5197 config = config,
5198 options = options,
5199 subnet = subnet)
5200 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
5201 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
5202 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
5203 log_test.info('Restart olt devices during client send discover to voltha')
5204 thread2.start()
5205 time.sleep(4)
5206 thread1.start()
5207 time.sleep(10)
5208 thread1.join()
5209 thread2.join()
5210 try:
5211 assert_equal(self.success, False)
5212 #assert_equal(status, True)
5213 time.sleep(10)
5214 finally:
5215 self.voltha.disable_device(device_id, delete = True)
5216 self.voltha_dhcprelay_tearDownClass()
5217
Thangavelu K S057b7d22017-05-16 22:03:22 +00005218
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005219 def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005220 """
5221 Test Method:
5222 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5223 1. OLT and ONU is detected and validated.
5224 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5225 3. Send dhcp request from residential subscriber to external dhcp server.
5226 4. Verify that subscriber get ip from external dhcp server. successfully.
5227 5. Disable onu port which is being detected in voltha CLI.
5228 6. Repeat step 3.
5229 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5230 """
5231
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005232 self.voltha_dhcprelay_setUpClass()
5233# if not port_list:
5234# port_list = self.generate_port_list(1, 0)
5235 iface = self.port_map[self.port_list[0][1]]
5236 mac = self.get_mac(iface)
5237 self.host_load(iface)
5238 ##we use the defaults for this test that serves as an example for others
5239 ##You don't need to restart dhcpd server if retaining default config
5240 config = self.default_config
5241 options = self.default_options
5242 subnet = self.default_subnet_config
5243 dhcpd_interface_list = self.relay_interfaces
5244 log_test.info('Enabling ponsim_olt')
5245 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5246 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5247 assert_not_equal(device_id, None)
5248 voltha = VolthaCtrl(**self.voltha_attrs)
5249 time.sleep(10)
5250 switch_map = None
5251 olt_configured = False
5252 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5253 log_test.info('Installing OLT app')
5254 OnosCtrl.install_app(self.olt_app_file)
5255 time.sleep(5)
5256 log_test.info('Adding subscribers through OLT app')
5257 self.config_olt(switch_map)
5258 olt_configured = True
5259 time.sleep(5)
5260 self.dhcpd_start(intf_list = dhcpd_interface_list,
5261 config = config,
5262 options = options,
5263 subnet = subnet)
5264 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
5265 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
5266 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
5267 log_test.info('Restart olt devices during client send discover to voltha')
5268 thread2.start()
5269 time.sleep(4)
5270 thread1.start()
5271 time.sleep(10)
5272 thread1.join()
5273 thread2.join()
5274 try:
5275 assert_equal(self.success, False)
5276 #assert_equal(status, True)
5277 time.sleep(10)
5278 finally:
5279 self.voltha.disable_device(device_id, delete = True)
5280 self.voltha_dhcprelay_tearDownClass()
5281
5282 def test_subscriber_with_voltha_for_dhcprelay_toggle_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005283 """
5284 Test Method:
5285 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5286 1. OLT and ONU is detected and validated.
5287 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5288 3. Send dhcp request from residential subscriber to external dhcp server.
5289 4. Verify that subscriber get ip from external dhcp server. successfully.
5290 5. Disable onu port which is being detected in voltha CLI.
5291 6. Repeat step 3.
5292 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5293 8. Enable onu port which is being detected in voltha CLI.
5294 9. Repeat steps 3 and 4.
5295 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005296 self.voltha_dhcprelay_setUpClass()
5297# if not port_list:
5298# port_list = self.generate_port_list(1, 0)
5299 iface = self.port_map[self.port_list[0][1]]
5300 mac = self.get_mac(iface)
5301 self.host_load(iface)
5302 ##we use the defaults for this test that serves as an example for others
5303 ##You don't need to restart dhcpd server if retaining default config
5304 config = self.default_config
5305 options = self.default_options
5306 subnet = self.default_subnet_config
5307 dhcpd_interface_list = self.relay_interfaces
5308 log_test.info('Enabling ponsim_olt')
5309 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5310 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5311 assert_not_equal(device_id, None)
5312 voltha = VolthaCtrl(**self.voltha_attrs)
5313 time.sleep(10)
5314 switch_map = None
5315 olt_configured = False
5316 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5317 log_test.info('Installing OLT app')
5318 OnosCtrl.install_app(self.olt_app_file)
5319 time.sleep(5)
5320 log_test.info('Adding subscribers through OLT app')
5321 self.config_olt(switch_map)
5322 olt_configured = True
5323 time.sleep(5)
5324 self.dhcpd_start(intf_list = dhcpd_interface_list,
5325 config = config,
5326 options = options,
5327 subnet = subnet)
5328 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
5329 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
5330 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
5331 log_test.info('Restart olt devices during client send discover to voltha')
5332 thread2.start()
5333 time.sleep(4)
5334 thread1.start()
5335 time.sleep(10)
5336 thread1.join()
5337 thread2.join()
5338 try:
5339 assert_equal(self.success, False)
5340 #assert_equal(status, True)
5341 time.sleep(10)
5342 cip, sip = self.send_recv(mac=mac)
5343 finally:
5344 self.voltha.disable_device(device_id, delete = True)
5345 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005346
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005347 def test_two_subscribers_with_voltha_for_dhcprelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005348 """
5349 Test Method:
5350 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5351 1. OLT and ONU is detected and validated.
5352 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5353 3. Send dhcp request from two residential subscribers to external dhcp server.
5354 4. Verify that subscribers had got different ips from external dhcp server. successfully.
5355 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005356 self.voltha_dhcprelay_setUpClass()
5357# if not port_list:
5358# port_list = self.generate_port_list(1, 0)
5359 iface_1 = self.port_map[self.port_list[0][1]]
5360 iface_2 = self.port_map[self.port_list[3][1]]
5361 mac_1 = self.get_mac(iface_1)
5362 mac_2 = self.get_mac(iface_2)
5363 self.host_load(iface_1)
5364 self.host_load(iface_2)
5365 ##we use the defaults for this test that serves as an example for others
5366 ##You don't need to restart dhcpd server if retaining default config
5367 config = self.default_config
5368 options = self.default_options
5369 subnet = self.default_subnet_config
5370 dhcpd_interface_list = self.relay_interfaces
5371 log_test.info('Enabling ponsim_olt')
5372 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5373 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5374 assert_not_equal(device_id, None)
5375 voltha = VolthaCtrl(**self.voltha_attrs)
5376 time.sleep(10)
5377 switch_map = None
5378 olt_configured = False
5379 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5380 log_test.info('Installing OLT app')
5381 OnosCtrl.install_app(self.olt_app_file)
5382 time.sleep(5)
5383 log_test.info('Adding subscribers through OLT app')
5384 self.config_olt(switch_map)
5385 olt_configured = True
5386 time.sleep(5)
5387 self.dhcpd_start(intf_list = dhcpd_interface_list,
5388 config = config,
5389 options = options,
5390 subnet = subnet)
5391 self.dhcp_1 = DHCPTest(seed_ip = '10.10.10.1', iface = iface_1)
5392 self.dhcp_2 = DHCPTest(seed_ip = '20.20.20.1', iface = iface_2)
5393 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac_1,False,True,self.dhcp_1,))
5394 thread2 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac_2,False,True,self.dhcp_2,))
5395# log_test.info('Restart olt devices during client send discover to voltha')
5396 thread2.start()
5397 time.sleep(4)
5398 thread1.start()
5399 time.sleep(10)
5400 thread1.join()
5401 thread2.join()
5402 try:
5403 assert_equal(self.success, True)
5404 #assert_equal(status, True)
5405 time.sleep(10)
5406 finally:
5407 self.voltha.disable_device(device_id, delete = True)
5408 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005409
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005410 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005411 """
5412 Test Method:
5413 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5414 1. OLT and ONU is detected and validated.
5415 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5416 3. Send dhcp request from two residential subscribers to external dhcp server.
5417 4. Verify that subscribers had got ip from external dhcp server. successfully.
5418 5. Repeat step 3 and 4 for 10 times for both subscribers.
5419 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
5420 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005421 self.voltha_dhcprelay_setUpClass()
5422# if not port_list:
5423# port_list = self.generate_port_list(1, 0)
5424 iface_1 = self.port_map[self.port_list[0][1]]
5425 iface_2 = self.port_map[self.port_list[3][1]]
5426 mac_1 = self.get_mac(iface_1)
5427 mac_2 = self.get_mac(iface_2)
5428 self.host_load(iface_1)
5429 self.host_load(iface_2)
5430 ##we use the defaults for this test that serves as an example for others
5431 ##You don't need to restart dhcpd server if retaining default config
5432 config = self.default_config
5433 options = self.default_options
5434 subnet = self.default_subnet_config
5435 dhcpd_interface_list = self.relay_interfaces
5436 log_test.info('Enabling ponsim_olt')
5437 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5438 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5439 assert_not_equal(device_id, None)
5440 voltha = VolthaCtrl(**self.voltha_attrs)
5441 time.sleep(10)
5442 switch_map = None
5443 olt_configured = False
5444 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5445 log_test.info('Installing OLT app')
5446 OnosCtrl.install_app(self.olt_app_file)
5447 time.sleep(5)
5448 log_test.info('Adding subscribers through OLT app')
5449 self.config_olt(switch_map)
5450 olt_configured = True
5451 time.sleep(5)
5452 self.dhcpd_start(intf_list = dhcpd_interface_list,
5453 config = config,
5454 options = options,
5455 subnet = subnet)
5456
5457 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,'multiple_discover',))
5458 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'multiple_discover',))
5459 #log_test.info('Restart olt devices during client send discover to voltha')
5460 thread2.start()
5461 time.sleep(4)
5462 thread1.start()
5463 time.sleep(10)
5464 thread1.join()
5465 thread2.join()
5466 try:
5467 assert_equal(self.success, True)
5468 #assert_equal(status, True)
5469 time.sleep(10)
5470 finally:
5471 self.voltha.disable_device(device_id, delete = True)
5472 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005473
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005474 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005475 """
5476 Test Method:
5477 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5478 1. OLT and ONU is detected and validated.
5479 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5480 3. Send dhcp request from two residential subscribers to external dhcp server.
5481 4. Verify that subscribers had got ip from external dhcp server. successfully.
5482 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
5483 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
5484 """
5485
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005486 self.voltha_dhcprelay_setUpClass()
5487# if not port_list:
5488# port_list = self.generate_port_list(1, 0)
5489 iface_1 = self.port_map[self.port_list[0][1]]
5490 iface_2 = self.port_map[self.port_list[3][1]]
5491 mac_1 = self.get_mac(iface_1)
5492 mac_2 = self.get_mac(iface_2)
5493 self.host_load(iface_1)
5494 self.host_load(iface_2)
5495 ##we use the defaults for this test that serves as an example for others
5496 ##You don't need to restart dhcpd server if retaining default config
5497 config = self.default_config
5498 options = self.default_options
5499 subnet = self.default_subnet_config
5500 dhcpd_interface_list = self.relay_interfaces
5501 log_test.info('Enabling ponsim_olt')
5502 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5503 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5504 assert_not_equal(device_id, None)
5505 voltha = VolthaCtrl(**self.voltha_attrs)
5506 time.sleep(10)
5507 switch_map = None
5508 olt_configured = False
5509 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5510 log_test.info('Installing OLT app')
5511 OnosCtrl.install_app(self.olt_app_file)
5512 time.sleep(5)
5513 log_test.info('Adding subscribers through OLT app')
5514 self.config_olt(switch_map)
5515 olt_configured = True
5516 time.sleep(5)
5517 self.dhcpd_start(intf_list = dhcpd_interface_list,
5518 config = config,
5519 options = options,
5520 subnet = subnet)
5521
5522 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,))
5523 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'multiple_discover',))
5524 #log_test.info('Restart olt devices during client send discover to voltha')
5525 thread2.start()
5526 time.sleep(4)
5527 thread1.start()
5528 time.sleep(10)
5529 thread1.join()
5530 thread2.join()
5531 try:
5532 assert_equal(self.success, True)
5533 #assert_equal(status, True)
5534 time.sleep(10)
5535 finally:
5536 self.voltha.disable_device(device_id, delete = True)
5537 self.voltha_dhcprelay_tearDownClass()
5538
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005539 def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005540 """
5541 Test Method:
5542 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5543 1. OLT and ONU is detected and validated.
5544 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5545 3. Send dhcp request from one residential subscriber to external dhcp server.
5546 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
5547 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
5548 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005549 self.voltha_dhcprelay_setUpClass()
5550# if not port_list:
5551# port_list = self.generate_port_list(1, 0)
5552 iface_1 = self.port_map[self.port_list[0][1]]
5553 iface_2 = self.port_map[self.port_list[3][1]]
5554 mac_1 = self.get_mac(iface_1)
5555 mac_2 = self.get_mac(iface_2)
5556 self.host_load(iface_1)
5557 self.host_load(iface_2)
5558 ##we use the defaults for this test that serves as an example for others
5559 ##You don't need to restart dhcpd server if retaining default config
5560 config = self.default_config
5561 options = self.default_options
5562 subnet = self.default_subnet_config
5563 dhcpd_interface_list = self.relay_interfaces
5564 log_test.info('Enabling ponsim_olt')
5565 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5566 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5567 assert_not_equal(device_id, None)
5568 voltha = VolthaCtrl(**self.voltha_attrs)
5569 time.sleep(10)
5570 switch_map = None
5571 olt_configured = False
5572 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5573 log_test.info('Installing OLT app')
5574 OnosCtrl.install_app(self.olt_app_file)
5575 time.sleep(5)
5576 log_test.info('Adding subscribers through OLT app')
5577 self.config_olt(switch_map)
5578 olt_configured = True
5579 time.sleep(5)
5580 self.dhcpd_start(intf_list = dhcpd_interface_list,
5581 config = config,
5582 options = options,
5583 subnet = subnet)
5584
5585 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,))
5586 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'desired_ip',))
5587 #log_test.info('Restart olt devices during client send discover to voltha')
5588 thread2.start()
5589 time.sleep(4)
5590 thread1.start()
5591 time.sleep(10)
5592 thread1.join()
5593 thread2.join()
5594 try:
5595 assert_equal(self.success, True)
5596 #assert_equal(status, True)
5597 time.sleep(10)
5598 finally:
5599 self.voltha.disable_device(device_id, delete = True)
5600 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005601
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005602 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 +00005603 """
5604 Test Method:
5605 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5606 1. OLT and ONU is detected and validated.
5607 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5608 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
5609 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
5610 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
5611 """
5612
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005613 self.voltha_dhcprelay_setUpClass()
5614# if not port_list:
5615# port_list = self.generate_port_list(1, 0)
5616 iface_1 = self.port_map[self.port_list[0][1]]
5617 iface_2 = self.port_map[self.port_list[3][1]]
5618 mac_1 = self.get_mac(iface_1)
5619 mac_2 = self.get_mac(iface_2)
5620 self.host_load(iface_1)
5621 self.host_load(iface_2)
5622 ##we use the defaults for this test that serves as an example for others
5623 ##You don't need to restart dhcpd server if retaining default config
5624 config = self.default_config
5625 options = self.default_options
5626 subnet = self.default_subnet_config
5627 dhcpd_interface_list = self.relay_interfaces
5628 log_test.info('Enabling ponsim_olt')
5629 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5630 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5631 assert_not_equal(device_id, None)
5632 voltha = VolthaCtrl(**self.voltha_attrs)
5633 time.sleep(10)
5634 switch_map = None
5635 olt_configured = False
5636 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5637 log_test.info('Installing OLT app')
5638 OnosCtrl.install_app(self.olt_app_file)
5639 time.sleep(5)
5640 log_test.info('Adding subscribers through OLT app')
5641 self.config_olt(switch_map)
5642 olt_configured = True
5643 time.sleep(5)
5644 self.dhcpd_start(intf_list = dhcpd_interface_list,
5645 config = config,
5646 options = options,
5647 subnet = subnet)
5648
5649 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,))
5650 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'out_of_pool_ip',))
5651 #log_test.info('Restart olt devices during client send discover to voltha')
5652 thread2.start()
5653 time.sleep(4)
5654 thread1.start()
5655 time.sleep(10)
5656 thread1.join()
5657 thread2.join()
5658 try:
5659 assert_equal(self.success, True)
5660 #assert_equal(status, True)
5661 time.sleep(10)
5662 finally:
5663 self.voltha.disable_device(device_id, delete = True)
5664 self.voltha_dhcprelay_tearDownClass()
5665
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005666 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005667 """
5668 Test Method:
5669 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5670 1. OLT and ONU is detected and validated.
5671 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5672 3. Send dhcp request from two residential subscribers to external dhcp server.
5673 4. Verify that subscribers had got ip from external dhcp server. successfully.
5674 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
5675 6. Repeat step 3 and 4 for one subscriber where uni port is down.
5676 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5677 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005678 self.voltha_dhcprelay_setUpClass()
5679# if not port_list:
5680# port_list = self.generate_port_list(1, 0)
5681 iface_1 = self.port_map[self.port_list[0][1]]
5682 iface_2 = self.port_map[self.port_list[3][1]]
5683 mac_1 = self.get_mac(iface_1)
5684 mac_2 = self.get_mac(iface_2)
5685 self.host_load(iface_1)
5686 self.host_load(iface_2)
5687 ##we use the defaults for this test that serves as an example for others
5688 ##You don't need to restart dhcpd server if retaining default config
5689 config = self.default_config
5690 options = self.default_options
5691 subnet = self.default_subnet_config
5692 dhcpd_interface_list = self.relay_interfaces
5693 log_test.info('Enabling ponsim_olt')
5694 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5695 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5696 assert_not_equal(device_id, None)
5697 voltha = VolthaCtrl(**self.voltha_attrs)
5698 time.sleep(10)
5699 switch_map = None
5700 olt_configured = False
5701 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5702 log_test.info('Installing OLT app')
5703 OnosCtrl.install_app(self.olt_app_file)
5704 time.sleep(5)
5705 log_test.info('Adding subscribers through OLT app')
5706 self.config_olt(switch_map)
5707 olt_configured = True
5708 time.sleep(5)
5709 self.dhcpd_start(intf_list = dhcpd_interface_list,
5710 config = config,
5711 options = options,
5712 subnet = subnet)
5713
5714 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,))
5715 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'desired_ip',))
5716 thread3 = threading.Thread(target = self.voltha_uni_port_toggle, args = (iface_2,))
5717 #log_test.info('Restart olt devices during client send discover to voltha')
5718 thread2.start()
5719 time.sleep(8)
5720 thread1.start()
5721 thread3.start()
5722 time.sleep(10)
5723 thread1.join()
5724 thread2.join()
5725 thread3.join()
5726 try:
5727 assert_equal(self.success, False)
5728 #assert_equal(status, True)
5729 time.sleep(10)
5730 finally:
5731 self.voltha.disable_device(device_id, delete = True)
5732 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005733
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005734 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005735 """
5736 Test Method:
5737 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5738 1. OLT and ONU is detected and validated.
5739 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5740 3. Send dhcp request from two residential subscribers to external dhcp server.
5741 4. Verify that subscribers had got ip from external dhcp server. successfully.
5742 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
5743 6. Repeat step 3 and 4 for one subscriber where uni port is down.
5744 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5745 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
5746 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
5747 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5748 """
5749
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005750 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005751 """
5752 Test Method:
5753 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5754 1. OLT and ONU is detected and validated.
5755 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5756 3. Send dhcp request from two residential subscribers to external dhcp server.
5757 4. Verify that subscribers had got ip from external dhcp server. successfully.
5758 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
5759 6. Disable the olt device which is detected in voltha.
5760 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
5761 """
5762
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005763 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005764 """
5765 Test Method:
5766 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5767 1. OLT and ONU is detected and validated.
5768 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5769 3. Send dhcp request from two residential subscribers to external dhcp server.
5770 4. Verify that subscribers had got ip from external dhcp server. successfully.
5771 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
5772 6. Disable the olt device which is detected in voltha.
5773 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
5774 8. Enable the olt device which is detected in voltha.
5775 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5776 """
5777
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005778 def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005779 """
5780 Test Method:
5781 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5782 1. OLT and ONU is detected and validated.
5783 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5784 3. Send dhcp request from two residential subscribers to external dhcp server.
5785 4. Verify that subscribers had got ip from external dhcp server. successfully.
5786 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
5787 6. Pause the olt device which is detected in voltha.
5788 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
5789 """
Thangavelu K S36edb012017-07-05 18:24:12 +00005790
Thangavelu K S6432b522017-07-22 00:05:54 +00005791 def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005792 """
5793 Test Method:
5794 0. Make sure that voltha is up and running on CORD-POD setup.
5795 1. OLT and ONU is detected and validated.
5796 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5797 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5798 4. Send igmp joins for a multicast group address multi-group-addressA.
5799 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
5800 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5801 """
5802
Thangavelu K S8e413082017-07-13 20:02:14 +00005803 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5804 num_subscribers = 1
5805 num_channels = 1
5806 services = ('IGMP')
5807 cbs = (self.igmp_flow_check, None, None)
5808 self.voltha_subscribers(services, cbs = cbs,
5809 num_subscribers = num_subscribers,
5810 num_channels = num_channels)
5811
Thangavelu K S6432b522017-07-22 00:05:54 +00005812 def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005813 """
5814 Test Method:
5815 0. Make sure that voltha is up and running on CORD-POD setup.
5816 1. OLT and ONU is detected and validated.
5817 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5818 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5819 4. Send igmp joins for a multicast group address multi-group-addressA.
5820 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
5821 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
5822 7. Send igmp leave for a multicast group address multi-group-addressA.
5823 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
5824 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005825 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5826 num_subscribers = 1
5827 num_channels = 1
5828 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005829 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00005830 self.voltha_subscribers(services, cbs = cbs,
5831 num_subscribers = num_subscribers,
5832 num_channels = num_channels)
5833
Thangavelu K S6432b522017-07-22 00:05:54 +00005834 def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005835 """
5836 Test Method:
5837 0. Make sure that voltha is up and running on CORD-POD setup.
5838 1. OLT and ONU is detected and validated.
5839 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5840 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5841 4. Send igmp joins for a multicast group address multi-group-addressA.
5842 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
5843 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
5844 7. Send igmp leave for a multicast group address multi-group-addressA.
5845 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
5846 9. Repeat steps 4 to 6.
5847 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005848 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5849 num_subscribers = 1
5850 num_channels = 1
5851 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005852 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00005853 self.voltha_subscribers(services, cbs = cbs,
5854 num_subscribers = num_subscribers,
5855 num_channels = num_channels)
5856
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005857 def test_subscriber_with_voltha_for_igmp_with_five_groups_joins_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005858 """
5859 Test Method:
5860 0. Make sure that voltha is up and running on CORD-POD setup.
5861 1. OLT and ONU is detected and validated.
5862 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5863 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5864 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
5865 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5866 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5867 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005868 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5869 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005870 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00005871 services = ('IGMP')
5872 cbs = (self.igmp_flow_check, None, None)
5873 self.voltha_subscribers(services, cbs = cbs,
5874 num_subscribers = num_subscribers,
5875 num_channels = num_channels)
5876
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005877 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 +00005878 """
5879 Test Method:
5880 0. Make sure that voltha is up and running on CORD-POD setup.
5881 1. OLT and ONU is detected and validated.
5882 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5883 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5884 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
5885 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5886 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5887 7. Send igmp leave for a multicast group address multi-group-addressA.
5888 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.
5889 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester.
5890 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005891 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5892 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005893 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00005894 services = ('IGMP')
5895 cbs = (self.igmp_flow_check, None, None)
5896 self.voltha_subscribers(services, cbs = cbs,
5897 num_subscribers = num_subscribers,
5898 num_channels = num_channels)
5899
Thangavelu K S6432b522017-07-22 00:05:54 +00005900 def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005901 """
5902 Test Method:
5903 0. Make sure that voltha is up and running on CORD-POD setup.
5904 1. OLT and ONU is detected and validated.
5905 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5906 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5907 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
5908 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5909 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5910 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
5911 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5912 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005913 num_subscribers = 1
5914 num_channels = 1
5915 services = ('IGMP')
5916 cbs = (self.igmp_flow_check, None, None)
5917 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5918 num_subscribers = num_subscribers,
5919 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00005920
Thangavelu K S6432b522017-07-22 00:05:54 +00005921 def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005922 """
5923 Test Method:
5924 0. Make sure that voltha is up and running on CORD-POD setup.
5925 1. OLT and ONU is detected and validated.
5926 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5927 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5928 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
5929 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5930 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5931 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA
5932 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5933 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5934 """
5935
Thangavelu K S8e413082017-07-13 20:02:14 +00005936 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00005937 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00005938 services = ('IGMP')
5939 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
5940 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5941 num_subscribers = num_subscribers,
5942 num_channels = num_channels)
5943
Thangavelu K S6432b522017-07-22 00:05:54 +00005944 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 +00005945 """
5946 Test Method:
5947 0. Make sure that voltha is up and running on CORD-POD setup.
5948 1. OLT and ONU is detected and validated.
5949 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5950 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5951 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
5952 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5953 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
5954 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA
5955 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5956 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
5957 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005958 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00005959 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00005960 services = ('IGMP')
5961 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
5962 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5963 num_subscribers = num_subscribers,
5964 num_channels = num_channels)
5965
Thangavelu K S6432b522017-07-22 00:05:54 +00005966 def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005967 """
5968 Test Method:
5969 0. Make sure that voltha is up and running on CORD-POD setup.
5970 1. OLT and ONU is detected and validated.
5971 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5972 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5973 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
5974 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5975 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5976 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA
5977 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5978 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5979 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005980
5981 num_subscribers = 1
5982 num_channels = 1
5983 services = ('IGMP')
5984 cbs = (self.igmp_flow_check_join_change_to_block, None, None)
5985 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5986 num_subscribers = num_subscribers,
5987 num_channels = num_channels)
5988
Thangavelu K S6432b522017-07-22 00:05:54 +00005989 def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005990 """
5991 Test Method:
5992 0. Make sure that voltha is up and running on CORD-POD setup.
5993 1. OLT and ONU is detected and validated.
5994 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5995 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5996 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
5997 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5998 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5999 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB
6000 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
6001 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
6002 """
Thangavelu K S8e413082017-07-13 20:02:14 +00006003
6004 num_subscribers = 1
6005 num_channels = 1
6006 services = ('IGMP')
6007 cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None)
6008 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
6009 num_subscribers = num_subscribers,
6010 num_channels = num_channels)
6011
Thangavelu K S6432b522017-07-22 00:05:54 +00006012 def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006013 """
6014 Test Method:
6015 0. Make sure that voltha is up and running on CORD-POD setup.
6016 1. OLT and ONU is detected and validated.
6017 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6018 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6019 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
6020 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
6021 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
6022 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
6023 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
6024 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006025
6026 num_subscribers = 1
6027 num_channels = 1
6028 services = ('IGMP')
6029 cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None)
6030 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
6031 num_subscribers = num_subscribers,
6032 num_channels = num_channels)
6033
Thangavelu K S6432b522017-07-22 00:05:54 +00006034 def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006035 """
6036 Test Method:
6037 0. Make sure that voltha is up and running on CORD-POD setup.
6038 1. OLT and ONU is detected and validated.
6039 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6040 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6041 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
6042 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
6043 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
6044 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
6045 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
6046 """
6047
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006048 num_subscribers = 1
6049 num_channels = 1
6050 services = ('IGMP')
6051 cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None)
6052 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
6053 num_subscribers = num_subscribers,
6054 num_channels = num_channels)
6055
Thangavelu K S6432b522017-07-22 00:05:54 +00006056 def test_two_subscribers_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006057 """
6058 Test Method:
6059 0. Make sure that voltha is up and running on CORD-POD setup.
6060 1. OLT and ONU is detected and validated.
6061 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6062 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6063 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6064 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
6065 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6066 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6067 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6068 """
6069
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006070 num_subscribers = 2
6071 num_channels = 1
6072 services = ('IGMP')
6073 cbs = (self.igmp_flow_check, None, None)
6074 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'],
6075 num_subscribers = num_subscribers,
6076 num_channels = num_channels)
6077
Thangavelu K S36edb012017-07-05 18:24:12 +00006078 def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self):
6079 """
6080 Test Method:
6081 0. Make sure that voltha is up and running on CORD-POD setup.
6082 1. OLT and ONU is detected and validated.
6083 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6084 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6085 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6086 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6087 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6088 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6089 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6090 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6091 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6092 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6093 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006094 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006095 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006096 services = ('IGMP')
6097 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
6098 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'],
6099 num_subscribers = num_subscribers,
6100 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00006101
Thangavelu K S6432b522017-07-22 00:05:54 +00006102 def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006103 """
6104 Test Method:
6105 0. Make sure that voltha is up and running on CORD-POD setup.
6106 1. OLT and ONU is detected and validated.
6107 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6108 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6109 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6110 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
6111 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6112 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.
6113 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.
6114 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6115 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.
6116 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.
6117 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.
6118 """
6119
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006120 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006121 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006122 services = ('IGMP')
6123 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
6124 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'],
6125 num_subscribers = num_subscribers,
6126 num_channels = num_channels)
6127
6128 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00006129 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 +00006130 """
6131 Test Method:
6132 0. Make sure that voltha is up and running on CORD-POD setup.
6133 1. OLT and ONU is detected and validated.
6134 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6135 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6136 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6137 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6138 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6139 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6140 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6141 9. Disable uni_2 port which is being shown on voltha CLI.
6142 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6143 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6144 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006145 #rx_port = self.port_map['ports'][port_list[i][1]]
6146 df = defer.Deferred()
6147 def igmp_flow_check_operating_onu_admin_state(df):
6148 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006149 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006150 services = ('IGMP')
6151 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
6152 port_list = self.generate_port_list(num_subscribers, num_channels)
6153
Thangavelu K S9a637332017-08-01 23:22:23 +00006154 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 +00006155 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
6156 thread1.start()
6157 time.sleep(randint(40,50))
6158 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
6159 thread2.start()
6160 time.sleep(10)
6161 thread1.join()
6162 thread2.join()
6163 try:
6164 assert_equal(self.success, False)
6165 log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check')
6166 time.sleep(10)
6167 finally:
6168 pass
6169 df.callback(0)
6170 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
6171 return df
6172
6173 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00006174 def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self):
6175 """
6176 Test Method:
6177 0. Make sure that voltha is up and running on CORD-POD setup.
6178 1. OLT and ONU is detected and validated.
6179 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6180 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6181 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6182 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6183 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6184 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6185 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6186 9. Disable uni_2 port which is being shown on voltha CLI.
6187 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6188 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6189 12. Enable uni_2 port which we disable at step 9.
6190 13. Repeat step 5,6 and 8.
6191 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006192 df = defer.Deferred()
6193 def igmp_flow_check_operating_onu_admin_state(df):
6194 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006195 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006196 services = ('IGMP')
6197 cbs = (self.igmp_flow_check, None, None)
6198 port_list = self.generate_port_list(num_subscribers, num_channels)
6199
Thangavelu K S9a637332017-08-01 23:22:23 +00006200 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 +00006201 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
6202 thread1.start()
6203 time.sleep(randint(50,60))
6204 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
6205 thread2.start()
6206 time.sleep(10)
6207 thread1.join()
6208 thread2.join()
6209 try:
6210 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00006211 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 +00006212 time.sleep(10)
6213 finally:
6214 pass
6215 df.callback(0)
6216 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
6217 return df
6218
6219 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00006220 def test_two_subscribers_with_voltha_for_igmp_disabling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006221 """
6222 Test Method:
6223 0. Make sure that voltha is up and running on CORD-POD setup.
6224 1. OLT and ONU is detected and validated.
6225 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6226 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6227 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6228 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6229 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6230 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6231 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6232 9. Disable olt device which is being shown on voltha CLI.
6233 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6234 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6235 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006236 df = defer.Deferred()
6237 def igmp_flow_check_operating_olt_admin_disble(df):
6238 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006239 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006240 services = ('IGMP')
6241 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
6242 port_list = self.generate_port_list(num_subscribers, num_channels)
6243
Thangavelu K S9a637332017-08-01 23:22:23 +00006244 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 +00006245 thread1.start()
6246 time.sleep(randint(50,60))
6247 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
6248 thread2.start()
6249 time.sleep(10)
6250 thread1.join()
6251 thread2.join()
6252 try:
6253 assert_equal(self.success, False)
6254 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
6255 time.sleep(10)
6256 finally:
6257 pass
6258 df.callback(0)
6259 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
6260 return df
6261
6262 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00006263 def test_two_subscribers_with_voltha_for_igmp_pausing_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006264 """
6265 Test Method:
6266 0. Make sure that voltha is up and running on CORD-POD setup.
6267 1. OLT and ONU is detected and validated.
6268 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6269 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6270 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6271 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6272 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6273 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6274 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6275 9. Pause olt device which is being shown on voltha CLI.
6276 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6277 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6278 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006279 df = defer.Deferred()
6280 def igmp_flow_check_operating_olt_admin_pause(df):
6281 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006282 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006283 services = ('IGMP')
6284 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
6285 port_list = self.generate_port_list(num_subscribers, num_channels)
6286
Thangavelu K S9a637332017-08-01 23:22:23 +00006287 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 +00006288 thread1.start()
6289 time.sleep(randint(50,60))
6290 thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,))
6291 thread2.start()
6292 time.sleep(10)
6293 thread1.join()
6294 thread2.join()
6295 try:
6296 assert_equal(self.success, False)
6297 log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test')
6298 time.sleep(10)
6299 finally:
6300 pass
6301 df.callback(0)
6302 reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df)
6303 return df
6304
6305 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00006306 def test_two_subscribers_with_voltha_for_igmp_toggling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006307 """
6308 Test Method:
6309 0. Make sure that voltha is up and running on CORD-POD setup.
6310 1. OLT and ONU is detected and validated.
6311 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6312 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6313 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6314 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6315 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6316 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6317 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6318 9. Disable olt device which is being shown on voltha CLI.
6319 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6320 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6321 12. Enable olt device which is disable at step 9.
6322 13. Repeat steps 4,5, 7 and 8.
6323 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006324 df = defer.Deferred()
6325 def igmp_flow_check_operating_olt_admin_restart(df):
6326 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006327 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006328 services = ('IGMP')
6329 cbs = (self.igmp_flow_check, None, None)
6330 port_list = self.generate_port_list(num_subscribers, num_channels)
6331
Thangavelu K S9a637332017-08-01 23:22:23 +00006332 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 +00006333 thread1.start()
6334 time.sleep(randint(50,60))
6335 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
6336 thread2.start()
6337 time.sleep(10)
6338 thread1.join()
6339 thread2.join()
6340 try:
6341 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00006342 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 +00006343 time.sleep(10)
6344 finally:
6345 pass
6346 df.callback(0)
6347 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
6348 return df
Thangavelu K S6432b522017-07-22 00:05:54 +00006349
6350 @deferred(TESTCASE_TIMEOUT)
6351 def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self):
6352 """
6353 Test Method:
6354 0. Make sure that voltha is up and running on CORD-POD setup.
6355 1. OLT and ONU is detected and validated.
6356 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6357 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6358 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6359 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6360 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6361 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6362 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6363 9. Disable olt device which is being shown on voltha CLI.
6364 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6365 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6366 12. Repeat steps 4 to 11 steps multiple times (example 20 times)
6367 """
6368 df = defer.Deferred()
6369 no_iterations = 20
6370 def igmp_flow_check_operating_olt_admin_disble(df):
6371 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006372 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00006373 services = ('IGMP')
6374 cbs = (self.igmp_flow_check, None, None)
6375 port_list = self.generate_port_list(num_subscribers, num_channels)
6376
Thangavelu K S9a637332017-08-01 23:22:23 +00006377 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 +00006378 thread1.start()
6379 time.sleep(randint(30,40))
6380 for i in range(no_iterations):
6381 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
6382 thread2.start()
6383 time.sleep(8)
6384 thread2.join()
6385 thread1.join()
6386 thread1.isAlive()
6387 thread2.join()
6388 try:
6389 assert_equal(self.success, False)
6390 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
6391 time.sleep(10)
6392 finally:
6393 pass
6394 df.callback(0)
6395 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
6396 return df
6397
6398 @deferred(TESTCASE_TIMEOUT + 200)
6399 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self):
6400 """
6401 Test Method:
6402 0. Make sure that voltha is up and running on CORD-POD setup.
6403 1. OLT and ONU is detected and validated.
6404 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6405 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6406 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6407 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6408 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6409 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6410 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6411 9. Disable uni_2 port which is being shown on voltha CLI.
6412 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6413 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6414 12. Enable uni_2 port which we disable at step 9.
6415 13. Repeat step 5,6 and 8.
6416 14. Repeat steps 4 to 13 steps multiple times (example 5 times)
6417 """
6418 df = defer.Deferred()
6419 no_iterations = 5
6420 def igmp_flow_check_operating_onu_admin_state(df):
6421 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006422 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00006423 services = ('IGMP')
6424 cbs = (self.igmp_flow_check, None, None)
6425 port_list = self.generate_port_list(num_subscribers, num_channels)
6426
Thangavelu K S9a637332017-08-01 23:22:23 +00006427 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 +00006428 thread1.start()
6429 time.sleep(randint(40,60))
6430 for i in range(no_iterations):
6431 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
6432 log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha')
6433 thread2.start()
6434 time.sleep(1)
6435 thread2.join()
6436 thread1.isAlive()
6437 thread1.join()
6438 thread2.join()
6439 try:
6440 assert_equal(self.success, True)
6441 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful')
6442 time.sleep(10)
6443 finally:
6444 pass
6445 df.callback(0)
6446 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
6447 return df
6448
6449 @deferred(TESTCASE_TIMEOUT)
6450 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self):
6451 """
6452 Test Method:
6453 0. Make sure that voltha is up and running on CORD-POD setup.
6454 1. OLT and ONU is detected and validated.
6455 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6456 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6457 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6458 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6459 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6460 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6461 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6462 9. Disable olt device which is being shown on voltha CLI.
6463 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6464 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6465 12. Enable olt device which is disable at step 9.
6466 13. Repeat steps 4,5, 7 and 8.
6467 14. Repeat steps 4 to 13 steps multiple times (example 10 times)
6468 """
6469 df = defer.Deferred()
6470 no_iterations = 10
6471 def igmp_flow_check_operating_olt_admin_restart(df):
6472 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006473 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00006474 services = ('IGMP')
6475 cbs = (self.igmp_flow_check, None, None)
6476 port_list = self.generate_port_list(num_subscribers, num_channels)
6477
Thangavelu K S9a637332017-08-01 23:22:23 +00006478 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 +00006479 thread1.start()
6480 time.sleep(randint(50,60))
6481 for i in range(no_iterations):
6482 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
6483 thread2.start()
6484 time.sleep(10)
6485 thread2.join()
6486 thread1.join()
6487 thread2.join()
6488 try:
6489 assert_equal(self.success, True)
6490 log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful')
6491 time.sleep(10)
6492 finally:
6493 pass
6494 df.callback(0)
6495 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
6496 return df
6497
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00006498 def test_five_subscribers_with_voltha_for_igmp_with_ten_group_joins_verifying_traffic(self):
Thangavelu K S6432b522017-07-22 00:05:54 +00006499 """
6500 Test Method:
6501 0. Make sure that voltha is up and running on CORD-POD setup.
6502 1. OLT and ONU is detected and validated.
6503 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
6504 3. Issue multiple dhcp client packets to get IP address from dhcp server for as subscribers and check connectivity.
6505 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
6506 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
6507 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
6508 """
6509
6510 num_subscribers = 5
6511 num_channels = 10
6512 services = ('IGMP')
6513 cbs = (self.igmp_flow_check, None, None)
6514 self.voltha_subscribers(services, cbs = cbs,
6515 num_subscribers = num_subscribers,
6516 num_channels = num_channels)
6517
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00006518 def test_nine_subscribers_with_voltha_for_igmp_with_ten_group_joins_and_verify_traffic(self):
Thangavelu K S6432b522017-07-22 00:05:54 +00006519 """
6520 Test Method:
6521 0. Make sure that voltha is up and running on CORD-POD setup.
6522 1. OLT and ONU is detected and validated.
6523 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
6524 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity.
6525 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
6526 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
6527 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
6528 """
6529 num_subscribers = 9
6530 num_channels = 10
6531 services = ('IGMP')
6532 cbs = (self.igmp_flow_check, None, None)
6533 self.voltha_subscribers(services, cbs = cbs,
6534 num_subscribers = num_subscribers,
6535 num_channels = num_channels)