blob: 6bd236732e47455047444ecac12ca244a86d5aa4 [file] [log] [blame]
adminf0713ab2014-04-29 10:43:35 -07001class ONOSSanity4 :
2 def __init__(self) :
3 self.default = ''
4
5#************************************************************************************************************************************
6 '''
7 CASE1: Initial Startup
8 This case will follow the following steps
9 1. Stop all instances of Zookeeper, RAMCloud, and ONOS
10 2. Pull and build (if necessary) the latest ONOS code from Gerrit
11 3. Start Up Zookeeper, RAMCloud, and ONOS. (We will be using the start_all function aka ./onos.sh start)
12 4. Start up Mininet (Omitted for now as the Mininet is started up when the handle is connected)
13 5. Start up Rest Server
14 6. Test startup of Zookeeper
15 7. Test startup of RAMCloud
16 8. Test startup of ONOS
17 9. Test startup of Rest Server
18 10. Test startup of Mininet
19 '''
20 def CASE1(self,main) :
21 main.case("Initial Startup")
22 main.step("\n*************************\nStop all instances of ZK, RC, and ONOS\n*******************\n")
23 main.ONOS1.stop()
24 main.ONOS2.stop()
25 main.ONOS3.stop()
26 main.ONOS4.stop()
27 main.RC1.stop_serv()
28 main.RC2.stop_serv()
29 main.RC3.stop_serv()
30 main.RC4.stop_serv()
31 main.RC1.stop_coor()
32 main.Zookeeper1.stop()
33 main.Zookeeper2.stop()
34 main.Zookeeper3.stop()
35 main.Zookeeper4.stop()
36 main.step("**************\nPull and build (if necessary) the latest ONOS code from Gerrit \n****************\n")
37 uptodate = main.ONOS1.git_pull()
38 main.ONOS2.git_pull()
39 main.ONOS3.git_pull()
40 main.ONOS4.git_pull()
41 ver1 = main.ONOS1.get_version()
42 ver2 = main.ONOS4.get_version()
43 if ver1!=ver2:
44 main.ONOS2.git_pull("ONOS1 master")
45 main.ONOS3.git_pull("ONOS1 master")
46 main.ONOS4.git_pull("ONOS1 master")
47 if uptodate==0:
48 main.ONOS1.git_compile()
49 main.ONOS2.git_compile()
50 main.ONOS3.git_compile()
51 main.ONOS4.git_compile()
52 main.ONOS1.print_version()
53 main.step("Start up ZK, RC, and ONOS")
admin1723f1c2014-05-19 16:08:39 -070054 main.Zookeeper1.start()
55 main.Zookeeper2.start()
56 main.Zookeeper3.start()
57 main.Zookeeper4.start()
58 main.RC1.del_db()
59 main.RC2.del_db()
60 main.RC3.del_db()
61 main.RC4.del_db()
adminf0713ab2014-04-29 10:43:35 -070062 main.ONOS1.start_all()
63 main.ONOS2.start_all()
64 main.ONOS3.start_all()
65 main.ONOS4.start_all()
admin1723f1c2014-05-19 16:08:39 -070066
adminf0713ab2014-04-29 10:43:35 -070067 #main.step("Start Up Mininet")
68 main.step("Start up Rest Server")
69 main.ONOS1.start_rest()
70 main.step("Test startup of Zookeeper")
71 for i in range(2):
72 zk1up = main.Zookeeper1.isup()
73 zk2up = main.Zookeeper2.isup()
74 zk3up = main.Zookeeper3.isup()
75 zk4up = main.Zookeeper4.isup()
76 zkup = zk1up and zk2up and zk3up and zk4up
77 if zkup==main.TRUE:
78 break
79 utilities.assert_equals(expect=main.TRUE,actual=zkup,onpass="Zookeeper is up!",onfail="Zookeeper is down! Exiting!")
80 if zkup==main.FALSE:
81 main.cleanup()
82 main.exit()
83 main.step("Test startup of RamCloud")
84 for i in range(2):
85 rccup = main.RC1.status_coor()
86 rcs1up = main.RC1.status_serv()
87 rcs2up = main.RC2.status_serv()
88 rcs3up = main.RC3.status_serv()
89 rcs4up = main.RC4.status_serv()
90 rcup = rccup and rcs1up and rcs2up and rcs3up and rcs4up
91 if rcup==main.TRUE:
92 break
93 utilities.assert_equals(expect=main.TRUE,actual=rcup,onpass="RAMCloud is up!",onfail="RAMCloud is down! Exiting!")
94 if rcup == main.FALSE:
95 main.cleanup()
96 main.exit()
97
98 main.step("Test startup of ONOS")
99 for i in range(2):
100 ONOS1up = main.ONOS1.isup()
101 ONOS2up = main.ONOS2.isup()
102 ONOS3up = main.ONOS3.isup()
103 ONOS4up = main.ONOS4.isup()
104 ONOSup = ONOS1up and ONOS2up and ONOS3up and ONOS4up
105 if ONOSup==main.TRUE:
106 break
107 utilities.assert_equals(expect=main.TRUE,actual=ONOSup,onpass="ONOS is up!",onfail="ONOS is down! Exiting!")
108 if ONOSup==main.FALSE:
109 main.cleanup()
110 main.exit()
111
112 main.step("Test startup of Rest Server")
113 for i in range(2):
114 restStatus = main.ONOS1.rest_status()
115 if restStatus==main.TRUE:
116 break
117 utilities.assert_equals(expect=main.TRUE,actual=restStatus,onpass="Rest Server is up!",onfail="Rest Server is Down! Exiting!")
118 if restStatus==main.FALSE:
119 main.cleanup()
120 main.exit()
121
adminaef00552014-05-08 09:18:36 -0700122 main.step("Test startup of Mininet")
123 main.log.report("Host IP Checking using checkIP")
124 result1 = main.Mininet1.checkIP(main.params['CASE1']['destination'])
125 result2 = main.Mininet1.checkIP(main.params['CASE1']['target'])
126 result = result1 and result2
127 utilities.assert_equals(expect=main.TRUE,actual=result, onpass="Host IP addresses configured",onfail="Host IP addresses not configured")
128 if result==main.FALSE:
129 main.cleanup()
130 main.exit()
131
adminf0713ab2014-04-29 10:43:35 -0700132
133
134
135#************************************************************************************************************************************
136
137
138#************************************************************************************************************************************
139 '''
140 CASE2: Assign Controllers
141 This case will follow the following steps
142 1. Assign a Master Controller to each switch
143 2. Verify Master Controller
144 3. Assign all controllers to all switches
145 4. Verify all controllers
146 '''
adminaef00552014-05-08 09:18:36 -0700147 main.case("Assign Controllers")
148 main.step("Assign a master controller to each switch")
149 for i in range(25):
150 if i<3:
151 main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
admin1723f1c2014-05-19 16:08:39 -0700152 elif i<5:
153 main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
154 elif i<16:
155 main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
156 else:
157 main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
adminaef00552014-05-08 09:18:36 -0700158 main.step("Verify Master controllers of each switch")
admin1723f1c2014-05-19 16:08:39 -0700159 for i in range(25):
160 if i<3:
161
adminf0713ab2014-04-29 10:43:35 -0700162#************************************************************************************************************************************
163
164
165#************************************************************************************************************************************
166 '''
167 CASE3: Device Discovery Test
168 This case will follow the following steps
169 1. Ping to generate arp packets to switch
170 2. Find number of hosts with target IP (Try twice if not 1. Then will fail)
171 3. Yank the switch
172 4. Ping to generate arp packets to switch
173 5. Find number of hosts with target IP (Try twice if not 0. Then will fail)
174 6. Plug the switch
175 7. Ping to generate arp packets to switch
176 8. Find number of hosts with target IP (Try twice if not 1. Then will fail)
177
178
179 '''
180#************************************************************************************************************************************