Matteo Scandolo | 48d3d2d | 2017-08-08 13:05:27 -0700 | [diff] [blame] | 1 | |
| 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 Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 17 | import os |
| 18 | import sys |
| 19 | import unittest |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 20 | import time, monotonic |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 21 | import json |
| 22 | import requests |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 23 | import threading |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 24 | from IGMP import * |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 25 | from random import randint |
| 26 | from threading import Timer |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 27 | from threadPool import ThreadPool |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 28 | from nose.tools import * |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 29 | from nose.twistedtools import reactor, deferred |
| 30 | from twisted.internet import defer |
A R Karthick | 9dc6e92 | 2017-07-12 14:40:16 -0700 | [diff] [blame] | 31 | from CordTestConfig import setup_module, teardown_module |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 32 | from CordTestUtils import log_test |
A R Karthick | caa1b6a | 2017-07-27 14:07:05 -0700 | [diff] [blame] | 33 | from VolthaCtrl import VolthaCtrl, voltha_setup, voltha_teardown |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 34 | from CordTestUtils import log_test, get_controller |
| 35 | from portmaps import g_subscriber_port_map |
| 36 | from OltConfig import * |
| 37 | from EapTLS import TLSAuthTest |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 38 | from Channels import Channels, IgmpChannel |
| 39 | from Stats import Stats |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 40 | from DHCP import DHCPTest |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 41 | from OnosCtrl import OnosCtrl |
| 42 | from CordLogger import CordLogger |
| 43 | from scapy.all import * |
| 44 | from scapy_ssl_tls.ssl_tls import * |
| 45 | from scapy_ssl_tls.ssl_tls_crypto import * |
| 46 | from CordTestServer import cord_test_onos_restart, cord_test_shell, cord_test_radius_restart |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 47 | from CordContainer import Onos |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 48 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 49 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 50 | class Voltha_olt_subscribers(Channels): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 51 | |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 52 | STATS_RX = 0 |
| 53 | STATS_TX = 1 |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 54 | STATS_JOIN = 2 |
| 55 | STATS_LEAVE = 3 |
| 56 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 57 | 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 S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 61 | self.num_channels = num_channels |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 62 | try: |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 63 | self.tx_intf = tx_port |
| 64 | self.rx_intf = rx_port |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 65 | except: |
| 66 | self.tx_intf = self.INTF_TX_DEFAULT |
| 67 | self.rx_intf = self.INTF_RX_DEFAULT |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 68 | # num = 1 |
| 69 | # channel_start = 0 |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 70 | mcast_cb = None |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 71 | Channels.__init__(self, num_channels, channel_start = channel_start, src_list = src_list, |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 72 | iface = self.rx_intf, iface_mcast = self.tx_intf, mcast_cb = mcast_cb) |
| 73 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 74 | self.loginType = 'wireless' |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 75 | ##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 S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 86 | def channel_join(self, chan = 0, delay = 2, src_list = None, record_type = None): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 87 | '''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 S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 91 | chan, join_time = self.join(chan, src_list = src_list, record_type = record_type) |
| 92 | #chan, join_time = self.join(chan) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 93 | self.channel_join_update(chan, join_time) |
| 94 | return chan |
| 95 | |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 96 | def channel_join_next(self, delay = 2, src_list = None, leave_flag = True): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 97 | '''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 S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 102 | chan, join_time = self.join_next(src_list = src_list, leave_flag = leave_flag) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 103 | 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 S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 116 | def channel_leave(self, chan = 0, force = False, src_list = None): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 117 | if self.join_map.has_key(chan): |
| 118 | del self.join_map[chan] |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 119 | self.leave(chan, force = force, src_list = src_list) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 120 | |
| 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 S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 130 | def channel_receive(self, chan, cb = None, count = 1, timeout = 5, src_list = None): |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 131 | log_test.info('Subscriber on port %s checking data traffic receiving from group %s, channel %d' % |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 132 | (self.rx_intf, self.gaddr(chan), chan)) |
| 133 | r = self.recv(chan, cb = cb, count = count, timeout = timeout, src_list = src_list) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 134 | if len(r) == 0: |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 135 | log_test.info('Subscriber on port %s timed out' %( self.rx_intf)) |
| 136 | self.test_status = False |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 137 | else: |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 138 | self.test_status = True |
| 139 | pass |
| 140 | # log_test.info('Subscriber on port %s received %d packets' %(self.rx_intf, len(r))) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 141 | if self.recv_timeout: |
| 142 | ##Negative test case is disabled for now |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 143 | log_test.info('Subscriber on port %s not received %d packets' %(self.rx_intf, len(r))) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 144 | assert_equal(len(r), 0) |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 145 | self.test_status = True |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 146 | return self.test_status |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 147 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 148 | def channel_not_receive(self, chan, cb = None, count = 1, timeout = 5, src_list = None): |
| 149 | log_test.info('Subscriber on port %s checking data traffic receiving from group %s, channel %d' % |
| 150 | (self.rx_intf, self.gaddr(chan), chan)) |
| 151 | r = self.not_recv(chan, cb = cb, count = count, timeout = timeout, src_list = src_list) |
| 152 | if len(r) == 0: |
| 153 | log_test.info('Subscriber on port %s timed out' %( self.rx_intf)) |
| 154 | self.test_status = True |
| 155 | else: |
| 156 | self.test_status = False |
| 157 | pass |
| 158 | # log_test.info('Subscriber on port %s received %d packets' %(self.rx_intf, len(r))) |
| 159 | if self.recv_timeout: |
| 160 | ##Negative test case is disabled for now |
| 161 | log_test.info('Subscriber on port %s not received %d packets' %(self.rx_intf, len(r))) |
| 162 | assert_equal(len(r), 0) |
| 163 | self.test_status = True |
| 164 | return self.test_status |
| 165 | |
| 166 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 167 | def recv_channel_cb(self, pkt, src_list = None): |
| 168 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 169 | ##First verify that we have received the packet for the joined instance |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 170 | log_test.info('Packet received for group %s, subscriber, port %s and from source ip %s showing full packet %s'% |
| 171 | (pkt[IP].dst, self.rx_intf, pkt[IP].src, pkt.show)) |
| 172 | if src_list is not None: |
| 173 | for i in src_list: |
| 174 | if pkt[IP].src == src_list[i]: |
| 175 | pass |
| 176 | else: |
| 177 | log_test.info('Packet received for group %s, subscriber, port %s and from source ip %s which is not expcted on that port'% |
| 178 | (pkt[IP].dst, self.rx_intf, pkt[IP].src)) |
| 179 | |
| 180 | self.recv_timeout = True |
| 181 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 182 | if self.recv_timeout: |
| 183 | return |
| 184 | chan = self.caddr(pkt[IP].dst) |
| 185 | assert_equal(chan in self.join_map.keys(), True) |
| 186 | recv_time = monotonic.monotonic() * 1000000 |
| 187 | join_time = self.join_map[chan][self.STATS_JOIN].start |
| 188 | delta = recv_time - join_time |
| 189 | self.join_rx_stats.update(packets=1, t = delta, usecs = True) |
| 190 | self.channel_update(chan, self.STATS_RX, 1, t = delta) |
| 191 | log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst)) |
| 192 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 193 | class voltha_subscriber_pool: |
| 194 | |
| 195 | def __init__(self, subscriber, test_cbs): |
| 196 | self.subscriber = subscriber |
| 197 | self.test_cbs = test_cbs |
| 198 | |
| 199 | def pool_cb(self): |
| 200 | for cb in self.test_cbs: |
| 201 | if cb: |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 202 | self.test_status = cb(self.subscriber, multiple_sub = True) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 203 | if self.test_status is not True: |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 204 | ## This is chaining for other sub status has to check again |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 205 | self.test_status = True |
| 206 | log_test.info('This service is failed and other services will not run for this subscriber') |
| 207 | break |
| 208 | log_test.info('This Subscriber is tested for multiple service eligibility ') |
| 209 | self.test_status = True |
| 210 | |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 211 | class voltha_exchange(unittest.TestCase): |
| 212 | |
| 213 | OLT_TYPE = 'tibit_olt' |
| 214 | OLT_MAC = '00:0c:e2:31:12:00' |
| 215 | VOLTHA_HOST = 'localhost' |
| 216 | VOLTHA_REST_PORT = 8881 |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 217 | VOLTHA_OLT_TYPE = 'ponsim_olt' |
| 218 | VOLTHA_OLT_MAC = '00:0c:e2:31:12:00' |
| 219 | VOLTHA_IGMP_ITERATIONS = 100 |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 220 | voltha = None |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 221 | voltha_attrs = None |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 222 | success = True |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 223 | olt_device_id = None |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 224 | apps = ('org.opencord.aaa', 'org.onosproject.dhcp', 'org.onosproject.dhcprelay') |
| 225 | app_dhcp = ('org.onosproject.dhcp') |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 226 | olt_apps = () #'org.opencord.cordmcast') |
| 227 | vtn_app = 'org.opencord.vtn' |
| 228 | table_app = 'org.ciena.cordigmp' |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 229 | test_path = os.path.dirname(os.path.realpath(__file__)) |
| 230 | table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar') |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 231 | app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar') |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 232 | olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar') |
A.R Karthick | 3493a57 | 2017-06-07 18:28:10 -0700 | [diff] [blame] | 233 | olt_app_name = 'org.onosproject.olt' |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 234 | #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config') |
| 235 | olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json')) |
| 236 | onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0))) |
A R Karthick | 9dc6e92 | 2017-07-12 14:40:16 -0700 | [diff] [blame] | 237 | VOLTHA_AUTO_CONFIGURE = False |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 238 | num_joins = 0 |
| 239 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 240 | relay_interfaces_last = () |
| 241 | interface_to_mac_map = {} |
| 242 | host_ip_map = {} |
| 243 | default_config = { 'default-lease-time' : 600, 'max-lease-time' : 7200, } |
| 244 | default_options = [ ('subnet-mask', '255.255.255.0'), |
| 245 | ('broadcast-address', '192.168.1.255'), |
| 246 | ('domain-name-servers', '192.168.1.1'), |
| 247 | ('domain-name', '"mydomain.cord-tester"'), |
| 248 | ] |
| 249 | ##specify the IP for the dhcp interface matching the subnet and subnet config |
| 250 | ##this is done for each interface dhcpd server would be listening on |
| 251 | default_subnet_config = [ ('192.168.1.2', |
| 252 | ''' |
| 253 | subnet 192.168.1.0 netmask 255.255.255.0 { |
| 254 | range 192.168.1.10 192.168.1.100; |
| 255 | } |
| 256 | '''), ] |
| 257 | |
| 258 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 259 | VOLTHA_ENABLED = True |
| 260 | INTF_TX_DEFAULT = 'veth2' |
| 261 | INTF_RX_DEFAULT = 'veth0' |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 262 | INTF_2_RX_DEFAULT = 'veth6' |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 263 | TESTCASE_TIMEOUT = 300 |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 264 | VOLTHA_IGMP_ITERATIONS = 10 |
| 265 | # VOLTHA_CONFIG_FAKE = True |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 266 | VOLTHA_CONFIG_FAKE = False |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 267 | VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' } |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 268 | VOLTHA_UPLINK_VLAN_START = 444 |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 269 | VOLTHA_ONU_UNI_PORT = 'veth0' |
| 270 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 271 | dhcp_server_config = { |
| 272 | "ip": "10.1.11.50", |
| 273 | "mac": "ca:fe:ca:fe:ca:fe", |
| 274 | "subnet": "255.255.252.0", |
| 275 | "broadcast": "10.1.11.255", |
| 276 | "router": "10.1.8.1", |
| 277 | "domain": "8.8.8.8", |
| 278 | "ttl": "63", |
| 279 | "delay": "2", |
| 280 | "startip": "10.1.11.51", |
| 281 | "endip": "10.1.11.100" |
| 282 | } |
| 283 | |
| 284 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 285 | CLIENT_CERT = """-----BEGIN CERTIFICATE----- |
| 286 | MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx |
| 287 | CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h |
| 288 | IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd |
| 289 | RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN |
| 290 | MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV |
| 291 | BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI |
| 292 | hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC |
| 293 | gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe |
| 294 | +9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg |
| 295 | rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD |
| 296 | VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l |
| 297 | eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY |
| 298 | 6tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC |
| 299 | PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC |
| 300 | nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug== |
| 301 | -----END CERTIFICATE-----""" |
| 302 | |
| 303 | CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE----- |
| 304 | MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx |
| 305 | CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h |
| 306 | IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd |
| 307 | RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN |
| 308 | MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV |
| 309 | BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI |
| 310 | hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC |
| 311 | AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ |
| 312 | 5An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK |
| 313 | tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR |
| 314 | OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21 |
| 315 | qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39 |
| 316 | 2Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB |
| 317 | BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l |
| 318 | eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV |
| 319 | MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn |
| 320 | VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP |
| 321 | RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ |
| 322 | dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3 |
| 323 | T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt |
| 324 | yg== |
| 325 | -----END CERTIFICATE-----''' |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 326 | |
A.R Karthick | 3493a57 | 2017-06-07 18:28:10 -0700 | [diff] [blame] | 327 | @classmethod |
| 328 | def update_apps_version(cls): |
| 329 | version = Onos.getVersion() |
| 330 | major = int(version.split('.')[0]) |
| 331 | minor = int(version.split('.')[1]) |
| 332 | cordigmp_app_version = '2.0-SNAPSHOT' |
| 333 | olt_app_version = '1.2-SNAPSHOT' |
| 334 | if major > 1: |
| 335 | cordigmp_app_version = '3.0-SNAPSHOT' |
| 336 | olt_app_version = '2.0-SNAPSHOT' |
| 337 | elif major == 1: |
| 338 | if minor > 10: |
| 339 | cordigmp_app_version = '3.0-SNAPSHOT' |
| 340 | olt_app_version = '2.0-SNAPSHOT' |
| 341 | elif minor <= 8: |
| 342 | olt_app_version = '1.1-SNAPSHOT' |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 343 | cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version)) |
| 344 | cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version)) |
| 345 | cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version)) |
| 346 | |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 347 | @classmethod |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 348 | def dhcprelay_setUpClass(cls): |
| 349 | ''' Activate the dhcprelay app''' |
| 350 | OnosCtrl(cls.app_dhcp).deactivate() |
| 351 | time.sleep(3) |
| 352 | cls.onos_ctrl = OnosCtrl('org.onosproject.dhcprelay') |
| 353 | status, _ = cls.onos_ctrl.activate() |
| 354 | assert_equal(status, True) |
| 355 | time.sleep(3) |
| 356 | cls.dhcp_relay_setup() |
| 357 | ##start dhcpd initially with default config |
| 358 | cls.dhcpd_start() |
| 359 | |
| 360 | @classmethod |
| 361 | def dhcprelay_tearDownClass(cls): |
| 362 | '''Deactivate the dhcp relay app''' |
| 363 | try: |
| 364 | os.unlink('{}/dhcpd.conf'.format(cls.dhcp_data_dir)) |
| 365 | os.unlink('{}/dhcpd.leases'.format(cls.dhcp_data_dir)) |
| 366 | except: pass |
| 367 | cls.onos_ctrl.deactivate() |
| 368 | cls.dhcpd_stop() |
| 369 | cls.dhcp_relay_cleanup() |
| 370 | |
| 371 | @classmethod |
A.R Karthick | f874d03 | 2017-06-07 18:47:51 -0700 | [diff] [blame] | 372 | def onos_load_config(cls, app, config): |
| 373 | status, code = OnosCtrl.config(config) |
| 374 | if status is False: |
| 375 | log_test.info('JSON config request for app %s returned status %d' %(app, code)) |
| 376 | assert_equal(status, True) |
| 377 | time.sleep(2) |
| 378 | |
| 379 | @classmethod |
| 380 | def onos_aaa_load(cls): |
| 381 | aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password', |
| 382 | 'radiusIp': '172.17.0.2' } } } } |
| 383 | radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2' |
| 384 | aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip |
| 385 | cls.onos_load_config('org.opencord.aaa', aaa_dict) |
| 386 | |
| 387 | @classmethod |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 388 | def onos_dhcp_table_load(self, config = None): |
| 389 | dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } } |
| 390 | dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp'] |
| 391 | if config: |
| 392 | for k in config.keys(): |
| 393 | if dhcp_config.has_key(k): |
| 394 | dhcp_config[k] = config[k] |
| 395 | self.onos_load_config('org.onosproject.dhcp', dhcp_dict) |
| 396 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 397 | def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = None): |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 398 | if validation: |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 399 | cip, sip = dhcp.discover(mac = mac, update_seed = update_seed) |
| 400 | assert_not_equal(cip, None) |
| 401 | assert_not_equal(sip, None) |
| 402 | log_test.info('Got dhcp client IP %s from server %s for mac %s' % |
| 403 | (cip, sip, dhcp.get_mac(cip)[0])) |
| 404 | if validation == False: |
| 405 | cip, sip = dhcp.discover(mac = mac, update_seed = update_seed) |
| 406 | assert_equal(cip, None) |
| 407 | assert_equal(sip, None) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 408 | log_test.info('Dhcp client did not get IP from server') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 409 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 410 | if validation == 'skip': |
| 411 | cip, sip = dhcp.discover(mac = mac, update_seed = update_seed) |
| 412 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 413 | return cip,sip |
| 414 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 415 | def dhcp_request(self, onu_iface = None, seed_ip = '10.10.10.1', update_seed = False, validation = None, startip = '10.10.10.20', mac = None): |
| 416 | config = {'startip':startip, 'endip':'10.10.10.200', |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 417 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 418 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 419 | self.onos_dhcp_table_load(config) |
| 420 | dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 421 | cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed, validation = validation, mac = mac) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 422 | return cip, sip |
| 423 | |
| 424 | @classmethod |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 425 | def setUpClass(cls): |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 426 | cls.update_apps_version() |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 427 | cls.voltha_attrs = dict(host = cls.VOLTHA_HOST, |
| 428 | rest_port = cls.VOLTHA_REST_PORT, |
| 429 | uplink_vlan_map = cls.VOLTHA_UPLINK_VLAN_MAP, |
| 430 | uplink_vlan_start = cls.VOLTHA_UPLINK_VLAN_START) |
| 431 | cls.voltha = VolthaCtrl(**cls.voltha_attrs) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 432 | cls.install_app_table() |
| 433 | cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file) |
| 434 | cls.port_map, cls.port_list = cls.olt.olt_port_map() |
| 435 | cls.switches = cls.port_map['switches'] |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 436 | cls.ponsim_ports = cls.port_map['ponsim'] |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 437 | cls.num_ports = cls.port_map['num_ports'] |
| 438 | if cls.num_ports > 1: |
| 439 | cls.num_ports -= 1 ##account for the tx port |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 440 | cls.activate_apps(cls.apps + cls.olt_apps, deactivate = True) |
A.R Karthick | f874d03 | 2017-06-07 18:47:51 -0700 | [diff] [blame] | 441 | cls.onos_aaa_load() |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 442 | |
A.R Karthick | 3493a57 | 2017-06-07 18:28:10 -0700 | [diff] [blame] | 443 | @classmethod |
| 444 | def tearDownClass(cls): |
| 445 | '''Deactivate the olt apps and restart OVS back''' |
| 446 | apps = cls.olt_apps + ( cls.table_app,) |
| 447 | for app in apps: |
| 448 | onos_ctrl = OnosCtrl(app) |
| 449 | onos_ctrl.deactivate() |
| 450 | cls.install_app_igmp() |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 451 | cord_test_radius_restart() |
| 452 | |
A.R Karthick | 3493a57 | 2017-06-07 18:28:10 -0700 | [diff] [blame] | 453 | @classmethod |
| 454 | def install_app_igmp(cls): |
| 455 | ##Uninstall the table app on class exit |
| 456 | OnosCtrl.uninstall_app(cls.table_app) |
| 457 | time.sleep(2) |
| 458 | log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file)) |
| 459 | OnosCtrl.install_app(cls.app_file) |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 460 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 461 | def remove_olt(self, switch_map): |
| 462 | controller = get_controller() |
| 463 | auth = ('karaf', 'karaf') |
| 464 | #remove subscriber for every port on all the voltha devices |
| 465 | for device, device_map in switch_map.iteritems(): |
| 466 | uni_ports = device_map['ports'] |
| 467 | uplink_vlan = device_map['uplink_vlan'] |
| 468 | for port in uni_ports: |
| 469 | rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller, |
| 470 | device, |
| 471 | port) |
| 472 | resp = requests.delete(rest_url, auth = auth) |
| 473 | if resp.status_code not in [204, 202, 200]: |
| 474 | log_test.error('Error deleting subscriber for device %s on port %s' %(device, port)) |
| 475 | else: |
| 476 | log_test.info('Deleted subscriber for device %s on port %s' %(device, port)) |
| 477 | OnosCtrl.uninstall_app(self.olt_app_file) |
| 478 | |
| 479 | def config_olt(self, switch_map): |
| 480 | controller = get_controller() |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 481 | auth = ('karaf', 'karaf') |
| 482 | #configure subscriber for every port on all the voltha devices |
| 483 | for device, device_map in switch_map.iteritems(): |
| 484 | uni_ports = device_map['ports'] |
| 485 | uplink_vlan = device_map['uplink_vlan'] |
| 486 | for port in uni_ports: |
| 487 | vlan = port |
| 488 | rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller, |
| 489 | device, |
| 490 | port, |
| 491 | vlan) |
| 492 | resp = requests.post(rest_url, auth = auth) |
| 493 | #assert_equal(resp.ok, True) |
| 494 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 495 | def voltha_uni_port_toggle(self, uni_port = None): |
| 496 | ## Admin state of port is down and up |
| 497 | if not uni_port: |
| 498 | uni_port = self.INTF_RX_DEFAULT |
| 499 | cmd = 'ifconfig {} down'.format(uni_port) |
| 500 | os.system(cmd) |
| 501 | log_test.info('Admin state of uni_port is down') |
| 502 | time.sleep(30) |
| 503 | cmd = 'ifconfig {} up'.format(uni_port) |
| 504 | os.system(cmd) |
| 505 | log_test.info('Admin state of uni_port is up now') |
| 506 | time.sleep(30) |
| 507 | return |
| 508 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 509 | @classmethod |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 510 | def install_app_table(cls): |
| 511 | ##Uninstall the existing app if any |
| 512 | OnosCtrl.uninstall_app(cls.table_app) |
| 513 | time.sleep(2) |
| 514 | log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file)) |
| 515 | OnosCtrl.install_app(cls.table_app_file) |
| 516 | time.sleep(3) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 517 | |
| 518 | @classmethod |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 519 | def activate_apps(cls, apps, deactivate = False): |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 520 | for app in apps: |
| 521 | onos_ctrl = OnosCtrl(app) |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 522 | if deactivate is True: |
| 523 | onos_ctrl.deactivate() |
| 524 | time.sleep(2) |
| 525 | status, _ = onos_ctrl.activate() |
| 526 | assert_equal(status, True) |
| 527 | time.sleep(2) |
| 528 | |
| 529 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 530 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 531 | @classmethod |
| 532 | def deactivate_apps(cls, apps): |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 533 | cls.success = True |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 534 | for app in apps: |
| 535 | onos_ctrl = OnosCtrl(app) |
| 536 | status, _ = onos_ctrl.deactivate() |
| 537 | if status is False: |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 538 | cls.success = False |
| 539 | # assert_equal(status, True) |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 540 | time.sleep(2) |
| 541 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 542 | def random_ip(self,start_ip = '10.10.10.20', end_ip = '10.10.10.65'): |
| 543 | start = list(map(int, start_ip.split("."))) |
| 544 | end = list(map(int, end_ip.split("."))) |
| 545 | temp = start |
| 546 | ip_range = [] |
| 547 | ip_range.append(start_ip) |
| 548 | while temp != end: |
| 549 | start[3] += 1 |
| 550 | for i in (3, 2, 1): |
| 551 | if temp[i] == 255: |
| 552 | temp[i] = 0 |
| 553 | temp[i-1] += 1 |
| 554 | ip_range.append(".".join(map(str, temp))) |
| 555 | return random.choice(ip_range) |
| 556 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 557 | def random_mcast_ip(self,start_ip = '224.0.1.0', end_ip = '224.0.1.100'): |
| 558 | start = list(map(int, start_ip.split("."))) |
| 559 | end = list(map(int, end_ip.split("."))) |
| 560 | temp = start |
| 561 | ip_range = [] |
| 562 | ip_range.append(start_ip) |
| 563 | while temp != end: |
| 564 | start[3] += 1 |
| 565 | for i in (3, 2, 1): |
| 566 | if temp[i] == 255: |
| 567 | temp[i] = 0 |
| 568 | temp[i-1] += 1 |
| 569 | ip_range.append(".".join(map(str, temp))) |
| 570 | return random.choice(ip_range) |
| 571 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 572 | @classmethod |
| 573 | def dhcp_relay_setup(cls): |
| 574 | #did = OnosCtrl.get_device_id() |
| 575 | #cls.relay_device_id = did |
| 576 | #cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file) |
| 577 | #cls.port_map, _ = cls.olt.olt_port_map() self.port_map['ports'][port_list[1][1]] |
| 578 | if cls.port_map: |
| 579 | ##Per subscriber, we use 1 relay port |
| 580 | try: |
| 581 | relay_port = cls.port_map['ports'] |
| 582 | except: |
| 583 | relay_port = cls.port_map['uplink'] |
| 584 | cls.relay_interface_port = relay_port |
| 585 | cls.relay_interfaces = (cls.port_map[cls.relay_interface_port],) |
| 586 | else: |
| 587 | # cls.relay_interface_port = 100 |
| 588 | # cls.relay_interfaces = (g_subscriber_port_map[cls.relay_interface_port],) |
| 589 | log_test.info('No ONU ports are available, hence returning nothing') |
| 590 | cls.relay_interfaces_last = cls.relay_interfaces |
| 591 | if cls.port_map: |
| 592 | ##generate a ip/mac client virtual interface config for onos |
| 593 | interface_list = [] |
| 594 | for port in cls.port_map['ports']: |
| 595 | port_num = cls.port_map[port] |
| 596 | if port_num == cls.port_map['uplink']: |
| 597 | continue |
| 598 | ip = cls.get_host_ip(port_num) |
| 599 | mac = cls.get_mac(port) |
| 600 | interface_list.append((port_num, ip, mac)) |
| 601 | |
| 602 | #configure dhcp server virtual interface on the same subnet as first client interface |
| 603 | relay_ip = cls.get_host_ip(interface_list[0][0]) |
| 604 | relay_mac = cls.get_mac(cls.port_map[cls.relay_interface_port]) |
| 605 | interface_list.append((cls.relay_interface_port, relay_ip, relay_mac)) |
| 606 | cls.onos_interface_load(interface_list) |
| 607 | |
| 608 | @classmethod |
| 609 | def onos_interface_load(cls, interface_list): |
| 610 | interface_dict = { 'ports': {} } |
| 611 | for port_num, ip, mac in interface_list: |
| 612 | port_map = interface_dict['ports'] |
| 613 | port = '{}/{}'.format(cls.relay_device_id, port_num) |
| 614 | port_map[port] = { 'interfaces': [] } |
| 615 | interface_list = port_map[port]['interfaces'] |
| 616 | interface_map = { 'ips' : [ '{}/{}'.format(ip, 24) ], |
| 617 | 'mac' : mac, |
| 618 | 'name': 'vir-{}'.format(port_num) |
| 619 | } |
| 620 | interface_list.append(interface_map) |
| 621 | |
| 622 | cls.onos_load_config(interface_dict) |
| 623 | cls.configs['interface_config'] = interface_dict |
| 624 | |
| 625 | @classmethod |
| 626 | def get_host_ip(cls, port): |
| 627 | if cls.host_ip_map.has_key(port): |
| 628 | return cls.host_ip_map[port] |
| 629 | cls.host_ip_map[port] = '192.168.1.{}'.format(port) |
| 630 | return cls.host_ip_map[port] |
| 631 | |
| 632 | @classmethod |
| 633 | def host_load(cls, iface): |
| 634 | '''Have ONOS discover the hosts for dhcp-relay responses''' |
| 635 | port = g_subscriber_port_map[iface] |
| 636 | host = '173.17.1.{}'.format(port) |
| 637 | cmds = ( 'ifconfig {} 0'.format(iface), |
| 638 | 'ifconfig {0} {1}'.format(iface, host), |
| 639 | 'arping -I {0} {1} -c 2'.format(iface, host), |
| 640 | 'ifconfig {} 0'.format(iface), ) |
| 641 | for c in cmds: |
| 642 | os.system(c) |
| 643 | |
| 644 | @classmethod |
| 645 | def dhcpd_conf_generate(cls, config = default_config, options = default_options, |
| 646 | subnet = default_subnet_config): |
| 647 | conf = '' |
| 648 | for k, v in config.items(): |
| 649 | conf += '{} {};\n'.format(k, v) |
| 650 | |
| 651 | opts = '' |
| 652 | for k, v in options: |
| 653 | opts += 'option {} {};\n'.format(k, v) |
| 654 | |
| 655 | subnet_config = '' |
| 656 | for _, v in subnet: |
| 657 | subnet_config += '{}\n'.format(v) |
| 658 | |
| 659 | return '{}{}{}'.format(conf, opts, subnet_config) |
| 660 | |
| 661 | @classmethod |
| 662 | def dhcpd_start(cls, intf_list = None, |
| 663 | config = default_config, options = default_options, |
| 664 | subnet = default_subnet_config): |
| 665 | '''Start the dhcpd server by generating the conf file''' |
| 666 | if intf_list is None: |
| 667 | intf_list = cls.relay_interfaces |
| 668 | ##stop dhcpd if already running |
| 669 | cls.dhcpd_stop() |
| 670 | dhcp_conf = cls.dhcpd_conf_generate(config = config, options = options, |
| 671 | subnet = subnet) |
| 672 | ##first touch dhcpd.leases if it doesn't exist |
| 673 | lease_file = '{}/dhcpd.leases'.format(cls.dhcp_data_dir) |
| 674 | if os.access(lease_file, os.F_OK) is False: |
| 675 | with open(lease_file, 'w') as fd: pass |
| 676 | |
| 677 | conf_file = '{}/dhcpd.conf'.format(cls.dhcp_data_dir) |
| 678 | with open(conf_file, 'w') as fd: |
| 679 | fd.write(dhcp_conf) |
| 680 | |
| 681 | #now configure the dhcpd interfaces for various subnets |
| 682 | index = 0 |
| 683 | intf_info = [] |
| 684 | for ip,_ in subnet: |
| 685 | intf = intf_list[index] |
| 686 | mac = cls.get_mac(intf) |
| 687 | intf_info.append((ip, mac)) |
| 688 | index += 1 |
| 689 | os.system('ifconfig {} {}'.format(intf, ip)) |
| 690 | |
| 691 | intf_str = ','.join(intf_list) |
| 692 | dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format(conf_file, lease_file, intf_str) |
| 693 | log_test.info('Starting DHCPD server with command: %s' %dhcpd_cmd) |
| 694 | ret = os.system(dhcpd_cmd) |
| 695 | assert_equal(ret, 0) |
| 696 | time.sleep(3) |
| 697 | cls.relay_interfaces_last = cls.relay_interfaces |
| 698 | cls.relay_interfaces = intf_list |
| 699 | cls.onos_dhcp_relay_load(*intf_info[0]) |
| 700 | |
| 701 | @classmethod |
| 702 | def dhcpd_stop(cls): |
| 703 | os.system('pkill -9 dhcpd') |
| 704 | for intf in cls.relay_interfaces: |
| 705 | os.system('ifconfig {} 0'.format(intf)) |
| 706 | |
| 707 | cls.relay_interfaces = cls.relay_interfaces_last |
| 708 | |
| 709 | @classmethod |
| 710 | def get_mac(cls, iface): |
| 711 | if cls.interface_to_mac_map.has_key(iface): |
| 712 | return cls.interface_to_mac_map[iface] |
| 713 | mac = get_mac(iface, pad = 0) |
| 714 | cls.interface_to_mac_map[iface] = mac |
| 715 | return mac |
| 716 | |
| 717 | def send_recv(self, mac=None, update_seed = False, validate = True): |
| 718 | cip, sip = self.dhcp.discover(mac = mac, update_seed = update_seed) |
| 719 | if validate: |
| 720 | assert_not_equal(cip, None) |
| 721 | assert_not_equal(sip, None) |
| 722 | log_test.info('Got dhcp client IP %s from server %s for mac %s' % |
| 723 | (cip, sip, self.dhcp.get_mac(cip)[0])) |
| 724 | return cip,sip |
| 725 | |
| 726 | @classmethod |
| 727 | def dhcpd_conf_generate(cls, config = default_config, options = default_options, |
| 728 | subnet = default_subnet_config): |
| 729 | conf = '' |
| 730 | for k, v in config.items(): |
| 731 | conf += '{} {};\n'.format(k, v) |
| 732 | |
| 733 | opts = '' |
| 734 | for k, v in options: |
| 735 | opts += 'option {} {};\n'.format(k, v) |
| 736 | |
| 737 | subnet_config = '' |
| 738 | for _, v in subnet: |
| 739 | subnet_config += '{}\n'.format(v) |
| 740 | |
| 741 | return '{}{}{}'.format(conf, opts, subnet_config) |
| 742 | |
| 743 | @classmethod |
| 744 | def onos_dhcp_relay_load(cls, server_ip, server_mac): |
| 745 | relay_device_map = '{}/{}'.format(cls.relay_device_id, cls.relay_interface_port) |
| 746 | dhcp_dict = {'apps':{'org.onosproject.dhcp-relay':{'dhcprelay': |
| 747 | {'dhcpserverConnectPoint':relay_device_map, |
| 748 | 'serverip':server_ip, |
| 749 | 'servermac':server_mac |
| 750 | } |
| 751 | } |
| 752 | } |
| 753 | } |
| 754 | cls.onos_load_config(dhcp_dict) |
| 755 | cls.configs['relay_config'] = dhcp_dict |
| 756 | |
| 757 | @classmethod |
| 758 | def dhcp_relay_cleanup(cls): |
| 759 | ##reset the ONOS port configuration back to default |
| 760 | for config in cls.configs.items(): |
| 761 | OnosCtrl.delete(config) |
| 762 | # if cls.onos_restartable is True: |
| 763 | # log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg') |
| 764 | # return cord_test_onos_restart(config = {}) |
| 765 | |
| 766 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 767 | def tls_flow_check(self, olt_ports, cert_info = None, multiple_sub = False): |
| 768 | if multiple_sub is True: |
| 769 | olt_nni_port = olt_ports.tx_port |
| 770 | olt_uni_port = olt_ports.rx_port |
| 771 | else: |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 772 | olt_uni_port = olt_ports |
| 773 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 774 | def tls_fail_cb(): |
| 775 | log_test.info('TLS verification failed') |
| 776 | if cert_info is None: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 777 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 778 | log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port) |
| 779 | tls.runTest() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 780 | if tls.failTest is True: |
| 781 | self.success = False |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 782 | assert_equal(tls.failTest, False) |
| 783 | if cert_info == "no_cert": |
| 784 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '') |
| 785 | log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port) |
| 786 | tls.runTest() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 787 | if tls.failTest is False: |
| 788 | self.success = False |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 789 | assert_equal(tls.failTest, True) |
| 790 | if cert_info == "invalid_cert": |
| 791 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID) |
| 792 | log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port) |
| 793 | tls.runTest() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 794 | if tls.failTest is False: |
| 795 | self.success = False |
| 796 | assert_equal(tls.failTest, True) |
| 797 | if cert_info == "same_cert": |
| 798 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port) |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 799 | log_test.info('Running subscriber %s tls auth test with same valid TLS certificate' %olt_uni_port) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 800 | tls.runTest() |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 801 | if tls.failTest is True: |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 802 | self.success = False |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 803 | assert_equal(tls.failTest, False) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 804 | if cert_info == "app_deactivate" or cert_info == "restart_radius" or cert_info == "disable_olt_device" or \ |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 805 | cert_info == "uni_port_admin_down" or cert_info == "restart_olt_device" or cert_info == "restart_onu_device": |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 806 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID) |
| 807 | log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info)) |
| 808 | tls.runTest() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 809 | if tls.failTest is False: |
| 810 | self.success = False |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 811 | assert_equal(tls.failTest, True) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 812 | self.test_status = True |
| 813 | return self.test_status |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 814 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 815 | def dhcp_flow_check(self, olt_ports, negative_test = None, multiple_sub = False): |
| 816 | if multiple_sub is True: |
| 817 | olt_nni_port = olt_ports.tx_port |
| 818 | onu_iface = olt_ports.rx_port |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 819 | dhcp_server_startip = self.random_ip() |
| 820 | random_mac = '00:00:00:0a:0a:' + hex(random.randrange(50,254)).split('x')[1] |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 821 | else: |
| 822 | onu_iface = olt_ports |
| 823 | dhcp_server_startip = '10.10.10.20' |
| 824 | random_mac = None |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 825 | self.success = True |
| 826 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 827 | if negative_test is None: |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 828 | cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = 'skip', startip = dhcp_server_startip, mac = random_mac) |
| 829 | if cip == None or sip == None: |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 830 | self.success = False |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 831 | self.test_status = False |
| 832 | assert_not_equal(cip,None) |
| 833 | assert_not_equal(sip,None) |
| 834 | else: |
| 835 | log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip)) |
| 836 | self.test_status = True |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 837 | |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 838 | if negative_test == "interrupting_dhcp_flows": |
| 839 | cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = False) |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 840 | if cip is not None: |
| 841 | self.success = False |
| 842 | assert_equal(cip,None) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 843 | log_test.info('Subscriber %s not got client ip %s from server' %(onu_iface, cip)) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 844 | self.test_status = True |
| 845 | |
| 846 | if negative_test == "invalid_src_mac_broadcast": |
| 847 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 848 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 849 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 850 | self.onos_dhcp_table_load(config) |
| 851 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 852 | cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 853 | |
| 854 | if cip is not None: |
| 855 | self.success = False |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 856 | log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected self.success = %s '%self.success) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 857 | assert_equal(cip,None) |
| 858 | log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected') |
| 859 | self.test_status = True |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 860 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 861 | if negative_test == "invalid_src_mac_multicast": |
| 862 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 863 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 864 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 865 | self.onos_dhcp_table_load(config) |
| 866 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 867 | cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 868 | if cip is not None: |
| 869 | self.success = False |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 870 | assert_equal(cip,None) |
| 871 | log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected') |
| 872 | self.test_status = True |
| 873 | |
| 874 | if negative_test == "invalid_src_mac_junk": |
| 875 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 876 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 877 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 878 | self.onos_dhcp_table_load(config) |
| 879 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 880 | cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 881 | if cip is not None: |
| 882 | self.success = False |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 883 | assert_equal(cip,None) |
| 884 | log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected') |
| 885 | self.test_status = True |
| 886 | |
| 887 | if negative_test == "request_release": |
| 888 | config = {'startip':'10.10.100.20', 'endip':'10.10.100.230', |
| 889 | 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe", |
| 890 | 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'} |
| 891 | self.onos_dhcp_table_load(config) |
| 892 | self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface) |
| 893 | cip, sip = self.dhcp_sndrcv(self.dhcp) |
| 894 | log_test.info('Releasing ip %s to server %s' %(cip, sip)) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 895 | if not self.dhcp.release(cip): |
| 896 | self.success = False |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 897 | assert_equal(self.dhcp.release(cip), True) |
| 898 | log_test.info('Triggering DHCP discover again after release') |
| 899 | cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True) |
| 900 | log_test.info('Verifying released IP was given back on rediscover') |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 901 | if not cip == cip2: |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 902 | self.success = False |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 903 | assert_equal(cip, cip2) |
| 904 | log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2)) |
| 905 | assert_equal(self.dhcp.release(cip2), True) |
| 906 | self.test_status = True |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 907 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 908 | if negative_test == "starvation_positive": |
| 909 | config = {'startip':'193.170.1.20', 'endip':'193.170.1.69', |
| 910 | 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe", |
| 911 | 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'} |
| 912 | self.onos_dhcp_table_load(config) |
| 913 | self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface) |
| 914 | ip_map = {} |
| 915 | for i in range(10): |
| 916 | cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True) |
| 917 | if ip_map.has_key(cip): |
| 918 | self.success = False |
| 919 | log_test.info('IP %s given out multiple times' %cip) |
| 920 | assert_equal(False, ip_map.has_key(cip)) |
| 921 | ip_map[cip] = sip |
| 922 | self.test_status = True |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 923 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 924 | if negative_test == "starvation_negative": |
| 925 | config = {'startip':'182.17.0.20', 'endip':'182.17.0.69', |
| 926 | 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe", |
| 927 | 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'} |
| 928 | self.onos_dhcp_table_load(config) |
| 929 | self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface) |
| 930 | log_test.info('Verifying passitive case') |
| 931 | for x in xrange(50): |
| 932 | mac = RandMAC()._fix() |
| 933 | self.dhcp_sndrcv(self.dhcp,mac = mac) |
| 934 | log_test.info('Verifying negative case') |
| 935 | cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 936 | if cip or sip is not None: |
| 937 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 938 | assert_equal(cip, None) |
| 939 | assert_equal(sip, None) |
| 940 | self.test_status = True |
| 941 | self.success = True |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 942 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 943 | if negative_test == "multiple_discover": |
| 944 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 945 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 946 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 947 | self.onos_dhcp_table_load(config) |
| 948 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 949 | cip, sip, mac, _ = self.dhcp.only_discover() |
| 950 | log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' % |
| 951 | (cip, sip, mac) ) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 952 | if cip is None: |
| 953 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 954 | assert_not_equal(cip, None) |
| 955 | log_test.info('Triggering DHCP discover again.') |
| 956 | new_cip, new_sip, new_mac, _ = self.dhcp.only_discover() |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 957 | if not new_cip == cip: |
| 958 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 959 | assert_equal(new_cip, cip) |
| 960 | log_test.info('client got same IP as expected when sent 2nd discovery') |
| 961 | self.test_status = True |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 962 | # self.success = True |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 963 | if negative_test == "multiple_requests": |
| 964 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 965 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 966 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 967 | self.onos_dhcp_table_load(config) |
| 968 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 969 | log_test.info('Sending DHCP discover and DHCP request.') |
| 970 | cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True) |
| 971 | mac = self.dhcp.get_mac(cip)[0] |
| 972 | log_test.info("Sending DHCP request again.") |
| 973 | new_cip, new_sip = self.dhcp.only_request(cip, mac) |
| 974 | assert_equal(new_cip,cip) |
| 975 | log_test.info('server offered same IP to clain for multiple requests, as expected') |
| 976 | self.test_status = True |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 977 | # self.success = True |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 978 | if negative_test == "desired_ip_address": |
| 979 | config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', |
| 980 | 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 981 | 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'} |
| 982 | self.onos_dhcp_table_load(config) |
| 983 | self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface) |
| 984 | cip, sip, mac, _ = self.dhcp.only_discover(desired = True) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 985 | if cip or sip is None: |
| 986 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 987 | assert_not_equal(cip, None) |
| 988 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 989 | (cip, sip, mac)) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 990 | if not self.dhcp.seed_ip == cip: |
| 991 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 992 | assert_equal(cip,self.dhcp.seed_ip) |
| 993 | log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip) |
| 994 | self.test_status = True |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 995 | # self.success = True |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 996 | if negative_test == "desired_out_of_pool_ip_address": |
| 997 | config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', |
| 998 | 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 999 | 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'} |
| 1000 | self.onos_dhcp_table_load(config) |
| 1001 | self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface) |
| 1002 | cip, sip, mac, _ = self.dhcp.only_discover(desired = True) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1003 | if cip or sip is None: |
| 1004 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1005 | assert_not_equal(cip, None) |
| 1006 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 1007 | (cip, sip, mac) ) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1008 | if self.dhcp.seed_ip == cip: |
| 1009 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1010 | assert_not_equal(cip,self.dhcp.seed_ip) |
| 1011 | log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected') |
| 1012 | self.test_status = True |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 1013 | # self.success = True |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1014 | if negative_test == "dhcp_renew": |
| 1015 | config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', |
| 1016 | 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 1017 | 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'} |
| 1018 | self.onos_dhcp_table_load(config) |
| 1019 | self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface) |
| 1020 | cip, sip, mac, _ = self.dhcp.only_discover() |
| 1021 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 1022 | (cip, sip, mac) ) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1023 | if cip or sip is None: |
| 1024 | self.success = False |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1025 | assert_not_equal(cip, None) |
| 1026 | new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True) |
| 1027 | log_test.info('waiting renew time %d seconds to send next request packet'%lval) |
| 1028 | time.sleep(lval) |
| 1029 | latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1030 | if not latest_cip == cip: |
| 1031 | self.success = False |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1032 | assert_equal(latest_cip,cip) |
| 1033 | log_test.info('client got same IP after renew time, as expected') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1034 | self.test_status = True |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1035 | # self.success = True |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1036 | if negative_test == "dhcp_rebind": |
| 1037 | config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', |
| 1038 | 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 1039 | 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'} |
| 1040 | self.onos_dhcp_table_load(config) |
| 1041 | self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface) |
| 1042 | cip, sip, mac, _ = self.dhcp.only_discover() |
| 1043 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 1044 | (cip, sip, mac) ) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1045 | if cip or sip is None: |
| 1046 | self.success = False |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1047 | assert_not_equal(cip, None) |
| 1048 | new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True) |
| 1049 | log_test.info('waiting rebind time %d seconds to send next request packet'%lval) |
| 1050 | time.sleep(lval) |
| 1051 | latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1052 | if not latest_cip == cip: |
| 1053 | self.success = False |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1054 | assert_equal(latest_cip,cip) |
| 1055 | log_test.info('client got same IP after rebind time, as expected') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1056 | self.test_status = True |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1057 | # self.success = True |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 1058 | return self.test_status |
| 1059 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1060 | def recv_channel_cb(self, pkt): |
| 1061 | ##First verify that we have received the packet for the joined instance |
| 1062 | chan = self.subscriber.caddr(pkt[IP].dst) |
| 1063 | assert_equal(chan in self.subscriber.join_map.keys(), True) |
| 1064 | recv_time = monotonic.monotonic() * 1000000 |
| 1065 | join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start |
| 1066 | delta = recv_time - join_time |
| 1067 | self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True) |
| 1068 | self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta) |
| 1069 | log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst)) |
| 1070 | self.test_status = True |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1071 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1072 | def traffic_verify(self, subscriber): |
| 1073 | # if subscriber.has_service('TRAFFIC'): |
| 1074 | url = 'http://www.google.com' |
| 1075 | resp = requests.get(url) |
| 1076 | self.test_status = resp.ok |
| 1077 | if resp.ok == False: |
| 1078 | log_test.info('Subscriber %s failed get from url %s with status code %d' |
| 1079 | %(subscriber.name, url, resp.status_code)) |
| 1080 | else: |
| 1081 | log_test.info('GET request from %s succeeded for subscriber %s' |
| 1082 | %(url, subscriber.name)) |
| 1083 | return self.test_status |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1084 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1085 | def igmp_flow_check(self, subscriber, multiple_sub = False): |
| 1086 | chan = 0 |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1087 | for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels): |
| 1088 | if subscriber.num_channels == 1: |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1089 | if i != 0: |
| 1090 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1091 | chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list) |
| 1092 | else: |
| 1093 | chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list) |
| 1094 | self.num_joins += 1 |
| 1095 | while self.num_joins < self.num_subscribers: |
| 1096 | time.sleep(5) |
| 1097 | log_test.info('All subscribers have joined the channel') |
| 1098 | # for i in range(1): |
| 1099 | time.sleep(0.5) |
| 1100 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list) |
| 1101 | #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1102 | #subscriber.channel_leave(chan, src_list = subscriber.src_list) |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1103 | time.sleep(5) |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1104 | # log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats)) |
| 1105 | if subscriber.num_channels == 1: |
| 1106 | pass |
| 1107 | elif chan != 0: |
| 1108 | #Should not receive packets for this channel |
| 1109 | self.recv_timeout = True |
| 1110 | subscriber.recv_timeout = True |
| 1111 | subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list) |
| 1112 | subscriber.recv_timeout = False |
| 1113 | self.recv_timeout = False |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1114 | log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port)) |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1115 | # subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list) |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1116 | # chan = subscriber.num_channels - i |
| 1117 | # self.test_status = True |
| 1118 | return self.test_status |
| 1119 | |
| 1120 | def igmp_join_next_channel_flow_check(self, subscriber, multiple_sub = False): |
| 1121 | chan = 0 |
| 1122 | for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels): |
| 1123 | # if subscriber.num_channels == 1: |
| 1124 | # chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list) |
| 1125 | # else: |
| 1126 | chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list) |
| 1127 | self.num_joins += 1 |
| 1128 | while self.num_joins < self.num_subscribers: |
| 1129 | time.sleep(5) |
| 1130 | log_test.info('All subscribers have joined the channel') |
| 1131 | # for i in range(1): |
| 1132 | time.sleep(0.5) |
| 1133 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list) |
| 1134 | #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1135 | #subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1136 | time.sleep(5) |
| 1137 | # log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats)) |
| 1138 | # if subscriber.num_channels == 1: |
| 1139 | # pass |
| 1140 | # elif chan != 0: |
| 1141 | # pass |
| 1142 | #Should not receive packets for this channel |
| 1143 | # log_test.info |
| 1144 | # self.recv_timeout = True |
| 1145 | # subscriber.recv_timeout = True |
| 1146 | # subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list) |
| 1147 | # subscriber.recv_timeout = False |
| 1148 | # self.recv_timeout = False |
| 1149 | # log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port)) |
| 1150 | # subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list) |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1151 | chan = subscriber.num_channels - i |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1152 | # self.test_status = True |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 1153 | return self.test_status |
| 1154 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1155 | |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1156 | def igmp_leave_flow_check(self, subscriber, multiple_sub = False): |
| 1157 | chan = 0 |
| 1158 | for i in range(self.VOLTHA_IGMP_ITERATIONS): |
| 1159 | subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list) |
| 1160 | self.num_joins += 1 |
| 1161 | while self.num_joins < self.num_subscribers: |
| 1162 | time.sleep(5) |
| 1163 | log_test.info('All subscribers have joined the channel') |
| 1164 | # for i in range(1): |
| 1165 | time.sleep(0.5) |
| 1166 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list) |
| 1167 | log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1168 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1169 | time.sleep(10) |
| 1170 | # log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats)) |
| 1171 | #Should not receive packets for this subscriber |
| 1172 | self.recv_timeout = True |
| 1173 | subscriber.recv_timeout = True |
| 1174 | subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list) |
| 1175 | subscriber.recv_timeout = False |
| 1176 | self.recv_timeout = False |
| 1177 | # log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port)) |
| 1178 | # subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list) |
| 1179 | # self.test_status = True |
| 1180 | return self.test_status |
| 1181 | |
| 1182 | |
| 1183 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1184 | def igmp_flow_check_join_change_to_exclude(self, subscriber, multiple_sub = False): |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1185 | chan = 2 |
| 1186 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1187 | self.num_joins += 1 |
| 1188 | while self.num_joins < self.num_subscribers: |
| 1189 | time.sleep(5) |
| 1190 | log_test.info('All subscribers have joined the channel') |
| 1191 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list) |
| 1192 | time.sleep(5) |
| 1193 | chan = 1 |
| 1194 | log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1195 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE) |
| 1196 | time.sleep(5) |
| 1197 | self.recv_timeout = True |
| 1198 | subscriber.recv_timeout = True |
| 1199 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[1]) |
| 1200 | if self.test_status is True: |
| 1201 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list[0]) |
| 1202 | if self.test_status is True: |
| 1203 | log_test.info('Subscriber should not receive data from channel %s on specific source %s, test is failed' %(chan, subscriber.rx_port)) |
| 1204 | self.test_status = False |
| 1205 | subscriber.recv_timeout = False |
| 1206 | self.recv_timeout = False |
| 1207 | chan = 0 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1208 | #for i in range(self.VOLTHA_IGMP_ITERATIONS): |
| 1209 | for i in range(3): |
| 1210 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1211 | self.num_joins += 1 |
| 1212 | while self.num_joins < self.num_subscribers: |
| 1213 | time.sleep(5) |
| 1214 | log_test.info('All subscribers have joined the channel') |
| 1215 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1]) |
| 1216 | time.sleep(5) |
| 1217 | log_test.info('Leaving channel %d for subscriber on port %s from specific source address %s and waited till GMI timer expires' %(chan, subscriber.rx_port, subscriber.src_list[0])) |
| 1218 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE) |
| 1219 | #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0] |
| 1220 | time.sleep(60) |
| 1221 | self.recv_timeout = False |
| 1222 | subscriber.recv_timeout = False |
| 1223 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1]) |
| 1224 | if self.test_status is True: |
| 1225 | self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0]) |
| 1226 | if self.test_status is False: |
| 1227 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1228 | continue |
| 1229 | subscriber.recv_timeout = False |
| 1230 | self.recv_timeout = False |
| 1231 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1232 | # self.test_status = True |
| 1233 | return self.test_status |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1234 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1235 | def igmp_flow_check_join_change_to_exclude_again_include_back(self, subscriber, multiple_sub = False): |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1236 | chan = 0 |
| 1237 | #for i in range(self.VOLTHA_IGMP_ITERATIONS): |
| 1238 | for i in range(3): |
| 1239 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1240 | self.num_joins += 1 |
| 1241 | while self.num_joins < self.num_subscribers: |
| 1242 | time.sleep(5) |
| 1243 | log_test.info('All subscribers have joined the channel') |
| 1244 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1]) |
| 1245 | time.sleep(5) |
| 1246 | log_test.info('Leaving channel %d for subscriber on port %s from specific source address %s and waited till GMI timer expires' %(chan, subscriber.rx_port, subscriber.src_list[0])) |
| 1247 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE) |
| 1248 | #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0] |
| 1249 | time.sleep(60) |
| 1250 | self.recv_timeout = False |
| 1251 | subscriber.recv_timeout = False |
| 1252 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1]) |
| 1253 | if self.test_status is True: |
| 1254 | self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0]) |
| 1255 | if self.test_status is False: |
| 1256 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1257 | continue |
| 1258 | subscriber.recv_timeout = False |
| 1259 | self.recv_timeout = False |
| 1260 | log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0])) |
| 1261 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_INCLUDE) |
| 1262 | time.sleep(5) |
| 1263 | # self.recv_timeout = True |
| 1264 | # subscriber.recv_timeout = True |
| 1265 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0]) |
| 1266 | subscriber.recv_timeout = False |
| 1267 | self.recv_timeout = False |
| 1268 | |
| 1269 | |
| 1270 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1271 | # self.test_status = True |
| 1272 | return self.test_status |
| 1273 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1274 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1275 | def igmp_flow_check_join_change_to_block(self, subscriber, multiple_sub = False): |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1276 | chan = 0 |
| 1277 | #for i in range(self.VOLTHA_IGMP_ITERATIONS): |
| 1278 | for i in range(3): |
| 1279 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1280 | self.num_joins += 1 |
| 1281 | while self.num_joins < self.num_subscribers: |
| 1282 | time.sleep(5) |
| 1283 | log_test.info('All subscribers have joined the channel') |
| 1284 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1]) |
| 1285 | time.sleep(5) |
| 1286 | log_test.info('Leaving channel %d for subscriber on port %s from specific source address %s and waited till GMI timer expires' %(chan, subscriber.rx_port, subscriber.src_list[0])) |
| 1287 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_BLOCK_OLD) |
| 1288 | #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0] |
| 1289 | time.sleep(60) |
| 1290 | self.recv_timeout = False |
| 1291 | subscriber.recv_timeout = False |
| 1292 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1]) |
| 1293 | if self.test_status is True: |
| 1294 | self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0]) |
| 1295 | if self.test_status is False: |
| 1296 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1297 | continue |
| 1298 | subscriber.recv_timeout = False |
| 1299 | self.recv_timeout = False |
| 1300 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1301 | # self.test_status = True |
| 1302 | return self.test_status |
| 1303 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1304 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1305 | def igmp_flow_check_join_change_to_block_again_allow_back(self, subscriber, multiple_sub = False): |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1306 | chan = 0 |
| 1307 | #for i in range(self.VOLTHA_IGMP_ITERATIONS): |
| 1308 | for i in range(3): |
| 1309 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1310 | self.num_joins += 1 |
| 1311 | while self.num_joins < self.num_subscribers: |
| 1312 | time.sleep(5) |
| 1313 | log_test.info('All subscribers have joined the channel') |
| 1314 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1]) |
| 1315 | time.sleep(5) |
| 1316 | log_test.info('Leaving channel %d for subscriber on port %s from specific source address %s and waited till GMI timer expires' %(chan, subscriber.rx_port, subscriber.src_list[0])) |
| 1317 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE) |
| 1318 | #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0] |
| 1319 | time.sleep(60) |
| 1320 | self.recv_timeout = False |
| 1321 | subscriber.recv_timeout = False |
| 1322 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1]) |
| 1323 | if self.test_status is True: |
| 1324 | self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0]) |
| 1325 | if self.test_status is False: |
| 1326 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1327 | continue |
| 1328 | subscriber.recv_timeout = False |
| 1329 | self.recv_timeout = False |
| 1330 | log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0])) |
| 1331 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_ALLOW_NEW) |
| 1332 | time.sleep(5) |
| 1333 | # self.recv_timeout = True |
| 1334 | # subscriber.recv_timeout = True |
| 1335 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0]) |
| 1336 | subscriber.recv_timeout = False |
| 1337 | self.recv_timeout = False |
| 1338 | |
| 1339 | |
| 1340 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1341 | # self.test_status = True |
| 1342 | return self.test_status |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1343 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1344 | def igmp_flow_check_group_include_source_empty_list(self, subscriber, multiple_sub = False): |
| 1345 | chan = 0 |
| 1346 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1347 | self.num_joins += 1 |
| 1348 | while self.num_joins < self.num_subscribers: |
| 1349 | time.sleep(5) |
| 1350 | log_test.info('All subscribers have joined the channel') |
| 1351 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10) |
| 1352 | if self.test_status is True: |
| 1353 | log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port)) |
| 1354 | self.test_status = False |
| 1355 | else: |
| 1356 | log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port)) |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1357 | self.test_status = True |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1358 | log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1359 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1360 | time.sleep(5) |
| 1361 | subscriber.recv_timeout = False |
| 1362 | self.recv_timeout = False |
| 1363 | return self.test_status |
| 1364 | |
| 1365 | def igmp_flow_check_group_exclude_source_empty_list(self, subscriber, multiple_sub = False): |
| 1366 | chan = 0 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1367 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1368 | self.num_joins += 1 |
| 1369 | while self.num_joins < self.num_subscribers: |
| 1370 | time.sleep(5) |
| 1371 | log_test.info('All subscribers have joined the channel') |
| 1372 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10) |
| 1373 | if self.test_status is True: |
| 1374 | log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port)) |
| 1375 | self.test_status = False |
| 1376 | else: |
| 1377 | log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port)) |
| 1378 | self.test_status = True |
| 1379 | |
| 1380 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE) |
| 1381 | log_test.info('Send join to multicast group with exclude empty source list and waited till GMI timer expires') |
| 1382 | time.sleep(60) |
| 1383 | |
| 1384 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10) |
| 1385 | log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1386 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1387 | time.sleep(5) |
| 1388 | subscriber.recv_timeout = False |
| 1389 | self.recv_timeout = False |
| 1390 | return self.test_status |
| 1391 | |
| 1392 | def igmp_flow_check_group_exclude_source_empty_list_1(self, subscriber, multiple_sub = False): |
| 1393 | chan = 0 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1394 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list,record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE) |
| 1395 | self.num_joins += 1 |
| 1396 | while self.num_joins < self.num_subscribers: |
| 1397 | time.sleep(5) |
| 1398 | log_test.info('All subscribers have joined the channel') |
| 1399 | for i in range(10): |
| 1400 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list) |
| 1401 | log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1402 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1403 | time.sleep(5) |
| 1404 | log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats)) |
| 1405 | #Should not receive packets for this subscriber |
| 1406 | self.recv_timeout = True |
| 1407 | subscriber.recv_timeout = True |
| 1408 | subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list) |
| 1409 | subscriber.recv_timeout = False |
| 1410 | self.recv_timeout = False |
| 1411 | log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port)) |
| 1412 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1413 | # self.test_status = True |
| 1414 | return self.test_status |
| 1415 | |
| 1416 | def igmp_flow_check_during_olt_onu_operational_issues(self, subscriber, multiple_sub = False): |
| 1417 | chan = 0 |
| 1418 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1419 | self.num_joins += 1 |
| 1420 | while self.num_joins < self.num_subscribers: |
| 1421 | time.sleep(5) |
| 1422 | log_test.info('All subscribers have joined the channel') |
| 1423 | for i in range(2): |
| 1424 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list) |
| 1425 | log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1426 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1427 | time.sleep(5) |
| 1428 | log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats)) |
| 1429 | #Should not receive packets for this subscriber |
| 1430 | self.recv_timeout = True |
| 1431 | subscriber.recv_timeout = True |
| 1432 | subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list) |
| 1433 | subscriber.recv_timeout = False |
| 1434 | self.recv_timeout = False |
| 1435 | log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port)) |
| 1436 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1437 | # self.test_status = True |
| 1438 | return self.test_status |
| 1439 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1440 | def voltha_igmp_jump_verify(self, subscriber): |
| 1441 | if subscriber.has_service('IGMP'): |
| 1442 | for i in xrange(subscriber.num): |
| 1443 | log_test.info('Subscriber %s jumping channel' %subscriber.name) |
| 1444 | chan = subscriber.channel_jump(delay=0) |
| 1445 | subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1) |
| 1446 | log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name)) |
| 1447 | time.sleep(3) |
| 1448 | log_test.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats)) |
| 1449 | self.test_status = True |
| 1450 | return self.test_status |
| 1451 | |
| 1452 | def voltha_igmp_next_verify(self, subscriber): |
| 1453 | for c in xrange(self.VOLTHA_IGMP_ITERATIONS): |
| 1454 | for i in xrange(subscriber.num): |
| 1455 | if i: |
| 1456 | chan = subscriber.channel_join_next(delay=0, leave_flag = self.leave_flag) |
| 1457 | time.sleep(0.2) |
| 1458 | else: |
| 1459 | chan = subscriber.channel_join(i, delay=0) |
| 1460 | time.sleep(0.2) |
| 1461 | if subscriber.num == 1: |
| 1462 | subscriber.channel_leave(chan) |
| 1463 | log_test.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name)) |
| 1464 | #subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1) |
| 1465 | #log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name)) |
| 1466 | self.test_status = True |
| 1467 | return self.test_status |
| 1468 | |
| 1469 | def voltha_subscribers(self, services, cbs = None, num_subscribers = 1, num_channels = 1, src_list = None): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1470 | """Test subscriber join next for channel surfing""" |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1471 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1472 | rest_port = self.VOLTHA_REST_PORT, |
| 1473 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1474 | if self.VOLTHA_OLT_TYPE.startswith('ponsim'): |
| 1475 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1476 | log_test.info('Enabling ponsim olt') |
| 1477 | device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = ponsim_address) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1478 | if device_id != '': |
| 1479 | self.olt_device_id = device_id |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1480 | else: |
| 1481 | log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution') |
| 1482 | assert_equal(False, True) |
| 1483 | |
| 1484 | assert_not_equal(device_id, None) |
| 1485 | if status == False: |
| 1486 | voltha.disable_device(device_id, delete = True) |
| 1487 | assert_equal(status, True) |
| 1488 | time.sleep(10) |
| 1489 | switch_map = None |
| 1490 | olt_configured = False |
| 1491 | try: |
| 1492 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1493 | if not switch_map: |
| 1494 | log_test.info('No voltha devices found') |
| 1495 | return |
| 1496 | log_test.info('Installing OLT app') |
| 1497 | OnosCtrl.install_app(self.olt_app_file) |
| 1498 | time.sleep(5) |
| 1499 | log_test.info('Adding subscribers through OLT app') |
| 1500 | self.config_olt(switch_map) |
| 1501 | olt_configured = True |
| 1502 | time.sleep(5) |
| 1503 | self.num_subscribers = num_subscribers |
| 1504 | self.num_channels = num_channels |
| 1505 | test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers, |
| 1506 | num_channels = self.num_channels, |
| 1507 | cbs = cbs, |
| 1508 | port_list = self.generate_port_list(self.num_subscribers, |
| 1509 | self.num_channels), |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1510 | src_list = src_list, services = services) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1511 | if test_status is False: |
| 1512 | self.success = False |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1513 | assert_equal(test_status, True) |
| 1514 | finally: |
| 1515 | if switch_map is not None: |
| 1516 | if olt_configured is True: |
| 1517 | self.remove_olt(switch_map) |
| 1518 | voltha.disable_device(device_id, delete = True) |
| 1519 | time.sleep(10) |
| 1520 | log_test.info('Uninstalling OLT app') |
| 1521 | OnosCtrl.uninstall_app(self.olt_app_name) |
| 1522 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1523 | def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1, |
| 1524 | channel_start = 0, cbs = None, port_list = [], src_list = None, |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1525 | services = None, negative_subscriber_auth = None): |
| 1526 | self.test_status = False |
| 1527 | self.ovs_cleanup() |
| 1528 | subscribers_count = num_subscribers |
| 1529 | sub_loop_count = num_subscribers |
| 1530 | if not port_list: |
| 1531 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 1532 | subscriber_tx_rx_ports = [] |
| 1533 | for i in range(num_subscribers): |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1534 | subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map[port_list[i][0]], |
| 1535 | rx_port = self.port_map[port_list[i][1]], |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1536 | num_channels = num_channels,src_list = src_list,)) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1537 | self.onos_aaa_load() |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1538 | #load the ssm list for all subscriber channels |
| 1539 | igmpChannel = IgmpChannel(src_list = src_list) |
| 1540 | ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports) |
| 1541 | ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 1542 | if src_list is None: |
| 1543 | igmpChannel = IgmpChannel() |
| 1544 | igmpChannel.igmp_load_ssm_config(ssm_list) |
| 1545 | else: |
| 1546 | igmpChannel = IgmpChannel(src_list = src_list) |
| 1547 | igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list) |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1548 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1549 | self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1) |
| 1550 | |
| 1551 | chan_leave = False #for single channel, multiple subscribers |
| 1552 | if cbs is None: |
| 1553 | cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check) |
| 1554 | chan_leave = True |
| 1555 | for subscriber in subscriber_tx_rx_ports: |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1556 | if 'IGMP' in services: |
| 1557 | # if src_list: |
| 1558 | # for i in range(len(src_list)): |
| 1559 | # subscriber.start(src_ip = src_list[i]) |
| 1560 | # else: |
| 1561 | # subscriber.start() |
| 1562 | subscriber.start() |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1563 | sub_loop_count = sub_loop_count - 1 |
| 1564 | pool_object = voltha_subscriber_pool(subscriber, cbs) |
| 1565 | self.thread_pool.addTask(pool_object.pool_cb) |
| 1566 | self.thread_pool.cleanUpThreads() |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1567 | for subscriber in subscriber_tx_rx_ports: |
| 1568 | if services and 'IGMP' in services: |
| 1569 | # if src_list: |
| 1570 | # for i in range(len(src_list)): |
| 1571 | # subscriber.stop(src_ip = src_list[i]) |
| 1572 | # else: |
| 1573 | # subscriber.stop() |
| 1574 | subscriber.stop() |
| 1575 | if chan_leave is True: |
| 1576 | subscriber.channel_leave(0) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1577 | subscribers_count = 0 |
| 1578 | return self.test_status |
| 1579 | |
| 1580 | |
| 1581 | def generate_port_list(self, subscribers, channels): |
| 1582 | return self.port_list[:subscribers] |
| 1583 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1584 | @classmethod |
| 1585 | def ovs_cleanup(cls): |
| 1586 | ##For every test case, delete all the OVS groups |
| 1587 | cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1' |
| 1588 | try: |
| 1589 | cord_test_shell(cmd) |
| 1590 | ##Since olt config is used for this test, we just fire a careless local cmd as well |
| 1591 | os.system(cmd) |
| 1592 | finally: |
| 1593 | return |
| 1594 | |
A.R Karthick | 8a507cf | 2017-06-02 18:44:49 -0700 | [diff] [blame] | 1595 | def test_olt_enable_disable(self): |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 1596 | log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC)) |
A.R Karthick | 8a507cf | 2017-06-02 18:44:49 -0700 | [diff] [blame] | 1597 | device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC) |
| 1598 | assert_not_equal(device_id, None) |
| 1599 | try: |
| 1600 | assert_equal(status, True) |
| 1601 | time.sleep(10) |
| 1602 | finally: |
| 1603 | self.voltha.disable_device(device_id, delete = True) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1604 | |
A.R Karthick | 8a507cf | 2017-06-02 18:44:49 -0700 | [diff] [blame] | 1605 | def test_ponsim_enable_disable(self): |
A.R Karthick | 8b9c5f1 | 2017-05-30 17:47:08 -0700 | [diff] [blame] | 1606 | log_test.info('Enabling ponsim_olt') |
| 1607 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
A.R Karthick | 8a507cf | 2017-06-02 18:44:49 -0700 | [diff] [blame] | 1608 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1609 | assert_not_equal(device_id, None) |
| 1610 | try: |
| 1611 | assert_equal(status, True) |
| 1612 | time.sleep(10) |
| 1613 | finally: |
| 1614 | self.voltha.disable_device(device_id, delete = True) |
A.R Karthick | 8b9c5f1 | 2017-05-30 17:47:08 -0700 | [diff] [blame] | 1615 | |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1616 | def test_subscriber_with_voltha_for_eap_tls_authentication(self): |
| 1617 | """ |
| 1618 | Test Method: |
| 1619 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1620 | 1. OLT and ONU is detected and validated. |
| 1621 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1622 | 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1623 | 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius. |
| 1624 | 5. Verify that subscriber is authenticated successfully. |
| 1625 | """ |
A R Karthick | caa1b6a | 2017-07-27 14:07:05 -0700 | [diff] [blame] | 1626 | ret = voltha_setup( |
| 1627 | host = self.VOLTHA_HOST, |
| 1628 | rest_port = self.VOLTHA_REST_PORT, |
| 1629 | olt_type = 'ponsim_olt', |
| 1630 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP, |
| 1631 | uplink_vlan_start = self.VOLTHA_UPLINK_VLAN_START, |
| 1632 | config_fake = self.VOLTHA_CONFIG_FAKE, |
| 1633 | olt_app = self.olt_app_file) |
| 1634 | assert_not_equal(ret, None) |
| 1635 | voltha, device_id, switch_map = ret[0], ret[1], ret[2] |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1636 | try: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 1637 | log_test.info('Adding subscribers through OLT app') |
| 1638 | self.config_olt(switch_map) |
| 1639 | olt_configured = True |
| 1640 | time.sleep(5) |
| 1641 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1642 | assert_equal(auth_status, True) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1643 | finally: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 1644 | if switch_map is not None: |
| 1645 | if olt_configured is True: |
| 1646 | self.remove_olt(switch_map) |
A R Karthick | caa1b6a | 2017-07-27 14:07:05 -0700 | [diff] [blame] | 1647 | voltha_teardown(voltha, device_id, switch_map, olt_app = self.olt_app_file) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1648 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1649 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1650 | def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self): |
| 1651 | """ |
| 1652 | Test Method: |
| 1653 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1654 | 1. OLT and ONU is detected and validated. |
| 1655 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1656 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1657 | 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius. |
| 1658 | 5. Verify that subscriber authentication is unsuccessful.. |
| 1659 | """ |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1660 | df = defer.Deferred() |
| 1661 | def tls_flow_check_with_no_cert_scenario(df): |
| 1662 | log_test.info('Enabling ponsim_olt') |
| 1663 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1664 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1665 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1666 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1667 | time.sleep(10) |
| 1668 | switch_map = None |
| 1669 | olt_configured = False |
| 1670 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1671 | log_test.info('Installing OLT app') |
| 1672 | OnosCtrl.install_app(self.olt_app_file) |
| 1673 | time.sleep(5) |
| 1674 | log_test.info('Adding subscribers through OLT app') |
| 1675 | self.config_olt(switch_map) |
| 1676 | olt_configured = True |
| 1677 | time.sleep(5) |
| 1678 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert") |
| 1679 | try: |
| 1680 | assert_equal(auth_status, True) |
| 1681 | assert_equal(status, True) |
| 1682 | time.sleep(10) |
| 1683 | finally: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 1684 | self.remove_olt(switch_map) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1685 | self.voltha.disable_device(device_id, delete = True) |
| 1686 | df.callback(0) |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 1687 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1688 | reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df) |
| 1689 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1690 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1691 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1692 | def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self): |
| 1693 | """ |
| 1694 | Test Method: |
| 1695 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1696 | 1. OLT and ONU is detected and validated. |
| 1697 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1698 | 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber.. |
| 1699 | 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius. |
| 1700 | 5. Verify that subscriber authentication is unsuccessful.. |
| 1701 | """ |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1702 | df = defer.Deferred() |
| 1703 | def tls_flow_check_with_invalid_cert_scenario(df): |
| 1704 | log_test.info('Enabling ponsim_olt') |
| 1705 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1706 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1707 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1708 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1709 | time.sleep(10) |
| 1710 | switch_map = None |
| 1711 | olt_configured = False |
| 1712 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1713 | log_test.info('Installing OLT app') |
| 1714 | OnosCtrl.install_app(self.olt_app_file) |
| 1715 | time.sleep(5) |
| 1716 | log_test.info('Adding subscribers through OLT app') |
| 1717 | self.config_olt(switch_map) |
| 1718 | olt_configured = True |
| 1719 | time.sleep(5) |
| 1720 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert") |
| 1721 | try: |
| 1722 | assert_equal(auth_status, True) |
| 1723 | assert_equal(status, True) |
| 1724 | time.sleep(10) |
| 1725 | finally: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 1726 | self.remove_olt(switch_map) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1727 | self.voltha.disable_device(device_id, delete = True) |
| 1728 | df.callback(0) |
| 1729 | reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df) |
| 1730 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1731 | |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1732 | @deferred(TESTCASE_TIMEOUT) |
| 1733 | def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self): |
| 1734 | """ |
| 1735 | Test Method: |
| 1736 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1737 | 1. OLT and ONU is detected and validated. |
| 1738 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1739 | 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times. |
| 1740 | 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius. |
| 1741 | 5. Verify that subscriber authentication is unsuccessful.. |
| 1742 | """ |
| 1743 | df = defer.Deferred() |
| 1744 | def tls_flow_check_with_no_cert_scenario(df): |
| 1745 | log_test.info('Enabling ponsim_olt') |
| 1746 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1747 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1748 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1749 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1750 | time.sleep(10) |
| 1751 | switch_map = None |
| 1752 | olt_configured = False |
| 1753 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1754 | log_test.info('Installing OLT app') |
| 1755 | OnosCtrl.install_app(self.olt_app_file) |
| 1756 | time.sleep(5) |
| 1757 | log_test.info('Adding subscribers through OLT app') |
| 1758 | self.config_olt(switch_map) |
| 1759 | olt_configured = True |
| 1760 | time.sleep(5) |
| 1761 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert") |
| 1762 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert") |
| 1763 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert") |
| 1764 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert") |
| 1765 | try: |
| 1766 | assert_equal(auth_status, True) |
| 1767 | assert_equal(status, True) |
| 1768 | time.sleep(10) |
| 1769 | finally: |
| 1770 | self.voltha.disable_device(device_id, delete = True) |
| 1771 | df.callback(0) |
| 1772 | reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df) |
| 1773 | return df |
| 1774 | |
| 1775 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1776 | def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self): |
| 1777 | """ |
| 1778 | Test Method: |
| 1779 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1780 | 1. OLT and ONU is detected and validated. |
| 1781 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1782 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1783 | 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius. |
| 1784 | 5. Verify that subscriber authentication is unsuccessful.. |
| 1785 | """ |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1786 | df = defer.Deferred() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1787 | def tls_flow_check_deactivating_app(df): |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1788 | aaa_app = ["org.opencord.aaa"] |
| 1789 | log_test.info('Enabling ponsim_olt') |
| 1790 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1791 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1792 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1793 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1794 | time.sleep(10) |
| 1795 | switch_map = None |
| 1796 | olt_configured = False |
| 1797 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1798 | log_test.info('Installing OLT app') |
| 1799 | OnosCtrl.install_app(self.olt_app_file) |
| 1800 | time.sleep(5) |
| 1801 | log_test.info('Adding subscribers through OLT app') |
| 1802 | self.config_olt(switch_map) |
| 1803 | olt_configured = True |
| 1804 | time.sleep(5) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1805 | |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1806 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",)) |
| 1807 | thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,)) |
| 1808 | thread1.start() |
| 1809 | time.sleep(randint(1,2)) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1810 | log_test.info('Restart aaa app in onos during tls auth flow check on voltha') |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1811 | thread2.start() |
| 1812 | time.sleep(10) |
| 1813 | thread1.join() |
| 1814 | thread2.join() |
| 1815 | try: |
| 1816 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1817 | assert_equal(self.success, True) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1818 | time.sleep(10) |
| 1819 | finally: |
| 1820 | self.voltha.disable_device(device_id, delete = True) |
| 1821 | df.callback(0) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1822 | reactor.callLater(0, tls_flow_check_deactivating_app, df) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1823 | return df |
| 1824 | |
| 1825 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1826 | def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self): |
| 1827 | """ |
| 1828 | Test Method: |
| 1829 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1830 | 1. OLT and ONU is detected and validated. |
| 1831 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1832 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1833 | 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius. |
| 1834 | 5. Verify that subscriber authentication is unsuccessful.. |
| 1835 | """ |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1836 | df = defer.Deferred() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1837 | def tls_flow_check_restarting_radius(df): |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1838 | aaa_app = ["org.opencord.aaa"] |
| 1839 | log_test.info('Enabling ponsim_olt') |
| 1840 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1841 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1842 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1843 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1844 | time.sleep(10) |
| 1845 | switch_map = None |
| 1846 | olt_configured = False |
| 1847 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1848 | log_test.info('Installing OLT app') |
| 1849 | OnosCtrl.install_app(self.olt_app_file) |
| 1850 | time.sleep(5) |
| 1851 | log_test.info('Adding subscribers through OLT app') |
| 1852 | self.config_olt(switch_map) |
| 1853 | olt_configured = True |
| 1854 | time.sleep(5) |
| 1855 | |
| 1856 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius")) |
| 1857 | thread2 = threading.Thread(target = cord_test_radius_restart) |
| 1858 | thread1.start() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1859 | time.sleep(randint(1,2)) |
| 1860 | log_test.info('Restart radius server during tls auth flow check on voltha') |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1861 | thread2.start() |
| 1862 | time.sleep(10) |
| 1863 | thread1.join() |
| 1864 | thread2.join() |
| 1865 | try: |
| 1866 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1867 | assert_equal(self.success, True) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1868 | time.sleep(10) |
| 1869 | finally: |
| 1870 | self.voltha.disable_device(device_id, delete = True) |
| 1871 | df.callback(0) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1872 | reactor.callLater(0, tls_flow_check_restarting_radius, df) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1873 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1874 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1875 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1876 | def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self): |
| 1877 | """ |
| 1878 | Test Method: |
| 1879 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1880 | 1. OLT and ONU is detected and validated. |
| 1881 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1882 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1883 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 1884 | 6. Verify that subscriber authenticated successfully. |
| 1885 | 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber. |
| 1886 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 1887 | 9. Verify that subscriber authentication is unsuccessful.. |
| 1888 | """ |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1889 | df = defer.Deferred() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1890 | def tls_flow_check_operating_olt_state(df): |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1891 | aaa_app = ["org.opencord.aaa"] |
| 1892 | log_test.info('Enabling ponsim_olt') |
| 1893 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1894 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1895 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1896 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1897 | time.sleep(10) |
| 1898 | switch_map = None |
| 1899 | olt_configured = False |
| 1900 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1901 | log_test.info('Installing OLT app') |
| 1902 | OnosCtrl.install_app(self.olt_app_file) |
| 1903 | time.sleep(5) |
| 1904 | log_test.info('Adding subscribers through OLT app') |
| 1905 | self.config_olt(switch_map) |
| 1906 | olt_configured = True |
| 1907 | time.sleep(5) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1908 | |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1909 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",)) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 1910 | thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id, False,)) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1911 | thread1.start() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1912 | time.sleep(randint(1,2)) |
| 1913 | log_test.info('Disable the ponsim olt device during tls auth flow check on voltha') |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1914 | thread2.start() |
| 1915 | time.sleep(10) |
| 1916 | thread1.join() |
| 1917 | thread2.join() |
| 1918 | try: |
| 1919 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1920 | assert_equal(self.success, True) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1921 | time.sleep(10) |
| 1922 | finally: |
| 1923 | self.voltha.disable_device(device_id, delete = True) |
| 1924 | df.callback(0) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1925 | reactor.callLater(0, tls_flow_check_operating_olt_state, df) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1926 | return df |
| 1927 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1928 | @deferred(TESTCASE_TIMEOUT) |
| 1929 | def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self): |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1930 | """ |
| 1931 | Test Method: |
| 1932 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1933 | 1. OLT and ONU is detected and validated. |
| 1934 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1935 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1936 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 1937 | 6. Verify that subscriber authenticated successfully. |
| 1938 | 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber. |
| 1939 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 1940 | 9. Verify that subscriber authentication is unsuccessful.. |
| 1941 | """ |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1942 | df = defer.Deferred() |
| 1943 | def tls_flow_check_operating_olt_state(df): |
| 1944 | aaa_app = ["org.opencord.aaa"] |
| 1945 | log_test.info('Enabling ponsim_olt') |
| 1946 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1947 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1948 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1949 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1950 | time.sleep(10) |
| 1951 | switch_map = None |
| 1952 | olt_configured = False |
| 1953 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1954 | log_test.info('Installing OLT app') |
| 1955 | OnosCtrl.install_app(self.olt_app_file) |
| 1956 | time.sleep(5) |
| 1957 | log_test.info('Adding subscribers through OLT app') |
| 1958 | self.config_olt(switch_map) |
| 1959 | olt_configured = True |
| 1960 | time.sleep(5) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1961 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1962 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",)) |
| 1963 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle) |
| 1964 | thread1.start() |
| 1965 | time.sleep(randint(1,2)) |
| 1966 | log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha') |
| 1967 | thread2.start() |
| 1968 | time.sleep(10) |
| 1969 | thread1.join() |
| 1970 | thread2.join() |
| 1971 | try: |
| 1972 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1973 | assert_equal(self.success, True) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1974 | time.sleep(10) |
| 1975 | finally: |
| 1976 | self.voltha.disable_device(device_id, delete = True) |
| 1977 | df.callback(0) |
| 1978 | reactor.callLater(0, tls_flow_check_operating_olt_state, df) |
| 1979 | return df |
| 1980 | |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 1981 | @deferred(TESTCASE_TIMEOUT +600) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 1982 | def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self): |
| 1983 | """ |
| 1984 | Test Method: |
| 1985 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1986 | 1. OLT and ONU is detected and validated. |
| 1987 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1988 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1989 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 1990 | 6. Verify that subscriber authenticated successfully. |
| 1991 | 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber. |
| 1992 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 1993 | 9. Verify that subscriber authentication is unsuccessful.. |
| 1994 | 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow |
| 1995 | |
| 1996 | """ |
| 1997 | df = defer.Deferred() |
| 1998 | no_iterations = 10 |
| 1999 | def tls_flow_check_with_disable_olt_device_scenario(df): |
| 2000 | aaa_app = ["org.opencord.aaa"] |
| 2001 | log_test.info('Enabling ponsim_olt') |
| 2002 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2003 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2004 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2005 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2006 | time.sleep(10) |
| 2007 | switch_map = None |
| 2008 | olt_configured = False |
| 2009 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2010 | log_test.info('Installing OLT app') |
| 2011 | OnosCtrl.install_app(self.olt_app_file) |
| 2012 | time.sleep(5) |
| 2013 | log_test.info('Adding subscribers through OLT app') |
| 2014 | self.config_olt(switch_map) |
| 2015 | olt_configured = True |
| 2016 | time.sleep(5) |
| 2017 | for i in range(no_iterations): |
| 2018 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",)) |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 2019 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2020 | thread1.start() |
| 2021 | time.sleep(randint(1,2)) |
| 2022 | log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha') |
| 2023 | thread2.start() |
| 2024 | time.sleep(10) |
| 2025 | thread1.join() |
| 2026 | thread2.join() |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 2027 | time.sleep(60) |
| 2028 | cord_test_radius_restart() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2029 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT) |
| 2030 | try: |
| 2031 | # assert_equal(status, True) |
| 2032 | assert_equal(auth_status, True) |
| 2033 | assert_equal(self.success, True) |
| 2034 | time.sleep(10) |
| 2035 | finally: |
| 2036 | self.voltha.disable_device(device_id, delete = True) |
| 2037 | df.callback(0) |
| 2038 | reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df) |
| 2039 | return df |
| 2040 | |
| 2041 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2042 | def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self): |
| 2043 | """ |
| 2044 | Test Method: |
| 2045 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2046 | 1. OLT and ONU is detected and validated. |
| 2047 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2048 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2049 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 2050 | 6. Verify that subscriber authenticated successfully. |
| 2051 | 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber. |
| 2052 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 2053 | 9. Verify that subscriber authentication is unsuccessful.. |
| 2054 | """ |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2055 | df = defer.Deferred() |
| 2056 | def tls_flow_check_operating_olt_state(df): |
| 2057 | aaa_app = ["org.opencord.aaa"] |
| 2058 | log_test.info('Enabling ponsim_olt') |
| 2059 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2060 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2061 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2062 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2063 | time.sleep(10) |
| 2064 | switch_map = None |
| 2065 | olt_configured = False |
| 2066 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2067 | log_test.info('Installing OLT app') |
| 2068 | OnosCtrl.install_app(self.olt_app_file) |
| 2069 | time.sleep(5) |
| 2070 | log_test.info('Adding subscribers through OLT app') |
| 2071 | self.config_olt(switch_map) |
| 2072 | olt_configured = True |
| 2073 | time.sleep(5) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2074 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2075 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",)) |
| 2076 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,)) |
| 2077 | thread1.start() |
| 2078 | time.sleep(randint(1,2)) |
| 2079 | log_test.info('Restart the ponsim olt device during tls auth flow check on voltha') |
| 2080 | thread2.start() |
| 2081 | time.sleep(10) |
| 2082 | thread1.join() |
| 2083 | thread2.join() |
| 2084 | try: |
| 2085 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2086 | assert_equal(self.success, True) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2087 | time.sleep(10) |
| 2088 | finally: |
| 2089 | self.voltha.disable_device(device_id, delete = True) |
| 2090 | df.callback(0) |
| 2091 | reactor.callLater(0, tls_flow_check_operating_olt_state, df) |
| 2092 | return df |
| 2093 | |
| 2094 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2095 | def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_olt(self): |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2096 | """ |
| 2097 | Test Method: |
| 2098 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2099 | 1. OLT and ONU is detected and validated. |
| 2100 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2101 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2102 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 2103 | 6. Verify that subscriber authenticated successfully. |
| 2104 | 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber. |
| 2105 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 2106 | 9. Verify that subscriber authentication is unsuccessful.. |
| 2107 | 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow |
| 2108 | """ |
| 2109 | df = defer.Deferred() |
| 2110 | no_iterations = 10 |
| 2111 | def tls_flow_check_with_disable_olt_device_scenario(df): |
| 2112 | aaa_app = ["org.opencord.aaa"] |
| 2113 | log_test.info('Enabling ponsim_olt') |
| 2114 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2115 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2116 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2117 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2118 | time.sleep(10) |
| 2119 | switch_map = None |
| 2120 | olt_configured = False |
| 2121 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2122 | log_test.info('Installing OLT app') |
| 2123 | OnosCtrl.install_app(self.olt_app_file) |
| 2124 | time.sleep(5) |
| 2125 | log_test.info('Adding subscribers through OLT app') |
| 2126 | self.config_olt(switch_map) |
| 2127 | olt_configured = True |
| 2128 | time.sleep(5) |
| 2129 | for i in range(no_iterations): |
| 2130 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",)) |
| 2131 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,)) |
| 2132 | thread1.start() |
| 2133 | time.sleep(randint(1,2)) |
| 2134 | log_test.info('Restart the ponsim olt device during tls auth flow check on voltha') |
| 2135 | thread2.start() |
| 2136 | time.sleep(10) |
| 2137 | thread1.join() |
| 2138 | thread2.join() |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 2139 | time.sleep(60) |
| 2140 | cord_test_radius_restart() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2141 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT) |
| 2142 | try: |
| 2143 | # assert_equal(status, True) |
| 2144 | assert_equal(auth_status, True) |
| 2145 | assert_equal(self.success, True) |
| 2146 | time.sleep(10) |
| 2147 | finally: |
| 2148 | self.voltha.disable_device(device_id, delete = True) |
| 2149 | df.callback(0) |
| 2150 | reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df) |
| 2151 | return df |
| 2152 | |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2153 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2154 | def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self): |
| 2155 | """ |
| 2156 | Test Method: |
| 2157 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2158 | 1. OLT and ONU is detected and validated. |
| 2159 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2160 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2161 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 2162 | 6. Verify that subscriber authenticated successfully. |
| 2163 | 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber. |
| 2164 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 2165 | 9. Verify that subscriber authentication is unsuccessful.. |
| 2166 | """ |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2167 | df = defer.Deferred() |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 2168 | def tls_flow_check_operating_onu_state(df): |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2169 | aaa_app = ["org.opencord.aaa"] |
| 2170 | log_test.info('Enabling ponsim_olt') |
| 2171 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2172 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2173 | devices_list = self.voltha.get_devices() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2174 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2175 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2176 | onu_device_id = devices_list['items'][1]['id'] |
| 2177 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2178 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2179 | time.sleep(10) |
| 2180 | switch_map = None |
| 2181 | olt_configured = False |
| 2182 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2183 | log_test.info('Installing OLT app') |
| 2184 | OnosCtrl.install_app(self.olt_app_file) |
| 2185 | time.sleep(5) |
| 2186 | log_test.info('Adding subscribers through OLT app') |
| 2187 | self.config_olt(switch_map) |
| 2188 | olt_configured = True |
| 2189 | time.sleep(5) |
| 2190 | devices_list = self.voltha.get_devices() |
| 2191 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",)) |
| 2192 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,)) |
| 2193 | thread1.start() |
| 2194 | time.sleep(randint(1,2)) |
| 2195 | log_test.info('Restart the ponsim oon device during tls auth flow check on voltha') |
| 2196 | thread2.start() |
| 2197 | time.sleep(10) |
| 2198 | thread1.join() |
| 2199 | thread2.join() |
| 2200 | try: |
| 2201 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2202 | assert_equal(self.success, True) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2203 | time.sleep(10) |
| 2204 | finally: |
| 2205 | self.voltha.disable_device(device_id, delete = True) |
| 2206 | df.callback(0) |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 2207 | reactor.callLater(0, tls_flow_check_operating_onu_state, df) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2208 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2209 | |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2210 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2211 | def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self): |
| 2212 | """ |
| 2213 | Test Method: |
| 2214 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2215 | 1. OLT and ONU is detected and validated. |
| 2216 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2217 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2218 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 2219 | 6. Verify that subscriber authenticated successfully. |
| 2220 | 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber. |
| 2221 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 2222 | 9. Verify that subscriber authentication is unsuccessful.. |
| 2223 | 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow |
| 2224 | """ |
| 2225 | df = defer.Deferred() |
| 2226 | no_iterations = 10 |
| 2227 | def tls_flow_check_operating_olt_state(df): |
| 2228 | aaa_app = ["org.opencord.aaa"] |
| 2229 | log_test.info('Enabling ponsim_olt') |
| 2230 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2231 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2232 | devices_list = self.voltha.get_devices() |
| 2233 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2234 | |
| 2235 | onu_device_id = devices_list['items'][1]['id'] |
| 2236 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2237 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2238 | time.sleep(10) |
| 2239 | switch_map = None |
| 2240 | olt_configured = False |
| 2241 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2242 | log_test.info('Installing OLT app') |
| 2243 | OnosCtrl.install_app(self.olt_app_file) |
| 2244 | time.sleep(5) |
| 2245 | log_test.info('Adding subscribers through OLT app') |
| 2246 | self.config_olt(switch_map) |
| 2247 | olt_configured = True |
| 2248 | time.sleep(5) |
| 2249 | devices_list = self.voltha.get_devices() |
| 2250 | for i in range(no_iterations): |
| 2251 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",)) |
| 2252 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,)) |
| 2253 | thread1.start() |
| 2254 | time.sleep(randint(1,2)) |
| 2255 | log_test.info('Restart the ponsim oon device during tls auth flow check on voltha') |
| 2256 | thread2.start() |
| 2257 | time.sleep(10) |
| 2258 | thread1.join() |
| 2259 | thread2.join() |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 2260 | time.sleep(60) |
| 2261 | cord_test_radius_restart() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2262 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT) |
| 2263 | try: |
| 2264 | # assert_equal(status, True) |
| 2265 | assert_equal(auth_status, True) |
| 2266 | assert_equal(self.success, True) |
| 2267 | time.sleep(10) |
| 2268 | finally: |
| 2269 | self.voltha.disable_device(device_id, delete = True) |
| 2270 | df.callback(0) |
| 2271 | reactor.callLater(0, tls_flow_check_operating_olt_state, df) |
| 2272 | return df |
| 2273 | |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2274 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2275 | def test_two_subscribers_with_voltha_for_eap_tls_authentication(self): |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2276 | """ |
| 2277 | Test Method: |
| 2278 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2279 | 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen. |
| 2280 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2281 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2282 | 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius. |
| 2283 | 5. Verify that two subscribers are authenticated successfully. |
| 2284 | """ |
| 2285 | |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2286 | df = defer.Deferred() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2287 | def tls_flow_check_on_two_subscribers_same_olt_device(df): |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2288 | aaa_app = ["org.opencord.aaa"] |
| 2289 | log_test.info('Enabling ponsim_olt') |
| 2290 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2291 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2292 | devices_list = self.voltha.get_devices() |
| 2293 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2294 | |
| 2295 | onu_device_id = devices_list['items'][1]['id'] |
| 2296 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2297 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2298 | time.sleep(10) |
| 2299 | switch_map = None |
| 2300 | olt_configured = False |
| 2301 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2302 | log_test.info('Installing OLT app') |
| 2303 | OnosCtrl.install_app(self.olt_app_file) |
| 2304 | time.sleep(5) |
| 2305 | log_test.info('Adding subscribers through OLT app') |
| 2306 | self.config_olt(switch_map) |
| 2307 | olt_configured = True |
| 2308 | time.sleep(5) |
| 2309 | devices_list = self.voltha.get_devices() |
| 2310 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 2311 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,)) |
| 2312 | thread1.start() |
| 2313 | time.sleep(randint(1,2)) |
| 2314 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 2315 | thread2.start() |
| 2316 | time.sleep(10) |
| 2317 | thread1.join() |
| 2318 | thread2.join() |
| 2319 | try: |
| 2320 | # assert_equal(status, True) |
| 2321 | assert_equal(self.success, True) |
| 2322 | time.sleep(10) |
| 2323 | finally: |
| 2324 | self.voltha.disable_device(device_id, delete = True) |
| 2325 | df.callback(0) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2326 | reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2327 | return df |
| 2328 | |
| 2329 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2330 | def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self): |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2331 | """ |
| 2332 | Test Method: |
| 2333 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2334 | 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen. |
| 2335 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2336 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2337 | 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius. |
| 2338 | 5. Verify that two subscribers are not authenticated. |
| 2339 | """ |
| 2340 | |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2341 | df = defer.Deferred() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2342 | def tls_flow_check_on_two_subscribers_same_olt_device(df): |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2343 | aaa_app = ["org.opencord.aaa"] |
| 2344 | log_test.info('Enabling ponsim_olt') |
| 2345 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2346 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2347 | devices_list = self.voltha.get_devices() |
| 2348 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2349 | |
| 2350 | onu_device_id = devices_list['items'][1]['id'] |
| 2351 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2352 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2353 | time.sleep(10) |
| 2354 | switch_map = None |
| 2355 | olt_configured = False |
| 2356 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2357 | log_test.info('Installing OLT app') |
| 2358 | OnosCtrl.install_app(self.olt_app_file) |
| 2359 | time.sleep(5) |
| 2360 | log_test.info('Adding subscribers through OLT app') |
| 2361 | self.config_olt(switch_map) |
| 2362 | olt_configured = True |
| 2363 | time.sleep(5) |
| 2364 | devices_list = self.voltha.get_devices() |
| 2365 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 2366 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",)) |
| 2367 | thread1.start() |
| 2368 | time.sleep(randint(1,2)) |
| 2369 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 2370 | thread2.start() |
| 2371 | time.sleep(10) |
| 2372 | thread1.join() |
| 2373 | thread2.join() |
| 2374 | try: |
| 2375 | # assert_equal(status, True) |
| 2376 | assert_equal(self.success, True) |
| 2377 | time.sleep(10) |
| 2378 | finally: |
| 2379 | self.voltha.disable_device(device_id, delete = True) |
| 2380 | df.callback(0) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2381 | reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2382 | return df |
| 2383 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2384 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2385 | def test_two_subscribers_with_voltha_for_eap_tls_authentication_initiating_invalid_tls_packets_for_one_subscriber(self): |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2386 | """ |
| 2387 | Test Method: |
| 2388 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2389 | 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen. |
| 2390 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2391 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2392 | 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius. |
| 2393 | 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius. |
| 2394 | 6. Verify that valid subscriber authenticated successfully. |
| 2395 | 7. Verify that invalid subscriber are not authenticated successfully. |
| 2396 | """ |
| 2397 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2398 | df = defer.Deferred() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2399 | def tls_flow_check_on_two_subscribers_same_olt_device(df): |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2400 | aaa_app = ["org.opencord.aaa"] |
| 2401 | log_test.info('Enabling ponsim_olt') |
| 2402 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2403 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2404 | devices_list = self.voltha.get_devices() |
| 2405 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2406 | |
| 2407 | onu_device_id = devices_list['items'][1]['id'] |
| 2408 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2409 | voltha = VolthaCtrl(**self.voltha_attrs) |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2410 | time.sleep(10) |
| 2411 | switch_map = None |
| 2412 | olt_configured = False |
| 2413 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2414 | log_test.info('Installing OLT app') |
| 2415 | OnosCtrl.install_app(self.olt_app_file) |
| 2416 | time.sleep(5) |
| 2417 | log_test.info('Adding subscribers through OLT app') |
| 2418 | self.config_olt(switch_map) |
| 2419 | olt_configured = True |
| 2420 | time.sleep(5) |
| 2421 | devices_list = self.voltha.get_devices() |
| 2422 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 2423 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",)) |
| 2424 | thread1.start() |
| 2425 | time.sleep(randint(1,2)) |
| 2426 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 2427 | thread2.start() |
| 2428 | time.sleep(10) |
| 2429 | thread1.join() |
| 2430 | thread2.join() |
| 2431 | try: |
| 2432 | # assert_equal(status, True) |
| 2433 | assert_equal(self.success, True) |
| 2434 | time.sleep(10) |
| 2435 | finally: |
| 2436 | self.voltha.disable_device(device_id, delete = True) |
| 2437 | df.callback(0) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2438 | reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df) |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2439 | return df |
| 2440 | |
| 2441 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2442 | def test_two_subscribers_with_voltha_for_eap_tls_authentication_initiating_invalid_cert_for_one_subscriber(self): |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2443 | """ |
| 2444 | Test Method: |
| 2445 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2446 | 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen. |
| 2447 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2448 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2449 | 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius. |
| 2450 | 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius. |
| 2451 | 6. Verify that valid subscriber authenticated successfully. |
| 2452 | 7. Verify that invalid subscriber are not authenticated successfully. |
| 2453 | """ |
| 2454 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2455 | df = defer.Deferred() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2456 | def tls_flow_check_on_two_subscribers_same_olt_device(df): |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2457 | aaa_app = ["org.opencord.aaa"] |
| 2458 | log_test.info('Enabling ponsim_olt') |
| 2459 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2460 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2461 | devices_list = self.voltha.get_devices() |
| 2462 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2463 | |
| 2464 | onu_device_id = devices_list['items'][1]['id'] |
| 2465 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2466 | voltha = VolthaCtrl(**self.voltha_attrs) |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2467 | time.sleep(10) |
| 2468 | switch_map = None |
| 2469 | olt_configured = False |
| 2470 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2471 | log_test.info('Installing OLT app') |
| 2472 | OnosCtrl.install_app(self.olt_app_file) |
| 2473 | time.sleep(5) |
| 2474 | log_test.info('Adding subscribers through OLT app') |
| 2475 | self.config_olt(switch_map) |
| 2476 | olt_configured = True |
| 2477 | time.sleep(5) |
| 2478 | devices_list = self.voltha.get_devices() |
| 2479 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 2480 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",)) |
| 2481 | thread1.start() |
| 2482 | time.sleep(randint(1,2)) |
| 2483 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 2484 | thread2.start() |
| 2485 | time.sleep(10) |
| 2486 | thread1.join() |
| 2487 | thread2.join() |
| 2488 | try: |
| 2489 | # assert_equal(status, True) |
| 2490 | assert_equal(self.success, True) |
| 2491 | time.sleep(10) |
| 2492 | finally: |
| 2493 | self.voltha.disable_device(device_id, delete = True) |
| 2494 | df.callback(0) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2495 | reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df) |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2496 | return df |
| 2497 | |
| 2498 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2499 | def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self): |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2500 | """ |
| 2501 | Test Method: |
| 2502 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2503 | 1. OLT and ONU is detected and validated. |
| 2504 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2505 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2506 | 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius. |
| 2507 | 6. Verify that subscriber authenticated successfully. |
| 2508 | 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber. |
| 2509 | 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius. |
| 2510 | 9. Verify that subscriber authentication is unsuccessful.. |
| 2511 | 10. Verify that other subscriber authenticated successfully. |
| 2512 | """ |
| 2513 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2514 | df = defer.Deferred() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2515 | def tls_flow_check_on_two_subscribers_same_olt_device(df): |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2516 | aaa_app = ["org.opencord.aaa"] |
| 2517 | log_test.info('Enabling ponsim_olt') |
| 2518 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2519 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2520 | devices_list = self.voltha.get_devices() |
| 2521 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2522 | |
| 2523 | onu_device_id = devices_list['items'][1]['id'] |
| 2524 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2525 | voltha = VolthaCtrl(**self.voltha_attrs) |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2526 | time.sleep(10) |
| 2527 | switch_map = None |
| 2528 | olt_configured = False |
| 2529 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2530 | log_test.info('Installing OLT app') |
| 2531 | OnosCtrl.install_app(self.olt_app_file) |
| 2532 | time.sleep(5) |
| 2533 | log_test.info('Adding subscribers through OLT app') |
| 2534 | self.config_olt(switch_map) |
| 2535 | olt_configured = True |
| 2536 | time.sleep(5) |
| 2537 | devices_list = self.voltha.get_devices() |
| 2538 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 2539 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",)) |
| 2540 | thread1.start() |
| 2541 | time.sleep(randint(1,2)) |
| 2542 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 2543 | thread2.start() |
| 2544 | time.sleep(10) |
| 2545 | thread1.join() |
| 2546 | thread2.join() |
| 2547 | try: |
| 2548 | # assert_equal(status, True) |
| 2549 | assert_equal(self.success, True) |
| 2550 | time.sleep(10) |
| 2551 | finally: |
| 2552 | self.voltha.disable_device(device_id, delete = True) |
| 2553 | df.callback(0) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2554 | reactor.callLater(0, tls_flow_check_on_two_subscribers_same_olt_device, df) |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2555 | return df |
| 2556 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2557 | def test_3_subscribers_with_voltha_for_eap_tls_authentication(self): |
| 2558 | """ |
| 2559 | Test Method: |
| 2560 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2561 | 1. OLT and ONU is detected and validated. |
| 2562 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2563 | 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers) |
| 2564 | 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius. |
| 2565 | 5. Verify that subscriber is authenticated successfully. |
| 2566 | """ |
| 2567 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 2568 | num_subscribers = 3 |
| 2569 | num_channels = 1 |
| 2570 | services = ('TLS') |
| 2571 | cbs = (self.tls_flow_check, None, None) |
| 2572 | self.voltha_subscribers(services, cbs = cbs, |
| 2573 | num_subscribers = num_subscribers, |
| 2574 | num_channels = num_channels) |
| 2575 | |
| 2576 | def test_5_subscribers_with_voltha_for_eap_tls_authentication(self): |
| 2577 | """ |
| 2578 | Test Method: |
| 2579 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2580 | 1. OLT and ONU is detected and validated. |
| 2581 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2582 | 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber) |
| 2583 | 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius. |
| 2584 | 5. Verify that subscriber is authenticated successfully. |
| 2585 | """ |
| 2586 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 2587 | num_subscribers = 5 |
| 2588 | num_channels = 1 |
| 2589 | services = ('TLS') |
| 2590 | cbs = (self.tls_flow_check, None, None) |
| 2591 | self.voltha_subscribers(services, cbs = cbs, |
| 2592 | num_subscribers = num_subscribers, |
| 2593 | num_channels = num_channels) |
| 2594 | |
| 2595 | def test_9_subscribers_with_voltha_for_eap_tls_authentication(self): |
| 2596 | """ |
| 2597 | Test Method: |
| 2598 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2599 | 1. OLT and ONU is detected and validated. |
| 2600 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2601 | 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (9 subscriber) |
| 2602 | 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius. |
| 2603 | 5. Verify that subscriber is authenticated successfully. |
| 2604 | """ |
| 2605 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 2606 | num_subscribers = 9 |
| 2607 | num_channels = 1 |
| 2608 | services = ('TLS') |
| 2609 | cbs = (self.tls_flow_check, None, None) |
| 2610 | self.voltha_subscribers(services, cbs = cbs, |
| 2611 | num_subscribers = num_subscribers, |
| 2612 | num_channels = num_channels) |
| 2613 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2614 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2615 | def test_subscriber_with_voltha_for_dhcp_request(self): |
| 2616 | """ |
| 2617 | Test Method: |
| 2618 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2619 | 1. OLT and ONU is detected and validated. |
| 2620 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2621 | 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app. |
| 2622 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 2623 | """ |
| 2624 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2625 | df = defer.Deferred() |
| 2626 | def dhcp_flow_check_scenario(df): |
| 2627 | log_test.info('Enabling ponsim_olt') |
| 2628 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2629 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2630 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2631 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2632 | time.sleep(10) |
| 2633 | switch_map = None |
| 2634 | olt_configured = False |
| 2635 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2636 | log_test.info('Installing OLT app') |
| 2637 | OnosCtrl.install_app(self.olt_app_file) |
| 2638 | time.sleep(5) |
| 2639 | log_test.info('Adding subscribers through OLT app') |
| 2640 | self.config_olt(switch_map) |
| 2641 | olt_configured = True |
| 2642 | time.sleep(5) |
| 2643 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT) |
| 2644 | try: |
| 2645 | assert_equal(dhcp_status, True) |
| 2646 | #assert_equal(status, True) |
| 2647 | time.sleep(10) |
| 2648 | finally: |
| 2649 | self.remove_olt(switch_map) |
| 2650 | self.voltha.disable_device(device_id, delete = True) |
| 2651 | df.callback(0) |
| 2652 | |
| 2653 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2654 | return df |
| 2655 | |
| 2656 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2657 | def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self): |
| 2658 | """ |
| 2659 | Test Method: |
| 2660 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2661 | 1. OLT and ONU is detected and validated. |
| 2662 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2663 | 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app. |
| 2664 | 4. Verify that subscriber should not get ip from dhcp server. |
| 2665 | """ |
| 2666 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2667 | df = defer.Deferred() |
| 2668 | def dhcp_flow_check_scenario(df): |
| 2669 | log_test.info('Enabling ponsim_olt') |
| 2670 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2671 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2672 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2673 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2674 | time.sleep(10) |
| 2675 | switch_map = None |
| 2676 | olt_configured = False |
| 2677 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2678 | log_test.info('Installing OLT app') |
| 2679 | OnosCtrl.install_app(self.olt_app_file) |
| 2680 | time.sleep(5) |
| 2681 | log_test.info('Adding subscribers through OLT app') |
| 2682 | self.config_olt(switch_map) |
| 2683 | olt_configured = True |
| 2684 | time.sleep(5) |
| 2685 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast") |
| 2686 | try: |
| 2687 | assert_equal(dhcp_status, True) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2688 | assert_equal(self.success, True) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2689 | #assert_equal(status, True) |
| 2690 | time.sleep(10) |
| 2691 | finally: |
| 2692 | self.voltha.disable_device(device_id, delete = True) |
| 2693 | self.remove_olt(switch_map) |
| 2694 | df.callback(0) |
| 2695 | |
| 2696 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2697 | return df |
| 2698 | |
| 2699 | |
| 2700 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2701 | def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self): |
| 2702 | """ |
| 2703 | Test Method: |
| 2704 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2705 | 1. OLT and ONU is detected and validated. |
| 2706 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2707 | 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app. |
| 2708 | 4. Verify that subscriber should not get ip from dhcp server. |
| 2709 | """ |
| 2710 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2711 | df = defer.Deferred() |
| 2712 | def dhcp_flow_check_scenario(df): |
| 2713 | log_test.info('Enabling ponsim_olt') |
| 2714 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2715 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2716 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2717 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2718 | time.sleep(10) |
| 2719 | switch_map = None |
| 2720 | olt_configured = False |
| 2721 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2722 | log_test.info('Installing OLT app') |
| 2723 | OnosCtrl.install_app(self.olt_app_file) |
| 2724 | time.sleep(5) |
| 2725 | log_test.info('Adding subscribers through OLT app') |
| 2726 | self.config_olt(switch_map) |
| 2727 | olt_configured = True |
| 2728 | time.sleep(5) |
| 2729 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast") |
| 2730 | try: |
| 2731 | assert_equal(dhcp_status, True) |
| 2732 | #assert_equal(status, True) |
| 2733 | time.sleep(10) |
| 2734 | finally: |
| 2735 | self.voltha.disable_device(device_id, delete = True) |
| 2736 | self.remove_olt(switch_map) |
| 2737 | df.callback(0) |
| 2738 | |
| 2739 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2740 | return df |
| 2741 | |
| 2742 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2743 | def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self): |
| 2744 | """ |
| 2745 | Test Method: |
| 2746 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2747 | 1. OLT and ONU is detected and validated. |
| 2748 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2749 | 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app. |
| 2750 | 4. Verify that subscriber should not get ip from dhcp server. |
| 2751 | """ |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2752 | df = defer.Deferred() |
| 2753 | def dhcp_flow_check_scenario(df): |
| 2754 | log_test.info('Enabling ponsim_olt') |
| 2755 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2756 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2757 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2758 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2759 | time.sleep(10) |
| 2760 | switch_map = None |
| 2761 | olt_configured = False |
| 2762 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2763 | log_test.info('Installing OLT app') |
| 2764 | OnosCtrl.install_app(self.olt_app_file) |
| 2765 | time.sleep(5) |
| 2766 | log_test.info('Adding subscribers through OLT app') |
| 2767 | self.config_olt(switch_map) |
| 2768 | olt_configured = True |
| 2769 | time.sleep(5) |
| 2770 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk") |
| 2771 | try: |
| 2772 | assert_equal(dhcp_status, True) |
| 2773 | #assert_equal(status, True) |
| 2774 | time.sleep(10) |
| 2775 | finally: |
| 2776 | self.voltha.disable_device(device_id, delete = True) |
| 2777 | self.remove_olt(switch_map) |
| 2778 | df.callback(0) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2779 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2780 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2781 | return df |
| 2782 | |
| 2783 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2784 | def test_subscriber_with_voltha_for_dhcp_request_and_release(self): |
| 2785 | """ |
| 2786 | Test Method: |
| 2787 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2788 | 1. OLT and ONU is detected and validated. |
| 2789 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2790 | 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app. |
| 2791 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 2792 | 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app. |
| 2793 | 6 Verify that subscriber should not get ip from dhcp server, ping to gateway. |
| 2794 | """ |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2795 | df = defer.Deferred() |
| 2796 | def dhcp_flow_check_scenario(df): |
| 2797 | log_test.info('Enabling ponsim_olt') |
| 2798 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2799 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2800 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2801 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2802 | time.sleep(10) |
| 2803 | switch_map = None |
| 2804 | olt_configured = False |
| 2805 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2806 | log_test.info('Installing OLT app') |
| 2807 | OnosCtrl.install_app(self.olt_app_file) |
| 2808 | time.sleep(5) |
| 2809 | log_test.info('Adding subscribers through OLT app') |
| 2810 | self.config_olt(switch_map) |
| 2811 | olt_configured = True |
| 2812 | time.sleep(5) |
| 2813 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release") |
| 2814 | try: |
| 2815 | assert_equal(dhcp_status, True) |
| 2816 | #assert_equal(status, True) |
| 2817 | time.sleep(10) |
| 2818 | finally: |
| 2819 | self.voltha.disable_device(device_id, delete = True) |
| 2820 | self.remove_olt(switch_map) |
| 2821 | df.callback(0) |
| 2822 | |
| 2823 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2824 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2825 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2826 | |
| 2827 | @deferred(TESTCASE_TIMEOUT) |
A.R Karthick | 57fa937 | 2017-05-24 12:47:03 -0700 | [diff] [blame] | 2828 | def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2829 | """ |
| 2830 | Test Method: |
| 2831 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2832 | 1. OLT and ONU is detected and validated. |
| 2833 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2834 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 2835 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 2836 | 5. Repeat step 3 and 4 for 10 times. |
| 2837 | 6 Verify that subscriber should get ip from dhcp server. |
| 2838 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2839 | df = defer.Deferred() |
| 2840 | def dhcp_flow_check_scenario(df): |
| 2841 | log_test.info('Enabling ponsim_olt') |
| 2842 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2843 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2844 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2845 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2846 | time.sleep(10) |
| 2847 | switch_map = None |
| 2848 | olt_configured = False |
| 2849 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2850 | log_test.info('Installing OLT app') |
| 2851 | OnosCtrl.install_app(self.olt_app_file) |
| 2852 | time.sleep(5) |
| 2853 | log_test.info('Adding subscribers through OLT app') |
| 2854 | self.config_olt(switch_map) |
| 2855 | olt_configured = True |
| 2856 | time.sleep(5) |
| 2857 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive") |
| 2858 | try: |
| 2859 | assert_equal(dhcp_status, True) |
| 2860 | #assert_equal(status, True) |
| 2861 | time.sleep(10) |
| 2862 | finally: |
| 2863 | self.voltha.disable_device(device_id, delete = True) |
| 2864 | self.remove_olt(switch_map) |
| 2865 | df.callback(0) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2866 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2867 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2868 | return df |
| 2869 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2870 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2871 | def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self): |
| 2872 | """ |
| 2873 | Test Method: |
| 2874 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2875 | 1. OLT and ONU is detected and validated. |
| 2876 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2877 | 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app. |
| 2878 | 4. Verify that subscriber should not get ip from dhcp server. |
| 2879 | 5. Repeat steps 3 and 4 for 10 times. |
| 2880 | 6 Verify that subscriber should not get ip from dhcp server. |
| 2881 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2882 | df = defer.Deferred() |
| 2883 | def dhcp_flow_check_scenario(df): |
| 2884 | log_test.info('Enabling ponsim_olt') |
| 2885 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2886 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2887 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2888 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2889 | time.sleep(10) |
| 2890 | switch_map = None |
| 2891 | olt_configured = False |
| 2892 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2893 | log_test.info('Installing OLT app') |
| 2894 | OnosCtrl.install_app(self.olt_app_file) |
| 2895 | time.sleep(5) |
| 2896 | log_test.info('Adding subscribers through OLT app') |
| 2897 | self.config_olt(switch_map) |
| 2898 | olt_configured = True |
| 2899 | time.sleep(5) |
| 2900 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative") |
| 2901 | try: |
| 2902 | assert_equal(dhcp_status, True) |
| 2903 | #assert_equal(status, True) |
| 2904 | time.sleep(10) |
| 2905 | finally: |
| 2906 | self.voltha.disable_device(device_id, delete = True) |
| 2907 | self.remove_olt(switch_map) |
| 2908 | df.callback(0) |
| 2909 | |
| 2910 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2911 | return df |
| 2912 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2913 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2914 | def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self): |
| 2915 | """ |
| 2916 | Test Method: |
| 2917 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2918 | 1. OLT and ONU is detected and validated. |
| 2919 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2920 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 2921 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 2922 | 5. Repeat step 3 for 50 times. |
| 2923 | 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server. |
| 2924 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2925 | df = defer.Deferred() |
| 2926 | def dhcp_flow_check_scenario(df): |
| 2927 | log_test.info('Enabling ponsim_olt') |
| 2928 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2929 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2930 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2931 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2932 | time.sleep(10) |
| 2933 | switch_map = None |
| 2934 | olt_configured = False |
| 2935 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2936 | log_test.info('Installing OLT app') |
| 2937 | OnosCtrl.install_app(self.olt_app_file) |
| 2938 | time.sleep(5) |
| 2939 | log_test.info('Adding subscribers through OLT app') |
| 2940 | self.config_olt(switch_map) |
| 2941 | olt_configured = True |
| 2942 | time.sleep(5) |
| 2943 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover") |
| 2944 | try: |
| 2945 | assert_equal(dhcp_status, True) |
| 2946 | #assert_equal(status, True) |
| 2947 | time.sleep(10) |
| 2948 | finally: |
| 2949 | self.voltha.disable_device(device_id, delete = True) |
| 2950 | self.remove_olt(switch_map) |
| 2951 | df.callback(0) |
| 2952 | |
| 2953 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2954 | return df |
| 2955 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2956 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2957 | def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self): |
| 2958 | """ |
| 2959 | Test Method: |
| 2960 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2961 | 1. OLT and ONU is detected and validated. |
| 2962 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2963 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 2964 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 2965 | 5. Send DHCP request to dhcp server which is running as onos app. |
| 2966 | 6. Repeat step 5 for 50 times. |
| 2967 | 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server. |
| 2968 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2969 | df = defer.Deferred() |
| 2970 | def dhcp_flow_check_scenario(df): |
| 2971 | log_test.info('Enabling ponsim_olt') |
| 2972 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2973 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2974 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2975 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2976 | time.sleep(10) |
| 2977 | switch_map = None |
| 2978 | olt_configured = False |
| 2979 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2980 | log_test.info('Installing OLT app') |
| 2981 | OnosCtrl.install_app(self.olt_app_file) |
| 2982 | time.sleep(5) |
| 2983 | log_test.info('Adding subscribers through OLT app') |
| 2984 | self.config_olt(switch_map) |
| 2985 | olt_configured = True |
| 2986 | time.sleep(5) |
| 2987 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests") |
| 2988 | try: |
| 2989 | assert_equal(dhcp_status, True) |
| 2990 | #assert_equal(status, True) |
| 2991 | time.sleep(10) |
| 2992 | finally: |
| 2993 | self.voltha.disable_device(device_id, delete = True) |
| 2994 | self.remove_olt(switch_map) |
| 2995 | df.callback(0) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2996 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 2997 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2998 | return df |
| 2999 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 3000 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3001 | def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self): |
| 3002 | """ |
| 3003 | Test Method: |
| 3004 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3005 | 1. OLT and ONU is detected and validated. |
| 3006 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3007 | 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app. |
| 3008 | 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully. |
| 3009 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 3010 | df = defer.Deferred() |
| 3011 | def dhcp_flow_check_scenario(df): |
| 3012 | log_test.info('Enabling ponsim_olt') |
| 3013 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3014 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3015 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3016 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 3017 | time.sleep(10) |
| 3018 | switch_map = None |
| 3019 | olt_configured = False |
| 3020 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3021 | log_test.info('Installing OLT app') |
| 3022 | OnosCtrl.install_app(self.olt_app_file) |
| 3023 | time.sleep(5) |
| 3024 | log_test.info('Adding subscribers through OLT app') |
| 3025 | self.config_olt(switch_map) |
| 3026 | olt_configured = True |
| 3027 | time.sleep(5) |
| 3028 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address") |
| 3029 | try: |
| 3030 | assert_equal(dhcp_status, True) |
| 3031 | #assert_equal(status, True) |
| 3032 | time.sleep(10) |
| 3033 | finally: |
| 3034 | self.voltha.disable_device(device_id, delete = True) |
| 3035 | self.remove_olt(switch_map) |
| 3036 | df.callback(0) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3037 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 3038 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3039 | return df |
| 3040 | |
| 3041 | @deferred(TESTCASE_TIMEOUT) |
| 3042 | def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3043 | """ |
| 3044 | Test Method: |
| 3045 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3046 | 1. OLT and ONU is detected and validated. |
| 3047 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3048 | 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app. |
| 3049 | 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. |
| 3050 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 3051 | df = defer.Deferred() |
| 3052 | def dhcp_flow_check_scenario(df): |
| 3053 | log_test.info('Enabling ponsim_olt') |
| 3054 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3055 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3056 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3057 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 3058 | time.sleep(10) |
| 3059 | switch_map = None |
| 3060 | olt_configured = False |
| 3061 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3062 | log_test.info('Installing OLT app') |
| 3063 | OnosCtrl.install_app(self.olt_app_file) |
| 3064 | time.sleep(5) |
| 3065 | log_test.info('Adding subscribers through OLT app') |
| 3066 | self.config_olt(switch_map) |
| 3067 | olt_configured = True |
| 3068 | time.sleep(5) |
| 3069 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address") |
| 3070 | try: |
| 3071 | assert_equal(dhcp_status, True) |
| 3072 | #assert_equal(status, True) |
| 3073 | time.sleep(10) |
| 3074 | finally: |
| 3075 | self.voltha.disable_device(device_id, delete = True) |
| 3076 | self.remove_olt(switch_map) |
| 3077 | df.callback(0) |
| 3078 | |
| 3079 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3080 | return df |
| 3081 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 3082 | @deferred(TESTCASE_TIMEOUT) |
| 3083 | def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3084 | """ |
| 3085 | Test Method: |
| 3086 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3087 | 1. OLT and ONU is detected and validated. |
| 3088 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3089 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 3090 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 3091 | 5. Deactivate dhcp server app in onos. |
| 3092 | 6. Repeat step 3. |
| 3093 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 3094 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 3095 | df = defer.Deferred() |
| 3096 | dhcp_app = 'org.onosproject.dhcp' |
| 3097 | def dhcp_flow_check_scenario(df): |
| 3098 | log_test.info('Enabling ponsim_olt') |
| 3099 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3100 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3101 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3102 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 3103 | time.sleep(10) |
| 3104 | switch_map = None |
| 3105 | olt_configured = False |
| 3106 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3107 | log_test.info('Installing OLT app') |
| 3108 | OnosCtrl.install_app(self.olt_app_file) |
| 3109 | time.sleep(5) |
| 3110 | log_test.info('Adding subscribers through OLT app') |
| 3111 | self.config_olt(switch_map) |
| 3112 | olt_configured = True |
| 3113 | time.sleep(5) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3114 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 3115 | thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,)) |
| 3116 | log_test.info('Restart dhcp app in onos during client send discover to voltha') |
| 3117 | thread2.start() |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 3118 | thread1.start() |
| 3119 | time.sleep(10) |
| 3120 | thread1.join() |
| 3121 | thread2.join() |
| 3122 | try: |
| 3123 | assert_equal(self.success, True) |
| 3124 | #assert_equal(status, True) |
| 3125 | time.sleep(10) |
| 3126 | finally: |
| 3127 | self.voltha.disable_device(device_id, delete = True) |
| 3128 | self.remove_olt(switch_map) |
| 3129 | df.callback(0) |
| 3130 | |
| 3131 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3132 | return df |
| 3133 | |
| 3134 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3135 | def test_subscriber_with_voltha_for_dhcp_renew_time(self): |
| 3136 | """ |
| 3137 | Test Method: |
| 3138 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3139 | 1. OLT and ONU is detected and validated. |
| 3140 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3141 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 3142 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 3143 | 5. Send dhcp renew packet to dhcp server which is running as onos app. |
| 3144 | 6. Repeat step 4. |
| 3145 | """ |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3146 | |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3147 | df = defer.Deferred() |
| 3148 | def dhcp_flow_check_scenario(df): |
| 3149 | log_test.info('Enabling ponsim_olt') |
| 3150 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3151 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3152 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3153 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3154 | time.sleep(10) |
| 3155 | switch_map = None |
| 3156 | olt_configured = False |
| 3157 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3158 | log_test.info('Installing OLT app') |
| 3159 | OnosCtrl.install_app(self.olt_app_file) |
| 3160 | time.sleep(5) |
| 3161 | log_test.info('Adding subscribers through OLT app') |
| 3162 | self.config_olt(switch_map) |
| 3163 | olt_configured = True |
| 3164 | time.sleep(5) |
| 3165 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew") |
| 3166 | try: |
| 3167 | assert_equal(dhcp_status, True) |
| 3168 | #assert_equal(status, True) |
| 3169 | time.sleep(10) |
| 3170 | finally: |
| 3171 | self.voltha.disable_device(device_id, delete = True) |
| 3172 | self.remove_olt(switch_map) |
| 3173 | df.callback(0) |
| 3174 | |
| 3175 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3176 | return df |
| 3177 | |
| 3178 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3179 | def test_subscriber_with_voltha_for_dhcp_rebind_time(self): |
| 3180 | """ |
| 3181 | Test Method: |
| 3182 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3183 | 1. OLT and ONU is detected and validated. |
| 3184 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3185 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 3186 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 3187 | 5. Send dhcp rebind packet to dhcp server which is running as onos app. |
| 3188 | 6. Repeat step 4. |
| 3189 | """ |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3190 | df = defer.Deferred() |
| 3191 | def dhcp_flow_check_scenario(df): |
| 3192 | log_test.info('Enabling ponsim_olt') |
| 3193 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3194 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3195 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3196 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3197 | time.sleep(10) |
| 3198 | switch_map = None |
| 3199 | olt_configured = False |
| 3200 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3201 | log_test.info('Installing OLT app') |
| 3202 | OnosCtrl.install_app(self.olt_app_file) |
| 3203 | time.sleep(5) |
| 3204 | log_test.info('Adding subscribers through OLT app') |
| 3205 | self.config_olt(switch_map) |
| 3206 | olt_configured = True |
| 3207 | time.sleep(5) |
| 3208 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind") |
| 3209 | try: |
| 3210 | assert_equal(dhcp_status, True) |
| 3211 | #assert_equal(status, True) |
| 3212 | time.sleep(10) |
| 3213 | finally: |
| 3214 | self.voltha.disable_device(device_id, delete = True) |
| 3215 | self.remove_olt(switch_map) |
| 3216 | df.callback(0) |
| 3217 | |
| 3218 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3219 | return df |
| 3220 | |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3221 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3222 | def test_subscriber_with_voltha_for_dhcp_toggling_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3223 | """ |
| 3224 | Test Method: |
| 3225 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3226 | 1. OLT and ONU is detected and validated. |
| 3227 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3228 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 3229 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 3230 | 5. Disable olt devices which is being detected in voltha CLI. |
| 3231 | 6. Repeat step 3. |
| 3232 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 3233 | """ |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3234 | df = defer.Deferred() |
| 3235 | dhcp_app = 'org.onosproject.dhcp' |
| 3236 | def dhcp_flow_check_scenario(df): |
| 3237 | log_test.info('Enabling ponsim_olt') |
| 3238 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3239 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3240 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3241 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3242 | time.sleep(10) |
| 3243 | switch_map = None |
| 3244 | olt_configured = False |
| 3245 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3246 | log_test.info('Installing OLT app') |
| 3247 | OnosCtrl.install_app(self.olt_app_file) |
| 3248 | time.sleep(5) |
| 3249 | log_test.info('Adding subscribers through OLT app') |
| 3250 | self.config_olt(switch_map) |
| 3251 | olt_configured = True |
| 3252 | time.sleep(5) |
| 3253 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
| 3254 | thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,)) |
| 3255 | log_test.info('Disable the olt device in during client send discover to voltha') |
| 3256 | thread2.start() |
| 3257 | # time.sleep(randint(0,1)) |
| 3258 | thread1.start() |
| 3259 | time.sleep(10) |
| 3260 | thread1.join() |
| 3261 | thread2.join() |
| 3262 | try: |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 3263 | assert_equal(self.success, True) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3264 | #assert_equal(status, True) |
| 3265 | time.sleep(10) |
| 3266 | finally: |
| 3267 | self.voltha.disable_device(device_id, delete = True) |
| 3268 | self.remove_olt(switch_map) |
| 3269 | df.callback(0) |
| 3270 | |
| 3271 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3272 | return df |
| 3273 | |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3274 | @deferred(TESTCASE_TIMEOUT) |
| 3275 | def test_subscriber_with_voltha_for_dhcp_with_multiple_times_disabling_of_olt(self): |
| 3276 | """ |
| 3277 | Test Method: |
| 3278 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3279 | 1. OLT and ONU is detected and validated. |
| 3280 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3281 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 3282 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 3283 | 5. Disable olt devices which is being detected in voltha CLI. |
| 3284 | 6. Repeat step 3. |
| 3285 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 3286 | 8. Repeat steps from 3 to 7 for 10 times and finally verify dhcp flow |
| 3287 | """ |
| 3288 | df = defer.Deferred() |
| 3289 | no_iterations = 10 |
| 3290 | dhcp_app = 'org.onosproject.dhcp' |
| 3291 | def dhcp_flow_check_scenario(df): |
| 3292 | log_test.info('Enabling ponsim_olt') |
| 3293 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3294 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3295 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3296 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3297 | time.sleep(10) |
| 3298 | switch_map = None |
| 3299 | olt_configured = False |
| 3300 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3301 | log_test.info('Installing OLT app') |
| 3302 | OnosCtrl.install_app(self.olt_app_file) |
| 3303 | time.sleep(5) |
| 3304 | log_test.info('Adding subscribers through OLT app') |
| 3305 | self.config_olt(switch_map) |
| 3306 | olt_configured = True |
| 3307 | time.sleep(5) |
| 3308 | for i in range(no_iterations): |
| 3309 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
| 3310 | thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,)) |
| 3311 | log_test.info('Disable the olt device in during client send discover to voltha') |
| 3312 | thread2.start() |
| 3313 | # time.sleep(randint(0,1)) |
| 3314 | thread1.start() |
| 3315 | time.sleep(10) |
| 3316 | thread1.join() |
| 3317 | thread2.join() |
| 3318 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT) |
| 3319 | try: |
| 3320 | assert_equal(self.success, True) |
| 3321 | assert_equal(dhcp_status, True) |
| 3322 | #assert_equal(status, True) |
| 3323 | time.sleep(10) |
| 3324 | finally: |
| 3325 | self.voltha.disable_device(device_id, delete = True) |
| 3326 | self.remove_olt(switch_map) |
| 3327 | df.callback(0) |
| 3328 | |
| 3329 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3330 | return df |
| 3331 | |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3332 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3333 | def test_subscriber_with_voltha_for_dhcp_toggling_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3334 | """ |
| 3335 | Test Method: |
| 3336 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3337 | 1. OLT and ONU is detected and validated. |
| 3338 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3339 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 3340 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 3341 | 5. Disable olt devices which is being detected in voltha CLI. |
| 3342 | 6. Repeat step 3. |
| 3343 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 3344 | 8. Enable olt devices which is being detected in voltha CLI. |
| 3345 | 9. Repeat steps 3 and 4. |
| 3346 | """ |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3347 | df = defer.Deferred() |
| 3348 | dhcp_app = 'org.onosproject.dhcp' |
| 3349 | def dhcp_flow_check_scenario(df): |
| 3350 | log_test.info('Enabling ponsim_olt') |
| 3351 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3352 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3353 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3354 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3355 | time.sleep(10) |
| 3356 | switch_map = None |
| 3357 | olt_configured = False |
| 3358 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3359 | log_test.info('Installing OLT app') |
| 3360 | OnosCtrl.install_app(self.olt_app_file) |
| 3361 | time.sleep(5) |
| 3362 | log_test.info('Adding subscribers through OLT app') |
| 3363 | self.config_olt(switch_map) |
| 3364 | olt_configured = True |
| 3365 | time.sleep(5) |
| 3366 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
| 3367 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,)) |
| 3368 | thread2.start() |
| 3369 | thread1.start() |
| 3370 | time.sleep(10) |
| 3371 | thread1.join() |
| 3372 | thread2.join() |
| 3373 | try: |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 3374 | assert_equal(self.success, True) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3375 | #assert_equal(status, True) |
| 3376 | time.sleep(10) |
| 3377 | finally: |
| 3378 | self.voltha.disable_device(device_id, delete = True) |
| 3379 | self.remove_olt(switch_map) |
| 3380 | df.callback(0) |
| 3381 | |
| 3382 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3383 | return df |
| 3384 | |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3385 | @deferred(TESTCASE_TIMEOUT) |
| 3386 | def test_subscriber_with_voltha_for_dhcp_toggling_olt_multiple_times(self): |
| 3387 | """ |
| 3388 | Test Method: |
| 3389 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3390 | 1. OLT and ONU is detected and validated. |
| 3391 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3392 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 3393 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 3394 | 5. Disable olt devices which is being detected in voltha CLI. |
| 3395 | 6. Repeat step 3. |
| 3396 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 3397 | 8. Enable olt devices which is being detected in voltha CLI. |
| 3398 | 9. Repeat steps 3 and 4. |
| 3399 | """ |
| 3400 | |
| 3401 | df = defer.Deferred() |
| 3402 | no_iterations = 10 |
| 3403 | dhcp_app = 'org.onosproject.dhcp' |
| 3404 | def dhcp_flow_check_scenario(df): |
| 3405 | log_test.info('Enabling ponsim_olt') |
| 3406 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3407 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3408 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3409 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3410 | time.sleep(10) |
| 3411 | switch_map = None |
| 3412 | olt_configured = False |
| 3413 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3414 | log_test.info('Installing OLT app') |
| 3415 | OnosCtrl.install_app(self.olt_app_file) |
| 3416 | time.sleep(5) |
| 3417 | log_test.info('Adding subscribers through OLT app') |
| 3418 | self.config_olt(switch_map) |
| 3419 | olt_configured = True |
| 3420 | time.sleep(5) |
| 3421 | for i in range(no_iterations): |
| 3422 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
| 3423 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,)) |
| 3424 | thread2.start() |
| 3425 | thread1.start() |
| 3426 | time.sleep(10) |
| 3427 | thread1.join() |
| 3428 | thread2.join() |
| 3429 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT) |
| 3430 | try: |
| 3431 | assert_equal(dhcp_status, True) |
| 3432 | #assert_equal(status, True) |
| 3433 | assert_equal(self.success, True) |
| 3434 | time.sleep(10) |
| 3435 | finally: |
| 3436 | self.voltha.disable_device(device_id, delete = True) |
| 3437 | self.remove_olt(switch_map) |
| 3438 | df.callback(0) |
| 3439 | |
| 3440 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3441 | return df |
| 3442 | |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3443 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3444 | def test_subscriber_with_voltha_for_dhcp_disabling_onu_port(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3445 | """ |
| 3446 | Test Method: |
| 3447 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3448 | 1. OLT and ONU is detected and validated. |
| 3449 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3450 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 3451 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 3452 | 5. Disable onu port which is being detected in voltha CLI. |
| 3453 | 6. Repeat step 3. |
| 3454 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 3455 | """ |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3456 | df = defer.Deferred() |
| 3457 | dhcp_app = 'org.onosproject.dhcp' |
| 3458 | def dhcp_flow_check_scenario(df): |
| 3459 | log_test.info('Enabling ponsim_olt') |
| 3460 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3461 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3462 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3463 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3464 | time.sleep(10) |
| 3465 | switch_map = None |
| 3466 | olt_configured = False |
| 3467 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3468 | log_test.info('Installing OLT app') |
| 3469 | OnosCtrl.install_app(self.olt_app_file) |
| 3470 | time.sleep(5) |
| 3471 | log_test.info('Adding subscribers through OLT app') |
| 3472 | self.config_olt(switch_map) |
| 3473 | olt_configured = True |
| 3474 | time.sleep(5) |
| 3475 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 3476 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3477 | thread1.start() |
| 3478 | thread2.start() |
| 3479 | time.sleep(10) |
| 3480 | thread1.join() |
| 3481 | thread2.join() |
| 3482 | try: |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 3483 | assert_equal(self.success, True) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3484 | #assert_equal(status, True) |
| 3485 | time.sleep(10) |
| 3486 | finally: |
| 3487 | self.voltha.disable_device(device_id, delete = True) |
| 3488 | self.remove_olt(switch_map) |
| 3489 | df.callback(0) |
| 3490 | |
| 3491 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3492 | return df |
| 3493 | |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3494 | @deferred(TESTCASE_TIMEOUT) |
| 3495 | def test_subscriber_with_voltha_for_dhcp_disabling_onu_port_multiple_times(self): |
| 3496 | """ |
| 3497 | Test Method: |
| 3498 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3499 | 1. OLT and ONU is detected and validated. |
| 3500 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3501 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 3502 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 3503 | 5. Disable onu port which is being detected in voltha CLI. |
| 3504 | 6. Repeat step 3. |
| 3505 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 3506 | """ |
| 3507 | df = defer.Deferred() |
| 3508 | no_iterations = 10 |
| 3509 | dhcp_app = 'org.onosproject.dhcp' |
| 3510 | def dhcp_flow_check_scenario(df): |
| 3511 | log_test.info('Enabling ponsim_olt') |
| 3512 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3513 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3514 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3515 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3516 | time.sleep(10) |
| 3517 | switch_map = None |
| 3518 | olt_configured = False |
| 3519 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3520 | log_test.info('Installing OLT app') |
| 3521 | OnosCtrl.install_app(self.olt_app_file) |
| 3522 | time.sleep(5) |
| 3523 | log_test.info('Adding subscribers through OLT app') |
| 3524 | self.config_olt(switch_map) |
| 3525 | olt_configured = True |
| 3526 | time.sleep(5) |
| 3527 | for i in range(no_iterations): |
| 3528 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 3529 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3530 | thread1.start() |
| 3531 | thread2.start() |
| 3532 | time.sleep(10) |
| 3533 | thread1.join() |
| 3534 | thread2.join() |
| 3535 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT) |
| 3536 | try: |
| 3537 | #assert_equal(status, True) |
| 3538 | assert_equal(dhcp_status, True) |
| 3539 | assert_equal(self.success, True) |
| 3540 | time.sleep(10) |
| 3541 | finally: |
| 3542 | self.voltha.disable_device(device_id, delete = True) |
| 3543 | self.remove_olt(switch_map) |
| 3544 | df.callback(0) |
| 3545 | |
| 3546 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3547 | return df |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3548 | |
| 3549 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3550 | def test_subscriber_with_voltha_for_dhcp_toggling_onu_port(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3551 | """ |
| 3552 | Test Method: |
| 3553 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3554 | 1. OLT and ONU is detected and validated. |
| 3555 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3556 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 3557 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 3558 | 5. Disable onu port which is being detected in voltha CLI. |
| 3559 | 6. Repeat step 3. |
| 3560 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 3561 | 8. Enable onu port which is being detected in voltha CLI. |
| 3562 | 9. Repeat steps 3 and 4. |
| 3563 | """ |
| 3564 | |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3565 | df = defer.Deferred() |
| 3566 | dhcp_app = 'org.onosproject.dhcp' |
| 3567 | def dhcp_flow_check_scenario(df): |
| 3568 | log_test.info('Enabling ponsim_olt') |
| 3569 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3570 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3571 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3572 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3573 | time.sleep(10) |
| 3574 | switch_map = None |
| 3575 | olt_configured = False |
| 3576 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3577 | log_test.info('Installing OLT app') |
| 3578 | OnosCtrl.install_app(self.olt_app_file) |
| 3579 | time.sleep(5) |
| 3580 | log_test.info('Adding subscribers through OLT app') |
| 3581 | self.config_olt(switch_map) |
| 3582 | olt_configured = True |
| 3583 | time.sleep(5) |
| 3584 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 3585 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3586 | log_test.info('Restart dhcp app in onos during client send discover to voltha') |
| 3587 | thread2.start() |
| 3588 | time.sleep(randint(0,1)) |
| 3589 | thread1.start() |
| 3590 | time.sleep(10) |
| 3591 | thread1.join() |
| 3592 | thread2.join() |
| 3593 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT) |
| 3594 | assert_equal(dhcp_status, True) |
| 3595 | try: |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 3596 | assert_equal(self.success, True) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3597 | #assert_equal(status, True) |
| 3598 | time.sleep(10) |
| 3599 | finally: |
| 3600 | self.voltha.disable_device(device_id, delete = True) |
| 3601 | self.remove_olt(switch_map) |
| 3602 | df.callback(0) |
| 3603 | |
| 3604 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3605 | return df |
| 3606 | |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3607 | @deferred(TESTCASE_TIMEOUT) |
| 3608 | def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_multiple_times(self): |
| 3609 | """ |
| 3610 | Test Method: |
| 3611 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3612 | 1. OLT and ONU is detected and validated. |
| 3613 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3614 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 3615 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 3616 | 5. Disable onu port which is being detected in voltha CLI. |
| 3617 | 6. Repeat step 3. |
| 3618 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 3619 | 8. Enable onu port which is being detected in voltha CLI. |
| 3620 | 9. Repeat steps 3 and 4. |
| 3621 | """ |
| 3622 | |
| 3623 | df = defer.Deferred() |
| 3624 | no_iterations = 10 |
| 3625 | dhcp_app = 'org.onosproject.dhcp' |
| 3626 | def dhcp_flow_check_scenario(df): |
| 3627 | log_test.info('Enabling ponsim_olt') |
| 3628 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3629 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3630 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3631 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3632 | time.sleep(10) |
| 3633 | switch_map = None |
| 3634 | olt_configured = False |
| 3635 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3636 | log_test.info('Installing OLT app') |
| 3637 | OnosCtrl.install_app(self.olt_app_file) |
| 3638 | time.sleep(5) |
| 3639 | log_test.info('Adding subscribers through OLT app') |
| 3640 | self.config_olt(switch_map) |
| 3641 | olt_configured = True |
| 3642 | time.sleep(5) |
| 3643 | for i in range(no_iterations): |
| 3644 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 3645 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3646 | log_test.info('Restart dhcp app in onos during client send discover to voltha') |
| 3647 | thread2.start() |
| 3648 | time.sleep(randint(0,1)) |
| 3649 | thread1.start() |
| 3650 | time.sleep(10) |
| 3651 | thread1.join() |
| 3652 | thread2.join() |
| 3653 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT) |
| 3654 | assert_equal(dhcp_status, True) |
| 3655 | try: |
| 3656 | assert_equal(self.success, True) |
| 3657 | #assert_equal(status, True) |
| 3658 | time.sleep(10) |
| 3659 | finally: |
| 3660 | self.voltha.disable_device(device_id, delete = True) |
| 3661 | self.remove_olt(switch_map) |
| 3662 | df.callback(0) |
| 3663 | |
| 3664 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3665 | return df |
| 3666 | |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 3667 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3668 | def test_two_subscribers_with_voltha_for_dhcp_discover(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3669 | """ |
| 3670 | Test Method: |
| 3671 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3672 | 1. OLT and ONU is detected and validated. |
| 3673 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3674 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 3675 | 4. Verify that subscribers had got different ips from dhcp server successfully. |
| 3676 | """ |
| 3677 | |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3678 | df = defer.Deferred() |
| 3679 | self.success = True |
| 3680 | dhcp_app = 'org.onosproject.dhcp' |
| 3681 | def dhcp_flow_check_scenario(df): |
| 3682 | log_test.info('Enabling ponsim_olt') |
| 3683 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3684 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3685 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3686 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3687 | time.sleep(10) |
| 3688 | switch_map = None |
| 3689 | olt_configured = False |
| 3690 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3691 | log_test.info('Installing OLT app') |
| 3692 | OnosCtrl.install_app(self.olt_app_file) |
| 3693 | time.sleep(5) |
| 3694 | log_test.info('Adding subscribers through OLT app') |
| 3695 | self.config_olt(switch_map) |
| 3696 | olt_configured = True |
| 3697 | time.sleep(5) |
| 3698 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 3699 | thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,)) |
| 3700 | thread1.start() |
| 3701 | thread2.start() |
| 3702 | time.sleep(10) |
| 3703 | thread1.join() |
| 3704 | thread2.join() |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3705 | dhcp_flow_status = self.success |
| 3706 | try: |
| 3707 | # if self.success is not True: |
| 3708 | assert_equal(dhcp_flow_status, True) |
| 3709 | #assert_equal(status, True) |
| 3710 | time.sleep(10) |
| 3711 | finally: |
| 3712 | self.voltha.disable_device(device_id, delete = True) |
| 3713 | self.remove_olt(switch_map) |
| 3714 | df.callback(0) |
| 3715 | |
| 3716 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3717 | return df |
| 3718 | |
| 3719 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3720 | def test_two_subscribers_with_voltha_for_dhcp_multiple_discover(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3721 | """ |
| 3722 | Test Method: |
| 3723 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3724 | 1. OLT and ONU is detected and validated. |
| 3725 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3726 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 3727 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 3728 | 5. Repeat step 3 and 4 for 10 times for both subscribers. |
| 3729 | 6 Verify that subscribers should get same ips which are offered the first time from dhcp server. |
| 3730 | """ |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3731 | |
| 3732 | |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3733 | df = defer.Deferred() |
| 3734 | self.success = True |
| 3735 | dhcp_app = 'org.onosproject.dhcp' |
| 3736 | def dhcp_flow_check_scenario(df): |
| 3737 | log_test.info('Enabling ponsim_olt') |
| 3738 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3739 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3740 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3741 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3742 | time.sleep(10) |
| 3743 | switch_map = None |
| 3744 | olt_configured = False |
| 3745 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3746 | log_test.info('Installing OLT app') |
| 3747 | OnosCtrl.install_app(self.olt_app_file) |
| 3748 | time.sleep(5) |
| 3749 | log_test.info('Adding subscribers through OLT app') |
| 3750 | self.config_olt(switch_map) |
| 3751 | olt_configured = True |
| 3752 | time.sleep(5) |
| 3753 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",)) |
| 3754 | thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"multiple_discover",)) |
| 3755 | thread1.start() |
| 3756 | thread2.start() |
| 3757 | time.sleep(10) |
| 3758 | thread1.join() |
| 3759 | thread2.join() |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3760 | dhcp_flow_status = self.success |
| 3761 | try: |
| 3762 | # if self.success is not True: |
| 3763 | assert_equal(dhcp_flow_status, True) |
| 3764 | #assert_equal(status, True) |
| 3765 | time.sleep(10) |
| 3766 | finally: |
| 3767 | self.voltha.disable_device(device_id, delete = True) |
| 3768 | self.remove_olt(switch_map) |
| 3769 | df.callback(0) |
| 3770 | |
| 3771 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3772 | return df |
| 3773 | |
| 3774 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3775 | def test_two_subscribers_with_voltha_for_dhcp_and_with_multiple_discover_for_one_subscriber(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3776 | """ |
| 3777 | Test Method: |
| 3778 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3779 | 1. OLT and ONU is detected and validated. |
| 3780 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3781 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 3782 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 3783 | 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber. |
| 3784 | 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 |
| 3785 | """ |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3786 | |
| 3787 | df = defer.Deferred() |
| 3788 | self.success = True |
| 3789 | dhcp_app = 'org.onosproject.dhcp' |
| 3790 | def dhcp_flow_check_scenario(df): |
| 3791 | log_test.info('Enabling ponsim_olt') |
| 3792 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3793 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3794 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3795 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3796 | time.sleep(10) |
| 3797 | switch_map = None |
| 3798 | olt_configured = False |
| 3799 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3800 | log_test.info('Installing OLT app') |
| 3801 | OnosCtrl.install_app(self.olt_app_file) |
| 3802 | time.sleep(5) |
| 3803 | log_test.info('Adding subscribers through OLT app') |
| 3804 | self.config_olt(switch_map) |
| 3805 | olt_configured = True |
| 3806 | time.sleep(5) |
| 3807 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"multiple_discover",)) |
| 3808 | thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,)) |
| 3809 | thread1.start() |
| 3810 | thread2.start() |
| 3811 | time.sleep(10) |
| 3812 | thread1.join() |
| 3813 | thread2.join() |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3814 | dhcp_flow_status = self.success |
| 3815 | try: |
| 3816 | # if self.success is not True: |
| 3817 | assert_equal(dhcp_flow_status, True) |
| 3818 | #assert_equal(status, True) |
| 3819 | time.sleep(10) |
| 3820 | finally: |
| 3821 | self.voltha.disable_device(device_id, delete = True) |
| 3822 | self.remove_olt(switch_map) |
| 3823 | df.callback(0) |
| 3824 | |
| 3825 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3826 | return df |
| 3827 | |
| 3828 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3829 | def test_two_subscribers_with_voltha_for_dhcp_discover_and_desired_ip_address_for_one_subscriber(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3830 | """ |
| 3831 | Test Method: |
| 3832 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3833 | 1. OLT and ONU is detected and validated. |
| 3834 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3835 | 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app. |
| 3836 | 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app. |
| 3837 | 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully. |
| 3838 | """ |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3839 | |
| 3840 | df = defer.Deferred() |
| 3841 | self.success = True |
| 3842 | dhcp_app = 'org.onosproject.dhcp' |
| 3843 | def dhcp_flow_check_scenario(df): |
| 3844 | log_test.info('Enabling ponsim_olt') |
| 3845 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3846 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3847 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3848 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3849 | time.sleep(10) |
| 3850 | switch_map = None |
| 3851 | olt_configured = False |
| 3852 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3853 | log_test.info('Installing OLT app') |
| 3854 | OnosCtrl.install_app(self.olt_app_file) |
| 3855 | time.sleep(5) |
| 3856 | log_test.info('Adding subscribers through OLT app') |
| 3857 | self.config_olt(switch_map) |
| 3858 | olt_configured = True |
| 3859 | time.sleep(5) |
| 3860 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 3861 | thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_ip_address",)) |
| 3862 | thread1.start() |
| 3863 | thread2.start() |
| 3864 | time.sleep(10) |
| 3865 | thread1.join() |
| 3866 | thread2.join() |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3867 | dhcp_flow_status = self.success |
| 3868 | try: |
| 3869 | # if self.success is not True: |
| 3870 | assert_equal(dhcp_flow_status, True) |
| 3871 | #assert_equal(status, True) |
| 3872 | time.sleep(10) |
| 3873 | finally: |
| 3874 | self.voltha.disable_device(device_id, delete = True) |
| 3875 | self.remove_olt(switch_map) |
| 3876 | df.callback(0) |
| 3877 | |
| 3878 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3879 | return df |
| 3880 | |
| 3881 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 3882 | def test_two_subscribers_with_voltha_for_dhcp_discover_within_and_without_dhcp_pool_ip_addresses(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3883 | """ |
| 3884 | Test Method: |
| 3885 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3886 | 1. OLT and ONU is detected and validated. |
| 3887 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3888 | 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app. |
| 3889 | 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app. |
| 3890 | 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully. |
| 3891 | """ |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3892 | df = defer.Deferred() |
| 3893 | self.success = True |
| 3894 | dhcp_app = 'org.onosproject.dhcp' |
| 3895 | def dhcp_flow_check_scenario(df): |
| 3896 | log_test.info('Enabling ponsim_olt') |
| 3897 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3898 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3899 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3900 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3901 | time.sleep(10) |
| 3902 | switch_map = None |
| 3903 | olt_configured = False |
| 3904 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3905 | log_test.info('Installing OLT app') |
| 3906 | OnosCtrl.install_app(self.olt_app_file) |
| 3907 | time.sleep(5) |
| 3908 | log_test.info('Adding subscribers through OLT app') |
| 3909 | self.config_olt(switch_map) |
| 3910 | olt_configured = True |
| 3911 | time.sleep(5) |
| 3912 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",)) |
| 3913 | thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",)) |
| 3914 | thread1.start() |
| 3915 | thread2.start() |
| 3916 | time.sleep(10) |
| 3917 | thread1.join() |
| 3918 | thread2.join() |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3919 | dhcp_flow_status = self.success |
| 3920 | try: |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3921 | assert_equal(dhcp_flow_status, True) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3922 | time.sleep(10) |
| 3923 | finally: |
| 3924 | self.voltha.disable_device(device_id, delete = True) |
| 3925 | self.remove_olt(switch_map) |
| 3926 | df.callback(0) |
| 3927 | |
| 3928 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3929 | return df |
| 3930 | |
| 3931 | @deferred(TESTCASE_TIMEOUT) |
| 3932 | def test_two_subscribers_with_voltha_for_dhcp_disabling_onu_port_for_one_subscriber(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3933 | """ |
| 3934 | Test Method: |
| 3935 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3936 | 1. OLT and ONU is detected and validated. |
| 3937 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3938 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 3939 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 3940 | 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber. |
| 3941 | 6. Repeat step 3 and 4 for one subscriber where uni port is down. |
| 3942 | 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed. |
| 3943 | """ |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3944 | df = defer.Deferred() |
| 3945 | self.success = True |
| 3946 | dhcp_app = 'org.onosproject.dhcp' |
| 3947 | def dhcp_flow_check_scenario(df): |
| 3948 | log_test.info('Enabling ponsim_olt') |
| 3949 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 3950 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 3951 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 3952 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3953 | time.sleep(10) |
| 3954 | switch_map = None |
| 3955 | olt_configured = False |
| 3956 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 3957 | log_test.info('Installing OLT app') |
| 3958 | OnosCtrl.install_app(self.olt_app_file) |
| 3959 | time.sleep(5) |
| 3960 | log_test.info('Adding subscribers through OLT app') |
| 3961 | self.config_olt(switch_map) |
| 3962 | olt_configured = True |
| 3963 | time.sleep(5) |
| 3964 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,"desired_ip_address",)) |
| 3965 | thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,"desired_out_of_pool_ip_address",)) |
| 3966 | thread1.start() |
| 3967 | thread2.start() |
| 3968 | time.sleep(10) |
| 3969 | thread1.join() |
| 3970 | thread2.join() |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3971 | dhcp_flow_status = self.success |
| 3972 | try: |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3973 | assert_equal(dhcp_flow_status, True) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3974 | time.sleep(10) |
| 3975 | finally: |
| 3976 | self.voltha.disable_device(device_id, delete = True) |
| 3977 | self.remove_olt(switch_map) |
| 3978 | df.callback(0) |
| 3979 | |
| 3980 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 3981 | return df |
| 3982 | |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3983 | @deferred(TESTCASE_TIMEOUT) |
| 3984 | def test_two_subscribers_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 3985 | """ |
| 3986 | Test Method: |
| 3987 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 3988 | 1. OLT and ONU is detected and validated. |
| 3989 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 3990 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 3991 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 3992 | 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber. |
| 3993 | 6. Repeat step 3 and 4 for one subscriber where uni port is down. |
| 3994 | 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed. |
| 3995 | 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber. |
| 3996 | 9. Repeat step 3 and 4 for one subscriber where uni port is up now. |
| 3997 | 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed. |
| 3998 | """ |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 3999 | df = defer.Deferred() |
| 4000 | self.success = True |
| 4001 | dhcp_app = 'org.onosproject.dhcp' |
| 4002 | def dhcp_flow_check_scenario(df): |
| 4003 | log_test.info('Enabling ponsim_olt') |
| 4004 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4005 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4006 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 4007 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 4008 | time.sleep(10) |
| 4009 | switch_map = None |
| 4010 | olt_configured = False |
| 4011 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4012 | log_test.info('Installing OLT app') |
| 4013 | OnosCtrl.install_app(self.olt_app_file) |
| 4014 | time.sleep(5) |
| 4015 | log_test.info('Adding subscribers through OLT app') |
| 4016 | self.config_olt(switch_map) |
| 4017 | olt_configured = True |
| 4018 | time.sleep(5) |
| 4019 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 4020 | thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,)) |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 4021 | thread3 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.INTF_2_RX_DEFAULT,)) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 4022 | thread1.start() |
| 4023 | thread2.start() |
| 4024 | thread3.start() |
| 4025 | time.sleep(10) |
| 4026 | thread1.join() |
| 4027 | thread2.join() |
| 4028 | thread3.join() |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 4029 | dhcp_flow_status = self.success |
| 4030 | try: |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 4031 | assert_equal(dhcp_flow_status, True) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 4032 | time.sleep(10) |
| 4033 | finally: |
| 4034 | self.voltha.disable_device(device_id, delete = True) |
| 4035 | self.remove_olt(switch_map) |
| 4036 | df.callback(0) |
| 4037 | |
| 4038 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 4039 | return df |
| 4040 | |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 4041 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4042 | def test_two_subscribers_with_voltha_for_dhcp_disabling_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4043 | """ |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4044 | Test Method: uni_port |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4045 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4046 | 1. OLT and ONU is detected and validated. |
| 4047 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4048 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 4049 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 4050 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 4051 | 6. Disable the olt device which is detected in voltha. |
| 4052 | 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed. |
| 4053 | """ |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4054 | df = defer.Deferred() |
| 4055 | self.success = True |
| 4056 | dhcp_app = 'org.onosproject.dhcp' |
| 4057 | def dhcp_flow_check_scenario(df): |
| 4058 | log_test.info('Enabling ponsim_olt') |
| 4059 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4060 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4061 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 4062 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4063 | time.sleep(10) |
| 4064 | switch_map = None |
| 4065 | olt_configured = False |
| 4066 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4067 | log_test.info('Installing OLT app') |
| 4068 | OnosCtrl.install_app(self.olt_app_file) |
| 4069 | time.sleep(5) |
| 4070 | log_test.info('Adding subscribers through OLT app') |
| 4071 | self.config_olt(switch_map) |
| 4072 | olt_configured = True |
| 4073 | time.sleep(5) |
| 4074 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 4075 | thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,)) |
| 4076 | thread3 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,)) |
| 4077 | |
| 4078 | thread1.start() |
| 4079 | thread2.start() |
| 4080 | thread3.start() |
| 4081 | time.sleep(10) |
| 4082 | thread1.join() |
| 4083 | thread2.join() |
| 4084 | thread3.join() |
| 4085 | dhcp_flow_status = self.success |
| 4086 | try: |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4087 | assert_equal(dhcp_flow_status, True) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4088 | time.sleep(10) |
| 4089 | finally: |
| 4090 | self.voltha.disable_device(device_id, delete = True) |
| 4091 | self.remove_olt(switch_map) |
| 4092 | df.callback(0) |
| 4093 | |
| 4094 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 4095 | return df |
| 4096 | |
| 4097 | @deferred(TESTCASE_TIMEOUT) |
| 4098 | def test_two_subscribers_with_voltha_for_dhcp_toggling_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4099 | """ |
| 4100 | Test Method: |
| 4101 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4102 | 1. OLT and ONU is detected and validated. |
| 4103 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4104 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 4105 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 4106 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 4107 | 6. Disable the olt device which is detected in voltha. |
| 4108 | 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed. |
| 4109 | 8. Enable the olt device which is detected in voltha. |
| 4110 | 9. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed. |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4111 | |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4112 | """ |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4113 | df = defer.Deferred() |
| 4114 | self.success = True |
| 4115 | dhcp_app = 'org.onosproject.dhcp' |
| 4116 | def dhcp_flow_check_scenario(df): |
| 4117 | log_test.info('Enabling ponsim_olt') |
| 4118 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4119 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4120 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 4121 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4122 | time.sleep(10) |
| 4123 | switch_map = None |
| 4124 | olt_configured = False |
| 4125 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4126 | log_test.info('Installing OLT app') |
| 4127 | OnosCtrl.install_app(self.olt_app_file) |
| 4128 | time.sleep(5) |
| 4129 | log_test.info('Adding subscribers through OLT app') |
| 4130 | self.config_olt(switch_map) |
| 4131 | olt_configured = True |
| 4132 | time.sleep(5) |
| 4133 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 4134 | thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,)) |
| 4135 | thread3 = threading.Thread(target = self.voltha.restart_device, args = (device_id,)) |
| 4136 | thread1.start() |
| 4137 | thread2.start() |
| 4138 | thread3.start() |
| 4139 | time.sleep(10) |
| 4140 | thread1.join() |
| 4141 | thread2.join() |
| 4142 | thread3.join() |
| 4143 | dhcp_flow_status = self.success |
| 4144 | try: |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4145 | assert_equal(dhcp_flow_status, True) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4146 | time.sleep(10) |
| 4147 | finally: |
| 4148 | self.voltha.disable_device(device_id, delete = True) |
| 4149 | self.remove_olt(switch_map) |
| 4150 | df.callback(0) |
| 4151 | |
| 4152 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 4153 | return df |
| 4154 | |
| 4155 | @deferred(TESTCASE_TIMEOUT) |
| 4156 | def test_two_subscribers_with_voltha_for_dhcp_with_paused_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4157 | """ |
| 4158 | Test Method: |
| 4159 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4160 | 1. OLT and ONU is detected and validated. |
| 4161 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4162 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 4163 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 4164 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 4165 | 6. Pause the olt device which is detected in voltha. |
| 4166 | 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed. |
| 4167 | """ |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4168 | df = defer.Deferred() |
| 4169 | self.success = True |
| 4170 | dhcp_app = 'org.onosproject.dhcp' |
| 4171 | def dhcp_flow_check_scenario(df): |
| 4172 | log_test.info('Enabling ponsim_olt') |
| 4173 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4174 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4175 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 4176 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4177 | time.sleep(10) |
| 4178 | switch_map = None |
| 4179 | olt_configured = False |
| 4180 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4181 | log_test.info('Installing OLT app') |
| 4182 | OnosCtrl.install_app(self.olt_app_file) |
| 4183 | time.sleep(5) |
| 4184 | log_test.info('Adding subscribers through OLT app') |
| 4185 | self.config_olt(switch_map) |
| 4186 | olt_configured = True |
| 4187 | time.sleep(5) |
| 4188 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 4189 | thread2 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_2_RX_DEFAULT,)) |
| 4190 | thread3 = threading.Thread(target = self.voltha.pause_device, args = (device_id,)) |
| 4191 | thread1.start() |
| 4192 | thread2.start() |
| 4193 | thread3.start() |
| 4194 | time.sleep(10) |
| 4195 | thread1.join() |
| 4196 | thread2.join() |
| 4197 | thread3.join() |
| 4198 | dhcp_flow_status = self.success |
| 4199 | try: |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4200 | assert_equal(dhcp_flow_status, True) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4201 | time.sleep(10) |
| 4202 | finally: |
| 4203 | self.voltha.disable_device(device_id, delete = True) |
| 4204 | self.remove_olt(switch_map) |
| 4205 | df.callback(0) |
| 4206 | |
| 4207 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 4208 | return df |
| 4209 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4210 | def test_3_subscribers_with_voltha_for_dhcp_discover_requests(self): |
| 4211 | """ |
| 4212 | Test Method: |
| 4213 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4214 | 1. OLT and ONU is detected and validated. |
| 4215 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers) |
| 4216 | 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app. |
| 4217 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 4218 | """ |
| 4219 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 4220 | num_subscribers = 3 |
| 4221 | num_channels = 1 |
| 4222 | services = ('DHCP') |
| 4223 | cbs = (self.dhcp_flow_check, None, None) |
| 4224 | self.voltha_subscribers(services, cbs = cbs, |
| 4225 | num_subscribers = num_subscribers, |
| 4226 | num_channels = num_channels) |
| 4227 | |
| 4228 | def test_5_subscribers_with_voltha_for_dhcp_discover_requests(self): |
| 4229 | """ |
| 4230 | Test Method: |
| 4231 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4232 | 1. OLT and ONU is detected and validated. |
| 4233 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers) |
| 4234 | 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app. |
| 4235 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 4236 | """ |
| 4237 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 4238 | num_subscribers = 5 |
| 4239 | num_channels = 1 |
| 4240 | services = ('DHCP') |
| 4241 | cbs = (self.dhcp_flow_check, None, None) |
| 4242 | self.voltha_subscribers(services, cbs = cbs, |
| 4243 | num_subscribers = num_subscribers, |
| 4244 | num_channels = num_channels) |
| 4245 | |
| 4246 | def test_9_subscribers_with_voltha_for_dhcp_discover_requests(self): |
| 4247 | """ |
| 4248 | Test Method: |
| 4249 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4250 | 1. OLT and ONU is detected and validated. |
| 4251 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers) |
| 4252 | 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app. |
| 4253 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 4254 | """ |
| 4255 | """Test subscriber join next for channel surfing with 9 subscribers browsing 1 channels each""" |
| 4256 | num_subscribers = 9 |
| 4257 | num_channels = 1 |
| 4258 | services = ('DHCP') |
| 4259 | cbs = (self.dhcp_flow_check, None, None) |
| 4260 | self.voltha_subscribers(services, cbs = cbs, |
| 4261 | num_subscribers = num_subscribers, |
| 4262 | num_channels = num_channels) |
| 4263 | |
| 4264 | def test_3_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self): |
| 4265 | """ |
| 4266 | Test Method: |
| 4267 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4268 | 1. OLT and ONU is detected and validated. |
| 4269 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (3 subscribers) |
| 4270 | 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app. |
| 4271 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 4272 | """ |
| 4273 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 4274 | num_subscribers = 3 |
| 4275 | num_channels = 1 |
| 4276 | services = ('TLS','DHCP') |
| 4277 | cbs = (self.tls_flow_check, self.dhcp_flow_check, None) |
| 4278 | self.voltha_subscribers(services, cbs = cbs, |
| 4279 | num_subscribers = num_subscribers, |
| 4280 | num_channels = num_channels) |
| 4281 | |
| 4282 | def test_5_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self): |
| 4283 | """ |
| 4284 | Test Method: |
| 4285 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4286 | 1. OLT and ONU is detected and validated. |
| 4287 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (5 subscribers) |
| 4288 | 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app. |
| 4289 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 4290 | """ |
| 4291 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 4292 | num_subscribers = 5 |
| 4293 | num_channels = 1 |
| 4294 | services = ('TLS','DHCP') |
| 4295 | cbs = (self.tls_flow_check, self.dhcp_flow_check, None) |
| 4296 | self.voltha_subscribers(services, cbs = cbs, |
| 4297 | num_subscribers = num_subscribers, |
| 4298 | num_channels = num_channels) |
| 4299 | |
| 4300 | def test_9_subscribers_with_voltha_for_tls_auth_and_dhcp_discover_flows(self): |
| 4301 | """ |
| 4302 | Test Method: |
| 4303 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4304 | 1. OLT and ONU is detected and validated. |
| 4305 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as multiple subscribers (9 subscribers) |
| 4306 | 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app. |
| 4307 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 4308 | """ |
| 4309 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 4310 | num_subscribers = 9 |
| 4311 | num_channels = 1 |
| 4312 | services = ('TLS','DHCP') |
| 4313 | cbs = (self.tls_flow_check, self.dhcp_flow_check, None) |
| 4314 | self.voltha_subscribers(services, cbs = cbs, |
| 4315 | num_subscribers = num_subscribers, |
| 4316 | num_channels = num_channels) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4317 | |
| 4318 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4319 | def test_subscriber_with_voltha_for_dhcprelay_request(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4320 | """ |
| 4321 | Test Method: |
| 4322 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4323 | 1. OLT and ONU is detected and validated. |
| 4324 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4325 | 3. Send dhcp request from residential subscrber to external dhcp server. |
| 4326 | 4. Verify that subscriber get ip from external dhcp server successfully. |
| 4327 | """ |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4328 | self.dhcprelay_setUpClass() |
| 4329 | # if not port_list: |
| 4330 | port_list = self.generate_port_list(1, 0) |
| 4331 | iface = self.port_map['ports'][port_list[1][1]] |
| 4332 | mac = self.get_mac(iface) |
| 4333 | self.host_load(iface) |
| 4334 | ##we use the defaults for this test that serves as an example for others |
| 4335 | ##You don't need to restart dhcpd server if retaining default config |
| 4336 | config = self.default_config |
| 4337 | options = self.default_options |
| 4338 | subnet = self.default_subnet_config |
| 4339 | dhcpd_interface_list = self.relay_interfaces |
| 4340 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4341 | config = config, |
| 4342 | options = options, |
| 4343 | subnet = subnet) |
| 4344 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface) |
| 4345 | self.send_recv(mac=mac) |
| 4346 | self.dhcprelay_tearDwonClass() |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4347 | |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4348 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4349 | def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_broadcast_source_mac(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4350 | """ |
| 4351 | Test Method: |
| 4352 | 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup. |
| 4353 | 1. OLT and ONU is detected and validated. |
| 4354 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4355 | 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server. |
| 4356 | 4. Verify that subscriber should not get ip from external dhcp server. |
| 4357 | """ |
| 4358 | |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4359 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4360 | def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_multicast_source_mac(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4361 | """ |
| 4362 | Test Method: |
| 4363 | 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup. |
| 4364 | 1. OLT and ONU is detected and validated. |
| 4365 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4366 | 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server. |
| 4367 | 4. Verify that subscriber should not get ip from external dhcp server. |
| 4368 | """ |
| 4369 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4370 | def test_subscriber_with_voltha_for_dhcprelay_request_with_invalid_source_mac(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4371 | """ |
| 4372 | Test Method: |
| 4373 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4374 | 1. OLT and ONU is detected and validated. |
| 4375 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4376 | 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server. |
| 4377 | 4. Verify that subscriber should not get ip from external dhcp server. |
| 4378 | """ |
| 4379 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4380 | def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4381 | """ |
| 4382 | Test Method: |
| 4383 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4384 | 1. OLT and ONU is detected and validated. |
| 4385 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4386 | 3. Send dhcp request from residential subscrber to external dhcp server. |
| 4387 | 4. Verify that subscriber get ip from external dhcp server successfully. |
| 4388 | 5. Send dhcp release from residential subscrber to external dhcp server. |
| 4389 | 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway. |
| 4390 | """ |
| 4391 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4392 | def test_subscriber_with_voltha_for_dhcprelay_starvation(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4393 | """ |
| 4394 | Test Method: |
| 4395 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4396 | 1. OLT and ONU is detected and validated. |
| 4397 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4398 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4399 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4400 | 5. Repeat step 3 and 4 for 10 times. |
| 4401 | 6 Verify that subscriber should get ip from external dhcp server.. |
| 4402 | """ |
| 4403 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4404 | def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4405 | """ |
| 4406 | Test Method: |
| 4407 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4408 | 1. OLT and ONU is detected and validated. |
| 4409 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4410 | 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server. |
| 4411 | 4. Verify that subscriber should not get ip from external dhcp server.. |
| 4412 | 5. Repeat steps 3 and 4 for 10 times. |
| 4413 | 6 Verify that subscriber should not get ip from external dhcp server.. |
| 4414 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4415 | def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4416 | """ |
| 4417 | Test Method: |
| 4418 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4419 | 1. OLT and ONU is detected and validated. |
| 4420 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4421 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4422 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4423 | 5. Repeat step 3 for 50 times. |
| 4424 | 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server.. |
| 4425 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4426 | def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_request(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4427 | """ |
| 4428 | Test Method: |
| 4429 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4430 | 1. OLT and ONU is detected and validated. |
| 4431 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4432 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4433 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4434 | 5. Send DHCP request to external dhcp server. |
| 4435 | 6. Repeat step 5 for 50 times. |
| 4436 | 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server.. |
| 4437 | """ |
| 4438 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4439 | def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_ip_address(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4440 | """ |
| 4441 | Test Method: |
| 4442 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4443 | 1. OLT and ONU is detected and validated. |
| 4444 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4445 | 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server. |
| 4446 | 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully. |
| 4447 | """ |
| 4448 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4449 | def test_subscriber_with_voltha_for_dhcprelay_requesting_desired_out_of_pool_ip_address(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4450 | """ |
| 4451 | Test Method: |
| 4452 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4453 | 1. OLT and ONU is detected and validated. |
| 4454 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4455 | 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server. |
| 4456 | 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. |
| 4457 | """ |
| 4458 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4459 | def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4460 | """ |
| 4461 | Test Method: |
| 4462 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4463 | 1. OLT and ONU is detected and validated. |
| 4464 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4465 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4466 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4467 | 5. Deactivate dhcp server app in onos. |
| 4468 | 6. Repeat step 3. |
| 4469 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 4470 | """ |
| 4471 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4472 | def test_subscriber_with_voltha_for_dhcprelay_renew_time(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4473 | """ |
| 4474 | Test Method: |
| 4475 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4476 | 1. OLT and ONU is detected and validated. |
| 4477 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4478 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4479 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4480 | 5. Send dhcp renew packet to external dhcp server. |
| 4481 | 6. Repeat step 4. |
| 4482 | """ |
| 4483 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4484 | def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4485 | """ |
| 4486 | Test Method: |
| 4487 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4488 | 1. OLT and ONU is detected and validated. |
| 4489 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4490 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4491 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4492 | 5. Send dhcp rebind packet to external dhcp server. |
| 4493 | 6. Repeat step 4. |
| 4494 | """ |
| 4495 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4496 | def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4497 | """ |
| 4498 | Test Method: |
| 4499 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4500 | 1. OLT and ONU is detected and validated. |
| 4501 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4502 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4503 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4504 | 5. Disable olt devices which is being detected in voltha CLI. |
| 4505 | 6. Repeat step 3. |
| 4506 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 4507 | """ |
| 4508 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4509 | def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4510 | """ |
| 4511 | Test Method: |
| 4512 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4513 | 1. OLT and ONU is detected and validated. |
| 4514 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4515 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4516 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4517 | 5. Disable olt devices which is being detected in voltha CLI. |
| 4518 | 6. Repeat step 3. |
| 4519 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 4520 | 8. Enable olt devices which is being detected in voltha CLI. |
| 4521 | 9. Repeat steps 3 and 4. |
| 4522 | """ |
| 4523 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4524 | def test_subscriber_with_voltha_for_dhcprelay_disable_onu_port_in_voltha(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4525 | """ |
| 4526 | Test Method: |
| 4527 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4528 | 1. OLT and ONU is detected and validated. |
| 4529 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4530 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4531 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4532 | 5. Disable onu port which is being detected in voltha CLI. |
| 4533 | 6. Repeat step 3. |
| 4534 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 4535 | """ |
| 4536 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4537 | def test_subscriber_with_voltha_for_dhcprelay_disable_enable_onu_port_in_voltha(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4538 | """ |
| 4539 | Test Method: |
| 4540 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4541 | 1. OLT and ONU is detected and validated. |
| 4542 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4543 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4544 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4545 | 5. Disable onu port which is being detected in voltha CLI. |
| 4546 | 6. Repeat step 3. |
| 4547 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 4548 | 8. Enable onu port which is being detected in voltha CLI. |
| 4549 | 9. Repeat steps 3 and 4. |
| 4550 | """ |
| 4551 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4552 | def test_two_subscribers_with_voltha_for_dhcprelay_discover(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4553 | """ |
| 4554 | Test Method: |
| 4555 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4556 | 1. OLT and ONU is detected and validated. |
| 4557 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4558 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 4559 | 4. Verify that subscribers had got different ips from external dhcp server. successfully. |
| 4560 | """ |
| 4561 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4562 | def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4563 | """ |
| 4564 | Test Method: |
| 4565 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4566 | 1. OLT and ONU is detected and validated. |
| 4567 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4568 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 4569 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 4570 | 5. Repeat step 3 and 4 for 10 times for both subscribers. |
| 4571 | 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server.. |
| 4572 | """ |
| 4573 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4574 | def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover_for_one_subscriber(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4575 | """ |
| 4576 | Test Method: |
| 4577 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4578 | 1. OLT and ONU is detected and validated. |
| 4579 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4580 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 4581 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 4582 | 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber. |
| 4583 | 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 |
| 4584 | """ |
| 4585 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4586 | def test_two_subscribers_with_voltha_for_dhcprelay_discover_desired_ip_address_for_one_subscriber(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4587 | """ |
| 4588 | Test Method: |
| 4589 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4590 | 1. OLT and ONU is detected and validated. |
| 4591 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4592 | 3. Send dhcp request from one residential subscriber to external dhcp server. |
| 4593 | 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server. |
| 4594 | 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully. |
| 4595 | """ |
| 4596 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4597 | def test_two_subscribers_with_voltha_for_dhcprelay_discover_for_in_range_and_out_of_range_from_dhcp_pool_ip_addresses(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4598 | """ |
| 4599 | Test Method: |
| 4600 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4601 | 1. OLT and ONU is detected and validated. |
| 4602 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4603 | 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server. |
| 4604 | 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server. |
| 4605 | 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully. |
| 4606 | """ |
| 4607 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4608 | def test_two_subscribers_with_voltha_for_dhcprelay_disabling_onu_port_for_one_subscriber(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4609 | """ |
| 4610 | Test Method: |
| 4611 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4612 | 1. OLT and ONU is detected and validated. |
| 4613 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4614 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 4615 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 4616 | 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber. |
| 4617 | 6. Repeat step 3 and 4 for one subscriber where uni port is down. |
| 4618 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed. |
| 4619 | """ |
| 4620 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4621 | def test_two_subscribers_with_voltha_for_dhcprelay_toggling_onu_port_for_one_subscriber(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4622 | """ |
| 4623 | Test Method: |
| 4624 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4625 | 1. OLT and ONU is detected and validated. |
| 4626 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4627 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 4628 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 4629 | 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber. |
| 4630 | 6. Repeat step 3 and 4 for one subscriber where uni port is down. |
| 4631 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed. |
| 4632 | 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber. |
| 4633 | 9. Repeat step 3 and 4 for one subscriber where uni port is up now. |
| 4634 | 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed. |
| 4635 | """ |
| 4636 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4637 | def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4638 | """ |
| 4639 | Test Method: |
| 4640 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4641 | 1. OLT and ONU is detected and validated. |
| 4642 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4643 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 4644 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 4645 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 4646 | 6. Disable the olt device which is detected in voltha. |
| 4647 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed. |
| 4648 | """ |
| 4649 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4650 | def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4651 | """ |
| 4652 | Test Method: |
| 4653 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4654 | 1. OLT and ONU is detected and validated. |
| 4655 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4656 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 4657 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 4658 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 4659 | 6. Disable the olt device which is detected in voltha. |
| 4660 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed. |
| 4661 | 8. Enable the olt device which is detected in voltha. |
| 4662 | 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed. |
| 4663 | """ |
| 4664 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4665 | def test_two_subscribers_with_voltha_for_dhcprelay_with_paused_olt_detected(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4666 | """ |
| 4667 | Test Method: |
| 4668 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4669 | 1. OLT and ONU is detected and validated. |
| 4670 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4671 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 4672 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 4673 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 4674 | 6. Pause the olt device which is detected in voltha. |
| 4675 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed. |
| 4676 | """ |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4677 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4678 | def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4679 | """ |
| 4680 | Test Method: |
| 4681 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4682 | 1. OLT and ONU is detected and validated. |
| 4683 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4684 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4685 | 4. Send igmp joins for a multicast group address multi-group-addressA. |
| 4686 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU. |
| 4687 | 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 4688 | """ |
| 4689 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4690 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 4691 | num_subscribers = 1 |
| 4692 | num_channels = 1 |
| 4693 | services = ('IGMP') |
| 4694 | cbs = (self.igmp_flow_check, None, None) |
| 4695 | self.voltha_subscribers(services, cbs = cbs, |
| 4696 | num_subscribers = num_subscribers, |
| 4697 | num_channels = num_channels) |
| 4698 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4699 | def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4700 | """ |
| 4701 | Test Method: |
| 4702 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4703 | 1. OLT and ONU is detected and validated. |
| 4704 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4705 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4706 | 4. Send igmp joins for a multicast group address multi-group-addressA. |
| 4707 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU. |
| 4708 | 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester. |
| 4709 | 7. Send igmp leave for a multicast group address multi-group-addressA. |
| 4710 | 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester. |
| 4711 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4712 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 4713 | num_subscribers = 1 |
| 4714 | num_channels = 1 |
| 4715 | services = ('IGMP') |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 4716 | cbs = (self.igmp_leave_flow_check, None, None) |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4717 | self.voltha_subscribers(services, cbs = cbs, |
| 4718 | num_subscribers = num_subscribers, |
| 4719 | num_channels = num_channels) |
| 4720 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4721 | def test_subscriber_with_voltha_for_igmp_leave_and_again_join_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4722 | """ |
| 4723 | Test Method: |
| 4724 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4725 | 1. OLT and ONU is detected and validated. |
| 4726 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4727 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4728 | 4. Send igmp joins for a multicast group address multi-group-addressA. |
| 4729 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU. |
| 4730 | 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester. |
| 4731 | 7. Send igmp leave for a multicast group address multi-group-addressA. |
| 4732 | 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester. |
| 4733 | 9. Repeat steps 4 to 6. |
| 4734 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4735 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 4736 | num_subscribers = 1 |
| 4737 | num_channels = 1 |
| 4738 | services = ('IGMP') |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 4739 | cbs = (self.igmp_leave_flow_check, None, None) |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4740 | self.voltha_subscribers(services, cbs = cbs, |
| 4741 | num_subscribers = num_subscribers, |
| 4742 | num_channels = num_channels) |
| 4743 | |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 4744 | def test_subscriber_with_voltha_for_igmp_5_groups_joins_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4745 | """ |
| 4746 | Test Method: |
| 4747 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4748 | 1. OLT and ONU is detected and validated. |
| 4749 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4750 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4751 | 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB |
| 4752 | 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU. |
| 4753 | 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 4754 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4755 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 4756 | num_subscribers = 1 |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 4757 | num_channels = 5 |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4758 | services = ('IGMP') |
| 4759 | cbs = (self.igmp_flow_check, None, None) |
| 4760 | self.voltha_subscribers(services, cbs = cbs, |
| 4761 | num_subscribers = num_subscribers, |
| 4762 | num_channels = num_channels) |
| 4763 | |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 4764 | def test_subscriber_with_voltha_for_igmp_5_groups_joins_and_leave_for_one_group_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4765 | """ |
| 4766 | Test Method: |
| 4767 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4768 | 1. OLT and ONU is detected and validated. |
| 4769 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4770 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4771 | 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB |
| 4772 | 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU. |
| 4773 | 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 4774 | 7. Send igmp leave for a multicast group address multi-group-addressA. |
| 4775 | 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. |
| 4776 | 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester. |
| 4777 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4778 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 4779 | num_subscribers = 1 |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 4780 | num_channels = 5 |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4781 | services = ('IGMP') |
| 4782 | cbs = (self.igmp_flow_check, None, None) |
| 4783 | self.voltha_subscribers(services, cbs = cbs, |
| 4784 | num_subscribers = num_subscribers, |
| 4785 | num_channels = num_channels) |
| 4786 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4787 | def test_subscriber_with_voltha_for_igmp_join_different_group_src_list_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4788 | """ |
| 4789 | Test Method: |
| 4790 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4791 | 1. OLT and ONU is detected and validated. |
| 4792 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4793 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4794 | 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA |
| 4795 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 4796 | 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 4797 | 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU. |
| 4798 | 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 4799 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4800 | num_subscribers = 1 |
| 4801 | num_channels = 1 |
| 4802 | services = ('IGMP') |
| 4803 | cbs = (self.igmp_flow_check, None, None) |
| 4804 | self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'], |
| 4805 | num_subscribers = num_subscribers, |
| 4806 | num_channels = num_channels) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4807 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4808 | def test_subscriber_with_voltha_for_igmp_change_to_exclude_mcast_group_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4809 | """ |
| 4810 | Test Method: |
| 4811 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4812 | 1. OLT and ONU is detected and validated. |
| 4813 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4814 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4815 | 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA |
| 4816 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 4817 | 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 4818 | 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA |
| 4819 | 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 4820 | 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 4821 | """ |
| 4822 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4823 | num_subscribers = 1 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 4824 | num_channels = 1 |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4825 | services = ('IGMP') |
| 4826 | cbs = (self.igmp_flow_check_join_change_to_exclude, None, None) |
| 4827 | self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'], |
| 4828 | num_subscribers = num_subscribers, |
| 4829 | num_channels = num_channels) |
| 4830 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4831 | def test_subscriber_with_voltha_for_igmp_change_to_include_back_from_exclude_mcast_group_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4832 | """ |
| 4833 | Test Method: |
| 4834 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4835 | 1. OLT and ONU is detected and validated. |
| 4836 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4837 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4838 | 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA |
| 4839 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 4840 | 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester. |
| 4841 | 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA |
| 4842 | 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 4843 | 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 4844 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4845 | num_subscribers = 1 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 4846 | num_channels = 1 |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4847 | services = ('IGMP') |
| 4848 | cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None) |
| 4849 | self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'], |
| 4850 | num_subscribers = num_subscribers, |
| 4851 | num_channels = num_channels) |
| 4852 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4853 | def test_subscriber_with_voltha_for_igmp_change_to_block_src_list_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4854 | """ |
| 4855 | Test Method: |
| 4856 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4857 | 1. OLT and ONU is detected and validated. |
| 4858 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4859 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4860 | 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA |
| 4861 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 4862 | 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 4863 | 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA |
| 4864 | 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 4865 | 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 4866 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4867 | |
| 4868 | num_subscribers = 1 |
| 4869 | num_channels = 1 |
| 4870 | services = ('IGMP') |
| 4871 | cbs = (self.igmp_flow_check_join_change_to_block, None, None) |
| 4872 | self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'], |
| 4873 | num_subscribers = num_subscribers, |
| 4874 | num_channels = num_channels) |
| 4875 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4876 | def test_subscriber_with_voltha_for_igmp_allow_new_src_list_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4877 | """ |
| 4878 | Test Method: |
| 4879 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4880 | 1. OLT and ONU is detected and validated. |
| 4881 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4882 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4883 | 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA |
| 4884 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 4885 | 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 4886 | 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB |
| 4887 | 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU. |
| 4888 | 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 4889 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 4890 | |
| 4891 | num_subscribers = 1 |
| 4892 | num_channels = 1 |
| 4893 | services = ('IGMP') |
| 4894 | cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None) |
| 4895 | self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'], |
| 4896 | num_subscribers = num_subscribers, |
| 4897 | num_channels = num_channels) |
| 4898 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4899 | def test_subscriber_with_voltha_for_igmp_group_include_empty_src_list_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4900 | """ |
| 4901 | Test Method: |
| 4902 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4903 | 1. OLT and ONU is detected and validated. |
| 4904 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4905 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4906 | 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA |
| 4907 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 4908 | 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester. |
| 4909 | 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU. |
| 4910 | 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 4911 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4912 | |
| 4913 | num_subscribers = 1 |
| 4914 | num_channels = 1 |
| 4915 | services = ('IGMP') |
| 4916 | cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None) |
| 4917 | self.voltha_subscribers(services, cbs = cbs, src_list = ['0'], |
| 4918 | num_subscribers = num_subscribers, |
| 4919 | num_channels = num_channels) |
| 4920 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4921 | def test_subscribers_with_voltha_for_igmp_group_exclude_empty_src_list_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4922 | """ |
| 4923 | Test Method: |
| 4924 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4925 | 1. OLT and ONU is detected and validated. |
| 4926 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4927 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4928 | 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA |
| 4929 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 4930 | 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 4931 | 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU. |
| 4932 | 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 4933 | """ |
| 4934 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4935 | num_subscribers = 1 |
| 4936 | num_channels = 1 |
| 4937 | services = ('IGMP') |
| 4938 | cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None) |
| 4939 | self.voltha_subscribers(services, cbs = cbs, src_list = ['0'], |
| 4940 | num_subscribers = num_subscribers, |
| 4941 | num_channels = num_channels) |
| 4942 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4943 | def test_two_subscribers_with_voltha_for_igmp_join_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4944 | """ |
| 4945 | Test Method: |
| 4946 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4947 | 1. OLT and ONU is detected and validated. |
| 4948 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4949 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4950 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 4951 | 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port) |
| 4952 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 4953 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 4954 | 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 4955 | """ |
| 4956 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4957 | num_subscribers = 2 |
| 4958 | num_channels = 1 |
| 4959 | services = ('IGMP') |
| 4960 | cbs = (self.igmp_flow_check, None, None) |
| 4961 | self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'], |
| 4962 | num_subscribers = num_subscribers, |
| 4963 | num_channels = num_channels) |
| 4964 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4965 | def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self): |
| 4966 | """ |
| 4967 | Test Method: |
| 4968 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4969 | 1. OLT and ONU is detected and validated. |
| 4970 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4971 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4972 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 4973 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 4974 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 4975 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 4976 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 4977 | 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 4978 | 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 4979 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 4980 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4981 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 4982 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4983 | services = ('IGMP') |
| 4984 | cbs = (self.igmp_flow_check_join_change_to_exclude, None, None) |
| 4985 | self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'], |
| 4986 | num_subscribers = num_subscribers, |
| 4987 | num_channels = num_channels) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4988 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4989 | def test_two_subscribers_with_voltha_for_igmp_leave_join_for_one_subscriber_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 4990 | """ |
| 4991 | Test Method: |
| 4992 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 4993 | 1. OLT and ONU is detected and validated. |
| 4994 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4995 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 4996 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 4997 | 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port) |
| 4998 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 4999 | 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. |
| 5000 | 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. |
| 5001 | 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5002 | 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. |
| 5003 | 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. |
| 5004 | 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. |
| 5005 | """ |
| 5006 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5007 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5008 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5009 | services = ('IGMP') |
| 5010 | cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None) |
| 5011 | self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'], |
| 5012 | num_subscribers = num_subscribers, |
| 5013 | num_channels = num_channels) |
| 5014 | |
| 5015 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5016 | def test_two_subscribers_with_voltha_for_igmp_with_uni_port_down_for_one_subscriber_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 5017 | """ |
| 5018 | Test Method: |
| 5019 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5020 | 1. OLT and ONU is detected and validated. |
| 5021 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5022 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5023 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5024 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5025 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5026 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5027 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5028 | 9. Disable uni_2 port which is being shown on voltha CLI. |
| 5029 | 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5030 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5031 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5032 | #rx_port = self.port_map['ports'][port_list[i][1]] |
| 5033 | df = defer.Deferred() |
| 5034 | def igmp_flow_check_operating_onu_admin_state(df): |
| 5035 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5036 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5037 | services = ('IGMP') |
| 5038 | cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None) |
| 5039 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5040 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5041 | thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],)) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5042 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],)) |
| 5043 | thread1.start() |
| 5044 | time.sleep(randint(40,50)) |
| 5045 | log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha') |
| 5046 | thread2.start() |
| 5047 | time.sleep(10) |
| 5048 | thread1.join() |
| 5049 | thread2.join() |
| 5050 | try: |
| 5051 | assert_equal(self.success, False) |
| 5052 | log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check') |
| 5053 | time.sleep(10) |
| 5054 | finally: |
| 5055 | pass |
| 5056 | df.callback(0) |
| 5057 | reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df) |
| 5058 | return df |
| 5059 | |
| 5060 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 5061 | def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self): |
| 5062 | """ |
| 5063 | Test Method: |
| 5064 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5065 | 1. OLT and ONU is detected and validated. |
| 5066 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5067 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5068 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5069 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5070 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5071 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5072 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5073 | 9. Disable uni_2 port which is being shown on voltha CLI. |
| 5074 | 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5075 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5076 | 12. Enable uni_2 port which we disable at step 9. |
| 5077 | 13. Repeat step 5,6 and 8. |
| 5078 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5079 | df = defer.Deferred() |
| 5080 | def igmp_flow_check_operating_onu_admin_state(df): |
| 5081 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5082 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5083 | services = ('IGMP') |
| 5084 | cbs = (self.igmp_flow_check, None, None) |
| 5085 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5086 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5087 | thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],)) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5088 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],)) |
| 5089 | thread1.start() |
| 5090 | time.sleep(randint(50,60)) |
| 5091 | log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha') |
| 5092 | thread2.start() |
| 5093 | time.sleep(10) |
| 5094 | thread1.join() |
| 5095 | thread2.join() |
| 5096 | try: |
| 5097 | assert_equal(self.success, True) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5098 | 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 S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5099 | time.sleep(10) |
| 5100 | finally: |
| 5101 | pass |
| 5102 | df.callback(0) |
| 5103 | reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df) |
| 5104 | return df |
| 5105 | |
| 5106 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5107 | def test_two_subscribers_with_voltha_for_igmp_disabling_olt_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 5108 | """ |
| 5109 | Test Method: |
| 5110 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5111 | 1. OLT and ONU is detected and validated. |
| 5112 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5113 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5114 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5115 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5116 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5117 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5118 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5119 | 9. Disable olt device which is being shown on voltha CLI. |
| 5120 | 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5121 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5122 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5123 | df = defer.Deferred() |
| 5124 | def igmp_flow_check_operating_olt_admin_disble(df): |
| 5125 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5126 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5127 | services = ('IGMP') |
| 5128 | cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None) |
| 5129 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5130 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5131 | thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],)) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5132 | thread1.start() |
| 5133 | time.sleep(randint(50,60)) |
| 5134 | thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,)) |
| 5135 | thread2.start() |
| 5136 | time.sleep(10) |
| 5137 | thread1.join() |
| 5138 | thread2.join() |
| 5139 | try: |
| 5140 | assert_equal(self.success, False) |
| 5141 | log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test') |
| 5142 | time.sleep(10) |
| 5143 | finally: |
| 5144 | pass |
| 5145 | df.callback(0) |
| 5146 | reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df) |
| 5147 | return df |
| 5148 | |
| 5149 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5150 | def test_two_subscribers_with_voltha_for_igmp_pausing_olt_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 5151 | """ |
| 5152 | Test Method: |
| 5153 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5154 | 1. OLT and ONU is detected and validated. |
| 5155 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5156 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5157 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5158 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5159 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5160 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5161 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5162 | 9. Pause olt device which is being shown on voltha CLI. |
| 5163 | 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5164 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5165 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5166 | df = defer.Deferred() |
| 5167 | def igmp_flow_check_operating_olt_admin_pause(df): |
| 5168 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5169 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5170 | services = ('IGMP') |
| 5171 | cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None) |
| 5172 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5173 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5174 | thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],)) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5175 | thread1.start() |
| 5176 | time.sleep(randint(50,60)) |
| 5177 | thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,)) |
| 5178 | thread2.start() |
| 5179 | time.sleep(10) |
| 5180 | thread1.join() |
| 5181 | thread2.join() |
| 5182 | try: |
| 5183 | assert_equal(self.success, False) |
| 5184 | log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test') |
| 5185 | time.sleep(10) |
| 5186 | finally: |
| 5187 | pass |
| 5188 | df.callback(0) |
| 5189 | reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df) |
| 5190 | return df |
| 5191 | |
| 5192 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5193 | def test_two_subscribers_with_voltha_for_igmp_toggling_olt_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 5194 | """ |
| 5195 | Test Method: |
| 5196 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5197 | 1. OLT and ONU is detected and validated. |
| 5198 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5199 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5200 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5201 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5202 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5203 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5204 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5205 | 9. Disable olt device which is being shown on voltha CLI. |
| 5206 | 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5207 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5208 | 12. Enable olt device which is disable at step 9. |
| 5209 | 13. Repeat steps 4,5, 7 and 8. |
| 5210 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5211 | df = defer.Deferred() |
| 5212 | def igmp_flow_check_operating_olt_admin_restart(df): |
| 5213 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5214 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5215 | services = ('IGMP') |
| 5216 | cbs = (self.igmp_flow_check, None, None) |
| 5217 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5218 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5219 | thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],)) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5220 | thread1.start() |
| 5221 | time.sleep(randint(50,60)) |
| 5222 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,)) |
| 5223 | thread2.start() |
| 5224 | time.sleep(10) |
| 5225 | thread1.join() |
| 5226 | thread2.join() |
| 5227 | try: |
| 5228 | assert_equal(self.success, True) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5229 | log_test.info('Igmp flow check expected to fail during olt device restart, After OLT device is up, it should be successful') |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5230 | time.sleep(10) |
| 5231 | finally: |
| 5232 | pass |
| 5233 | df.callback(0) |
| 5234 | reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df) |
| 5235 | return df |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5236 | |
| 5237 | @deferred(TESTCASE_TIMEOUT) |
| 5238 | def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self): |
| 5239 | """ |
| 5240 | Test Method: |
| 5241 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5242 | 1. OLT and ONU is detected and validated. |
| 5243 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5244 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5245 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5246 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5247 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5248 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5249 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5250 | 9. Disable olt device which is being shown on voltha CLI. |
| 5251 | 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5252 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5253 | 12. Repeat steps 4 to 11 steps multiple times (example 20 times) |
| 5254 | """ |
| 5255 | df = defer.Deferred() |
| 5256 | no_iterations = 20 |
| 5257 | def igmp_flow_check_operating_olt_admin_disble(df): |
| 5258 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5259 | num_channels = 1 |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5260 | services = ('IGMP') |
| 5261 | cbs = (self.igmp_flow_check, None, None) |
| 5262 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5263 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5264 | thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],)) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5265 | thread1.start() |
| 5266 | time.sleep(randint(30,40)) |
| 5267 | for i in range(no_iterations): |
| 5268 | thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,)) |
| 5269 | thread2.start() |
| 5270 | time.sleep(8) |
| 5271 | thread2.join() |
| 5272 | thread1.join() |
| 5273 | thread1.isAlive() |
| 5274 | thread2.join() |
| 5275 | try: |
| 5276 | assert_equal(self.success, False) |
| 5277 | log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test') |
| 5278 | time.sleep(10) |
| 5279 | finally: |
| 5280 | pass |
| 5281 | df.callback(0) |
| 5282 | reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df) |
| 5283 | return df |
| 5284 | |
| 5285 | @deferred(TESTCASE_TIMEOUT + 200) |
| 5286 | def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self): |
| 5287 | """ |
| 5288 | Test Method: |
| 5289 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5290 | 1. OLT and ONU is detected and validated. |
| 5291 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5292 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5293 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5294 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5295 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5296 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5297 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5298 | 9. Disable uni_2 port which is being shown on voltha CLI. |
| 5299 | 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5300 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5301 | 12. Enable uni_2 port which we disable at step 9. |
| 5302 | 13. Repeat step 5,6 and 8. |
| 5303 | 14. Repeat steps 4 to 13 steps multiple times (example 5 times) |
| 5304 | """ |
| 5305 | df = defer.Deferred() |
| 5306 | no_iterations = 5 |
| 5307 | def igmp_flow_check_operating_onu_admin_state(df): |
| 5308 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5309 | num_channels = 1 |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5310 | services = ('IGMP') |
| 5311 | cbs = (self.igmp_flow_check, None, None) |
| 5312 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5313 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5314 | thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],)) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5315 | thread1.start() |
| 5316 | time.sleep(randint(40,60)) |
| 5317 | for i in range(no_iterations): |
| 5318 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],)) |
| 5319 | log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha') |
| 5320 | thread2.start() |
| 5321 | time.sleep(1) |
| 5322 | thread2.join() |
| 5323 | thread1.isAlive() |
| 5324 | thread1.join() |
| 5325 | thread2.join() |
| 5326 | try: |
| 5327 | assert_equal(self.success, True) |
| 5328 | log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful') |
| 5329 | time.sleep(10) |
| 5330 | finally: |
| 5331 | pass |
| 5332 | df.callback(0) |
| 5333 | reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df) |
| 5334 | return df |
| 5335 | |
| 5336 | @deferred(TESTCASE_TIMEOUT) |
| 5337 | def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self): |
| 5338 | """ |
| 5339 | Test Method: |
| 5340 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5341 | 1. OLT and ONU is detected and validated. |
| 5342 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5343 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5344 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5345 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5346 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5347 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5348 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5349 | 9. Disable olt device which is being shown on voltha CLI. |
| 5350 | 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5351 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5352 | 12. Enable olt device which is disable at step 9. |
| 5353 | 13. Repeat steps 4,5, 7 and 8. |
| 5354 | 14. Repeat steps 4 to 13 steps multiple times (example 10 times) |
| 5355 | """ |
| 5356 | df = defer.Deferred() |
| 5357 | no_iterations = 10 |
| 5358 | def igmp_flow_check_operating_olt_admin_restart(df): |
| 5359 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5360 | num_channels = 1 |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5361 | services = ('IGMP') |
| 5362 | cbs = (self.igmp_flow_check, None, None) |
| 5363 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5364 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5365 | thread1 = threading.Thread(target = self.voltha_subscribers, args = (services, cbs, 2, 1, ['1.2.3.4', '3.4.5.6'],)) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5366 | thread1.start() |
| 5367 | time.sleep(randint(50,60)) |
| 5368 | for i in range(no_iterations): |
| 5369 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,)) |
| 5370 | thread2.start() |
| 5371 | time.sleep(10) |
| 5372 | thread2.join() |
| 5373 | thread1.join() |
| 5374 | thread2.join() |
| 5375 | try: |
| 5376 | assert_equal(self.success, True) |
| 5377 | log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful') |
| 5378 | time.sleep(10) |
| 5379 | finally: |
| 5380 | pass |
| 5381 | df.callback(0) |
| 5382 | reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df) |
| 5383 | return df |
| 5384 | |
| 5385 | def test_5_subscriber_with_voltha_for_igmp_with_10_group_joins_verifying_traffic(self): |
| 5386 | """ |
| 5387 | Test Method: |
| 5388 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5389 | 1. OLT and ONU is detected and validated. |
| 5390 | 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers.. |
| 5391 | 3. Issue multiple dhcp client packets to get IP address from dhcp server for as subscribers and check connectivity. |
| 5392 | 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc |
| 5393 | 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU. |
| 5394 | 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 5395 | """ |
| 5396 | |
| 5397 | num_subscribers = 5 |
| 5398 | num_channels = 10 |
| 5399 | services = ('IGMP') |
| 5400 | cbs = (self.igmp_flow_check, None, None) |
| 5401 | self.voltha_subscribers(services, cbs = cbs, |
| 5402 | num_subscribers = num_subscribers, |
| 5403 | num_channels = num_channels) |
| 5404 | |
| 5405 | def test_9_subscriber_with_voltha_for_igmp_with_10_group_joins_and_verify_traffic(self): |
| 5406 | """ |
| 5407 | Test Method: |
| 5408 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5409 | 1. OLT and ONU is detected and validated. |
| 5410 | 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers.. |
| 5411 | 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity. |
| 5412 | 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc |
| 5413 | 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU. |
| 5414 | 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 5415 | """ |
| 5416 | num_subscribers = 9 |
| 5417 | num_channels = 10 |
| 5418 | services = ('IGMP') |
| 5419 | cbs = (self.igmp_flow_check, None, None) |
| 5420 | self.voltha_subscribers(services, cbs = cbs, |
| 5421 | num_subscribers = num_subscribers, |
| 5422 | num_channels = num_channels) |