blob: 74bae5279c40bd80e99d6d16d8b3bb51f2a473eb [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 Karthick18d0fb62017-09-01 18:49:07 -0700220 VOLTHA_TEARDOWN = True
A R Karthick35495c32017-05-11 14:58:32 -0700221 voltha = None
A R Karthick53442712017-07-27 12:23:30 -0700222 voltha_attrs = None
Thangavelu K S9648eed2017-06-13 20:15:25 +0000223 success = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +0000224 olt_device_id = None
A R Karthick168e2342017-08-15 16:13:10 -0700225 apps = ('org.opencord.aaa', 'org.onosproject.dhcp',)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000226 #apps = ('org.opencord.aaa', 'org.onosproject.dhcp', 'org.onosproject.dhcprelay')
A R Karthick168e2342017-08-15 16:13:10 -0700227 app_dhcp = ('org.onosproject.dhcp',)
228 app_dhcprelay = ('org.onosproject.dhcprelay',)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000229 olt_apps = () #'org.opencord.cordmcast')
230 vtn_app = 'org.opencord.vtn'
231 table_app = 'org.ciena.cordigmp'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000232 test_path = os.path.dirname(os.path.realpath(__file__))
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000233 dhcp_data_dir = os.path.join(test_path, '..', 'setup')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000234 table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700235 app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000236 olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar')
A.R Karthick3493a572017-06-07 18:28:10 -0700237 olt_app_name = 'org.onosproject.olt'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000238 #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
239 olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
240 onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
A R Karthick9dc6e922017-07-12 14:40:16 -0700241 VOLTHA_AUTO_CONFIGURE = False
Thangavelu K S8e413082017-07-13 20:02:14 +0000242 num_joins = 0
243
Thangavelu K S6432b522017-07-22 00:05:54 +0000244 relay_interfaces_last = ()
245 interface_to_mac_map = {}
246 host_ip_map = {}
247 default_config = { 'default-lease-time' : 600, 'max-lease-time' : 7200, }
248 default_options = [ ('subnet-mask', '255.255.255.0'),
249 ('broadcast-address', '192.168.1.255'),
250 ('domain-name-servers', '192.168.1.1'),
251 ('domain-name', '"mydomain.cord-tester"'),
252 ]
253 ##specify the IP for the dhcp interface matching the subnet and subnet config
254 ##this is done for each interface dhcpd server would be listening on
255 default_subnet_config = [ ('192.168.1.2',
256'''
257subnet 192.168.1.0 netmask 255.255.255.0 {
258 range 192.168.1.10 192.168.1.100;
259}
260'''), ]
261
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000262 configs = {}
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000263 VOLTHA_ENABLED = True
264 INTF_TX_DEFAULT = 'veth2'
265 INTF_RX_DEFAULT = 'veth0'
Thangavelu K S9648eed2017-06-13 20:15:25 +0000266 INTF_2_RX_DEFAULT = 'veth6'
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000267 TESTCASE_TIMEOUT = 300
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000268 VOLTHA_IGMP_ITERATIONS = 10
269# VOLTHA_CONFIG_FAKE = True
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000270 VOLTHA_CONFIG_FAKE = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000271 VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
A R Karthick53442712017-07-27 12:23:30 -0700272 VOLTHA_UPLINK_VLAN_START = 444
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000273 VOLTHA_ONU_UNI_PORT = 'veth0'
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000274
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000275 dhcp_server_config = {
276 "ip": "10.1.11.50",
277 "mac": "ca:fe:ca:fe:ca:fe",
278 "subnet": "255.255.252.0",
279 "broadcast": "10.1.11.255",
280 "router": "10.1.8.1",
281 "domain": "8.8.8.8",
282 "ttl": "63",
283 "delay": "2",
284 "startip": "10.1.11.51",
285 "endip": "10.1.11.100"
286 }
287
288
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000289 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
290MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
291CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
292IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
293RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
294MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
295BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
296hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
297gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
298+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
299rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
300VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
301eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
3026tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
303PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
304nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
305-----END CERTIFICATE-----"""
306
307 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
308MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
309CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
310IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
311RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
312MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
313BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
314hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
315AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
3165An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
317tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
318OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
319qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
3202Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
321BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
322eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
323MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
324VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
325RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
326dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
327T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
328yg==
329-----END CERTIFICATE-----'''
A R Karthick35495c32017-05-11 14:58:32 -0700330
A.R Karthick3493a572017-06-07 18:28:10 -0700331 @classmethod
332 def update_apps_version(cls):
333 version = Onos.getVersion()
334 major = int(version.split('.')[0])
335 minor = int(version.split('.')[1])
336 cordigmp_app_version = '2.0-SNAPSHOT'
337 olt_app_version = '1.2-SNAPSHOT'
338 if major > 1:
339 cordigmp_app_version = '3.0-SNAPSHOT'
340 olt_app_version = '2.0-SNAPSHOT'
341 elif major == 1:
342 if minor > 10:
343 cordigmp_app_version = '3.0-SNAPSHOT'
344 olt_app_version = '2.0-SNAPSHOT'
345 elif minor <= 8:
346 olt_app_version = '1.1-SNAPSHOT'
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700347 cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version))
348 cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version))
349 cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
350
A R Karthick35495c32017-05-11 14:58:32 -0700351 @classmethod
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000352 def voltha_dhcprelay_setUpClass(cls):
Thangavelu K S6432b522017-07-22 00:05:54 +0000353 ''' Activate the dhcprelay app'''
354 OnosCtrl(cls.app_dhcp).deactivate()
355 time.sleep(3)
356 cls.onos_ctrl = OnosCtrl('org.onosproject.dhcprelay')
357 status, _ = cls.onos_ctrl.activate()
358 assert_equal(status, True)
359 time.sleep(3)
360 cls.dhcp_relay_setup()
361 ##start dhcpd initially with default config
362 cls.dhcpd_start()
363
364 @classmethod
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000365 def voltha_dhcprelay_tearDownClass(cls):
Thangavelu K S6432b522017-07-22 00:05:54 +0000366 '''Deactivate the dhcp relay app'''
367 try:
368 os.unlink('{}/dhcpd.conf'.format(cls.dhcp_data_dir))
369 os.unlink('{}/dhcpd.leases'.format(cls.dhcp_data_dir))
370 except: pass
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000371 onos_ctrl = OnosCtrl(cls.app_dhcprelay)
372 onos_ctrl.deactivate()
Thangavelu K S6432b522017-07-22 00:05:54 +0000373 cls.dhcpd_stop()
374 cls.dhcp_relay_cleanup()
375
376 @classmethod
A.R Karthickf874d032017-06-07 18:47:51 -0700377 def onos_load_config(cls, app, config):
378 status, code = OnosCtrl.config(config)
379 if status is False:
380 log_test.info('JSON config request for app %s returned status %d' %(app, code))
381 assert_equal(status, True)
382 time.sleep(2)
383
384 @classmethod
385 def onos_aaa_load(cls):
386 aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
387 'radiusIp': '172.17.0.2' } } } }
388 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
389 aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip
390 cls.onos_load_config('org.opencord.aaa', aaa_dict)
391
392 @classmethod
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000393 def onos_dhcp_table_load(self, config = None):
394 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
395 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
396 if config:
397 for k in config.keys():
398 if dhcp_config.has_key(k):
399 dhcp_config[k] = config[k]
400 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
401
Thangavelu K S36edb012017-07-05 18:24:12 +0000402 def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = None):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000403 if validation:
Thangavelu K S735a6662017-06-15 18:08:23 +0000404 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
405 assert_not_equal(cip, None)
406 assert_not_equal(sip, None)
407 log_test.info('Got dhcp client IP %s from server %s for mac %s' %
408 (cip, sip, dhcp.get_mac(cip)[0]))
409 if validation == False:
410 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
411 assert_equal(cip, None)
412 assert_equal(sip, None)
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000413 log_test.info('Dhcp client did not get IP from server')
Thangavelu K S735a6662017-06-15 18:08:23 +0000414
Thangavelu K S36edb012017-07-05 18:24:12 +0000415 if validation == 'skip':
416 cip, sip = dhcp.discover(mac = mac, update_seed = update_seed)
417
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000418 return cip,sip
419
Thangavelu K S36edb012017-07-05 18:24:12 +0000420 def dhcp_request(self, onu_iface = None, seed_ip = '10.10.10.1', update_seed = False, validation = None, startip = '10.10.10.20', mac = None):
421 config = {'startip':startip, 'endip':'10.10.10.200',
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000422 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
423 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
424 self.onos_dhcp_table_load(config)
425 dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface)
Thangavelu K S36edb012017-07-05 18:24:12 +0000426 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed, validation = validation, mac = mac)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000427 return cip, sip
428
429 @classmethod
A R Karthick35495c32017-05-11 14:58:32 -0700430 def setUpClass(cls):
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700431 cls.update_apps_version()
A R Karthick53442712017-07-27 12:23:30 -0700432 cls.voltha_attrs = dict(host = cls.VOLTHA_HOST,
433 rest_port = cls.VOLTHA_REST_PORT,
434 uplink_vlan_map = cls.VOLTHA_UPLINK_VLAN_MAP,
435 uplink_vlan_start = cls.VOLTHA_UPLINK_VLAN_START)
436 cls.voltha = VolthaCtrl(**cls.voltha_attrs)
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000437 cls.install_app_table()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000438 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
439 cls.port_map, cls.port_list = cls.olt.olt_port_map()
440 cls.switches = cls.port_map['switches']
Thangavelu K S36edb012017-07-05 18:24:12 +0000441 cls.ponsim_ports = cls.port_map['ponsim']
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000442 cls.num_ports = cls.port_map['num_ports']
443 if cls.num_ports > 1:
444 cls.num_ports -= 1 ##account for the tx port
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000445 cls.activate_apps(cls.apps + cls.olt_apps, deactivate = True)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000446 cls.deactivate_apps(cls.app_dhcprelay)
A.R Karthickf874d032017-06-07 18:47:51 -0700447 cls.onos_aaa_load()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000448
A.R Karthick3493a572017-06-07 18:28:10 -0700449 @classmethod
450 def tearDownClass(cls):
451 '''Deactivate the olt apps and restart OVS back'''
452 apps = cls.olt_apps + ( cls.table_app,)
453 for app in apps:
454 onos_ctrl = OnosCtrl(app)
455 onos_ctrl.deactivate()
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000456 cls.deactivate_apps(cls.app_dhcprelay)
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000457 cls.install_app_igmp()
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000458 log_test.info('TearDownClass Restarting the Radius Server in the TA setup')
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000459 cord_test_radius_restart()
460
A.R Karthick3493a572017-06-07 18:28:10 -0700461 @classmethod
462 def install_app_igmp(cls):
463 ##Uninstall the table app on class exit
464 OnosCtrl.uninstall_app(cls.table_app)
465 time.sleep(2)
466 log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file))
467 OnosCtrl.install_app(cls.app_file)
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700468
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000469 def remove_olt(self, switch_map):
470 controller = get_controller()
471 auth = ('karaf', 'karaf')
472 #remove subscriber for every port on all the voltha devices
473 for device, device_map in switch_map.iteritems():
474 uni_ports = device_map['ports']
475 uplink_vlan = device_map['uplink_vlan']
476 for port in uni_ports:
477 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller,
478 device,
479 port)
480 resp = requests.delete(rest_url, auth = auth)
481 if resp.status_code not in [204, 202, 200]:
482 log_test.error('Error deleting subscriber for device %s on port %s' %(device, port))
483 else:
484 log_test.info('Deleted subscriber for device %s on port %s' %(device, port))
485 OnosCtrl.uninstall_app(self.olt_app_file)
486
487 def config_olt(self, switch_map):
488 controller = get_controller()
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000489 auth = ('karaf', 'karaf')
490 #configure subscriber for every port on all the voltha devices
491 for device, device_map in switch_map.iteritems():
492 uni_ports = device_map['ports']
493 uplink_vlan = device_map['uplink_vlan']
494 for port in uni_ports:
495 vlan = port
496 rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller,
497 device,
498 port,
499 vlan)
500 resp = requests.post(rest_url, auth = auth)
501 #assert_equal(resp.ok, True)
502
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000503 def voltha_uni_port_toggle(self, uni_port = None):
504 ## Admin state of port is down and up
505 if not uni_port:
506 uni_port = self.INTF_RX_DEFAULT
507 cmd = 'ifconfig {} down'.format(uni_port)
508 os.system(cmd)
509 log_test.info('Admin state of uni_port is down')
510 time.sleep(30)
511 cmd = 'ifconfig {} up'.format(uni_port)
512 os.system(cmd)
513 log_test.info('Admin state of uni_port is up now')
514 time.sleep(30)
515 return
516
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000517 @classmethod
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000518 def install_app_table(cls):
519 ##Uninstall the existing app if any
520 OnosCtrl.uninstall_app(cls.table_app)
521 time.sleep(2)
522 log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file))
523 OnosCtrl.install_app(cls.table_app_file)
524 time.sleep(3)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000525
526 @classmethod
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000527 def activate_apps(cls, apps, deactivate = False):
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000528 for app in apps:
529 onos_ctrl = OnosCtrl(app)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000530 if deactivate is True:
531 onos_ctrl.deactivate()
532 time.sleep(2)
A R Karthick168e2342017-08-15 16:13:10 -0700533 log_test.info('Activating app %s' %app)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000534 status, _ = onos_ctrl.activate()
535 assert_equal(status, True)
536 time.sleep(2)
537
Thangavelu K S735a6662017-06-15 18:08:23 +0000538 @classmethod
539 def deactivate_apps(cls, apps):
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000540 cls.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000541 for app in apps:
542 onos_ctrl = OnosCtrl(app)
A R Karthick168e2342017-08-15 16:13:10 -0700543 log_test.info('Deactivating app %s' %app)
Thangavelu K S735a6662017-06-15 18:08:23 +0000544 status, _ = onos_ctrl.deactivate()
545 if status is False:
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000546 cls.success = False
547 # assert_equal(status, True)
Thangavelu K S735a6662017-06-15 18:08:23 +0000548 time.sleep(2)
549
Thangavelu K S36edb012017-07-05 18:24:12 +0000550 def random_ip(self,start_ip = '10.10.10.20', end_ip = '10.10.10.65'):
551 start = list(map(int, start_ip.split(".")))
552 end = list(map(int, end_ip.split(".")))
553 temp = start
554 ip_range = []
555 ip_range.append(start_ip)
556 while temp != end:
557 start[3] += 1
558 for i in (3, 2, 1):
559 if temp[i] == 255:
560 temp[i] = 0
561 temp[i-1] += 1
562 ip_range.append(".".join(map(str, temp)))
563 return random.choice(ip_range)
564
Thangavelu K S8e413082017-07-13 20:02:14 +0000565 def random_mcast_ip(self,start_ip = '224.0.1.0', end_ip = '224.0.1.100'):
566 start = list(map(int, start_ip.split(".")))
567 end = list(map(int, end_ip.split(".")))
568 temp = start
569 ip_range = []
570 ip_range.append(start_ip)
571 while temp != end:
572 start[3] += 1
573 for i in (3, 2, 1):
574 if temp[i] == 255:
575 temp[i] = 0
576 temp[i-1] += 1
577 ip_range.append(".".join(map(str, temp)))
578 return random.choice(ip_range)
579
Thangavelu K S6432b522017-07-22 00:05:54 +0000580 @classmethod
581 def dhcp_relay_setup(cls):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000582 did = OnosCtrl.get_device_id()
583 cls.relay_device_id = did
584 cls.relay_device_id = 'of:0000000000000001'
585 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
586 cls.port_map, _ = cls.olt.olt_port_map()
Thangavelu K S6432b522017-07-22 00:05:54 +0000587 if cls.port_map:
588 ##Per subscriber, we use 1 relay port
589 try:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000590 relay_port = cls.port_map[cls.port_map['relay_ports'][0]]
Thangavelu K S6432b522017-07-22 00:05:54 +0000591 except:
592 relay_port = cls.port_map['uplink']
593 cls.relay_interface_port = relay_port
594 cls.relay_interfaces = (cls.port_map[cls.relay_interface_port],)
595 else:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000596 cls.relay_interface_port = 100
597 cls.relay_interfaces = (g_subscriber_port_map[cls.relay_interface_port],)
Thangavelu K S6432b522017-07-22 00:05:54 +0000598 cls.relay_interfaces_last = cls.relay_interfaces
599 if cls.port_map:
600 ##generate a ip/mac client virtual interface config for onos
601 interface_list = []
602 for port in cls.port_map['ports']:
603 port_num = cls.port_map[port]
604 if port_num == cls.port_map['uplink']:
605 continue
606 ip = cls.get_host_ip(port_num)
607 mac = cls.get_mac(port)
608 interface_list.append((port_num, ip, mac))
609
610 #configure dhcp server virtual interface on the same subnet as first client interface
611 relay_ip = cls.get_host_ip(interface_list[0][0])
612 relay_mac = cls.get_mac(cls.port_map[cls.relay_interface_port])
613 interface_list.append((cls.relay_interface_port, relay_ip, relay_mac))
614 cls.onos_interface_load(interface_list)
615
616 @classmethod
617 def onos_interface_load(cls, interface_list):
618 interface_dict = { 'ports': {} }
619 for port_num, ip, mac in interface_list:
620 port_map = interface_dict['ports']
621 port = '{}/{}'.format(cls.relay_device_id, port_num)
622 port_map[port] = { 'interfaces': [] }
623 interface_list = port_map[port]['interfaces']
624 interface_map = { 'ips' : [ '{}/{}'.format(ip, 24) ],
625 'mac' : mac,
626 'name': 'vir-{}'.format(port_num)
627 }
628 interface_list.append(interface_map)
629
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000630 cls.onos_load_config('org.onosproject.dhcprelay', interface_dict)
Thangavelu K S6432b522017-07-22 00:05:54 +0000631 cls.configs['interface_config'] = interface_dict
632
633 @classmethod
634 def get_host_ip(cls, port):
635 if cls.host_ip_map.has_key(port):
636 return cls.host_ip_map[port]
637 cls.host_ip_map[port] = '192.168.1.{}'.format(port)
638 return cls.host_ip_map[port]
639
640 @classmethod
641 def host_load(cls, iface):
642 '''Have ONOS discover the hosts for dhcp-relay responses'''
643 port = g_subscriber_port_map[iface]
644 host = '173.17.1.{}'.format(port)
645 cmds = ( 'ifconfig {} 0'.format(iface),
646 'ifconfig {0} {1}'.format(iface, host),
647 'arping -I {0} {1} -c 2'.format(iface, host),
648 'ifconfig {} 0'.format(iface), )
649 for c in cmds:
650 os.system(c)
651
652 @classmethod
653 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
654 subnet = default_subnet_config):
655 conf = ''
656 for k, v in config.items():
657 conf += '{} {};\n'.format(k, v)
658
659 opts = ''
660 for k, v in options:
661 opts += 'option {} {};\n'.format(k, v)
662
663 subnet_config = ''
664 for _, v in subnet:
665 subnet_config += '{}\n'.format(v)
666
667 return '{}{}{}'.format(conf, opts, subnet_config)
668
669 @classmethod
670 def dhcpd_start(cls, intf_list = None,
671 config = default_config, options = default_options,
672 subnet = default_subnet_config):
673 '''Start the dhcpd server by generating the conf file'''
674 if intf_list is None:
675 intf_list = cls.relay_interfaces
676 ##stop dhcpd if already running
677 cls.dhcpd_stop()
678 dhcp_conf = cls.dhcpd_conf_generate(config = config, options = options,
679 subnet = subnet)
680 ##first touch dhcpd.leases if it doesn't exist
681 lease_file = '{}/dhcpd.leases'.format(cls.dhcp_data_dir)
682 if os.access(lease_file, os.F_OK) is False:
683 with open(lease_file, 'w') as fd: pass
684
685 conf_file = '{}/dhcpd.conf'.format(cls.dhcp_data_dir)
686 with open(conf_file, 'w') as fd:
687 fd.write(dhcp_conf)
688
689 #now configure the dhcpd interfaces for various subnets
690 index = 0
691 intf_info = []
692 for ip,_ in subnet:
693 intf = intf_list[index]
694 mac = cls.get_mac(intf)
695 intf_info.append((ip, mac))
696 index += 1
697 os.system('ifconfig {} {}'.format(intf, ip))
698
699 intf_str = ','.join(intf_list)
700 dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format(conf_file, lease_file, intf_str)
701 log_test.info('Starting DHCPD server with command: %s' %dhcpd_cmd)
702 ret = os.system(dhcpd_cmd)
703 assert_equal(ret, 0)
704 time.sleep(3)
705 cls.relay_interfaces_last = cls.relay_interfaces
706 cls.relay_interfaces = intf_list
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000707 cls.onos_dhcp_relay_load_1(*intf_info[0])
Thangavelu K S6432b522017-07-22 00:05:54 +0000708
709 @classmethod
710 def dhcpd_stop(cls):
711 os.system('pkill -9 dhcpd')
712 for intf in cls.relay_interfaces:
713 os.system('ifconfig {} 0'.format(intf))
714
715 cls.relay_interfaces = cls.relay_interfaces_last
716
717 @classmethod
718 def get_mac(cls, iface):
719 if cls.interface_to_mac_map.has_key(iface):
720 return cls.interface_to_mac_map[iface]
721 mac = get_mac(iface, pad = 0)
722 cls.interface_to_mac_map[iface] = mac
723 return mac
724
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000725 def send_recv(self, mac=None, update_seed = False, validate = True, dhcp_obj = None):
726 if dhcp_obj is None:
727 dhcp_obj = self.dhcp
728 cip, sip = dhcp_obj.discover(mac = mac, update_seed = update_seed)
Thangavelu K S6432b522017-07-22 00:05:54 +0000729 if validate:
730 assert_not_equal(cip, None)
731 assert_not_equal(sip, None)
732 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 +0000733 (cip, sip, dhcp_obj.get_mac(cip)[0]))
Thangavelu K S6432b522017-07-22 00:05:54 +0000734 return cip,sip
735
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +0000736 def send_recv_function_in_thread(self, mac=None, update_seed = False, validate = False, dhcp_obj = None):
737 self.success = True
738 cip, sip = self.send_recv(mac=mac,update_seed=update_seed,validate=validate,dhcp_obj = dhcp_obj)
739 if cip is None or sip is None:
740 self.success = False
741
Thangavelu K S6432b522017-07-22 00:05:54 +0000742 @classmethod
743 def dhcpd_conf_generate(cls, config = default_config, options = default_options,
744 subnet = default_subnet_config):
745 conf = ''
746 for k, v in config.items():
747 conf += '{} {};\n'.format(k, v)
748
749 opts = ''
750 for k, v in options:
751 opts += 'option {} {};\n'.format(k, v)
752
753 subnet_config = ''
754 for _, v in subnet:
755 subnet_config += '{}\n'.format(v)
756
757 return '{}{}{}'.format(conf, opts, subnet_config)
758
759 @classmethod
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000760 def onos_dhcp_relay_load_1(cls, server_ip, server_mac):
Thangavelu K S6432b522017-07-22 00:05:54 +0000761 relay_device_map = '{}/{}'.format(cls.relay_device_id, cls.relay_interface_port)
762 dhcp_dict = {'apps':{'org.onosproject.dhcp-relay':{'dhcprelay':
763 {'dhcpserverConnectPoint':relay_device_map,
764 'serverip':server_ip,
765 'servermac':server_mac
766 }
767 }
768 }
769 }
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +0000770 cls.onos_load_config(cls.app_dhcprelay,dhcp_dict)
Thangavelu K S6432b522017-07-22 00:05:54 +0000771 cls.configs['relay_config'] = dhcp_dict
772
773 @classmethod
774 def dhcp_relay_cleanup(cls):
775 ##reset the ONOS port configuration back to default
776 for config in cls.configs.items():
777 OnosCtrl.delete(config)
778 # if cls.onos_restartable is True:
779 # log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
780 # return cord_test_onos_restart(config = {})
781
782
Thangavelu K S8e413082017-07-13 20:02:14 +0000783 def tls_flow_check(self, olt_ports, cert_info = None, multiple_sub = False):
784 if multiple_sub is True:
785 olt_nni_port = olt_ports.tx_port
786 olt_uni_port = olt_ports.rx_port
787 else:
Thangavelu K S36edb012017-07-05 18:24:12 +0000788 olt_uni_port = olt_ports
789
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000790 def tls_fail_cb():
791 log_test.info('TLS verification failed')
792 if cert_info is None:
A.R Karthickb9eab5a2017-06-07 16:03:51 -0700793 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000794 log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port)
795 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000796 if tls.failTest is True:
797 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000798 assert_equal(tls.failTest, False)
799 if cert_info == "no_cert":
800 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '')
801 log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port)
802 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000803 if tls.failTest is False:
804 self.success = False
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000805 assert_equal(tls.failTest, True)
806 if cert_info == "invalid_cert":
807 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
808 log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port)
809 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000810 if tls.failTest is False:
811 self.success = False
812 assert_equal(tls.failTest, True)
813 if cert_info == "same_cert":
814 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000815 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 +0000816 tls.runTest()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000817 if tls.failTest is True:
Thangavelu K S9648eed2017-06-13 20:15:25 +0000818 self.success = False
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +0000819 assert_equal(tls.failTest, False)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000820 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 +0000821 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 +0000822 tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID)
823 log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info))
824 tls.runTest()
Thangavelu K S9648eed2017-06-13 20:15:25 +0000825 if tls.failTest is False:
826 self.success = False
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +0000827 assert_equal(tls.failTest, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +0000828 self.test_status = True
829 return self.test_status
A R Karthick35495c32017-05-11 14:58:32 -0700830
Thangavelu K S8e413082017-07-13 20:02:14 +0000831 def dhcp_flow_check(self, olt_ports, negative_test = None, multiple_sub = False):
832 if multiple_sub is True:
833 olt_nni_port = olt_ports.tx_port
834 onu_iface = olt_ports.rx_port
Thangavelu K S36edb012017-07-05 18:24:12 +0000835 dhcp_server_startip = self.random_ip()
836 random_mac = '00:00:00:0a:0a:' + hex(random.randrange(50,254)).split('x')[1]
Thangavelu K S8e413082017-07-13 20:02:14 +0000837 else:
838 onu_iface = olt_ports
839 dhcp_server_startip = '10.10.10.20'
840 random_mac = None
Thangavelu K S735a6662017-06-15 18:08:23 +0000841 self.success = True
842
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000843 if negative_test is None:
Thangavelu K S36edb012017-07-05 18:24:12 +0000844 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = 'skip', startip = dhcp_server_startip, mac = random_mac)
845 if cip == None or sip == None:
Thangavelu K S735a6662017-06-15 18:08:23 +0000846 self.success = False
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000847 self.test_status = False
848 assert_not_equal(cip,None)
849 assert_not_equal(sip,None)
850 else:
851 log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip))
852 self.test_status = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000853
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000854 if negative_test == "interrupting_dhcp_flows":
855 cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False)
Thangavelu K S735a6662017-06-15 18:08:23 +0000856 if cip is not None:
857 self.success = False
858 assert_equal(cip,None)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000859 log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip))
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000860 self.test_status = True
861
862 if negative_test == "invalid_src_mac_broadcast":
863 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
864 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
865 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
866 self.onos_dhcp_table_load(config)
867 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
868 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
Thangavelu K S735a6662017-06-15 18:08:23 +0000869
870 if cip is not None:
871 self.success = False
Thangavelu K Sb006b8a2017-07-28 19:29:39 +0000872 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 +0000873 assert_equal(cip,None)
874 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
875 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000876
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000877 if negative_test == "invalid_src_mac_multicast":
878 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
879 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
880 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
881 self.onos_dhcp_table_load(config)
882 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
883 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4')
Thangavelu K S735a6662017-06-15 18:08:23 +0000884 if cip is not None:
885 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000886 assert_equal(cip,None)
887 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
888 self.test_status = True
889
890 if negative_test == "invalid_src_mac_junk":
891 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
892 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
893 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
894 self.onos_dhcp_table_load(config)
895 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
896 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
Thangavelu K S735a6662017-06-15 18:08:23 +0000897 if cip is not None:
898 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000899 assert_equal(cip,None)
900 log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected')
901 self.test_status = True
902
903 if negative_test == "request_release":
904 config = {'startip':'10.10.100.20', 'endip':'10.10.100.230',
905 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
906 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
907 self.onos_dhcp_table_load(config)
908 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface)
909 cip, sip = self.dhcp_sndrcv(self.dhcp)
910 log_test.info('Releasing ip %s to server %s' %(cip, sip))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000911 if not self.dhcp.release(cip):
912 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000913 assert_equal(self.dhcp.release(cip), True)
914 log_test.info('Triggering DHCP discover again after release')
915 cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True)
916 log_test.info('Verifying released IP was given back on rediscover')
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000917 if not cip == cip2:
Thangavelu K S735a6662017-06-15 18:08:23 +0000918 self.success = False
Thangavelu K Sa1c71b42017-06-14 18:13:21 +0000919 assert_equal(cip, cip2)
920 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
921 assert_equal(self.dhcp.release(cip2), True)
922 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000923
Thangavelu K S735a6662017-06-15 18:08:23 +0000924 if negative_test == "starvation_positive":
925 config = {'startip':'193.170.1.20', 'endip':'193.170.1.69',
926 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe",
927 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'}
928 self.onos_dhcp_table_load(config)
929 self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface)
930 ip_map = {}
931 for i in range(10):
932 cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True)
933 if ip_map.has_key(cip):
934 self.success = False
935 log_test.info('IP %s given out multiple times' %cip)
936 assert_equal(False, ip_map.has_key(cip))
937 ip_map[cip] = sip
938 self.test_status = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000939
Thangavelu K S735a6662017-06-15 18:08:23 +0000940 if negative_test == "starvation_negative":
941 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
942 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
943 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
944 self.onos_dhcp_table_load(config)
945 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface)
946 log_test.info('Verifying passitive case')
947 for x in xrange(50):
948 mac = RandMAC()._fix()
949 self.dhcp_sndrcv(self.dhcp,mac = mac)
950 log_test.info('Verifying negative case')
951 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000952 if cip or sip is not None:
953 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000954 assert_equal(cip, None)
955 assert_equal(sip, None)
956 self.test_status = True
957 self.success = True
Thangavelu K S8e413082017-07-13 20:02:14 +0000958
Thangavelu K S735a6662017-06-15 18:08:23 +0000959 if negative_test == "multiple_discover":
960 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
961 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
962 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
963 self.onos_dhcp_table_load(config)
964 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
965 cip, sip, mac, _ = self.dhcp.only_discover()
966 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
967 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000968 if cip is None:
969 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000970 assert_not_equal(cip, None)
971 log_test.info('Triggering DHCP discover again.')
972 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +0000973 if not new_cip == cip:
974 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +0000975 assert_equal(new_cip, cip)
976 log_test.info('client got same IP as expected when sent 2nd discovery')
977 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000978 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000979 if negative_test == "multiple_requests":
980 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
981 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
982 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
983 self.onos_dhcp_table_load(config)
984 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface)
985 log_test.info('Sending DHCP discover and DHCP request.')
986 cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True)
987 mac = self.dhcp.get_mac(cip)[0]
988 log_test.info("Sending DHCP request again.")
989 new_cip, new_sip = self.dhcp.only_request(cip, mac)
990 assert_equal(new_cip,cip)
991 log_test.info('server offered same IP to clain for multiple requests, as expected')
992 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +0000993# self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +0000994 if negative_test == "desired_ip_address":
995 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
996 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
997 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
998 self.onos_dhcp_table_load(config)
999 self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface)
1000 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001001 if cip or sip is None:
1002 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001003 assert_not_equal(cip, None)
1004 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1005 (cip, sip, mac))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001006 if not self.dhcp.seed_ip == cip:
1007 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001008 assert_equal(cip,self.dhcp.seed_ip)
1009 log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip)
1010 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001011 # self.success = True
Thangavelu K S735a6662017-06-15 18:08:23 +00001012 if negative_test == "desired_out_of_pool_ip_address":
1013 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1014 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1015 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1016 self.onos_dhcp_table_load(config)
1017 self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface)
1018 cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001019 if cip or sip is None:
1020 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001021 assert_not_equal(cip, None)
1022 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1023 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001024 if self.dhcp.seed_ip == cip:
1025 self.success = False
Thangavelu K S735a6662017-06-15 18:08:23 +00001026 assert_not_equal(cip,self.dhcp.seed_ip)
1027 log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected')
1028 self.test_status = True
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001029 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001030 if negative_test == "dhcp_renew":
1031 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1032 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1033 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1034 self.onos_dhcp_table_load(config)
1035 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1036 cip, sip, mac, _ = self.dhcp.only_discover()
1037 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1038 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001039 if cip or sip is None:
1040 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001041 assert_not_equal(cip, None)
1042 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
1043 log_test.info('waiting renew time %d seconds to send next request packet'%lval)
1044 time.sleep(lval)
1045 latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001046 if not latest_cip == cip:
1047 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001048 assert_equal(latest_cip,cip)
1049 log_test.info('client got same IP after renew time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001050 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001051 # self.success = True
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001052 if negative_test == "dhcp_rebind":
1053 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
1054 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
1055 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
1056 self.onos_dhcp_table_load(config)
1057 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface)
1058 cip, sip, mac, _ = self.dhcp.only_discover()
1059 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
1060 (cip, sip, mac) )
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001061 if cip or sip is None:
1062 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001063 assert_not_equal(cip, None)
1064 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
1065 log_test.info('waiting rebind time %d seconds to send next request packet'%lval)
1066 time.sleep(lval)
1067 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001068 if not latest_cip == cip:
1069 self.success = False
Thangavelu K S0f2c5232017-06-19 19:11:43 +00001070 assert_equal(latest_cip,cip)
1071 log_test.info('client got same IP after rebind time, as expected')
Thangavelu K S735a6662017-06-15 18:08:23 +00001072 self.test_status = True
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00001073 # self.success = True
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00001074 return self.test_status
1075
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00001076 def dhcprelay_flow_check(self, seed_ip = None, iface = None, mac= None, test_scenario = None):
1077 self.success = True
1078 if test_scenario is None:
1079 self.dhcp = DHCPTest(seed_ip = seed_ip, iface = iface)
1080 self.send_recv(mac=mac)
1081 elif test_scenario == 'multiple_discover':
1082 self.dhcp_2 = DHCPTest(seed_ip = seed_ip, iface = iface)
1083 cip, sip, mac, _ = self.dhcp_2.only_discover(mac=mac)
1084 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCP REQUEST.' %
1085 (cip, sip, mac) )
1086 if cip is None:
1087 self.success = False
1088 assert_not_equal(cip, None)
1089 log_test.info('Triggering DHCP discover again.')
1090 new_cip, new_sip, new_mac, _ = self.dhcp_2.only_discover(mac=mac)
1091 if new_cip != cip:
1092 self.success = False
1093 assert_equal(new_cip, cip)
1094 log_test.info('Got same ip to same the client when sent discover again, as expected')
1095
1096 elif test_scenario == 'desired_ip':
1097 self.dhcp_3 = DHCPTest(seed_ip = '192.168.1.31', iface = iface)
1098 cip, sip, mac, _ = self.dhcp_3.only_discover(mac=mac,desired = True)
1099 if cip != self.dhcp_3.seed_ip:
1100 self.success = False
1101 assert_equal(cip,self.dhcp_3.seed_ip)
1102 log_test.info('Got dhcp client desired IP %s from server %s for mac %s as expected' %
1103 (cip, sip, mac) )
1104
1105 elif test_scenario == 'out_of_pool_ip':
1106 self.dhcp = DHCPTest(seed_ip = '20.20.20.35', iface = iface)
1107 cip, sip, mac, _ = self.dhcp.only_discover(mac= mac,desired = True)
1108 if cip is None or cip == self.dhcp.seed_ip:
1109 self.success = False
1110 assert_not_equal(cip,None)
1111 assert_not_equal(cip,self.dhcp.seed_ip)
1112 log_test.info('server offered IP from its pool when requested out of pool IP, as expected')
1113 elif test_scenario == 'multiple_discover_1':
1114 pass
1115 return self.success
1116
Thangavelu K S8e413082017-07-13 20:02:14 +00001117 def recv_channel_cb(self, pkt):
1118 ##First verify that we have received the packet for the joined instance
1119 chan = self.subscriber.caddr(pkt[IP].dst)
1120 assert_equal(chan in self.subscriber.join_map.keys(), True)
1121 recv_time = monotonic.monotonic() * 1000000
1122 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
1123 delta = recv_time - join_time
1124 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
1125 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
1126 log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
1127 self.test_status = True
Thangavelu K S36edb012017-07-05 18:24:12 +00001128
Thangavelu K S8e413082017-07-13 20:02:14 +00001129 def traffic_verify(self, subscriber):
1130 # if subscriber.has_service('TRAFFIC'):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001131 url = 'http://www.google.com'
1132 resp = requests.get(url)
1133 self.test_status = resp.ok
1134 if resp.ok == False:
1135 log_test.info('Subscriber %s failed get from url %s with status code %d'
1136 %(subscriber.name, url, resp.status_code))
1137 else:
1138 log_test.info('GET request from %s succeeded for subscriber %s'
1139 %(url, subscriber.name))
1140 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001141
Thangavelu K S8e413082017-07-13 20:02:14 +00001142 def igmp_flow_check(self, subscriber, multiple_sub = False):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001143 chan = 0
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001144 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1145 if subscriber.num_channels == 1:
Thangavelu K S9a637332017-08-01 23:22:23 +00001146 if i != 0:
1147 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001148 chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1149 else:
1150 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1151 self.num_joins += 1
1152 while self.num_joins < self.num_subscribers:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001153 time.sleep(5)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001154 log_test.info('All subscribers have joined the channel')
1155 # for i in range(1):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001156 time.sleep(0.5)
1157 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1158 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1159 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
1160 time.sleep(5)
1161# 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 +00001162 if subscriber.num_channels == 1:
1163 pass
1164 elif chan != 0:
1165 #Should not receive packets for this channel
1166 self.recv_timeout = True
1167 subscriber.recv_timeout = True
1168 subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1169 subscriber.recv_timeout = False
1170 self.recv_timeout = False
Thangavelu K S9a637332017-08-01 23:22:23 +00001171 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 +00001172# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K S9a637332017-08-01 23:22:23 +00001173# chan = subscriber.num_channels - i
1174# self.test_status = True
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001175 return self.test_status
Thangavelu K S9a637332017-08-01 23:22:23 +00001176
1177 def igmp_join_next_channel_flow_check(self, subscriber, multiple_sub = False):
1178 chan = 0
1179 for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels):
1180# if subscriber.num_channels == 1:
1181# chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1182# else:
1183 chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list)
1184 self.num_joins += 1
1185 while self.num_joins < self.num_subscribers:
1186 time.sleep(5)
1187 log_test.info('All subscribers have joined the channel')
1188 # for i in range(1):
1189 time.sleep(0.5)
1190 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1191 #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1192 #subscriber.channel_leave(chan, src_list = subscriber.src_list)
1193 time.sleep(5)
1194# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1195# if subscriber.num_channels == 1:
1196# pass
1197# elif chan != 0:
1198# pass
1199 #Should not receive packets for this channel
1200# log_test.info
1201# self.recv_timeout = True
1202# subscriber.recv_timeout = True
1203# subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1204# subscriber.recv_timeout = False
1205# self.recv_timeout = False
1206# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1207# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001208 chan = subscriber.num_channels - i
Thangavelu K S8e413082017-07-13 20:02:14 +00001209# self.test_status = True
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00001210 return self.test_status
1211
Thangavelu K S36edb012017-07-05 18:24:12 +00001212
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001213 def igmp_leave_flow_check(self, subscriber, multiple_sub = False):
1214 chan = 0
1215 for i in range(self.VOLTHA_IGMP_ITERATIONS):
1216 subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1217 self.num_joins += 1
1218 while self.num_joins < self.num_subscribers:
1219 time.sleep(5)
1220 log_test.info('All subscribers have joined the channel')
1221# for i in range(1):
1222 time.sleep(0.5)
1223 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1224 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1225 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1226 time.sleep(10)
1227# log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1228 #Should not receive packets for this subscriber
1229 self.recv_timeout = True
1230 subscriber.recv_timeout = True
1231 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list)
1232 subscriber.recv_timeout = False
1233 self.recv_timeout = False
1234# log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1235# subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list)
1236# self.test_status = True
1237 return self.test_status
1238
1239
Thangavelu K S8e413082017-07-13 20:02:14 +00001240 def igmp_flow_check_join_change_to_exclude(self, subscriber, multiple_sub = False):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001241 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001242 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1243 for i in range(3):
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001244 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
Thangavelu K S9a637332017-08-01 23:22:23 +00001245 self.num_joins += 1
1246 while self.num_joins < self.num_subscribers:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001247 time.sleep(5)
Thangavelu K S9a637332017-08-01 23:22:23 +00001248 log_test.info('All subscribers have joined the channel')
1249 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1250 time.sleep(5)
1251 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]))
1252 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1253 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1254 time.sleep(60)
1255 self.recv_timeout = False
1256 subscriber.recv_timeout = False
1257 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1258 if self.test_status is True:
1259 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1260 if self.test_status is False:
1261 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1262 continue
1263 subscriber.recv_timeout = False
1264 self.recv_timeout = False
1265 subscriber.channel_leave(chan, src_list = subscriber.src_list)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001266# self.test_status = True
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001267 return self.test_status
Thangavelu K S36edb012017-07-05 18:24:12 +00001268
Thangavelu K S8e413082017-07-13 20:02:14 +00001269 def igmp_flow_check_join_change_to_exclude_again_include_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001270 chan = 0
1271 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1272 for i in range(3):
1273 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1274 self.num_joins += 1
1275 while self.num_joins < self.num_subscribers:
1276 time.sleep(5)
1277 log_test.info('All subscribers have joined the channel')
1278 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1279 time.sleep(5)
1280 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]))
1281 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1282 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1283 time.sleep(60)
1284 self.recv_timeout = False
1285 subscriber.recv_timeout = False
1286 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1287 if self.test_status is True:
1288 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1289 if self.test_status is False:
1290 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1291 continue
1292 subscriber.recv_timeout = False
1293 self.recv_timeout = False
1294 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1295 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_INCLUDE)
1296 time.sleep(5)
1297# self.recv_timeout = True
1298# subscriber.recv_timeout = True
1299 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1300 subscriber.recv_timeout = False
1301 self.recv_timeout = False
1302
1303
1304 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1305# self.test_status = True
1306 return self.test_status
1307
Thangavelu K S8e413082017-07-13 20:02:14 +00001308 def igmp_flow_check_join_change_to_block(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001309 chan = 0
1310 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1311 for i in range(3):
1312 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1313 self.num_joins += 1
1314 while self.num_joins < self.num_subscribers:
1315 time.sleep(5)
1316 log_test.info('All subscribers have joined the channel')
1317 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1318 time.sleep(5)
1319 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]))
1320 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_BLOCK_OLD)
1321 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1322 time.sleep(60)
1323 self.recv_timeout = False
1324 subscriber.recv_timeout = False
1325 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1326 if self.test_status is True:
1327 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1328 if self.test_status is False:
1329 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1330 continue
1331 subscriber.recv_timeout = False
1332 self.recv_timeout = False
1333 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1334# self.test_status = True
1335 return self.test_status
1336
Thangavelu K S36edb012017-07-05 18:24:12 +00001337
Thangavelu K S8e413082017-07-13 20:02:14 +00001338 def igmp_flow_check_join_change_to_block_again_allow_back(self, subscriber, multiple_sub = False):
Thangavelu K S9a637332017-08-01 23:22:23 +00001339 chan = 0
1340 #for i in range(self.VOLTHA_IGMP_ITERATIONS):
1341 for i in range(3):
1342 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1343 self.num_joins += 1
1344 while self.num_joins < self.num_subscribers:
1345 time.sleep(5)
1346 log_test.info('All subscribers have joined the channel')
1347 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1])
1348 time.sleep(5)
1349 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]))
1350 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1351 #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0]
1352 time.sleep(60)
1353 self.recv_timeout = False
1354 subscriber.recv_timeout = False
1355 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1])
1356 if self.test_status is True:
1357 self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0])
1358 if self.test_status is False:
1359 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1360 continue
1361 subscriber.recv_timeout = False
1362 self.recv_timeout = False
1363 log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0]))
1364 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_ALLOW_NEW)
1365 time.sleep(5)
1366# self.recv_timeout = True
1367# subscriber.recv_timeout = True
1368 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0])
1369 subscriber.recv_timeout = False
1370 self.recv_timeout = False
1371
1372
1373 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1374# self.test_status = True
1375 return self.test_status
Thangavelu K S8e413082017-07-13 20:02:14 +00001376
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001377 def igmp_flow_check_group_include_source_empty_list(self, subscriber, multiple_sub = False):
1378 chan = 0
1379 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1380 self.num_joins += 1
1381 while self.num_joins < self.num_subscribers:
1382 time.sleep(5)
1383 log_test.info('All subscribers have joined the channel')
1384 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 +00001385 if self.test_status is True:
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001386 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1387 self.test_status = False
1388 else:
1389 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 +00001390 self.test_status = True
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001391 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1392 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1393 time.sleep(5)
1394 subscriber.recv_timeout = False
1395 self.recv_timeout = False
1396 return self.test_status
1397
1398 def igmp_flow_check_group_exclude_source_empty_list(self, subscriber, multiple_sub = False):
1399 chan = 0
Thangavelu K S9a637332017-08-01 23:22:23 +00001400 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1401 self.num_joins += 1
1402 while self.num_joins < self.num_subscribers:
1403 time.sleep(5)
1404 log_test.info('All subscribers have joined the channel')
1405 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1406 if self.test_status is True:
1407 log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port))
1408 self.test_status = False
1409 else:
1410 log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port))
1411 self.test_status = True
1412
1413 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1414 log_test.info('Send join to multicast group with exclude empty source list and waited till GMI timer expires')
1415 time.sleep(60)
1416
1417 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10)
1418 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1419 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1420 time.sleep(5)
1421 subscriber.recv_timeout = False
1422 self.recv_timeout = False
1423 return self.test_status
1424
1425 def igmp_flow_check_group_exclude_source_empty_list_1(self, subscriber, multiple_sub = False):
1426 chan = 0
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001427 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list,record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE)
1428 self.num_joins += 1
1429 while self.num_joins < self.num_subscribers:
1430 time.sleep(5)
1431 log_test.info('All subscribers have joined the channel')
1432 for i in range(10):
1433 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1434 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1435 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1436 time.sleep(5)
1437 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1438 #Should not receive packets for this subscriber
1439 self.recv_timeout = True
1440 subscriber.recv_timeout = True
1441 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1442 subscriber.recv_timeout = False
1443 self.recv_timeout = False
1444 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1445 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1446# self.test_status = True
1447 return self.test_status
1448
1449 def igmp_flow_check_during_olt_onu_operational_issues(self, subscriber, multiple_sub = False):
1450 chan = 0
1451 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1452 self.num_joins += 1
1453 while self.num_joins < self.num_subscribers:
1454 time.sleep(5)
1455 log_test.info('All subscribers have joined the channel')
1456 for i in range(2):
1457 self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1458 log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port))
1459 subscriber.channel_leave(chan, src_list = subscriber.src_list)
1460 time.sleep(5)
1461 log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats))
1462 #Should not receive packets for this subscriber
1463 self.recv_timeout = True
1464 subscriber.recv_timeout = True
1465 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list)
1466 subscriber.recv_timeout = False
1467 self.recv_timeout = False
1468 log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port))
1469 subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list)
1470# self.test_status = True
1471 return self.test_status
1472
Thangavelu K S8e413082017-07-13 20:02:14 +00001473 def voltha_igmp_jump_verify(self, subscriber):
1474 if subscriber.has_service('IGMP'):
1475 for i in xrange(subscriber.num):
1476 log_test.info('Subscriber %s jumping channel' %subscriber.name)
1477 chan = subscriber.channel_jump(delay=0)
1478 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
1479 log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1480 time.sleep(3)
1481 log_test.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats))
1482 self.test_status = True
1483 return self.test_status
1484
1485 def voltha_igmp_next_verify(self, subscriber):
1486 for c in xrange(self.VOLTHA_IGMP_ITERATIONS):
1487 for i in xrange(subscriber.num):
1488 if i:
1489 chan = subscriber.channel_join_next(delay=0, leave_flag = self.leave_flag)
1490 time.sleep(0.2)
1491 else:
1492 chan = subscriber.channel_join(i, delay=0)
1493 time.sleep(0.2)
1494 if subscriber.num == 1:
1495 subscriber.channel_leave(chan)
1496 log_test.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
1497 #subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
1498 #log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
1499 self.test_status = True
1500 return self.test_status
1501
1502 def voltha_subscribers(self, services, cbs = None, num_subscribers = 1, num_channels = 1, src_list = None):
Thangavelu K S36edb012017-07-05 18:24:12 +00001503 """Test subscriber join next for channel surfing"""
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001504 voltha = VolthaCtrl(self.VOLTHA_HOST,
1505 rest_port = self.VOLTHA_REST_PORT,
1506 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP)
Thangavelu K S36edb012017-07-05 18:24:12 +00001507 if self.VOLTHA_OLT_TYPE.startswith('ponsim'):
A R Karthick168e2342017-08-15 16:13:10 -07001508 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S36edb012017-07-05 18:24:12 +00001509 log_test.info('Enabling ponsim olt')
1510 device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001511 if device_id != '':
1512 self.olt_device_id = device_id
Thangavelu K S36edb012017-07-05 18:24:12 +00001513 else:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00001514 log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution')
1515 assert_equal(False, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00001516
1517 assert_not_equal(device_id, None)
1518 if status == False:
1519 voltha.disable_device(device_id, delete = True)
1520 assert_equal(status, True)
1521 time.sleep(10)
1522 switch_map = None
1523 olt_configured = False
1524 try:
1525 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1526 if not switch_map:
1527 log_test.info('No voltha devices found')
1528 return
1529 log_test.info('Installing OLT app')
1530 OnosCtrl.install_app(self.olt_app_file)
1531 time.sleep(5)
1532 log_test.info('Adding subscribers through OLT app')
1533 self.config_olt(switch_map)
1534 olt_configured = True
1535 time.sleep(5)
1536 self.num_subscribers = num_subscribers
1537 self.num_channels = num_channels
1538 test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers,
1539 num_channels = self.num_channels,
1540 cbs = cbs,
1541 port_list = self.generate_port_list(self.num_subscribers,
1542 self.num_channels),
Thangavelu K S8e413082017-07-13 20:02:14 +00001543 src_list = src_list, services = services)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00001544 if test_status is False:
1545 self.success = False
Thangavelu K S36edb012017-07-05 18:24:12 +00001546 assert_equal(test_status, True)
1547 finally:
1548 if switch_map is not None:
1549 if olt_configured is True:
1550 self.remove_olt(switch_map)
1551 voltha.disable_device(device_id, delete = True)
1552 time.sleep(10)
1553 log_test.info('Uninstalling OLT app')
1554 OnosCtrl.uninstall_app(self.olt_app_name)
1555
Thangavelu K S8e413082017-07-13 20:02:14 +00001556 def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1,
1557 channel_start = 0, cbs = None, port_list = [], src_list = None,
Thangavelu K S36edb012017-07-05 18:24:12 +00001558 services = None, negative_subscriber_auth = None):
1559 self.test_status = False
1560 self.ovs_cleanup()
1561 subscribers_count = num_subscribers
1562 sub_loop_count = num_subscribers
1563 if not port_list:
1564 port_list = self.generate_port_list(num_subscribers, num_channels)
1565 subscriber_tx_rx_ports = []
1566 for i in range(num_subscribers):
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001567 subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map[port_list[i][0]],
1568 rx_port = self.port_map[port_list[i][1]],
Thangavelu K S8e413082017-07-13 20:02:14 +00001569 num_channels = num_channels,src_list = src_list,))
Thangavelu K S36edb012017-07-05 18:24:12 +00001570 self.onos_aaa_load()
Thangavelu K S8e413082017-07-13 20:02:14 +00001571 #load the ssm list for all subscriber channels
1572 igmpChannel = IgmpChannel(src_list = src_list)
1573 ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports)
1574 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
Thangavelu K S6432b522017-07-22 00:05:54 +00001575 if src_list is None:
1576 igmpChannel = IgmpChannel()
1577 igmpChannel.igmp_load_ssm_config(ssm_list)
1578 else:
1579 igmpChannel = IgmpChannel(src_list = src_list)
1580 igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list)
Thangavelu K S8e413082017-07-13 20:02:14 +00001581
Thangavelu K S36edb012017-07-05 18:24:12 +00001582 self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1)
1583
1584 chan_leave = False #for single channel, multiple subscribers
1585 if cbs is None:
1586 cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check)
1587 chan_leave = True
1588 for subscriber in subscriber_tx_rx_ports:
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001589 if 'IGMP' in services:
1590# if src_list:
1591# for i in range(len(src_list)):
1592# subscriber.start(src_ip = src_list[i])
1593# else:
1594# subscriber.start()
1595 subscriber.start()
Thangavelu K S36edb012017-07-05 18:24:12 +00001596 sub_loop_count = sub_loop_count - 1
1597 pool_object = voltha_subscriber_pool(subscriber, cbs)
1598 self.thread_pool.addTask(pool_object.pool_cb)
1599 self.thread_pool.cleanUpThreads()
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00001600 for subscriber in subscriber_tx_rx_ports:
1601 if services and 'IGMP' in services:
1602# if src_list:
1603# for i in range(len(src_list)):
1604# subscriber.stop(src_ip = src_list[i])
1605# else:
1606# subscriber.stop()
1607 subscriber.stop()
1608 if chan_leave is True:
1609 subscriber.channel_leave(0)
Thangavelu K S36edb012017-07-05 18:24:12 +00001610 subscribers_count = 0
1611 return self.test_status
1612
1613
1614 def generate_port_list(self, subscribers, channels):
1615 return self.port_list[:subscribers]
1616
Thangavelu K S36edb012017-07-05 18:24:12 +00001617 @classmethod
1618 def ovs_cleanup(cls):
1619 ##For every test case, delete all the OVS groups
1620 cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1'
1621 try:
1622 cord_test_shell(cmd)
1623 ##Since olt config is used for this test, we just fire a careless local cmd as well
1624 os.system(cmd)
1625 finally:
1626 return
1627
A.R Karthick8a507cf2017-06-02 18:44:49 -07001628 def test_olt_enable_disable(self):
A R Karthick35495c32017-05-11 14:58:32 -07001629 log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC))
A.R Karthick8a507cf2017-06-02 18:44:49 -07001630 device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC)
1631 assert_not_equal(device_id, None)
1632 try:
1633 assert_equal(status, True)
1634 time.sleep(10)
1635 finally:
1636 self.voltha.disable_device(device_id, delete = True)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001637
A.R Karthick8a507cf2017-06-02 18:44:49 -07001638 def test_ponsim_enable_disable(self):
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001639 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001640 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
A.R Karthick8a507cf2017-06-02 18:44:49 -07001641 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1642 assert_not_equal(device_id, None)
1643 try:
1644 assert_equal(status, True)
1645 time.sleep(10)
1646 finally:
1647 self.voltha.disable_device(device_id, delete = True)
A.R Karthick8b9c5f12017-05-30 17:47:08 -07001648
A R Karthick31a40172017-08-14 12:06:09 -07001649 def test_maple_enable_disable(self):
1650 log_test.info('Enabling maple olt')
1651 if self.VOLTHA_OLT_IP:
1652 address = self.VOLTHA_OLT_IP
1653 device_id, status = self.voltha.enable_device('maple_olt', address = address)
1654 assert_not_equal(device_id, None)
1655 try:
1656 assert_equal(status, True)
1657 time.sleep(10)
1658 finally:
1659 self.voltha.disable_device(device_id, delete = True)
1660
Thangavelu K S008f38e2017-05-15 19:36:55 +00001661 def test_subscriber_with_voltha_for_eap_tls_authentication(self):
1662 """
1663 Test Method:
1664 0. Make sure that voltha is up and running on CORD-POD setup.
1665 1. OLT and ONU is detected and validated.
1666 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1667 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber..
1668 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
1669 5. Verify that subscriber is authenticated successfully.
1670 """
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001671 ret = voltha_setup(
1672 host = self.VOLTHA_HOST,
A R Karthick168e2342017-08-15 16:13:10 -07001673 ponsim_host = self.VOLTHA_PONSIM_HOST,
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001674 rest_port = self.VOLTHA_REST_PORT,
1675 olt_type = 'ponsim_olt',
1676 uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP,
1677 uplink_vlan_start = self.VOLTHA_UPLINK_VLAN_START,
1678 config_fake = self.VOLTHA_CONFIG_FAKE,
1679 olt_app = self.olt_app_file)
1680 assert_not_equal(ret, None)
A R Karthick18d0fb62017-09-01 18:49:07 -07001681 voltha, device_id, switch_map, preconfigured = ret[0], ret[1], ret[2], ret[3]
1682 if self.VOLTHA_TEARDOWN is False:
1683 preconfigured = True
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001684 try:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001685 log_test.info('Adding subscribers through OLT app')
1686 self.config_olt(switch_map)
1687 olt_configured = True
1688 time.sleep(5)
1689 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001690 assert_equal(auth_status, True)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001691 finally:
A R Karthick18d0fb62017-09-01 18:49:07 -07001692 if switch_map is not None and preconfigured is False:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001693 if olt_configured is True:
1694 self.remove_olt(switch_map)
A R Karthickcaa1b6a2017-07-27 14:07:05 -07001695 voltha_teardown(voltha, device_id, switch_map, olt_app = self.olt_app_file)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001696
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001697 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001698 def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self):
1699 """
1700 Test Method:
1701 0. Make sure that voltha is up and running on CORD-POD setup.
1702 1. OLT and ONU is detected and validated.
1703 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1704 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1705 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius.
1706 5. Verify that subscriber authentication is unsuccessful..
1707 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001708 df = defer.Deferred()
1709 def tls_flow_check_with_no_cert_scenario(df):
1710 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001711 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001712 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1713 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001714 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001715 time.sleep(10)
1716 switch_map = None
1717 olt_configured = False
1718 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1719 log_test.info('Installing OLT app')
1720 OnosCtrl.install_app(self.olt_app_file)
1721 time.sleep(5)
1722 log_test.info('Adding subscribers through OLT app')
1723 self.config_olt(switch_map)
1724 olt_configured = True
1725 time.sleep(5)
1726 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1727 try:
1728 assert_equal(auth_status, True)
1729 assert_equal(status, True)
1730 time.sleep(10)
1731 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001732 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001733 self.voltha.disable_device(device_id, delete = True)
1734 df.callback(0)
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001735
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001736 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1737 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001738
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001739 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001740 def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self):
1741 """
1742 Test Method:
1743 0. Make sure that voltha is up and running on CORD-POD setup.
1744 1. OLT and ONU is detected and validated.
1745 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1746 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber..
1747 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1748 5. Verify that subscriber authentication is unsuccessful..
1749 """
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001750 df = defer.Deferred()
1751 def tls_flow_check_with_invalid_cert_scenario(df):
1752 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001753 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001754 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1755 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001756 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001757 time.sleep(10)
1758 switch_map = None
1759 olt_configured = False
1760 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1761 log_test.info('Installing OLT app')
1762 OnosCtrl.install_app(self.olt_app_file)
1763 time.sleep(5)
1764 log_test.info('Adding subscribers through OLT app')
1765 self.config_olt(switch_map)
1766 olt_configured = True
1767 time.sleep(5)
1768 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1769 try:
1770 assert_equal(auth_status, True)
1771 assert_equal(status, True)
1772 time.sleep(10)
1773 finally:
A.R Karthickb9eab5a2017-06-07 16:03:51 -07001774 self.remove_olt(switch_map)
Thangavelu K S77c8c0c2017-06-07 18:04:21 +00001775 self.voltha.disable_device(device_id, delete = True)
1776 df.callback(0)
1777 reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df)
1778 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001779
Thangavelu K S0d745c82017-06-09 21:56:08 +00001780 @deferred(TESTCASE_TIMEOUT)
1781 def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self):
1782 """
1783 Test Method:
1784 0. Make sure that voltha is up and running on CORD-POD setup.
1785 1. OLT and ONU is detected and validated.
1786 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1787 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times.
1788 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius.
1789 5. Verify that subscriber authentication is unsuccessful..
1790 """
1791 df = defer.Deferred()
1792 def tls_flow_check_with_no_cert_scenario(df):
1793 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001794 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001795 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1796 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001797 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001798 time.sleep(10)
1799 switch_map = None
1800 olt_configured = False
1801 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1802 log_test.info('Installing OLT app')
1803 OnosCtrl.install_app(self.olt_app_file)
1804 time.sleep(5)
1805 log_test.info('Adding subscribers through OLT app')
1806 self.config_olt(switch_map)
1807 olt_configured = True
1808 time.sleep(5)
1809 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1810 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1811 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert")
1812 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert")
1813 try:
1814 assert_equal(auth_status, True)
1815 assert_equal(status, True)
1816 time.sleep(10)
1817 finally:
1818 self.voltha.disable_device(device_id, delete = True)
1819 df.callback(0)
1820 reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df)
1821 return df
1822
1823 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001824 def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self):
1825 """
1826 Test Method:
1827 0. Make sure that voltha is up and running on CORD-POD setup.
1828 1. OLT and ONU is detected and validated.
1829 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1830 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1831 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius.
1832 5. Verify that subscriber authentication is unsuccessful..
1833 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001834 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001835 def tls_flow_check_deactivating_app(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001836 aaa_app = ["org.opencord.aaa"]
1837 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001838 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001839 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1840 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001841 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001842 time.sleep(10)
1843 switch_map = None
1844 olt_configured = False
1845 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1846 log_test.info('Installing OLT app')
1847 OnosCtrl.install_app(self.olt_app_file)
1848 time.sleep(5)
1849 log_test.info('Adding subscribers through OLT app')
1850 self.config_olt(switch_map)
1851 olt_configured = True
1852 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001853
Thangavelu K S0d745c82017-06-09 21:56:08 +00001854 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",))
1855 thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,))
1856 thread1.start()
1857 time.sleep(randint(1,2))
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001858 log_test.info('Restart aaa app in onos during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001859 thread2.start()
1860 time.sleep(10)
1861 thread1.join()
1862 thread2.join()
1863 try:
1864 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001865 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001866 time.sleep(10)
1867 finally:
1868 self.voltha.disable_device(device_id, delete = True)
1869 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001870 reactor.callLater(0, tls_flow_check_deactivating_app, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001871 return df
1872
1873 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001874 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self):
1875 """
1876 Test Method:
1877 0. Make sure that voltha is up and running on CORD-POD setup.
1878 1. OLT and ONU is detected and validated.
1879 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1880 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1881 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius.
1882 5. Verify that subscriber authentication is unsuccessful..
1883 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001884 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001885 def tls_flow_check_restarting_radius(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001886 aaa_app = ["org.opencord.aaa"]
1887 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001888 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001889 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1890 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001891 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001892 time.sleep(10)
1893 switch_map = None
1894 olt_configured = False
1895 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1896 log_test.info('Installing OLT app')
1897 OnosCtrl.install_app(self.olt_app_file)
1898 time.sleep(5)
1899 log_test.info('Adding subscribers through OLT app')
1900 self.config_olt(switch_map)
1901 olt_configured = True
1902 time.sleep(5)
1903
1904 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius"))
1905 thread2 = threading.Thread(target = cord_test_radius_restart)
1906 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001907 time.sleep(randint(1,2))
1908 log_test.info('Restart radius server during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001909 thread2.start()
1910 time.sleep(10)
1911 thread1.join()
1912 thread2.join()
1913 try:
1914 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001915 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001916 time.sleep(10)
1917 finally:
1918 self.voltha.disable_device(device_id, delete = True)
1919 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001920 reactor.callLater(0, tls_flow_check_restarting_radius, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001921 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00001922
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001923 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001924 def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self):
1925 """
1926 Test Method:
1927 0. Make sure that voltha is up and running on CORD-POD setup.
1928 1. OLT and ONU is detected and validated.
1929 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1930 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1931 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1932 6. Verify that subscriber authenticated successfully.
1933 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber.
1934 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1935 9. Verify that subscriber authentication is unsuccessful..
1936 """
Thangavelu K S0d745c82017-06-09 21:56:08 +00001937 df = defer.Deferred()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001938 def tls_flow_check_operating_olt_state(df):
Thangavelu K S0d745c82017-06-09 21:56:08 +00001939 aaa_app = ["org.opencord.aaa"]
1940 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001941 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001942 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1943 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001944 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001945 time.sleep(10)
1946 switch_map = None
1947 olt_configured = False
1948 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
1949 log_test.info('Installing OLT app')
1950 OnosCtrl.install_app(self.olt_app_file)
1951 time.sleep(5)
1952 log_test.info('Adding subscribers through OLT app')
1953 self.config_olt(switch_map)
1954 olt_configured = True
1955 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00001956
Thangavelu K S0d745c82017-06-09 21:56:08 +00001957 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",))
Thangavelu K Se6c77c72017-06-23 21:28:48 +00001958 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,))
Thangavelu K S0d745c82017-06-09 21:56:08 +00001959 thread1.start()
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001960 time.sleep(randint(1,2))
1961 log_test.info('Disable the ponsim olt device during tls auth flow check on voltha')
Thangavelu K S0d745c82017-06-09 21:56:08 +00001962 thread2.start()
1963 time.sleep(10)
1964 thread1.join()
1965 thread2.join()
1966 try:
1967 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00001968 assert_equal(self.success, True)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001969 time.sleep(10)
1970 finally:
1971 self.voltha.disable_device(device_id, delete = True)
1972 df.callback(0)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001973 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
Thangavelu K S0d745c82017-06-09 21:56:08 +00001974 return df
1975
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001976 @deferred(TESTCASE_TIMEOUT)
1977 def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00001978 """
1979 Test Method:
1980 0. Make sure that voltha is up and running on CORD-POD setup.
1981 1. OLT and ONU is detected and validated.
1982 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
1983 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
1984 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
1985 6. Verify that subscriber authenticated successfully.
1986 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
1987 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
1988 9. Verify that subscriber authentication is unsuccessful..
1989 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001990 df = defer.Deferred()
1991 def tls_flow_check_operating_olt_state(df):
1992 aaa_app = ["org.opencord.aaa"]
1993 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07001994 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001995 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
1996 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07001997 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00001998 time.sleep(10)
1999 switch_map = None
2000 olt_configured = False
2001 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2002 log_test.info('Installing OLT app')
2003 OnosCtrl.install_app(self.olt_app_file)
2004 time.sleep(5)
2005 log_test.info('Adding subscribers through OLT app')
2006 self.config_olt(switch_map)
2007 olt_configured = True
2008 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002009
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002010 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",))
2011 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
2012 thread1.start()
2013 time.sleep(randint(1,2))
2014 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
2015 thread2.start()
2016 time.sleep(10)
2017 thread1.join()
2018 thread2.join()
2019 try:
2020 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002021 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002022 time.sleep(10)
2023 finally:
2024 self.voltha.disable_device(device_id, delete = True)
2025 df.callback(0)
2026 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2027 return df
2028
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002029 @deferred(TESTCASE_TIMEOUT +600)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002030 def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self):
2031 """
2032 Test Method:
2033 0. Make sure that voltha is up and running on CORD-POD setup.
2034 1. OLT and ONU is detected and validated.
2035 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2036 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2037 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2038 6. Verify that subscriber authenticated successfully.
2039 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber.
2040 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2041 9. Verify that subscriber authentication is unsuccessful..
2042 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2043
2044 """
2045 df = defer.Deferred()
2046 no_iterations = 10
2047 def tls_flow_check_with_disable_olt_device_scenario(df):
2048 aaa_app = ["org.opencord.aaa"]
2049 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002050 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002051 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2052 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002053 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002054 time.sleep(10)
2055 switch_map = None
2056 olt_configured = False
2057 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2058 log_test.info('Installing OLT app')
2059 OnosCtrl.install_app(self.olt_app_file)
2060 time.sleep(5)
2061 log_test.info('Adding subscribers through OLT app')
2062 self.config_olt(switch_map)
2063 olt_configured = True
2064 time.sleep(5)
2065 for i in range(no_iterations):
2066 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 +00002067 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002068 thread1.start()
2069 time.sleep(randint(1,2))
2070 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
2071 thread2.start()
2072 time.sleep(10)
2073 thread1.join()
2074 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002075 time.sleep(60)
2076 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002077 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2078 try:
2079 # assert_equal(status, True)
2080 assert_equal(auth_status, True)
2081 assert_equal(self.success, True)
2082 time.sleep(10)
2083 finally:
2084 self.voltha.disable_device(device_id, delete = True)
2085 df.callback(0)
2086 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2087 return df
2088
2089 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002090 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self):
2091 """
2092 Test Method:
2093 0. Make sure that voltha is up and running on CORD-POD setup.
2094 1. OLT and ONU is detected and validated.
2095 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2096 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2097 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2098 6. Verify that subscriber authenticated successfully.
2099 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2100 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2101 9. Verify that subscriber authentication is unsuccessful..
2102 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002103 df = defer.Deferred()
2104 def tls_flow_check_operating_olt_state(df):
2105 aaa_app = ["org.opencord.aaa"]
2106 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002107 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002108 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2109 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002110 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002111 time.sleep(10)
2112 switch_map = None
2113 olt_configured = False
2114 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2115 log_test.info('Installing OLT app')
2116 OnosCtrl.install_app(self.olt_app_file)
2117 time.sleep(5)
2118 log_test.info('Adding subscribers through OLT app')
2119 self.config_olt(switch_map)
2120 olt_configured = True
2121 time.sleep(5)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002122
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002123 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2124 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2125 thread1.start()
2126 time.sleep(randint(1,2))
2127 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2128 thread2.start()
2129 time.sleep(10)
2130 thread1.join()
2131 thread2.join()
2132 try:
2133 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002134 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002135 time.sleep(10)
2136 finally:
2137 self.voltha.disable_device(device_id, delete = True)
2138 df.callback(0)
2139 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2140 return df
2141
2142 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002143 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self):
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002144 """
2145 Test Method:
2146 0. Make sure that voltha is up and running on CORD-POD setup.
2147 1. OLT and ONU is detected and validated.
2148 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2149 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2150 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2151 6. Verify that subscriber authenticated successfully.
2152 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber.
2153 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2154 9. Verify that subscriber authentication is unsuccessful..
2155 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2156 """
2157 df = defer.Deferred()
2158 no_iterations = 10
2159 def tls_flow_check_with_disable_olt_device_scenario(df):
2160 aaa_app = ["org.opencord.aaa"]
2161 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002162 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002163 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2164 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002165 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002166 time.sleep(10)
2167 switch_map = None
2168 olt_configured = False
2169 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2170 log_test.info('Installing OLT app')
2171 OnosCtrl.install_app(self.olt_app_file)
2172 time.sleep(5)
2173 log_test.info('Adding subscribers through OLT app')
2174 self.config_olt(switch_map)
2175 olt_configured = True
2176 time.sleep(5)
2177 for i in range(no_iterations):
2178 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",))
2179 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
2180 thread1.start()
2181 time.sleep(randint(1,2))
2182 log_test.info('Restart the ponsim olt device during tls auth flow check on voltha')
2183 thread2.start()
2184 time.sleep(10)
2185 thread1.join()
2186 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002187 time.sleep(60)
2188 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002189 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2190 try:
2191 # assert_equal(status, True)
2192 assert_equal(auth_status, True)
2193 assert_equal(self.success, True)
2194 time.sleep(10)
2195 finally:
2196 self.voltha.disable_device(device_id, delete = True)
2197 df.callback(0)
2198 reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df)
2199 return df
2200
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002201 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002202 def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self):
2203 """
2204 Test Method:
2205 0. Make sure that voltha is up and running on CORD-POD setup.
2206 1. OLT and ONU is detected and validated.
2207 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2208 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2209 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2210 6. Verify that subscriber authenticated successfully.
2211 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2212 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2213 9. Verify that subscriber authentication is unsuccessful..
2214 """
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002215 df = defer.Deferred()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002216 def tls_flow_check_operating_onu_state(df):
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002217 aaa_app = ["org.opencord.aaa"]
2218 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002219 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002220 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2221 devices_list = self.voltha.get_devices()
Thangavelu K S9648eed2017-06-13 20:15:25 +00002222 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2223
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002224 onu_device_id = devices_list['items'][1]['id']
2225 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002226 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002227 time.sleep(10)
2228 switch_map = None
2229 olt_configured = False
2230 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2231 log_test.info('Installing OLT app')
2232 OnosCtrl.install_app(self.olt_app_file)
2233 time.sleep(5)
2234 log_test.info('Adding subscribers through OLT app')
2235 self.config_olt(switch_map)
2236 olt_configured = True
2237 time.sleep(5)
2238 devices_list = self.voltha.get_devices()
2239 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2240 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2241 thread1.start()
2242 time.sleep(randint(1,2))
2243 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2244 thread2.start()
2245 time.sleep(10)
2246 thread1.join()
2247 thread2.join()
2248 try:
2249 # assert_equal(status, True)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002250 assert_equal(self.success, True)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002251 time.sleep(10)
2252 finally:
2253 self.voltha.disable_device(device_id, delete = True)
2254 df.callback(0)
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002255 reactor.callLater(0, tls_flow_check_operating_onu_state, df)
Thangavelu K Sb6fc1b52017-06-12 17:46:10 +00002256 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002257
Thangavelu K S9648eed2017-06-13 20:15:25 +00002258 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002259 def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self):
2260 """
2261 Test Method:
2262 0. Make sure that voltha is up and running on CORD-POD setup.
2263 1. OLT and ONU is detected and validated.
2264 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2265 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2266 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius.
2267 6. Verify that subscriber authenticated successfully.
2268 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber.
2269 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius.
2270 9. Verify that subscriber authentication is unsuccessful..
2271 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow
2272 """
2273 df = defer.Deferred()
2274 no_iterations = 10
2275 def tls_flow_check_operating_olt_state(df):
2276 aaa_app = ["org.opencord.aaa"]
2277 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002278 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002279 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2280 devices_list = self.voltha.get_devices()
2281 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2282
2283 onu_device_id = devices_list['items'][1]['id']
2284 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002285 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002286 time.sleep(10)
2287 switch_map = None
2288 olt_configured = False
2289 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2290 log_test.info('Installing OLT app')
2291 OnosCtrl.install_app(self.olt_app_file)
2292 time.sleep(5)
2293 log_test.info('Adding subscribers through OLT app')
2294 self.config_olt(switch_map)
2295 olt_configured = True
2296 time.sleep(5)
2297 devices_list = self.voltha.get_devices()
2298 for i in range(no_iterations):
2299 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",))
2300 thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,))
2301 thread1.start()
2302 time.sleep(randint(1,2))
2303 log_test.info('Restart the ponsim oon device during tls auth flow check on voltha')
2304 thread2.start()
2305 time.sleep(10)
2306 thread1.join()
2307 thread2.join()
Thangavelu K S and Chetan Gaonker0cf75642017-08-03 20:13:23 +00002308 time.sleep(60)
2309 cord_test_radius_restart()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002310 auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT)
2311 try:
2312 # assert_equal(status, True)
2313 assert_equal(auth_status, True)
2314 assert_equal(self.success, True)
2315 time.sleep(10)
2316 finally:
2317 self.voltha.disable_device(device_id, delete = True)
2318 df.callback(0)
2319 reactor.callLater(0, tls_flow_check_operating_olt_state, df)
2320 return df
2321
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002322 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002323 def test_two_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002324 """
2325 Test Method:
2326 0. Make sure that voltha is up and running on CORD-POD setup.
2327 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2328 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2329 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2330 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius.
2331 5. Verify that two subscribers are authenticated successfully.
2332 """
2333
Thangavelu K S9648eed2017-06-13 20:15:25 +00002334 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002335 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002336 aaa_app = ["org.opencord.aaa"]
2337 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002338 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002339 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2340 devices_list = self.voltha.get_devices()
2341 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2342
2343 onu_device_id = devices_list['items'][1]['id']
2344 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002345 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002346 time.sleep(10)
2347 switch_map = None
2348 olt_configured = False
2349 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2350 log_test.info('Installing OLT app')
2351 OnosCtrl.install_app(self.olt_app_file)
2352 time.sleep(5)
2353 log_test.info('Adding subscribers through OLT app')
2354 self.config_olt(switch_map)
2355 olt_configured = True
2356 time.sleep(5)
2357 devices_list = self.voltha.get_devices()
2358 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2359 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,))
2360 thread1.start()
2361 time.sleep(randint(1,2))
2362 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2363 thread2.start()
2364 time.sleep(10)
2365 thread1.join()
2366 thread2.join()
2367 try:
2368 # assert_equal(status, True)
2369 assert_equal(self.success, True)
2370 time.sleep(10)
2371 finally:
2372 self.voltha.disable_device(device_id, delete = True)
2373 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002374 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002375 return df
2376
2377 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002378 def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002379 """
2380 Test Method:
2381 0. Make sure that voltha is up and running on CORD-POD setup.
2382 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2383 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2384 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2385 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius.
2386 5. Verify that two subscribers are not authenticated.
2387 """
Thangavelu K S9648eed2017-06-13 20:15:25 +00002388 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002389 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Thangavelu K S9648eed2017-06-13 20:15:25 +00002390 aaa_app = ["org.opencord.aaa"]
2391 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002392 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002393 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2394 devices_list = self.voltha.get_devices()
2395 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2396
2397 onu_device_id = devices_list['items'][1]['id']
2398 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002399 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002400 time.sleep(10)
2401 switch_map = None
2402 olt_configured = False
2403 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2404 log_test.info('Installing OLT app')
2405 OnosCtrl.install_app(self.olt_app_file)
2406 time.sleep(5)
2407 log_test.info('Adding subscribers through OLT app')
2408 self.config_olt(switch_map)
2409 olt_configured = True
2410 time.sleep(5)
2411 devices_list = self.voltha.get_devices()
2412 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2413 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",))
2414 thread1.start()
2415 time.sleep(randint(1,2))
2416 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2417 thread2.start()
2418 time.sleep(10)
2419 thread1.join()
2420 thread2.join()
2421 try:
2422 # assert_equal(status, True)
2423 assert_equal(self.success, True)
2424 time.sleep(10)
2425 finally:
2426 self.voltha.disable_device(device_id, delete = True)
2427 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002428 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Thangavelu K S9648eed2017-06-13 20:15:25 +00002429 return df
2430
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002431 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002432 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 +00002433 """
2434 Test Method:
2435 0. Make sure that voltha is up and running on CORD-POD setup.
2436 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2437 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2438 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2439 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2440 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius.
2441 6. Verify that valid subscriber authenticated successfully.
2442 7. Verify that invalid subscriber are not authenticated successfully.
2443 """
2444
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002445 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002446 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002447 aaa_app = ["org.opencord.aaa"]
2448 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002449 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002450 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2451 devices_list = self.voltha.get_devices()
2452 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2453
2454 onu_device_id = devices_list['items'][1]['id']
2455 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002456 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002457 time.sleep(10)
2458 switch_map = None
2459 olt_configured = False
2460 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2461 log_test.info('Installing OLT app')
2462 OnosCtrl.install_app(self.olt_app_file)
2463 time.sleep(5)
2464 log_test.info('Adding subscribers through OLT app')
2465 self.config_olt(switch_map)
2466 olt_configured = True
2467 time.sleep(5)
2468 devices_list = self.voltha.get_devices()
2469 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2470 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",))
2471 thread1.start()
2472 time.sleep(randint(1,2))
2473 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2474 thread2.start()
2475 time.sleep(10)
2476 thread1.join()
2477 thread2.join()
2478 try:
2479 # assert_equal(status, True)
2480 assert_equal(self.success, True)
2481 time.sleep(10)
2482 finally:
2483 self.voltha.disable_device(device_id, delete = True)
2484 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002485 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002486 return df
2487
2488 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002489 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 +00002490 """
2491 Test Method:
2492 0. Make sure that voltha is up and running on CORD-POD setup.
2493 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen.
2494 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2495 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2496 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius.
2497 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius.
2498 6. Verify that valid subscriber authenticated successfully.
2499 7. Verify that invalid subscriber are not authenticated successfully.
2500 """
2501
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002502 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002503 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002504 aaa_app = ["org.opencord.aaa"]
2505 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002506 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002507 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2508 devices_list = self.voltha.get_devices()
2509 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2510
2511 onu_device_id = devices_list['items'][1]['id']
2512 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002513 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002514 time.sleep(10)
2515 switch_map = None
2516 olt_configured = False
2517 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2518 log_test.info('Installing OLT app')
2519 OnosCtrl.install_app(self.olt_app_file)
2520 time.sleep(5)
2521 log_test.info('Adding subscribers through OLT app')
2522 self.config_olt(switch_map)
2523 olt_configured = True
2524 time.sleep(5)
2525 devices_list = self.voltha.get_devices()
2526 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2527 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",))
2528 thread1.start()
2529 time.sleep(randint(1,2))
2530 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2531 thread2.start()
2532 time.sleep(10)
2533 thread1.join()
2534 thread2.join()
2535 try:
2536 # assert_equal(status, True)
2537 assert_equal(self.success, True)
2538 time.sleep(10)
2539 finally:
2540 self.voltha.disable_device(device_id, delete = True)
2541 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002542 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002543 return df
2544
2545 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00002546 def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self):
Thangavelu K S008f38e2017-05-15 19:36:55 +00002547 """
2548 Test Method:
2549 0. Make sure that voltha is up and running on CORD-POD setup.
2550 1. OLT and ONU is detected and validated.
2551 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2552 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2553 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius.
2554 6. Verify that subscriber authenticated successfully.
2555 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber.
2556 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius.
2557 9. Verify that subscriber authentication is unsuccessful..
2558 10. Verify that other subscriber authenticated successfully.
2559 """
2560
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002561 df = defer.Deferred()
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002562 def tls_flow_check_on_two_subscribers_same_olt_device(df):
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002563 aaa_app = ["org.opencord.aaa"]
2564 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002565 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002566 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2567 devices_list = self.voltha.get_devices()
2568 log_test.info('All available devices on voltha = %s'%devices_list['items'])
2569
2570 onu_device_id = devices_list['items'][1]['id']
2571 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002572 voltha = VolthaCtrl(**self.voltha_attrs)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002573 time.sleep(10)
2574 switch_map = None
2575 olt_configured = False
2576 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2577 log_test.info('Installing OLT app')
2578 OnosCtrl.install_app(self.olt_app_file)
2579 time.sleep(5)
2580 log_test.info('Adding subscribers through OLT app')
2581 self.config_olt(switch_map)
2582 olt_configured = True
2583 time.sleep(5)
2584 devices_list = self.voltha.get_devices()
2585 thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,))
2586 thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",))
2587 thread1.start()
2588 time.sleep(randint(1,2))
2589 log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha')
2590 thread2.start()
2591 time.sleep(10)
2592 thread1.join()
2593 thread2.join()
2594 try:
2595 # assert_equal(status, True)
2596 assert_equal(self.success, True)
2597 time.sleep(10)
2598 finally:
2599 self.voltha.disable_device(device_id, delete = True)
2600 df.callback(0)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002601 reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df)
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002602 return df
2603
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00002604 def test_three_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00002605 """
2606 Test Method:
2607 0. Make sure that voltha is up and running on CORD-POD setup.
2608 1. OLT and ONU is detected and validated.
2609 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2610 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers)
2611 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2612 5. Verify that subscriber is authenticated successfully.
2613 """
2614 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2615 num_subscribers = 3
2616 num_channels = 1
2617 services = ('TLS')
2618 cbs = (self.tls_flow_check, None, None)
2619 self.voltha_subscribers(services, cbs = cbs,
2620 num_subscribers = num_subscribers,
2621 num_channels = num_channels)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00002622 assert_equal(self.success, True)
2623
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00002624 def test_five_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00002625 """
2626 Test Method:
2627 0. Make sure that voltha is up and running on CORD-POD setup.
2628 1. OLT and ONU is detected and validated.
2629 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2630 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber)
2631 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2632 5. Verify that subscriber is authenticated successfully.
2633 """
2634 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2635 num_subscribers = 5
2636 num_channels = 1
2637 services = ('TLS')
2638 cbs = (self.tls_flow_check, None, None)
2639 self.voltha_subscribers(services, cbs = cbs,
2640 num_subscribers = num_subscribers,
2641 num_channels = num_channels)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00002642 assert_equal(self.success, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00002643
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00002644 def test_nine_subscribers_with_voltha_for_eap_tls_authentication(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00002645 """
2646 Test Method:
2647 0. Make sure that voltha is up and running on CORD-POD setup.
2648 1. OLT and ONU is detected and validated.
2649 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server.
2650 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber)
2651 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius.
2652 5. Verify that subscriber is authenticated successfully.
2653 """
2654 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
2655 num_subscribers = 9
2656 num_channels = 1
2657 services = ('TLS')
2658 cbs = (self.tls_flow_check, None, None)
2659 self.voltha_subscribers(services, cbs = cbs,
2660 num_subscribers = num_subscribers,
2661 num_channels = num_channels)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00002662 assert_equal(self.success, True)
Thangavelu K S36edb012017-07-05 18:24:12 +00002663
Chetan Gaonkerfe1048f2017-06-13 20:16:25 +00002664 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002665 def test_subscriber_with_voltha_for_dhcp_request(self):
2666 """
2667 Test Method:
2668 0. Make sure that voltha is up and running on CORD-POD setup.
2669 1. OLT and ONU is detected and validated.
2670 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2671 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2672 4. Verify that subscriber get ip from dhcp server successfully.
2673 """
2674
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002675 df = defer.Deferred()
2676 def dhcp_flow_check_scenario(df):
2677 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002678 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002679 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2680 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002681 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002682 time.sleep(10)
2683 switch_map = None
2684 olt_configured = False
2685 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2686 log_test.info('Installing OLT app')
2687 OnosCtrl.install_app(self.olt_app_file)
2688 time.sleep(5)
2689 log_test.info('Adding subscribers through OLT app')
2690 self.config_olt(switch_map)
2691 olt_configured = True
2692 time.sleep(5)
2693 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
2694 try:
2695 assert_equal(dhcp_status, True)
2696 #assert_equal(status, True)
2697 time.sleep(10)
2698 finally:
2699 self.remove_olt(switch_map)
2700 self.voltha.disable_device(device_id, delete = True)
2701 df.callback(0)
2702
2703 reactor.callLater(0, dhcp_flow_check_scenario, df)
2704 return df
2705
2706 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002707 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self):
2708 """
2709 Test Method:
2710 0. Make sure that voltha is up and running on CORD-POD setup.
2711 1. OLT and ONU is detected and validated.
2712 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2713 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app.
2714 4. Verify that subscriber should not get ip from dhcp server.
2715 """
2716
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002717 df = defer.Deferred()
2718 def dhcp_flow_check_scenario(df):
2719 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002720 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002721 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2722 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002723 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002724 time.sleep(10)
2725 switch_map = None
2726 olt_configured = False
2727 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2728 log_test.info('Installing OLT app')
2729 OnosCtrl.install_app(self.olt_app_file)
2730 time.sleep(5)
2731 log_test.info('Adding subscribers through OLT app')
2732 self.config_olt(switch_map)
2733 olt_configured = True
2734 time.sleep(5)
2735 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast")
2736 try:
2737 assert_equal(dhcp_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00002738 assert_equal(self.success, True)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002739 #assert_equal(status, True)
2740 time.sleep(10)
2741 finally:
2742 self.voltha.disable_device(device_id, delete = True)
2743 self.remove_olt(switch_map)
2744 df.callback(0)
2745
2746 reactor.callLater(0, dhcp_flow_check_scenario, df)
2747 return df
2748
2749
2750 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002751 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self):
2752 """
2753 Test Method:
2754 0. Make sure that voltha is up and running on CORD-POD setup.
2755 1. OLT and ONU is detected and validated.
2756 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2757 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app.
2758 4. Verify that subscriber should not get ip from dhcp server.
2759 """
2760
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002761 df = defer.Deferred()
2762 def dhcp_flow_check_scenario(df):
2763 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002764 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002765 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2766 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002767 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002768 time.sleep(10)
2769 switch_map = None
2770 olt_configured = False
2771 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2772 log_test.info('Installing OLT app')
2773 OnosCtrl.install_app(self.olt_app_file)
2774 time.sleep(5)
2775 log_test.info('Adding subscribers through OLT app')
2776 self.config_olt(switch_map)
2777 olt_configured = True
2778 time.sleep(5)
2779 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast")
2780 try:
2781 assert_equal(dhcp_status, True)
2782 #assert_equal(status, True)
2783 time.sleep(10)
2784 finally:
2785 self.voltha.disable_device(device_id, delete = True)
2786 self.remove_olt(switch_map)
2787 df.callback(0)
2788
2789 reactor.callLater(0, dhcp_flow_check_scenario, df)
2790 return df
2791
2792 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002793 def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self):
2794 """
2795 Test Method:
2796 0. Make sure that voltha is up and running on CORD-POD setup.
2797 1. OLT and ONU is detected and validated.
2798 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2799 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app.
2800 4. Verify that subscriber should not get ip from dhcp server.
2801 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002802 df = defer.Deferred()
2803 def dhcp_flow_check_scenario(df):
2804 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002805 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002806 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2807 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002808 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002809 time.sleep(10)
2810 switch_map = None
2811 olt_configured = False
2812 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2813 log_test.info('Installing OLT app')
2814 OnosCtrl.install_app(self.olt_app_file)
2815 time.sleep(5)
2816 log_test.info('Adding subscribers through OLT app')
2817 self.config_olt(switch_map)
2818 olt_configured = True
2819 time.sleep(5)
2820 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk")
2821 try:
2822 assert_equal(dhcp_status, True)
2823 #assert_equal(status, True)
2824 time.sleep(10)
2825 finally:
2826 self.voltha.disable_device(device_id, delete = True)
2827 self.remove_olt(switch_map)
2828 df.callback(0)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002829
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002830 reactor.callLater(0, dhcp_flow_check_scenario, df)
2831 return df
2832
2833 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S008f38e2017-05-15 19:36:55 +00002834 def test_subscriber_with_voltha_for_dhcp_request_and_release(self):
2835 """
2836 Test Method:
2837 0. Make sure that voltha is up and running on CORD-POD setup.
2838 1. OLT and ONU is detected and validated.
2839 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2840 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
2841 4. Verify that subscriber get ip from dhcp server successfully.
2842 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app.
2843 6 Verify that subscriber should not get ip from dhcp server, ping to gateway.
2844 """
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002845 df = defer.Deferred()
2846 def dhcp_flow_check_scenario(df):
2847 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002848 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002849 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2850 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002851 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Sa1c71b42017-06-14 18:13:21 +00002852 time.sleep(10)
2853 switch_map = None
2854 olt_configured = False
2855 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2856 log_test.info('Installing OLT app')
2857 OnosCtrl.install_app(self.olt_app_file)
2858 time.sleep(5)
2859 log_test.info('Adding subscribers through OLT app')
2860 self.config_olt(switch_map)
2861 olt_configured = True
2862 time.sleep(5)
2863 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release")
2864 try:
2865 assert_equal(dhcp_status, True)
2866 #assert_equal(status, True)
2867 time.sleep(10)
2868 finally:
2869 self.voltha.disable_device(device_id, delete = True)
2870 self.remove_olt(switch_map)
2871 df.callback(0)
2872
2873 reactor.callLater(0, dhcp_flow_check_scenario, df)
2874 return df
Thangavelu K S008f38e2017-05-15 19:36:55 +00002875
Thangavelu K S735a6662017-06-15 18:08:23 +00002876 @deferred(TESTCASE_TIMEOUT)
A.R Karthick57fa9372017-05-24 12:47:03 -07002877 def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00002878 """
2879 Test Method:
2880 0. Make sure that voltha is up and running on CORD-POD setup.
2881 1. OLT and ONU is detected and validated.
2882 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2883 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2884 4. Verify that subscriber get ip from dhcp server successfully.
2885 5. Repeat step 3 and 4 for 10 times.
2886 6 Verify that subscriber should get ip from dhcp server.
2887 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002888 df = defer.Deferred()
2889 def dhcp_flow_check_scenario(df):
2890 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002891 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00002892 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2893 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002894 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002895 time.sleep(10)
2896 switch_map = None
2897 olt_configured = False
2898 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2899 log_test.info('Installing OLT app')
2900 OnosCtrl.install_app(self.olt_app_file)
2901 time.sleep(5)
2902 log_test.info('Adding subscribers through OLT app')
2903 self.config_olt(switch_map)
2904 olt_configured = True
2905 time.sleep(5)
2906 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive")
2907 try:
2908 assert_equal(dhcp_status, True)
2909 #assert_equal(status, True)
2910 time.sleep(10)
2911 finally:
2912 self.voltha.disable_device(device_id, delete = True)
2913 self.remove_olt(switch_map)
2914 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002915
Thangavelu K S735a6662017-06-15 18:08:23 +00002916 reactor.callLater(0, dhcp_flow_check_scenario, df)
2917 return df
2918
Thangavelu K S735a6662017-06-15 18:08:23 +00002919 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002920 def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self):
2921 """
2922 Test Method:
2923 0. Make sure that voltha is up and running on CORD-POD setup.
2924 1. OLT and ONU is detected and validated.
2925 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2926 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app.
2927 4. Verify that subscriber should not get ip from dhcp server.
2928 5. Repeat steps 3 and 4 for 10 times.
2929 6 Verify that subscriber should not get ip from dhcp server.
2930 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002931 df = defer.Deferred()
2932 def dhcp_flow_check_scenario(df):
2933 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002934 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00002935 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2936 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002937 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002938 time.sleep(10)
2939 switch_map = None
2940 olt_configured = False
2941 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2942 log_test.info('Installing OLT app')
2943 OnosCtrl.install_app(self.olt_app_file)
2944 time.sleep(5)
2945 log_test.info('Adding subscribers through OLT app')
2946 self.config_olt(switch_map)
2947 olt_configured = True
2948 time.sleep(5)
2949 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative")
2950 try:
2951 assert_equal(dhcp_status, True)
2952 #assert_equal(status, True)
2953 time.sleep(10)
2954 finally:
2955 self.voltha.disable_device(device_id, delete = True)
2956 self.remove_olt(switch_map)
2957 df.callback(0)
2958
2959 reactor.callLater(0, dhcp_flow_check_scenario, df)
2960 return df
2961
Thangavelu K S735a6662017-06-15 18:08:23 +00002962 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00002963 def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self):
2964 """
2965 Test Method:
2966 0. Make sure that voltha is up and running on CORD-POD setup.
2967 1. OLT and ONU is detected and validated.
2968 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
2969 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
2970 4. Verify that subscriber get ip from dhcp server successfully.
2971 5. Repeat step 3 for 50 times.
2972 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
2973 """
Thangavelu K S735a6662017-06-15 18:08:23 +00002974 df = defer.Deferred()
2975 def dhcp_flow_check_scenario(df):
2976 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07002977 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00002978 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
2979 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07002980 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00002981 time.sleep(10)
2982 switch_map = None
2983 olt_configured = False
2984 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
2985 log_test.info('Installing OLT app')
2986 OnosCtrl.install_app(self.olt_app_file)
2987 time.sleep(5)
2988 log_test.info('Adding subscribers through OLT app')
2989 self.config_olt(switch_map)
2990 olt_configured = True
2991 time.sleep(5)
2992 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover")
2993 try:
2994 assert_equal(dhcp_status, True)
2995 #assert_equal(status, True)
2996 time.sleep(10)
2997 finally:
2998 self.voltha.disable_device(device_id, delete = True)
2999 self.remove_olt(switch_map)
3000 df.callback(0)
3001
3002 reactor.callLater(0, dhcp_flow_check_scenario, df)
3003 return df
3004
Thangavelu K S735a6662017-06-15 18:08:23 +00003005 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003006 def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self):
3007 """
3008 Test Method:
3009 0. Make sure that voltha is up and running on CORD-POD setup.
3010 1. OLT and ONU is detected and validated.
3011 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3012 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3013 4. Verify that subscriber get ip from dhcp server successfully.
3014 5. Send DHCP request to dhcp server which is running as onos app.
3015 6. Repeat step 5 for 50 times.
3016 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server.
3017 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003018 df = defer.Deferred()
3019 def dhcp_flow_check_scenario(df):
3020 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003021 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003022 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3023 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003024 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003025 time.sleep(10)
3026 switch_map = None
3027 olt_configured = False
3028 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3029 log_test.info('Installing OLT app')
3030 OnosCtrl.install_app(self.olt_app_file)
3031 time.sleep(5)
3032 log_test.info('Adding subscribers through OLT app')
3033 self.config_olt(switch_map)
3034 olt_configured = True
3035 time.sleep(5)
3036 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests")
3037 try:
3038 assert_equal(dhcp_status, True)
3039 #assert_equal(status, True)
3040 time.sleep(10)
3041 finally:
3042 self.voltha.disable_device(device_id, delete = True)
3043 self.remove_olt(switch_map)
3044 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003045
Thangavelu K S735a6662017-06-15 18:08:23 +00003046 reactor.callLater(0, dhcp_flow_check_scenario, df)
3047 return df
3048
Thangavelu K S735a6662017-06-15 18:08:23 +00003049 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003050 def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self):
3051 """
3052 Test Method:
3053 0. Make sure that voltha is up and running on CORD-POD setup.
3054 1. OLT and ONU is detected and validated.
3055 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3056 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app.
3057 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully.
3058 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003059 df = defer.Deferred()
3060 def dhcp_flow_check_scenario(df):
3061 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003062 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003063 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3064 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003065 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003066 time.sleep(10)
3067 switch_map = None
3068 olt_configured = False
3069 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3070 log_test.info('Installing OLT app')
3071 OnosCtrl.install_app(self.olt_app_file)
3072 time.sleep(5)
3073 log_test.info('Adding subscribers through OLT app')
3074 self.config_olt(switch_map)
3075 olt_configured = True
3076 time.sleep(5)
3077 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address")
3078 try:
3079 assert_equal(dhcp_status, True)
3080 #assert_equal(status, True)
3081 time.sleep(10)
3082 finally:
3083 self.voltha.disable_device(device_id, delete = True)
3084 self.remove_olt(switch_map)
3085 df.callback(0)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003086
Thangavelu K S735a6662017-06-15 18:08:23 +00003087 reactor.callLater(0, dhcp_flow_check_scenario, df)
3088 return df
3089
3090 @deferred(TESTCASE_TIMEOUT)
3091 def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003092 """
3093 Test Method:
3094 0. Make sure that voltha is up and running on CORD-POD setup.
3095 1. OLT and ONU is detected and validated.
3096 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3097 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app.
3098 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.
3099 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003100 df = defer.Deferred()
3101 def dhcp_flow_check_scenario(df):
3102 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003103 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003104 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3105 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003106 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003107 time.sleep(10)
3108 switch_map = None
3109 olt_configured = False
3110 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3111 log_test.info('Installing OLT app')
3112 OnosCtrl.install_app(self.olt_app_file)
3113 time.sleep(5)
3114 log_test.info('Adding subscribers through OLT app')
3115 self.config_olt(switch_map)
3116 olt_configured = True
3117 time.sleep(5)
3118 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address")
3119 try:
3120 assert_equal(dhcp_status, True)
3121 #assert_equal(status, True)
3122 time.sleep(10)
3123 finally:
3124 self.voltha.disable_device(device_id, delete = True)
3125 self.remove_olt(switch_map)
3126 df.callback(0)
3127
3128 reactor.callLater(0, dhcp_flow_check_scenario, df)
3129 return df
3130
Thangavelu K S735a6662017-06-15 18:08:23 +00003131 @deferred(TESTCASE_TIMEOUT)
3132 def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003133 """
3134 Test Method:
3135 0. Make sure that voltha is up and running on CORD-POD setup.
3136 1. OLT and ONU is detected and validated.
3137 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3138 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3139 4. Verify that subscriber get ip from dhcp server successfully.
3140 5. Deactivate dhcp server app in onos.
3141 6. Repeat step 3.
3142 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3143 """
Thangavelu K S735a6662017-06-15 18:08:23 +00003144 df = defer.Deferred()
3145 dhcp_app = 'org.onosproject.dhcp'
3146 def dhcp_flow_check_scenario(df):
3147 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003148 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S735a6662017-06-15 18:08:23 +00003149 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3150 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003151 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S735a6662017-06-15 18:08:23 +00003152 time.sleep(10)
3153 switch_map = None
3154 olt_configured = False
3155 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3156 log_test.info('Installing OLT app')
3157 OnosCtrl.install_app(self.olt_app_file)
3158 time.sleep(5)
3159 log_test.info('Adding subscribers through OLT app')
3160 self.config_olt(switch_map)
3161 olt_configured = True
3162 time.sleep(5)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003163 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
Thangavelu K S735a6662017-06-15 18:08:23 +00003164 thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,))
3165 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3166 thread2.start()
Thangavelu K S735a6662017-06-15 18:08:23 +00003167 thread1.start()
3168 time.sleep(10)
3169 thread1.join()
3170 thread2.join()
3171 try:
3172 assert_equal(self.success, True)
3173 #assert_equal(status, True)
3174 time.sleep(10)
3175 finally:
3176 self.voltha.disable_device(device_id, delete = True)
3177 self.remove_olt(switch_map)
3178 df.callback(0)
3179
3180 reactor.callLater(0, dhcp_flow_check_scenario, df)
3181 return df
3182
3183 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003184 def test_subscriber_with_voltha_for_dhcp_renew_time(self):
3185 """
3186 Test Method:
3187 0. Make sure that voltha is up and running on CORD-POD setup.
3188 1. OLT and ONU is detected and validated.
3189 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3190 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3191 4. Verify that subscriber get ip from dhcp server successfully.
3192 5. Send dhcp renew packet to dhcp server which is running as onos app.
3193 6. Repeat step 4.
3194 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003195
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003196 df = defer.Deferred()
3197 def dhcp_flow_check_scenario(df):
3198 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003199 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003200 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3201 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003202 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003203 time.sleep(10)
3204 switch_map = None
3205 olt_configured = False
3206 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3207 log_test.info('Installing OLT app')
3208 OnosCtrl.install_app(self.olt_app_file)
3209 time.sleep(5)
3210 log_test.info('Adding subscribers through OLT app')
3211 self.config_olt(switch_map)
3212 olt_configured = True
3213 time.sleep(5)
3214 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew")
3215 try:
3216 assert_equal(dhcp_status, True)
3217 #assert_equal(status, True)
3218 time.sleep(10)
3219 finally:
3220 self.voltha.disable_device(device_id, delete = True)
3221 self.remove_olt(switch_map)
3222 df.callback(0)
3223
3224 reactor.callLater(0, dhcp_flow_check_scenario, df)
3225 return df
3226
3227 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S057b7d22017-05-16 22:03:22 +00003228 def test_subscriber_with_voltha_for_dhcp_rebind_time(self):
3229 """
3230 Test Method:
3231 0. Make sure that voltha is up and running on CORD-POD setup.
3232 1. OLT and ONU is detected and validated.
3233 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3234 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3235 4. Verify that subscriber get ip from dhcp server successfully.
3236 5. Send dhcp rebind packet to dhcp server which is running as onos app.
3237 6. Repeat step 4.
3238 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003239 df = defer.Deferred()
3240 def dhcp_flow_check_scenario(df):
3241 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003242 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003243 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3244 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003245 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003246 time.sleep(10)
3247 switch_map = None
3248 olt_configured = False
3249 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3250 log_test.info('Installing OLT app')
3251 OnosCtrl.install_app(self.olt_app_file)
3252 time.sleep(5)
3253 log_test.info('Adding subscribers through OLT app')
3254 self.config_olt(switch_map)
3255 olt_configured = True
3256 time.sleep(5)
3257 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind")
3258 try:
3259 assert_equal(dhcp_status, True)
3260 #assert_equal(status, True)
3261 time.sleep(10)
3262 finally:
3263 self.voltha.disable_device(device_id, delete = True)
3264 self.remove_olt(switch_map)
3265 df.callback(0)
3266
3267 reactor.callLater(0, dhcp_flow_check_scenario, df)
3268 return df
3269
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003270 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003271 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003272 """
3273 Test Method:
3274 0. Make sure that voltha is up and running on CORD-POD setup.
3275 1. OLT and ONU is detected and validated.
3276 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3277 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3278 4. Verify that subscriber get ip from dhcp server successfully.
3279 5. Disable olt devices which is being detected in voltha CLI.
3280 6. Repeat step 3.
3281 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3282 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003283 df = defer.Deferred()
3284 dhcp_app = 'org.onosproject.dhcp'
3285 def dhcp_flow_check_scenario(df):
3286 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003287 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003288 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3289 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003290 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003291 time.sleep(10)
3292 switch_map = None
3293 olt_configured = False
3294 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3295 log_test.info('Installing OLT app')
3296 OnosCtrl.install_app(self.olt_app_file)
3297 time.sleep(5)
3298 log_test.info('Adding subscribers through OLT app')
3299 self.config_olt(switch_map)
3300 olt_configured = True
3301 time.sleep(5)
3302 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3303 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3304 log_test.info('Disable the olt device in during client send discover to voltha')
3305 thread2.start()
3306# time.sleep(randint(0,1))
3307 thread1.start()
3308 time.sleep(10)
3309 thread1.join()
3310 thread2.join()
3311 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003312 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003313 #assert_equal(status, True)
3314 time.sleep(10)
3315 finally:
3316 self.voltha.disable_device(device_id, delete = True)
3317 self.remove_olt(switch_map)
3318 df.callback(0)
3319
3320 reactor.callLater(0, dhcp_flow_check_scenario, df)
3321 return df
3322
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003323 @deferred(TESTCASE_TIMEOUT)
3324 def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self):
3325 """
3326 Test Method:
3327 0. Make sure that voltha is up and running on CORD-POD setup.
3328 1. OLT and ONU is detected and validated.
3329 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3330 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3331 4. Verify that subscriber get ip from dhcp server successfully.
3332 5. Disable olt devices which is being detected in voltha CLI.
3333 6. Repeat step 3.
3334 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3335 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow
3336 """
3337 df = defer.Deferred()
3338 no_iterations = 10
3339 dhcp_app = 'org.onosproject.dhcp'
3340 def dhcp_flow_check_scenario(df):
3341 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003342 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003343 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3344 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003345 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003346 time.sleep(10)
3347 switch_map = None
3348 olt_configured = False
3349 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3350 log_test.info('Installing OLT app')
3351 OnosCtrl.install_app(self.olt_app_file)
3352 time.sleep(5)
3353 log_test.info('Adding subscribers through OLT app')
3354 self.config_olt(switch_map)
3355 olt_configured = True
3356 time.sleep(5)
3357 for i in range(no_iterations):
3358 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3359 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
3360 log_test.info('Disable the olt device in during client send discover to voltha')
3361 thread2.start()
3362# time.sleep(randint(0,1))
3363 thread1.start()
3364 time.sleep(10)
3365 thread1.join()
3366 thread2.join()
3367 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3368 try:
3369 assert_equal(self.success, True)
3370 assert_equal(dhcp_status, True)
3371 #assert_equal(status, True)
3372 time.sleep(10)
3373 finally:
3374 self.voltha.disable_device(device_id, delete = True)
3375 self.remove_olt(switch_map)
3376 df.callback(0)
3377
3378 reactor.callLater(0, dhcp_flow_check_scenario, df)
3379 return df
3380
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003381 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003382 def test_subscriber_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003383 """
3384 Test Method:
3385 0. Make sure that voltha is up and running on CORD-POD setup.
3386 1. OLT and ONU is detected and validated.
3387 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3388 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3389 4. Verify that subscriber get ip from dhcp server successfully.
3390 5. Disable olt devices which is being detected in voltha CLI.
3391 6. Repeat step 3.
3392 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3393 8. Enable olt devices which is being detected in voltha CLI.
3394 9. Repeat steps 3 and 4.
3395 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003396 df = defer.Deferred()
3397 dhcp_app = 'org.onosproject.dhcp'
3398 def dhcp_flow_check_scenario(df):
3399 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003400 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003401 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3402 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003403 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003404 time.sleep(10)
3405 switch_map = None
3406 olt_configured = False
3407 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3408 log_test.info('Installing OLT app')
3409 OnosCtrl.install_app(self.olt_app_file)
3410 time.sleep(5)
3411 log_test.info('Adding subscribers through OLT app')
3412 self.config_olt(switch_map)
3413 olt_configured = True
3414 time.sleep(5)
3415 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3416 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3417 thread2.start()
3418 thread1.start()
3419 time.sleep(10)
3420 thread1.join()
3421 thread2.join()
3422 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003423 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003424 #assert_equal(status, True)
3425 time.sleep(10)
3426 finally:
3427 self.voltha.disable_device(device_id, delete = True)
3428 self.remove_olt(switch_map)
3429 df.callback(0)
3430
3431 reactor.callLater(0, dhcp_flow_check_scenario, df)
3432 return df
3433
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003434 @deferred(TESTCASE_TIMEOUT)
3435 def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self):
3436 """
3437 Test Method:
3438 0. Make sure that voltha is up and running on CORD-POD setup.
3439 1. OLT and ONU is detected and validated.
3440 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3441 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3442 4. Verify that subscriber get ip from dhcp server successfully.
3443 5. Disable olt devices which is being detected in voltha CLI.
3444 6. Repeat step 3.
3445 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3446 8. Enable olt devices which is being detected in voltha CLI.
3447 9. Repeat steps 3 and 4.
3448 """
3449
3450 df = defer.Deferred()
3451 no_iterations = 10
3452 dhcp_app = 'org.onosproject.dhcp'
3453 def dhcp_flow_check_scenario(df):
3454 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003455 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003456 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3457 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003458 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003459 time.sleep(10)
3460 switch_map = None
3461 olt_configured = False
3462 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3463 log_test.info('Installing OLT app')
3464 OnosCtrl.install_app(self.olt_app_file)
3465 time.sleep(5)
3466 log_test.info('Adding subscribers through OLT app')
3467 self.config_olt(switch_map)
3468 olt_configured = True
3469 time.sleep(5)
3470 for i in range(no_iterations):
3471 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",))
3472 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
3473 thread2.start()
3474 thread1.start()
3475 time.sleep(10)
3476 thread1.join()
3477 thread2.join()
3478 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3479 try:
3480 assert_equal(dhcp_status, True)
3481 #assert_equal(status, True)
3482 assert_equal(self.success, True)
3483 time.sleep(10)
3484 finally:
3485 self.voltha.disable_device(device_id, delete = True)
3486 self.remove_olt(switch_map)
3487 df.callback(0)
3488
3489 reactor.callLater(0, dhcp_flow_check_scenario, df)
3490 return df
3491
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003492 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003493 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003494 """
3495 Test Method:
3496 0. Make sure that voltha is up and running on CORD-POD setup.
3497 1. OLT and ONU is detected and validated.
3498 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3499 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3500 4. Verify that subscriber get ip from dhcp server successfully.
3501 5. Disable onu port which is being detected in voltha CLI.
3502 6. Repeat step 3.
3503 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3504 """
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003505 df = defer.Deferred()
3506 dhcp_app = 'org.onosproject.dhcp'
3507 def dhcp_flow_check_scenario(df):
3508 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003509 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003510 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3511 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003512 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003513 time.sleep(10)
3514 switch_map = None
3515 olt_configured = False
3516 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3517 log_test.info('Installing OLT app')
3518 OnosCtrl.install_app(self.olt_app_file)
3519 time.sleep(5)
3520 log_test.info('Adding subscribers through OLT app')
3521 self.config_olt(switch_map)
3522 olt_configured = True
3523 time.sleep(5)
3524 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 +00003525 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003526 thread1.start()
3527 thread2.start()
3528 time.sleep(10)
3529 thread1.join()
3530 thread2.join()
3531 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003532 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003533 #assert_equal(status, True)
3534 time.sleep(10)
3535 finally:
3536 self.voltha.disable_device(device_id, delete = True)
3537 self.remove_olt(switch_map)
3538 df.callback(0)
3539
3540 reactor.callLater(0, dhcp_flow_check_scenario, df)
3541 return df
3542
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003543 @deferred(TESTCASE_TIMEOUT)
3544 def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self):
3545 """
3546 Test Method:
3547 0. Make sure that voltha is up and running on CORD-POD setup.
3548 1. OLT and ONU is detected and validated.
3549 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3550 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3551 4. Verify that subscriber get ip from dhcp server successfully.
3552 5. Disable onu port which is being detected in voltha CLI.
3553 6. Repeat step 3.
3554 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3555 """
3556 df = defer.Deferred()
3557 no_iterations = 10
3558 dhcp_app = 'org.onosproject.dhcp'
3559 def dhcp_flow_check_scenario(df):
3560 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003561 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003562 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3563 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003564 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003565 time.sleep(10)
3566 switch_map = None
3567 olt_configured = False
3568 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3569 log_test.info('Installing OLT app')
3570 OnosCtrl.install_app(self.olt_app_file)
3571 time.sleep(5)
3572 log_test.info('Adding subscribers through OLT app')
3573 self.config_olt(switch_map)
3574 olt_configured = True
3575 time.sleep(5)
3576 for i in range(no_iterations):
3577 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 +00003578 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003579 thread1.start()
3580 thread2.start()
3581 time.sleep(10)
3582 thread1.join()
3583 thread2.join()
3584 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3585 try:
3586 #assert_equal(status, True)
3587 assert_equal(dhcp_status, True)
3588 assert_equal(self.success, True)
3589 time.sleep(10)
3590 finally:
3591 self.voltha.disable_device(device_id, delete = True)
3592 self.remove_olt(switch_map)
3593 df.callback(0)
3594
3595 reactor.callLater(0, dhcp_flow_check_scenario, df)
3596 return df
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003597
3598 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003599 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003600 """
3601 Test Method:
3602 0. Make sure that voltha is up and running on CORD-POD setup.
3603 1. OLT and ONU is detected and validated.
3604 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3605 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3606 4. Verify that subscriber get ip from dhcp server successfully.
3607 5. Disable onu port which is being detected in voltha CLI.
3608 6. Repeat step 3.
3609 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3610 8. Enable onu port which is being detected in voltha CLI.
3611 9. Repeat steps 3 and 4.
3612 """
3613
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003614 df = defer.Deferred()
3615 dhcp_app = 'org.onosproject.dhcp'
3616 def dhcp_flow_check_scenario(df):
3617 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003618 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003619 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3620 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003621 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003622 time.sleep(10)
3623 switch_map = None
3624 olt_configured = False
3625 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3626 log_test.info('Installing OLT app')
3627 OnosCtrl.install_app(self.olt_app_file)
3628 time.sleep(5)
3629 log_test.info('Adding subscribers through OLT app')
3630 self.config_olt(switch_map)
3631 olt_configured = True
3632 time.sleep(5)
3633 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 +00003634 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003635 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3636 thread2.start()
3637 time.sleep(randint(0,1))
3638 thread1.start()
3639 time.sleep(10)
3640 thread1.join()
3641 thread2.join()
3642 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3643 assert_equal(dhcp_status, True)
3644 try:
Chetan Gaonkercf37f262017-06-19 19:11:11 +00003645 assert_equal(self.success, True)
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003646 #assert_equal(status, True)
3647 time.sleep(10)
3648 finally:
3649 self.voltha.disable_device(device_id, delete = True)
3650 self.remove_olt(switch_map)
3651 df.callback(0)
3652
3653 reactor.callLater(0, dhcp_flow_check_scenario, df)
3654 return df
3655
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003656 @deferred(TESTCASE_TIMEOUT)
3657 def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self):
3658 """
3659 Test Method:
3660 0. Make sure that voltha is up and running on CORD-POD setup.
3661 1. OLT and ONU is detected and validated.
3662 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3663 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app.
3664 4. Verify that subscriber get ip from dhcp server successfully.
3665 5. Disable onu port which is being detected in voltha CLI.
3666 6. Repeat step 3.
3667 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway.
3668 8. Enable onu port which is being detected in voltha CLI.
3669 9. Repeat steps 3 and 4.
3670 """
3671
3672 df = defer.Deferred()
3673 no_iterations = 10
3674 dhcp_app = 'org.onosproject.dhcp'
3675 def dhcp_flow_check_scenario(df):
3676 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003677 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003678 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3679 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003680 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003681 time.sleep(10)
3682 switch_map = None
3683 olt_configured = False
3684 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3685 log_test.info('Installing OLT app')
3686 OnosCtrl.install_app(self.olt_app_file)
3687 time.sleep(5)
3688 log_test.info('Adding subscribers through OLT app')
3689 self.config_olt(switch_map)
3690 olt_configured = True
3691 time.sleep(5)
3692 for i in range(no_iterations):
3693 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 +00003694 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003695 log_test.info('Restart dhcp app in onos during client send discover to voltha')
3696 thread2.start()
3697 time.sleep(randint(0,1))
3698 thread1.start()
3699 time.sleep(10)
3700 thread1.join()
3701 thread2.join()
3702 dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT)
3703 assert_equal(dhcp_status, True)
3704 try:
3705 assert_equal(self.success, True)
3706 #assert_equal(status, True)
3707 time.sleep(10)
3708 finally:
3709 self.voltha.disable_device(device_id, delete = True)
3710 self.remove_olt(switch_map)
3711 df.callback(0)
3712
3713 reactor.callLater(0, dhcp_flow_check_scenario, df)
3714 return df
3715
Thangavelu K S0f2c5232017-06-19 19:11:43 +00003716 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003717 def test_two_subscribers_with_voltha_for_dhcp_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003718 """
3719 Test Method:
3720 0. Make sure that voltha is up and running on CORD-POD setup.
3721 1. OLT and ONU is detected and validated.
3722 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3723 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3724 4. Verify that subscribers had got different ips from dhcp server successfully.
3725 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003726 df = defer.Deferred()
3727 self.success = True
3728 dhcp_app = 'org.onosproject.dhcp'
3729 def dhcp_flow_check_scenario(df):
3730 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003731 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003732 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3733 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003734 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003735 time.sleep(10)
3736 switch_map = None
3737 olt_configured = False
3738 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3739 log_test.info('Installing OLT app')
3740 OnosCtrl.install_app(self.olt_app_file)
3741 time.sleep(5)
3742 log_test.info('Adding subscribers through OLT app')
3743 self.config_olt(switch_map)
3744 olt_configured = True
3745 time.sleep(5)
3746 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3747 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3748 thread1.start()
3749 thread2.start()
3750 time.sleep(10)
3751 thread1.join()
3752 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003753 dhcp_flow_status = self.success
3754 try:
3755# if self.success is not True:
3756 assert_equal(dhcp_flow_status, True)
3757 #assert_equal(status, True)
3758 time.sleep(10)
3759 finally:
3760 self.voltha.disable_device(device_id, delete = True)
3761 self.remove_olt(switch_map)
3762 df.callback(0)
3763
3764 reactor.callLater(0, dhcp_flow_check_scenario, df)
3765 return df
3766
3767 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003768 def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003769 """
3770 Test Method:
3771 0. Make sure that voltha is up and running on CORD-POD setup.
3772 1. OLT and ONU is detected and validated.
3773 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3774 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3775 4. Verify that subscribers had got ip from dhcp server successfully.
3776 5. Repeat step 3 and 4 for 10 times for both subscribers.
3777 6 Verify that subscribers should get same ips which are offered the first time from dhcp server.
3778 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003779 df = defer.Deferred()
3780 self.success = True
3781 dhcp_app = 'org.onosproject.dhcp'
3782 def dhcp_flow_check_scenario(df):
3783 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003784 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003785 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3786 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003787 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003788 time.sleep(10)
3789 switch_map = None
3790 olt_configured = False
3791 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3792 log_test.info('Installing OLT app')
3793 OnosCtrl.install_app(self.olt_app_file)
3794 time.sleep(5)
3795 log_test.info('Adding subscribers through OLT app')
3796 self.config_olt(switch_map)
3797 olt_configured = True
3798 time.sleep(5)
3799 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3800 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",))
3801 thread1.start()
3802 thread2.start()
3803 time.sleep(10)
3804 thread1.join()
3805 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003806 dhcp_flow_status = self.success
3807 try:
3808# if self.success is not True:
3809 assert_equal(dhcp_flow_status, True)
3810 #assert_equal(status, True)
3811 time.sleep(10)
3812 finally:
3813 self.voltha.disable_device(device_id, delete = True)
3814 self.remove_olt(switch_map)
3815 df.callback(0)
3816
3817 reactor.callLater(0, dhcp_flow_check_scenario, df)
3818 return df
3819
3820 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003821 def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003822 """
3823 Test Method:
3824 0. Make sure that voltha is up and running on CORD-POD setup.
3825 1. OLT and ONU is detected and validated.
3826 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3827 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3828 4. Verify that subscribers had got ip from dhcp server successfully.
3829 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
3830 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
3831 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003832 df = defer.Deferred()
3833 self.success = True
3834 dhcp_app = 'org.onosproject.dhcp'
3835 def dhcp_flow_check_scenario(df):
3836 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003837 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003838 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3839 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003840 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003841 time.sleep(10)
3842 switch_map = None
3843 olt_configured = False
3844 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3845 log_test.info('Installing OLT app')
3846 OnosCtrl.install_app(self.olt_app_file)
3847 time.sleep(5)
3848 log_test.info('Adding subscribers through OLT app')
3849 self.config_olt(switch_map)
3850 olt_configured = True
3851 time.sleep(5)
3852 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",))
3853 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
3854 thread1.start()
3855 thread2.start()
3856 time.sleep(10)
3857 thread1.join()
3858 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003859 dhcp_flow_status = self.success
3860 try:
3861# if self.success is not True:
3862 assert_equal(dhcp_flow_status, True)
3863 #assert_equal(status, True)
3864 time.sleep(10)
3865 finally:
3866 self.voltha.disable_device(device_id, delete = True)
3867 self.remove_olt(switch_map)
3868 df.callback(0)
3869
3870 reactor.callLater(0, dhcp_flow_check_scenario, df)
3871 return df
3872
3873 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003874 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 +00003875 """
3876 Test Method:
3877 0. Make sure that voltha is up and running on CORD-POD setup.
3878 1. OLT and ONU is detected and validated.
3879 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3880 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app.
3881 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app.
3882 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully.
3883 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003884
3885 df = defer.Deferred()
3886 self.success = True
3887 dhcp_app = 'org.onosproject.dhcp'
3888 def dhcp_flow_check_scenario(df):
3889 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003890 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003891 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3892 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003893 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003894 time.sleep(10)
3895 switch_map = None
3896 olt_configured = False
3897 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3898 log_test.info('Installing OLT app')
3899 OnosCtrl.install_app(self.olt_app_file)
3900 time.sleep(5)
3901 log_test.info('Adding subscribers through OLT app')
3902 self.config_olt(switch_map)
3903 olt_configured = True
3904 time.sleep(5)
3905 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
3906 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",))
3907 thread1.start()
3908 thread2.start()
3909 time.sleep(10)
3910 thread1.join()
3911 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003912 dhcp_flow_status = self.success
3913 try:
3914# if self.success is not True:
3915 assert_equal(dhcp_flow_status, True)
3916 #assert_equal(status, True)
3917 time.sleep(10)
3918 finally:
3919 self.voltha.disable_device(device_id, delete = True)
3920 self.remove_olt(switch_map)
3921 df.callback(0)
3922
3923 reactor.callLater(0, dhcp_flow_check_scenario, df)
3924 return df
3925
3926 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00003927 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 +00003928 """
3929 Test Method:
3930 0. Make sure that voltha is up and running on CORD-POD setup.
3931 1. OLT and ONU is detected and validated.
3932 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3933 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app.
3934 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app.
3935 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully.
3936 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003937 df = defer.Deferred()
3938 self.success = True
3939 dhcp_app = 'org.onosproject.dhcp'
3940 def dhcp_flow_check_scenario(df):
3941 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003942 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003943 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3944 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003945 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003946 time.sleep(10)
3947 switch_map = None
3948 olt_configured = False
3949 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
3950 log_test.info('Installing OLT app')
3951 OnosCtrl.install_app(self.olt_app_file)
3952 time.sleep(5)
3953 log_test.info('Adding subscribers through OLT app')
3954 self.config_olt(switch_map)
3955 olt_configured = True
3956 time.sleep(5)
3957 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
3958 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
3959 thread1.start()
3960 thread2.start()
3961 time.sleep(10)
3962 thread1.join()
3963 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003964 dhcp_flow_status = self.success
3965 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003966 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003967 time.sleep(10)
3968 finally:
3969 self.voltha.disable_device(device_id, delete = True)
3970 self.remove_olt(switch_map)
3971 df.callback(0)
3972
3973 reactor.callLater(0, dhcp_flow_check_scenario, df)
3974 return df
3975
3976 @deferred(TESTCASE_TIMEOUT)
3977 def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00003978 """
3979 Test Method:
3980 0. Make sure that voltha is up and running on CORD-POD setup.
3981 1. OLT and ONU is detected and validated.
3982 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
3983 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
3984 4. Verify that subscribers had got ip from dhcp server successfully.
3985 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
3986 6. Repeat step 3 and 4 for one subscriber where uni port is down.
3987 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
3988 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003989 df = defer.Deferred()
3990 self.success = True
3991 dhcp_app = 'org.onosproject.dhcp'
3992 def dhcp_flow_check_scenario(df):
3993 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07003994 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003995 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
3996 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07003997 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00003998 time.sleep(10)
3999 switch_map = None
4000 olt_configured = False
4001 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4002 log_test.info('Installing OLT app')
4003 OnosCtrl.install_app(self.olt_app_file)
4004 time.sleep(5)
4005 log_test.info('Adding subscribers through OLT app')
4006 self.config_olt(switch_map)
4007 olt_configured = True
4008 time.sleep(5)
4009 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",))
4010 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",))
4011 thread1.start()
4012 thread2.start()
4013 time.sleep(10)
4014 thread1.join()
4015 thread2.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004016 dhcp_flow_status = self.success
4017 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004018 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004019 time.sleep(10)
4020 finally:
4021 self.voltha.disable_device(device_id, delete = True)
4022 self.remove_olt(switch_map)
4023 df.callback(0)
4024
4025 reactor.callLater(0, dhcp_flow_check_scenario, df)
4026 return df
4027
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004028 @deferred(TESTCASE_TIMEOUT)
4029 def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004030 """
4031 Test Method:
4032 0. Make sure that voltha is up and running on CORD-POD setup.
4033 1. OLT and ONU is detected and validated.
4034 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4035 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4036 4. Verify that subscribers had got ip from dhcp server successfully.
4037 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
4038 6. Repeat step 3 and 4 for one subscriber where uni port is down.
4039 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed.
4040 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
4041 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
4042 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
4043 """
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004044 df = defer.Deferred()
4045 self.success = True
4046 dhcp_app = 'org.onosproject.dhcp'
4047 def dhcp_flow_check_scenario(df):
4048 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004049 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004050 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4051 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004052 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004053 time.sleep(10)
4054 switch_map = None
4055 olt_configured = False
4056 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4057 log_test.info('Installing OLT app')
4058 OnosCtrl.install_app(self.olt_app_file)
4059 time.sleep(5)
4060 log_test.info('Adding subscribers through OLT app')
4061 self.config_olt(switch_map)
4062 olt_configured = True
4063 time.sleep(5)
4064 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4065 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 +00004066 thread3 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.INTF_2_RX_DEFAULT,))
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004067 thread1.start()
4068 thread2.start()
4069 thread3.start()
4070 time.sleep(10)
4071 thread1.join()
4072 thread2.join()
4073 thread3.join()
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004074 dhcp_flow_status = self.success
4075 try:
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004076 assert_equal(dhcp_flow_status, True)
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004077 time.sleep(10)
4078 finally:
4079 self.voltha.disable_device(device_id, delete = True)
4080 self.remove_olt(switch_map)
4081 df.callback(0)
4082
4083 reactor.callLater(0, dhcp_flow_check_scenario, df)
4084 return df
4085
Thangavelu K S0ffd5b82017-06-21 18:01:59 +00004086 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004087 def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004088 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004089 Test Method: uni_port
Thangavelu K S057b7d22017-05-16 22:03:22 +00004090 0. Make sure that voltha is up and running on CORD-POD setup.
4091 1. OLT and ONU is detected and validated.
4092 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4093 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4094 4. Verify that subscribers had got ip from dhcp server successfully.
4095 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4096 6. Disable the olt device which is detected in voltha.
4097 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4098 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004099 df = defer.Deferred()
4100 self.success = True
4101 dhcp_app = 'org.onosproject.dhcp'
4102 def dhcp_flow_check_scenario(df):
4103 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004104 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004105 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4106 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004107 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004108 time.sleep(10)
4109 switch_map = None
4110 olt_configured = False
4111 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4112 log_test.info('Installing OLT app')
4113 OnosCtrl.install_app(self.olt_app_file)
4114 time.sleep(5)
4115 log_test.info('Adding subscribers through OLT app')
4116 self.config_olt(switch_map)
4117 olt_configured = True
4118 time.sleep(5)
4119 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4120 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4121 thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
4122
4123 thread1.start()
4124 thread2.start()
4125 thread3.start()
4126 time.sleep(10)
4127 thread1.join()
4128 thread2.join()
4129 thread3.join()
4130 dhcp_flow_status = self.success
4131 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004132 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004133 time.sleep(10)
4134 finally:
4135 self.voltha.disable_device(device_id, delete = True)
4136 self.remove_olt(switch_map)
4137 df.callback(0)
4138
4139 reactor.callLater(0, dhcp_flow_check_scenario, df)
4140 return df
4141
4142 @deferred(TESTCASE_TIMEOUT)
4143 def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004144 """
4145 Test Method:
4146 0. Make sure that voltha is up and running on CORD-POD setup.
4147 1. OLT and ONU is detected and validated.
4148 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4149 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4150 4. Verify that subscribers had got ip from dhcp server successfully.
4151 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4152 6. Disable the olt device which is detected in voltha.
4153 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4154 8. Enable the olt device which is detected in voltha.
4155 9. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed.
4156 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004157 df = defer.Deferred()
4158 self.success = True
4159 dhcp_app = 'org.onosproject.dhcp'
4160 def dhcp_flow_check_scenario(df):
4161 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004162 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004163 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4164 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004165 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004166 time.sleep(10)
4167 switch_map = None
4168 olt_configured = False
4169 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4170 log_test.info('Installing OLT app')
4171 OnosCtrl.install_app(self.olt_app_file)
4172 time.sleep(5)
4173 log_test.info('Adding subscribers through OLT app')
4174 self.config_olt(switch_map)
4175 olt_configured = True
4176 time.sleep(5)
4177 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4178 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4179 thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
4180 thread1.start()
4181 thread2.start()
4182 thread3.start()
4183 time.sleep(10)
4184 thread1.join()
4185 thread2.join()
4186 thread3.join()
4187 dhcp_flow_status = self.success
4188 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004189 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004190 time.sleep(10)
4191 finally:
4192 self.voltha.disable_device(device_id, delete = True)
4193 self.remove_olt(switch_map)
4194 df.callback(0)
4195
4196 reactor.callLater(0, dhcp_flow_check_scenario, df)
4197 return df
4198
4199 @deferred(TESTCASE_TIMEOUT)
4200 def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004201 """
4202 Test Method:
4203 0. Make sure that voltha is up and running on CORD-POD setup.
4204 1. OLT and ONU is detected and validated.
4205 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4206 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app.
4207 4. Verify that subscribers had got ip from dhcp server successfully.
4208 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
4209 6. Pause the olt device which is detected in voltha.
4210 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed.
4211 """
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004212 df = defer.Deferred()
4213 self.success = True
4214 dhcp_app = 'org.onosproject.dhcp'
4215 def dhcp_flow_check_scenario(df):
4216 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004217 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004218 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4219 assert_not_equal(device_id, None)
A R Karthick53442712017-07-27 12:23:30 -07004220 voltha = VolthaCtrl(**self.voltha_attrs)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004221 time.sleep(10)
4222 switch_map = None
4223 olt_configured = False
4224 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4225 log_test.info('Installing OLT app')
4226 OnosCtrl.install_app(self.olt_app_file)
4227 time.sleep(5)
4228 log_test.info('Adding subscribers through OLT app')
4229 self.config_olt(switch_map)
4230 olt_configured = True
4231 time.sleep(5)
4232 thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,))
4233 thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,))
4234 thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,))
4235 thread1.start()
4236 thread2.start()
4237 thread3.start()
4238 time.sleep(10)
4239 thread1.join()
4240 thread2.join()
4241 thread3.join()
4242 dhcp_flow_status = self.success
4243 try:
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004244 assert_equal(dhcp_flow_status, True)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004245 time.sleep(10)
4246 finally:
4247 self.voltha.disable_device(device_id, delete = True)
4248 self.remove_olt(switch_map)
4249 df.callback(0)
4250
4251 reactor.callLater(0, dhcp_flow_check_scenario, df)
4252 return df
4253
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004254 def test_three_subscribers_with_voltha_for_dhcp_discover_requests(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004255 """
4256 Test Method:
4257 0. Make sure that voltha is up and running on CORD-POD setup.
4258 1. OLT and ONU is detected and validated.
4259 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4260 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4261 4. Verify that subscriber get ip from dhcp server successfully.
4262 """
4263 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4264 num_subscribers = 3
4265 num_channels = 1
4266 services = ('DHCP')
4267 cbs = (self.dhcp_flow_check, None, None)
4268 self.voltha_subscribers(services, cbs = cbs,
4269 num_subscribers = num_subscribers,
4270 num_channels = num_channels)
4271
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004272 def test_five_subscribers_with_voltha_for_dhcp_discover_requests(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004273 """
4274 Test Method:
4275 0. Make sure that voltha is up and running on CORD-POD setup.
4276 1. OLT and ONU is detected and validated.
4277 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4278 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4279 4. Verify that subscriber get ip from dhcp server successfully.
4280 """
4281 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4282 num_subscribers = 5
4283 num_channels = 1
4284 services = ('DHCP')
4285 cbs = (self.dhcp_flow_check, None, None)
4286 self.voltha_subscribers(services, cbs = cbs,
4287 num_subscribers = num_subscribers,
4288 num_channels = num_channels)
4289
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004290 def test_nine_subscribers_with_voltha_for_dhcp_discover_requests(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004291 """
4292 Test Method:
4293 0. Make sure that voltha is up and running on CORD-POD setup.
4294 1. OLT and ONU is detected and validated.
4295 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4296 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4297 4. Verify that subscriber get ip from dhcp server successfully.
4298 """
4299 """Test subscriber join next for channel surfing with 9 subscribers browsing 1 channels each"""
4300 num_subscribers = 9
4301 num_channels = 1
4302 services = ('DHCP')
4303 cbs = (self.dhcp_flow_check, None, None)
4304 self.voltha_subscribers(services, cbs = cbs,
4305 num_subscribers = num_subscribers,
4306 num_channels = num_channels)
4307
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004308 def test_three_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004309 """
4310 Test Method:
4311 0. Make sure that voltha is up and running on CORD-POD setup.
4312 1. OLT and ONU is detected and validated.
4313 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers)
4314 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4315 4. Verify that subscriber get ip from dhcp server successfully.
4316 """
4317 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4318 num_subscribers = 3
4319 num_channels = 1
4320 services = ('TLS','DHCP')
4321 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4322 self.voltha_subscribers(services, cbs = cbs,
4323 num_subscribers = num_subscribers,
4324 num_channels = num_channels)
4325
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004326 def test_five_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004327 """
4328 Test Method:
4329 0. Make sure that voltha is up and running on CORD-POD setup.
4330 1. OLT and ONU is detected and validated.
4331 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers)
4332 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4333 4. Verify that subscriber get ip from dhcp server successfully.
4334 """
4335 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4336 num_subscribers = 5
4337 num_channels = 1
4338 services = ('TLS','DHCP')
4339 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4340 self.voltha_subscribers(services, cbs = cbs,
4341 num_subscribers = num_subscribers,
4342 num_channels = num_channels)
4343
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004344 def test_nine_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00004345 """
4346 Test Method:
4347 0. Make sure that voltha is up and running on CORD-POD setup.
4348 1. OLT and ONU is detected and validated.
4349 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers)
4350 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app.
4351 4. Verify that subscriber get ip from dhcp server successfully.
4352 """
4353 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
4354 num_subscribers = 9
4355 num_channels = 1
4356 services = ('TLS','DHCP')
4357 cbs = (self.tls_flow_check, self.dhcp_flow_check, None)
4358 self.voltha_subscribers(services, cbs = cbs,
4359 num_subscribers = num_subscribers,
4360 num_channels = num_channels)
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004361
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004362# @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004363 def test_subscriber_with_voltha_for_dhcprelay_request(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004364 """
4365 Test Method:
4366 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4367 1. OLT and ONU is detected and validated.
4368 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4369 3. Send dhcp request from residential subscrber to external dhcp server.
4370 4. Verify that subscriber get ip from external dhcp server successfully.
4371 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004372 self.voltha_dhcprelay_setUpClass()
Thangavelu K S6432b522017-07-22 00:05:54 +00004373# if not port_list:
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004374# port_list = self.generate_port_list(1, 0)
4375 iface = self.port_map[self.port_list[0][1]]
Thangavelu K S6432b522017-07-22 00:05:54 +00004376 mac = self.get_mac(iface)
4377 self.host_load(iface)
4378 ##we use the defaults for this test that serves as an example for others
4379 ##You don't need to restart dhcpd server if retaining default config
4380 config = self.default_config
4381 options = self.default_options
4382 subnet = self.default_subnet_config
4383 dhcpd_interface_list = self.relay_interfaces
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004384 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004385 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004386 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4387 assert_not_equal(device_id, None)
4388 voltha = VolthaCtrl(**self.voltha_attrs)
4389 time.sleep(10)
4390 switch_map = None
4391 olt_configured = False
4392 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4393 log_test.info('Installing OLT app')
4394 OnosCtrl.install_app(self.olt_app_file)
4395 time.sleep(5)
4396 log_test.info('Adding subscribers through OLT app')
4397 self.config_olt(switch_map)
4398 olt_configured = True
4399 time.sleep(5)
Thangavelu K S6432b522017-07-22 00:05:54 +00004400 self.dhcpd_start(intf_list = dhcpd_interface_list,
4401 config = config,
4402 options = options,
4403 subnet = subnet)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004404 try:
4405 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4406 self.send_recv(mac=mac)
4407 finally:
4408 self.voltha.disable_device(device_id, delete = True)
4409 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004410
Thangavelu K Se6c77c72017-06-23 21:28:48 +00004411 @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004412 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004413 """
4414 Test Method:
4415 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4416 1. OLT and ONU is detected and validated.
4417 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4418 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server.
4419 4. Verify that subscriber should not get ip from external dhcp server.
4420 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004421 self.voltha_dhcprelay_setUpClass()
4422# if not port_list:
4423# port_list = self.generate_port_list(1, 0)
4424 iface = self.port_map[self.port_list[0][1]]
4425 mac = self.get_mac(iface)
4426 self.host_load(iface)
4427 ##we use the defaults for this test that serves as an example for others
4428 ##You don't need to restart dhcpd server if retaining default config
4429 config = self.default_config
4430 options = self.default_options
4431 subnet = self.default_subnet_config
4432 dhcpd_interface_list = self.relay_interfaces
4433 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004434 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004435 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4436 assert_not_equal(device_id, None)
4437 voltha = VolthaCtrl(**self.voltha_attrs)
4438 time.sleep(10)
4439 switch_map = None
4440 olt_configured = False
4441 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4442 log_test.info('Installing OLT app')
4443 OnosCtrl.install_app(self.olt_app_file)
4444 time.sleep(5)
4445 log_test.info('Adding subscribers through OLT app')
4446 self.config_olt(switch_map)
4447 olt_configured = True
4448 time.sleep(5)
4449 self.dhcpd_start(intf_list = dhcpd_interface_list,
4450 config = config,
4451 options = options,
4452 subnet = subnet)
4453 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4454 cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
4455 try:
4456 assert_equal(cip,None)
4457 log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
4458 finally:
4459 self.voltha.disable_device(device_id, delete = True)
4460 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004461
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004462# @deferred(TESTCASE_TIMEOUT)
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004463 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004464 """
4465 Test Method:
4466 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup.
4467 1. OLT and ONU is detected and validated.
4468 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4469 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server.
4470 4. Verify that subscriber should not get ip from external dhcp server.
4471 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004472 self.voltha_dhcprelay_setUpClass()
4473# if not port_list:
4474# port_list = self.generate_port_list(1, 0)
4475 iface = self.port_map[self.port_list[0][1]]
4476 mac = self.get_mac(iface)
4477 self.host_load(iface)
4478 ##we use the defaults for this test that serves as an example for others
4479 ##You don't need to restart dhcpd server if retaining default config
4480 config = self.default_config
4481 options = self.default_options
4482 subnet = self.default_subnet_config
4483 dhcpd_interface_list = self.relay_interfaces
4484 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004485 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004486 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4487 assert_not_equal(device_id, None)
4488 voltha = VolthaCtrl(**self.voltha_attrs)
4489 time.sleep(10)
4490 switch_map = None
4491 olt_configured = False
4492 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4493 log_test.info('Installing OLT app')
4494 OnosCtrl.install_app(self.olt_app_file)
4495 time.sleep(5)
4496 log_test.info('Adding subscribers through OLT app')
4497 self.config_olt(switch_map)
4498 olt_configured = True
4499 time.sleep(5)
4500 self.dhcpd_start(intf_list = dhcpd_interface_list,
4501 config = config,
4502 options = options,
4503 subnet = subnet)
4504 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4505 cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:01:98:05')
4506 try:
4507 assert_equal(cip,None)
4508 log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
4509 finally:
4510 self.voltha.disable_device(device_id, delete = True)
4511 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004512
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004513 def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_source_mac(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004514 """
4515 Test Method:
4516 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4517 1. OLT and ONU is detected and validated.
4518 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4519 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server.
4520 4. Verify that subscriber should not get ip from external dhcp server.
4521 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004522 self.voltha_dhcprelay_setUpClass()
4523# if not port_list:
4524# port_list = self.generate_port_list(1, 0)
4525 iface = self.port_map[self.port_list[0][1]]
4526 mac = self.get_mac(iface)
4527 self.host_load(iface)
4528 ##we use the defaults for this test that serves as an example for others
4529 ##You don't need to restart dhcpd server if retaining default config
4530 config = self.default_config
4531 options = self.default_options
4532 subnet = self.default_subnet_config
4533 dhcpd_interface_list = self.relay_interfaces
4534 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004535 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004536 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4537 assert_not_equal(device_id, None)
4538 voltha = VolthaCtrl(**self.voltha_attrs)
4539 time.sleep(10)
4540 switch_map = None
4541 olt_configured = False
4542 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4543 log_test.info('Installing OLT app')
4544 OnosCtrl.install_app(self.olt_app_file)
4545 time.sleep(5)
4546 log_test.info('Adding subscribers through OLT app')
4547 self.config_olt(switch_map)
4548 olt_configured = True
4549 time.sleep(5)
4550 self.dhcpd_start(intf_list = dhcpd_interface_list,
4551 config = config,
4552 options = options,
4553 subnet = subnet)
4554 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4555 cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
4556 try:
4557 assert_equal(cip,None)
4558 log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
4559 finally:
4560 self.voltha.disable_device(device_id, delete = True)
4561 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004562
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004563 def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004564 """
4565 Test Method:
4566 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4567 1. OLT and ONU is detected and validated.
4568 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4569 3. Send dhcp request from residential subscrber to external dhcp server.
4570 4. Verify that subscriber get ip from external dhcp server successfully.
4571 5. Send dhcp release from residential subscrber to external dhcp server.
4572 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway.
4573 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004574 self.voltha_dhcprelay_setUpClass()
4575# if not port_list:
4576# port_list = self.generate_port_list(1, 0)
4577 iface = self.port_map[self.port_list[0][1]]
4578 mac = self.get_mac(iface)
4579 self.host_load(iface)
4580 ##we use the defaults for this test that serves as an example for others
4581 ##You don't need to restart dhcpd server if retaining default config
4582 config = self.default_config
4583 options = self.default_options
4584 subnet = self.default_subnet_config
4585 dhcpd_interface_list = self.relay_interfaces
4586 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004587 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004588 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4589 assert_not_equal(device_id, None)
4590 voltha = VolthaCtrl(**self.voltha_attrs)
4591 time.sleep(10)
4592 switch_map = None
4593 olt_configured = False
4594 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4595 log_test.info('Installing OLT app')
4596 OnosCtrl.install_app(self.olt_app_file)
4597 time.sleep(5)
4598 log_test.info('Adding subscribers through OLT app')
4599 self.config_olt(switch_map)
4600 olt_configured = True
4601 time.sleep(5)
4602 self.dhcpd_start(intf_list = dhcpd_interface_list,
4603 config = config,
4604 options = options,
4605 subnet = subnet)
4606 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = iface)
4607 cip, sip = self.send_recv(mac=mac)
4608 log_test.info('Releasing ip %s to server %s' %(cip, sip))
4609 try:
4610 assert_equal(self.dhcp.release(cip), True)
4611 log_test.info('Triggering DHCP discover again after release')
4612 cip2, sip2 = self.send_recv(mac=mac)
4613 log_test.info('Verifying released IP was given back on rediscover')
4614 assert_equal(cip, cip2)
4615 log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
4616 assert_equal(self.dhcp.release(cip2), True)
4617 finally:
4618 self.voltha.disable_device(device_id, delete = True)
4619 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004620
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004621 ##Not yet validated
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004622 def test_subscriber_with_voltha_for_dhcprelay_starvation(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004623 """
4624 Test Method:
4625 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4626 1. OLT and ONU is detected and validated.
4627 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4628 3. Send dhcp request from residential subscriber to external dhcp server.
4629 4. Verify that subscriber get ip from external dhcp server. successfully.
4630 5. Repeat step 3 and 4 for 10 times.
4631 6 Verify that subscriber should get ip from external dhcp server..
4632 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004633 self.voltha_dhcprelay_setUpClass()
4634# if not port_list:
4635# port_list = self.generate_port_list(1, 0)
4636 iface = self.port_map[self.port_list[0][1]]
4637 mac = self.get_mac(iface)
4638 self.host_load(iface)
4639 ##we use the defaults for this test that serves as an example for others
4640 ##You don't need to restart dhcpd server if retaining default config
4641 config = self.default_config
4642 options = self.default_options
4643 subnet = self.default_subnet_config
4644 dhcpd_interface_list = self.relay_interfaces
4645 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004646 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004647 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4648 assert_not_equal(device_id, None)
4649 voltha = VolthaCtrl(**self.voltha_attrs)
4650 time.sleep(10)
4651 switch_map = None
4652 olt_configured = False
4653 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4654 log_test.info('Installing OLT app')
4655 OnosCtrl.install_app(self.olt_app_file)
4656 time.sleep(5)
4657 log_test.info('Adding subscribers through OLT app')
4658 self.config_olt(switch_map)
4659 olt_configured = True
4660 time.sleep(5)
4661 self.dhcpd_start(intf_list = dhcpd_interface_list,
4662 config = config,
4663 options = options,
4664 subnet = subnet)
4665 #self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = iface)
4666 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4667 log_test.info('Verifying 1 ')
4668 count = 0
4669 while True:
4670 #mac = RandMAC()._fix()
4671 cip, sip = self.send_recv(mac=mac,update_seed = True,validate = False)
4672 if cip is None:
4673 break
4674 else:
4675 count += 1
4676 assert_equal(count,91)
4677 log_test.info('Verifying 2 ')
4678 cip, sip = self.send_recv(mac=mac, update_seed = True, validate = False)
4679 try:
4680 assert_equal(cip, None)
4681 assert_equal(sip, None)
4682 finally:
4683 self.voltha.disable_device(device_id, delete = True)
4684 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004685
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004686 def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004687 """
4688 Test Method:
4689 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4690 1. OLT and ONU is detected and validated.
4691 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4692 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server.
4693 4. Verify that subscriber should not get ip from external dhcp server..
4694 5. Repeat steps 3 and 4 for 10 times.
4695 6 Verify that subscriber should not get ip from external dhcp server..
4696 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004697 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004698 """
4699 Test Method:
4700 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4701 1. OLT and ONU is detected and validated.
4702 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4703 3. Send dhcp request from residential subscriber to external dhcp server.
4704 4. Verify that subscriber get ip from external dhcp server. successfully.
4705 5. Repeat step 3 for 50 times.
4706 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4707 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004708 self.voltha_dhcprelay_setUpClass()
4709# if not port_list:
4710# port_list = self.generate_port_list(1, 0)
4711 iface = self.port_map[self.port_list[0][1]]
4712 mac = self.get_mac(iface)
4713 self.host_load(iface)
4714 ##we use the defaults for this test that serves as an example for others
4715 ##You don't need to restart dhcpd server if retaining default config
4716 config = self.default_config
4717 options = self.default_options
4718 subnet = self.default_subnet_config
4719 dhcpd_interface_list = self.relay_interfaces
4720 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004721 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004722 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4723 assert_not_equal(device_id, None)
4724 voltha = VolthaCtrl(**self.voltha_attrs)
4725 time.sleep(10)
4726 switch_map = None
4727 olt_configured = False
4728 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4729 log_test.info('Installing OLT app')
4730 OnosCtrl.install_app(self.olt_app_file)
4731 time.sleep(5)
4732 log_test.info('Adding subscribers through OLT app')
4733 self.config_olt(switch_map)
4734 olt_configured = True
4735 time.sleep(5)
4736 self.dhcpd_start(intf_list = dhcpd_interface_list,
4737 config = config,
4738 options = options,
4739 subnet = subnet)
4740 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4741 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
4742 log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCP REQUEST.' %
4743 (cip, sip, mac) )
4744 try:
4745 assert_not_equal(cip, None)
4746 log_test.info('Triggering DHCP discover again.')
4747 new_cip, new_sip, new_mac, _ = self.dhcp.only_discover(mac=mac)
4748 assert_equal(new_cip, cip)
4749 log_test.info('Got same ip to same the client when sent discover again, as expected')
4750 finally:
4751 self.voltha.disable_device(device_id, delete = True)
4752 self.voltha_dhcprelay_tearDownClass()
4753
4754 def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_requests(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004755 """
4756 Test Method:
4757 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4758 1. OLT and ONU is detected and validated.
4759 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4760 3. Send dhcp request from residential subscriber to external dhcp server.
4761 4. Verify that subscriber get ip from external dhcp server. successfully.
4762 5. Send DHCP request to external dhcp server.
4763 6. Repeat step 5 for 50 times.
4764 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server..
4765 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004766 self.voltha_dhcprelay_setUpClass()
4767# if not port_list:
4768# port_list = self.generate_port_list(1, 0)
4769 iface = self.port_map[self.port_list[0][1]]
4770 mac = self.get_mac(iface)
4771 self.host_load(iface)
4772 ##we use the defaults for this test that serves as an example for others
4773 ##You don't need to restart dhcpd server if retaining default config
4774 config = self.default_config
4775 options = self.default_options
4776 subnet = self.default_subnet_config
4777 dhcpd_interface_list = self.relay_interfaces
4778 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004779 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004780 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4781 assert_not_equal(device_id, None)
4782 voltha = VolthaCtrl(**self.voltha_attrs)
4783 time.sleep(10)
4784 switch_map = None
4785 olt_configured = False
4786 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4787 log_test.info('Installing OLT app')
4788 OnosCtrl.install_app(self.olt_app_file)
4789 time.sleep(5)
4790 log_test.info('Adding subscribers through OLT app')
4791 self.config_olt(switch_map)
4792 olt_configured = True
4793 time.sleep(5)
4794 self.dhcpd_start(intf_list = dhcpd_interface_list,
4795 config = config,
4796 options = options,
4797 subnet = subnet)
4798 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4799 log_test.info('Sending DHCP discover and DHCP request.')
4800 cip, sip = self.send_recv(mac=mac)
4801 mac = self.dhcp.get_mac(cip)[0]
4802 log_test.info("Sending DHCP request again.")
4803 new_cip, new_sip = self.dhcp.only_request(cip, mac)
4804 try:
4805 assert_equal(new_cip, cip)
4806 log_test.info('got same ip to smae the client when sent request again, as expected')
4807 finally:
4808 self.voltha.disable_device(device_id, delete = True)
4809 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004810
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004811 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004812 """
4813 Test Method:
4814 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4815 1. OLT and ONU is detected and validated.
4816 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4817 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server.
4818 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully.
4819 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004820 self.voltha_dhcprelay_setUpClass()
4821# if not port_list:
4822# port_list = self.generate_port_list(1, 0)
4823 iface = self.port_map[self.port_list[0][1]]
4824 mac = self.get_mac(iface)
4825 self.host_load(iface)
4826 ##we use the defaults for this test that serves as an example for others
4827 ##You don't need to restart dhcpd server if retaining default config
4828 config = self.default_config
4829 options = self.default_options
4830 subnet = self.default_subnet_config
4831 dhcpd_interface_list = self.relay_interfaces
4832 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004833 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004834 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4835 assert_not_equal(device_id, None)
4836 voltha = VolthaCtrl(**self.voltha_attrs)
4837 time.sleep(10)
4838 switch_map = None
4839 olt_configured = False
4840 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4841 log_test.info('Installing OLT app')
4842 OnosCtrl.install_app(self.olt_app_file)
4843 time.sleep(5)
4844 log_test.info('Adding subscribers through OLT app')
4845 self.config_olt(switch_map)
4846 olt_configured = True
4847 time.sleep(5)
4848 self.dhcpd_start(intf_list = dhcpd_interface_list,
4849 config = config,
4850 options = options,
4851 subnet = subnet)
4852 self.dhcp = DHCPTest(seed_ip = '192.168.1.31', iface = iface)
4853 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac,desired = True)
4854 try:
4855 assert_equal(cip,self.dhcp.seed_ip)
4856 log_test.info('Got dhcp client desired IP %s from server %s for mac %s as expected' %
4857 (cip, sip, mac) )
4858 finally:
4859 self.voltha.disable_device(device_id, delete = True)
4860 self.voltha_dhcprelay_tearDownClass()
4861
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004862 def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_ip_address(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004863 """
4864 Test Method:
4865 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4866 1. OLT and ONU is detected and validated.
4867 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4868 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server.
4869 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.
4870 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004871 self.voltha_dhcprelay_setUpClass()
4872# if not port_list:
4873# port_list = self.generate_port_list(1, 0)
4874 iface = self.port_map[self.port_list[0][1]]
4875 mac = self.get_mac(iface)
4876 self.host_load(iface)
4877 ##we use the defaults for this test that serves as an example for others
4878 ##You don't need to restart dhcpd server if retaining default config
4879 config = self.default_config
4880 options = self.default_options
4881 subnet = self.default_subnet_config
4882 dhcpd_interface_list = self.relay_interfaces
4883 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004884 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004885 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4886 assert_not_equal(device_id, None)
4887 voltha = VolthaCtrl(**self.voltha_attrs)
4888 time.sleep(10)
4889 switch_map = None
4890 olt_configured = False
4891 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4892 log_test.info('Installing OLT app')
4893 OnosCtrl.install_app(self.olt_app_file)
4894 time.sleep(5)
4895 log_test.info('Adding subscribers through OLT app')
4896 self.config_olt(switch_map)
4897 olt_configured = True
4898 time.sleep(5)
4899 self.dhcpd_start(intf_list = dhcpd_interface_list,
4900 config = config,
4901 options = options,
4902 subnet = subnet)
4903 self.dhcp = DHCPTest(seed_ip = '20.20.20.35', iface = iface)
4904 cip, sip, mac, _ = self.dhcp.only_discover(mac= mac,desired = True)
4905 try:
4906 assert_not_equal(cip,None)
4907 assert_not_equal(cip,self.dhcp.seed_ip)
4908 log_test.info('server offered IP from its pool when requested out of pool IP, as expected')
4909 finally:
4910 self.voltha.disable_device(device_id, delete = True)
4911 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004912
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004913 def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004914 """
4915 Test Method:
4916 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4917 1. OLT and ONU is detected and validated.
4918 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4919 3. Send dhcp request from residential subscriber to external dhcp server.
4920 4. Verify that subscriber get ip from external dhcp server. successfully.
4921 5. Deactivate dhcp server app in onos.
4922 6. Repeat step 3.
4923 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
4924 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00004925 self.voltha_dhcprelay_setUpClass()
4926# if not port_list:
4927# port_list = self.generate_port_list(1, 0)
4928 iface = self.port_map[self.port_list[0][1]]
4929 mac = self.get_mac(iface)
4930 self.host_load(iface)
4931 ##we use the defaults for this test that serves as an example for others
4932 ##You don't need to restart dhcpd server if retaining default config
4933 config = self.default_config
4934 options = self.default_options
4935 subnet = self.default_subnet_config
4936 dhcpd_interface_list = self.relay_interfaces
4937 log_test.info('Enabling ponsim_olt')
4938 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
4939 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
4940 assert_not_equal(device_id, None)
4941 voltha = VolthaCtrl(**self.voltha_attrs)
4942 time.sleep(10)
4943 switch_map = None
4944 olt_configured = False
4945 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
4946 log_test.info('Installing OLT app')
4947 OnosCtrl.install_app(self.olt_app_file)
4948 time.sleep(5)
4949 log_test.info('Adding subscribers through OLT app')
4950 self.config_olt(switch_map)
4951 olt_configured = True
4952 time.sleep(5)
4953 self.dhcpd_start(intf_list = dhcpd_interface_list,
4954 config = config,
4955 options = options,
4956 subnet = subnet)
4957 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
4958 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
4959 thread2 = threading.Thread(target = self.deactivate_apps, args = (self.app_dhcprelay,))
4960 log_test.info('Restart dhcprelay app in onos during client send discover to voltha')
4961 thread2.start()
4962 thread1.start()
4963 time.sleep(10)
4964 thread1.join()
4965 thread2.join()
4966 try:
4967 assert_equal(self.success, False)
4968 #assert_equal(status, True)
4969 time.sleep(10)
4970 finally:
4971 self.voltha.disable_device(device_id, delete = True)
4972 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00004973
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00004974 def test_subscriber_with_voltha_for_dhcprelay_renew_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00004975 """
4976 Test Method:
4977 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
4978 1. OLT and ONU is detected and validated.
4979 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
4980 3. Send dhcp request from residential subscriber to external dhcp server.
4981 4. Verify that subscriber get ip from external dhcp server. successfully.
4982 5. Send dhcp renew packet to external dhcp server.
4983 6. Repeat step 4.
4984 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00004985 self.voltha_dhcprelay_setUpClass()
4986# if not port_list:
4987# port_list = self.generate_port_list(1, 0)
4988 iface = self.port_map[self.port_list[0][1]]
4989 mac = self.get_mac(iface)
4990 self.host_load(iface)
4991 ##we use the defaults for this test that serves as an example for others
4992 ##You don't need to restart dhcpd server if retaining default config
4993 config = self.default_config
4994 new_options = [('dhcp-renewal-time', 100), ('dhcp-rebinding-time', 125)]
4995 options = self.default_options + new_options
4996 subnet = self.default_subnet_config
4997 dhcpd_interface_list = self.relay_interfaces
4998 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07004999 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00005000 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5001 assert_not_equal(device_id, None)
5002 voltha = VolthaCtrl(**self.voltha_attrs)
5003 time.sleep(10)
5004 switch_map = None
5005 olt_configured = False
5006 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5007 log_test.info('Installing OLT app')
5008 OnosCtrl.install_app(self.olt_app_file)
5009 time.sleep(5)
5010 log_test.info('Adding subscribers through OLT app')
5011 self.config_olt(switch_map)
5012 olt_configured = True
5013 time.sleep(5)
5014 self.dhcpd_start(intf_list = dhcpd_interface_list,
5015 config = config,
5016 options = options,
5017 subnet = subnet)
5018 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
5019 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
5020 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
5021 (cip, sip, mac) )
5022 try:
5023 assert_not_equal(cip,None)
5024 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
5025 log_test.info('Waiting for renew time..')
5026 time.sleep(lval)
5027 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac, unicast = True)
5028 assert_equal(latest_cip, cip)
5029 log_test.info('Server renewed client IP when client sends request after renew time, as expected')
5030 finally:
5031 self.voltha.disable_device(device_id, delete = True)
5032 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005033
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005034 def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005035 """
5036 Test Method:
5037 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5038 1. OLT and ONU is detected and validated.
5039 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5040 3. Send dhcp request from residential subscriber to external dhcp server.
5041 4. Verify that subscriber get ip from external dhcp server. successfully.
5042 5. Send dhcp rebind packet to external dhcp server.
5043 6. Repeat step 4.
5044 """
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00005045 self.voltha_dhcprelay_setUpClass()
5046# if not port_list:
5047# port_list = self.generate_port_list(1, 0)
5048 iface = self.port_map[self.port_list[0][1]]
5049 mac = self.get_mac(iface)
5050 self.host_load(iface)
5051 ##we use the defaults for this test that serves as an example for others
5052 ##You don't need to restart dhcpd server if retaining default config
5053 config = self.default_config
5054 new_options = [('dhcp-renewal-time', 100), ('dhcp-rebinding-time', 125)]
5055 options = self.default_options + new_options
5056 subnet = self.default_subnet_config
5057 dhcpd_interface_list = self.relay_interfaces
5058 log_test.info('Enabling ponsim_olt')
A R Karthick168e2342017-08-15 16:13:10 -07005059 ponsim_address = '{}:50060'.format(self.VOLTHA_PONSIM_HOST)
Thangavelu K S and Chetan Gaonker88b30a52017-08-15 00:27:55 +00005060 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5061 assert_not_equal(device_id, None)
5062 voltha = VolthaCtrl(**self.voltha_attrs)
5063 time.sleep(10)
5064 switch_map = None
5065 olt_configured = False
5066 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5067 log_test.info('Installing OLT app')
5068 OnosCtrl.install_app(self.olt_app_file)
5069 time.sleep(5)
5070 log_test.info('Adding subscribers through OLT app')
5071 self.config_olt(switch_map)
5072 olt_configured = True
5073 time.sleep(5)
5074 self.dhcpd_start(intf_list = dhcpd_interface_list,
5075 config = config,
5076 options = options,
5077 subnet = subnet)
5078 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
5079 cip, sip, mac, _ = self.dhcp.only_discover(mac=mac)
5080 log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
5081 (cip, sip, mac) )
5082 try:
5083 assert_not_equal(cip,None)
5084 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
5085 log_test.info('Waiting for rebind time..')
5086 time.sleep(lval)
5087 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
5088 assert_equal(latest_cip, cip)
5089 log_test.info('Server renewed client IP when client sends request after rebind time, as expected')
5090 finally:
5091 self.voltha.disable_device(device_id, delete = True)
5092 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005093
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005094 def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005095 """
5096 Test Method:
5097 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5098 1. OLT and ONU is detected and validated.
5099 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5100 3. Send dhcp request from residential subscriber to external dhcp server.
5101 4. Verify that subscriber get ip from external dhcp server. successfully.
5102 5. Disable olt devices which is being detected in voltha CLI.
5103 6. Repeat step 3.
5104 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5105 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005106 self.voltha_dhcprelay_setUpClass()
5107# if not port_list:
5108# port_list = self.generate_port_list(1, 0)
5109 iface = self.port_map[self.port_list[0][1]]
5110 mac = self.get_mac(iface)
5111 self.host_load(iface)
5112 ##we use the defaults for this test that serves as an example for others
5113 ##You don't need to restart dhcpd server if retaining default config
5114 config = self.default_config
5115 options = self.default_options
5116 subnet = self.default_subnet_config
5117 dhcpd_interface_list = self.relay_interfaces
5118 log_test.info('Enabling ponsim_olt')
5119 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5120 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5121 assert_not_equal(device_id, None)
5122 voltha = VolthaCtrl(**self.voltha_attrs)
5123 time.sleep(10)
5124 switch_map = None
5125 olt_configured = False
5126 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5127 log_test.info('Installing OLT app')
5128 OnosCtrl.install_app(self.olt_app_file)
5129 time.sleep(5)
5130 log_test.info('Adding subscribers through OLT app')
5131 self.config_olt(switch_map)
5132 olt_configured = True
5133 time.sleep(5)
5134 self.dhcpd_start(intf_list = dhcpd_interface_list,
5135 config = config,
5136 options = options,
5137 subnet = subnet)
5138 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
5139 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
5140 thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,))
5141 log_test.info('Disable olt devices during client send discover to voltha')
5142 thread2.start()
5143 time.sleep(4)
5144 thread1.start()
5145 time.sleep(10)
5146 thread1.join()
5147 thread2.join()
5148 try:
5149 assert_equal(self.success, False)
5150 #assert_equal(status, True)
5151 time.sleep(10)
5152 finally:
5153 self.voltha.disable_device(device_id, delete = True)
5154 self.voltha_dhcprelay_tearDownClass()
5155
Thangavelu K S057b7d22017-05-16 22:03:22 +00005156
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005157 def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005158 """
5159 Test Method:
5160 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5161 1. OLT and ONU is detected and validated.
5162 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5163 3. Send dhcp request from residential subscriber to external dhcp server.
5164 4. Verify that subscriber get ip from external dhcp server. successfully.
5165 5. Disable olt devices which is being detected in voltha CLI.
5166 6. Repeat step 3.
5167 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5168 8. Enable olt devices which is being detected in voltha CLI.
5169 9. Repeat steps 3 and 4.
5170 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005171 self.voltha_dhcprelay_setUpClass()
5172# if not port_list:
5173# port_list = self.generate_port_list(1, 0)
5174 iface = self.port_map[self.port_list[0][1]]
5175 mac = self.get_mac(iface)
5176 self.host_load(iface)
5177 ##we use the defaults for this test that serves as an example for others
5178 ##You don't need to restart dhcpd server if retaining default config
5179 config = self.default_config
5180 options = self.default_options
5181 subnet = self.default_subnet_config
5182 dhcpd_interface_list = self.relay_interfaces
5183 log_test.info('Enabling ponsim_olt')
5184 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5185 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5186 assert_not_equal(device_id, None)
5187 voltha = VolthaCtrl(**self.voltha_attrs)
5188 time.sleep(10)
5189 switch_map = None
5190 olt_configured = False
5191 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5192 log_test.info('Installing OLT app')
5193 OnosCtrl.install_app(self.olt_app_file)
5194 time.sleep(5)
5195 log_test.info('Adding subscribers through OLT app')
5196 self.config_olt(switch_map)
5197 olt_configured = True
5198 time.sleep(5)
5199 self.dhcpd_start(intf_list = dhcpd_interface_list,
5200 config = config,
5201 options = options,
5202 subnet = subnet)
5203 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
5204 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
5205 thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,))
5206 log_test.info('Restart olt devices during client send discover to voltha')
5207 thread2.start()
5208 time.sleep(4)
5209 thread1.start()
5210 time.sleep(10)
5211 thread1.join()
5212 thread2.join()
5213 try:
5214 assert_equal(self.success, False)
5215 #assert_equal(status, True)
5216 time.sleep(10)
5217 finally:
5218 self.voltha.disable_device(device_id, delete = True)
5219 self.voltha_dhcprelay_tearDownClass()
5220
Thangavelu K S057b7d22017-05-16 22:03:22 +00005221
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005222 def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005223 """
5224 Test Method:
5225 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5226 1. OLT and ONU is detected and validated.
5227 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5228 3. Send dhcp request from residential subscriber to external dhcp server.
5229 4. Verify that subscriber get ip from external dhcp server. successfully.
5230 5. Disable onu port which is being detected in voltha CLI.
5231 6. Repeat step 3.
5232 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5233 """
5234
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005235 self.voltha_dhcprelay_setUpClass()
5236# if not port_list:
5237# port_list = self.generate_port_list(1, 0)
5238 iface = self.port_map[self.port_list[0][1]]
5239 mac = self.get_mac(iface)
5240 self.host_load(iface)
5241 ##we use the defaults for this test that serves as an example for others
5242 ##You don't need to restart dhcpd server if retaining default config
5243 config = self.default_config
5244 options = self.default_options
5245 subnet = self.default_subnet_config
5246 dhcpd_interface_list = self.relay_interfaces
5247 log_test.info('Enabling ponsim_olt')
5248 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5249 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5250 assert_not_equal(device_id, None)
5251 voltha = VolthaCtrl(**self.voltha_attrs)
5252 time.sleep(10)
5253 switch_map = None
5254 olt_configured = False
5255 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5256 log_test.info('Installing OLT app')
5257 OnosCtrl.install_app(self.olt_app_file)
5258 time.sleep(5)
5259 log_test.info('Adding subscribers through OLT app')
5260 self.config_olt(switch_map)
5261 olt_configured = True
5262 time.sleep(5)
5263 self.dhcpd_start(intf_list = dhcpd_interface_list,
5264 config = config,
5265 options = options,
5266 subnet = subnet)
5267 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
5268 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
5269 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
5270 log_test.info('Restart olt devices during client send discover to voltha')
5271 thread2.start()
5272 time.sleep(4)
5273 thread1.start()
5274 time.sleep(10)
5275 thread1.join()
5276 thread2.join()
5277 try:
5278 assert_equal(self.success, False)
5279 #assert_equal(status, True)
5280 time.sleep(10)
5281 finally:
5282 self.voltha.disable_device(device_id, delete = True)
5283 self.voltha_dhcprelay_tearDownClass()
5284
5285 def test_subscriber_with_voltha_for_dhcprelay_toggle_onu_port_in_voltha(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005286 """
5287 Test Method:
5288 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5289 1. OLT and ONU is detected and validated.
5290 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5291 3. Send dhcp request from residential subscriber to external dhcp server.
5292 4. Verify that subscriber get ip from external dhcp server. successfully.
5293 5. Disable onu port which is being detected in voltha CLI.
5294 6. Repeat step 3.
5295 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway.
5296 8. Enable onu port which is being detected in voltha CLI.
5297 9. Repeat steps 3 and 4.
5298 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005299 self.voltha_dhcprelay_setUpClass()
5300# if not port_list:
5301# port_list = self.generate_port_list(1, 0)
5302 iface = self.port_map[self.port_list[0][1]]
5303 mac = self.get_mac(iface)
5304 self.host_load(iface)
5305 ##we use the defaults for this test that serves as an example for others
5306 ##You don't need to restart dhcpd server if retaining default config
5307 config = self.default_config
5308 options = self.default_options
5309 subnet = self.default_subnet_config
5310 dhcpd_interface_list = self.relay_interfaces
5311 log_test.info('Enabling ponsim_olt')
5312 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5313 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5314 assert_not_equal(device_id, None)
5315 voltha = VolthaCtrl(**self.voltha_attrs)
5316 time.sleep(10)
5317 switch_map = None
5318 olt_configured = False
5319 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5320 log_test.info('Installing OLT app')
5321 OnosCtrl.install_app(self.olt_app_file)
5322 time.sleep(5)
5323 log_test.info('Adding subscribers through OLT app')
5324 self.config_olt(switch_map)
5325 olt_configured = True
5326 time.sleep(5)
5327 self.dhcpd_start(intf_list = dhcpd_interface_list,
5328 config = config,
5329 options = options,
5330 subnet = subnet)
5331 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
5332 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac,))
5333 thread2 = threading.Thread(target = self.voltha_uni_port_toggle)
5334 log_test.info('Restart olt devices during client send discover to voltha')
5335 thread2.start()
5336 time.sleep(4)
5337 thread1.start()
5338 time.sleep(10)
5339 thread1.join()
5340 thread2.join()
5341 try:
5342 assert_equal(self.success, False)
5343 #assert_equal(status, True)
5344 time.sleep(10)
5345 cip, sip = self.send_recv(mac=mac)
5346 finally:
5347 self.voltha.disable_device(device_id, delete = True)
5348 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005349
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005350 def test_two_subscribers_with_voltha_for_dhcprelay_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005351 """
5352 Test Method:
5353 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5354 1. OLT and ONU is detected and validated.
5355 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5356 3. Send dhcp request from two residential subscribers to external dhcp server.
5357 4. Verify that subscribers had got different ips from external dhcp server. successfully.
5358 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005359 self.voltha_dhcprelay_setUpClass()
5360# if not port_list:
5361# port_list = self.generate_port_list(1, 0)
5362 iface_1 = self.port_map[self.port_list[0][1]]
5363 iface_2 = self.port_map[self.port_list[3][1]]
5364 mac_1 = self.get_mac(iface_1)
5365 mac_2 = self.get_mac(iface_2)
5366 self.host_load(iface_1)
5367 self.host_load(iface_2)
5368 ##we use the defaults for this test that serves as an example for others
5369 ##You don't need to restart dhcpd server if retaining default config
5370 config = self.default_config
5371 options = self.default_options
5372 subnet = self.default_subnet_config
5373 dhcpd_interface_list = self.relay_interfaces
5374 log_test.info('Enabling ponsim_olt')
5375 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5376 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5377 assert_not_equal(device_id, None)
5378 voltha = VolthaCtrl(**self.voltha_attrs)
5379 time.sleep(10)
5380 switch_map = None
5381 olt_configured = False
5382 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5383 log_test.info('Installing OLT app')
5384 OnosCtrl.install_app(self.olt_app_file)
5385 time.sleep(5)
5386 log_test.info('Adding subscribers through OLT app')
5387 self.config_olt(switch_map)
5388 olt_configured = True
5389 time.sleep(5)
5390 self.dhcpd_start(intf_list = dhcpd_interface_list,
5391 config = config,
5392 options = options,
5393 subnet = subnet)
5394 self.dhcp_1 = DHCPTest(seed_ip = '10.10.10.1', iface = iface_1)
5395 self.dhcp_2 = DHCPTest(seed_ip = '20.20.20.1', iface = iface_2)
5396 thread1 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac_1,False,True,self.dhcp_1,))
5397 thread2 = threading.Thread(target = self.send_recv_function_in_thread, args = (mac_2,False,True,self.dhcp_2,))
5398# log_test.info('Restart olt devices during client send discover to voltha')
5399 thread2.start()
5400 time.sleep(4)
5401 thread1.start()
5402 time.sleep(10)
5403 thread1.join()
5404 thread2.join()
5405 try:
5406 assert_equal(self.success, True)
5407 #assert_equal(status, True)
5408 time.sleep(10)
5409 finally:
5410 self.voltha.disable_device(device_id, delete = True)
5411 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005412
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005413 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005414 """
5415 Test Method:
5416 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5417 1. OLT and ONU is detected and validated.
5418 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5419 3. Send dhcp request from two residential subscribers to external dhcp server.
5420 4. Verify that subscribers had got ip from external dhcp server. successfully.
5421 5. Repeat step 3 and 4 for 10 times for both subscribers.
5422 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server..
5423 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005424 self.voltha_dhcprelay_setUpClass()
5425# if not port_list:
5426# port_list = self.generate_port_list(1, 0)
5427 iface_1 = self.port_map[self.port_list[0][1]]
5428 iface_2 = self.port_map[self.port_list[3][1]]
5429 mac_1 = self.get_mac(iface_1)
5430 mac_2 = self.get_mac(iface_2)
5431 self.host_load(iface_1)
5432 self.host_load(iface_2)
5433 ##we use the defaults for this test that serves as an example for others
5434 ##You don't need to restart dhcpd server if retaining default config
5435 config = self.default_config
5436 options = self.default_options
5437 subnet = self.default_subnet_config
5438 dhcpd_interface_list = self.relay_interfaces
5439 log_test.info('Enabling ponsim_olt')
5440 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5441 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5442 assert_not_equal(device_id, None)
5443 voltha = VolthaCtrl(**self.voltha_attrs)
5444 time.sleep(10)
5445 switch_map = None
5446 olt_configured = False
5447 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5448 log_test.info('Installing OLT app')
5449 OnosCtrl.install_app(self.olt_app_file)
5450 time.sleep(5)
5451 log_test.info('Adding subscribers through OLT app')
5452 self.config_olt(switch_map)
5453 olt_configured = True
5454 time.sleep(5)
5455 self.dhcpd_start(intf_list = dhcpd_interface_list,
5456 config = config,
5457 options = options,
5458 subnet = subnet)
5459
5460 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,'multiple_discover',))
5461 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'multiple_discover',))
5462 #log_test.info('Restart olt devices during client send discover to voltha')
5463 thread2.start()
5464 time.sleep(4)
5465 thread1.start()
5466 time.sleep(10)
5467 thread1.join()
5468 thread2.join()
5469 try:
5470 assert_equal(self.success, True)
5471 #assert_equal(status, True)
5472 time.sleep(10)
5473 finally:
5474 self.voltha.disable_device(device_id, delete = True)
5475 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005476
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005477 def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005478 """
5479 Test Method:
5480 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5481 1. OLT and ONU is detected and validated.
5482 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5483 3. Send dhcp request from two residential subscribers to external dhcp server.
5484 4. Verify that subscribers had got ip from external dhcp server. successfully.
5485 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber.
5486 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
5487 """
5488
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005489 self.voltha_dhcprelay_setUpClass()
5490# if not port_list:
5491# port_list = self.generate_port_list(1, 0)
5492 iface_1 = self.port_map[self.port_list[0][1]]
5493 iface_2 = self.port_map[self.port_list[3][1]]
5494 mac_1 = self.get_mac(iface_1)
5495 mac_2 = self.get_mac(iface_2)
5496 self.host_load(iface_1)
5497 self.host_load(iface_2)
5498 ##we use the defaults for this test that serves as an example for others
5499 ##You don't need to restart dhcpd server if retaining default config
5500 config = self.default_config
5501 options = self.default_options
5502 subnet = self.default_subnet_config
5503 dhcpd_interface_list = self.relay_interfaces
5504 log_test.info('Enabling ponsim_olt')
5505 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5506 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5507 assert_not_equal(device_id, None)
5508 voltha = VolthaCtrl(**self.voltha_attrs)
5509 time.sleep(10)
5510 switch_map = None
5511 olt_configured = False
5512 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5513 log_test.info('Installing OLT app')
5514 OnosCtrl.install_app(self.olt_app_file)
5515 time.sleep(5)
5516 log_test.info('Adding subscribers through OLT app')
5517 self.config_olt(switch_map)
5518 olt_configured = True
5519 time.sleep(5)
5520 self.dhcpd_start(intf_list = dhcpd_interface_list,
5521 config = config,
5522 options = options,
5523 subnet = subnet)
5524
5525 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,))
5526 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'multiple_discover',))
5527 #log_test.info('Restart olt devices during client send discover to voltha')
5528 thread2.start()
5529 time.sleep(4)
5530 thread1.start()
5531 time.sleep(10)
5532 thread1.join()
5533 thread2.join()
5534 try:
5535 assert_equal(self.success, True)
5536 #assert_equal(status, True)
5537 time.sleep(10)
5538 finally:
5539 self.voltha.disable_device(device_id, delete = True)
5540 self.voltha_dhcprelay_tearDownClass()
5541
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005542 def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005543 """
5544 Test Method:
5545 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5546 1. OLT and ONU is detected and validated.
5547 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5548 3. Send dhcp request from one residential subscriber to external dhcp server.
5549 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server.
5550 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully.
5551 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005552 self.voltha_dhcprelay_setUpClass()
5553# if not port_list:
5554# port_list = self.generate_port_list(1, 0)
5555 iface_1 = self.port_map[self.port_list[0][1]]
5556 iface_2 = self.port_map[self.port_list[3][1]]
5557 mac_1 = self.get_mac(iface_1)
5558 mac_2 = self.get_mac(iface_2)
5559 self.host_load(iface_1)
5560 self.host_load(iface_2)
5561 ##we use the defaults for this test that serves as an example for others
5562 ##You don't need to restart dhcpd server if retaining default config
5563 config = self.default_config
5564 options = self.default_options
5565 subnet = self.default_subnet_config
5566 dhcpd_interface_list = self.relay_interfaces
5567 log_test.info('Enabling ponsim_olt')
5568 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5569 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5570 assert_not_equal(device_id, None)
5571 voltha = VolthaCtrl(**self.voltha_attrs)
5572 time.sleep(10)
5573 switch_map = None
5574 olt_configured = False
5575 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5576 log_test.info('Installing OLT app')
5577 OnosCtrl.install_app(self.olt_app_file)
5578 time.sleep(5)
5579 log_test.info('Adding subscribers through OLT app')
5580 self.config_olt(switch_map)
5581 olt_configured = True
5582 time.sleep(5)
5583 self.dhcpd_start(intf_list = dhcpd_interface_list,
5584 config = config,
5585 options = options,
5586 subnet = subnet)
5587
5588 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,))
5589 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'desired_ip',))
5590 #log_test.info('Restart olt devices during client send discover to voltha')
5591 thread2.start()
5592 time.sleep(4)
5593 thread1.start()
5594 time.sleep(10)
5595 thread1.join()
5596 thread2.join()
5597 try:
5598 assert_equal(self.success, True)
5599 #assert_equal(status, True)
5600 time.sleep(10)
5601 finally:
5602 self.voltha.disable_device(device_id, delete = True)
5603 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005604
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005605 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 +00005606 """
5607 Test Method:
5608 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5609 1. OLT and ONU is detected and validated.
5610 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5611 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server.
5612 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server.
5613 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully.
5614 """
5615
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005616 self.voltha_dhcprelay_setUpClass()
5617# if not port_list:
5618# port_list = self.generate_port_list(1, 0)
5619 iface_1 = self.port_map[self.port_list[0][1]]
5620 iface_2 = self.port_map[self.port_list[3][1]]
5621 mac_1 = self.get_mac(iface_1)
5622 mac_2 = self.get_mac(iface_2)
5623 self.host_load(iface_1)
5624 self.host_load(iface_2)
5625 ##we use the defaults for this test that serves as an example for others
5626 ##You don't need to restart dhcpd server if retaining default config
5627 config = self.default_config
5628 options = self.default_options
5629 subnet = self.default_subnet_config
5630 dhcpd_interface_list = self.relay_interfaces
5631 log_test.info('Enabling ponsim_olt')
5632 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5633 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5634 assert_not_equal(device_id, None)
5635 voltha = VolthaCtrl(**self.voltha_attrs)
5636 time.sleep(10)
5637 switch_map = None
5638 olt_configured = False
5639 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5640 log_test.info('Installing OLT app')
5641 OnosCtrl.install_app(self.olt_app_file)
5642 time.sleep(5)
5643 log_test.info('Adding subscribers through OLT app')
5644 self.config_olt(switch_map)
5645 olt_configured = True
5646 time.sleep(5)
5647 self.dhcpd_start(intf_list = dhcpd_interface_list,
5648 config = config,
5649 options = options,
5650 subnet = subnet)
5651
5652 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,))
5653 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'out_of_pool_ip',))
5654 #log_test.info('Restart olt devices during client send discover to voltha')
5655 thread2.start()
5656 time.sleep(4)
5657 thread1.start()
5658 time.sleep(10)
5659 thread1.join()
5660 thread2.join()
5661 try:
5662 assert_equal(self.success, True)
5663 #assert_equal(status, True)
5664 time.sleep(10)
5665 finally:
5666 self.voltha.disable_device(device_id, delete = True)
5667 self.voltha_dhcprelay_tearDownClass()
5668
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005669 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005670 """
5671 Test Method:
5672 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5673 1. OLT and ONU is detected and validated.
5674 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5675 3. Send dhcp request from two residential subscribers to external dhcp server.
5676 4. Verify that subscribers had got ip from external dhcp server. successfully.
5677 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
5678 6. Repeat step 3 and 4 for one subscriber where uni port is down.
5679 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5680 """
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005681 self.voltha_dhcprelay_setUpClass()
5682# if not port_list:
5683# port_list = self.generate_port_list(1, 0)
5684 iface_1 = self.port_map[self.port_list[0][1]]
5685 iface_2 = self.port_map[self.port_list[3][1]]
5686 mac_1 = self.get_mac(iface_1)
5687 mac_2 = self.get_mac(iface_2)
5688 self.host_load(iface_1)
5689 self.host_load(iface_2)
5690 ##we use the defaults for this test that serves as an example for others
5691 ##You don't need to restart dhcpd server if retaining default config
5692 config = self.default_config
5693 options = self.default_options
5694 subnet = self.default_subnet_config
5695 dhcpd_interface_list = self.relay_interfaces
5696 log_test.info('Enabling ponsim_olt')
5697 ponsim_address = '{}:50060'.format(self.VOLTHA_HOST)
5698 device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address)
5699 assert_not_equal(device_id, None)
5700 voltha = VolthaCtrl(**self.voltha_attrs)
5701 time.sleep(10)
5702 switch_map = None
5703 olt_configured = False
5704 switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE)
5705 log_test.info('Installing OLT app')
5706 OnosCtrl.install_app(self.olt_app_file)
5707 time.sleep(5)
5708 log_test.info('Adding subscribers through OLT app')
5709 self.config_olt(switch_map)
5710 olt_configured = True
5711 time.sleep(5)
5712 self.dhcpd_start(intf_list = dhcpd_interface_list,
5713 config = config,
5714 options = options,
5715 subnet = subnet)
5716
5717 thread1 = threading.Thread(target = self.dhcprelay_flow_check, args = ('10.10.10.1', iface_1, mac_1,))
5718 thread2 = threading.Thread(target = self.dhcprelay_flow_check, args = ('20.20.20.1', iface_2, mac_2,'desired_ip',))
5719 thread3 = threading.Thread(target = self.voltha_uni_port_toggle, args = (iface_2,))
5720 #log_test.info('Restart olt devices during client send discover to voltha')
5721 thread2.start()
5722 time.sleep(8)
5723 thread1.start()
5724 thread3.start()
5725 time.sleep(10)
5726 thread1.join()
5727 thread2.join()
5728 thread3.join()
5729 try:
5730 assert_equal(self.success, False)
5731 #assert_equal(status, True)
5732 time.sleep(10)
5733 finally:
5734 self.voltha.disable_device(device_id, delete = True)
5735 self.voltha_dhcprelay_tearDownClass()
Thangavelu K S057b7d22017-05-16 22:03:22 +00005736
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005737 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005738 """
5739 Test Method:
5740 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5741 1. OLT and ONU is detected and validated.
5742 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5743 3. Send dhcp request from two residential subscribers to external dhcp server.
5744 4. Verify that subscribers had got ip from external dhcp server. successfully.
5745 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber.
5746 6. Repeat step 3 and 4 for one subscriber where uni port is down.
5747 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5748 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber.
5749 9. Repeat step 3 and 4 for one subscriber where uni port is up now.
5750 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5751 """
5752
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005753 def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005754 """
5755 Test Method:
5756 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5757 1. OLT and ONU is detected and validated.
5758 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5759 3. Send dhcp request from two residential subscribers to external dhcp server.
5760 4. Verify that subscribers had got ip from external dhcp server. successfully.
5761 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
5762 6. Disable the olt device which is detected in voltha.
5763 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
5764 """
5765
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005766 def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005767 """
5768 Test Method:
5769 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5770 1. OLT and ONU is detected and validated.
5771 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5772 3. Send dhcp request from two residential subscribers to external dhcp server.
5773 4. Verify that subscribers had got ip from external dhcp server. successfully.
5774 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
5775 6. Disable the olt device which is detected in voltha.
5776 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
5777 8. Enable the olt device which is detected in voltha.
5778 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed.
5779 """
5780
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00005781 def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self):
Thangavelu K S057b7d22017-05-16 22:03:22 +00005782 """
5783 Test Method:
5784 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup.
5785 1. OLT and ONU is detected and validated.
5786 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5787 3. Send dhcp request from two residential subscribers to external dhcp server.
5788 4. Verify that subscribers had got ip from external dhcp server. successfully.
5789 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber.
5790 6. Pause the olt device which is detected in voltha.
5791 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed.
5792 """
Thangavelu K S36edb012017-07-05 18:24:12 +00005793
Thangavelu K S6432b522017-07-22 00:05:54 +00005794 def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005795 """
5796 Test Method:
5797 0. Make sure that voltha is up and running on CORD-POD setup.
5798 1. OLT and ONU is detected and validated.
5799 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5800 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5801 4. Send igmp joins for a multicast group address multi-group-addressA.
5802 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
5803 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5804 """
5805
Thangavelu K S8e413082017-07-13 20:02:14 +00005806 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5807 num_subscribers = 1
5808 num_channels = 1
5809 services = ('IGMP')
5810 cbs = (self.igmp_flow_check, None, None)
5811 self.voltha_subscribers(services, cbs = cbs,
5812 num_subscribers = num_subscribers,
5813 num_channels = num_channels)
5814
Thangavelu K S6432b522017-07-22 00:05:54 +00005815 def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005816 """
5817 Test Method:
5818 0. Make sure that voltha is up and running on CORD-POD setup.
5819 1. OLT and ONU is detected and validated.
5820 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5821 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5822 4. Send igmp joins for a multicast group address multi-group-addressA.
5823 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
5824 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
5825 7. Send igmp leave for a multicast group address multi-group-addressA.
5826 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
5827 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005828 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5829 num_subscribers = 1
5830 num_channels = 1
5831 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005832 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00005833 self.voltha_subscribers(services, cbs = cbs,
5834 num_subscribers = num_subscribers,
5835 num_channels = num_channels)
5836
Thangavelu K S6432b522017-07-22 00:05:54 +00005837 def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005838 """
5839 Test Method:
5840 0. Make sure that voltha is up and running on CORD-POD setup.
5841 1. OLT and ONU is detected and validated.
5842 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5843 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5844 4. Send igmp joins for a multicast group address multi-group-addressA.
5845 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU.
5846 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester.
5847 7. Send igmp leave for a multicast group address multi-group-addressA.
5848 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester.
5849 9. Repeat steps 4 to 6.
5850 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005851 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5852 num_subscribers = 1
5853 num_channels = 1
5854 services = ('IGMP')
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005855 cbs = (self.igmp_leave_flow_check, None, None)
Thangavelu K S8e413082017-07-13 20:02:14 +00005856 self.voltha_subscribers(services, cbs = cbs,
5857 num_subscribers = num_subscribers,
5858 num_channels = num_channels)
5859
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005860 def test_subscriber_with_voltha_for_igmp_with_five_groups_joins_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005861 """
5862 Test Method:
5863 0. Make sure that voltha is up and running on CORD-POD setup.
5864 1. OLT and ONU is detected and validated.
5865 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5866 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5867 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
5868 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5869 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5870 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005871 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5872 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005873 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00005874 services = ('IGMP')
5875 cbs = (self.igmp_flow_check, None, None)
5876 self.voltha_subscribers(services, cbs = cbs,
5877 num_subscribers = num_subscribers,
5878 num_channels = num_channels)
5879
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00005880 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 +00005881 """
5882 Test Method:
5883 0. Make sure that voltha is up and running on CORD-POD setup.
5884 1. OLT and ONU is detected and validated.
5885 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5886 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5887 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB
5888 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
5889 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5890 7. Send igmp leave for a multicast group address multi-group-addressA.
5891 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.
5892 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester.
5893 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005894 """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each"""
5895 num_subscribers = 1
Thangavelu K Sb006b8a2017-07-28 19:29:39 +00005896 num_channels = 5
Thangavelu K S8e413082017-07-13 20:02:14 +00005897 services = ('IGMP')
5898 cbs = (self.igmp_flow_check, None, None)
5899 self.voltha_subscribers(services, cbs = cbs,
5900 num_subscribers = num_subscribers,
5901 num_channels = num_channels)
5902
Thangavelu K S6432b522017-07-22 00:05:54 +00005903 def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005904 """
5905 Test Method:
5906 0. Make sure that voltha is up and running on CORD-POD setup.
5907 1. OLT and ONU is detected and validated.
5908 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5909 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5910 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
5911 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5912 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5913 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
5914 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5915 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005916 num_subscribers = 1
5917 num_channels = 1
5918 services = ('IGMP')
5919 cbs = (self.igmp_flow_check, None, None)
5920 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5921 num_subscribers = num_subscribers,
5922 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00005923
Thangavelu K S6432b522017-07-22 00:05:54 +00005924 def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005925 """
5926 Test Method:
5927 0. Make sure that voltha is up and running on CORD-POD setup.
5928 1. OLT and ONU is detected and validated.
5929 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5930 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5931 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
5932 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5933 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5934 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA
5935 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5936 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5937 """
5938
Thangavelu K S8e413082017-07-13 20:02:14 +00005939 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00005940 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00005941 services = ('IGMP')
5942 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
5943 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5944 num_subscribers = num_subscribers,
5945 num_channels = num_channels)
5946
Thangavelu K S6432b522017-07-22 00:05:54 +00005947 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 +00005948 """
5949 Test Method:
5950 0. Make sure that voltha is up and running on CORD-POD setup.
5951 1. OLT and ONU is detected and validated.
5952 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5953 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5954 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
5955 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5956 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
5957 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA
5958 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5959 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
5960 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005961 num_subscribers = 1
Thangavelu K S9a637332017-08-01 23:22:23 +00005962 num_channels = 1
Thangavelu K S8e413082017-07-13 20:02:14 +00005963 services = ('IGMP')
5964 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
5965 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5966 num_subscribers = num_subscribers,
5967 num_channels = num_channels)
5968
Thangavelu K S6432b522017-07-22 00:05:54 +00005969 def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005970 """
5971 Test Method:
5972 0. Make sure that voltha is up and running on CORD-POD setup.
5973 1. OLT and ONU is detected and validated.
5974 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5975 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5976 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA
5977 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5978 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
5979 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA
5980 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
5981 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
5982 """
Thangavelu K S8e413082017-07-13 20:02:14 +00005983
5984 num_subscribers = 1
5985 num_channels = 1
5986 services = ('IGMP')
5987 cbs = (self.igmp_flow_check_join_change_to_block, None, None)
5988 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
5989 num_subscribers = num_subscribers,
5990 num_channels = num_channels)
5991
Thangavelu K S6432b522017-07-22 00:05:54 +00005992 def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00005993 """
5994 Test Method:
5995 0. Make sure that voltha is up and running on CORD-POD setup.
5996 1. OLT and ONU is detected and validated.
5997 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
5998 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
5999 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
6000 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
6001 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
6002 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB
6003 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
6004 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
6005 """
Thangavelu K S8e413082017-07-13 20:02:14 +00006006
6007 num_subscribers = 1
6008 num_channels = 1
6009 services = ('IGMP')
6010 cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None)
6011 self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'],
6012 num_subscribers = num_subscribers,
6013 num_channels = num_channels)
6014
Thangavelu K S6432b522017-07-22 00:05:54 +00006015 def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006016 """
6017 Test Method:
6018 0. Make sure that voltha is up and running on CORD-POD setup.
6019 1. OLT and ONU is detected and validated.
6020 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6021 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6022 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
6023 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
6024 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester.
6025 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
6026 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester.
6027 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006028
6029 num_subscribers = 1
6030 num_channels = 1
6031 services = ('IGMP')
6032 cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None)
6033 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
6034 num_subscribers = num_subscribers,
6035 num_channels = num_channels)
6036
Thangavelu K S6432b522017-07-22 00:05:54 +00006037 def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006038 """
6039 Test Method:
6040 0. Make sure that voltha is up and running on CORD-POD setup.
6041 1. OLT and ONU is detected and validated.
6042 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6043 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6044 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA
6045 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU.
6046 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
6047 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU.
6048 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester.
6049 """
6050
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006051 num_subscribers = 1
6052 num_channels = 1
6053 services = ('IGMP')
6054 cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None)
6055 self.voltha_subscribers(services, cbs = cbs, src_list = ['0'],
6056 num_subscribers = num_subscribers,
6057 num_channels = num_channels)
6058
Thangavelu K S6432b522017-07-22 00:05:54 +00006059 def test_two_subscribers_with_voltha_for_igmp_join_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006060 """
6061 Test Method:
6062 0. Make sure that voltha is up and running on CORD-POD setup.
6063 1. OLT and ONU is detected and validated.
6064 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6065 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6066 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6067 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
6068 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6069 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6070 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6071 """
6072
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006073 num_subscribers = 2
6074 num_channels = 1
6075 services = ('IGMP')
6076 cbs = (self.igmp_flow_check, None, None)
6077 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'],
6078 num_subscribers = num_subscribers,
6079 num_channels = num_channels)
6080
Thangavelu K S36edb012017-07-05 18:24:12 +00006081 def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self):
6082 """
6083 Test Method:
6084 0. Make sure that voltha is up and running on CORD-POD setup.
6085 1. OLT and ONU is detected and validated.
6086 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6087 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6088 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6089 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6090 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6091 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6092 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6093 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6094 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6095 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6096 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006097 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006098 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006099 services = ('IGMP')
6100 cbs = (self.igmp_flow_check_join_change_to_exclude, None, None)
6101 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'],
6102 num_subscribers = num_subscribers,
6103 num_channels = num_channels)
Thangavelu K S36edb012017-07-05 18:24:12 +00006104
Thangavelu K S6432b522017-07-22 00:05:54 +00006105 def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006106 """
6107 Test Method:
6108 0. Make sure that voltha is up and running on CORD-POD setup.
6109 1. OLT and ONU is detected and validated.
6110 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6111 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6112 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6113 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port)
6114 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6115 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.
6116 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.
6117 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6118 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.
6119 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.
6120 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.
6121 """
6122
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006123 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006124 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006125 services = ('IGMP')
6126 cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None)
6127 self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'],
6128 num_subscribers = num_subscribers,
6129 num_channels = num_channels)
6130
6131 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00006132 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 +00006133 """
6134 Test Method:
6135 0. Make sure that voltha is up and running on CORD-POD setup.
6136 1. OLT and ONU is detected and validated.
6137 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6138 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6139 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6140 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6141 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6142 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6143 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6144 9. Disable uni_2 port which is being shown on voltha CLI.
6145 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6146 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6147 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006148 #rx_port = self.port_map['ports'][port_list[i][1]]
6149 df = defer.Deferred()
6150 def igmp_flow_check_operating_onu_admin_state(df):
6151 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006152 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006153 services = ('IGMP')
6154 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
6155 port_list = self.generate_port_list(num_subscribers, num_channels)
6156
Thangavelu K S9a637332017-08-01 23:22:23 +00006157 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 +00006158 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
6159 thread1.start()
6160 time.sleep(randint(40,50))
6161 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
6162 thread2.start()
6163 time.sleep(10)
6164 thread1.join()
6165 thread2.join()
6166 try:
6167 assert_equal(self.success, False)
6168 log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check')
6169 time.sleep(10)
6170 finally:
6171 pass
6172 df.callback(0)
6173 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
6174 return df
6175
6176 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S36edb012017-07-05 18:24:12 +00006177 def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self):
6178 """
6179 Test Method:
6180 0. Make sure that voltha is up and running on CORD-POD setup.
6181 1. OLT and ONU is detected and validated.
6182 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6183 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6184 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6185 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6186 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6187 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6188 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6189 9. Disable uni_2 port which is being shown on voltha CLI.
6190 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6191 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6192 12. Enable uni_2 port which we disable at step 9.
6193 13. Repeat step 5,6 and 8.
6194 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006195 df = defer.Deferred()
6196 def igmp_flow_check_operating_onu_admin_state(df):
6197 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006198 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006199 services = ('IGMP')
6200 cbs = (self.igmp_flow_check, None, None)
6201 port_list = self.generate_port_list(num_subscribers, num_channels)
6202
Thangavelu K S9a637332017-08-01 23:22:23 +00006203 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 +00006204 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
6205 thread1.start()
6206 time.sleep(randint(50,60))
6207 log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha')
6208 thread2.start()
6209 time.sleep(10)
6210 thread1.join()
6211 thread2.join()
6212 try:
6213 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00006214 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 +00006215 time.sleep(10)
6216 finally:
6217 pass
6218 df.callback(0)
6219 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
6220 return df
6221
6222 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00006223 def test_two_subscribers_with_voltha_for_igmp_disabling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006224 """
6225 Test Method:
6226 0. Make sure that voltha is up and running on CORD-POD setup.
6227 1. OLT and ONU is detected and validated.
6228 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6229 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6230 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6231 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6232 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6233 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6234 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6235 9. Disable olt device which is being shown on voltha CLI.
6236 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6237 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6238 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006239 df = defer.Deferred()
6240 def igmp_flow_check_operating_olt_admin_disble(df):
6241 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006242 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006243 services = ('IGMP')
6244 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
6245 port_list = self.generate_port_list(num_subscribers, num_channels)
6246
Thangavelu K S9a637332017-08-01 23:22:23 +00006247 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 +00006248 thread1.start()
6249 time.sleep(randint(50,60))
6250 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
6251 thread2.start()
6252 time.sleep(10)
6253 thread1.join()
6254 thread2.join()
6255 try:
6256 assert_equal(self.success, False)
6257 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
6258 time.sleep(10)
6259 finally:
6260 pass
6261 df.callback(0)
6262 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
6263 return df
6264
6265 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00006266 def test_two_subscribers_with_voltha_for_igmp_pausing_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006267 """
6268 Test Method:
6269 0. Make sure that voltha is up and running on CORD-POD setup.
6270 1. OLT and ONU is detected and validated.
6271 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6272 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6273 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6274 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6275 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6276 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6277 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6278 9. Pause olt device which is being shown on voltha CLI.
6279 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6280 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6281 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006282 df = defer.Deferred()
6283 def igmp_flow_check_operating_olt_admin_pause(df):
6284 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006285 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006286 services = ('IGMP')
6287 cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None)
6288 port_list = self.generate_port_list(num_subscribers, num_channels)
6289
Thangavelu K S9a637332017-08-01 23:22:23 +00006290 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 +00006291 thread1.start()
6292 time.sleep(randint(50,60))
6293 thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,))
6294 thread2.start()
6295 time.sleep(10)
6296 thread1.join()
6297 thread2.join()
6298 try:
6299 assert_equal(self.success, False)
6300 log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test')
6301 time.sleep(10)
6302 finally:
6303 pass
6304 df.callback(0)
6305 reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df)
6306 return df
6307
6308 @deferred(TESTCASE_TIMEOUT)
Thangavelu K S6432b522017-07-22 00:05:54 +00006309 def test_two_subscribers_with_voltha_for_igmp_toggling_olt_verifying_traffic(self):
Thangavelu K S36edb012017-07-05 18:24:12 +00006310 """
6311 Test Method:
6312 0. Make sure that voltha is up and running on CORD-POD setup.
6313 1. OLT and ONU is detected and validated.
6314 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6315 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6316 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6317 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6318 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6319 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6320 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6321 9. Disable olt device which is being shown on voltha CLI.
6322 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6323 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6324 12. Enable olt device which is disable at step 9.
6325 13. Repeat steps 4,5, 7 and 8.
6326 """
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006327 df = defer.Deferred()
6328 def igmp_flow_check_operating_olt_admin_restart(df):
6329 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006330 num_channels = 1
Thangavelu K Sfdf5cac2017-07-18 21:57:07 +00006331 services = ('IGMP')
6332 cbs = (self.igmp_flow_check, None, None)
6333 port_list = self.generate_port_list(num_subscribers, num_channels)
6334
Thangavelu K S9a637332017-08-01 23:22:23 +00006335 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 +00006336 thread1.start()
6337 time.sleep(randint(50,60))
6338 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
6339 thread2.start()
6340 time.sleep(10)
6341 thread1.join()
6342 thread2.join()
6343 try:
6344 assert_equal(self.success, True)
Thangavelu K S6432b522017-07-22 00:05:54 +00006345 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 +00006346 time.sleep(10)
6347 finally:
6348 pass
6349 df.callback(0)
6350 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
6351 return df
Thangavelu K S6432b522017-07-22 00:05:54 +00006352
6353 @deferred(TESTCASE_TIMEOUT)
6354 def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self):
6355 """
6356 Test Method:
6357 0. Make sure that voltha is up and running on CORD-POD setup.
6358 1. OLT and ONU is detected and validated.
6359 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6360 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6361 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6362 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6363 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6364 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6365 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6366 9. Disable olt device which is being shown on voltha CLI.
6367 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6368 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6369 12. Repeat steps 4 to 11 steps multiple times (example 20 times)
6370 """
6371 df = defer.Deferred()
6372 no_iterations = 20
6373 def igmp_flow_check_operating_olt_admin_disble(df):
6374 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006375 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00006376 services = ('IGMP')
6377 cbs = (self.igmp_flow_check, None, None)
6378 port_list = self.generate_port_list(num_subscribers, num_channels)
6379
Thangavelu K S9a637332017-08-01 23:22:23 +00006380 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 +00006381 thread1.start()
6382 time.sleep(randint(30,40))
6383 for i in range(no_iterations):
6384 thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,))
6385 thread2.start()
6386 time.sleep(8)
6387 thread2.join()
6388 thread1.join()
6389 thread1.isAlive()
6390 thread2.join()
6391 try:
6392 assert_equal(self.success, False)
6393 log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test')
6394 time.sleep(10)
6395 finally:
6396 pass
6397 df.callback(0)
6398 reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df)
6399 return df
6400
6401 @deferred(TESTCASE_TIMEOUT + 200)
6402 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self):
6403 """
6404 Test Method:
6405 0. Make sure that voltha is up and running on CORD-POD setup.
6406 1. OLT and ONU is detected and validated.
6407 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6408 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6409 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6410 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6411 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6412 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6413 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6414 9. Disable uni_2 port which is being shown on voltha CLI.
6415 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6416 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6417 12. Enable uni_2 port which we disable at step 9.
6418 13. Repeat step 5,6 and 8.
6419 14. Repeat steps 4 to 13 steps multiple times (example 5 times)
6420 """
6421 df = defer.Deferred()
6422 no_iterations = 5
6423 def igmp_flow_check_operating_onu_admin_state(df):
6424 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006425 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00006426 services = ('IGMP')
6427 cbs = (self.igmp_flow_check, None, None)
6428 port_list = self.generate_port_list(num_subscribers, num_channels)
6429
Thangavelu K S9a637332017-08-01 23:22:23 +00006430 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 +00006431 thread1.start()
6432 time.sleep(randint(40,60))
6433 for i in range(no_iterations):
6434 thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],))
6435 log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha')
6436 thread2.start()
6437 time.sleep(1)
6438 thread2.join()
6439 thread1.isAlive()
6440 thread1.join()
6441 thread2.join()
6442 try:
6443 assert_equal(self.success, True)
6444 log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful')
6445 time.sleep(10)
6446 finally:
6447 pass
6448 df.callback(0)
6449 reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df)
6450 return df
6451
6452 @deferred(TESTCASE_TIMEOUT)
6453 def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self):
6454 """
6455 Test Method:
6456 0. Make sure that voltha is up and running on CORD-POD setup.
6457 1. OLT and ONU is detected and validated.
6458 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber..
6459 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity.
6460 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port)
6461 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port)
6462 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU.
6463 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6464 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6465 9. Disable olt device which is being shown on voltha CLI.
6466 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester.
6467 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester.
6468 12. Enable olt device which is disable at step 9.
6469 13. Repeat steps 4,5, 7 and 8.
6470 14. Repeat steps 4 to 13 steps multiple times (example 10 times)
6471 """
6472 df = defer.Deferred()
6473 no_iterations = 10
6474 def igmp_flow_check_operating_olt_admin_restart(df):
6475 num_subscribers = 2
Thangavelu K S9a637332017-08-01 23:22:23 +00006476 num_channels = 1
Thangavelu K S6432b522017-07-22 00:05:54 +00006477 services = ('IGMP')
6478 cbs = (self.igmp_flow_check, None, None)
6479 port_list = self.generate_port_list(num_subscribers, num_channels)
6480
Thangavelu K S9a637332017-08-01 23:22:23 +00006481 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 +00006482 thread1.start()
6483 time.sleep(randint(50,60))
6484 for i in range(no_iterations):
6485 thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,))
6486 thread2.start()
6487 time.sleep(10)
6488 thread2.join()
6489 thread1.join()
6490 thread2.join()
6491 try:
6492 assert_equal(self.success, True)
6493 log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful')
6494 time.sleep(10)
6495 finally:
6496 pass
6497 df.callback(0)
6498 reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df)
6499 return df
6500
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00006501 def test_five_subscribers_with_voltha_for_igmp_with_ten_group_joins_verifying_traffic(self):
Thangavelu K S6432b522017-07-22 00:05:54 +00006502 """
6503 Test Method:
6504 0. Make sure that voltha is up and running on CORD-POD setup.
6505 1. OLT and ONU is detected and validated.
6506 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
6507 3. Issue multiple dhcp client packets to get IP address from dhcp server for as subscribers and check connectivity.
6508 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
6509 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
6510 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
6511 """
6512
6513 num_subscribers = 5
6514 num_channels = 10
6515 services = ('IGMP')
6516 cbs = (self.igmp_flow_check, None, None)
6517 self.voltha_subscribers(services, cbs = cbs,
6518 num_subscribers = num_subscribers,
6519 num_channels = num_channels)
6520
Thangavelu K S and Chetan Gaonkere07a7b42017-08-23 17:43:31 +00006521 def test_nine_subscribers_with_voltha_for_igmp_with_ten_group_joins_and_verify_traffic(self):
Thangavelu K S6432b522017-07-22 00:05:54 +00006522 """
6523 Test Method:
6524 0. Make sure that voltha is up and running on CORD-POD setup.
6525 1. OLT and ONU is detected and validated.
6526 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers..
6527 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity.
6528 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc
6529 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU.
6530 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester.
6531 """
6532 num_subscribers = 9
6533 num_channels = 10
6534 services = ('IGMP')
6535 cbs = (self.igmp_flow_check, None, None)
6536 self.voltha_subscribers(services, cbs = cbs,
6537 num_subscribers = num_subscribers,
6538 num_channels = num_channels)