blob: ab7a12fd5c127b706a660822c02a349c339c866d [file] [log] [blame]
Chetan Gaonker3533faa2016-04-25 17:50:14 -07001import unittest
2from nose.tools import *
3from scapy.all import *
4from OnosCtrl import OnosCtrl
5from OltConfig import OltConfig
6from OnosFlowCtrl import OnosFlowCtrl, get_mac
7from onosclidriver import OnosCliDriver
Chetan Gaonker6cf6e472016-04-26 14:41:51 -07008from CordContainer import Container, Onos, Quagga
9from CordTestServer import cord_test_onos_restart, cord_test_quagga_restart
Chetan Gaonker3533faa2016-04-25 17:50:14 -070010from portmaps import g_subscriber_port_map
11import threading
12import time
13import os
14import json
15log.setLevel('INFO')
16
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -070017class QuaggaStopWrapper(Container):
18
19 def __init__(self, name = 'cord-quagga', image = 'cord-test/quagga', tag = 'latest'):
20 super(QuaggaStopWrapper, self).__init__(name, image, tag = tag)
21 if self.exists():
22 self.kill()
23
Chetan Gaonker3533faa2016-04-25 17:50:14 -070024class vrouter_exchange(unittest.TestCase):
25
26 apps = ('org.onosproject.vrouter', 'org.onosproject.fwd')
27 device_id = 'of:' + get_mac('ovsbr0')
28 vrouter_device_dict = { "devices" : {
29 "{}".format(device_id) : {
30 "basic" : {
31 "driver" : "softrouter"
32 }
33 }
34 },
35 }
36 zebra_conf = '''
37password zebra
38log stdout
39service advanced-vty
40!
Chetan Gaonkerfd3d6502016-05-03 13:23:07 -070041!debug zebra rib
42!debug zebra kernel
43!debug zebra fpm
Chetan Gaonker3533faa2016-04-25 17:50:14 -070044!
45!interface eth1
46! ip address 10.10.0.3/16
47line vty
48 exec-timeout 0 0
49'''
50 test_path = os.path.dirname(os.path.realpath(__file__))
51 quagga_config_path = os.path.join(test_path, '..', 'setup/quagga-config')
52 onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -070053 GATEWAY = '192.168.10.50'
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070054 INGRESS_PORT = 1
55 EGRESS_PORT = 2
Chetan Gaonker3533faa2016-04-25 17:50:14 -070056 MAX_PORTS = 100
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -070057 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 -070058 network_list = []
Chetan Gaonker3533faa2016-04-25 17:50:14 -070059
60 @classmethod
61 def setUpClass(cls):
62 ''' Activate the vrouter apps'''
63 cls.olt = OltConfig()
64 cls.port_map = cls.olt.olt_port_map()
65 if not cls.port_map:
66 cls.port_map = g_subscriber_port_map
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070067 #cls.vrouter_host_load(host = cls.GATEWAY)
Chetan Gaonker3533faa2016-04-25 17:50:14 -070068 time.sleep(3)
69
70 @classmethod
71 def tearDownClass(cls):
72 '''Deactivate the vrouter apps'''
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070073 #cls.vrouter_host_unload()
Chetan Gaonker3533faa2016-04-25 17:50:14 -070074
75 def cliEnter(self):
76 retries = 0
77 while retries < 3:
78 self.cli = OnosCliDriver(connect = True)
79 if self.cli.handle:
80 break
81 else:
82 retries += 1
83 time.sleep(2)
84
85 def cliExit(self):
86 self.cli.disconnect()
87
88 @classmethod
89 def onos_load_config(cls, config):
90 status, code = OnosCtrl.config(config)
91 if status is False:
92 log.info('JSON request returned status %d' %code)
93 assert_equal(status, True)
94
95 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -070096 def vrouter_config_get(cls, networks = 4, peers = 1):
97 vrouter_configs = cls.generate_vrouter_conf(networks = networks, peers = peers)
Chetan Gaonker3533faa2016-04-25 17:50:14 -070098 return vrouter_configs
99 ##ONOS router does not support dynamic reconfigurations
100 #for config in vrouter_configs:
101 # cls.onos_load_config(config)
102 # time.sleep(5)
103
104 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700105 def vrouter_host_load(cls):
106 index = 1
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700107 for host,_ in cls.peer_list:
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700108 iface = cls.port_map[index]
109 index += 1
110 config_cmds = ( 'ifconfig {0} {1}'.format(iface, host),
111 'arping -I {0} {1} -c 2'.format(iface, host),
112 )
113 for cmd in config_cmds:
114 os.system(cmd)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700115
116 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700117 def vrouter_host_unload(cls):
118 index = 1
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700119 for host,_ in cls.peer_list:
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700120 iface = cls.port_map[index]
121 index += 1
122 config_cmds = ('ifconfig {} 0'.format(iface), )
123 for cmd in config_cmds:
124 os.system(cmd)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700125
126 @classmethod
127 def start_onos(cls, network_cfg = None):
128 if type(network_cfg) is tuple:
129 res = []
130 for v in network_cfg:
131 res += v.items()
132 config = dict(res)
133 else:
134 config = network_cfg
135 log.info('Restarting ONOS with new network configuration')
136 cfg = json.dumps(config)
137 with open('{}/network-cfg.json'.format(cls.onos_config_path), 'w') as f:
138 f.write(cfg)
139
140 return cord_test_onos_restart()
141
142 @classmethod
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700143 def start_quagga(cls, networks = 4):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700144 log.info('Restarting Quagga container with configuration for %d networks' %(networks))
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700145 config = cls.generate_conf(networks = networks)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700146 host_config_file = '{}/testrib_gen.conf'.format(Quagga.host_quagga_config)
147 guest_config_file = os.path.join(Quagga.guest_quagga_config, 'testrib_gen.conf')
148 with open(host_config_file, 'w') as f:
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700149 f.write(config)
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]
Chetan Gaonkerfd3d6502016-05-03 13:23:07 -0700156 cord_test_quagga_restart(config_file = guest_config_file, 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']
175
176 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
190 quagga_router_dict['controlPlaneConnectPoint'] = '{0}/{1}'.format(cls.device_id,
191 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
264
265 @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
284
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
331
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')
357 quaggaStop = QuaggaStopWrapper()
358 time.sleep(2)
Chetan Gaonker68d95172016-05-03 11:16:59 -0700359 if networks <= 10000:
360 routes = json.loads(self.cli.routes(jsonFormat = True))
361 #Verify routes have been removed
362 if routes and routes.has_key('routes4'):
363 assert_equal(len(routes['routes4']), 0)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700364 self.vrouter_traffic_verify(positive_test = False)
365 log.info('OVS flows have been removed successfully after Quagga was stopped')
366 self.start_quagga(networks = networks)
367 ##Verify the flows again after restarting quagga back
Chetan Gaonker68d95172016-05-03 11:16:59 -0700368 if networks <= 10000:
369 routes = json.loads(self.cli.routes(jsonFormat = True))
370 assert_equal(len(routes['routes4']), networks)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700371 self.vrouter_traffic_verify()
372 log.info('OVS flows have been successfully reinstalled after Quagga was restarted')
373
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700374 def test_vrouter_1(self):
375 '''Test vrouter with 5 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700376 res = self.__vrouter_network_verify(5, peers = 1)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700377 assert_equal(res, True)
378
379 def test_vrouter_2(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700380 '''Test vrouter with 5 routes with 2 peers'''
381 res = self.__vrouter_network_verify(5, peers = 2)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700382 assert_equal(res, True)
383
384 def test_vrouter_3(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700385 '''Test vrouter with 6 routes with 3 peers'''
386 res = self.__vrouter_network_verify(6, peers = 3)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700387 assert_equal(res, True)
388
389 def test_vrouter_4(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700390 '''Test vrouter with 50 routes'''
391 res = self.__vrouter_network_verify(50, peers = 1)
Chetan Gaonker3533faa2016-04-25 17:50:14 -0700392 assert_equal(res, True)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700393
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700394 def test_vrouter_5(self):
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700395 '''Test vrouter with 50 routes and 5 peers'''
396 res = self.__vrouter_network_verify(50, peers = 5)
397 assert_equal(res, True)
398
399 def test_vrouter_6(self):
400 '''Test vrouter with 100 routes'''
401 res = self.__vrouter_network_verify(100, peers = 1)
402 assert_equal(res, True)
403
404 def test_vrouter_7(self):
405 '''Test vrouter with 100 routes and 10 peers'''
406 res = self.__vrouter_network_verify(100, peers = 10)
407 assert_equal(res, True)
408
409 def test_vrouter_8(self):
410 '''Test vrouter with 300 routes'''
411 res = self.__vrouter_network_verify(300, peers = 1)
412 assert_equal(res, True)
413
414 def test_vrouter_9(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700415 '''Test vrouter with 1000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700416 res = self.__vrouter_network_verify(1000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700417 assert_equal(res, True)
418
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700419 def test_vrouter_10(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700420 '''Test vrouter with 10000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700421 res = self.__vrouter_network_verify(10000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700422 assert_equal(res, True)
Chetan Gaonkerfe551a22016-04-29 17:34:57 -0700423
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700424 @nottest
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700425 def test_vrouter_11(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700426 '''Test vrouter with 100000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700427 res = self.__vrouter_network_verify(100000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700428 assert_equal(res, True)
429
430 @nottest
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700431 def test_vrouter_12(self):
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700432 '''Test vrouter with 1000000 routes'''
Chetan Gaonker8e25e1b2016-05-02 13:42:21 -0700433 res = self.__vrouter_network_verify(1000000, peers = 1)
Chetan Gaonker6cf6e472016-04-26 14:41:51 -0700434 assert_equal(res, True)
Chetan Gaonkerb6064fa2016-05-02 16:29:57 -0700435
436 def test_vrouter_13(self):
437 '''Test vrouter by installing 5 routes, removing Quagga and re-starting Quagga back'''
438 res = self.__vrouter_network_verify(5, peers = 1, positive_test = False)
439
440 def test_vrouter_14(self):
441 '''Test vrouter by installing 50 routes, removing Quagga and re-starting Quagga back'''
442 res = self.__vrouter_network_verify(50, peers = 1, positive_test = False)