blob: c81eb8d48374e87129d91da116687f27c55b5602 [file] [log] [blame]
Chetan Gaonkercfcce782016-05-10 10:10:42 -07001#
2# Copyright 2016-present Ciena Corporation
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#
Chetan Gaonker3533faa2016-04-25 17:50:14 -070016import unittest
17from nose.tools import *
18from scapy.all import *
19from OnosCtrl import OnosCtrl
20from OltConfig import OltConfig
21from OnosFlowCtrl import OnosFlowCtrl, get_mac
22from onosclidriver import OnosCliDriver
Chetan Gaonker6cf6e472016-04-26 14:41:51 -070023from CordContainer import Container, Onos, Quagga
24from CordTestServer import cord_test_onos_restart, cord_test_quagga_restart
Chetan Gaonker3533faa2016-04-25 17:50:14 -070025from portmaps import g_subscriber_port_map
26import threading
27import time
28import os
29import json
30log.setLevel('INFO')
31
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -070032class QuaggaStopWrapper(Container):
33
34 def __init__(self, name = 'cord-quagga', image = 'cord-test/quagga', tag = 'latest'):
35 super(QuaggaStopWrapper, self).__init__(name, image, tag = tag)
36 if self.exists():
37 self.kill()
38
Chetan Gaonker3533faa2016-04-25 17:50:14 -070039class vrouter_exchange(unittest.TestCase):
40
41 apps = ('org.onosproject.vrouter', 'org.onosproject.fwd')
42 device_id = 'of:' + get_mac('ovsbr0')
43 vrouter_device_dict = { "devices" : {
44 "{}".format(device_id) : {
45 "basic" : {
46 "driver" : "softrouter"
47 }
48 }
49 },
50 }
51 zebra_conf = '''
52password zebra
53log stdout
54service advanced-vty
55!
Chetan Gaonkerfd3d6502016-05-03 13:23:07 -070056!debug zebra rib
57!debug zebra kernel
58!debug zebra fpm
Chetan Gaonker3533faa2016-04-25 17:50:14 -070059!
60!interface eth1
61! ip address 10.10.0.3/16
62line vty
63 exec-timeout 0 0
64'''
65 test_path = os.path.dirname(os.path.realpath(__file__))
66 quagga_config_path = os.path.join(test_path, '..', 'setup/quagga-config')
67 onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -070068 GATEWAY = '192.168.10.50'
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070069 INGRESS_PORT = 1
70 EGRESS_PORT = 2
Chetan Gaonker3533faa2016-04-25 17:50:14 -070071 MAX_PORTS = 100
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -070072 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 -070073 network_list = []
Chetan Gaonker3533faa2016-04-25 17:50:14 -070074
75 @classmethod
76 def setUpClass(cls):
77 ''' Activate the vrouter apps'''
78 cls.olt = OltConfig()
79 cls.port_map = cls.olt.olt_port_map()
80 if not cls.port_map:
81 cls.port_map = g_subscriber_port_map
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070082 #cls.vrouter_host_load(host = cls.GATEWAY)
Chetan Gaonker3533faa2016-04-25 17:50:14 -070083 time.sleep(3)
84
85 @classmethod
86 def tearDownClass(cls):
87 '''Deactivate the vrouter apps'''
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070088 #cls.vrouter_host_unload()
Chetan Gaonker3533faa2016-04-25 17:50:14 -070089
90 def cliEnter(self):
91 retries = 0
92 while retries < 3:
93 self.cli = OnosCliDriver(connect = True)
94 if self.cli.handle:
95 break
96 else:
97 retries += 1
98 time.sleep(2)
99
100 def cliExit(self):
101 self.cli.disconnect()
102
103 @classmethod
104 def onos_load_config(cls, config):
105 status, code = OnosCtrl.config(config)
106 if status is False:
107 log.info('JSON request returned status %d' %code)
108 assert_equal(status, True)
109
110 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700111 def vrouter_config_get(cls, networks = 4, peers = 1):
112 vrouter_configs = cls.generate_vrouter_conf(networks = networks, peers = peers)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700113 return vrouter_configs
114 ##ONOS router does not support dynamic reconfigurations
115 #for config in vrouter_configs:
116 # cls.onos_load_config(config)
117 # time.sleep(5)
118
119 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700120 def vrouter_host_load(cls):
121 index = 1
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700122 for host,_ in cls.peer_list:
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700123 iface = cls.port_map[index]
124 index += 1
125 config_cmds = ( 'ifconfig {0} {1}'.format(iface, host),
126 'arping -I {0} {1} -c 2'.format(iface, host),
127 )
128 for cmd in config_cmds:
129 os.system(cmd)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700130
131 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700132 def vrouter_host_unload(cls):
133 index = 1
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700134 for host,_ in cls.peer_list:
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700135 iface = cls.port_map[index]
136 index += 1
137 config_cmds = ('ifconfig {} 0'.format(iface), )
138 for cmd in config_cmds:
139 os.system(cmd)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700140
141 @classmethod
142 def start_onos(cls, network_cfg = None):
143 if type(network_cfg) is tuple:
144 res = []
145 for v in network_cfg:
146 res += v.items()
147 config = dict(res)
148 else:
149 config = network_cfg
150 log.info('Restarting ONOS with new network configuration')
151 cfg = json.dumps(config)
152 with open('{}/network-cfg.json'.format(cls.onos_config_path), 'w') as f:
153 f.write(cfg)
154
155 return cord_test_onos_restart()
156
157 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700158 def start_quagga(cls, networks = 4):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700159 log.info('Restarting Quagga container with configuration for %d networks' %(networks))
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700160 config = cls.generate_conf(networks = networks)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700161 host_config_file = '{}/testrib_gen.conf'.format(Quagga.host_quagga_config)
162 guest_config_file = os.path.join(Quagga.guest_quagga_config, 'testrib_gen.conf')
163 with open(host_config_file, 'w') as f:
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700164 f.write(config)
Chetan Gaonkerfd3d6502016-05-03 13:23:07 -0700165 if networks <= 10000:
166 boot_delay = 25
167 else:
Chetan Gaonker37ad23f2016-05-03 17:37:59 -0700168 delay_map = [60, 100, 150, 200, 300, 450, 600, 800, 1000, 1200]
169 n = min(networks/100000, len(delay_map)-1)
170 boot_delay = delay_map[n]
Chetan Gaonkerfd3d6502016-05-03 13:23:07 -0700171 cord_test_quagga_restart(config_file = guest_config_file, boot_delay = boot_delay)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700172
173 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700174 def zgenerate_vrouter_conf(cls, networks = 4):
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700175 num = 0
176 start_network = ( 11 << 24) | ( 0 << 16) | ( 0 << 8) | 0
177 end_network = ( 200 << 24 ) | ( 0 << 16) | (0 << 8) | 0
178 ports_dict = { 'ports' : {} }
179 interface_list = []
180 for n in xrange(start_network, end_network):
181 if n & 255 == 0:
182 port_map = ports_dict['ports']
183 port = num + 1 if num < cls.MAX_PORTS - 1 else cls.MAX_PORTS - 1
184 device_port_key = '{0}/{1}'.format(cls.device_id, port)
185 try:
186 interfaces = port_map[device_port_key]['interfaces']
187 except:
188 port_map[device_port_key] = { 'interfaces' : [] }
189 interfaces = port_map[device_port_key]['interfaces']
190
191 ips = '%d.%d.%d.2/24'%( (n >> 24) & 0xff, ( ( n >> 16) & 0xff ), ( (n >> 8 ) & 0xff ) )
192 if num < cls.MAX_PORTS - 1:
193 interface_dict = { 'name' : 'b1-{}'.format(port), 'ips': [ips], 'mac' : '00:00:00:00:00:01' }
194 interfaces.append(interface_dict)
195 interface_list.append(interface_dict['name'])
196 else:
197 interfaces[0]['ips'].append(ips)
198 num += 1
199 if num == networks:
200 break
201 quagga_dict = { 'apps': { 'org.onosproject.router' : { 'router' : {} } } }
202 quagga_router_dict = quagga_dict['apps']['org.onosproject.router']['router']
203 quagga_router_dict['ospfEnabled'] = True
204 quagga_router_dict['interfaces'] = interface_list
205 quagga_router_dict['controlPlaneConnectPoint'] = '{0}/{1}'.format(cls.device_id,
206 networks + 1 if networks < cls.MAX_PORTS else cls.MAX_PORTS )
207 return (cls.vrouter_device_dict, ports_dict, quagga_dict)
208
209 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700210 def generate_vrouter_conf(cls, networks = 4, peers = 1):
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700211 num = 0
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700212 start_peer = ( 192 << 24) | ( 168 << 16) | (10 << 8) | 0
213 end_peer = ( 200 << 24 ) | (168 << 16) | (10 << 8) | 0
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700214 local_network = end_peer + 1
215 ports_dict = { 'ports' : {} }
216 interface_list = []
217 peer_list = []
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700218 for n in xrange(start_peer, end_peer, 256):
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700219 port_map = ports_dict['ports']
220 port = num + 1 if num < cls.MAX_PORTS - 1 else cls.MAX_PORTS - 1
221 device_port_key = '{0}/{1}'.format(cls.device_id, port)
222 try:
223 interfaces = port_map[device_port_key]['interfaces']
224 except:
225 port_map[device_port_key] = { 'interfaces' : [] }
226 interfaces = port_map[device_port_key]['interfaces']
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700227 ip = n + 2
228 peer_ip = n + 1
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700229 ips = '%d.%d.%d.%d/24'%( (ip >> 24) & 0xff, ( (ip >> 16) & 0xff ), ( (ip >> 8 ) & 0xff ), ip & 0xff)
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700230 peer = '%d.%d.%d.%d' % ( (peer_ip >> 24) & 0xff, ( ( peer_ip >> 16) & 0xff ), ( (peer_ip >> 8 ) & 0xff ), peer_ip & 0xff )
231 mac = RandMAC()._fix()
232 peer_list.append((peer, mac))
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700233 if num < cls.MAX_PORTS - 1:
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700234 interface_dict = { 'name' : 'b1-{}'.format(port), 'ips': [ips], 'mac' : mac }
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700235 interfaces.append(interface_dict)
236 interface_list.append(interface_dict['name'])
237 else:
238 interfaces[0]['ips'].append(ips)
239 num += 1
240 if num == peers:
241 break
242 quagga_dict = { 'apps': { 'org.onosproject.router' : { 'router' : {}, 'bgp' : { 'bgpSpeakers' : [] } } } }
243 quagga_router_dict = quagga_dict['apps']['org.onosproject.router']['router']
244 quagga_router_dict['ospfEnabled'] = True
245 quagga_router_dict['interfaces'] = interface_list
246 quagga_router_dict['controlPlaneConnectPoint'] = '{0}/{1}'.format(cls.device_id, peers + 1)
247
248 #bgp_speaker_dict = { 'apps': { 'org.onosproject.router' : { 'bgp' : { 'bgpSpeakers' : [] } } } }
249 bgp_speakers_list = quagga_dict['apps']['org.onosproject.router']['bgp']['bgpSpeakers']
250 speaker_dict = {}
251 speaker_dict['name'] = 'bgp{}'.format(peers+1)
252 speaker_dict['connectPoint'] = '{0}/{1}'.format(cls.device_id, peers + 1)
253 speaker_dict['peers'] = peer_list
254 bgp_speakers_list.append(speaker_dict)
255 cls.peer_list = peer_list
256 return (cls.vrouter_device_dict, ports_dict, quagga_dict)
257
258 @classmethod
259 def generate_conf(cls, networks = 4):
260 num = 0
261 start_network = ( 11 << 24) | ( 10 << 16) | ( 10 << 8) | 0
262 end_network = ( 172 << 24 ) | ( 0 << 16) | (0 << 8) | 0
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700263 net_list = []
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700264 peer_list = cls.peer_list
265 network_list = []
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700266 for n in xrange(start_network, end_network, 256):
267 net = '%d.%d.%d.0'%( (n >> 24) & 0xff, ( ( n >> 16) & 0xff ), ( (n >> 8 ) & 0xff ) )
268 network_list.append(net)
269 gateway = peer_list[num % len(peer_list)][0]
270 net_route = 'ip route {0}/24 {1}'.format(net, gateway)
271 net_list.append(net_route)
272 num += 1
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700273 if num == networks:
274 break
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700275 cls.network_list = network_list
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700276 zebra_routes = '\n'.join(net_list)
Chetan Gaonker68d95172016-05-03 11:16:59 -0700277 #log.info('Zebra routes: \n:%s\n' %cls.zebra_conf + zebra_routes)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700278 return cls.zebra_conf + zebra_routes
279
280 @classmethod
281 def vrouter_activate(cls, deactivate = False):
282 app = 'org.onosproject.vrouter'
283 onos_ctrl = OnosCtrl(app)
284 if deactivate is True:
285 onos_ctrl.deactivate()
286 else:
287 onos_ctrl.activate()
288 time.sleep(3)
289
290 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700291 def vrouter_configure(cls, networks = 4, peers = 1):
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700292 ##Deactivate vrouter
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700293 vrouter_configs = cls.vrouter_config_get(networks = networks, peers = peers)
Chetan Gaonker46b62d52016-04-26 10:08:42 -0700294 cls.start_onos(network_cfg = vrouter_configs)
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700295 cls.vrouter_host_load()
Chetan Gaonker02236ba2016-04-26 11:24:34 -0700296 ##Start quagga
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700297 cls.start_quagga(networks = networks)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700298 return vrouter_configs
299
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700300 def vrouter_port_send_recv(self, ingress, egress, dst_mac, dst_ip, positive_test = True):
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700301 src_mac = '00:00:00:00:00:02'
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700302 src_ip = '1.1.1.1'
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700303 self.success = False if positive_test else True
Chetan Gaonker68d95172016-05-03 11:16:59 -0700304 timeout = 10 if positive_test else 1
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700305 count = 2 if positive_test else 1
Chetan Gaonker68d95172016-05-03 11:16:59 -0700306 self.start_sending = True
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700307 def recv_task():
308 def recv_cb(pkt):
309 log.info('Pkt seen with ingress ip %s, egress ip %s' %(pkt[IP].src, pkt[IP].dst))
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700310 self.success = True if positive_test else False
311 sniff(count=count, timeout=timeout,
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700312 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 -0700313 prn = recv_cb, iface = self.port_map[ingress])
Chetan Gaonker68d95172016-05-03 11:16:59 -0700314 self.start_sending = False
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700315
316 t = threading.Thread(target = recv_task)
317 t.start()
318 L2 = Ether(src = src_mac, dst = dst_mac)
319 L3 = IP(src = src_ip, dst = dst_ip)
320 pkt = L2/L3
321 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 -0700322 (dst_ip, dst_mac, self.port_map[egress]))
Chetan Gaonker68d95172016-05-03 11:16:59 -0700323 while self.start_sending is True:
324 sendp(pkt, count=50, iface = self.port_map[egress])
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700325 t.join()
326 assert_equal(self.success, True)
327
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700328 def vrouter_traffic_verify(self, positive_test = True):
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700329 peers = len(self.peer_list)
330 egress = peers + 1
331 num = 0
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700332 num_hosts = 5 if positive_test else 1
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700333 for network in self.network_list:
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700334 num_ips = num_hosts
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700335 octets = network.split('.')
336 for i in xrange(num_ips):
337 octets[-1] = str(int(octets[-1]) + 1)
338 dst_ip = '.'.join(octets)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700339 dst_mac = self.peer_list[ num % peers ] [1]
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700340 port = (num % peers)
341 ingress = port + 1
342 #Since peers are on the same network
343 ##Verify if flows are setup by sending traffic across
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700344 self.vrouter_port_send_recv(ingress, egress, dst_mac, dst_ip, positive_test = positive_test)
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700345 num += 1
346
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700347 def __vrouter_network_verify(self, networks, peers = 1, positive_test = True):
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700348 _, ports_map, egress_map = self.vrouter_configure(networks = networks, peers = peers)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700349 self.cliEnter()
350 ##Now verify
351 hosts = json.loads(self.cli.hosts(jsonFormat = True))
352 log.info('Discovered hosts: %s' %hosts)
Chetan Gaonker68d95172016-05-03 11:16:59 -0700353 ##We read from cli if we expect less number of routes to avoid cli timeouts
354 if networks <= 10000:
355 routes = json.loads(self.cli.routes(jsonFormat = True))
356 #log.info('Routes: %s' %routes)
357 assert_equal(len(routes['routes4']), networks)
358 flows = json.loads(self.cli.flows(jsonFormat = True))
359 flows = filter(lambda f: f['flows'], flows)
360 #log.info('Flows: %s' %flows)
361 assert_not_equal(len(flows), 0)
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700362 self.vrouter_traffic_verify()
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700363 if positive_test is False:
364 self.__vrouter_network_verify_negative(networks, peers = peers)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700365 self.cliExit()
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700366 self.vrouter_host_unload()
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700367 return True
368
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700369 def __vrouter_network_verify_negative(self, networks, peers = 1):
370 ##Stop quagga. Test traffic again to see if flows were removed
371 log.info('Stopping Quagga container')
372 quaggaStop = QuaggaStopWrapper()
373 time.sleep(2)
Chetan Gaonker68d95172016-05-03 11:16:59 -0700374 if networks <= 10000:
375 routes = json.loads(self.cli.routes(jsonFormat = True))
376 #Verify routes have been removed
377 if routes and routes.has_key('routes4'):
378 assert_equal(len(routes['routes4']), 0)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700379 self.vrouter_traffic_verify(positive_test = False)
380 log.info('OVS flows have been removed successfully after Quagga was stopped')
381 self.start_quagga(networks = networks)
382 ##Verify the flows again after restarting quagga back
Chetan Gaonker68d95172016-05-03 11:16:59 -0700383 if networks <= 10000:
384 routes = json.loads(self.cli.routes(jsonFormat = True))
385 assert_equal(len(routes['routes4']), networks)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700386 self.vrouter_traffic_verify()
387 log.info('OVS flows have been successfully reinstalled after Quagga was restarted')
388
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700389 def test_vrouter_1(self):
390 '''Test vrouter with 5 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700391 res = self.__vrouter_network_verify(5, peers = 1)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700392 assert_equal(res, True)
393
394 def test_vrouter_2(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700395 '''Test vrouter with 5 routes with 2 peers'''
396 res = self.__vrouter_network_verify(5, peers = 2)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700397 assert_equal(res, True)
398
399 def test_vrouter_3(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700400 '''Test vrouter with 6 routes with 3 peers'''
401 res = self.__vrouter_network_verify(6, peers = 3)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700402 assert_equal(res, True)
403
404 def test_vrouter_4(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700405 '''Test vrouter with 50 routes'''
406 res = self.__vrouter_network_verify(50, peers = 1)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700407 assert_equal(res, True)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700408
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700409 def test_vrouter_5(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700410 '''Test vrouter with 50 routes and 5 peers'''
411 res = self.__vrouter_network_verify(50, peers = 5)
412 assert_equal(res, True)
413
414 def test_vrouter_6(self):
415 '''Test vrouter with 100 routes'''
416 res = self.__vrouter_network_verify(100, peers = 1)
417 assert_equal(res, True)
418
419 def test_vrouter_7(self):
420 '''Test vrouter with 100 routes and 10 peers'''
421 res = self.__vrouter_network_verify(100, peers = 10)
422 assert_equal(res, True)
423
424 def test_vrouter_8(self):
425 '''Test vrouter with 300 routes'''
426 res = self.__vrouter_network_verify(300, peers = 1)
427 assert_equal(res, True)
428
429 def test_vrouter_9(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700430 '''Test vrouter with 1000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700431 res = self.__vrouter_network_verify(1000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700432 assert_equal(res, True)
433
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700434 def test_vrouter_10(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700435 '''Test vrouter with 10000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700436 res = self.__vrouter_network_verify(10000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700437 assert_equal(res, True)
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700438
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700439 @nottest
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700440 def test_vrouter_11(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700441 '''Test vrouter with 100000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700442 res = self.__vrouter_network_verify(100000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700443 assert_equal(res, True)
444
445 @nottest
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700446 def test_vrouter_12(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700447 '''Test vrouter with 1000000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700448 res = self.__vrouter_network_verify(1000000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700449 assert_equal(res, True)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700450
451 def test_vrouter_13(self):
452 '''Test vrouter by installing 5 routes, removing Quagga and re-starting Quagga back'''
453 res = self.__vrouter_network_verify(5, peers = 1, positive_test = False)
454
455 def test_vrouter_14(self):
456 '''Test vrouter by installing 50 routes, removing Quagga and re-starting Quagga back'''
457 res = self.__vrouter_network_verify(50, peers = 1, positive_test = False)