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 |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 32 | from CordTestUtils import get_mac, 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 and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 224 | apps = ('org.opencord.aaa', 'org.onosproject.dhcp') |
| 225 | #apps = ('org.opencord.aaa', 'org.onosproject.dhcp', 'org.onosproject.dhcprelay') |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 226 | app_dhcp = ('org.onosproject.dhcp') |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 227 | app_dhcprelay = ('org.onosproject.dhcprelay') |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 228 | olt_apps = () #'org.opencord.cordmcast') |
| 229 | vtn_app = 'org.opencord.vtn' |
| 230 | table_app = 'org.ciena.cordigmp' |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 231 | test_path = os.path.dirname(os.path.realpath(__file__)) |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 232 | dhcp_data_dir = os.path.join(test_path, '..', 'setup') |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 233 | 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] | 234 | 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] | 235 | 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] | 236 | olt_app_name = 'org.onosproject.olt' |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 237 | #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config') |
| 238 | olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json')) |
| 239 | onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0))) |
A R Karthick | 9dc6e92 | 2017-07-12 14:40:16 -0700 | [diff] [blame] | 240 | VOLTHA_AUTO_CONFIGURE = False |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 241 | num_joins = 0 |
| 242 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 243 | relay_interfaces_last = () |
| 244 | interface_to_mac_map = {} |
| 245 | host_ip_map = {} |
| 246 | default_config = { 'default-lease-time' : 600, 'max-lease-time' : 7200, } |
| 247 | default_options = [ ('subnet-mask', '255.255.255.0'), |
| 248 | ('broadcast-address', '192.168.1.255'), |
| 249 | ('domain-name-servers', '192.168.1.1'), |
| 250 | ('domain-name', '"mydomain.cord-tester"'), |
| 251 | ] |
| 252 | ##specify the IP for the dhcp interface matching the subnet and subnet config |
| 253 | ##this is done for each interface dhcpd server would be listening on |
| 254 | default_subnet_config = [ ('192.168.1.2', |
| 255 | ''' |
| 256 | subnet 192.168.1.0 netmask 255.255.255.0 { |
| 257 | range 192.168.1.10 192.168.1.100; |
| 258 | } |
| 259 | '''), ] |
| 260 | |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 261 | configs = {} |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 262 | VOLTHA_ENABLED = True |
| 263 | INTF_TX_DEFAULT = 'veth2' |
| 264 | INTF_RX_DEFAULT = 'veth0' |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 265 | INTF_2_RX_DEFAULT = 'veth6' |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 266 | TESTCASE_TIMEOUT = 300 |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 267 | VOLTHA_IGMP_ITERATIONS = 10 |
| 268 | # VOLTHA_CONFIG_FAKE = True |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 269 | VOLTHA_CONFIG_FAKE = False |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 270 | VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' } |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 271 | VOLTHA_UPLINK_VLAN_START = 444 |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 272 | VOLTHA_ONU_UNI_PORT = 'veth0' |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 273 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 274 | dhcp_server_config = { |
| 275 | "ip": "10.1.11.50", |
| 276 | "mac": "ca:fe:ca:fe:ca:fe", |
| 277 | "subnet": "255.255.252.0", |
| 278 | "broadcast": "10.1.11.255", |
| 279 | "router": "10.1.8.1", |
| 280 | "domain": "8.8.8.8", |
| 281 | "ttl": "63", |
| 282 | "delay": "2", |
| 283 | "startip": "10.1.11.51", |
| 284 | "endip": "10.1.11.100" |
| 285 | } |
| 286 | |
| 287 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 288 | CLIENT_CERT = """-----BEGIN CERTIFICATE----- |
| 289 | MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx |
| 290 | CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h |
| 291 | IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd |
| 292 | RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN |
| 293 | MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV |
| 294 | BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI |
| 295 | hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC |
| 296 | gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe |
| 297 | +9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg |
| 298 | rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD |
| 299 | VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l |
| 300 | eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY |
| 301 | 6tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC |
| 302 | PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC |
| 303 | nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug== |
| 304 | -----END CERTIFICATE-----""" |
| 305 | |
| 306 | CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE----- |
| 307 | MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx |
| 308 | CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h |
| 309 | IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd |
| 310 | RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN |
| 311 | MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV |
| 312 | BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI |
| 313 | hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC |
| 314 | AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ |
| 315 | 5An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK |
| 316 | tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR |
| 317 | OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21 |
| 318 | qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39 |
| 319 | 2Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB |
| 320 | BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l |
| 321 | eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV |
| 322 | MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn |
| 323 | VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP |
| 324 | RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ |
| 325 | dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3 |
| 326 | T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt |
| 327 | yg== |
| 328 | -----END CERTIFICATE-----''' |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 329 | |
A.R Karthick | 3493a57 | 2017-06-07 18:28:10 -0700 | [diff] [blame] | 330 | @classmethod |
| 331 | def update_apps_version(cls): |
| 332 | version = Onos.getVersion() |
| 333 | major = int(version.split('.')[0]) |
| 334 | minor = int(version.split('.')[1]) |
| 335 | cordigmp_app_version = '2.0-SNAPSHOT' |
| 336 | olt_app_version = '1.2-SNAPSHOT' |
| 337 | if major > 1: |
| 338 | cordigmp_app_version = '3.0-SNAPSHOT' |
| 339 | olt_app_version = '2.0-SNAPSHOT' |
| 340 | elif major == 1: |
| 341 | if minor > 10: |
| 342 | cordigmp_app_version = '3.0-SNAPSHOT' |
| 343 | olt_app_version = '2.0-SNAPSHOT' |
| 344 | elif minor <= 8: |
| 345 | olt_app_version = '1.1-SNAPSHOT' |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 346 | cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version)) |
| 347 | cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version)) |
| 348 | cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version)) |
| 349 | |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 350 | @classmethod |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 351 | def voltha_dhcprelay_setUpClass(cls): |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 352 | ''' Activate the dhcprelay app''' |
| 353 | OnosCtrl(cls.app_dhcp).deactivate() |
| 354 | time.sleep(3) |
| 355 | cls.onos_ctrl = OnosCtrl('org.onosproject.dhcprelay') |
| 356 | status, _ = cls.onos_ctrl.activate() |
| 357 | assert_equal(status, True) |
| 358 | time.sleep(3) |
| 359 | cls.dhcp_relay_setup() |
| 360 | ##start dhcpd initially with default config |
| 361 | cls.dhcpd_start() |
| 362 | |
| 363 | @classmethod |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 364 | def voltha_dhcprelay_tearDownClass(cls): |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 365 | '''Deactivate the dhcp relay app''' |
| 366 | try: |
| 367 | os.unlink('{}/dhcpd.conf'.format(cls.dhcp_data_dir)) |
| 368 | os.unlink('{}/dhcpd.leases'.format(cls.dhcp_data_dir)) |
| 369 | except: pass |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 370 | onos_ctrl = OnosCtrl(cls.app_dhcprelay) |
| 371 | onos_ctrl.deactivate() |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 372 | cls.dhcpd_stop() |
| 373 | cls.dhcp_relay_cleanup() |
| 374 | |
| 375 | @classmethod |
A.R Karthick | f874d03 | 2017-06-07 18:47:51 -0700 | [diff] [blame] | 376 | def onos_load_config(cls, app, config): |
| 377 | status, code = OnosCtrl.config(config) |
| 378 | if status is False: |
| 379 | log_test.info('JSON config request for app %s returned status %d' %(app, code)) |
| 380 | assert_equal(status, True) |
| 381 | time.sleep(2) |
| 382 | |
| 383 | @classmethod |
| 384 | def onos_aaa_load(cls): |
| 385 | aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password', |
| 386 | 'radiusIp': '172.17.0.2' } } } } |
| 387 | radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2' |
| 388 | aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip |
| 389 | cls.onos_load_config('org.opencord.aaa', aaa_dict) |
| 390 | |
| 391 | @classmethod |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 392 | def onos_dhcp_table_load(self, config = None): |
| 393 | dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } } |
| 394 | dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp'] |
| 395 | if config: |
| 396 | for k in config.keys(): |
| 397 | if dhcp_config.has_key(k): |
| 398 | dhcp_config[k] = config[k] |
| 399 | self.onos_load_config('org.onosproject.dhcp', dhcp_dict) |
| 400 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 401 | 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] | 402 | if validation: |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 403 | cip, sip = dhcp.discover(mac = mac, update_seed = update_seed) |
| 404 | assert_not_equal(cip, None) |
| 405 | assert_not_equal(sip, None) |
| 406 | log_test.info('Got dhcp client IP %s from server %s for mac %s' % |
| 407 | (cip, sip, dhcp.get_mac(cip)[0])) |
| 408 | if validation == False: |
| 409 | cip, sip = dhcp.discover(mac = mac, update_seed = update_seed) |
| 410 | assert_equal(cip, None) |
| 411 | assert_equal(sip, None) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 412 | log_test.info('Dhcp client did not get IP from server') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 413 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 414 | if validation == 'skip': |
| 415 | cip, sip = dhcp.discover(mac = mac, update_seed = update_seed) |
| 416 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 417 | return cip,sip |
| 418 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 419 | def dhcp_request(self, onu_iface = None, seed_ip = '10.10.10.1', update_seed = False, validation = None, startip = '10.10.10.20', mac = None): |
| 420 | config = {'startip':startip, 'endip':'10.10.10.200', |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 421 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 422 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 423 | self.onos_dhcp_table_load(config) |
| 424 | dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 425 | 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] | 426 | return cip, sip |
| 427 | |
| 428 | @classmethod |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 429 | def setUpClass(cls): |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 430 | cls.update_apps_version() |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 431 | cls.voltha_attrs = dict(host = cls.VOLTHA_HOST, |
| 432 | rest_port = cls.VOLTHA_REST_PORT, |
| 433 | uplink_vlan_map = cls.VOLTHA_UPLINK_VLAN_MAP, |
| 434 | uplink_vlan_start = cls.VOLTHA_UPLINK_VLAN_START) |
| 435 | cls.voltha = VolthaCtrl(**cls.voltha_attrs) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 436 | cls.install_app_table() |
| 437 | cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file) |
| 438 | cls.port_map, cls.port_list = cls.olt.olt_port_map() |
| 439 | cls.switches = cls.port_map['switches'] |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 440 | cls.ponsim_ports = cls.port_map['ponsim'] |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 441 | cls.num_ports = cls.port_map['num_ports'] |
| 442 | if cls.num_ports > 1: |
| 443 | cls.num_ports -= 1 ##account for the tx port |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 444 | cls.activate_apps(cls.apps + cls.olt_apps, deactivate = True) |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 445 | cls.deactivate_apps(cls.app_dhcprelay) |
A.R Karthick | f874d03 | 2017-06-07 18:47:51 -0700 | [diff] [blame] | 446 | cls.onos_aaa_load() |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 447 | |
A.R Karthick | 3493a57 | 2017-06-07 18:28:10 -0700 | [diff] [blame] | 448 | @classmethod |
| 449 | def tearDownClass(cls): |
| 450 | '''Deactivate the olt apps and restart OVS back''' |
| 451 | apps = cls.olt_apps + ( cls.table_app,) |
| 452 | for app in apps: |
| 453 | onos_ctrl = OnosCtrl(app) |
| 454 | onos_ctrl.deactivate() |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 455 | cls.deactivate_apps(cls.app_dhcprelay) |
A.R Karthick | 3493a57 | 2017-06-07 18:28:10 -0700 | [diff] [blame] | 456 | cls.install_app_igmp() |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 457 | log_test.info('TearDownClass Restarting the Radius Server in the TA setup') |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 458 | cord_test_radius_restart() |
| 459 | |
A.R Karthick | 3493a57 | 2017-06-07 18:28:10 -0700 | [diff] [blame] | 460 | @classmethod |
| 461 | def install_app_igmp(cls): |
| 462 | ##Uninstall the table app on class exit |
| 463 | OnosCtrl.uninstall_app(cls.table_app) |
| 464 | time.sleep(2) |
| 465 | log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file)) |
| 466 | OnosCtrl.install_app(cls.app_file) |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 467 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 468 | def remove_olt(self, switch_map): |
| 469 | controller = get_controller() |
| 470 | auth = ('karaf', 'karaf') |
| 471 | #remove subscriber for every port on all the voltha devices |
| 472 | for device, device_map in switch_map.iteritems(): |
| 473 | uni_ports = device_map['ports'] |
| 474 | uplink_vlan = device_map['uplink_vlan'] |
| 475 | for port in uni_ports: |
| 476 | rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller, |
| 477 | device, |
| 478 | port) |
| 479 | resp = requests.delete(rest_url, auth = auth) |
| 480 | if resp.status_code not in [204, 202, 200]: |
| 481 | log_test.error('Error deleting subscriber for device %s on port %s' %(device, port)) |
| 482 | else: |
| 483 | log_test.info('Deleted subscriber for device %s on port %s' %(device, port)) |
| 484 | OnosCtrl.uninstall_app(self.olt_app_file) |
| 485 | |
| 486 | def config_olt(self, switch_map): |
| 487 | controller = get_controller() |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 488 | auth = ('karaf', 'karaf') |
| 489 | #configure subscriber for every port on all the voltha devices |
| 490 | for device, device_map in switch_map.iteritems(): |
| 491 | uni_ports = device_map['ports'] |
| 492 | uplink_vlan = device_map['uplink_vlan'] |
| 493 | for port in uni_ports: |
| 494 | vlan = port |
| 495 | rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller, |
| 496 | device, |
| 497 | port, |
| 498 | vlan) |
| 499 | resp = requests.post(rest_url, auth = auth) |
| 500 | #assert_equal(resp.ok, True) |
| 501 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 502 | def voltha_uni_port_toggle(self, uni_port = None): |
| 503 | ## Admin state of port is down and up |
| 504 | if not uni_port: |
| 505 | uni_port = self.INTF_RX_DEFAULT |
| 506 | cmd = 'ifconfig {} down'.format(uni_port) |
| 507 | os.system(cmd) |
| 508 | log_test.info('Admin state of uni_port is down') |
| 509 | time.sleep(30) |
| 510 | cmd = 'ifconfig {} up'.format(uni_port) |
| 511 | os.system(cmd) |
| 512 | log_test.info('Admin state of uni_port is up now') |
| 513 | time.sleep(30) |
| 514 | return |
| 515 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 516 | @classmethod |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 517 | def install_app_table(cls): |
| 518 | ##Uninstall the existing app if any |
| 519 | OnosCtrl.uninstall_app(cls.table_app) |
| 520 | time.sleep(2) |
| 521 | log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file)) |
| 522 | OnosCtrl.install_app(cls.table_app_file) |
| 523 | time.sleep(3) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 524 | |
| 525 | @classmethod |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 526 | def activate_apps(cls, apps, deactivate = False): |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 527 | for app in apps: |
| 528 | onos_ctrl = OnosCtrl(app) |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 529 | if deactivate is True: |
| 530 | onos_ctrl.deactivate() |
| 531 | time.sleep(2) |
| 532 | status, _ = onos_ctrl.activate() |
| 533 | assert_equal(status, True) |
| 534 | time.sleep(2) |
| 535 | |
| 536 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 537 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 538 | @classmethod |
| 539 | def deactivate_apps(cls, apps): |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 540 | cls.success = True |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 541 | for app in apps: |
| 542 | onos_ctrl = OnosCtrl(app) |
| 543 | status, _ = onos_ctrl.deactivate() |
| 544 | if status is False: |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 545 | cls.success = False |
| 546 | # assert_equal(status, True) |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 547 | time.sleep(2) |
| 548 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 549 | def random_ip(self,start_ip = '10.10.10.20', end_ip = '10.10.10.65'): |
| 550 | start = list(map(int, start_ip.split("."))) |
| 551 | end = list(map(int, end_ip.split("."))) |
| 552 | temp = start |
| 553 | ip_range = [] |
| 554 | ip_range.append(start_ip) |
| 555 | while temp != end: |
| 556 | start[3] += 1 |
| 557 | for i in (3, 2, 1): |
| 558 | if temp[i] == 255: |
| 559 | temp[i] = 0 |
| 560 | temp[i-1] += 1 |
| 561 | ip_range.append(".".join(map(str, temp))) |
| 562 | return random.choice(ip_range) |
| 563 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 564 | def random_mcast_ip(self,start_ip = '224.0.1.0', end_ip = '224.0.1.100'): |
| 565 | start = list(map(int, start_ip.split("."))) |
| 566 | end = list(map(int, end_ip.split("."))) |
| 567 | temp = start |
| 568 | ip_range = [] |
| 569 | ip_range.append(start_ip) |
| 570 | while temp != end: |
| 571 | start[3] += 1 |
| 572 | for i in (3, 2, 1): |
| 573 | if temp[i] == 255: |
| 574 | temp[i] = 0 |
| 575 | temp[i-1] += 1 |
| 576 | ip_range.append(".".join(map(str, temp))) |
| 577 | return random.choice(ip_range) |
| 578 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 579 | @classmethod |
| 580 | def dhcp_relay_setup(cls): |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 581 | did = OnosCtrl.get_device_id() |
| 582 | cls.relay_device_id = did |
| 583 | cls.relay_device_id = 'of:0000000000000001' |
| 584 | cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file) |
| 585 | cls.port_map, _ = cls.olt.olt_port_map() |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 586 | if cls.port_map: |
| 587 | ##Per subscriber, we use 1 relay port |
| 588 | try: |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 589 | relay_port = cls.port_map[cls.port_map['relay_ports'][0]] |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 590 | except: |
| 591 | relay_port = cls.port_map['uplink'] |
| 592 | cls.relay_interface_port = relay_port |
| 593 | cls.relay_interfaces = (cls.port_map[cls.relay_interface_port],) |
| 594 | else: |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 595 | cls.relay_interface_port = 100 |
| 596 | cls.relay_interfaces = (g_subscriber_port_map[cls.relay_interface_port],) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 597 | cls.relay_interfaces_last = cls.relay_interfaces |
| 598 | if cls.port_map: |
| 599 | ##generate a ip/mac client virtual interface config for onos |
| 600 | interface_list = [] |
| 601 | for port in cls.port_map['ports']: |
| 602 | port_num = cls.port_map[port] |
| 603 | if port_num == cls.port_map['uplink']: |
| 604 | continue |
| 605 | ip = cls.get_host_ip(port_num) |
| 606 | mac = cls.get_mac(port) |
| 607 | interface_list.append((port_num, ip, mac)) |
| 608 | |
| 609 | #configure dhcp server virtual interface on the same subnet as first client interface |
| 610 | relay_ip = cls.get_host_ip(interface_list[0][0]) |
| 611 | relay_mac = cls.get_mac(cls.port_map[cls.relay_interface_port]) |
| 612 | interface_list.append((cls.relay_interface_port, relay_ip, relay_mac)) |
| 613 | cls.onos_interface_load(interface_list) |
| 614 | |
| 615 | @classmethod |
| 616 | def onos_interface_load(cls, interface_list): |
| 617 | interface_dict = { 'ports': {} } |
| 618 | for port_num, ip, mac in interface_list: |
| 619 | port_map = interface_dict['ports'] |
| 620 | port = '{}/{}'.format(cls.relay_device_id, port_num) |
| 621 | port_map[port] = { 'interfaces': [] } |
| 622 | interface_list = port_map[port]['interfaces'] |
| 623 | interface_map = { 'ips' : [ '{}/{}'.format(ip, 24) ], |
| 624 | 'mac' : mac, |
| 625 | 'name': 'vir-{}'.format(port_num) |
| 626 | } |
| 627 | interface_list.append(interface_map) |
| 628 | |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 629 | cls.onos_load_config('org.onosproject.dhcprelay', interface_dict) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 630 | cls.configs['interface_config'] = interface_dict |
| 631 | |
| 632 | @classmethod |
| 633 | def get_host_ip(cls, port): |
| 634 | if cls.host_ip_map.has_key(port): |
| 635 | return cls.host_ip_map[port] |
| 636 | cls.host_ip_map[port] = '192.168.1.{}'.format(port) |
| 637 | return cls.host_ip_map[port] |
| 638 | |
| 639 | @classmethod |
| 640 | def host_load(cls, iface): |
| 641 | '''Have ONOS discover the hosts for dhcp-relay responses''' |
| 642 | port = g_subscriber_port_map[iface] |
| 643 | host = '173.17.1.{}'.format(port) |
| 644 | cmds = ( 'ifconfig {} 0'.format(iface), |
| 645 | 'ifconfig {0} {1}'.format(iface, host), |
| 646 | 'arping -I {0} {1} -c 2'.format(iface, host), |
| 647 | 'ifconfig {} 0'.format(iface), ) |
| 648 | for c in cmds: |
| 649 | os.system(c) |
| 650 | |
| 651 | @classmethod |
| 652 | def dhcpd_conf_generate(cls, config = default_config, options = default_options, |
| 653 | subnet = default_subnet_config): |
| 654 | conf = '' |
| 655 | for k, v in config.items(): |
| 656 | conf += '{} {};\n'.format(k, v) |
| 657 | |
| 658 | opts = '' |
| 659 | for k, v in options: |
| 660 | opts += 'option {} {};\n'.format(k, v) |
| 661 | |
| 662 | subnet_config = '' |
| 663 | for _, v in subnet: |
| 664 | subnet_config += '{}\n'.format(v) |
| 665 | |
| 666 | return '{}{}{}'.format(conf, opts, subnet_config) |
| 667 | |
| 668 | @classmethod |
| 669 | def dhcpd_start(cls, intf_list = None, |
| 670 | config = default_config, options = default_options, |
| 671 | subnet = default_subnet_config): |
| 672 | '''Start the dhcpd server by generating the conf file''' |
| 673 | if intf_list is None: |
| 674 | intf_list = cls.relay_interfaces |
| 675 | ##stop dhcpd if already running |
| 676 | cls.dhcpd_stop() |
| 677 | dhcp_conf = cls.dhcpd_conf_generate(config = config, options = options, |
| 678 | subnet = subnet) |
| 679 | ##first touch dhcpd.leases if it doesn't exist |
| 680 | lease_file = '{}/dhcpd.leases'.format(cls.dhcp_data_dir) |
| 681 | if os.access(lease_file, os.F_OK) is False: |
| 682 | with open(lease_file, 'w') as fd: pass |
| 683 | |
| 684 | conf_file = '{}/dhcpd.conf'.format(cls.dhcp_data_dir) |
| 685 | with open(conf_file, 'w') as fd: |
| 686 | fd.write(dhcp_conf) |
| 687 | |
| 688 | #now configure the dhcpd interfaces for various subnets |
| 689 | index = 0 |
| 690 | intf_info = [] |
| 691 | for ip,_ in subnet: |
| 692 | intf = intf_list[index] |
| 693 | mac = cls.get_mac(intf) |
| 694 | intf_info.append((ip, mac)) |
| 695 | index += 1 |
| 696 | os.system('ifconfig {} {}'.format(intf, ip)) |
| 697 | |
| 698 | intf_str = ','.join(intf_list) |
| 699 | dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format(conf_file, lease_file, intf_str) |
| 700 | log_test.info('Starting DHCPD server with command: %s' %dhcpd_cmd) |
| 701 | ret = os.system(dhcpd_cmd) |
| 702 | assert_equal(ret, 0) |
| 703 | time.sleep(3) |
| 704 | cls.relay_interfaces_last = cls.relay_interfaces |
| 705 | cls.relay_interfaces = intf_list |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 706 | cls.onos_dhcp_relay_load_1(*intf_info[0]) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 707 | |
| 708 | @classmethod |
| 709 | def dhcpd_stop(cls): |
| 710 | os.system('pkill -9 dhcpd') |
| 711 | for intf in cls.relay_interfaces: |
| 712 | os.system('ifconfig {} 0'.format(intf)) |
| 713 | |
| 714 | cls.relay_interfaces = cls.relay_interfaces_last |
| 715 | |
| 716 | @classmethod |
| 717 | def get_mac(cls, iface): |
| 718 | if cls.interface_to_mac_map.has_key(iface): |
| 719 | return cls.interface_to_mac_map[iface] |
| 720 | mac = get_mac(iface, pad = 0) |
| 721 | cls.interface_to_mac_map[iface] = mac |
| 722 | return mac |
| 723 | |
| 724 | def send_recv(self, mac=None, update_seed = False, validate = True): |
| 725 | cip, sip = self.dhcp.discover(mac = mac, update_seed = update_seed) |
| 726 | if validate: |
| 727 | assert_not_equal(cip, None) |
| 728 | assert_not_equal(sip, None) |
| 729 | log_test.info('Got dhcp client IP %s from server %s for mac %s' % |
| 730 | (cip, sip, self.dhcp.get_mac(cip)[0])) |
| 731 | return cip,sip |
| 732 | |
| 733 | @classmethod |
| 734 | def dhcpd_conf_generate(cls, config = default_config, options = default_options, |
| 735 | subnet = default_subnet_config): |
| 736 | conf = '' |
| 737 | for k, v in config.items(): |
| 738 | conf += '{} {};\n'.format(k, v) |
| 739 | |
| 740 | opts = '' |
| 741 | for k, v in options: |
| 742 | opts += 'option {} {};\n'.format(k, v) |
| 743 | |
| 744 | subnet_config = '' |
| 745 | for _, v in subnet: |
| 746 | subnet_config += '{}\n'.format(v) |
| 747 | |
| 748 | return '{}{}{}'.format(conf, opts, subnet_config) |
| 749 | |
| 750 | @classmethod |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 751 | def onos_dhcp_relay_load_1(cls, server_ip, server_mac): |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 752 | relay_device_map = '{}/{}'.format(cls.relay_device_id, cls.relay_interface_port) |
| 753 | dhcp_dict = {'apps':{'org.onosproject.dhcp-relay':{'dhcprelay': |
| 754 | {'dhcpserverConnectPoint':relay_device_map, |
| 755 | 'serverip':server_ip, |
| 756 | 'servermac':server_mac |
| 757 | } |
| 758 | } |
| 759 | } |
| 760 | } |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 761 | cls.onos_load_config(cls.app_dhcprelay,dhcp_dict) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 762 | cls.configs['relay_config'] = dhcp_dict |
| 763 | |
| 764 | @classmethod |
| 765 | def dhcp_relay_cleanup(cls): |
| 766 | ##reset the ONOS port configuration back to default |
| 767 | for config in cls.configs.items(): |
| 768 | OnosCtrl.delete(config) |
| 769 | # if cls.onos_restartable is True: |
| 770 | # log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg') |
| 771 | # return cord_test_onos_restart(config = {}) |
| 772 | |
| 773 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 774 | def tls_flow_check(self, olt_ports, cert_info = None, multiple_sub = False): |
| 775 | if multiple_sub is True: |
| 776 | olt_nni_port = olt_ports.tx_port |
| 777 | olt_uni_port = olt_ports.rx_port |
| 778 | else: |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 779 | olt_uni_port = olt_ports |
| 780 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 781 | def tls_fail_cb(): |
| 782 | log_test.info('TLS verification failed') |
| 783 | if cert_info is None: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 784 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 785 | log_test.info('Running subscriber %s tls auth test with valid 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 True: |
| 788 | self.success = False |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 789 | assert_equal(tls.failTest, False) |
| 790 | if cert_info == "no_cert": |
| 791 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '') |
| 792 | log_test.info('Running subscriber %s tls auth test with no 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 |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 796 | assert_equal(tls.failTest, True) |
| 797 | if cert_info == "invalid_cert": |
| 798 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID) |
| 799 | log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port) |
| 800 | tls.runTest() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 801 | if tls.failTest is False: |
| 802 | self.success = False |
| 803 | assert_equal(tls.failTest, True) |
| 804 | if cert_info == "same_cert": |
| 805 | 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] | 806 | 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] | 807 | tls.runTest() |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 808 | if tls.failTest is True: |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 809 | self.success = False |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 810 | assert_equal(tls.failTest, False) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 811 | 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] | 812 | 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] | 813 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID) |
| 814 | log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info)) |
| 815 | tls.runTest() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 816 | if tls.failTest is False: |
| 817 | self.success = False |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 818 | assert_equal(tls.failTest, True) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 819 | self.test_status = True |
| 820 | return self.test_status |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 821 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 822 | def dhcp_flow_check(self, olt_ports, negative_test = None, multiple_sub = False): |
| 823 | if multiple_sub is True: |
| 824 | olt_nni_port = olt_ports.tx_port |
| 825 | onu_iface = olt_ports.rx_port |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 826 | dhcp_server_startip = self.random_ip() |
| 827 | 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] | 828 | else: |
| 829 | onu_iface = olt_ports |
| 830 | dhcp_server_startip = '10.10.10.20' |
| 831 | random_mac = None |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 832 | self.success = True |
| 833 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 834 | if negative_test is None: |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 835 | cip, sip = self.dhcp_request(onu_iface, update_seed = True, validation = 'skip', startip = dhcp_server_startip, mac = random_mac) |
| 836 | if cip == None or sip == None: |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 837 | self.success = False |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 838 | self.test_status = False |
| 839 | assert_not_equal(cip,None) |
| 840 | assert_not_equal(sip,None) |
| 841 | else: |
| 842 | log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip)) |
| 843 | self.test_status = True |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 844 | |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 845 | if negative_test == "interrupting_dhcp_flows": |
| 846 | 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] | 847 | if cip is not None: |
| 848 | self.success = False |
| 849 | assert_equal(cip,None) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 850 | 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] | 851 | self.test_status = True |
| 852 | |
| 853 | if negative_test == "invalid_src_mac_broadcast": |
| 854 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 855 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 856 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 857 | self.onos_dhcp_table_load(config) |
| 858 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 859 | 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] | 860 | |
| 861 | if cip is not None: |
| 862 | self.success = False |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 863 | 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] | 864 | assert_equal(cip,None) |
| 865 | log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected') |
| 866 | self.test_status = True |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 867 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 868 | if negative_test == "invalid_src_mac_multicast": |
| 869 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 870 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 871 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 872 | self.onos_dhcp_table_load(config) |
| 873 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 874 | 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] | 875 | if cip is not None: |
| 876 | self.success = False |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 877 | assert_equal(cip,None) |
| 878 | log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected') |
| 879 | self.test_status = True |
| 880 | |
| 881 | if negative_test == "invalid_src_mac_junk": |
| 882 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 883 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 884 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 885 | self.onos_dhcp_table_load(config) |
| 886 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 887 | 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] | 888 | if cip is not None: |
| 889 | self.success = False |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 890 | assert_equal(cip,None) |
| 891 | log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected') |
| 892 | self.test_status = True |
| 893 | |
| 894 | if negative_test == "request_release": |
| 895 | config = {'startip':'10.10.100.20', 'endip':'10.10.100.230', |
| 896 | 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe", |
| 897 | 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'} |
| 898 | self.onos_dhcp_table_load(config) |
| 899 | self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface) |
| 900 | cip, sip = self.dhcp_sndrcv(self.dhcp) |
| 901 | log_test.info('Releasing ip %s to server %s' %(cip, sip)) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 902 | if not self.dhcp.release(cip): |
| 903 | self.success = False |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 904 | assert_equal(self.dhcp.release(cip), True) |
| 905 | log_test.info('Triggering DHCP discover again after release') |
| 906 | cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True) |
| 907 | log_test.info('Verifying released IP was given back on rediscover') |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 908 | if not cip == cip2: |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 909 | self.success = False |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 910 | assert_equal(cip, cip2) |
| 911 | log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2)) |
| 912 | assert_equal(self.dhcp.release(cip2), True) |
| 913 | self.test_status = True |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 914 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 915 | if negative_test == "starvation_positive": |
| 916 | config = {'startip':'193.170.1.20', 'endip':'193.170.1.69', |
| 917 | 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe", |
| 918 | 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'} |
| 919 | self.onos_dhcp_table_load(config) |
| 920 | self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface) |
| 921 | ip_map = {} |
| 922 | for i in range(10): |
| 923 | cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True) |
| 924 | if ip_map.has_key(cip): |
| 925 | self.success = False |
| 926 | log_test.info('IP %s given out multiple times' %cip) |
| 927 | assert_equal(False, ip_map.has_key(cip)) |
| 928 | ip_map[cip] = sip |
| 929 | self.test_status = True |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 930 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 931 | if negative_test == "starvation_negative": |
| 932 | config = {'startip':'182.17.0.20', 'endip':'182.17.0.69', |
| 933 | 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe", |
| 934 | 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'} |
| 935 | self.onos_dhcp_table_load(config) |
| 936 | self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface) |
| 937 | log_test.info('Verifying passitive case') |
| 938 | for x in xrange(50): |
| 939 | mac = RandMAC()._fix() |
| 940 | self.dhcp_sndrcv(self.dhcp,mac = mac) |
| 941 | log_test.info('Verifying negative case') |
| 942 | cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 943 | if cip or sip is not None: |
| 944 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 945 | assert_equal(cip, None) |
| 946 | assert_equal(sip, None) |
| 947 | self.test_status = True |
| 948 | self.success = True |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 949 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 950 | if negative_test == "multiple_discover": |
| 951 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 952 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 953 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 954 | self.onos_dhcp_table_load(config) |
| 955 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 956 | cip, sip, mac, _ = self.dhcp.only_discover() |
| 957 | log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' % |
| 958 | (cip, sip, mac) ) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 959 | if cip is None: |
| 960 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 961 | assert_not_equal(cip, None) |
| 962 | log_test.info('Triggering DHCP discover again.') |
| 963 | new_cip, new_sip, new_mac, _ = self.dhcp.only_discover() |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 964 | if not new_cip == cip: |
| 965 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 966 | assert_equal(new_cip, cip) |
| 967 | log_test.info('client got same IP as expected when sent 2nd discovery') |
| 968 | self.test_status = True |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 969 | # self.success = True |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 970 | if negative_test == "multiple_requests": |
| 971 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 972 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 973 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 974 | self.onos_dhcp_table_load(config) |
| 975 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 976 | log_test.info('Sending DHCP discover and DHCP request.') |
| 977 | cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True) |
| 978 | mac = self.dhcp.get_mac(cip)[0] |
| 979 | log_test.info("Sending DHCP request again.") |
| 980 | new_cip, new_sip = self.dhcp.only_request(cip, mac) |
| 981 | assert_equal(new_cip,cip) |
| 982 | log_test.info('server offered same IP to clain for multiple requests, as expected') |
| 983 | self.test_status = True |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 984 | # self.success = True |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 985 | if negative_test == "desired_ip_address": |
| 986 | config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', |
| 987 | 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 988 | 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'} |
| 989 | self.onos_dhcp_table_load(config) |
| 990 | self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface) |
| 991 | cip, sip, mac, _ = self.dhcp.only_discover(desired = True) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 992 | if cip or sip is None: |
| 993 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 994 | assert_not_equal(cip, None) |
| 995 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 996 | (cip, sip, mac)) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 997 | if not self.dhcp.seed_ip == cip: |
| 998 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 999 | assert_equal(cip,self.dhcp.seed_ip) |
| 1000 | log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip) |
| 1001 | self.test_status = True |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1002 | # self.success = True |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1003 | if negative_test == "desired_out_of_pool_ip_address": |
| 1004 | config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', |
| 1005 | 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 1006 | 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'} |
| 1007 | self.onos_dhcp_table_load(config) |
| 1008 | self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface) |
| 1009 | cip, sip, mac, _ = self.dhcp.only_discover(desired = True) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1010 | if cip or sip is None: |
| 1011 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1012 | assert_not_equal(cip, None) |
| 1013 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 1014 | (cip, sip, mac) ) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1015 | if self.dhcp.seed_ip == cip: |
| 1016 | self.success = False |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1017 | assert_not_equal(cip,self.dhcp.seed_ip) |
| 1018 | log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected') |
| 1019 | self.test_status = True |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 1020 | # self.success = True |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1021 | if negative_test == "dhcp_renew": |
| 1022 | config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', |
| 1023 | 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 1024 | 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'} |
| 1025 | self.onos_dhcp_table_load(config) |
| 1026 | self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface) |
| 1027 | cip, sip, mac, _ = self.dhcp.only_discover() |
| 1028 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 1029 | (cip, sip, mac) ) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1030 | if cip or sip is None: |
| 1031 | self.success = False |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1032 | assert_not_equal(cip, None) |
| 1033 | new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True) |
| 1034 | log_test.info('waiting renew time %d seconds to send next request packet'%lval) |
| 1035 | time.sleep(lval) |
| 1036 | 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] | 1037 | if not latest_cip == cip: |
| 1038 | self.success = False |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1039 | assert_equal(latest_cip,cip) |
| 1040 | 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] | 1041 | self.test_status = True |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1042 | # self.success = True |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1043 | if negative_test == "dhcp_rebind": |
| 1044 | config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', |
| 1045 | 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 1046 | 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'} |
| 1047 | self.onos_dhcp_table_load(config) |
| 1048 | self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface) |
| 1049 | cip, sip, mac, _ = self.dhcp.only_discover() |
| 1050 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 1051 | (cip, sip, mac) ) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1052 | if cip or sip is None: |
| 1053 | self.success = False |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1054 | assert_not_equal(cip, None) |
| 1055 | new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True) |
| 1056 | log_test.info('waiting rebind time %d seconds to send next request packet'%lval) |
| 1057 | time.sleep(lval) |
| 1058 | latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac) |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1059 | if not latest_cip == cip: |
| 1060 | self.success = False |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1061 | assert_equal(latest_cip,cip) |
| 1062 | 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] | 1063 | self.test_status = True |
Thangavelu K S | 0ffd5b8 | 2017-06-21 18:01:59 +0000 | [diff] [blame] | 1064 | # self.success = True |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 1065 | return self.test_status |
| 1066 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1067 | def recv_channel_cb(self, pkt): |
| 1068 | ##First verify that we have received the packet for the joined instance |
| 1069 | chan = self.subscriber.caddr(pkt[IP].dst) |
| 1070 | assert_equal(chan in self.subscriber.join_map.keys(), True) |
| 1071 | recv_time = monotonic.monotonic() * 1000000 |
| 1072 | join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start |
| 1073 | delta = recv_time - join_time |
| 1074 | self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True) |
| 1075 | self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta) |
| 1076 | log_test.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst)) |
| 1077 | self.test_status = True |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1078 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1079 | def traffic_verify(self, subscriber): |
| 1080 | # if subscriber.has_service('TRAFFIC'): |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 1081 | url = 'http://www.google.com' |
| 1082 | resp = requests.get(url) |
| 1083 | self.test_status = resp.ok |
| 1084 | if resp.ok == False: |
| 1085 | log_test.info('Subscriber %s failed get from url %s with status code %d' |
| 1086 | %(subscriber.name, url, resp.status_code)) |
| 1087 | else: |
| 1088 | log_test.info('GET request from %s succeeded for subscriber %s' |
| 1089 | %(url, subscriber.name)) |
| 1090 | return self.test_status |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1091 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1092 | def igmp_flow_check(self, subscriber, multiple_sub = False): |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 1093 | chan = 0 |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1094 | for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels): |
| 1095 | if subscriber.num_channels == 1: |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1096 | if i != 0: |
| 1097 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1098 | chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list) |
| 1099 | else: |
| 1100 | chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list) |
| 1101 | self.num_joins += 1 |
| 1102 | while self.num_joins < self.num_subscribers: |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 1103 | time.sleep(5) |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1104 | log_test.info('All subscribers have joined the channel') |
| 1105 | # for i in range(1): |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 1106 | time.sleep(0.5) |
| 1107 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list) |
| 1108 | #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1109 | #subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1110 | time.sleep(5) |
| 1111 | # log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats)) |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1112 | if subscriber.num_channels == 1: |
| 1113 | pass |
| 1114 | elif chan != 0: |
| 1115 | #Should not receive packets for this channel |
| 1116 | self.recv_timeout = True |
| 1117 | subscriber.recv_timeout = True |
| 1118 | subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list) |
| 1119 | subscriber.recv_timeout = False |
| 1120 | self.recv_timeout = False |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1121 | log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port)) |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 1122 | # subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list) |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1123 | # chan = subscriber.num_channels - i |
| 1124 | # self.test_status = True |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 1125 | return self.test_status |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1126 | |
| 1127 | def igmp_join_next_channel_flow_check(self, subscriber, multiple_sub = False): |
| 1128 | chan = 0 |
| 1129 | for i in range(self.VOLTHA_IGMP_ITERATIONS + subscriber.num_channels): |
| 1130 | # if subscriber.num_channels == 1: |
| 1131 | # chan = subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list) |
| 1132 | # else: |
| 1133 | chan = subscriber.channel_join_next(delay = 2, src_list = subscriber.src_list) |
| 1134 | self.num_joins += 1 |
| 1135 | while self.num_joins < self.num_subscribers: |
| 1136 | time.sleep(5) |
| 1137 | log_test.info('All subscribers have joined the channel') |
| 1138 | # for i in range(1): |
| 1139 | time.sleep(0.5) |
| 1140 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list) |
| 1141 | #log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1142 | #subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1143 | time.sleep(5) |
| 1144 | # log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats)) |
| 1145 | # if subscriber.num_channels == 1: |
| 1146 | # pass |
| 1147 | # elif chan != 0: |
| 1148 | # pass |
| 1149 | #Should not receive packets for this channel |
| 1150 | # log_test.info |
| 1151 | # self.recv_timeout = True |
| 1152 | # subscriber.recv_timeout = True |
| 1153 | # subscriber.channel_receive(chan-1, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list) |
| 1154 | # subscriber.recv_timeout = False |
| 1155 | # self.recv_timeout = False |
| 1156 | # log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port)) |
| 1157 | # subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list) |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1158 | chan = subscriber.num_channels - i |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1159 | # self.test_status = True |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 1160 | return self.test_status |
| 1161 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1162 | |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1163 | def igmp_leave_flow_check(self, subscriber, multiple_sub = False): |
| 1164 | chan = 0 |
| 1165 | for i in range(self.VOLTHA_IGMP_ITERATIONS): |
| 1166 | subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list) |
| 1167 | self.num_joins += 1 |
| 1168 | while self.num_joins < self.num_subscribers: |
| 1169 | time.sleep(5) |
| 1170 | log_test.info('All subscribers have joined the channel') |
| 1171 | # for i in range(1): |
| 1172 | time.sleep(0.5) |
| 1173 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list) |
| 1174 | log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1175 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1176 | time.sleep(10) |
| 1177 | # log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats)) |
| 1178 | #Should not receive packets for this subscriber |
| 1179 | self.recv_timeout = True |
| 1180 | subscriber.recv_timeout = True |
| 1181 | subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list) |
| 1182 | subscriber.recv_timeout = False |
| 1183 | self.recv_timeout = False |
| 1184 | # log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port)) |
| 1185 | # subscriber.channel_join(chan, delay = 2, src_list = subscriber.src_list) |
| 1186 | # self.test_status = True |
| 1187 | return self.test_status |
| 1188 | |
| 1189 | |
| 1190 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1191 | def igmp_flow_check_join_change_to_exclude(self, subscriber, multiple_sub = False): |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 1192 | chan = 0 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1193 | #for i in range(self.VOLTHA_IGMP_ITERATIONS): |
| 1194 | for i in range(3): |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 1195 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1196 | self.num_joins += 1 |
| 1197 | while self.num_joins < self.num_subscribers: |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 1198 | time.sleep(5) |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1199 | log_test.info('All subscribers have joined the channel') |
| 1200 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1]) |
| 1201 | time.sleep(5) |
| 1202 | 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])) |
| 1203 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE) |
| 1204 | #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0] |
| 1205 | time.sleep(60) |
| 1206 | self.recv_timeout = False |
| 1207 | subscriber.recv_timeout = False |
| 1208 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1]) |
| 1209 | if self.test_status is True: |
| 1210 | self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0]) |
| 1211 | if self.test_status is False: |
| 1212 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1213 | continue |
| 1214 | subscriber.recv_timeout = False |
| 1215 | self.recv_timeout = False |
| 1216 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1217 | # self.test_status = True |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 1218 | return self.test_status |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1219 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1220 | 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] | 1221 | chan = 0 |
| 1222 | #for i in range(self.VOLTHA_IGMP_ITERATIONS): |
| 1223 | for i in range(3): |
| 1224 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1225 | self.num_joins += 1 |
| 1226 | while self.num_joins < self.num_subscribers: |
| 1227 | time.sleep(5) |
| 1228 | log_test.info('All subscribers have joined the channel') |
| 1229 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1]) |
| 1230 | time.sleep(5) |
| 1231 | 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])) |
| 1232 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE) |
| 1233 | #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0] |
| 1234 | time.sleep(60) |
| 1235 | self.recv_timeout = False |
| 1236 | subscriber.recv_timeout = False |
| 1237 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1]) |
| 1238 | if self.test_status is True: |
| 1239 | self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0]) |
| 1240 | if self.test_status is False: |
| 1241 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1242 | continue |
| 1243 | subscriber.recv_timeout = False |
| 1244 | self.recv_timeout = False |
| 1245 | log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0])) |
| 1246 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_INCLUDE) |
| 1247 | time.sleep(5) |
| 1248 | # self.recv_timeout = True |
| 1249 | # subscriber.recv_timeout = True |
| 1250 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0]) |
| 1251 | subscriber.recv_timeout = False |
| 1252 | self.recv_timeout = False |
| 1253 | |
| 1254 | |
| 1255 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1256 | # self.test_status = True |
| 1257 | return self.test_status |
| 1258 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1259 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1260 | 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] | 1261 | chan = 0 |
| 1262 | #for i in range(self.VOLTHA_IGMP_ITERATIONS): |
| 1263 | for i in range(3): |
| 1264 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1265 | self.num_joins += 1 |
| 1266 | while self.num_joins < self.num_subscribers: |
| 1267 | time.sleep(5) |
| 1268 | log_test.info('All subscribers have joined the channel') |
| 1269 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1]) |
| 1270 | time.sleep(5) |
| 1271 | 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])) |
| 1272 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_BLOCK_OLD) |
| 1273 | #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0] |
| 1274 | time.sleep(60) |
| 1275 | self.recv_timeout = False |
| 1276 | subscriber.recv_timeout = False |
| 1277 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1]) |
| 1278 | if self.test_status is True: |
| 1279 | self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0]) |
| 1280 | if self.test_status is False: |
| 1281 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1282 | continue |
| 1283 | subscriber.recv_timeout = False |
| 1284 | self.recv_timeout = False |
| 1285 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1286 | # self.test_status = True |
| 1287 | return self.test_status |
| 1288 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1289 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1290 | 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] | 1291 | chan = 0 |
| 1292 | #for i in range(self.VOLTHA_IGMP_ITERATIONS): |
| 1293 | for i in range(3): |
| 1294 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1295 | self.num_joins += 1 |
| 1296 | while self.num_joins < self.num_subscribers: |
| 1297 | time.sleep(5) |
| 1298 | log_test.info('All subscribers have joined the channel') |
| 1299 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[1]) |
| 1300 | time.sleep(5) |
| 1301 | 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])) |
| 1302 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list[0], record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE) |
| 1303 | #### Adding delay till igmp timer expire data traffic is received from source specific of subscriber.src_list[0] |
| 1304 | time.sleep(60) |
| 1305 | self.recv_timeout = False |
| 1306 | subscriber.recv_timeout = False |
| 1307 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[1]) |
| 1308 | if self.test_status is True: |
| 1309 | self.test_status = subscriber.channel_not_receive(chan, cb = subscriber.recv_channel_cb, count = 1, src_list = subscriber.src_list[0]) |
| 1310 | if self.test_status is False: |
| 1311 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1312 | continue |
| 1313 | subscriber.recv_timeout = False |
| 1314 | self.recv_timeout = False |
| 1315 | log_test.info('Again include the channel %s on port %s with souce list ip %s' %(chan, subscriber.rx_port,subscriber.src_list[0])) |
| 1316 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_ALLOW_NEW) |
| 1317 | time.sleep(5) |
| 1318 | # self.recv_timeout = True |
| 1319 | # subscriber.recv_timeout = True |
| 1320 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 5, src_list = subscriber.src_list[0]) |
| 1321 | subscriber.recv_timeout = False |
| 1322 | self.recv_timeout = False |
| 1323 | |
| 1324 | |
| 1325 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1326 | # self.test_status = True |
| 1327 | return self.test_status |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1328 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1329 | def igmp_flow_check_group_include_source_empty_list(self, subscriber, multiple_sub = False): |
| 1330 | chan = 0 |
| 1331 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1332 | self.num_joins += 1 |
| 1333 | while self.num_joins < self.num_subscribers: |
| 1334 | time.sleep(5) |
| 1335 | log_test.info('All subscribers have joined the channel') |
| 1336 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10) |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 1337 | if self.test_status is True: |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1338 | log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port)) |
| 1339 | self.test_status = False |
| 1340 | else: |
| 1341 | 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] | 1342 | self.test_status = True |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1343 | log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1344 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1345 | time.sleep(5) |
| 1346 | subscriber.recv_timeout = False |
| 1347 | self.recv_timeout = False |
| 1348 | return self.test_status |
| 1349 | |
| 1350 | def igmp_flow_check_group_exclude_source_empty_list(self, subscriber, multiple_sub = False): |
| 1351 | chan = 0 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 1352 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1353 | self.num_joins += 1 |
| 1354 | while self.num_joins < self.num_subscribers: |
| 1355 | time.sleep(5) |
| 1356 | log_test.info('All subscribers have joined the channel') |
| 1357 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10) |
| 1358 | if self.test_status is True: |
| 1359 | log_test.info('Subscriber should not receive data from channel %s on any specific source %s, test is failed' %(chan, subscriber.rx_port)) |
| 1360 | self.test_status = False |
| 1361 | else: |
| 1362 | log_test.info('Subscriber not receive data from channel %s on any specific source %s' %(chan, subscriber.rx_port)) |
| 1363 | self.test_status = True |
| 1364 | |
| 1365 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list, record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE) |
| 1366 | log_test.info('Send join to multicast group with exclude empty source list and waited till GMI timer expires') |
| 1367 | time.sleep(60) |
| 1368 | |
| 1369 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10) |
| 1370 | log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1371 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1372 | time.sleep(5) |
| 1373 | subscriber.recv_timeout = False |
| 1374 | self.recv_timeout = False |
| 1375 | return self.test_status |
| 1376 | |
| 1377 | def igmp_flow_check_group_exclude_source_empty_list_1(self, subscriber, multiple_sub = False): |
| 1378 | chan = 0 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1379 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list,record_type = IGMP_V3_GR_TYPE_CHANGE_TO_EXCLUDE) |
| 1380 | self.num_joins += 1 |
| 1381 | while self.num_joins < self.num_subscribers: |
| 1382 | time.sleep(5) |
| 1383 | log_test.info('All subscribers have joined the channel') |
| 1384 | for i in range(10): |
| 1385 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list) |
| 1386 | log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1387 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1388 | time.sleep(5) |
| 1389 | log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats)) |
| 1390 | #Should not receive packets for this subscriber |
| 1391 | self.recv_timeout = True |
| 1392 | subscriber.recv_timeout = True |
| 1393 | subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list) |
| 1394 | subscriber.recv_timeout = False |
| 1395 | self.recv_timeout = False |
| 1396 | log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port)) |
| 1397 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1398 | # self.test_status = True |
| 1399 | return self.test_status |
| 1400 | |
| 1401 | def igmp_flow_check_during_olt_onu_operational_issues(self, subscriber, multiple_sub = False): |
| 1402 | chan = 0 |
| 1403 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1404 | self.num_joins += 1 |
| 1405 | while self.num_joins < self.num_subscribers: |
| 1406 | time.sleep(5) |
| 1407 | log_test.info('All subscribers have joined the channel') |
| 1408 | for i in range(2): |
| 1409 | self.test_status = subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list) |
| 1410 | log_test.info('Leaving channel %d for subscriber on port %s' %(chan, subscriber.rx_port)) |
| 1411 | subscriber.channel_leave(chan, src_list = subscriber.src_list) |
| 1412 | time.sleep(5) |
| 1413 | log_test.info('Interface %s Join RX stats for subscriber, %s' %(subscriber.iface,subscriber.join_rx_stats)) |
| 1414 | #Should not receive packets for this subscriber |
| 1415 | self.recv_timeout = True |
| 1416 | subscriber.recv_timeout = True |
| 1417 | subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 10, src_list = subscriber.src_list) |
| 1418 | subscriber.recv_timeout = False |
| 1419 | self.recv_timeout = False |
| 1420 | log_test.info('Joining channel %d for subscriber port %s' %(chan, subscriber.rx_port)) |
| 1421 | subscriber.channel_join(chan, delay = 0, src_list = subscriber.src_list) |
| 1422 | # self.test_status = True |
| 1423 | return self.test_status |
| 1424 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1425 | def voltha_igmp_jump_verify(self, subscriber): |
| 1426 | if subscriber.has_service('IGMP'): |
| 1427 | for i in xrange(subscriber.num): |
| 1428 | log_test.info('Subscriber %s jumping channel' %subscriber.name) |
| 1429 | chan = subscriber.channel_jump(delay=0) |
| 1430 | subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1) |
| 1431 | log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name)) |
| 1432 | time.sleep(3) |
| 1433 | log_test.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats)) |
| 1434 | self.test_status = True |
| 1435 | return self.test_status |
| 1436 | |
| 1437 | def voltha_igmp_next_verify(self, subscriber): |
| 1438 | for c in xrange(self.VOLTHA_IGMP_ITERATIONS): |
| 1439 | for i in xrange(subscriber.num): |
| 1440 | if i: |
| 1441 | chan = subscriber.channel_join_next(delay=0, leave_flag = self.leave_flag) |
| 1442 | time.sleep(0.2) |
| 1443 | else: |
| 1444 | chan = subscriber.channel_join(i, delay=0) |
| 1445 | time.sleep(0.2) |
| 1446 | if subscriber.num == 1: |
| 1447 | subscriber.channel_leave(chan) |
| 1448 | log_test.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name)) |
| 1449 | #subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1) |
| 1450 | #log_test.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name)) |
| 1451 | self.test_status = True |
| 1452 | return self.test_status |
| 1453 | |
| 1454 | 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] | 1455 | """Test subscriber join next for channel surfing""" |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1456 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1457 | rest_port = self.VOLTHA_REST_PORT, |
| 1458 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1459 | if self.VOLTHA_OLT_TYPE.startswith('ponsim'): |
| 1460 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1461 | log_test.info('Enabling ponsim olt') |
| 1462 | 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] | 1463 | if device_id != '': |
| 1464 | self.olt_device_id = device_id |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1465 | else: |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 1466 | log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution') |
| 1467 | assert_equal(False, True) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1468 | |
| 1469 | assert_not_equal(device_id, None) |
| 1470 | if status == False: |
| 1471 | voltha.disable_device(device_id, delete = True) |
| 1472 | assert_equal(status, True) |
| 1473 | time.sleep(10) |
| 1474 | switch_map = None |
| 1475 | olt_configured = False |
| 1476 | try: |
| 1477 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1478 | if not switch_map: |
| 1479 | log_test.info('No voltha devices found') |
| 1480 | return |
| 1481 | log_test.info('Installing OLT app') |
| 1482 | OnosCtrl.install_app(self.olt_app_file) |
| 1483 | time.sleep(5) |
| 1484 | log_test.info('Adding subscribers through OLT app') |
| 1485 | self.config_olt(switch_map) |
| 1486 | olt_configured = True |
| 1487 | time.sleep(5) |
| 1488 | self.num_subscribers = num_subscribers |
| 1489 | self.num_channels = num_channels |
| 1490 | test_status = self.subscriber_flows_check(num_subscribers = self.num_subscribers, |
| 1491 | num_channels = self.num_channels, |
| 1492 | cbs = cbs, |
| 1493 | port_list = self.generate_port_list(self.num_subscribers, |
| 1494 | self.num_channels), |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1495 | src_list = src_list, services = services) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 1496 | if test_status is False: |
| 1497 | self.success = False |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1498 | assert_equal(test_status, True) |
| 1499 | finally: |
| 1500 | if switch_map is not None: |
| 1501 | if olt_configured is True: |
| 1502 | self.remove_olt(switch_map) |
| 1503 | voltha.disable_device(device_id, delete = True) |
| 1504 | time.sleep(10) |
| 1505 | log_test.info('Uninstalling OLT app') |
| 1506 | OnosCtrl.uninstall_app(self.olt_app_name) |
| 1507 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1508 | def subscriber_flows_check( self, num_subscribers = 1, num_channels = 1, |
| 1509 | channel_start = 0, cbs = None, port_list = [], src_list = None, |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1510 | services = None, negative_subscriber_auth = None): |
| 1511 | self.test_status = False |
| 1512 | self.ovs_cleanup() |
| 1513 | subscribers_count = num_subscribers |
| 1514 | sub_loop_count = num_subscribers |
| 1515 | if not port_list: |
| 1516 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 1517 | subscriber_tx_rx_ports = [] |
| 1518 | for i in range(num_subscribers): |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1519 | subscriber_tx_rx_ports.append(Voltha_olt_subscribers(tx_port = self.port_map[port_list[i][0]], |
| 1520 | rx_port = self.port_map[port_list[i][1]], |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1521 | num_channels = num_channels,src_list = src_list,)) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1522 | self.onos_aaa_load() |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1523 | #load the ssm list for all subscriber channels |
| 1524 | igmpChannel = IgmpChannel(src_list = src_list) |
| 1525 | ssm_groups = map(lambda sub: sub.channels, subscriber_tx_rx_ports) |
| 1526 | ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 1527 | if src_list is None: |
| 1528 | igmpChannel = IgmpChannel() |
| 1529 | igmpChannel.igmp_load_ssm_config(ssm_list) |
| 1530 | else: |
| 1531 | igmpChannel = IgmpChannel(src_list = src_list) |
| 1532 | igmpChannel.igmp_load_ssm_config(ssm_list, src_list= src_list) |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 1533 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1534 | self.thread_pool = ThreadPool(min(100, subscribers_count), queue_size=1, wait_timeout=1) |
| 1535 | |
| 1536 | chan_leave = False #for single channel, multiple subscribers |
| 1537 | if cbs is None: |
| 1538 | cbs = (self.tls_flow_check, self.dhcp_flow_check, self.igmp_flow_check) |
| 1539 | chan_leave = True |
| 1540 | for subscriber in subscriber_tx_rx_ports: |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1541 | if 'IGMP' in services: |
| 1542 | # if src_list: |
| 1543 | # for i in range(len(src_list)): |
| 1544 | # subscriber.start(src_ip = src_list[i]) |
| 1545 | # else: |
| 1546 | # subscriber.start() |
| 1547 | subscriber.start() |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1548 | sub_loop_count = sub_loop_count - 1 |
| 1549 | pool_object = voltha_subscriber_pool(subscriber, cbs) |
| 1550 | self.thread_pool.addTask(pool_object.pool_cb) |
| 1551 | self.thread_pool.cleanUpThreads() |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 1552 | for subscriber in subscriber_tx_rx_ports: |
| 1553 | if services and 'IGMP' in services: |
| 1554 | # if src_list: |
| 1555 | # for i in range(len(src_list)): |
| 1556 | # subscriber.stop(src_ip = src_list[i]) |
| 1557 | # else: |
| 1558 | # subscriber.stop() |
| 1559 | subscriber.stop() |
| 1560 | if chan_leave is True: |
| 1561 | subscriber.channel_leave(0) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1562 | subscribers_count = 0 |
| 1563 | return self.test_status |
| 1564 | |
| 1565 | |
| 1566 | def generate_port_list(self, subscribers, channels): |
| 1567 | return self.port_list[:subscribers] |
| 1568 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 1569 | @classmethod |
| 1570 | def ovs_cleanup(cls): |
| 1571 | ##For every test case, delete all the OVS groups |
| 1572 | cmd = 'ovs-ofctl del-groups br-int -OOpenFlow11 >/dev/null 2>&1' |
| 1573 | try: |
| 1574 | cord_test_shell(cmd) |
| 1575 | ##Since olt config is used for this test, we just fire a careless local cmd as well |
| 1576 | os.system(cmd) |
| 1577 | finally: |
| 1578 | return |
| 1579 | |
A.R Karthick | 8a507cf | 2017-06-02 18:44:49 -0700 | [diff] [blame] | 1580 | def test_olt_enable_disable(self): |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 1581 | 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] | 1582 | device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC) |
| 1583 | assert_not_equal(device_id, None) |
| 1584 | try: |
| 1585 | assert_equal(status, True) |
| 1586 | time.sleep(10) |
| 1587 | finally: |
| 1588 | self.voltha.disable_device(device_id, delete = True) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1589 | |
A.R Karthick | 8a507cf | 2017-06-02 18:44:49 -0700 | [diff] [blame] | 1590 | def test_ponsim_enable_disable(self): |
A.R Karthick | 8b9c5f1 | 2017-05-30 17:47:08 -0700 | [diff] [blame] | 1591 | log_test.info('Enabling ponsim_olt') |
| 1592 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
A.R Karthick | 8a507cf | 2017-06-02 18:44:49 -0700 | [diff] [blame] | 1593 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1594 | assert_not_equal(device_id, None) |
| 1595 | try: |
| 1596 | assert_equal(status, True) |
| 1597 | time.sleep(10) |
| 1598 | finally: |
| 1599 | self.voltha.disable_device(device_id, delete = True) |
A.R Karthick | 8b9c5f1 | 2017-05-30 17:47:08 -0700 | [diff] [blame] | 1600 | |
A R Karthick | 31a4017 | 2017-08-14 12:06:09 -0700 | [diff] [blame] | 1601 | def test_maple_enable_disable(self): |
| 1602 | log_test.info('Enabling maple olt') |
| 1603 | if self.VOLTHA_OLT_IP: |
| 1604 | address = self.VOLTHA_OLT_IP |
| 1605 | device_id, status = self.voltha.enable_device('maple_olt', address = address) |
| 1606 | assert_not_equal(device_id, None) |
| 1607 | try: |
| 1608 | assert_equal(status, True) |
| 1609 | time.sleep(10) |
| 1610 | finally: |
| 1611 | self.voltha.disable_device(device_id, delete = True) |
| 1612 | |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1613 | def test_subscriber_with_voltha_for_eap_tls_authentication(self): |
| 1614 | """ |
| 1615 | Test Method: |
| 1616 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1617 | 1. OLT and ONU is detected and validated. |
| 1618 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1619 | 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1620 | 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius. |
| 1621 | 5. Verify that subscriber is authenticated successfully. |
| 1622 | """ |
A R Karthick | caa1b6a | 2017-07-27 14:07:05 -0700 | [diff] [blame] | 1623 | ret = voltha_setup( |
| 1624 | host = self.VOLTHA_HOST, |
| 1625 | rest_port = self.VOLTHA_REST_PORT, |
| 1626 | olt_type = 'ponsim_olt', |
| 1627 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP, |
| 1628 | uplink_vlan_start = self.VOLTHA_UPLINK_VLAN_START, |
| 1629 | config_fake = self.VOLTHA_CONFIG_FAKE, |
| 1630 | olt_app = self.olt_app_file) |
| 1631 | assert_not_equal(ret, None) |
| 1632 | voltha, device_id, switch_map = ret[0], ret[1], ret[2] |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1633 | try: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 1634 | log_test.info('Adding subscribers through OLT app') |
| 1635 | self.config_olt(switch_map) |
| 1636 | olt_configured = True |
| 1637 | time.sleep(5) |
| 1638 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1639 | assert_equal(auth_status, True) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1640 | finally: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 1641 | if switch_map is not None: |
| 1642 | if olt_configured is True: |
| 1643 | self.remove_olt(switch_map) |
A R Karthick | caa1b6a | 2017-07-27 14:07:05 -0700 | [diff] [blame] | 1644 | 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] | 1645 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1646 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1647 | def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self): |
| 1648 | """ |
| 1649 | Test Method: |
| 1650 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1651 | 1. OLT and ONU is detected and validated. |
| 1652 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1653 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1654 | 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius. |
| 1655 | 5. Verify that subscriber authentication is unsuccessful.. |
| 1656 | """ |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1657 | df = defer.Deferred() |
| 1658 | def tls_flow_check_with_no_cert_scenario(df): |
| 1659 | log_test.info('Enabling ponsim_olt') |
| 1660 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1661 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1662 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1663 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1664 | time.sleep(10) |
| 1665 | switch_map = None |
| 1666 | olt_configured = False |
| 1667 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1668 | log_test.info('Installing OLT app') |
| 1669 | OnosCtrl.install_app(self.olt_app_file) |
| 1670 | time.sleep(5) |
| 1671 | log_test.info('Adding subscribers through OLT app') |
| 1672 | self.config_olt(switch_map) |
| 1673 | olt_configured = True |
| 1674 | time.sleep(5) |
| 1675 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert") |
| 1676 | try: |
| 1677 | assert_equal(auth_status, True) |
| 1678 | assert_equal(status, True) |
| 1679 | time.sleep(10) |
| 1680 | finally: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 1681 | self.remove_olt(switch_map) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1682 | self.voltha.disable_device(device_id, delete = True) |
| 1683 | df.callback(0) |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 1684 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1685 | reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df) |
| 1686 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1687 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1688 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1689 | def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self): |
| 1690 | """ |
| 1691 | Test Method: |
| 1692 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1693 | 1. OLT and ONU is detected and validated. |
| 1694 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1695 | 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber.. |
| 1696 | 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius. |
| 1697 | 5. Verify that subscriber authentication is unsuccessful.. |
| 1698 | """ |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1699 | df = defer.Deferred() |
| 1700 | def tls_flow_check_with_invalid_cert_scenario(df): |
| 1701 | log_test.info('Enabling ponsim_olt') |
| 1702 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1703 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1704 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1705 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1706 | time.sleep(10) |
| 1707 | switch_map = None |
| 1708 | olt_configured = False |
| 1709 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1710 | log_test.info('Installing OLT app') |
| 1711 | OnosCtrl.install_app(self.olt_app_file) |
| 1712 | time.sleep(5) |
| 1713 | log_test.info('Adding subscribers through OLT app') |
| 1714 | self.config_olt(switch_map) |
| 1715 | olt_configured = True |
| 1716 | time.sleep(5) |
| 1717 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert") |
| 1718 | try: |
| 1719 | assert_equal(auth_status, True) |
| 1720 | assert_equal(status, True) |
| 1721 | time.sleep(10) |
| 1722 | finally: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 1723 | self.remove_olt(switch_map) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 1724 | self.voltha.disable_device(device_id, delete = True) |
| 1725 | df.callback(0) |
| 1726 | reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df) |
| 1727 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1728 | |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1729 | @deferred(TESTCASE_TIMEOUT) |
| 1730 | def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self): |
| 1731 | """ |
| 1732 | Test Method: |
| 1733 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1734 | 1. OLT and ONU is detected and validated. |
| 1735 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1736 | 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times. |
| 1737 | 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius. |
| 1738 | 5. Verify that subscriber authentication is unsuccessful.. |
| 1739 | """ |
| 1740 | df = defer.Deferred() |
| 1741 | def tls_flow_check_with_no_cert_scenario(df): |
| 1742 | log_test.info('Enabling ponsim_olt') |
| 1743 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1744 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1745 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1746 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1747 | time.sleep(10) |
| 1748 | switch_map = None |
| 1749 | olt_configured = False |
| 1750 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1751 | log_test.info('Installing OLT app') |
| 1752 | OnosCtrl.install_app(self.olt_app_file) |
| 1753 | time.sleep(5) |
| 1754 | log_test.info('Adding subscribers through OLT app') |
| 1755 | self.config_olt(switch_map) |
| 1756 | olt_configured = True |
| 1757 | time.sleep(5) |
| 1758 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert") |
| 1759 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert") |
| 1760 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert") |
| 1761 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert") |
| 1762 | try: |
| 1763 | assert_equal(auth_status, True) |
| 1764 | assert_equal(status, True) |
| 1765 | time.sleep(10) |
| 1766 | finally: |
| 1767 | self.voltha.disable_device(device_id, delete = True) |
| 1768 | df.callback(0) |
| 1769 | reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df) |
| 1770 | return df |
| 1771 | |
| 1772 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1773 | def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self): |
| 1774 | """ |
| 1775 | Test Method: |
| 1776 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1777 | 1. OLT and ONU is detected and validated. |
| 1778 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1779 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1780 | 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius. |
| 1781 | 5. Verify that subscriber authentication is unsuccessful.. |
| 1782 | """ |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1783 | df = defer.Deferred() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1784 | def tls_flow_check_deactivating_app(df): |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1785 | aaa_app = ["org.opencord.aaa"] |
| 1786 | log_test.info('Enabling ponsim_olt') |
| 1787 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1788 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1789 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1790 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1791 | time.sleep(10) |
| 1792 | switch_map = None |
| 1793 | olt_configured = False |
| 1794 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1795 | log_test.info('Installing OLT app') |
| 1796 | OnosCtrl.install_app(self.olt_app_file) |
| 1797 | time.sleep(5) |
| 1798 | log_test.info('Adding subscribers through OLT app') |
| 1799 | self.config_olt(switch_map) |
| 1800 | olt_configured = True |
| 1801 | time.sleep(5) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1802 | |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1803 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",)) |
| 1804 | thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,)) |
| 1805 | thread1.start() |
| 1806 | time.sleep(randint(1,2)) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1807 | 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] | 1808 | thread2.start() |
| 1809 | time.sleep(10) |
| 1810 | thread1.join() |
| 1811 | thread2.join() |
| 1812 | try: |
| 1813 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1814 | assert_equal(self.success, True) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1815 | time.sleep(10) |
| 1816 | finally: |
| 1817 | self.voltha.disable_device(device_id, delete = True) |
| 1818 | df.callback(0) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1819 | reactor.callLater(0, tls_flow_check_deactivating_app, df) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1820 | return df |
| 1821 | |
| 1822 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1823 | def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self): |
| 1824 | """ |
| 1825 | Test Method: |
| 1826 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1827 | 1. OLT and ONU is detected and validated. |
| 1828 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1829 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1830 | 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius. |
| 1831 | 5. Verify that subscriber authentication is unsuccessful.. |
| 1832 | """ |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1833 | df = defer.Deferred() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1834 | def tls_flow_check_restarting_radius(df): |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1835 | aaa_app = ["org.opencord.aaa"] |
| 1836 | log_test.info('Enabling ponsim_olt') |
| 1837 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1838 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1839 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1840 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1841 | time.sleep(10) |
| 1842 | switch_map = None |
| 1843 | olt_configured = False |
| 1844 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1845 | log_test.info('Installing OLT app') |
| 1846 | OnosCtrl.install_app(self.olt_app_file) |
| 1847 | time.sleep(5) |
| 1848 | log_test.info('Adding subscribers through OLT app') |
| 1849 | self.config_olt(switch_map) |
| 1850 | olt_configured = True |
| 1851 | time.sleep(5) |
| 1852 | |
| 1853 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius")) |
| 1854 | thread2 = threading.Thread(target = cord_test_radius_restart) |
| 1855 | thread1.start() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1856 | time.sleep(randint(1,2)) |
| 1857 | 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] | 1858 | thread2.start() |
| 1859 | time.sleep(10) |
| 1860 | thread1.join() |
| 1861 | thread2.join() |
| 1862 | try: |
| 1863 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1864 | assert_equal(self.success, True) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1865 | time.sleep(10) |
| 1866 | finally: |
| 1867 | self.voltha.disable_device(device_id, delete = True) |
| 1868 | df.callback(0) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1869 | reactor.callLater(0, tls_flow_check_restarting_radius, df) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1870 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1871 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1872 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1873 | def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self): |
| 1874 | """ |
| 1875 | Test Method: |
| 1876 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1877 | 1. OLT and ONU is detected and validated. |
| 1878 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1879 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1880 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 1881 | 6. Verify that subscriber authenticated successfully. |
| 1882 | 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber. |
| 1883 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 1884 | 9. Verify that subscriber authentication is unsuccessful.. |
| 1885 | """ |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1886 | df = defer.Deferred() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1887 | def tls_flow_check_operating_olt_state(df): |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1888 | aaa_app = ["org.opencord.aaa"] |
| 1889 | log_test.info('Enabling ponsim_olt') |
| 1890 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1891 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1892 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1893 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1894 | time.sleep(10) |
| 1895 | switch_map = None |
| 1896 | olt_configured = False |
| 1897 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1898 | log_test.info('Installing OLT app') |
| 1899 | OnosCtrl.install_app(self.olt_app_file) |
| 1900 | time.sleep(5) |
| 1901 | log_test.info('Adding subscribers through OLT app') |
| 1902 | self.config_olt(switch_map) |
| 1903 | olt_configured = True |
| 1904 | time.sleep(5) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1905 | |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1906 | 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] | 1907 | 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] | 1908 | thread1.start() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1909 | time.sleep(randint(1,2)) |
| 1910 | 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] | 1911 | thread2.start() |
| 1912 | time.sleep(10) |
| 1913 | thread1.join() |
| 1914 | thread2.join() |
| 1915 | try: |
| 1916 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1917 | assert_equal(self.success, True) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1918 | time.sleep(10) |
| 1919 | finally: |
| 1920 | self.voltha.disable_device(device_id, delete = True) |
| 1921 | df.callback(0) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1922 | reactor.callLater(0, tls_flow_check_operating_olt_state, df) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 1923 | return df |
| 1924 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1925 | @deferred(TESTCASE_TIMEOUT) |
| 1926 | 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] | 1927 | """ |
| 1928 | Test Method: |
| 1929 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1930 | 1. OLT and ONU is detected and validated. |
| 1931 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1932 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1933 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 1934 | 6. Verify that subscriber authenticated successfully. |
| 1935 | 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber. |
| 1936 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 1937 | 9. Verify that subscriber authentication is unsuccessful.. |
| 1938 | """ |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1939 | df = defer.Deferred() |
| 1940 | def tls_flow_check_operating_olt_state(df): |
| 1941 | aaa_app = ["org.opencord.aaa"] |
| 1942 | log_test.info('Enabling ponsim_olt') |
| 1943 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1944 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1945 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 1946 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1947 | time.sleep(10) |
| 1948 | switch_map = None |
| 1949 | olt_configured = False |
| 1950 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1951 | log_test.info('Installing OLT app') |
| 1952 | OnosCtrl.install_app(self.olt_app_file) |
| 1953 | time.sleep(5) |
| 1954 | log_test.info('Adding subscribers through OLT app') |
| 1955 | self.config_olt(switch_map) |
| 1956 | olt_configured = True |
| 1957 | time.sleep(5) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1958 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1959 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",)) |
| 1960 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle) |
| 1961 | thread1.start() |
| 1962 | time.sleep(randint(1,2)) |
| 1963 | log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha') |
| 1964 | thread2.start() |
| 1965 | time.sleep(10) |
| 1966 | thread1.join() |
| 1967 | thread2.join() |
| 1968 | try: |
| 1969 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1970 | assert_equal(self.success, True) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1971 | time.sleep(10) |
| 1972 | finally: |
| 1973 | self.voltha.disable_device(device_id, delete = True) |
| 1974 | df.callback(0) |
| 1975 | reactor.callLater(0, tls_flow_check_operating_olt_state, df) |
| 1976 | return df |
| 1977 | |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 1978 | @deferred(TESTCASE_TIMEOUT +600) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 1979 | def test_subscriber_with_voltha_for_eap_tls_authentication_carrying_out_multiple_times_toggling_of_uni_port(self): |
| 1980 | """ |
| 1981 | Test Method: |
| 1982 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1983 | 1. OLT and ONU is detected and validated. |
| 1984 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1985 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1986 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 1987 | 6. Verify that subscriber authenticated successfully. |
| 1988 | 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber. |
| 1989 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 1990 | 9. Verify that subscriber authentication is unsuccessful.. |
| 1991 | 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow |
| 1992 | |
| 1993 | """ |
| 1994 | df = defer.Deferred() |
| 1995 | no_iterations = 10 |
| 1996 | def tls_flow_check_with_disable_olt_device_scenario(df): |
| 1997 | aaa_app = ["org.opencord.aaa"] |
| 1998 | log_test.info('Enabling ponsim_olt') |
| 1999 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2000 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2001 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2002 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2003 | time.sleep(10) |
| 2004 | switch_map = None |
| 2005 | olt_configured = False |
| 2006 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2007 | log_test.info('Installing OLT app') |
| 2008 | OnosCtrl.install_app(self.olt_app_file) |
| 2009 | time.sleep(5) |
| 2010 | log_test.info('Adding subscribers through OLT app') |
| 2011 | self.config_olt(switch_map) |
| 2012 | olt_configured = True |
| 2013 | time.sleep(5) |
| 2014 | for i in range(no_iterations): |
| 2015 | 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] | 2016 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2017 | thread1.start() |
| 2018 | time.sleep(randint(1,2)) |
| 2019 | log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha') |
| 2020 | thread2.start() |
| 2021 | time.sleep(10) |
| 2022 | thread1.join() |
| 2023 | thread2.join() |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 2024 | time.sleep(60) |
| 2025 | cord_test_radius_restart() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2026 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT) |
| 2027 | try: |
| 2028 | # assert_equal(status, True) |
| 2029 | assert_equal(auth_status, True) |
| 2030 | assert_equal(self.success, True) |
| 2031 | time.sleep(10) |
| 2032 | finally: |
| 2033 | self.voltha.disable_device(device_id, delete = True) |
| 2034 | df.callback(0) |
| 2035 | reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df) |
| 2036 | return df |
| 2037 | |
| 2038 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2039 | def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self): |
| 2040 | """ |
| 2041 | Test Method: |
| 2042 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2043 | 1. OLT and ONU is detected and validated. |
| 2044 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2045 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2046 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 2047 | 6. Verify that subscriber authenticated successfully. |
| 2048 | 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber. |
| 2049 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 2050 | 9. Verify that subscriber authentication is unsuccessful.. |
| 2051 | """ |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2052 | df = defer.Deferred() |
| 2053 | def tls_flow_check_operating_olt_state(df): |
| 2054 | aaa_app = ["org.opencord.aaa"] |
| 2055 | log_test.info('Enabling ponsim_olt') |
| 2056 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2057 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2058 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2059 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2060 | time.sleep(10) |
| 2061 | switch_map = None |
| 2062 | olt_configured = False |
| 2063 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2064 | log_test.info('Installing OLT app') |
| 2065 | OnosCtrl.install_app(self.olt_app_file) |
| 2066 | time.sleep(5) |
| 2067 | log_test.info('Adding subscribers through OLT app') |
| 2068 | self.config_olt(switch_map) |
| 2069 | olt_configured = True |
| 2070 | time.sleep(5) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2071 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2072 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",)) |
| 2073 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,)) |
| 2074 | thread1.start() |
| 2075 | time.sleep(randint(1,2)) |
| 2076 | log_test.info('Restart the ponsim olt device during tls auth flow check on voltha') |
| 2077 | thread2.start() |
| 2078 | time.sleep(10) |
| 2079 | thread1.join() |
| 2080 | thread2.join() |
| 2081 | try: |
| 2082 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2083 | assert_equal(self.success, True) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2084 | time.sleep(10) |
| 2085 | finally: |
| 2086 | self.voltha.disable_device(device_id, delete = True) |
| 2087 | df.callback(0) |
| 2088 | reactor.callLater(0, tls_flow_check_operating_olt_state, df) |
| 2089 | return df |
| 2090 | |
| 2091 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2092 | 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] | 2093 | """ |
| 2094 | Test Method: |
| 2095 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2096 | 1. OLT and ONU is detected and validated. |
| 2097 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2098 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2099 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 2100 | 6. Verify that subscriber authenticated successfully. |
| 2101 | 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber. |
| 2102 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 2103 | 9. Verify that subscriber authentication is unsuccessful.. |
| 2104 | 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow |
| 2105 | """ |
| 2106 | df = defer.Deferred() |
| 2107 | no_iterations = 10 |
| 2108 | def tls_flow_check_with_disable_olt_device_scenario(df): |
| 2109 | aaa_app = ["org.opencord.aaa"] |
| 2110 | log_test.info('Enabling ponsim_olt') |
| 2111 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2112 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2113 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2114 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2115 | time.sleep(10) |
| 2116 | switch_map = None |
| 2117 | olt_configured = False |
| 2118 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2119 | log_test.info('Installing OLT app') |
| 2120 | OnosCtrl.install_app(self.olt_app_file) |
| 2121 | time.sleep(5) |
| 2122 | log_test.info('Adding subscribers through OLT app') |
| 2123 | self.config_olt(switch_map) |
| 2124 | olt_configured = True |
| 2125 | time.sleep(5) |
| 2126 | for i in range(no_iterations): |
| 2127 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",)) |
| 2128 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,)) |
| 2129 | thread1.start() |
| 2130 | time.sleep(randint(1,2)) |
| 2131 | log_test.info('Restart the ponsim olt device during tls auth flow check on voltha') |
| 2132 | thread2.start() |
| 2133 | time.sleep(10) |
| 2134 | thread1.join() |
| 2135 | thread2.join() |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 2136 | time.sleep(60) |
| 2137 | cord_test_radius_restart() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2138 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT) |
| 2139 | try: |
| 2140 | # assert_equal(status, True) |
| 2141 | assert_equal(auth_status, True) |
| 2142 | assert_equal(self.success, True) |
| 2143 | time.sleep(10) |
| 2144 | finally: |
| 2145 | self.voltha.disable_device(device_id, delete = True) |
| 2146 | df.callback(0) |
| 2147 | reactor.callLater(0, tls_flow_check_with_disable_olt_device_scenario, df) |
| 2148 | return df |
| 2149 | |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2150 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2151 | def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self): |
| 2152 | """ |
| 2153 | Test Method: |
| 2154 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2155 | 1. OLT and ONU is detected and validated. |
| 2156 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2157 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2158 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 2159 | 6. Verify that subscriber authenticated successfully. |
| 2160 | 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber. |
| 2161 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 2162 | 9. Verify that subscriber authentication is unsuccessful.. |
| 2163 | """ |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2164 | df = defer.Deferred() |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 2165 | def tls_flow_check_operating_onu_state(df): |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2166 | aaa_app = ["org.opencord.aaa"] |
| 2167 | log_test.info('Enabling ponsim_olt') |
| 2168 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2169 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2170 | devices_list = self.voltha.get_devices() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2171 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2172 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2173 | onu_device_id = devices_list['items'][1]['id'] |
| 2174 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2175 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2176 | time.sleep(10) |
| 2177 | switch_map = None |
| 2178 | olt_configured = False |
| 2179 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2180 | log_test.info('Installing OLT app') |
| 2181 | OnosCtrl.install_app(self.olt_app_file) |
| 2182 | time.sleep(5) |
| 2183 | log_test.info('Adding subscribers through OLT app') |
| 2184 | self.config_olt(switch_map) |
| 2185 | olt_configured = True |
| 2186 | time.sleep(5) |
| 2187 | devices_list = self.voltha.get_devices() |
| 2188 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",)) |
| 2189 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,)) |
| 2190 | thread1.start() |
| 2191 | time.sleep(randint(1,2)) |
| 2192 | log_test.info('Restart the ponsim oon device during tls auth flow check on voltha') |
| 2193 | thread2.start() |
| 2194 | time.sleep(10) |
| 2195 | thread1.join() |
| 2196 | thread2.join() |
| 2197 | try: |
| 2198 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2199 | assert_equal(self.success, True) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2200 | time.sleep(10) |
| 2201 | finally: |
| 2202 | self.voltha.disable_device(device_id, delete = True) |
| 2203 | df.callback(0) |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 2204 | reactor.callLater(0, tls_flow_check_operating_onu_state, df) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 2205 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2206 | |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2207 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2208 | def test_subscriber_with_voltha_for_eap_tls_authentication_performing_multiple_times_restart_of_onu(self): |
| 2209 | """ |
| 2210 | Test Method: |
| 2211 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2212 | 1. OLT and ONU is detected and validated. |
| 2213 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2214 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2215 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 2216 | 6. Verify that subscriber authenticated successfully. |
| 2217 | 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber. |
| 2218 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 2219 | 9. Verify that subscriber authentication is unsuccessful.. |
| 2220 | 10. Repeat steps from 3 to 9 for 10 times and finally verify tls flow |
| 2221 | """ |
| 2222 | df = defer.Deferred() |
| 2223 | no_iterations = 10 |
| 2224 | def tls_flow_check_operating_olt_state(df): |
| 2225 | aaa_app = ["org.opencord.aaa"] |
| 2226 | log_test.info('Enabling ponsim_olt') |
| 2227 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2228 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2229 | devices_list = self.voltha.get_devices() |
| 2230 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2231 | |
| 2232 | onu_device_id = devices_list['items'][1]['id'] |
| 2233 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2234 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2235 | time.sleep(10) |
| 2236 | switch_map = None |
| 2237 | olt_configured = False |
| 2238 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2239 | log_test.info('Installing OLT app') |
| 2240 | OnosCtrl.install_app(self.olt_app_file) |
| 2241 | time.sleep(5) |
| 2242 | log_test.info('Adding subscribers through OLT app') |
| 2243 | self.config_olt(switch_map) |
| 2244 | olt_configured = True |
| 2245 | time.sleep(5) |
| 2246 | devices_list = self.voltha.get_devices() |
| 2247 | for i in range(no_iterations): |
| 2248 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",)) |
| 2249 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,)) |
| 2250 | thread1.start() |
| 2251 | time.sleep(randint(1,2)) |
| 2252 | log_test.info('Restart the ponsim oon device during tls auth flow check on voltha') |
| 2253 | thread2.start() |
| 2254 | time.sleep(10) |
| 2255 | thread1.join() |
| 2256 | thread2.join() |
Thangavelu K S and Chetan Gaonker | 0cf7564 | 2017-08-03 20:13:23 +0000 | [diff] [blame] | 2257 | time.sleep(60) |
| 2258 | cord_test_radius_restart() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2259 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT) |
| 2260 | try: |
| 2261 | # assert_equal(status, True) |
| 2262 | assert_equal(auth_status, True) |
| 2263 | assert_equal(self.success, True) |
| 2264 | time.sleep(10) |
| 2265 | finally: |
| 2266 | self.voltha.disable_device(device_id, delete = True) |
| 2267 | df.callback(0) |
| 2268 | reactor.callLater(0, tls_flow_check_operating_olt_state, df) |
| 2269 | return df |
| 2270 | |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2271 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2272 | def test_two_subscribers_with_voltha_for_eap_tls_authentication(self): |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2273 | """ |
| 2274 | Test Method: |
| 2275 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2276 | 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen. |
| 2277 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2278 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2279 | 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius. |
| 2280 | 5. Verify that two subscribers are authenticated successfully. |
| 2281 | """ |
| 2282 | |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2283 | df = defer.Deferred() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2284 | def tls_flow_check_on_two_subscribers_same_olt_device(df): |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2285 | aaa_app = ["org.opencord.aaa"] |
| 2286 | log_test.info('Enabling ponsim_olt') |
| 2287 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2288 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2289 | devices_list = self.voltha.get_devices() |
| 2290 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2291 | |
| 2292 | onu_device_id = devices_list['items'][1]['id'] |
| 2293 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2294 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2295 | time.sleep(10) |
| 2296 | switch_map = None |
| 2297 | olt_configured = False |
| 2298 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2299 | log_test.info('Installing OLT app') |
| 2300 | OnosCtrl.install_app(self.olt_app_file) |
| 2301 | time.sleep(5) |
| 2302 | log_test.info('Adding subscribers through OLT app') |
| 2303 | self.config_olt(switch_map) |
| 2304 | olt_configured = True |
| 2305 | time.sleep(5) |
| 2306 | devices_list = self.voltha.get_devices() |
| 2307 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 2308 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,)) |
| 2309 | thread1.start() |
| 2310 | time.sleep(randint(1,2)) |
| 2311 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 2312 | thread2.start() |
| 2313 | time.sleep(10) |
| 2314 | thread1.join() |
| 2315 | thread2.join() |
| 2316 | try: |
| 2317 | # assert_equal(status, True) |
| 2318 | assert_equal(self.success, True) |
| 2319 | time.sleep(10) |
| 2320 | finally: |
| 2321 | self.voltha.disable_device(device_id, delete = True) |
| 2322 | df.callback(0) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2323 | 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] | 2324 | return df |
| 2325 | |
| 2326 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2327 | 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] | 2328 | """ |
| 2329 | Test Method: |
| 2330 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2331 | 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen. |
| 2332 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2333 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2334 | 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius. |
| 2335 | 5. Verify that two subscribers are not authenticated. |
| 2336 | """ |
| 2337 | |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2338 | df = defer.Deferred() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2339 | def tls_flow_check_on_two_subscribers_same_olt_device(df): |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2340 | aaa_app = ["org.opencord.aaa"] |
| 2341 | log_test.info('Enabling ponsim_olt') |
| 2342 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2343 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2344 | devices_list = self.voltha.get_devices() |
| 2345 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2346 | |
| 2347 | onu_device_id = devices_list['items'][1]['id'] |
| 2348 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2349 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 2350 | time.sleep(10) |
| 2351 | switch_map = None |
| 2352 | olt_configured = False |
| 2353 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2354 | log_test.info('Installing OLT app') |
| 2355 | OnosCtrl.install_app(self.olt_app_file) |
| 2356 | time.sleep(5) |
| 2357 | log_test.info('Adding subscribers through OLT app') |
| 2358 | self.config_olt(switch_map) |
| 2359 | olt_configured = True |
| 2360 | time.sleep(5) |
| 2361 | devices_list = self.voltha.get_devices() |
| 2362 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 2363 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",)) |
| 2364 | thread1.start() |
| 2365 | time.sleep(randint(1,2)) |
| 2366 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 2367 | thread2.start() |
| 2368 | time.sleep(10) |
| 2369 | thread1.join() |
| 2370 | thread2.join() |
| 2371 | try: |
| 2372 | # assert_equal(status, True) |
| 2373 | assert_equal(self.success, True) |
| 2374 | time.sleep(10) |
| 2375 | finally: |
| 2376 | self.voltha.disable_device(device_id, delete = True) |
| 2377 | df.callback(0) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2378 | 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] | 2379 | return df |
| 2380 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2381 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2382 | 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] | 2383 | """ |
| 2384 | Test Method: |
| 2385 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2386 | 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen. |
| 2387 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2388 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2389 | 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius. |
| 2390 | 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius. |
| 2391 | 6. Verify that valid subscriber authenticated successfully. |
| 2392 | 7. Verify that invalid subscriber are not authenticated successfully. |
| 2393 | """ |
| 2394 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2395 | df = defer.Deferred() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2396 | def tls_flow_check_on_two_subscribers_same_olt_device(df): |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2397 | aaa_app = ["org.opencord.aaa"] |
| 2398 | log_test.info('Enabling ponsim_olt') |
| 2399 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2400 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2401 | devices_list = self.voltha.get_devices() |
| 2402 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2403 | |
| 2404 | onu_device_id = devices_list['items'][1]['id'] |
| 2405 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2406 | voltha = VolthaCtrl(**self.voltha_attrs) |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2407 | time.sleep(10) |
| 2408 | switch_map = None |
| 2409 | olt_configured = False |
| 2410 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2411 | log_test.info('Installing OLT app') |
| 2412 | OnosCtrl.install_app(self.olt_app_file) |
| 2413 | time.sleep(5) |
| 2414 | log_test.info('Adding subscribers through OLT app') |
| 2415 | self.config_olt(switch_map) |
| 2416 | olt_configured = True |
| 2417 | time.sleep(5) |
| 2418 | devices_list = self.voltha.get_devices() |
| 2419 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 2420 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",)) |
| 2421 | thread1.start() |
| 2422 | time.sleep(randint(1,2)) |
| 2423 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 2424 | thread2.start() |
| 2425 | time.sleep(10) |
| 2426 | thread1.join() |
| 2427 | thread2.join() |
| 2428 | try: |
| 2429 | # assert_equal(status, True) |
| 2430 | assert_equal(self.success, True) |
| 2431 | time.sleep(10) |
| 2432 | finally: |
| 2433 | self.voltha.disable_device(device_id, delete = True) |
| 2434 | df.callback(0) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2435 | 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] | 2436 | return df |
| 2437 | |
| 2438 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2439 | 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] | 2440 | """ |
| 2441 | Test Method: |
| 2442 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2443 | 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen. |
| 2444 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2445 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2446 | 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius. |
| 2447 | 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius. |
| 2448 | 6. Verify that valid subscriber authenticated successfully. |
| 2449 | 7. Verify that invalid subscriber are not authenticated successfully. |
| 2450 | """ |
| 2451 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2452 | df = defer.Deferred() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2453 | def tls_flow_check_on_two_subscribers_same_olt_device(df): |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2454 | aaa_app = ["org.opencord.aaa"] |
| 2455 | log_test.info('Enabling ponsim_olt') |
| 2456 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2457 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2458 | devices_list = self.voltha.get_devices() |
| 2459 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2460 | |
| 2461 | onu_device_id = devices_list['items'][1]['id'] |
| 2462 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2463 | voltha = VolthaCtrl(**self.voltha_attrs) |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2464 | time.sleep(10) |
| 2465 | switch_map = None |
| 2466 | olt_configured = False |
| 2467 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2468 | log_test.info('Installing OLT app') |
| 2469 | OnosCtrl.install_app(self.olt_app_file) |
| 2470 | time.sleep(5) |
| 2471 | log_test.info('Adding subscribers through OLT app') |
| 2472 | self.config_olt(switch_map) |
| 2473 | olt_configured = True |
| 2474 | time.sleep(5) |
| 2475 | devices_list = self.voltha.get_devices() |
| 2476 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 2477 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",)) |
| 2478 | thread1.start() |
| 2479 | time.sleep(randint(1,2)) |
| 2480 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 2481 | thread2.start() |
| 2482 | time.sleep(10) |
| 2483 | thread1.join() |
| 2484 | thread2.join() |
| 2485 | try: |
| 2486 | # assert_equal(status, True) |
| 2487 | assert_equal(self.success, True) |
| 2488 | time.sleep(10) |
| 2489 | finally: |
| 2490 | self.voltha.disable_device(device_id, delete = True) |
| 2491 | df.callback(0) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2492 | 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] | 2493 | return df |
| 2494 | |
| 2495 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2496 | 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] | 2497 | """ |
| 2498 | Test Method: |
| 2499 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2500 | 1. OLT and ONU is detected and validated. |
| 2501 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2502 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2503 | 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius. |
| 2504 | 6. Verify that subscriber authenticated successfully. |
| 2505 | 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber. |
| 2506 | 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius. |
| 2507 | 9. Verify that subscriber authentication is unsuccessful.. |
| 2508 | 10. Verify that other subscriber authenticated successfully. |
| 2509 | """ |
| 2510 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2511 | df = defer.Deferred() |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2512 | def tls_flow_check_on_two_subscribers_same_olt_device(df): |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2513 | aaa_app = ["org.opencord.aaa"] |
| 2514 | log_test.info('Enabling ponsim_olt') |
| 2515 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2516 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2517 | devices_list = self.voltha.get_devices() |
| 2518 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 2519 | |
| 2520 | onu_device_id = devices_list['items'][1]['id'] |
| 2521 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2522 | voltha = VolthaCtrl(**self.voltha_attrs) |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2523 | time.sleep(10) |
| 2524 | switch_map = None |
| 2525 | olt_configured = False |
| 2526 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2527 | log_test.info('Installing OLT app') |
| 2528 | OnosCtrl.install_app(self.olt_app_file) |
| 2529 | time.sleep(5) |
| 2530 | log_test.info('Adding subscribers through OLT app') |
| 2531 | self.config_olt(switch_map) |
| 2532 | olt_configured = True |
| 2533 | time.sleep(5) |
| 2534 | devices_list = self.voltha.get_devices() |
| 2535 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 2536 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",)) |
| 2537 | thread1.start() |
| 2538 | time.sleep(randint(1,2)) |
| 2539 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 2540 | thread2.start() |
| 2541 | time.sleep(10) |
| 2542 | thread1.join() |
| 2543 | thread2.join() |
| 2544 | try: |
| 2545 | # assert_equal(status, True) |
| 2546 | assert_equal(self.success, True) |
| 2547 | time.sleep(10) |
| 2548 | finally: |
| 2549 | self.voltha.disable_device(device_id, delete = True) |
| 2550 | df.callback(0) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2551 | 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] | 2552 | return df |
| 2553 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2554 | def test_3_subscribers_with_voltha_for_eap_tls_authentication(self): |
| 2555 | """ |
| 2556 | Test Method: |
| 2557 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2558 | 1. OLT and ONU is detected and validated. |
| 2559 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2560 | 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (3 subscribers) |
| 2561 | 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius. |
| 2562 | 5. Verify that subscriber is authenticated successfully. |
| 2563 | """ |
| 2564 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 2565 | num_subscribers = 3 |
| 2566 | num_channels = 1 |
| 2567 | services = ('TLS') |
| 2568 | cbs = (self.tls_flow_check, None, None) |
| 2569 | self.voltha_subscribers(services, cbs = cbs, |
| 2570 | num_subscribers = num_subscribers, |
| 2571 | num_channels = num_channels) |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 2572 | assert_equal(self.success, True) |
| 2573 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2574 | |
| 2575 | def test_5_subscribers_with_voltha_for_eap_tls_authentication(self): |
| 2576 | """ |
| 2577 | Test Method: |
| 2578 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2579 | 1. OLT and ONU is detected and validated. |
| 2580 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 2581 | 3. Issue auth request packets from CORD TESTER voltha test module acting as multipe subscribers (5 subscriber) |
| 2582 | 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius. |
| 2583 | 5. Verify that subscriber is authenticated successfully. |
| 2584 | """ |
| 2585 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 2586 | num_subscribers = 5 |
| 2587 | num_channels = 1 |
| 2588 | services = ('TLS') |
| 2589 | cbs = (self.tls_flow_check, None, None) |
| 2590 | self.voltha_subscribers(services, cbs = cbs, |
| 2591 | num_subscribers = num_subscribers, |
| 2592 | num_channels = num_channels) |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 2593 | assert_equal(self.success, True) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 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) |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 2613 | assert_equal(self.success, True) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 2614 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 2615 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2616 | def test_subscriber_with_voltha_for_dhcp_request(self): |
| 2617 | """ |
| 2618 | Test Method: |
| 2619 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2620 | 1. OLT and ONU is detected and validated. |
| 2621 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2622 | 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app. |
| 2623 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 2624 | """ |
| 2625 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2626 | df = defer.Deferred() |
| 2627 | def dhcp_flow_check_scenario(df): |
| 2628 | log_test.info('Enabling ponsim_olt') |
| 2629 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2630 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2631 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2632 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2633 | time.sleep(10) |
| 2634 | switch_map = None |
| 2635 | olt_configured = False |
| 2636 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2637 | log_test.info('Installing OLT app') |
| 2638 | OnosCtrl.install_app(self.olt_app_file) |
| 2639 | time.sleep(5) |
| 2640 | log_test.info('Adding subscribers through OLT app') |
| 2641 | self.config_olt(switch_map) |
| 2642 | olt_configured = True |
| 2643 | time.sleep(5) |
| 2644 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT) |
| 2645 | try: |
| 2646 | assert_equal(dhcp_status, True) |
| 2647 | #assert_equal(status, True) |
| 2648 | time.sleep(10) |
| 2649 | finally: |
| 2650 | self.remove_olt(switch_map) |
| 2651 | self.voltha.disable_device(device_id, delete = True) |
| 2652 | df.callback(0) |
| 2653 | |
| 2654 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2655 | return df |
| 2656 | |
| 2657 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2658 | def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self): |
| 2659 | """ |
| 2660 | Test Method: |
| 2661 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2662 | 1. OLT and ONU is detected and validated. |
| 2663 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2664 | 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app. |
| 2665 | 4. Verify that subscriber should not get ip from dhcp server. |
| 2666 | """ |
| 2667 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2668 | df = defer.Deferred() |
| 2669 | def dhcp_flow_check_scenario(df): |
| 2670 | log_test.info('Enabling ponsim_olt') |
| 2671 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2672 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2673 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2674 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2675 | time.sleep(10) |
| 2676 | switch_map = None |
| 2677 | olt_configured = False |
| 2678 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2679 | log_test.info('Installing OLT app') |
| 2680 | OnosCtrl.install_app(self.olt_app_file) |
| 2681 | time.sleep(5) |
| 2682 | log_test.info('Adding subscribers through OLT app') |
| 2683 | self.config_olt(switch_map) |
| 2684 | olt_configured = True |
| 2685 | time.sleep(5) |
| 2686 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast") |
| 2687 | try: |
| 2688 | assert_equal(dhcp_status, True) |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 2689 | assert_equal(self.success, True) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2690 | #assert_equal(status, True) |
| 2691 | time.sleep(10) |
| 2692 | finally: |
| 2693 | self.voltha.disable_device(device_id, delete = True) |
| 2694 | self.remove_olt(switch_map) |
| 2695 | df.callback(0) |
| 2696 | |
| 2697 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2698 | return df |
| 2699 | |
| 2700 | |
| 2701 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2702 | def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self): |
| 2703 | """ |
| 2704 | Test Method: |
| 2705 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2706 | 1. OLT and ONU is detected and validated. |
| 2707 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2708 | 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app. |
| 2709 | 4. Verify that subscriber should not get ip from dhcp server. |
| 2710 | """ |
| 2711 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2712 | df = defer.Deferred() |
| 2713 | def dhcp_flow_check_scenario(df): |
| 2714 | log_test.info('Enabling ponsim_olt') |
| 2715 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2716 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2717 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2718 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2719 | time.sleep(10) |
| 2720 | switch_map = None |
| 2721 | olt_configured = False |
| 2722 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2723 | log_test.info('Installing OLT app') |
| 2724 | OnosCtrl.install_app(self.olt_app_file) |
| 2725 | time.sleep(5) |
| 2726 | log_test.info('Adding subscribers through OLT app') |
| 2727 | self.config_olt(switch_map) |
| 2728 | olt_configured = True |
| 2729 | time.sleep(5) |
| 2730 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast") |
| 2731 | try: |
| 2732 | assert_equal(dhcp_status, True) |
| 2733 | #assert_equal(status, True) |
| 2734 | time.sleep(10) |
| 2735 | finally: |
| 2736 | self.voltha.disable_device(device_id, delete = True) |
| 2737 | self.remove_olt(switch_map) |
| 2738 | df.callback(0) |
| 2739 | |
| 2740 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2741 | return df |
| 2742 | |
| 2743 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2744 | def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self): |
| 2745 | """ |
| 2746 | Test Method: |
| 2747 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2748 | 1. OLT and ONU is detected and validated. |
| 2749 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2750 | 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app. |
| 2751 | 4. Verify that subscriber should not get ip from dhcp server. |
| 2752 | """ |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2753 | df = defer.Deferred() |
| 2754 | def dhcp_flow_check_scenario(df): |
| 2755 | log_test.info('Enabling ponsim_olt') |
| 2756 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2757 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2758 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2759 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2760 | time.sleep(10) |
| 2761 | switch_map = None |
| 2762 | olt_configured = False |
| 2763 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2764 | log_test.info('Installing OLT app') |
| 2765 | OnosCtrl.install_app(self.olt_app_file) |
| 2766 | time.sleep(5) |
| 2767 | log_test.info('Adding subscribers through OLT app') |
| 2768 | self.config_olt(switch_map) |
| 2769 | olt_configured = True |
| 2770 | time.sleep(5) |
| 2771 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk") |
| 2772 | try: |
| 2773 | assert_equal(dhcp_status, True) |
| 2774 | #assert_equal(status, True) |
| 2775 | time.sleep(10) |
| 2776 | finally: |
| 2777 | self.voltha.disable_device(device_id, delete = True) |
| 2778 | self.remove_olt(switch_map) |
| 2779 | df.callback(0) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2780 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2781 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2782 | return df |
| 2783 | |
| 2784 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2785 | def test_subscriber_with_voltha_for_dhcp_request_and_release(self): |
| 2786 | """ |
| 2787 | Test Method: |
| 2788 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2789 | 1. OLT and ONU is detected and validated. |
| 2790 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2791 | 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app. |
| 2792 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 2793 | 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app. |
| 2794 | 6 Verify that subscriber should not get ip from dhcp server, ping to gateway. |
| 2795 | """ |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2796 | df = defer.Deferred() |
| 2797 | def dhcp_flow_check_scenario(df): |
| 2798 | log_test.info('Enabling ponsim_olt') |
| 2799 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2800 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2801 | assert_not_equal(device_id, None) |
A R Karthick | 5344271 | 2017-07-27 12:23:30 -0700 | [diff] [blame] | 2802 | voltha = VolthaCtrl(**self.voltha_attrs) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 2803 | time.sleep(10) |
| 2804 | switch_map = None |
| 2805 | olt_configured = False |
| 2806 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2807 | log_test.info('Installing OLT app') |
| 2808 | OnosCtrl.install_app(self.olt_app_file) |
| 2809 | time.sleep(5) |
| 2810 | log_test.info('Adding subscribers through OLT app') |
| 2811 | self.config_olt(switch_map) |
| 2812 | olt_configured = True |
| 2813 | time.sleep(5) |
| 2814 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release") |
| 2815 | try: |
| 2816 | assert_equal(dhcp_status, True) |
| 2817 | #assert_equal(status, True) |
| 2818 | time.sleep(10) |
| 2819 | finally: |
| 2820 | self.voltha.disable_device(device_id, delete = True) |
| 2821 | self.remove_olt(switch_map) |
| 2822 | df.callback(0) |
| 2823 | |
| 2824 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2825 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 2826 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 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 | |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 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 and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4328 | self.voltha_dhcprelay_setUpClass() |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4329 | # if not port_list: |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4330 | # port_list = self.generate_port_list(1, 0) |
| 4331 | iface = self.port_map[self.port_list[0][1]] |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 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 |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4340 | log_test.info('Enabling ponsim_olt') |
| 4341 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4342 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4343 | assert_not_equal(device_id, None) |
| 4344 | voltha = VolthaCtrl(**self.voltha_attrs) |
| 4345 | time.sleep(10) |
| 4346 | switch_map = None |
| 4347 | olt_configured = False |
| 4348 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4349 | log_test.info('Installing OLT app') |
| 4350 | OnosCtrl.install_app(self.olt_app_file) |
| 4351 | time.sleep(5) |
| 4352 | log_test.info('Adding subscribers through OLT app') |
| 4353 | self.config_olt(switch_map) |
| 4354 | olt_configured = True |
| 4355 | time.sleep(5) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 4356 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4357 | config = config, |
| 4358 | options = options, |
| 4359 | subnet = subnet) |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4360 | try: |
| 4361 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface) |
| 4362 | self.send_recv(mac=mac) |
| 4363 | finally: |
| 4364 | self.voltha.disable_device(device_id, delete = True) |
| 4365 | self.voltha_dhcprelay_tearDownClass() |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4366 | |
Thangavelu K S | e6c77c7 | 2017-06-23 21:28:48 +0000 | [diff] [blame] | 4367 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4368 | 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] | 4369 | """ |
| 4370 | Test Method: |
| 4371 | 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup. |
| 4372 | 1. OLT and ONU is detected and validated. |
| 4373 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4374 | 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server. |
| 4375 | 4. Verify that subscriber should not get ip from external dhcp server. |
| 4376 | """ |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4377 | self.voltha_dhcprelay_setUpClass() |
| 4378 | # if not port_list: |
| 4379 | # port_list = self.generate_port_list(1, 0) |
| 4380 | iface = self.port_map[self.port_list[0][1]] |
| 4381 | mac = self.get_mac(iface) |
| 4382 | self.host_load(iface) |
| 4383 | ##we use the defaults for this test that serves as an example for others |
| 4384 | ##You don't need to restart dhcpd server if retaining default config |
| 4385 | config = self.default_config |
| 4386 | options = self.default_options |
| 4387 | subnet = self.default_subnet_config |
| 4388 | dhcpd_interface_list = self.relay_interfaces |
| 4389 | log_test.info('Enabling ponsim_olt') |
| 4390 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4391 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4392 | assert_not_equal(device_id, None) |
| 4393 | voltha = VolthaCtrl(**self.voltha_attrs) |
| 4394 | time.sleep(10) |
| 4395 | switch_map = None |
| 4396 | olt_configured = False |
| 4397 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4398 | log_test.info('Installing OLT app') |
| 4399 | OnosCtrl.install_app(self.olt_app_file) |
| 4400 | time.sleep(5) |
| 4401 | log_test.info('Adding subscribers through OLT app') |
| 4402 | self.config_olt(switch_map) |
| 4403 | olt_configured = True |
| 4404 | time.sleep(5) |
| 4405 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4406 | config = config, |
| 4407 | options = options, |
| 4408 | subnet = subnet) |
| 4409 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface) |
| 4410 | cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff') |
| 4411 | try: |
| 4412 | assert_equal(cip,None) |
| 4413 | log_test.info('dhcp server rejected client discover with invalid source mac, as expected') |
| 4414 | finally: |
| 4415 | self.voltha.disable_device(device_id, delete = True) |
| 4416 | self.voltha_dhcprelay_tearDownClass() |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4417 | |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4418 | # @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4419 | 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] | 4420 | """ |
| 4421 | Test Method: |
| 4422 | 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup. |
| 4423 | 1. OLT and ONU is detected and validated. |
| 4424 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4425 | 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server. |
| 4426 | 4. Verify that subscriber should not get ip from external dhcp server. |
| 4427 | """ |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4428 | self.voltha_dhcprelay_setUpClass() |
| 4429 | # if not port_list: |
| 4430 | # port_list = self.generate_port_list(1, 0) |
| 4431 | iface = self.port_map[self.port_list[0][1]] |
| 4432 | mac = self.get_mac(iface) |
| 4433 | self.host_load(iface) |
| 4434 | ##we use the defaults for this test that serves as an example for others |
| 4435 | ##You don't need to restart dhcpd server if retaining default config |
| 4436 | config = self.default_config |
| 4437 | options = self.default_options |
| 4438 | subnet = self.default_subnet_config |
| 4439 | dhcpd_interface_list = self.relay_interfaces |
| 4440 | log_test.info('Enabling ponsim_olt') |
| 4441 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4442 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4443 | assert_not_equal(device_id, None) |
| 4444 | voltha = VolthaCtrl(**self.voltha_attrs) |
| 4445 | time.sleep(10) |
| 4446 | switch_map = None |
| 4447 | olt_configured = False |
| 4448 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4449 | log_test.info('Installing OLT app') |
| 4450 | OnosCtrl.install_app(self.olt_app_file) |
| 4451 | time.sleep(5) |
| 4452 | log_test.info('Adding subscribers through OLT app') |
| 4453 | self.config_olt(switch_map) |
| 4454 | olt_configured = True |
| 4455 | time.sleep(5) |
| 4456 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4457 | config = config, |
| 4458 | options = options, |
| 4459 | subnet = subnet) |
| 4460 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface) |
| 4461 | cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:01:98:05') |
| 4462 | try: |
| 4463 | assert_equal(cip,None) |
| 4464 | log_test.info('dhcp server rejected client discover with invalid source mac, as expected') |
| 4465 | finally: |
| 4466 | self.voltha.disable_device(device_id, delete = True) |
| 4467 | self.voltha_dhcprelay_tearDownClass() |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4468 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4469 | 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] | 4470 | """ |
| 4471 | Test Method: |
| 4472 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4473 | 1. OLT and ONU is detected and validated. |
| 4474 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4475 | 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server. |
| 4476 | 4. Verify that subscriber should not get ip from external dhcp server. |
| 4477 | """ |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4478 | self.voltha_dhcprelay_setUpClass() |
| 4479 | # if not port_list: |
| 4480 | # port_list = self.generate_port_list(1, 0) |
| 4481 | iface = self.port_map[self.port_list[0][1]] |
| 4482 | mac = self.get_mac(iface) |
| 4483 | self.host_load(iface) |
| 4484 | ##we use the defaults for this test that serves as an example for others |
| 4485 | ##You don't need to restart dhcpd server if retaining default config |
| 4486 | config = self.default_config |
| 4487 | options = self.default_options |
| 4488 | subnet = self.default_subnet_config |
| 4489 | dhcpd_interface_list = self.relay_interfaces |
| 4490 | log_test.info('Enabling ponsim_olt') |
| 4491 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4492 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4493 | assert_not_equal(device_id, None) |
| 4494 | voltha = VolthaCtrl(**self.voltha_attrs) |
| 4495 | time.sleep(10) |
| 4496 | switch_map = None |
| 4497 | olt_configured = False |
| 4498 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4499 | log_test.info('Installing OLT app') |
| 4500 | OnosCtrl.install_app(self.olt_app_file) |
| 4501 | time.sleep(5) |
| 4502 | log_test.info('Adding subscribers through OLT app') |
| 4503 | self.config_olt(switch_map) |
| 4504 | olt_configured = True |
| 4505 | time.sleep(5) |
| 4506 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4507 | config = config, |
| 4508 | options = options, |
| 4509 | subnet = subnet) |
| 4510 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface) |
| 4511 | cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00') |
| 4512 | try: |
| 4513 | assert_equal(cip,None) |
| 4514 | log_test.info('dhcp server rejected client discover with invalid source mac, as expected') |
| 4515 | finally: |
| 4516 | self.voltha.disable_device(device_id, delete = True) |
| 4517 | self.voltha_dhcprelay_tearDownClass() |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4518 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4519 | def test_subscriber_with_voltha_for_dhcprelay_request_and_release(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4520 | """ |
| 4521 | Test Method: |
| 4522 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4523 | 1. OLT and ONU is detected and validated. |
| 4524 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4525 | 3. Send dhcp request from residential subscrber to external dhcp server. |
| 4526 | 4. Verify that subscriber get ip from external dhcp server successfully. |
| 4527 | 5. Send dhcp release from residential subscrber to external dhcp server. |
| 4528 | 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway. |
| 4529 | """ |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4530 | self.voltha_dhcprelay_setUpClass() |
| 4531 | # if not port_list: |
| 4532 | # port_list = self.generate_port_list(1, 0) |
| 4533 | iface = self.port_map[self.port_list[0][1]] |
| 4534 | mac = self.get_mac(iface) |
| 4535 | self.host_load(iface) |
| 4536 | ##we use the defaults for this test that serves as an example for others |
| 4537 | ##You don't need to restart dhcpd server if retaining default config |
| 4538 | config = self.default_config |
| 4539 | options = self.default_options |
| 4540 | subnet = self.default_subnet_config |
| 4541 | dhcpd_interface_list = self.relay_interfaces |
| 4542 | log_test.info('Enabling ponsim_olt') |
| 4543 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4544 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4545 | assert_not_equal(device_id, None) |
| 4546 | voltha = VolthaCtrl(**self.voltha_attrs) |
| 4547 | time.sleep(10) |
| 4548 | switch_map = None |
| 4549 | olt_configured = False |
| 4550 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4551 | log_test.info('Installing OLT app') |
| 4552 | OnosCtrl.install_app(self.olt_app_file) |
| 4553 | time.sleep(5) |
| 4554 | log_test.info('Adding subscribers through OLT app') |
| 4555 | self.config_olt(switch_map) |
| 4556 | olt_configured = True |
| 4557 | time.sleep(5) |
| 4558 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4559 | config = config, |
| 4560 | options = options, |
| 4561 | subnet = subnet) |
| 4562 | self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = iface) |
| 4563 | cip, sip = self.send_recv(mac=mac) |
| 4564 | log_test.info('Releasing ip %s to server %s' %(cip, sip)) |
| 4565 | try: |
| 4566 | assert_equal(self.dhcp.release(cip), True) |
| 4567 | log_test.info('Triggering DHCP discover again after release') |
| 4568 | cip2, sip2 = self.send_recv(mac=mac) |
| 4569 | log_test.info('Verifying released IP was given back on rediscover') |
| 4570 | assert_equal(cip, cip2) |
| 4571 | log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2)) |
| 4572 | assert_equal(self.dhcp.release(cip2), True) |
| 4573 | finally: |
| 4574 | self.voltha.disable_device(device_id, delete = True) |
| 4575 | self.voltha_dhcprelay_tearDownClass() |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4576 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4577 | def test_subscriber_with_voltha_for_dhcprelay_starvation(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4578 | """ |
| 4579 | Test Method: |
| 4580 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4581 | 1. OLT and ONU is detected and validated. |
| 4582 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4583 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4584 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4585 | 5. Repeat step 3 and 4 for 10 times. |
| 4586 | 6 Verify that subscriber should get ip from external dhcp server.. |
| 4587 | """ |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4588 | self.voltha_dhcprelay_setUpClass() |
| 4589 | # if not port_list: |
| 4590 | # port_list = self.generate_port_list(1, 0) |
| 4591 | iface = self.port_map[self.port_list[0][1]] |
| 4592 | mac = self.get_mac(iface) |
| 4593 | self.host_load(iface) |
| 4594 | ##we use the defaults for this test that serves as an example for others |
| 4595 | ##You don't need to restart dhcpd server if retaining default config |
| 4596 | config = self.default_config |
| 4597 | options = self.default_options |
| 4598 | subnet = self.default_subnet_config |
| 4599 | dhcpd_interface_list = self.relay_interfaces |
| 4600 | log_test.info('Enabling ponsim_olt') |
| 4601 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4602 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4603 | assert_not_equal(device_id, None) |
| 4604 | voltha = VolthaCtrl(**self.voltha_attrs) |
| 4605 | time.sleep(10) |
| 4606 | switch_map = None |
| 4607 | olt_configured = False |
| 4608 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4609 | log_test.info('Installing OLT app') |
| 4610 | OnosCtrl.install_app(self.olt_app_file) |
| 4611 | time.sleep(5) |
| 4612 | log_test.info('Adding subscribers through OLT app') |
| 4613 | self.config_olt(switch_map) |
| 4614 | olt_configured = True |
| 4615 | time.sleep(5) |
| 4616 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4617 | config = config, |
| 4618 | options = options, |
| 4619 | subnet = subnet) |
| 4620 | #self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = iface) |
| 4621 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface) |
| 4622 | log_test.info('Verifying 1 ') |
| 4623 | count = 0 |
| 4624 | while True: |
| 4625 | #mac = RandMAC()._fix() |
| 4626 | cip, sip = self.send_recv(mac=mac,update_seed = True,validate = False) |
| 4627 | if cip is None: |
| 4628 | break |
| 4629 | else: |
| 4630 | count += 1 |
| 4631 | assert_equal(count,91) |
| 4632 | log_test.info('Verifying 2 ') |
| 4633 | cip, sip = self.send_recv(mac=mac, update_seed = True, validate = False) |
| 4634 | try: |
| 4635 | assert_equal(cip, None) |
| 4636 | assert_equal(sip, None) |
| 4637 | finally: |
| 4638 | self.voltha.disable_device(device_id, delete = True) |
| 4639 | self.voltha_dhcprelay_tearDownClass() |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4640 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4641 | def test_subscriber_with_voltha_for_dhcprelay_starvation_negative_scenario(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4642 | """ |
| 4643 | Test Method: |
| 4644 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4645 | 1. OLT and ONU is detected and validated. |
| 4646 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4647 | 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server. |
| 4648 | 4. Verify that subscriber should not get ip from external dhcp server.. |
| 4649 | 5. Repeat steps 3 and 4 for 10 times. |
| 4650 | 6 Verify that subscriber should not get ip from external dhcp server.. |
| 4651 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4652 | def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_discover(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4653 | """ |
| 4654 | Test Method: |
| 4655 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4656 | 1. OLT and ONU is detected and validated. |
| 4657 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4658 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4659 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4660 | 5. Repeat step 3 for 50 times. |
| 4661 | 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server.. |
| 4662 | """ |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4663 | self.voltha_dhcprelay_setUpClass() |
| 4664 | # if not port_list: |
| 4665 | # port_list = self.generate_port_list(1, 0) |
| 4666 | iface = self.port_map[self.port_list[0][1]] |
| 4667 | mac = self.get_mac(iface) |
| 4668 | self.host_load(iface) |
| 4669 | ##we use the defaults for this test that serves as an example for others |
| 4670 | ##You don't need to restart dhcpd server if retaining default config |
| 4671 | config = self.default_config |
| 4672 | options = self.default_options |
| 4673 | subnet = self.default_subnet_config |
| 4674 | dhcpd_interface_list = self.relay_interfaces |
| 4675 | log_test.info('Enabling ponsim_olt') |
| 4676 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4677 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4678 | assert_not_equal(device_id, None) |
| 4679 | voltha = VolthaCtrl(**self.voltha_attrs) |
| 4680 | time.sleep(10) |
| 4681 | switch_map = None |
| 4682 | olt_configured = False |
| 4683 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4684 | log_test.info('Installing OLT app') |
| 4685 | OnosCtrl.install_app(self.olt_app_file) |
| 4686 | time.sleep(5) |
| 4687 | log_test.info('Adding subscribers through OLT app') |
| 4688 | self.config_olt(switch_map) |
| 4689 | olt_configured = True |
| 4690 | time.sleep(5) |
| 4691 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4692 | config = config, |
| 4693 | options = options, |
| 4694 | subnet = subnet) |
| 4695 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface) |
| 4696 | cip, sip, mac, _ = self.dhcp.only_discover(mac=mac) |
| 4697 | log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCP REQUEST.' % |
| 4698 | (cip, sip, mac) ) |
| 4699 | try: |
| 4700 | assert_not_equal(cip, None) |
| 4701 | log_test.info('Triggering DHCP discover again.') |
| 4702 | new_cip, new_sip, new_mac, _ = self.dhcp.only_discover(mac=mac) |
| 4703 | assert_equal(new_cip, cip) |
| 4704 | log_test.info('Got same ip to same the client when sent discover again, as expected') |
| 4705 | finally: |
| 4706 | self.voltha.disable_device(device_id, delete = True) |
| 4707 | self.voltha_dhcprelay_tearDownClass() |
| 4708 | |
| 4709 | def test_subscriber_with_voltha_for_dhcprelay_sending_multiple_requests(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4710 | """ |
| 4711 | Test Method: |
| 4712 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4713 | 1. OLT and ONU is detected and validated. |
| 4714 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4715 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4716 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4717 | 5. Send DHCP request to external dhcp server. |
| 4718 | 6. Repeat step 5 for 50 times. |
| 4719 | 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server.. |
| 4720 | """ |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4721 | self.voltha_dhcprelay_setUpClass() |
| 4722 | # if not port_list: |
| 4723 | # port_list = self.generate_port_list(1, 0) |
| 4724 | iface = self.port_map[self.port_list[0][1]] |
| 4725 | mac = self.get_mac(iface) |
| 4726 | self.host_load(iface) |
| 4727 | ##we use the defaults for this test that serves as an example for others |
| 4728 | ##You don't need to restart dhcpd server if retaining default config |
| 4729 | config = self.default_config |
| 4730 | options = self.default_options |
| 4731 | subnet = self.default_subnet_config |
| 4732 | dhcpd_interface_list = self.relay_interfaces |
| 4733 | log_test.info('Enabling ponsim_olt') |
| 4734 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4735 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4736 | assert_not_equal(device_id, None) |
| 4737 | voltha = VolthaCtrl(**self.voltha_attrs) |
| 4738 | time.sleep(10) |
| 4739 | switch_map = None |
| 4740 | olt_configured = False |
| 4741 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4742 | log_test.info('Installing OLT app') |
| 4743 | OnosCtrl.install_app(self.olt_app_file) |
| 4744 | time.sleep(5) |
| 4745 | log_test.info('Adding subscribers through OLT app') |
| 4746 | self.config_olt(switch_map) |
| 4747 | olt_configured = True |
| 4748 | time.sleep(5) |
| 4749 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4750 | config = config, |
| 4751 | options = options, |
| 4752 | subnet = subnet) |
| 4753 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface) |
| 4754 | log_test.info('Sending DHCP discover and DHCP request.') |
| 4755 | cip, sip = self.send_recv(mac=mac) |
| 4756 | mac = self.dhcp.get_mac(cip)[0] |
| 4757 | log_test.info("Sending DHCP request again.") |
| 4758 | new_cip, new_sip = self.dhcp.only_request(cip, mac) |
| 4759 | try: |
| 4760 | assert_equal(new_cip, cip) |
| 4761 | log_test.info('got same ip to smae the client when sent request again, as expected') |
| 4762 | finally: |
| 4763 | self.voltha.disable_device(device_id, delete = True) |
| 4764 | self.voltha_dhcprelay_tearDownClass() |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4765 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4766 | 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] | 4767 | """ |
| 4768 | Test Method: |
| 4769 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4770 | 1. OLT and ONU is detected and validated. |
| 4771 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4772 | 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server. |
| 4773 | 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully. |
| 4774 | """ |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4775 | self.voltha_dhcprelay_setUpClass() |
| 4776 | # if not port_list: |
| 4777 | # port_list = self.generate_port_list(1, 0) |
| 4778 | iface = self.port_map[self.port_list[0][1]] |
| 4779 | mac = self.get_mac(iface) |
| 4780 | self.host_load(iface) |
| 4781 | ##we use the defaults for this test that serves as an example for others |
| 4782 | ##You don't need to restart dhcpd server if retaining default config |
| 4783 | config = self.default_config |
| 4784 | options = self.default_options |
| 4785 | subnet = self.default_subnet_config |
| 4786 | dhcpd_interface_list = self.relay_interfaces |
| 4787 | log_test.info('Enabling ponsim_olt') |
| 4788 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4789 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4790 | assert_not_equal(device_id, None) |
| 4791 | voltha = VolthaCtrl(**self.voltha_attrs) |
| 4792 | time.sleep(10) |
| 4793 | switch_map = None |
| 4794 | olt_configured = False |
| 4795 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4796 | log_test.info('Installing OLT app') |
| 4797 | OnosCtrl.install_app(self.olt_app_file) |
| 4798 | time.sleep(5) |
| 4799 | log_test.info('Adding subscribers through OLT app') |
| 4800 | self.config_olt(switch_map) |
| 4801 | olt_configured = True |
| 4802 | time.sleep(5) |
| 4803 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4804 | config = config, |
| 4805 | options = options, |
| 4806 | subnet = subnet) |
| 4807 | self.dhcp = DHCPTest(seed_ip = '192.168.1.31', iface = iface) |
| 4808 | cip, sip, mac, _ = self.dhcp.only_discover(mac=mac,desired = True) |
| 4809 | try: |
| 4810 | assert_equal(cip,self.dhcp.seed_ip) |
| 4811 | log_test.info('Got dhcp client desired IP %s from server %s for mac %s as expected' % |
| 4812 | (cip, sip, mac) ) |
| 4813 | finally: |
| 4814 | self.voltha.disable_device(device_id, delete = True) |
| 4815 | self.voltha_dhcprelay_tearDownClass() |
| 4816 | |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4817 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4818 | 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] | 4819 | """ |
| 4820 | Test Method: |
| 4821 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4822 | 1. OLT and ONU is detected and validated. |
| 4823 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4824 | 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server. |
| 4825 | 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. |
| 4826 | """ |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4827 | self.voltha_dhcprelay_setUpClass() |
| 4828 | # if not port_list: |
| 4829 | # port_list = self.generate_port_list(1, 0) |
| 4830 | iface = self.port_map[self.port_list[0][1]] |
| 4831 | mac = self.get_mac(iface) |
| 4832 | self.host_load(iface) |
| 4833 | ##we use the defaults for this test that serves as an example for others |
| 4834 | ##You don't need to restart dhcpd server if retaining default config |
| 4835 | config = self.default_config |
| 4836 | options = self.default_options |
| 4837 | subnet = self.default_subnet_config |
| 4838 | dhcpd_interface_list = self.relay_interfaces |
| 4839 | log_test.info('Enabling ponsim_olt') |
| 4840 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4841 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4842 | assert_not_equal(device_id, None) |
| 4843 | voltha = VolthaCtrl(**self.voltha_attrs) |
| 4844 | time.sleep(10) |
| 4845 | switch_map = None |
| 4846 | olt_configured = False |
| 4847 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4848 | log_test.info('Installing OLT app') |
| 4849 | OnosCtrl.install_app(self.olt_app_file) |
| 4850 | time.sleep(5) |
| 4851 | log_test.info('Adding subscribers through OLT app') |
| 4852 | self.config_olt(switch_map) |
| 4853 | olt_configured = True |
| 4854 | time.sleep(5) |
| 4855 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4856 | config = config, |
| 4857 | options = options, |
| 4858 | subnet = subnet) |
| 4859 | self.dhcp = DHCPTest(seed_ip = '20.20.20.35', iface = iface) |
| 4860 | cip, sip, mac, _ = self.dhcp.only_discover(mac= mac,desired = True) |
| 4861 | try: |
| 4862 | assert_not_equal(cip,None) |
| 4863 | assert_not_equal(cip,self.dhcp.seed_ip) |
| 4864 | log_test.info('server offered IP from its pool when requested out of pool IP, as expected') |
| 4865 | finally: |
| 4866 | self.voltha.disable_device(device_id, delete = True) |
| 4867 | self.voltha_dhcprelay_tearDownClass() |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4868 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4869 | def test_subscriber_with_voltha_deactivating_dhcprelay_app_in_onos(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4870 | """ |
| 4871 | Test Method: |
| 4872 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4873 | 1. OLT and ONU is detected and validated. |
| 4874 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4875 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4876 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4877 | 5. Deactivate dhcp server app in onos. |
| 4878 | 6. Repeat step 3. |
| 4879 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 4880 | """ |
| 4881 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4882 | def test_subscriber_with_voltha_for_dhcprelay_renew_time(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4883 | """ |
| 4884 | Test Method: |
| 4885 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4886 | 1. OLT and ONU is detected and validated. |
| 4887 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4888 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4889 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4890 | 5. Send dhcp renew packet to external dhcp server. |
| 4891 | 6. Repeat step 4. |
| 4892 | """ |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4893 | self.voltha_dhcprelay_setUpClass() |
| 4894 | # if not port_list: |
| 4895 | # port_list = self.generate_port_list(1, 0) |
| 4896 | iface = self.port_map[self.port_list[0][1]] |
| 4897 | mac = self.get_mac(iface) |
| 4898 | self.host_load(iface) |
| 4899 | ##we use the defaults for this test that serves as an example for others |
| 4900 | ##You don't need to restart dhcpd server if retaining default config |
| 4901 | config = self.default_config |
| 4902 | new_options = [('dhcp-renewal-time', 100), ('dhcp-rebinding-time', 125)] |
| 4903 | options = self.default_options + new_options |
| 4904 | subnet = self.default_subnet_config |
| 4905 | dhcpd_interface_list = self.relay_interfaces |
| 4906 | log_test.info('Enabling ponsim_olt') |
| 4907 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4908 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4909 | assert_not_equal(device_id, None) |
| 4910 | voltha = VolthaCtrl(**self.voltha_attrs) |
| 4911 | time.sleep(10) |
| 4912 | switch_map = None |
| 4913 | olt_configured = False |
| 4914 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4915 | log_test.info('Installing OLT app') |
| 4916 | OnosCtrl.install_app(self.olt_app_file) |
| 4917 | time.sleep(5) |
| 4918 | log_test.info('Adding subscribers through OLT app') |
| 4919 | self.config_olt(switch_map) |
| 4920 | olt_configured = True |
| 4921 | time.sleep(5) |
| 4922 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4923 | config = config, |
| 4924 | options = options, |
| 4925 | subnet = subnet) |
| 4926 | self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface) |
| 4927 | cip, sip, mac, _ = self.dhcp.only_discover(mac=mac) |
| 4928 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 4929 | (cip, sip, mac) ) |
| 4930 | try: |
| 4931 | assert_not_equal(cip,None) |
| 4932 | new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True) |
| 4933 | log_test.info('Waiting for renew time..') |
| 4934 | time.sleep(lval) |
| 4935 | latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac, unicast = True) |
| 4936 | assert_equal(latest_cip, cip) |
| 4937 | log_test.info('Server renewed client IP when client sends request after renew time, as expected') |
| 4938 | finally: |
| 4939 | self.voltha.disable_device(device_id, delete = True) |
| 4940 | self.voltha_dhcprelay_tearDownClass() |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4941 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 4942 | def test_subscriber_with_voltha_for_dhcprelay_rebind_time(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 4943 | """ |
| 4944 | Test Method: |
| 4945 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 4946 | 1. OLT and ONU is detected and validated. |
| 4947 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 4948 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 4949 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 4950 | 5. Send dhcp rebind packet to external dhcp server. |
| 4951 | 6. Repeat step 4. |
| 4952 | """ |
Thangavelu K S and Chetan Gaonker | 88b30a5 | 2017-08-15 00:27:55 +0000 | [diff] [blame] | 4953 | self.voltha_dhcprelay_setUpClass() |
| 4954 | # if not port_list: |
| 4955 | # port_list = self.generate_port_list(1, 0) |
| 4956 | iface = self.port_map[self.port_list[0][1]] |
| 4957 | mac = self.get_mac(iface) |
| 4958 | self.host_load(iface) |
| 4959 | ##we use the defaults for this test that serves as an example for others |
| 4960 | ##You don't need to restart dhcpd server if retaining default config |
| 4961 | config = self.default_config |
| 4962 | new_options = [('dhcp-renewal-time', 100), ('dhcp-rebinding-time', 125)] |
| 4963 | options = self.default_options + new_options |
| 4964 | subnet = self.default_subnet_config |
| 4965 | dhcpd_interface_list = self.relay_interfaces |
| 4966 | log_test.info('Enabling ponsim_olt') |
| 4967 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 4968 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 4969 | assert_not_equal(device_id, None) |
| 4970 | voltha = VolthaCtrl(**self.voltha_attrs) |
| 4971 | time.sleep(10) |
| 4972 | switch_map = None |
| 4973 | olt_configured = False |
| 4974 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 4975 | log_test.info('Installing OLT app') |
| 4976 | OnosCtrl.install_app(self.olt_app_file) |
| 4977 | time.sleep(5) |
| 4978 | log_test.info('Adding subscribers through OLT app') |
| 4979 | self.config_olt(switch_map) |
| 4980 | olt_configured = True |
| 4981 | time.sleep(5) |
| 4982 | self.dhcpd_start(intf_list = dhcpd_interface_list, |
| 4983 | config = config, |
| 4984 | options = options, |
| 4985 | subnet = subnet) |
| 4986 | self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface) |
| 4987 | cip, sip, mac, _ = self.dhcp.only_discover(mac=mac) |
| 4988 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 4989 | (cip, sip, mac) ) |
| 4990 | try: |
| 4991 | assert_not_equal(cip,None) |
| 4992 | new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True) |
| 4993 | log_test.info('Waiting for rebind time..') |
| 4994 | time.sleep(lval) |
| 4995 | latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac) |
| 4996 | assert_equal(latest_cip, cip) |
| 4997 | log_test.info('Server renewed client IP when client sends request after rebind time, as expected') |
| 4998 | finally: |
| 4999 | self.voltha.disable_device(device_id, delete = True) |
| 5000 | self.voltha_dhcprelay_tearDownClass() |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 5001 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5002 | def test_subscriber_with_voltha_for_dhcprelay_disabling_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 5003 | """ |
| 5004 | Test Method: |
| 5005 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5006 | 1. OLT and ONU is detected and validated. |
| 5007 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5008 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 5009 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 5010 | 5. Disable olt devices which is being detected in voltha CLI. |
| 5011 | 6. Repeat step 3. |
| 5012 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 5013 | """ |
| 5014 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5015 | def test_subscriber_with_voltha_for_dhcprelay_toggling_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 5016 | """ |
| 5017 | Test Method: |
| 5018 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5019 | 1. OLT and ONU is detected and validated. |
| 5020 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5021 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 5022 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 5023 | 5. Disable olt devices which is being detected in voltha CLI. |
| 5024 | 6. Repeat step 3. |
| 5025 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 5026 | 8. Enable olt devices which is being detected in voltha CLI. |
| 5027 | 9. Repeat steps 3 and 4. |
| 5028 | """ |
| 5029 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5030 | 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] | 5031 | """ |
| 5032 | Test Method: |
| 5033 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5034 | 1. OLT and ONU is detected and validated. |
| 5035 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5036 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 5037 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 5038 | 5. Disable onu port which is being detected in voltha CLI. |
| 5039 | 6. Repeat step 3. |
| 5040 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 5041 | """ |
| 5042 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5043 | 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] | 5044 | """ |
| 5045 | Test Method: |
| 5046 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5047 | 1. OLT and ONU is detected and validated. |
| 5048 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5049 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 5050 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 5051 | 5. Disable onu port which is being detected in voltha CLI. |
| 5052 | 6. Repeat step 3. |
| 5053 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 5054 | 8. Enable onu port which is being detected in voltha CLI. |
| 5055 | 9. Repeat steps 3 and 4. |
| 5056 | """ |
| 5057 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5058 | def test_two_subscribers_with_voltha_for_dhcprelay_discover(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 5059 | """ |
| 5060 | Test Method: |
| 5061 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5062 | 1. OLT and ONU is detected and validated. |
| 5063 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5064 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 5065 | 4. Verify that subscribers had got different ips from external dhcp server. successfully. |
| 5066 | """ |
| 5067 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5068 | def test_two_subscribers_with_voltha_for_dhcprelay_multiple_discover(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 5069 | """ |
| 5070 | Test Method: |
| 5071 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5072 | 1. OLT and ONU is detected and validated. |
| 5073 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5074 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 5075 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 5076 | 5. Repeat step 3 and 4 for 10 times for both subscribers. |
| 5077 | 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server.. |
| 5078 | """ |
| 5079 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5080 | 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] | 5081 | """ |
| 5082 | Test Method: |
| 5083 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5084 | 1. OLT and ONU is detected and validated. |
| 5085 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5086 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 5087 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 5088 | 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber. |
| 5089 | 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 |
| 5090 | """ |
| 5091 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5092 | 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] | 5093 | """ |
| 5094 | Test Method: |
| 5095 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5096 | 1. OLT and ONU is detected and validated. |
| 5097 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5098 | 3. Send dhcp request from one residential subscriber to external dhcp server. |
| 5099 | 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server. |
| 5100 | 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully. |
| 5101 | """ |
| 5102 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5103 | 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] | 5104 | """ |
| 5105 | Test Method: |
| 5106 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5107 | 1. OLT and ONU is detected and validated. |
| 5108 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5109 | 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server. |
| 5110 | 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server. |
| 5111 | 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully. |
| 5112 | """ |
| 5113 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5114 | 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] | 5115 | """ |
| 5116 | Test Method: |
| 5117 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5118 | 1. OLT and ONU is detected and validated. |
| 5119 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5120 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 5121 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 5122 | 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber. |
| 5123 | 6. Repeat step 3 and 4 for one subscriber where uni port is down. |
| 5124 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed. |
| 5125 | """ |
| 5126 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5127 | 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] | 5128 | """ |
| 5129 | Test Method: |
| 5130 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5131 | 1. OLT and ONU is detected and validated. |
| 5132 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5133 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 5134 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 5135 | 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber. |
| 5136 | 6. Repeat step 3 and 4 for one subscriber where uni port is down. |
| 5137 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed. |
| 5138 | 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber. |
| 5139 | 9. Repeat step 3 and 4 for one subscriber where uni port is up now. |
| 5140 | 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed. |
| 5141 | """ |
| 5142 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5143 | def test_two_subscribers_with_voltha_for_dhcprelay_disabling_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 5144 | """ |
| 5145 | Test Method: |
| 5146 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5147 | 1. OLT and ONU is detected and validated. |
| 5148 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5149 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 5150 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 5151 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 5152 | 6. Disable the olt device which is detected in voltha. |
| 5153 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed. |
| 5154 | """ |
| 5155 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5156 | def test_two_subscribers_with_voltha_for_dhcprelay_toggling_olt(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 5157 | """ |
| 5158 | Test Method: |
| 5159 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5160 | 1. OLT and ONU is detected and validated. |
| 5161 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5162 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 5163 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 5164 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 5165 | 6. Disable the olt device which is detected in voltha. |
| 5166 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed. |
| 5167 | 8. Enable the olt device which is detected in voltha. |
| 5168 | 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed. |
| 5169 | """ |
| 5170 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5171 | 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] | 5172 | """ |
| 5173 | Test Method: |
| 5174 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 5175 | 1. OLT and ONU is detected and validated. |
| 5176 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5177 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 5178 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 5179 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 5180 | 6. Pause the olt device which is detected in voltha. |
| 5181 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed. |
| 5182 | """ |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 5183 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5184 | def test_subscriber_with_voltha_for_igmp_join_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 5185 | """ |
| 5186 | Test Method: |
| 5187 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5188 | 1. OLT and ONU is detected and validated. |
| 5189 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5190 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5191 | 4. Send igmp joins for a multicast group address multi-group-addressA. |
| 5192 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU. |
| 5193 | 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 5194 | """ |
| 5195 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5196 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 5197 | num_subscribers = 1 |
| 5198 | num_channels = 1 |
| 5199 | services = ('IGMP') |
| 5200 | cbs = (self.igmp_flow_check, None, None) |
| 5201 | self.voltha_subscribers(services, cbs = cbs, |
| 5202 | num_subscribers = num_subscribers, |
| 5203 | num_channels = num_channels) |
| 5204 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5205 | def test_subscriber_with_voltha_for_igmp_leave_verifying_traffic(self): |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 5206 | """ |
| 5207 | Test Method: |
| 5208 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5209 | 1. OLT and ONU is detected and validated. |
| 5210 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5211 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5212 | 4. Send igmp joins for a multicast group address multi-group-addressA. |
| 5213 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU. |
| 5214 | 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester. |
| 5215 | 7. Send igmp leave for a multicast group address multi-group-addressA. |
| 5216 | 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester. |
| 5217 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5218 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 5219 | num_subscribers = 1 |
| 5220 | num_channels = 1 |
| 5221 | services = ('IGMP') |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 5222 | cbs = (self.igmp_leave_flow_check, None, None) |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5223 | self.voltha_subscribers(services, cbs = cbs, |
| 5224 | num_subscribers = num_subscribers, |
| 5225 | num_channels = num_channels) |
| 5226 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5227 | 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] | 5228 | """ |
| 5229 | Test Method: |
| 5230 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5231 | 1. OLT and ONU is detected and validated. |
| 5232 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5233 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5234 | 4. Send igmp joins for a multicast group address multi-group-addressA. |
| 5235 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port on ONU. |
| 5236 | 6. Verify that multicast data packets are being recieved on join received uni port on ONU to cord-tester. |
| 5237 | 7. Send igmp leave for a multicast group address multi-group-addressA. |
| 5238 | 8. Verify that multicast data packets are not being recieved on leave sent uni port on ONU to cord-tester. |
| 5239 | 9. Repeat steps 4 to 6. |
| 5240 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5241 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 5242 | num_subscribers = 1 |
| 5243 | num_channels = 1 |
| 5244 | services = ('IGMP') |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 5245 | cbs = (self.igmp_leave_flow_check, None, None) |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5246 | self.voltha_subscribers(services, cbs = cbs, |
| 5247 | num_subscribers = num_subscribers, |
| 5248 | num_channels = num_channels) |
| 5249 | |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 5250 | 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] | 5251 | """ |
| 5252 | Test Method: |
| 5253 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5254 | 1. OLT and ONU is detected and validated. |
| 5255 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5256 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5257 | 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB |
| 5258 | 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU. |
| 5259 | 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 5260 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5261 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 5262 | num_subscribers = 1 |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 5263 | num_channels = 5 |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5264 | services = ('IGMP') |
| 5265 | cbs = (self.igmp_flow_check, None, None) |
| 5266 | self.voltha_subscribers(services, cbs = cbs, |
| 5267 | num_subscribers = num_subscribers, |
| 5268 | num_channels = num_channels) |
| 5269 | |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 5270 | 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] | 5271 | """ |
| 5272 | Test Method: |
| 5273 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5274 | 1. OLT and ONU is detected and validated. |
| 5275 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5276 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5277 | 4. Send igmp joins for multicast group addresses multi-group-addressA,multi-group-addressB |
| 5278 | 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU. |
| 5279 | 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 5280 | 7. Send igmp leave for a multicast group address multi-group-addressA. |
| 5281 | 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. |
| 5282 | 9. Verify that multicast data packets of group (multi-group-addressB) are being recieved on join sent uni port on ONU to cord-tester. |
| 5283 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5284 | """Test subscriber join next for channel surfing with 3 subscribers browsing 3 channels each""" |
| 5285 | num_subscribers = 1 |
Thangavelu K S | b006b8a | 2017-07-28 19:29:39 +0000 | [diff] [blame] | 5286 | num_channels = 5 |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5287 | services = ('IGMP') |
| 5288 | cbs = (self.igmp_flow_check, None, None) |
| 5289 | self.voltha_subscribers(services, cbs = cbs, |
| 5290 | num_subscribers = num_subscribers, |
| 5291 | num_channels = num_channels) |
| 5292 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5293 | 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] | 5294 | """ |
| 5295 | Test Method: |
| 5296 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5297 | 1. OLT and ONU is detected and validated. |
| 5298 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5299 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5300 | 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA |
| 5301 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 5302 | 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 5303 | 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU. |
| 5304 | 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 5305 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5306 | num_subscribers = 1 |
| 5307 | num_channels = 1 |
| 5308 | services = ('IGMP') |
| 5309 | cbs = (self.igmp_flow_check, None, None) |
| 5310 | self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'], |
| 5311 | num_subscribers = num_subscribers, |
| 5312 | num_channels = num_channels) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 5313 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5314 | 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] | 5315 | """ |
| 5316 | Test Method: |
| 5317 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5318 | 1. OLT and ONU is detected and validated. |
| 5319 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5320 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5321 | 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA |
| 5322 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 5323 | 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 5324 | 7. Send igmp joins for a multicast group address multi-group-addressA with exclude source list src_listA |
| 5325 | 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 5326 | 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 5327 | """ |
| 5328 | |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5329 | num_subscribers = 1 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5330 | num_channels = 1 |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5331 | services = ('IGMP') |
| 5332 | cbs = (self.igmp_flow_check_join_change_to_exclude, None, None) |
| 5333 | self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'], |
| 5334 | num_subscribers = num_subscribers, |
| 5335 | num_channels = num_channels) |
| 5336 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5337 | 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] | 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 with source exclude list src_listA |
| 5345 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 5346 | 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester. |
| 5347 | 7. Send igmp joins for a multicast group address multi-group-addressA with allow source list src_listA |
| 5348 | 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 5349 | 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 5350 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5351 | num_subscribers = 1 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5352 | num_channels = 1 |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5353 | services = ('IGMP') |
| 5354 | cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None) |
| 5355 | self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'], |
| 5356 | num_subscribers = num_subscribers, |
| 5357 | num_channels = num_channels) |
| 5358 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5359 | 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] | 5360 | """ |
| 5361 | Test Method: |
| 5362 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5363 | 1. OLT and ONU is detected and validated. |
| 5364 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5365 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5366 | 4. Send igmp joins for a multicast group address multi-group-addressA with source list src_listA |
| 5367 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 5368 | 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 5369 | 7. Send igmp joins for a multicast group address multi-group-addressA with block source list src_listA |
| 5370 | 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 5371 | 9. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 5372 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5373 | |
| 5374 | num_subscribers = 1 |
| 5375 | num_channels = 1 |
| 5376 | services = ('IGMP') |
| 5377 | cbs = (self.igmp_flow_check_join_change_to_block, None, None) |
| 5378 | self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'], |
| 5379 | num_subscribers = num_subscribers, |
| 5380 | num_channels = num_channels) |
| 5381 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5382 | 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] | 5383 | """ |
| 5384 | Test Method: |
| 5385 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5386 | 1. OLT and ONU is detected and validated. |
| 5387 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5388 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5389 | 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA |
| 5390 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 5391 | 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 5392 | 7. Send igmp joins for a multicast group address multi-group-addressA with allow new source list src_listB |
| 5393 | 8. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU. |
| 5394 | 9. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 5395 | """ |
Thangavelu K S | 8e41308 | 2017-07-13 20:02:14 +0000 | [diff] [blame] | 5396 | |
| 5397 | num_subscribers = 1 |
| 5398 | num_channels = 1 |
| 5399 | services = ('IGMP') |
| 5400 | cbs = (self.igmp_flow_check_join_change_to_block_again_allow_back, None, None) |
| 5401 | self.voltha_subscribers(services, cbs = cbs, src_list = ['2.3.4.5','3.4.5.6'], |
| 5402 | num_subscribers = num_subscribers, |
| 5403 | num_channels = num_channels) |
| 5404 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5405 | 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] | 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 tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5411 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5412 | 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA |
| 5413 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 5414 | 6. Verify that multicast data packets are not being recieved on join sent uni port on ONU to cord-tester. |
| 5415 | 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU. |
| 5416 | 8. Verify that multicast data packets are not being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 5417 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5418 | |
| 5419 | num_subscribers = 1 |
| 5420 | num_channels = 1 |
| 5421 | services = ('IGMP') |
| 5422 | cbs = (self.igmp_flow_check_group_include_source_empty_list, None, None) |
| 5423 | self.voltha_subscribers(services, cbs = cbs, src_list = ['0'], |
| 5424 | num_subscribers = num_subscribers, |
| 5425 | num_channels = num_channels) |
| 5426 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5427 | 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] | 5428 | """ |
| 5429 | Test Method: |
| 5430 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5431 | 1. OLT and ONU is detected and validated. |
| 5432 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5433 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5434 | 4. Send igmp joins for a multicast group address multi-group-addressA with source exclude list src_listA |
| 5435 | 5. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listA on ONU. |
| 5436 | 6. Verify that multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 5437 | 7. Send multicast data traffic for a group (multi-group-addressA) from other uni port with source ip as src_listB on ONU. |
| 5438 | 8. Verify that multicast data packets are being recieved on join sent uni port on ONU from other source list to cord-tester. |
| 5439 | """ |
| 5440 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5441 | num_subscribers = 1 |
| 5442 | num_channels = 1 |
| 5443 | services = ('IGMP') |
| 5444 | cbs = (self.igmp_flow_check_group_exclude_source_empty_list, None, None) |
| 5445 | self.voltha_subscribers(services, cbs = cbs, src_list = ['0'], |
| 5446 | num_subscribers = num_subscribers, |
| 5447 | num_channels = num_channels) |
| 5448 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5449 | 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] | 5450 | """ |
| 5451 | Test Method: |
| 5452 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5453 | 1. OLT and ONU is detected and validated. |
| 5454 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5455 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5456 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5457 | 5. Send igmp joins for a multicast group address multi-group-addressB from other subscribers ( uni_2 port) |
| 5458 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5459 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5460 | 8. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5461 | """ |
| 5462 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5463 | num_subscribers = 2 |
| 5464 | num_channels = 1 |
| 5465 | services = ('IGMP') |
| 5466 | cbs = (self.igmp_flow_check, None, None) |
| 5467 | self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4'], |
| 5468 | num_subscribers = num_subscribers, |
| 5469 | num_channels = num_channels) |
| 5470 | |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 5471 | def test_two_subscribers_with_voltha_for_igmp_join_leave_for_one_subscriber_verifying_traffic(self): |
| 5472 | """ |
| 5473 | Test Method: |
| 5474 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5475 | 1. OLT and ONU is detected and validated. |
| 5476 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5477 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5478 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5479 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5480 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5481 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5482 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5483 | 9. Send igmp leave for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5484 | 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5485 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5486 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5487 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5488 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5489 | services = ('IGMP') |
| 5490 | cbs = (self.igmp_flow_check_join_change_to_exclude, None, None) |
| 5491 | self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4','2.3.4.5'], |
| 5492 | num_subscribers = num_subscribers, |
| 5493 | num_channels = num_channels) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 5494 | |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5495 | 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] | 5496 | """ |
| 5497 | Test Method: |
| 5498 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5499 | 1. OLT and ONU is detected and validated. |
| 5500 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5501 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5502 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5503 | 5. Send igmp leave for a multicast group address multi-group-addressB from other subscribers ( uni_2 port) |
| 5504 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5505 | 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. |
| 5506 | 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. |
| 5507 | 9. Send igmp join for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5508 | 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. |
| 5509 | 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. |
| 5510 | 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. |
| 5511 | """ |
| 5512 | |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5513 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5514 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5515 | services = ('IGMP') |
| 5516 | cbs = (self.igmp_flow_check_join_change_to_exclude_again_include_back, None, None) |
| 5517 | self.voltha_subscribers(services, cbs = cbs, src_list = ['1.2.3.4', '3.4.5.6'], |
| 5518 | num_subscribers = num_subscribers, |
| 5519 | num_channels = num_channels) |
| 5520 | |
| 5521 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5522 | 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] | 5523 | """ |
| 5524 | Test Method: |
| 5525 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5526 | 1. OLT and ONU is detected and validated. |
| 5527 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5528 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5529 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5530 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5531 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5532 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5533 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5534 | 9. Disable uni_2 port which is being shown on voltha CLI. |
| 5535 | 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5536 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5537 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5538 | #rx_port = self.port_map['ports'][port_list[i][1]] |
| 5539 | df = defer.Deferred() |
| 5540 | def igmp_flow_check_operating_onu_admin_state(df): |
| 5541 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5542 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5543 | services = ('IGMP') |
| 5544 | cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None) |
| 5545 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5546 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5547 | 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] | 5548 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],)) |
| 5549 | thread1.start() |
| 5550 | time.sleep(randint(40,50)) |
| 5551 | log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha') |
| 5552 | thread2.start() |
| 5553 | time.sleep(10) |
| 5554 | thread1.join() |
| 5555 | thread2.join() |
| 5556 | try: |
| 5557 | assert_equal(self.success, False) |
| 5558 | log_test.info('Igmp flow check expected to fail, hence ignore the test_status of igmp flow check') |
| 5559 | time.sleep(10) |
| 5560 | finally: |
| 5561 | pass |
| 5562 | df.callback(0) |
| 5563 | reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df) |
| 5564 | return df |
| 5565 | |
| 5566 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 36edb01 | 2017-07-05 18:24:12 +0000 | [diff] [blame] | 5567 | def test_two_subscribers_with_voltha_for_igmp_toggling_uni_port_for_one_subscriber_and_verifying_traffic(self): |
| 5568 | """ |
| 5569 | Test Method: |
| 5570 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5571 | 1. OLT and ONU is detected and validated. |
| 5572 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5573 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5574 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5575 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5576 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5577 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5578 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5579 | 9. Disable uni_2 port which is being shown on voltha CLI. |
| 5580 | 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5581 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5582 | 12. Enable uni_2 port which we disable at step 9. |
| 5583 | 13. Repeat step 5,6 and 8. |
| 5584 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5585 | df = defer.Deferred() |
| 5586 | def igmp_flow_check_operating_onu_admin_state(df): |
| 5587 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5588 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5589 | services = ('IGMP') |
| 5590 | cbs = (self.igmp_flow_check, None, None) |
| 5591 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5592 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5593 | 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] | 5594 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],)) |
| 5595 | thread1.start() |
| 5596 | time.sleep(randint(50,60)) |
| 5597 | log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha') |
| 5598 | thread2.start() |
| 5599 | time.sleep(10) |
| 5600 | thread1.join() |
| 5601 | thread2.join() |
| 5602 | try: |
| 5603 | assert_equal(self.success, True) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5604 | 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] | 5605 | time.sleep(10) |
| 5606 | finally: |
| 5607 | pass |
| 5608 | df.callback(0) |
| 5609 | reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df) |
| 5610 | return df |
| 5611 | |
| 5612 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5613 | 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] | 5614 | """ |
| 5615 | Test Method: |
| 5616 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5617 | 1. OLT and ONU is detected and validated. |
| 5618 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5619 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5620 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5621 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5622 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5623 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5624 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5625 | 9. Disable olt device which is being shown on voltha CLI. |
| 5626 | 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5627 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5628 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5629 | df = defer.Deferred() |
| 5630 | def igmp_flow_check_operating_olt_admin_disble(df): |
| 5631 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5632 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5633 | services = ('IGMP') |
| 5634 | cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None) |
| 5635 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5636 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5637 | 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] | 5638 | thread1.start() |
| 5639 | time.sleep(randint(50,60)) |
| 5640 | thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,)) |
| 5641 | thread2.start() |
| 5642 | time.sleep(10) |
| 5643 | thread1.join() |
| 5644 | thread2.join() |
| 5645 | try: |
| 5646 | assert_equal(self.success, False) |
| 5647 | log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test') |
| 5648 | time.sleep(10) |
| 5649 | finally: |
| 5650 | pass |
| 5651 | df.callback(0) |
| 5652 | reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df) |
| 5653 | return df |
| 5654 | |
| 5655 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5656 | 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] | 5657 | """ |
| 5658 | Test Method: |
| 5659 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5660 | 1. OLT and ONU is detected and validated. |
| 5661 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5662 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5663 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5664 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5665 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5666 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5667 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5668 | 9. Pause olt device which is being shown on voltha CLI. |
| 5669 | 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5670 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5671 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5672 | df = defer.Deferred() |
| 5673 | def igmp_flow_check_operating_olt_admin_pause(df): |
| 5674 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5675 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5676 | services = ('IGMP') |
| 5677 | cbs = (self.igmp_flow_check_during_olt_onu_operational_issues, None, None) |
| 5678 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5679 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5680 | 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] | 5681 | thread1.start() |
| 5682 | time.sleep(randint(50,60)) |
| 5683 | thread2 = threading.Thread(target = self.voltha.pause_device, args = (self.olt_device_id,)) |
| 5684 | thread2.start() |
| 5685 | time.sleep(10) |
| 5686 | thread1.join() |
| 5687 | thread2.join() |
| 5688 | try: |
| 5689 | assert_equal(self.success, False) |
| 5690 | log_test.info('Igmp flow check expected to fail during olt device is paused, so ignored test_status of this test') |
| 5691 | time.sleep(10) |
| 5692 | finally: |
| 5693 | pass |
| 5694 | df.callback(0) |
| 5695 | reactor.callLater(0, igmp_flow_check_operating_olt_admin_pause, df) |
| 5696 | return df |
| 5697 | |
| 5698 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5699 | 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] | 5700 | """ |
| 5701 | Test Method: |
| 5702 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5703 | 1. OLT and ONU is detected and validated. |
| 5704 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5705 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5706 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5707 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5708 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5709 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5710 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5711 | 9. Disable olt device which is being shown on voltha CLI. |
| 5712 | 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5713 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5714 | 12. Enable olt device which is disable at step 9. |
| 5715 | 13. Repeat steps 4,5, 7 and 8. |
| 5716 | """ |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5717 | df = defer.Deferred() |
| 5718 | def igmp_flow_check_operating_olt_admin_restart(df): |
| 5719 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5720 | num_channels = 1 |
Thangavelu K S | fdf5cac | 2017-07-18 21:57:07 +0000 | [diff] [blame] | 5721 | services = ('IGMP') |
| 5722 | cbs = (self.igmp_flow_check, None, None) |
| 5723 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5724 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5725 | 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] | 5726 | thread1.start() |
| 5727 | time.sleep(randint(50,60)) |
| 5728 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,)) |
| 5729 | thread2.start() |
| 5730 | time.sleep(10) |
| 5731 | thread1.join() |
| 5732 | thread2.join() |
| 5733 | try: |
| 5734 | assert_equal(self.success, True) |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5735 | 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] | 5736 | time.sleep(10) |
| 5737 | finally: |
| 5738 | pass |
| 5739 | df.callback(0) |
| 5740 | reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df) |
| 5741 | return df |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5742 | |
| 5743 | @deferred(TESTCASE_TIMEOUT) |
| 5744 | def test_two_subscribers_with_voltha_for_igmp_multiple_times_disabling_olt_verifying_traffic(self): |
| 5745 | """ |
| 5746 | Test Method: |
| 5747 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5748 | 1. OLT and ONU is detected and validated. |
| 5749 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5750 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5751 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5752 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5753 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5754 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5755 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5756 | 9. Disable olt device which is being shown on voltha CLI. |
| 5757 | 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5758 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5759 | 12. Repeat steps 4 to 11 steps multiple times (example 20 times) |
| 5760 | """ |
| 5761 | df = defer.Deferred() |
| 5762 | no_iterations = 20 |
| 5763 | def igmp_flow_check_operating_olt_admin_disble(df): |
| 5764 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5765 | num_channels = 1 |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5766 | services = ('IGMP') |
| 5767 | cbs = (self.igmp_flow_check, None, None) |
| 5768 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5769 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5770 | 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] | 5771 | thread1.start() |
| 5772 | time.sleep(randint(30,40)) |
| 5773 | for i in range(no_iterations): |
| 5774 | thread2 = threading.Thread(target = self.voltha.disable_device, args = (self.olt_device_id, False,)) |
| 5775 | thread2.start() |
| 5776 | time.sleep(8) |
| 5777 | thread2.join() |
| 5778 | thread1.join() |
| 5779 | thread1.isAlive() |
| 5780 | thread2.join() |
| 5781 | try: |
| 5782 | assert_equal(self.success, False) |
| 5783 | log_test.info('Igmp flow check expected to fail during olt device is disabled, so ignored test_status of this test') |
| 5784 | time.sleep(10) |
| 5785 | finally: |
| 5786 | pass |
| 5787 | df.callback(0) |
| 5788 | reactor.callLater(0, igmp_flow_check_operating_olt_admin_disble, df) |
| 5789 | return df |
| 5790 | |
| 5791 | @deferred(TESTCASE_TIMEOUT + 200) |
| 5792 | def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_uni_port_for_one_subscriber_verifying_traffic(self): |
| 5793 | """ |
| 5794 | Test Method: |
| 5795 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5796 | 1. OLT and ONU is detected and validated. |
| 5797 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5798 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5799 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5800 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5801 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5802 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5803 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5804 | 9. Disable uni_2 port which is being shown on voltha CLI. |
| 5805 | 10. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5806 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5807 | 12. Enable uni_2 port which we disable at step 9. |
| 5808 | 13. Repeat step 5,6 and 8. |
| 5809 | 14. Repeat steps 4 to 13 steps multiple times (example 5 times) |
| 5810 | """ |
| 5811 | df = defer.Deferred() |
| 5812 | no_iterations = 5 |
| 5813 | def igmp_flow_check_operating_onu_admin_state(df): |
| 5814 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5815 | num_channels = 1 |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5816 | services = ('IGMP') |
| 5817 | cbs = (self.igmp_flow_check, None, None) |
| 5818 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5819 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5820 | 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] | 5821 | thread1.start() |
| 5822 | time.sleep(randint(40,60)) |
| 5823 | for i in range(no_iterations): |
| 5824 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle, args = (self.port_map['ports'][port_list[1][1]],)) |
| 5825 | log_test.info('Admin state of uni port is down and up after delay of 30 sec during igmp flow check on voltha') |
| 5826 | thread2.start() |
| 5827 | time.sleep(1) |
| 5828 | thread2.join() |
| 5829 | thread1.isAlive() |
| 5830 | thread1.join() |
| 5831 | thread2.join() |
| 5832 | try: |
| 5833 | assert_equal(self.success, True) |
| 5834 | log_test.info('Igmp flow check expected to fail during UNI port down only, after UNI port is up it should be successful') |
| 5835 | time.sleep(10) |
| 5836 | finally: |
| 5837 | pass |
| 5838 | df.callback(0) |
| 5839 | reactor.callLater(0, igmp_flow_check_operating_onu_admin_state, df) |
| 5840 | return df |
| 5841 | |
| 5842 | @deferred(TESTCASE_TIMEOUT) |
| 5843 | def test_two_subscribers_with_voltha_for_igmp_multiple_times_toggling_olt_verifying_traffic(self): |
| 5844 | """ |
| 5845 | Test Method: |
| 5846 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5847 | 1. OLT and ONU is detected and validated. |
| 5848 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 5849 | 3. Issue dhcp client packets to get IP address from dhcp server for a subscriber and check connectivity. |
| 5850 | 4. Send igmp joins for a multicast group address multi-group-addressA from one subscribers (uni_1 port) |
| 5851 | 5. Send igmp joins for a multicast group address multi-group-addressA from other subscribers ( uni_2 port) |
| 5852 | 6. Send multicast data traffic for a group (multi-group-addressA) from other uni_3 port on ONU. |
| 5853 | 7. Verify that multicast data packets are being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5854 | 8. Verify that multicast data packets are being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5855 | 9. Disable olt device which is being shown on voltha CLI. |
| 5856 | 10. Verify that multicast data packets are not being recieved on join sent uni (uni_1) port on ONU to cord-tester. |
| 5857 | 11. Verify that multicast data packets are not being recieved on join sent uni (uni_2) port on ONU to cord-tester. |
| 5858 | 12. Enable olt device which is disable at step 9. |
| 5859 | 13. Repeat steps 4,5, 7 and 8. |
| 5860 | 14. Repeat steps 4 to 13 steps multiple times (example 10 times) |
| 5861 | """ |
| 5862 | df = defer.Deferred() |
| 5863 | no_iterations = 10 |
| 5864 | def igmp_flow_check_operating_olt_admin_restart(df): |
| 5865 | num_subscribers = 2 |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5866 | num_channels = 1 |
Thangavelu K S | 6432b52 | 2017-07-22 00:05:54 +0000 | [diff] [blame] | 5867 | services = ('IGMP') |
| 5868 | cbs = (self.igmp_flow_check, None, None) |
| 5869 | port_list = self.generate_port_list(num_subscribers, num_channels) |
| 5870 | |
Thangavelu K S | 9a63733 | 2017-08-01 23:22:23 +0000 | [diff] [blame] | 5871 | 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] | 5872 | thread1.start() |
| 5873 | time.sleep(randint(50,60)) |
| 5874 | for i in range(no_iterations): |
| 5875 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (self.olt_device_id,)) |
| 5876 | thread2.start() |
| 5877 | time.sleep(10) |
| 5878 | thread2.join() |
| 5879 | thread1.join() |
| 5880 | thread2.join() |
| 5881 | try: |
| 5882 | assert_equal(self.success, True) |
| 5883 | log_test.info('Igmp flow check expected to fail during olt device restart, after OLT device is up, it should be successful') |
| 5884 | time.sleep(10) |
| 5885 | finally: |
| 5886 | pass |
| 5887 | df.callback(0) |
| 5888 | reactor.callLater(0, igmp_flow_check_operating_olt_admin_restart, df) |
| 5889 | return df |
| 5890 | |
| 5891 | def test_5_subscriber_with_voltha_for_igmp_with_10_group_joins_verifying_traffic(self): |
| 5892 | """ |
| 5893 | Test Method: |
| 5894 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5895 | 1. OLT and ONU is detected and validated. |
| 5896 | 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers.. |
| 5897 | 3. Issue multiple dhcp client packets to get IP address from dhcp server for as subscribers and check connectivity. |
| 5898 | 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc |
| 5899 | 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU. |
| 5900 | 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 5901 | """ |
| 5902 | |
| 5903 | num_subscribers = 5 |
| 5904 | num_channels = 10 |
| 5905 | services = ('IGMP') |
| 5906 | cbs = (self.igmp_flow_check, None, None) |
| 5907 | self.voltha_subscribers(services, cbs = cbs, |
| 5908 | num_subscribers = num_subscribers, |
| 5909 | num_channels = num_channels) |
| 5910 | |
| 5911 | def test_9_subscriber_with_voltha_for_igmp_with_10_group_joins_and_verify_traffic(self): |
| 5912 | """ |
| 5913 | Test Method: |
| 5914 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 5915 | 1. OLT and ONU is detected and validated. |
| 5916 | 2. Issue multiple tls auth packets from CORD TESTER voltha test module acting as subscribers.. |
| 5917 | 3. Issue multiple dhcp client packets to get IP address from dhcp server for subscribers and check connectivity. |
| 5918 | 4. Send multiple igmp joins for 10 multicast group addresses multi-group-addressA,multi-group-addressB etc |
| 5919 | 5. Send multicast data traffic for two groups (multi-group-addressA and multi-group-addressB) from other uni port on ONU. |
| 5920 | 6. Verify that 2 groups multicast data packets are being recieved on join sent uni port on ONU to cord-tester. |
| 5921 | """ |
| 5922 | num_subscribers = 9 |
| 5923 | num_channels = 10 |
| 5924 | services = ('IGMP') |
| 5925 | cbs = (self.igmp_flow_check, None, None) |
| 5926 | self.voltha_subscribers(services, cbs = cbs, |
| 5927 | num_subscribers = num_subscribers, |
| 5928 | num_channels = num_channels) |