blob: 566634883da0946a700252fc5218e4a99c28b9ff [file] [log] [blame]
A R Karthick81acbff2016-06-17 14:45:16 -07001#
Chetan Gaonkercfcce782016-05-10 10:10:42 -07002# 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
A R Karthick81acbff2016-06-17 14:45:16 -07007#
Chetan Gaonkercfcce782016-05-10 10:10:42 -07008# http://www.apache.org/licenses/LICENSE-2.0
A R Karthick81acbff2016-06-17 14:45:16 -07009#
Chetan Gaonkercfcce782016-05-10 10:10:42 -070010# 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
A R Karthick4a2362c2016-06-22 17:32:44 -070024from CordTestServer import cord_test_onos_restart, cord_test_quagga_restart, cord_test_quagga_stop
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 Gaonker3533faa2016-04-25 17:50:14 -070032class vrouter_exchange(unittest.TestCase):
33
34 apps = ('org.onosproject.vrouter', 'org.onosproject.fwd')
35 device_id = 'of:' + get_mac('ovsbr0')
36 vrouter_device_dict = { "devices" : {
37 "{}".format(device_id) : {
38 "basic" : {
39 "driver" : "softrouter"
40 }
41 }
42 },
43 }
44 zebra_conf = '''
45password zebra
46log stdout
47service advanced-vty
48!
Chetan Gaonkerfd3d6502016-05-03 13:23:07 -070049!debug zebra rib
50!debug zebra kernel
51!debug zebra fpm
Chetan Gaonker3533faa2016-04-25 17:50:14 -070052!
53!interface eth1
54! ip address 10.10.0.3/16
55line vty
56 exec-timeout 0 0
57'''
58 test_path = os.path.dirname(os.path.realpath(__file__))
59 quagga_config_path = os.path.join(test_path, '..', 'setup/quagga-config')
60 onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -070061 GATEWAY = '192.168.10.50'
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070062 INGRESS_PORT = 1
63 EGRESS_PORT = 2
Chetan Gaonker3533faa2016-04-25 17:50:14 -070064 MAX_PORTS = 100
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -070065 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 -070066 network_list = []
Chetan Gaonker3533faa2016-04-25 17:50:14 -070067
68 @classmethod
69 def setUpClass(cls):
70 ''' Activate the vrouter apps'''
71 cls.olt = OltConfig()
72 cls.port_map = cls.olt.olt_port_map()
73 if not cls.port_map:
74 cls.port_map = g_subscriber_port_map
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070075 #cls.vrouter_host_load(host = cls.GATEWAY)
Chetan Gaonker3533faa2016-04-25 17:50:14 -070076 time.sleep(3)
A R Karthick81acbff2016-06-17 14:45:16 -070077
Chetan Gaonker3533faa2016-04-25 17:50:14 -070078 @classmethod
79 def tearDownClass(cls):
80 '''Deactivate the vrouter apps'''
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070081 #cls.vrouter_host_unload()
Chetan Gaonker3533faa2016-04-25 17:50:14 -070082
83 def cliEnter(self):
84 retries = 0
85 while retries < 3:
86 self.cli = OnosCliDriver(connect = True)
87 if self.cli.handle:
88 break
89 else:
90 retries += 1
91 time.sleep(2)
92
93 def cliExit(self):
94 self.cli.disconnect()
95
96 @classmethod
97 def onos_load_config(cls, config):
98 status, code = OnosCtrl.config(config)
99 if status is False:
100 log.info('JSON request returned status %d' %code)
101 assert_equal(status, True)
102
103 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700104 def vrouter_config_get(cls, networks = 4, peers = 1):
105 vrouter_configs = cls.generate_vrouter_conf(networks = networks, peers = peers)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700106 return vrouter_configs
107 ##ONOS router does not support dynamic reconfigurations
108 #for config in vrouter_configs:
109 # cls.onos_load_config(config)
110 # time.sleep(5)
111
112 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700113 def vrouter_host_load(cls):
114 index = 1
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700115 for host,_ in cls.peer_list:
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700116 iface = cls.port_map[index]
117 index += 1
118 config_cmds = ( 'ifconfig {0} {1}'.format(iface, host),
119 'arping -I {0} {1} -c 2'.format(iface, host),
120 )
121 for cmd in config_cmds:
122 os.system(cmd)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700123
124 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700125 def vrouter_host_unload(cls):
126 index = 1
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700127 for host,_ in cls.peer_list:
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700128 iface = cls.port_map[index]
129 index += 1
130 config_cmds = ('ifconfig {} 0'.format(iface), )
131 for cmd in config_cmds:
132 os.system(cmd)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700133
134 @classmethod
135 def start_onos(cls, network_cfg = None):
136 if type(network_cfg) is tuple:
137 res = []
138 for v in network_cfg:
139 res += v.items()
140 config = dict(res)
141 else:
142 config = network_cfg
143 log.info('Restarting ONOS with new network configuration')
A R Karthick81acbff2016-06-17 14:45:16 -0700144 return cord_test_onos_restart(config = config)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700145
146 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700147 def start_quagga(cls, networks = 4):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700148 log.info('Restarting Quagga container with configuration for %d networks' %(networks))
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700149 config = cls.generate_conf(networks = networks)
Chetan Gaonkerfd3d6502016-05-03 13:23:07 -0700150 if networks <= 10000:
151 boot_delay = 25
152 else:
Chetan Gaonker37ad23f2016-05-03 17:37:59 -0700153 delay_map = [60, 100, 150, 200, 300, 450, 600, 800, 1000, 1200]
154 n = min(networks/100000, len(delay_map)-1)
155 boot_delay = delay_map[n]
A R Karthick81acbff2016-06-17 14:45:16 -0700156 cord_test_quagga_restart(config = config, boot_delay = boot_delay)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700157
158 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700159 def zgenerate_vrouter_conf(cls, networks = 4):
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700160 num = 0
161 start_network = ( 11 << 24) | ( 0 << 16) | ( 0 << 8) | 0
162 end_network = ( 200 << 24 ) | ( 0 << 16) | (0 << 8) | 0
163 ports_dict = { 'ports' : {} }
164 interface_list = []
165 for n in xrange(start_network, end_network):
166 if n & 255 == 0:
167 port_map = ports_dict['ports']
168 port = num + 1 if num < cls.MAX_PORTS - 1 else cls.MAX_PORTS - 1
169 device_port_key = '{0}/{1}'.format(cls.device_id, port)
170 try:
171 interfaces = port_map[device_port_key]['interfaces']
172 except:
173 port_map[device_port_key] = { 'interfaces' : [] }
174 interfaces = port_map[device_port_key]['interfaces']
A R Karthick81acbff2016-06-17 14:45:16 -0700175
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700176 ips = '%d.%d.%d.2/24'%( (n >> 24) & 0xff, ( ( n >> 16) & 0xff ), ( (n >> 8 ) & 0xff ) )
177 if num < cls.MAX_PORTS - 1:
178 interface_dict = { 'name' : 'b1-{}'.format(port), 'ips': [ips], 'mac' : '00:00:00:00:00:01' }
179 interfaces.append(interface_dict)
180 interface_list.append(interface_dict['name'])
181 else:
182 interfaces[0]['ips'].append(ips)
183 num += 1
184 if num == networks:
185 break
186 quagga_dict = { 'apps': { 'org.onosproject.router' : { 'router' : {} } } }
187 quagga_router_dict = quagga_dict['apps']['org.onosproject.router']['router']
188 quagga_router_dict['ospfEnabled'] = True
189 quagga_router_dict['interfaces'] = interface_list
A R Karthick81acbff2016-06-17 14:45:16 -0700190 quagga_router_dict['controlPlaneConnectPoint'] = '{0}/{1}'.format(cls.device_id,
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700191 networks + 1 if networks < cls.MAX_PORTS else cls.MAX_PORTS )
192 return (cls.vrouter_device_dict, ports_dict, quagga_dict)
193
194 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700195 def generate_vrouter_conf(cls, networks = 4, peers = 1):
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700196 num = 0
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700197 start_peer = ( 192 << 24) | ( 168 << 16) | (10 << 8) | 0
198 end_peer = ( 200 << 24 ) | (168 << 16) | (10 << 8) | 0
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700199 local_network = end_peer + 1
200 ports_dict = { 'ports' : {} }
201 interface_list = []
202 peer_list = []
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700203 for n in xrange(start_peer, end_peer, 256):
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700204 port_map = ports_dict['ports']
205 port = num + 1 if num < cls.MAX_PORTS - 1 else cls.MAX_PORTS - 1
206 device_port_key = '{0}/{1}'.format(cls.device_id, port)
207 try:
208 interfaces = port_map[device_port_key]['interfaces']
209 except:
210 port_map[device_port_key] = { 'interfaces' : [] }
211 interfaces = port_map[device_port_key]['interfaces']
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700212 ip = n + 2
213 peer_ip = n + 1
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700214 ips = '%d.%d.%d.%d/24'%( (ip >> 24) & 0xff, ( (ip >> 16) & 0xff ), ( (ip >> 8 ) & 0xff ), ip & 0xff)
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700215 peer = '%d.%d.%d.%d' % ( (peer_ip >> 24) & 0xff, ( ( peer_ip >> 16) & 0xff ), ( (peer_ip >> 8 ) & 0xff ), peer_ip & 0xff )
216 mac = RandMAC()._fix()
217 peer_list.append((peer, mac))
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700218 if num < cls.MAX_PORTS - 1:
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700219 interface_dict = { 'name' : 'b1-{}'.format(port), 'ips': [ips], 'mac' : mac }
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700220 interfaces.append(interface_dict)
221 interface_list.append(interface_dict['name'])
222 else:
223 interfaces[0]['ips'].append(ips)
224 num += 1
225 if num == peers:
226 break
227 quagga_dict = { 'apps': { 'org.onosproject.router' : { 'router' : {}, 'bgp' : { 'bgpSpeakers' : [] } } } }
228 quagga_router_dict = quagga_dict['apps']['org.onosproject.router']['router']
229 quagga_router_dict['ospfEnabled'] = True
230 quagga_router_dict['interfaces'] = interface_list
231 quagga_router_dict['controlPlaneConnectPoint'] = '{0}/{1}'.format(cls.device_id, peers + 1)
232
233 #bgp_speaker_dict = { 'apps': { 'org.onosproject.router' : { 'bgp' : { 'bgpSpeakers' : [] } } } }
234 bgp_speakers_list = quagga_dict['apps']['org.onosproject.router']['bgp']['bgpSpeakers']
235 speaker_dict = {}
236 speaker_dict['name'] = 'bgp{}'.format(peers+1)
237 speaker_dict['connectPoint'] = '{0}/{1}'.format(cls.device_id, peers + 1)
238 speaker_dict['peers'] = peer_list
239 bgp_speakers_list.append(speaker_dict)
240 cls.peer_list = peer_list
241 return (cls.vrouter_device_dict, ports_dict, quagga_dict)
242
243 @classmethod
244 def generate_conf(cls, networks = 4):
245 num = 0
246 start_network = ( 11 << 24) | ( 10 << 16) | ( 10 << 8) | 0
247 end_network = ( 172 << 24 ) | ( 0 << 16) | (0 << 8) | 0
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700248 net_list = []
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700249 peer_list = cls.peer_list
250 network_list = []
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700251 for n in xrange(start_network, end_network, 256):
252 net = '%d.%d.%d.0'%( (n >> 24) & 0xff, ( ( n >> 16) & 0xff ), ( (n >> 8 ) & 0xff ) )
253 network_list.append(net)
254 gateway = peer_list[num % len(peer_list)][0]
255 net_route = 'ip route {0}/24 {1}'.format(net, gateway)
256 net_list.append(net_route)
257 num += 1
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700258 if num == networks:
259 break
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700260 cls.network_list = network_list
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700261 zebra_routes = '\n'.join(net_list)
Chetan Gaonker68d95172016-05-03 11:16:59 -0700262 #log.info('Zebra routes: \n:%s\n' %cls.zebra_conf + zebra_routes)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700263 return cls.zebra_conf + zebra_routes
A R Karthick81acbff2016-06-17 14:45:16 -0700264
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700265 @classmethod
266 def vrouter_activate(cls, deactivate = False):
267 app = 'org.onosproject.vrouter'
268 onos_ctrl = OnosCtrl(app)
269 if deactivate is True:
270 onos_ctrl.deactivate()
271 else:
272 onos_ctrl.activate()
273 time.sleep(3)
274
275 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700276 def vrouter_configure(cls, networks = 4, peers = 1):
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700277 ##Deactivate vrouter
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700278 vrouter_configs = cls.vrouter_config_get(networks = networks, peers = peers)
Chetan Gaonker46b62d52016-04-26 10:08:42 -0700279 cls.start_onos(network_cfg = vrouter_configs)
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700280 cls.vrouter_host_load()
Chetan Gaonker02236ba2016-04-26 11:24:34 -0700281 ##Start quagga
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700282 cls.start_quagga(networks = networks)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700283 return vrouter_configs
A R Karthick81acbff2016-06-17 14:45:16 -0700284
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700285 def vrouter_port_send_recv(self, ingress, egress, dst_mac, dst_ip, positive_test = True):
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700286 src_mac = '00:00:00:00:00:02'
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700287 src_ip = '1.1.1.1'
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700288 self.success = False if positive_test else True
Chetan Gaonker68d95172016-05-03 11:16:59 -0700289 timeout = 10 if positive_test else 1
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700290 count = 2 if positive_test else 1
Chetan Gaonker68d95172016-05-03 11:16:59 -0700291 self.start_sending = True
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700292 def recv_task():
293 def recv_cb(pkt):
294 log.info('Pkt seen with ingress ip %s, egress ip %s' %(pkt[IP].src, pkt[IP].dst))
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700295 self.success = True if positive_test else False
296 sniff(count=count, timeout=timeout,
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700297 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 -0700298 prn = recv_cb, iface = self.port_map[ingress])
Chetan Gaonker68d95172016-05-03 11:16:59 -0700299 self.start_sending = False
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700300
301 t = threading.Thread(target = recv_task)
302 t.start()
303 L2 = Ether(src = src_mac, dst = dst_mac)
304 L3 = IP(src = src_ip, dst = dst_ip)
305 pkt = L2/L3
306 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 -0700307 (dst_ip, dst_mac, self.port_map[egress]))
Chetan Gaonker68d95172016-05-03 11:16:59 -0700308 while self.start_sending is True:
309 sendp(pkt, count=50, iface = self.port_map[egress])
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700310 t.join()
311 assert_equal(self.success, True)
312
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700313 def vrouter_traffic_verify(self, positive_test = True):
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700314 peers = len(self.peer_list)
315 egress = peers + 1
316 num = 0
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700317 num_hosts = 5 if positive_test else 1
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700318 for network in self.network_list:
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700319 num_ips = num_hosts
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700320 octets = network.split('.')
321 for i in xrange(num_ips):
322 octets[-1] = str(int(octets[-1]) + 1)
323 dst_ip = '.'.join(octets)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700324 dst_mac = self.peer_list[ num % peers ] [1]
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700325 port = (num % peers)
326 ingress = port + 1
327 #Since peers are on the same network
328 ##Verify if flows are setup by sending traffic across
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700329 self.vrouter_port_send_recv(ingress, egress, dst_mac, dst_ip, positive_test = positive_test)
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700330 num += 1
A R Karthick81acbff2016-06-17 14:45:16 -0700331
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700332 def __vrouter_network_verify(self, networks, peers = 1, positive_test = True):
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700333 _, ports_map, egress_map = self.vrouter_configure(networks = networks, peers = peers)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700334 self.cliEnter()
335 ##Now verify
336 hosts = json.loads(self.cli.hosts(jsonFormat = True))
337 log.info('Discovered hosts: %s' %hosts)
Chetan Gaonker68d95172016-05-03 11:16:59 -0700338 ##We read from cli if we expect less number of routes to avoid cli timeouts
339 if networks <= 10000:
340 routes = json.loads(self.cli.routes(jsonFormat = True))
341 #log.info('Routes: %s' %routes)
342 assert_equal(len(routes['routes4']), networks)
343 flows = json.loads(self.cli.flows(jsonFormat = True))
344 flows = filter(lambda f: f['flows'], flows)
345 #log.info('Flows: %s' %flows)
346 assert_not_equal(len(flows), 0)
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700347 self.vrouter_traffic_verify()
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700348 if positive_test is False:
349 self.__vrouter_network_verify_negative(networks, peers = peers)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700350 self.cliExit()
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700351 self.vrouter_host_unload()
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700352 return True
353
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700354 def __vrouter_network_verify_negative(self, networks, peers = 1):
355 ##Stop quagga. Test traffic again to see if flows were removed
356 log.info('Stopping Quagga container')
A R Karthick4a2362c2016-06-22 17:32:44 -0700357 cord_test_quagga_stop()
Chetan Gaonker68d95172016-05-03 11:16:59 -0700358 if networks <= 10000:
359 routes = json.loads(self.cli.routes(jsonFormat = True))
360 #Verify routes have been removed
361 if routes and routes.has_key('routes4'):
362 assert_equal(len(routes['routes4']), 0)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700363 self.vrouter_traffic_verify(positive_test = False)
364 log.info('OVS flows have been removed successfully after Quagga was stopped')
365 self.start_quagga(networks = networks)
366 ##Verify the flows again after restarting quagga back
Chetan Gaonker68d95172016-05-03 11:16:59 -0700367 if networks <= 10000:
368 routes = json.loads(self.cli.routes(jsonFormat = True))
369 assert_equal(len(routes['routes4']), networks)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700370 self.vrouter_traffic_verify()
371 log.info('OVS flows have been successfully reinstalled after Quagga was restarted')
372
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700373 def test_vrouter_1(self):
374 '''Test vrouter with 5 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700375 res = self.__vrouter_network_verify(5, peers = 1)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700376 assert_equal(res, True)
377
378 def test_vrouter_2(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700379 '''Test vrouter with 5 routes with 2 peers'''
380 res = self.__vrouter_network_verify(5, peers = 2)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700381 assert_equal(res, True)
382
383 def test_vrouter_3(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700384 '''Test vrouter with 6 routes with 3 peers'''
385 res = self.__vrouter_network_verify(6, peers = 3)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700386 assert_equal(res, True)
387
388 def test_vrouter_4(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700389 '''Test vrouter with 50 routes'''
390 res = self.__vrouter_network_verify(50, peers = 1)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700391 assert_equal(res, True)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700392
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700393 def test_vrouter_5(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700394 '''Test vrouter with 50 routes and 5 peers'''
395 res = self.__vrouter_network_verify(50, peers = 5)
396 assert_equal(res, True)
397
398 def test_vrouter_6(self):
399 '''Test vrouter with 100 routes'''
400 res = self.__vrouter_network_verify(100, peers = 1)
401 assert_equal(res, True)
402
403 def test_vrouter_7(self):
404 '''Test vrouter with 100 routes and 10 peers'''
405 res = self.__vrouter_network_verify(100, peers = 10)
406 assert_equal(res, True)
407
408 def test_vrouter_8(self):
409 '''Test vrouter with 300 routes'''
410 res = self.__vrouter_network_verify(300, peers = 1)
411 assert_equal(res, True)
412
413 def test_vrouter_9(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700414 '''Test vrouter with 1000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700415 res = self.__vrouter_network_verify(1000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700416 assert_equal(res, True)
A R Karthick81acbff2016-06-17 14:45:16 -0700417
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700418 def test_vrouter_10(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700419 '''Test vrouter with 10000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700420 res = self.__vrouter_network_verify(10000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700421 assert_equal(res, True)
A R Karthick81acbff2016-06-17 14:45:16 -0700422
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700423 @nottest
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700424 def test_vrouter_11(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700425 '''Test vrouter with 100000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700426 res = self.__vrouter_network_verify(100000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700427 assert_equal(res, True)
428
429 @nottest
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700430 def test_vrouter_12(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700431 '''Test vrouter with 1000000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700432 res = self.__vrouter_network_verify(1000000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700433 assert_equal(res, True)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700434
435 def test_vrouter_13(self):
436 '''Test vrouter by installing 5 routes, removing Quagga and re-starting Quagga back'''
437 res = self.__vrouter_network_verify(5, peers = 1, positive_test = False)
438
439 def test_vrouter_14(self):
440 '''Test vrouter by installing 50 routes, removing Quagga and re-starting Quagga back'''
441 res = self.__vrouter_network_verify(50, peers = 1, positive_test = False)