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 | |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 17 | # |
| 18 | # Copyright 2016-present Ciena Corporation |
| 19 | # |
| 20 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 21 | # you may not use this file except in compliance with the License. |
| 22 | # You may obtain a copy of the License at |
| 23 | # |
| 24 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 25 | # |
| 26 | # Unless required by applicable law or agreed to in writing, software |
| 27 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 28 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 29 | # See the License for the specific language governing permissions and |
| 30 | # limitations under the License. |
| 31 | # |
| 32 | import unittest |
| 33 | from nose.tools import * |
| 34 | from scapy.all import * |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 35 | from CordTestUtils import get_mac, log_test |
A.R Karthick | be7768c | 2017-03-17 11:39:41 -0700 | [diff] [blame] | 36 | from OnosCtrl import OnosCtrl |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 37 | from OltConfig import OltConfig |
| 38 | from OnosFlowCtrl import OnosFlowCtrl |
| 39 | from onosclidriver import OnosCliDriver |
| 40 | #from quaggaclidriver import QuaggaCliDriver |
| 41 | from CordContainer import Container, Onos, Quagga |
| 42 | from CordTestServer import cord_test_onos_restart, cord_test_quagga_restart, cord_test_quagga_stop, cord_test_quagga_shell |
| 43 | from portmaps import g_subscriber_port_map |
| 44 | from CordLogger import CordLogger |
| 45 | import threading |
| 46 | import time |
| 47 | import os |
| 48 | import json |
| 49 | import pexpect |
| 50 | import random |
| 51 | from netaddr.ip import IPNetwork, IPAddress |
| 52 | |
| 53 | #from cli import quagga |
| 54 | #from quagga import * |
| 55 | #from cli import requires |
| 56 | #from cli import system |
| 57 | #from generic import * |
| 58 | |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 59 | log_test.setLevel('INFO') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 60 | |
| 61 | class ipv6vrouter_exchange(CordLogger): |
| 62 | |
| 63 | apps = ('org.onosproject.vrouter', 'org.onosproject.fwd') |
| 64 | device_id = 'of:' + get_mac() |
| 65 | vrouter_device_dict = { "devices" : { |
| 66 | "{}".format(device_id) : { |
| 67 | "basic" : { |
| 68 | "driver" : "softrouter" |
| 69 | } |
| 70 | } |
| 71 | }, |
| 72 | } |
| 73 | zebra_conf = ''' |
| 74 | password zebra |
| 75 | log stdout |
| 76 | service advanced-vty |
| 77 | ! |
| 78 | !debug zebra rib |
| 79 | !debug zebra kernel |
| 80 | !debug zebra fpm |
| 81 | ! |
| 82 | interface eth1 |
| 83 | ipv6 address 2001::10/32 |
| 84 | line vty |
| 85 | exec-timeout 0 0 |
| 86 | ''' |
| 87 | |
| 88 | #! ip address 10.10.0.3/16 |
| 89 | test_path = os.path.dirname(os.path.realpath(__file__)) |
| 90 | quagga_config_path = os.path.join(test_path, '..', 'setup/quagga-config') |
| 91 | onos_config_path = os.path.join(test_path, '..', 'setup/onos-config') |
| 92 | GATEWAY = '1000:10:0:0:0:0:0:164' |
| 93 | INGRESS_PORT = 1 |
| 94 | EGRESS_PORT = 2 |
| 95 | MAX_PORTS = 100 |
| 96 | peer_list = [ ('2001:0:10:0:0:0:10:1', '00:00:00:00:00:01'), ('2001:0:20:0:0:0:20:1', '00:00:00:00:02:01'), ] |
| 97 | network_list = [] |
| 98 | network_mask = 64 |
| 99 | default_routes_address = ('1001:0:10:0::/32',) |
| 100 | default_peer_address = peer_list |
| 101 | quagga_ip = os.getenv('QUAGGA_IP') |
| 102 | |
| 103 | @classmethod |
| 104 | def setUpClass(cls): |
| 105 | ''' Activate the vrouter apps''' |
| 106 | cls.olt = OltConfig() |
| 107 | cls.port_map, _ = cls.olt.olt_port_map() |
| 108 | if not cls.port_map: |
| 109 | cls.port_map = g_subscriber_port_map |
| 110 | time.sleep(3) |
| 111 | cls.load_device_id() |
| 112 | |
| 113 | @classmethod |
| 114 | def tearDownClass(cls): |
| 115 | '''Deactivate the vrouter apps''' |
| 116 | cls.vrouter_host_unload() |
| 117 | cls.start_onos(network_cfg = {}) |
| 118 | |
| 119 | @classmethod |
| 120 | def load_device_id(cls): |
| 121 | did = OnosCtrl.get_device_id() |
| 122 | cls.device_id = did |
| 123 | cls.vrouter_device_dict = { "devices" : { |
| 124 | "{}".format(did) : { |
| 125 | "basic" : { |
| 126 | "driver" : "softrouter" |
| 127 | } |
| 128 | } |
| 129 | }, |
| 130 | } |
| 131 | |
| 132 | def cliEnter(self): |
| 133 | retries = 0 |
| 134 | while retries < 3: |
| 135 | self.cli = OnosCliDriver(connect = True) |
| 136 | if self.cli.handle: |
| 137 | break |
| 138 | else: |
| 139 | retries += 1 |
| 140 | time.sleep(2) |
| 141 | |
| 142 | def cliExit(self): |
| 143 | self.cli.disconnect() |
| 144 | |
| 145 | @classmethod |
| 146 | def onos_load_config(cls, config): |
| 147 | status, code = OnosCtrl.config(config) |
| 148 | if status is False: |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 149 | log_test.info('JSON request returned status %d' %code) |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 150 | assert_equal(status, True) |
| 151 | |
| 152 | @classmethod |
| 153 | def vrouter_config_get(cls, networks = 4, peers = 1, peer_address = None, |
| 154 | route_update = None, router_address = None, specific_peer = None): |
| 155 | vrouter_configs = cls.generate_vrouter_conf(networks = networks, peers = peers,specific_peer = specific_peer, |
| 156 | peer_address = peer_address, router_address = router_address) |
| 157 | return vrouter_configs |
| 158 | |
| 159 | @classmethod |
| 160 | def host_config_load(cls, host_config = None): |
| 161 | for host in host_config: |
| 162 | status, code = OnosCtrl.host_config(host) |
| 163 | if status is False: |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 164 | log_test.info('JSON request returned status %d' %code) |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 165 | assert_equal(status, True) |
| 166 | |
| 167 | @classmethod |
| 168 | def generate_host_config(cls,hosts_list=None): |
| 169 | num = 1 |
| 170 | hosts_dict = {} |
| 171 | if hosts_list is not None: |
| 172 | hosts = hosts_list |
| 173 | else: |
| 174 | hosts = cls.peer_list |
| 175 | for host, mac in hosts: |
| 176 | port = num if num < cls.MAX_PORTS - 1 else cls.MAX_PORTS - 1 |
| 177 | hosts_dict[host] = {'mac':mac, 'vlan':'none', 'ipAddresses':[host], 'location':{ 'elementId' : '{}'.format(cls.device_id), 'port': port}} |
| 178 | num += 1 |
| 179 | return hosts_dict.values() |
| 180 | |
| 181 | |
| 182 | @classmethod |
| 183 | def vrouter_host_load(cls, peer_address = None): |
| 184 | index = 1 |
| 185 | peer_info = peer_address if peer_address is not None else cls.peer_list |
| 186 | |
| 187 | for host,_ in peer_info: |
| 188 | iface = cls.port_map[index] |
| 189 | index += 1 |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 190 | log_test.info('Assigning ip %s to interface %s' %(host, iface)) |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 191 | config_cmds = ( 'ifconfig {} 0'.format(iface), |
| 192 | 'ifconfig {0} inet6 add {1}/64'.format(iface, host), |
| 193 | 'arping -I {0} {1} -c 2'.format(iface, host), |
| 194 | ) |
| 195 | for cmd in config_cmds: |
| 196 | os.system(cmd) |
| 197 | |
| 198 | @classmethod |
| 199 | def vrouter_host_unload(cls, peer_address = None): |
| 200 | index = 1 |
| 201 | peer_info = peer_address if peer_address is not None else cls.peer_list |
| 202 | |
| 203 | for host,_ in peer_info: |
| 204 | iface = cls.port_map[index] |
| 205 | index += 1 |
| 206 | config_cmds = ('ifconfig {} 0'.format(iface), ) |
| 207 | for cmd in config_cmds: |
| 208 | os.system(cmd) |
| 209 | |
| 210 | @classmethod |
| 211 | def start_onos(cls, network_cfg = None): |
| 212 | if type(network_cfg) is tuple: |
| 213 | res = [] |
| 214 | for v in network_cfg: |
| 215 | res += v.items() |
| 216 | config = dict(res) |
| 217 | else: |
| 218 | config = network_cfg |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 219 | log_test.info('Restarting ONOS with new network configuration %s'%config) |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 220 | return cord_test_onos_restart(config = config) |
| 221 | |
| 222 | @classmethod |
| 223 | def randomipv6(cls, subnet='2001::', prefix=64): |
| 224 | random.seed() |
| 225 | ipv6_address = IPAddress(subnet) + random.getrandbits(16) |
| 226 | ipv6_network = IPNetwork(ipv6_address) |
| 227 | ipv6_network.prefixlen = prefix |
| 228 | output = '{},{}'.format(ipv6_address,ipv6_network) |
| 229 | return '{}'.format(ipv6_address),'{}'.format(ipv6_network) |
| 230 | |
| 231 | @classmethod |
| 232 | def start_quagga(cls, networks = 4, peer_address = None, router_address = None): |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 233 | log_test.info('Peer address in quagga start is %s'%peer_address) |
| 234 | log_test.info('Restarting Quagga container with configuration for %d networks' %(networks)) |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 235 | config = cls.generate_conf(networks = networks, peer_address = peer_address, router_address = router_address) |
| 236 | if networks <= 10000: |
| 237 | boot_delay = 25 |
| 238 | else: |
| 239 | delay_map = [60, 100, 150, 200, 300, 450, 600, 800, 1000, 1200] |
| 240 | n = min(networks/100000, len(delay_map)-1) |
| 241 | boot_delay = delay_map[n] |
| 242 | cord_test_quagga_restart(config = config, boot_delay = boot_delay) |
| 243 | |
| 244 | @classmethod |
| 245 | def generate_vrouter_conf(cls, networks = 4, peers = 1, peer_address = None, specific_peer = None,router_address = None): |
| 246 | num = 0 |
| 247 | count = 0 |
| 248 | if peer_address is None: |
| 249 | start_peer = ( 10 << 16 ) |
| 250 | end_peer = ( 9999 << 16 ) |
| 251 | else: |
| 252 | ip = peer_address[0][0] |
| 253 | start_ip = ip.split(':') |
| 254 | start_peer = ( int(start_ip[6]) << 16) |
| 255 | end_peer = ( 9999 << 16 ) |
| 256 | local_network = end_peer + 1 |
| 257 | ports_dict = { 'ports' : {} } |
| 258 | interface_list = [] |
| 259 | peer_list = [] |
| 260 | for n in xrange(start_peer, end_peer, 65536): |
| 261 | port_map = ports_dict['ports'] |
| 262 | port = num+1 if count < cls.MAX_PORTS - 1 else cls.MAX_PORTS - 1 |
| 263 | device_port_key = '{0}/{1}'.format(cls.device_id, port) |
| 264 | try: |
| 265 | interfaces = port_map[device_port_key]['interfaces'] |
| 266 | except: |
| 267 | port_map[device_port_key] = { 'interfaces' : [] } |
| 268 | interfaces = port_map[device_port_key]['interfaces'] |
| 269 | if specific_peer is None: |
| 270 | peer_ip = '2001:0:0:0:0:0:' + '%s:1'%( ( n >> 16 ) & 0xffff ) |
| 271 | else: |
| 272 | start_ip[6] = '%s'%( ( n >> 16 ) & 0xffff ) |
| 273 | start_ip[-1] = '1' |
| 274 | peer_ip = ':'.join(start_ip) |
| 275 | peer_nt = peer_ip + '/112' |
| 276 | mac = RandMAC()._fix() |
| 277 | peer_list.append((peer_ip, mac)) |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 278 | log_test.info('peer ip is %s and and peer network is %s'%(peer_ip,peer_nt)) |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 279 | if num < cls.MAX_PORTS - 1: |
| 280 | interface_dict = { 'name' : 'b1-{}'.format(port), 'ips': [peer_nt], 'mac' : mac } |
| 281 | interfaces.append(interface_dict) |
| 282 | interface_list.append(interface_dict['name']) |
| 283 | else: |
| 284 | interfaces[0]['ips'].append(peer_nt) |
| 285 | num += 1 |
| 286 | if num == peers: |
| 287 | break |
| 288 | quagga_dict = { 'apps': { 'org.onosproject.router' : { 'router' : {}, 'bgp' : { 'bgpSpeakers' : [] } } } } |
| 289 | quagga_router_dict = quagga_dict['apps']['org.onosproject.router']['router'] |
| 290 | quagga_router_dict['ospfEnabled'] = True |
| 291 | quagga_router_dict['interfaces'] = interface_list |
| 292 | quagga_router_dict['controlPlaneConnectPoint'] = '{0}/{1}'.format(cls.device_id, peers + 1) |
| 293 | |
| 294 | #bgp_speaker_dict = { 'apps': { 'org.onosproject.router' : { 'bgp' : { 'bgpSpeakers' : [] } } } } |
| 295 | bgp_speakers_list = quagga_dict['apps']['org.onosproject.router']['bgp']['bgpSpeakers'] |
| 296 | speaker_dict = {} |
| 297 | speaker_dict['name'] = 'bgp{}'.format(peers+1) |
| 298 | speaker_dict['connectPoint'] = '{0}/{1}'.format(cls.device_id, peers + 1) |
| 299 | speaker_dict['peers'] = peer_list |
| 300 | bgp_speakers_list.append(speaker_dict) |
| 301 | cls.peer_list = peer_list |
| 302 | return (cls.vrouter_device_dict, ports_dict, quagga_dict) |
| 303 | |
| 304 | |
| 305 | @classmethod |
| 306 | def generate_conf(cls, networks = 4, peer_address = None, router_address = None): |
| 307 | num = 0 |
| 308 | if router_address is None: |
| 309 | start_network = ( 10 << 16 ) |
| 310 | end_network = ( 9999 << 16 ) |
| 311 | network_mask = 112 |
| 312 | else: |
| 313 | ip = router_address |
| 314 | start_ip = ip.split(':') |
| 315 | network_mask = int(start_ip[7].split('/')[1]) |
| 316 | start_network = (int(start_ip[6]) << 16) |
| 317 | end_network = (9999 << 16) |
| 318 | net_list = [] |
| 319 | peer_list = peer_address if peer_address is not None else cls.peer_list |
| 320 | network_list = [] |
| 321 | for n in xrange(start_network, end_network, 65536): |
| 322 | if router_address is None: |
| 323 | net = '3001:0:0:0:0:0:' + '%s:0'%( ( n >> 16 ) & 0xffff ) |
| 324 | else: |
| 325 | start_ip[6] = '%s'%( ( n >> 16 ) & 0xffff ) |
| 326 | net = ':'.join((start_ip[0],start_ip[1],start_ip[2],start_ip[3],start_ip[4],start_ip[5],start_ip[6],start_ip[7][0])) |
| 327 | network_list.append(net) |
| 328 | gateway = peer_list[num % len(peer_list)][0] |
| 329 | net_route = 'ipv6 route {0}/{1} {2}'.format(net, network_mask, gateway) |
| 330 | net_list.append(net_route) |
| 331 | num += 1 |
| 332 | if num == networks: |
| 333 | break |
| 334 | cls.network_list = network_list |
| 335 | cls.network_mask = network_mask |
| 336 | zebra_routes = '\n'.join(net_list) |
| 337 | return cls.zebra_conf + zebra_routes |
| 338 | |
| 339 | @classmethod |
| 340 | def vrouter_activate(cls, deactivate = False): |
| 341 | app = 'org.onosproject.vrouter' |
| 342 | onos_ctrl = OnosCtrl(app) |
| 343 | if deactivate is True: |
| 344 | onos_ctrl.deactivate() |
| 345 | else: |
| 346 | onos_ctrl.activate() |
| 347 | time.sleep(3) |
| 348 | |
| 349 | @classmethod |
| 350 | def vrouter_configure(cls, networks = 4, peers = 1, peer_address = None,specific_peer = None, |
| 351 | route_update = None, router_address = None, time_expire = None, adding_new_routes = None): |
| 352 | vrouter_configs = cls.vrouter_config_get(networks = networks, peers = peers,specific_peer = specific_peer, |
| 353 | peer_address = peer_address, route_update = route_update) |
| 354 | cls.start_onos(network_cfg = vrouter_configs) |
| 355 | hostcfg = cls.generate_host_config() |
| 356 | cls.host_config_load(host_config = hostcfg) |
| 357 | ##Start quagga |
| 358 | cls.start_quagga(networks = networks, peer_address = peer_address, router_address = router_address) |
| 359 | return vrouter_configs |
| 360 | |
| 361 | def vrouter_port_send_recv(self, ingress, egress, dst_mac, dst_ip, positive_test = True): |
| 362 | src_mac = '00:00:00:00:00:02' |
| 363 | src_ip = '1000:11:12:13:14:15:16:17' |
| 364 | self.success = False if positive_test else True |
| 365 | timeout = 10 if positive_test else 1 |
| 366 | count = 2 if positive_test else 1 |
| 367 | self.start_sending = True |
| 368 | def recv_task(): |
| 369 | def recv_cb(pkt): |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 370 | log_test.info('Pkt seen with ingress ip %s, egress ip %s' %(pkt[IP].src, pkt[IP].dst)) |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 371 | self.success = True if positive_test else False |
| 372 | sniff(count=count, timeout=timeout, |
| 373 | lfilter = lambda p: IP in p and p[IP].dst == dst_ip and p[IP].src == src_ip, |
| 374 | prn = recv_cb, iface = self.port_map[ingress]) |
| 375 | self.start_sending = False |
| 376 | |
| 377 | t = threading.Thread(target = recv_task) |
| 378 | t.start() |
| 379 | L2 = Ether(src = src_mac, dst = dst_mac) |
| 380 | L3 = IPv6(src=src_ip,dst = dst_ip) |
| 381 | pkt = L2/L3 |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 382 | log_test.info('Sending a packet with dst ip %s, dst mac %s on port %s to verify if flows are correct' % |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 383 | (dst_ip, dst_mac, self.port_map[egress])) |
| 384 | while self.start_sending is True: |
| 385 | sendp(pkt, count=50, iface = self.port_map[egress]) |
| 386 | t.join() |
| 387 | assert_equal(self.success, True) |
| 388 | |
| 389 | def vrouter_traffic_verify(self, positive_test = True, peer_address = None): |
| 390 | if peer_address is None: |
| 391 | peers = len(self.peer_list) |
| 392 | peer_list = self.peer_list |
| 393 | else: |
| 394 | peers = len(peer_address) |
| 395 | peer_list = peer_address |
| 396 | egress = peers + 1 |
| 397 | num = 0 |
| 398 | num_hosts = 5 if positive_test else 1 |
| 399 | src_mac = '00:00:00:00:00:02' |
| 400 | src_ip = '1000:11:12:13:14:15:16:17' |
| 401 | last_bytes = [1234,8364,7360,'0af3','fdac'] |
| 402 | for network in self.network_list: |
| 403 | num_ips = num_hosts |
| 404 | octets = network.split(':') |
| 405 | for byte in last_bytes: |
| 406 | octets[-1] = str(byte) |
| 407 | dst_ip = ':'.join(octets) |
| 408 | dst_mac = peer_list[ num % peers ] [1] |
| 409 | port = (num % peers) |
| 410 | ingress = port + 1 |
| 411 | #Since peers are on the same network |
| 412 | ##Verify if flows are setup by sending traffic across |
| 413 | self.vrouter_port_send_recv(ingress, egress, dst_mac, dst_ip, positive_test = positive_test) |
| 414 | num += 1 |
| 415 | |
| 416 | def __vrouter_network_verify(self, networks, peers = 1, positive_test = True, |
| 417 | start_network = None, start_peer_address = None, route_update = None, |
| 418 | invalid_peers = None, time_expire = None, unreachable_route_traffic = None, |
| 419 | deactivate_activate_vrouter = None, adding_new_routes = None, |
| 420 | specific_peer = None): |
| 421 | |
| 422 | _, ports_map, egress_map = self.vrouter_configure(networks = networks, peers = peers, |
| 423 | peer_address = start_peer_address, |
| 424 | route_update = route_update, |
| 425 | router_address = start_network, |
| 426 | time_expire = time_expire, |
| 427 | adding_new_routes = adding_new_routes, |
| 428 | specific_peer = specific_peer) |
| 429 | if self.network_list > 50: |
| 430 | wait = len(self.network_list)/20 |
| 431 | time.sleep(wait) |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 432 | log_test.info('waiting for %d seconds to verify routes in ONOS'%wait) |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 433 | else: |
| 434 | time.sleep(5) |
| 435 | self.cliEnter() |
| 436 | routes = json.loads(self.cli.routes(jsonFormat = True)) |
| 437 | assert_equal(len(routes['routes6']), networks) |
| 438 | if invalid_peers is None: |
| 439 | self.vrouter_traffic_verify() |
| 440 | if time_expire is True: |
| 441 | self.start_quagga(networks = networks, peer_address = start_peer_address, router_address = '12.10.10.1/24') |
| 442 | self.vrouter_traffic_verify() |
| 443 | if unreachable_route_traffic is True: |
| 444 | network_list_backup = self.network_list |
| 445 | self.network_list = ['1:1:1:1:1:1:1:1','2:2:2:2:2:2:2:2','3:3:3:3:3:3:3:3','4:4:4:4:4:4:4:4'] |
| 446 | self.vrouter_traffic_verify(positive_test = False) |
| 447 | self.network_list = network_list_backup |
| 448 | if deactivate_activate_vrouter is True: |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 449 | log_test.info('Deactivating vrouter app in ONOS controller for negative scenario') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 450 | self.vrouter_activate(deactivate = True) |
| 451 | #routes = json.loads(self.cli.routes(jsonFormat = False, cmd_exist = False)) |
| 452 | #assert_equal(len(routes['routes4']), 'Command not found') |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 453 | log_test.info('Activating vrouter app again in ONOS controller for negative scenario') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 454 | self.vrouter_activate(deactivate = False) |
| 455 | if self.network_list > 50: |
| 456 | wait = len(self.network_list)/20 |
| 457 | time.sleep(wait) |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 458 | log_test.info('waiting for %d seconds to verify routes in ONOS'%wait) |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 459 | else: |
| 460 | time.sleep(5) |
| 461 | routes = json.loads(self.cli.routes(jsonFormat = True)) |
| 462 | assert_equal(len(routes['routes4']), networks) |
| 463 | self.vrouter_traffic_verify() |
| 464 | self.cliExit() |
| 465 | return True |
| 466 | |
| 467 | def __vrouter_network_verify_negative(self, networks, peers = 1): |
| 468 | ##Stop quagga. Test traffic again to see if flows were removed |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 469 | log_test.info('Stopping Quagga container') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 470 | cord_test_quagga_stop() |
| 471 | self.vrouter_traffic_verify(positive_test = False) |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 472 | log_test.info('OVS flows have been removed successfully after Quagga was stopped') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 473 | self.start_quagga(networks = networks) |
| 474 | self.vrouter_traffic_verify() |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 475 | log_test.info('OVS flows have been successfully reinstalled after Quagga was restarted') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 476 | |
| 477 | def quagga_shell(self, cmd): |
| 478 | shell_cmds = ('vtysh', '"conf t"', '"{}"'.format(cmd)) |
| 479 | quagga_cmd = ' -c '.join(shell_cmds) |
| 480 | return cord_test_quagga_shell(quagga_cmd) |
| 481 | |
| 482 | def test_vrouter_ipv6_with_5_routes(self): |
| 483 | res = self.__vrouter_network_verify(5, peers = 1) |
| 484 | assert_equal(res, True) |
| 485 | |
| 486 | def test_vrouter_ipv6_with_5_routes_quagga_restart_without_config(self): |
| 487 | res = self.__vrouter_network_verify(5, peers = 1) |
| 488 | assert_equal(res, True) |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 489 | log_test.info('Restart Quagga container without config retain') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 490 | cord_test_quagga_restart() |
| 491 | self.vrouter_traffic_verify(positive_test = False) |
| 492 | |
| 493 | def test_vrouter_ipv6_with_5_routes_quagga_restart_with_config(self): |
| 494 | res = self.__vrouter_network_verify(5, peers = 1) |
| 495 | assert_equal(res, True) |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 496 | log_test.info('verifying vrouter traffic after Quagga restart with config retain') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 497 | #cord_test_quagga_restart() |
| 498 | self.start_quagga(networks=5) |
| 499 | self.vrouter_traffic_verify(positive_test = True) |
| 500 | |
| 501 | def test_vrouter_ipv6_with_5_routes_quagga_stop(self): |
| 502 | res = self.__vrouter_network_verify(5, peers = 1) |
| 503 | assert_equal(res, True) |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 504 | log_test.info('verifying vrouter traffic after Quagga stop') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 505 | cord_test_quagga_stop() |
| 506 | self.vrouter_traffic_verify(positive_test = False) |
| 507 | |
| 508 | def test_vrouter_ipv6_with_5_routes_quagga_stop_and_start(self): |
| 509 | res = self.__vrouter_network_verify(5, peers = 1) |
| 510 | assert_equal(res, True) |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 511 | log_test.info('verifying vrouter traffic after Quagga stop and start again') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 512 | cord_test_quagga_stop() |
| 513 | self.vrouter_traffic_verify(positive_test = False) |
| 514 | self.start_quagga(networks=5) |
| 515 | self.vrouter_traffic_verify(positive_test = True) |
| 516 | |
| 517 | def test_vrouter_ipv6_with_5_routes_onos_restart_without_config(self): |
| 518 | res = self.__vrouter_network_verify(5, peers = 1) |
| 519 | assert_equal(res, True) |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 520 | log_test.info('verifying vrouter traffic after ONOS restart without config retain') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 521 | cord_test_onos_restart() |
| 522 | self.vrouter_traffic_verify(positive_test = False) |
| 523 | |
| 524 | def test_vrouter_ipv6_with_5_routes_onos_restart_with_config(self): |
| 525 | res = self.__vrouter_network_verify(5, peers = 1) |
| 526 | assert_equal(res, True) |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 527 | log_test.info('verifying vrouter traffic after ONOS restart with config retain') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 528 | vrouter_configs = self.vrouter_config_get(networks = 5, peers = 1, |
| 529 | peer_address = None, route_update = None) |
| 530 | self.start_onos(network_cfg=vrouter_configs) |
| 531 | mac = RandMAC()._fix() |
| 532 | hostcfg = self.generate_host_config(hosts_list = [('2001:0:0:0:0:0:10:1',mac)]) |
| 533 | self.host_config_load(host_config = hostcfg) |
| 534 | time.sleep(10) |
| 535 | self.vrouter_traffic_verify(positive_test = True) |
| 536 | |
| 537 | def test_vrouter_ipv6_with_5_routes_restart_quagga_and_onos_with_config(self): |
| 538 | res = self.__vrouter_network_verify(5, peers = 1) |
| 539 | assert_equal(res, True) |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 540 | log_test.info('verifying vrouter traffic after Quagga and ONOS restart with config retain') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 541 | #cord_test_quagga_restart() |
| 542 | self.start_quagga(networks=5) |
| 543 | vrouter_configs = self.vrouter_config_get(networks = 5, peers = 1, |
| 544 | peer_address = None, route_update = None) |
| 545 | self.start_onos(network_cfg = vrouter_configs) |
| 546 | mac = RandMAC()._fix() |
| 547 | hostcfg = self.generate_host_config(hosts_list = [('2001:0:0:0:0:0:10:1',mac)]) |
| 548 | self.host_config_load(host_config = hostcfg) |
| 549 | time.sleep(10) |
| 550 | self.vrouter_traffic_verify(positive_test = True) |
| 551 | |
| 552 | def test_vrouter_ipv6_with_5_routes_2_peers(self): |
| 553 | res = self.__vrouter_network_verify(5, peers = 2) |
| 554 | assert_equal(res, True) |
| 555 | |
| 556 | def test_vrouter_ipv6_with_6_routes_3_peers(self): |
| 557 | res = self.__vrouter_network_verify(6, peers = 3) |
| 558 | assert_equal(res, True) |
| 559 | |
| 560 | def test_vrouter_ipv6_with_50_routes(self): |
| 561 | res = self.__vrouter_network_verify(50, peers = 1) |
| 562 | assert_equal(res, True) |
| 563 | |
| 564 | def test_vrouter_ipv6_with_50_routes_5_peers(self): |
| 565 | res = self.__vrouter_network_verify(50, peers = 5) |
| 566 | assert_equal(res, True) |
| 567 | |
| 568 | def test_vrouter_ipv6_with_100_routes(self): |
| 569 | res = self.__vrouter_network_verify(100, peers = 1) |
| 570 | assert_equal(res, True) |
| 571 | |
| 572 | def test_vrouter_ipv6_with_100_routes_10_peers(self): |
| 573 | res = self.__vrouter_network_verify(100, peers = 10) |
| 574 | assert_equal(res, True) |
| 575 | |
| 576 | def test_vrouter_ipv6_with_300_routes(self): |
| 577 | res = self.__vrouter_network_verify(300, peers = 1) |
| 578 | assert_equal(res, True) |
| 579 | |
| 580 | def test_vrouter_ipv6_with_1k_routes(self): |
| 581 | res = self.__vrouter_network_verify(1000, peers = 1) |
| 582 | assert_equal(res, True) |
| 583 | |
| 584 | def test_vrouter_ipv6_with_9k_routes(self): |
| 585 | res = self.__vrouter_network_verify(9000, peers = 1) |
| 586 | assert_equal(res, True) |
| 587 | |
| 588 | @nottest # Need to implement logic for generating more than 10000 routes |
| 589 | def test_vrouter_ipv6_with_100000_routes(self): |
| 590 | res = self.__vrouter_network_verify(100000, peers = 1) |
| 591 | assert_equal(res, True) |
| 592 | |
| 593 | @nottest # Need to implement logic for generating more than 10000 routes |
| 594 | def test_vrouter_ipv6_with_1000000_routes(self): |
| 595 | res = self.__vrouter_network_verify(1000000, peers = 1) |
| 596 | assert_equal(res, True) |
| 597 | |
| 598 | def test_vrouter_ipv6_with_route_update(self): |
| 599 | res = self.__vrouter_network_verify(5, peers = 2, positive_test = True) |
| 600 | assert_equal(res, True) |
| 601 | peer_info = [('2001:0:0:0:0:0:72:1', '00:00:00:00:01:01'), ('2001:0:0:0:0:0:73:1', '00:00:00:00:02:01')] |
| 602 | res = self.__vrouter_network_verify(5, peers = 2, positive_test = True, |
| 603 | start_peer_address = peer_info, route_update = True) |
| 604 | assert_equal(res, True) |
| 605 | |
| 606 | def test_vrouter_ipv6_with_64bit_mask_route_update(self): |
| 607 | router_address = '3001:0:0:0:0:0:56:0/64' |
| 608 | res = self.__vrouter_network_verify(1, peers = 1, positive_test = True, start_network = router_address) |
| 609 | assert_equal(res, True) |
| 610 | |
| 611 | def test_vrouter_ipv6_with_32bit_route_update(self): |
| 612 | router_address = '3112:90c4:836a:7e56:0:0:06:0/32' |
| 613 | res = self.__vrouter_network_verify(1, peers = 1, positive_test = True, start_network = router_address) |
| 614 | assert_equal(res, True) |
| 615 | |
| 616 | def test_vrouter_ipv6_with_16bit_route_update(self): |
| 617 | router_address = '9961:9474:0:8472:f30a:0:06:0/16' |
| 618 | res = self.__vrouter_network_verify(1, peers = 1, positive_test = True,start_network = router_address) |
| 619 | assert_equal(res, True) |
| 620 | |
| 621 | def test_vrouter_ipv6_with_48bit_route_update(self): |
| 622 | router_address = 'c34a:9737:14cd:8730:0:0:06:0/48' |
| 623 | res = self.__vrouter_network_verify(1, peers = 1, positive_test = True, start_network = router_address) |
| 624 | assert_equal(res, True) |
| 625 | |
| 626 | def test_vrouter_ipv6_with_classless_route_update(self): |
| 627 | router_address = '3001:430d:76cb:f56e:873:0:677:0/67' |
| 628 | res = self.__vrouter_network_verify(1, peers = 1, positive_test = True, start_network = router_address) |
| 629 | assert_equal(res, True) |
| 630 | |
| 631 | def test_vrouter_ipv6_with_classless_duplicate_route_update(self): |
| 632 | router_address = '3001:8730:732:723:0:0:677:0/116' |
| 633 | res = self.__vrouter_network_verify(5, peers = 1, positive_test = True, start_network = router_address) |
| 634 | assert_equal(res, True) |
| 635 | |
| 636 | def test_vrouter_ipv6_with_invalid_peers(self): |
| 637 | peer_info = [('FE80:0:0:0:C800:27FF:10:8', '00:00:00:00:01:01'), ('FE80:0:0:0:C800:27FF:11:8', '00:00:00:00:02:01')] |
| 638 | res = self.__vrouter_network_verify(5, peers = 2, positive_test = True, |
| 639 | start_peer_address = peer_info, specific_peer=True,invalid_peers= True) |
| 640 | assert_equal(res, True) |
| 641 | |
| 642 | @nottest |
| 643 | def test_vrouter_with_traffic_sent_between_peers_connected_to_onos(self): |
| 644 | res = self.__vrouter_network_verify(5, peers = 2, positive_test = True, traffic_running_between_peers = True) |
| 645 | assert_equal(res, True) |
| 646 | |
| 647 | @nottest |
| 648 | def test_vrouter_with_routes_time_expire(self): |
| 649 | res = self.__vrouter_network_verify(5, peers = 2, positive_test = True, time_expire = True) |
| 650 | assert_equal(res, True) |
| 651 | |
| 652 | def test_vrouter_ipv6_with_unreachable_route(self): |
| 653 | res = self.__vrouter_network_verify(5, peers = 2, positive_test = True, unreachable_route_traffic = True) |
| 654 | assert_equal(res, True) |
| 655 | |
| 656 | @nottest |
| 657 | def test_vrouter_ipv6_with_enabling_disabling_vrouter_app(self): |
| 658 | res = self.__vrouter_network_verify(5, peers = 2, positive_test = True, deactivate_activate_vrouter = True) |
| 659 | assert_equal(res, True) |
| 660 | |
| 661 | def test_vrouter_ipv6_with_adding_new_routes_in_routing_table(self): |
| 662 | res = self.__vrouter_network_verify(5, peers = 2, positive_test = True) |
| 663 | cmd = 'ipv6 route 4001:0:0:0:0:0:677:0/64 2001:0:0:0:0:0:10:1' |
| 664 | self.quagga_shell(cmd) |
| 665 | self.vrouter_traffic_verify() |
| 666 | self.network_list = [ '4001:0:0:0:0:0:677:0' ] |
| 667 | self.network_mask = 64 |
| 668 | self.vrouter_traffic_verify() |
| 669 | assert_equal(res, True) |
| 670 | |
| 671 | def test_vrouter_ipv6_with_adding_new_routes_in_quagga_routing_table_and_restart(self): |
| 672 | res = self.__vrouter_network_verify(5, peers = 2, positive_test = True) |
| 673 | cmd = 'ipv6 route 4001:0:0:0:0:0:677:0/64 2001:0:0:0:0:0:10:1' |
| 674 | self.quagga_shell(cmd) |
| 675 | self.vrouter_traffic_verify() |
| 676 | self.network_list = [ '4001:0:0:0:0:0:677:0' ] |
| 677 | self.network_mask = 64 |
| 678 | self.vrouter_traffic_verify() |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 679 | log_test.info('verifying vrouter traffic for added routes after Quagga restart with old config only retain') |
Anil Kumar Sanka | 8915c83 | 2017-02-02 01:07:53 +0000 | [diff] [blame] | 680 | #cord_test_quagga_restart() |
| 681 | self.start_quagga(networks=5) |
| 682 | self.vrouter_traffic_verify(positive_test = False) |
| 683 | assert_equal(res, True) |
| 684 | |
| 685 | def test_vrouter_ipv6_with_removing_old_routes_in_routing_table(self): |
| 686 | res = self.__vrouter_network_verify(5, peers = 2, positive_test = True) |
| 687 | cmd = 'ipv6 route 4001:0:0:0:0:0:677:0/64 2001:0:0:0:0:0:10:1' |
| 688 | self.quagga_shell(cmd) |
| 689 | self.vrouter_traffic_verify() |
| 690 | old_network_list = self.network_list |
| 691 | old_network_mask = self.network_mask |
| 692 | self.network_list = [ '4001:0:0:0:0:0:677:0' ] |
| 693 | self.network_mask = 64 |
| 694 | self.vrouter_traffic_verify() |
| 695 | assert_equal(res, True) |
| 696 | cmd = 'no ipv6 route 4001:0:0:0:0:0:677:0/64 2001:0:0:0:0:0:10:1' |
| 697 | self.quagga_shell(cmd) |
| 698 | time.sleep(5) |
| 699 | self.vrouter_traffic_verify(positive_test = False) |
| 700 | self.network_mask = old_network_mask |
| 701 | self.network_list = old_network_list |
| 702 | self.vrouter_traffic_verify(positive_test = True) |
| 703 | |
| 704 | def test_vrouter_ipv6_modifying_nexthop_route_in_routing_table(self): |
| 705 | peer_info = [('2001:0:0:0:0:0:12:1', '00:00:00:00:01:01'), ('2001:0:0:0:0:0:13:1', '00:00:00:00:02:01')] |
| 706 | router_address = '3001:0:0:0:0:0:677:0/112' |
| 707 | res = self.__vrouter_network_verify(1, peers = 1, positive_test = True, |
| 708 | start_peer_address = peer_info, start_network = router_address) |
| 709 | cmd = 'no ipv6 route 3001:0:0:0:0:0:677:0/112 2001:0:0:0:0:0:18:1' |
| 710 | self.quagga_shell(cmd) |
| 711 | self.vrouter_traffic_verify(positive_test = True) |
| 712 | assert_equal(res, True) |
| 713 | |
| 714 | |
| 715 | def test_vrouter_ipv6_deleting_alternative_nexthop_in_routing_table(self): |
| 716 | peer_info = [('2001:0:0:0:0:0:12:1', '00:00:00:00:01:01'), ('2001:0:0:0:0:0:13:1', '00:00:00:00:02:01')] |
| 717 | router_address = '3001:0:0:0:0:0:677:0/112' |
| 718 | res = self.__vrouter_network_verify(1, peers = 2, positive_test = True, |
| 719 | start_peer_address = peer_info, start_network = router_address) |
| 720 | cmd = 'no ipv6 route 3001:0:0:0:0:0:677:0/112 2001:0:0:0:0:0:12:1' |
| 721 | self.quagga_shell(cmd) |
| 722 | time.sleep(5) |
| 723 | self.vrouter_traffic_verify(positive_test = False) |
| 724 | assert_equal(res, True) |
| 725 | |
| 726 | def test_vrouter_ipv6_deleting_some_routes_in_routing_table(self): |
| 727 | peer_info = [('2001:0:0:0:0:0:12:1', '00:00:00:00:01:01'), ('2001:0:0:0:0:0:13:1', '00:00:00:00:02:01')] |
| 728 | router_address = '3001:0:0:0:0:0:677:0/112' |
| 729 | res = self.__vrouter_network_verify(10, peers = 2, positive_test = True, |
| 730 | start_peer_address = peer_info, start_network = router_address) |
| 731 | cmd = 'no ipv6 route 3001:0:0:0:0:0:677:0/112 2001:0:0:0:0:0:12:1' |
| 732 | self.quagga_shell(cmd) |
| 733 | cmd = 'no ipv6 route 3001:0:0:0:0:0:678:0/112 2001:0:0:0:0:0:13:1' |
| 734 | self.quagga_shell(cmd) |
| 735 | cmd = 'no ipv6 route 3001:0:0:0:0:0:679:0/112 2001:0:0:0:0:0:12:1' |
| 736 | self.quagga_shell(cmd) |
| 737 | self.vrouter_traffic_verify(positive_test = True) |
| 738 | assert_equal(res, True) |
| 739 | |
| 740 | def test_vrouter_ipv6_deleting_some_routes_in_quagga_routing_table_and_restart(self): |
| 741 | peer_info = [('2001:0:0:0:0:0:12:1', '00:00:00:00:01:01'), ('2001:0:0:0:0:0:13:1', '00:00:00:00:02:01')] |
| 742 | router_address = '3001:0:0:0:0:0:677:0/112' |
| 743 | res = self.__vrouter_network_verify(10, peers = 2, positive_test = True, |
| 744 | start_peer_address = peer_info, start_network = router_address) |
| 745 | cmd = 'no ipv6 route 3001:0:0:0:0:0:677:0/112 2001:0:0:0:0:0:12:1' |
| 746 | self.quagga_shell(cmd) |
| 747 | cmd = 'no ipv6 route 3001:0:0:0:0:0:678:0/112 2001:0:0:0:0:0:13:1' |
| 748 | self.quagga_shell(cmd) |
| 749 | cmd = 'no ipv6 route 3001:0:0:0:0:0:679:0/112 2001:0:0:0:0:0:12:1' |
| 750 | self.quagga_shell(cmd) |
| 751 | self.network_list = [ '3001:0:0:0:0:0:677:0','3001:0:0:0:0:0:678:0','3001:0:0:0:0:0:679:0' ] |
| 752 | self.network_mask = 112 |
| 753 | self.vrouter_traffic_verify(positive_test = False) |
| 754 | self.network_list = [ '3001:0:0:0:0:0:680:0','3001:0:0:0:0:0:681:0' ] |
| 755 | self.vrouter_traffic_verify(positive_test = True) |
| 756 | #cord_test_quagga_restart() |
| 757 | self.start_quagga(networks=10) |
| 758 | self.network_list = [ '3001:0:0:0:0:0:677:0','3001:0:0:0:0:0:681:0' ] |
| 759 | self.vrouter_traffic_verify(positive_test = True) |
| 760 | assert_equal(res, True) |
| 761 | |
| 762 | |
| 763 | def test_vrouter_ipv6_deleting_and_adding_routes_in_routing_table(self): |
| 764 | peer_info = [('2001:0:0:0:0:0:12:1', '00:00:00:00:01:01'), ('2001:0:0:0:0:0:13:1', '00:00:00:00:02:01')] |
| 765 | router_address = '3001:0:0:0:0:0:677:0/64' |
| 766 | res = self.__vrouter_network_verify(1, peers = 1, positive_test = True, start_peer_address = peer_info, start_network = router_address) |
| 767 | cmd = 'no ipv6 route 3001:0:0:0:0:0:677:0/64 2001:0:0:0:0:0:12:1' |
| 768 | self.quagga_shell(cmd) |
| 769 | cmd = 'ipv6 route 3001:0:0:0:0:0:677:0/64 2001:0:0:0:0:0:12:1' |
| 770 | self.quagga_shell(cmd) |
| 771 | self.vrouter_traffic_verify(positive_test = True) |
| 772 | assert_equal(res, True) |
| 773 | |
| 774 | def test_vrouter_ipv6_toggling_nexthop_interface(self): |
| 775 | peer_info = [('2001:0:0:0:0:0:12:1', '00:00:00:00:01:01'), ('2001:0:0:0:0:0:13:1', '00:00:00:00:02:01')] |
| 776 | router_address = '3001:0:0:0:0:0:677:0/64' |
| 777 | res = self.__vrouter_network_verify(1, peers = 1, positive_test = True, start_peer_address = peer_info, start_network = router_address) |
| 778 | iface = self.port_map[1] |
| 779 | #toggle the interface to trigger host removal. |
| 780 | cmds = ('ifconfig {} down'.format(iface), |
| 781 | 'sleep 2', |
| 782 | 'ifconfig {} 0'.format(iface),) |
| 783 | for cmd in cmds: |
| 784 | os.system(cmd) |
| 785 | self.vrouter_traffic_verify(positive_test = False) |
| 786 | host = "2001:0:0:0:0:0:12:1" |
| 787 | cmd = 'ifconfig {0} {1} up'.format(iface, host) |
| 788 | os.system(cmd) |
| 789 | #wait for arp refresh |
| 790 | time.sleep(60) |
| 791 | self.vrouter_traffic_verify(positive_test = True) |
| 792 | assert_equal(res, True) |