blob: 64f3fc8c3d7218c41ecb31a06b3ae71dc43ebc6f [file] [log] [blame]
Chetan Gaonkercb122cc2016-05-10 10:58:34 -07001#!/usr/bin/env python
Chetan Gaonkercfcce782016-05-10 10:10:42 -07002#
3# Copyright 2016-present Ciena Corporation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
Chetan Gaonker3533faa2016-04-25 17:50:14 -070017import unittest
18from nose.tools import *
19from scapy.all import *
20from OnosCtrl import OnosCtrl
21from OltConfig import OltConfig
22from OnosFlowCtrl import OnosFlowCtrl, get_mac
23from onosclidriver import OnosCliDriver
Chetan Gaonker6cf6e472016-04-26 14:41:51 -070024from CordContainer import Container, Onos, Quagga
25from CordTestServer import cord_test_onos_restart, cord_test_quagga_restart
Chetan Gaonker3533faa2016-04-25 17:50:14 -070026from portmaps import g_subscriber_port_map
27import threading
28import time
29import os
30import json
31log.setLevel('INFO')
32
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -070033class QuaggaStopWrapper(Container):
34
35 def __init__(self, name = 'cord-quagga', image = 'cord-test/quagga', tag = 'latest'):
36 super(QuaggaStopWrapper, self).__init__(name, image, tag = tag)
37 if self.exists():
38 self.kill()
39
Chetan Gaonker3533faa2016-04-25 17:50:14 -070040class vrouter_exchange(unittest.TestCase):
41
42 apps = ('org.onosproject.vrouter', 'org.onosproject.fwd')
43 device_id = 'of:' + get_mac('ovsbr0')
44 vrouter_device_dict = { "devices" : {
45 "{}".format(device_id) : {
46 "basic" : {
47 "driver" : "softrouter"
48 }
49 }
50 },
51 }
52 zebra_conf = '''
53password zebra
54log stdout
55service advanced-vty
56!
Chetan Gaonkerfd3d6502016-05-03 13:23:07 -070057!debug zebra rib
58!debug zebra kernel
59!debug zebra fpm
Chetan Gaonker3533faa2016-04-25 17:50:14 -070060!
61!interface eth1
62! ip address 10.10.0.3/16
63line vty
64 exec-timeout 0 0
65'''
66 test_path = os.path.dirname(os.path.realpath(__file__))
67 quagga_config_path = os.path.join(test_path, '..', 'setup/quagga-config')
68 onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -070069 GATEWAY = '192.168.10.50'
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070070 INGRESS_PORT = 1
71 EGRESS_PORT = 2
Chetan Gaonker3533faa2016-04-25 17:50:14 -070072 MAX_PORTS = 100
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -070073 peer_list = [ ('192.168.10.1', '00:00:00:00:00:01'), ('192.168.11.1', '00:00:00:00:02:01'), ]
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070074 network_list = []
Chetan Gaonker3533faa2016-04-25 17:50:14 -070075
76 @classmethod
77 def setUpClass(cls):
78 ''' Activate the vrouter apps'''
79 cls.olt = OltConfig()
80 cls.port_map = cls.olt.olt_port_map()
81 if not cls.port_map:
82 cls.port_map = g_subscriber_port_map
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070083 #cls.vrouter_host_load(host = cls.GATEWAY)
Chetan Gaonker3533faa2016-04-25 17:50:14 -070084 time.sleep(3)
85
86 @classmethod
87 def tearDownClass(cls):
88 '''Deactivate the vrouter apps'''
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070089 #cls.vrouter_host_unload()
Chetan Gaonker3533faa2016-04-25 17:50:14 -070090
91 def cliEnter(self):
92 retries = 0
93 while retries < 3:
94 self.cli = OnosCliDriver(connect = True)
95 if self.cli.handle:
96 break
97 else:
98 retries += 1
99 time.sleep(2)
100
101 def cliExit(self):
102 self.cli.disconnect()
103
104 @classmethod
105 def onos_load_config(cls, config):
106 status, code = OnosCtrl.config(config)
107 if status is False:
108 log.info('JSON request returned status %d' %code)
109 assert_equal(status, True)
110
111 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700112 def vrouter_config_get(cls, networks = 4, peers = 1):
113 vrouter_configs = cls.generate_vrouter_conf(networks = networks, peers = peers)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700114 return vrouter_configs
115 ##ONOS router does not support dynamic reconfigurations
116 #for config in vrouter_configs:
117 # cls.onos_load_config(config)
118 # time.sleep(5)
119
120 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700121 def vrouter_host_load(cls):
122 index = 1
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700123 for host,_ in cls.peer_list:
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700124 iface = cls.port_map[index]
125 index += 1
126 config_cmds = ( 'ifconfig {0} {1}'.format(iface, host),
127 'arping -I {0} {1} -c 2'.format(iface, host),
128 )
129 for cmd in config_cmds:
130 os.system(cmd)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700131
132 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700133 def vrouter_host_unload(cls):
134 index = 1
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700135 for host,_ in cls.peer_list:
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700136 iface = cls.port_map[index]
137 index += 1
138 config_cmds = ('ifconfig {} 0'.format(iface), )
139 for cmd in config_cmds:
140 os.system(cmd)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700141
142 @classmethod
143 def start_onos(cls, network_cfg = None):
144 if type(network_cfg) is tuple:
145 res = []
146 for v in network_cfg:
147 res += v.items()
148 config = dict(res)
149 else:
150 config = network_cfg
151 log.info('Restarting ONOS with new network configuration')
152 cfg = json.dumps(config)
153 with open('{}/network-cfg.json'.format(cls.onos_config_path), 'w') as f:
154 f.write(cfg)
155
156 return cord_test_onos_restart()
157
158 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700159 def start_quagga(cls, networks = 4):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700160 log.info('Restarting Quagga container with configuration for %d networks' %(networks))
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700161 config = cls.generate_conf(networks = networks)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700162 host_config_file = '{}/testrib_gen.conf'.format(Quagga.host_quagga_config)
163 guest_config_file = os.path.join(Quagga.guest_quagga_config, 'testrib_gen.conf')
164 with open(host_config_file, 'w') as f:
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700165 f.write(config)
Chetan Gaonkerfd3d6502016-05-03 13:23:07 -0700166 if networks <= 10000:
167 boot_delay = 25
168 else:
Chetan Gaonker37ad23f2016-05-03 17:37:59 -0700169 delay_map = [60, 100, 150, 200, 300, 450, 600, 800, 1000, 1200]
170 n = min(networks/100000, len(delay_map)-1)
171 boot_delay = delay_map[n]
Chetan Gaonkerfd3d6502016-05-03 13:23:07 -0700172 cord_test_quagga_restart(config_file = guest_config_file, boot_delay = boot_delay)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700173
174 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700175 def zgenerate_vrouter_conf(cls, networks = 4):
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700176 num = 0
177 start_network = ( 11 << 24) | ( 0 << 16) | ( 0 << 8) | 0
178 end_network = ( 200 << 24 ) | ( 0 << 16) | (0 << 8) | 0
179 ports_dict = { 'ports' : {} }
180 interface_list = []
181 for n in xrange(start_network, end_network):
182 if n & 255 == 0:
183 port_map = ports_dict['ports']
184 port = num + 1 if num < cls.MAX_PORTS - 1 else cls.MAX_PORTS - 1
185 device_port_key = '{0}/{1}'.format(cls.device_id, port)
186 try:
187 interfaces = port_map[device_port_key]['interfaces']
188 except:
189 port_map[device_port_key] = { 'interfaces' : [] }
190 interfaces = port_map[device_port_key]['interfaces']
191
192 ips = '%d.%d.%d.2/24'%( (n >> 24) & 0xff, ( ( n >> 16) & 0xff ), ( (n >> 8 ) & 0xff ) )
193 if num < cls.MAX_PORTS - 1:
194 interface_dict = { 'name' : 'b1-{}'.format(port), 'ips': [ips], 'mac' : '00:00:00:00:00:01' }
195 interfaces.append(interface_dict)
196 interface_list.append(interface_dict['name'])
197 else:
198 interfaces[0]['ips'].append(ips)
199 num += 1
200 if num == networks:
201 break
202 quagga_dict = { 'apps': { 'org.onosproject.router' : { 'router' : {} } } }
203 quagga_router_dict = quagga_dict['apps']['org.onosproject.router']['router']
204 quagga_router_dict['ospfEnabled'] = True
205 quagga_router_dict['interfaces'] = interface_list
206 quagga_router_dict['controlPlaneConnectPoint'] = '{0}/{1}'.format(cls.device_id,
207 networks + 1 if networks < cls.MAX_PORTS else cls.MAX_PORTS )
208 return (cls.vrouter_device_dict, ports_dict, quagga_dict)
209
210 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700211 def generate_vrouter_conf(cls, networks = 4, peers = 1):
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700212 num = 0
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700213 start_peer = ( 192 << 24) | ( 168 << 16) | (10 << 8) | 0
214 end_peer = ( 200 << 24 ) | (168 << 16) | (10 << 8) | 0
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700215 local_network = end_peer + 1
216 ports_dict = { 'ports' : {} }
217 interface_list = []
218 peer_list = []
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700219 for n in xrange(start_peer, end_peer, 256):
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700220 port_map = ports_dict['ports']
221 port = num + 1 if num < cls.MAX_PORTS - 1 else cls.MAX_PORTS - 1
222 device_port_key = '{0}/{1}'.format(cls.device_id, port)
223 try:
224 interfaces = port_map[device_port_key]['interfaces']
225 except:
226 port_map[device_port_key] = { 'interfaces' : [] }
227 interfaces = port_map[device_port_key]['interfaces']
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700228 ip = n + 2
229 peer_ip = n + 1
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700230 ips = '%d.%d.%d.%d/24'%( (ip >> 24) & 0xff, ( (ip >> 16) & 0xff ), ( (ip >> 8 ) & 0xff ), ip & 0xff)
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700231 peer = '%d.%d.%d.%d' % ( (peer_ip >> 24) & 0xff, ( ( peer_ip >> 16) & 0xff ), ( (peer_ip >> 8 ) & 0xff ), peer_ip & 0xff )
232 mac = RandMAC()._fix()
233 peer_list.append((peer, mac))
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700234 if num < cls.MAX_PORTS - 1:
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700235 interface_dict = { 'name' : 'b1-{}'.format(port), 'ips': [ips], 'mac' : mac }
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700236 interfaces.append(interface_dict)
237 interface_list.append(interface_dict['name'])
238 else:
239 interfaces[0]['ips'].append(ips)
240 num += 1
241 if num == peers:
242 break
243 quagga_dict = { 'apps': { 'org.onosproject.router' : { 'router' : {}, 'bgp' : { 'bgpSpeakers' : [] } } } }
244 quagga_router_dict = quagga_dict['apps']['org.onosproject.router']['router']
245 quagga_router_dict['ospfEnabled'] = True
246 quagga_router_dict['interfaces'] = interface_list
247 quagga_router_dict['controlPlaneConnectPoint'] = '{0}/{1}'.format(cls.device_id, peers + 1)
248
249 #bgp_speaker_dict = { 'apps': { 'org.onosproject.router' : { 'bgp' : { 'bgpSpeakers' : [] } } } }
250 bgp_speakers_list = quagga_dict['apps']['org.onosproject.router']['bgp']['bgpSpeakers']
251 speaker_dict = {}
252 speaker_dict['name'] = 'bgp{}'.format(peers+1)
253 speaker_dict['connectPoint'] = '{0}/{1}'.format(cls.device_id, peers + 1)
254 speaker_dict['peers'] = peer_list
255 bgp_speakers_list.append(speaker_dict)
256 cls.peer_list = peer_list
257 return (cls.vrouter_device_dict, ports_dict, quagga_dict)
258
259 @classmethod
260 def generate_conf(cls, networks = 4):
261 num = 0
262 start_network = ( 11 << 24) | ( 10 << 16) | ( 10 << 8) | 0
263 end_network = ( 172 << 24 ) | ( 0 << 16) | (0 << 8) | 0
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700264 net_list = []
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700265 peer_list = cls.peer_list
266 network_list = []
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700267 for n in xrange(start_network, end_network, 256):
268 net = '%d.%d.%d.0'%( (n >> 24) & 0xff, ( ( n >> 16) & 0xff ), ( (n >> 8 ) & 0xff ) )
269 network_list.append(net)
270 gateway = peer_list[num % len(peer_list)][0]
271 net_route = 'ip route {0}/24 {1}'.format(net, gateway)
272 net_list.append(net_route)
273 num += 1
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700274 if num == networks:
275 break
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700276 cls.network_list = network_list
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700277 zebra_routes = '\n'.join(net_list)
Chetan Gaonker68d95172016-05-03 11:16:59 -0700278 #log.info('Zebra routes: \n:%s\n' %cls.zebra_conf + zebra_routes)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700279 return cls.zebra_conf + zebra_routes
280
281 @classmethod
282 def vrouter_activate(cls, deactivate = False):
283 app = 'org.onosproject.vrouter'
284 onos_ctrl = OnosCtrl(app)
285 if deactivate is True:
286 onos_ctrl.deactivate()
287 else:
288 onos_ctrl.activate()
289 time.sleep(3)
290
291 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700292 def vrouter_configure(cls, networks = 4, peers = 1):
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700293 ##Deactivate vrouter
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700294 vrouter_configs = cls.vrouter_config_get(networks = networks, peers = peers)
Chetan Gaonker46b62d52016-04-26 10:08:42 -0700295 cls.start_onos(network_cfg = vrouter_configs)
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700296 cls.vrouter_host_load()
Chetan Gaonker02236ba2016-04-26 11:24:34 -0700297 ##Start quagga
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700298 cls.start_quagga(networks = networks)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700299 return vrouter_configs
300
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700301 def vrouter_port_send_recv(self, ingress, egress, dst_mac, dst_ip, positive_test = True):
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700302 src_mac = '00:00:00:00:00:02'
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700303 src_ip = '1.1.1.1'
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700304 self.success = False if positive_test else True
Chetan Gaonker68d95172016-05-03 11:16:59 -0700305 timeout = 10 if positive_test else 1
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700306 count = 2 if positive_test else 1
Chetan Gaonker68d95172016-05-03 11:16:59 -0700307 self.start_sending = True
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700308 def recv_task():
309 def recv_cb(pkt):
310 log.info('Pkt seen with ingress ip %s, egress ip %s' %(pkt[IP].src, pkt[IP].dst))
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700311 self.success = True if positive_test else False
312 sniff(count=count, timeout=timeout,
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700313 lfilter = lambda p: IP in p and p[IP].dst == dst_ip and p[IP].src == src_ip,
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700314 prn = recv_cb, iface = self.port_map[ingress])
Chetan Gaonker68d95172016-05-03 11:16:59 -0700315 self.start_sending = False
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700316
317 t = threading.Thread(target = recv_task)
318 t.start()
319 L2 = Ether(src = src_mac, dst = dst_mac)
320 L3 = IP(src = src_ip, dst = dst_ip)
321 pkt = L2/L3
322 log.info('Sending a packet with dst ip %s, dst mac %s on port %s to verify if flows are correct' %
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700323 (dst_ip, dst_mac, self.port_map[egress]))
Chetan Gaonker68d95172016-05-03 11:16:59 -0700324 while self.start_sending is True:
325 sendp(pkt, count=50, iface = self.port_map[egress])
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700326 t.join()
327 assert_equal(self.success, True)
328
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700329 def vrouter_traffic_verify(self, positive_test = True):
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700330 peers = len(self.peer_list)
331 egress = peers + 1
332 num = 0
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700333 num_hosts = 5 if positive_test else 1
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700334 for network in self.network_list:
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700335 num_ips = num_hosts
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700336 octets = network.split('.')
337 for i in xrange(num_ips):
338 octets[-1] = str(int(octets[-1]) + 1)
339 dst_ip = '.'.join(octets)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700340 dst_mac = self.peer_list[ num % peers ] [1]
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700341 port = (num % peers)
342 ingress = port + 1
343 #Since peers are on the same network
344 ##Verify if flows are setup by sending traffic across
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700345 self.vrouter_port_send_recv(ingress, egress, dst_mac, dst_ip, positive_test = positive_test)
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700346 num += 1
347
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700348 def __vrouter_network_verify(self, networks, peers = 1, positive_test = True):
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700349 _, ports_map, egress_map = self.vrouter_configure(networks = networks, peers = peers)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700350 self.cliEnter()
351 ##Now verify
352 hosts = json.loads(self.cli.hosts(jsonFormat = True))
353 log.info('Discovered hosts: %s' %hosts)
Chetan Gaonker68d95172016-05-03 11:16:59 -0700354 ##We read from cli if we expect less number of routes to avoid cli timeouts
355 if networks <= 10000:
356 routes = json.loads(self.cli.routes(jsonFormat = True))
357 #log.info('Routes: %s' %routes)
358 assert_equal(len(routes['routes4']), networks)
359 flows = json.loads(self.cli.flows(jsonFormat = True))
360 flows = filter(lambda f: f['flows'], flows)
361 #log.info('Flows: %s' %flows)
362 assert_not_equal(len(flows), 0)
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700363 self.vrouter_traffic_verify()
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700364 if positive_test is False:
365 self.__vrouter_network_verify_negative(networks, peers = peers)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700366 self.cliExit()
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700367 self.vrouter_host_unload()
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700368 return True
369
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700370 def __vrouter_network_verify_negative(self, networks, peers = 1):
371 ##Stop quagga. Test traffic again to see if flows were removed
372 log.info('Stopping Quagga container')
373 quaggaStop = QuaggaStopWrapper()
374 time.sleep(2)
Chetan Gaonker68d95172016-05-03 11:16:59 -0700375 if networks <= 10000:
376 routes = json.loads(self.cli.routes(jsonFormat = True))
377 #Verify routes have been removed
378 if routes and routes.has_key('routes4'):
379 assert_equal(len(routes['routes4']), 0)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700380 self.vrouter_traffic_verify(positive_test = False)
381 log.info('OVS flows have been removed successfully after Quagga was stopped')
382 self.start_quagga(networks = networks)
383 ##Verify the flows again after restarting quagga back
Chetan Gaonker68d95172016-05-03 11:16:59 -0700384 if networks <= 10000:
385 routes = json.loads(self.cli.routes(jsonFormat = True))
386 assert_equal(len(routes['routes4']), networks)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700387 self.vrouter_traffic_verify()
388 log.info('OVS flows have been successfully reinstalled after Quagga was restarted')
389
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700390 def test_vrouter_1(self):
391 '''Test vrouter with 5 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700392 res = self.__vrouter_network_verify(5, peers = 1)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700393 assert_equal(res, True)
394
395 def test_vrouter_2(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700396 '''Test vrouter with 5 routes with 2 peers'''
397 res = self.__vrouter_network_verify(5, peers = 2)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700398 assert_equal(res, True)
399
400 def test_vrouter_3(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700401 '''Test vrouter with 6 routes with 3 peers'''
402 res = self.__vrouter_network_verify(6, peers = 3)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700403 assert_equal(res, True)
404
405 def test_vrouter_4(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700406 '''Test vrouter with 50 routes'''
407 res = self.__vrouter_network_verify(50, peers = 1)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700408 assert_equal(res, True)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700409
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700410 def test_vrouter_5(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700411 '''Test vrouter with 50 routes and 5 peers'''
412 res = self.__vrouter_network_verify(50, peers = 5)
413 assert_equal(res, True)
414
415 def test_vrouter_6(self):
416 '''Test vrouter with 100 routes'''
417 res = self.__vrouter_network_verify(100, peers = 1)
418 assert_equal(res, True)
419
420 def test_vrouter_7(self):
421 '''Test vrouter with 100 routes and 10 peers'''
422 res = self.__vrouter_network_verify(100, peers = 10)
423 assert_equal(res, True)
424
425 def test_vrouter_8(self):
426 '''Test vrouter with 300 routes'''
427 res = self.__vrouter_network_verify(300, peers = 1)
428 assert_equal(res, True)
429
430 def test_vrouter_9(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700431 '''Test vrouter with 1000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700432 res = self.__vrouter_network_verify(1000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700433 assert_equal(res, True)
434
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700435 def test_vrouter_10(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700436 '''Test vrouter with 10000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700437 res = self.__vrouter_network_verify(10000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700438 assert_equal(res, True)
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700439
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700440 @nottest
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700441 def test_vrouter_11(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700442 '''Test vrouter with 100000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700443 res = self.__vrouter_network_verify(100000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700444 assert_equal(res, True)
445
446 @nottest
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700447 def test_vrouter_12(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700448 '''Test vrouter with 1000000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700449 res = self.__vrouter_network_verify(1000000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700450 assert_equal(res, True)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700451
452 def test_vrouter_13(self):
453 '''Test vrouter by installing 5 routes, removing Quagga and re-starting Quagga back'''
454 res = self.__vrouter_network_verify(5, peers = 1, positive_test = False)
455
456 def test_vrouter_14(self):
457 '''Test vrouter by installing 50 routes, removing Quagga and re-starting Quagga back'''
458 res = self.__vrouter_network_verify(50, peers = 1, positive_test = False)