blob: 414e15ae0d646790da8cadd0975e2db45158be50 [file] [log] [blame]
timlindbergef8d55d2013-09-27 12:50:13 -07001class SDNIPRouteTest :
2
3 def __init__(self) :
4 self.default = ''
5
6 def CASE1(self):
7
8 result = main.Quagga1.enter_config(1)
9 result = result and main.Quagga2.enter_config(2)
10 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Entered config mode successfully",onfail="Failed to enter config mode")
11
12 result = main.Dataplane1.create_interfaces(main.params['Q1']['net'],main.params['numRoutes'],main.params['Q1']['startNet'])
13 result = result and main.Dataplane2.create_interfaces(main.params['Q2']['net'],main.params['numRoutes'],main.params['Q2']['startNet'])
14 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Interfaces created successfully",onfail="Failed to create interfaces")
15 def CASE2(self):
16 import time
17
18 main.log.info('Adding routes into Quagga1 and Quagga2')
19 result = main.Quagga1.add_route(str(main.params['Q1']['net']),int(main.params['numRoutes']),int(main.params['Q1']['routeRate']))
20 result = result and main.Quagga2.add_route(str(main.params['Q2']['net']),int(main.params['numRoutes']),int(main.params['Q2']['routeRate']))
21 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Added routes successfully",onfail="Failed to add routes")
22
23 main.log.info('Routes added, now waiting 30 seconds')
24 time.sleep(30)
25
26 main.log.info('Dataplane1 pinging all interfaces on Dataplane1')
27 result = main.Dataplane1.pingall_interfaces(main.params['DP1']['pingIntf'],main.params['Q2']['net'],main.params['Q2']['startNet'],main.params['numRoutes'])
28 main.log.info('Dataplane2 pinging all interfaces on Dataplane2')
29 result = result and main.Dataplane2.pingall_interfaces(main.params['DP2']['pingIntf'],main.params['Q1']['net'],main.params['Q1']['startNet'],main.params['numRoutes'])
30 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Switches properly direct traffic",onfail="Network unable to ping")
31
32 def CASE3(self):
33 import time
34
35 main.log.info('Removing routes on Quagga1 and Quagga2')
36 result = main.Quagga1.del_route(str(main.params['Q1']['net']),int(main.params['numRoutes']),int(main.params['Q1']['routeRate']))
37 result = result and main.Quagga2.del_route(str(main.params['Q2']['net']),int(main.params['numRoutes']),int(main.params['Q2']['routeRate']))
38 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Removed routes successfully",onfail="Failed to remove routes")
39
40 main.log.info('Routes removed, now waiting 30 seconds')
41 time.sleep(30)
42
43 main.log.info('Dataplane1 pinging all interfaces on Dataplane1')
44 result = main.Dataplane1.pingall_interfaces(main.params['DP1']['pingIntf'],main.params['Q2']['net'],main.params['Q2']['startNet'],main.params['numRoutes'])
45 main.log.info('Dataplane2 pinging all interfaces on Dataplane2')
46 result = result and main.Dataplane2.pingall_interfaces(main.params['DP2']['pingIntf'],main.params['Q1']['net'],main.params['Q1']['startNet'],main.params['numRoutes'])
47 utilities.assert_equals(expect=main.FALSE,actual=result,onpass="Flows removed properly",onfail="Flows still present")
48
49 '''
50 num_routes = int(main.params['Q1']['numRoutes'])
51 a = str(Q2check)
52 main.log.info("The number of routes checked are" + a)
53 #print Q2check
54 #if Q1check == num_routes:
55 # main.log.info("all routes added from Quagga1 successfully")
56 #else:
57 # main.log.info("failed to add routes from Quagga1 fully")
58 if Q2check == num_routes:
59 print "all routes added from Quagga2 successfully"
60 else:
61 print "failed to add routes from Quagga2 fully"
62 #delresult = main.Quagga1.del_route(str(main.params['Q1']['net']),int(main.params['Q1']['numRoutes']),int(main.params['Q1']['routeRate']))
63 delresult = main.Quagga2.del_route(str(main.params['Q2']['net']),int(main.params['Q2']['numRoutes']),int(main.params['Q2']['routeRate']))
64 utilities.assert_equals(expect=main.TRUE,actual=delresult,onpass="Deleted routes successfully",onfaile="Failed to delete routes")
65 '''