admin | f0713ab | 2014-04-29 10:43:35 -0700 | [diff] [blame] | 1 | class 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") |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 54 | main.Zookeeper1.start() |
| 55 | main.Zookeeper2.start() |
| 56 | main.Zookeeper3.start() |
| 57 | main.Zookeeper4.start() |
Jon Hall | 5a8aac6 | 2014-06-03 09:30:21 -0700 | [diff] [blame] | 58 | time.sleep(3) |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 59 | main.RC1.del_db() |
| 60 | main.RC2.del_db() |
| 61 | main.RC3.del_db() |
| 62 | main.RC4.del_db() |
Jon Hall | 5a8aac6 | 2014-06-03 09:30:21 -0700 | [diff] [blame] | 63 | time.sleep(5) |
admin | f0713ab | 2014-04-29 10:43:35 -0700 | [diff] [blame] | 64 | main.ONOS1.start_all() |
| 65 | main.ONOS2.start_all() |
| 66 | main.ONOS3.start_all() |
| 67 | main.ONOS4.start_all() |
| 68 | #main.step("Start Up Mininet") |
| 69 | main.step("Start up Rest Server") |
| 70 | main.ONOS1.start_rest() |
| 71 | main.step("Test startup of Zookeeper") |
| 72 | for i in range(2): |
| 73 | zk1up = main.Zookeeper1.isup() |
| 74 | zk2up = main.Zookeeper2.isup() |
| 75 | zk3up = main.Zookeeper3.isup() |
| 76 | zk4up = main.Zookeeper4.isup() |
| 77 | zkup = zk1up and zk2up and zk3up and zk4up |
| 78 | if zkup==main.TRUE: |
| 79 | break |
| 80 | utilities.assert_equals(expect=main.TRUE,actual=zkup,onpass="Zookeeper is up!",onfail="Zookeeper is down! Exiting!") |
| 81 | if zkup==main.FALSE: |
| 82 | main.cleanup() |
| 83 | main.exit() |
| 84 | main.step("Test startup of RamCloud") |
| 85 | for i in range(2): |
| 86 | rccup = main.RC1.status_coor() |
| 87 | rcs1up = main.RC1.status_serv() |
| 88 | rcs2up = main.RC2.status_serv() |
| 89 | rcs3up = main.RC3.status_serv() |
| 90 | rcs4up = main.RC4.status_serv() |
| 91 | rcup = rccup and rcs1up and rcs2up and rcs3up and rcs4up |
| 92 | if rcup==main.TRUE: |
| 93 | break |
| 94 | utilities.assert_equals(expect=main.TRUE,actual=rcup,onpass="RAMCloud is up!",onfail="RAMCloud is down! Exiting!") |
| 95 | if rcup == main.FALSE: |
| 96 | main.cleanup() |
| 97 | main.exit() |
| 98 | |
| 99 | main.step("Test startup of ONOS") |
| 100 | for i in range(2): |
| 101 | ONOS1up = main.ONOS1.isup() |
| 102 | ONOS2up = main.ONOS2.isup() |
| 103 | ONOS3up = main.ONOS3.isup() |
| 104 | ONOS4up = main.ONOS4.isup() |
| 105 | ONOSup = ONOS1up and ONOS2up and ONOS3up and ONOS4up |
| 106 | if ONOSup==main.TRUE: |
| 107 | break |
| 108 | utilities.assert_equals(expect=main.TRUE,actual=ONOSup,onpass="ONOS is up!",onfail="ONOS is down! Exiting!") |
| 109 | if ONOSup==main.FALSE: |
| 110 | main.cleanup() |
| 111 | main.exit() |
| 112 | |
| 113 | main.step("Test startup of Rest Server") |
| 114 | for i in range(2): |
| 115 | restStatus = main.ONOS1.rest_status() |
| 116 | if restStatus==main.TRUE: |
| 117 | break |
| 118 | utilities.assert_equals(expect=main.TRUE,actual=restStatus,onpass="Rest Server is up!",onfail="Rest Server is Down! Exiting!") |
| 119 | if restStatus==main.FALSE: |
| 120 | main.cleanup() |
| 121 | main.exit() |
| 122 | |
admin | aef0055 | 2014-05-08 09:18:36 -0700 | [diff] [blame] | 123 | main.step("Test startup of Mininet") |
| 124 | main.log.report("Host IP Checking using checkIP") |
| 125 | result1 = main.Mininet1.checkIP(main.params['CASE1']['destination']) |
| 126 | result2 = main.Mininet1.checkIP(main.params['CASE1']['target']) |
| 127 | result = result1 and result2 |
| 128 | utilities.assert_equals(expect=main.TRUE,actual=result, onpass="Host IP addresses configured",onfail="Host IP addresses not configured") |
| 129 | if result==main.FALSE: |
| 130 | main.cleanup() |
| 131 | main.exit() |
| 132 | |
admin | f0713ab | 2014-04-29 10:43:35 -0700 | [diff] [blame] | 133 | |
| 134 | |
| 135 | |
| 136 | #************************************************************************************************************************************ |
| 137 | |
| 138 | |
| 139 | #************************************************************************************************************************************ |
| 140 | ''' |
| 141 | CASE2: Assign Controllers |
| 142 | This case will follow the following steps |
| 143 | 1. Assign a Master Controller to each switch |
| 144 | 2. Verify Master Controller |
| 145 | 3. Assign all controllers to all switches |
| 146 | 4. Verify all controllers |
| 147 | ''' |
admin | aef0055 | 2014-05-08 09:18:36 -0700 | [diff] [blame] | 148 | main.case("Assign Controllers") |
| 149 | main.step("Assign a master controller to each switch") |
| 150 | for i in range(25): |
| 151 | if i<3: |
| 152 | main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1']) |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 153 | elif i<5: |
| 154 | main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2']) |
| 155 | elif i<16: |
| 156 | main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3']) |
| 157 | else: |
| 158 | main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4']) |
admin | aef0055 | 2014-05-08 09:18:36 -0700 | [diff] [blame] | 159 | main.step("Verify Master controllers of each switch") |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 160 | for i in range(25): |
| 161 | if i<3: |
| 162 | |
admin | f0713ab | 2014-04-29 10:43:35 -0700 | [diff] [blame] | 163 | #************************************************************************************************************************************ |
| 164 | |
| 165 | |
| 166 | #************************************************************************************************************************************ |
| 167 | ''' |
| 168 | CASE3: Device Discovery Test |
| 169 | This case will follow the following steps |
| 170 | 1. Ping to generate arp packets to switch |
| 171 | 2. Find number of hosts with target IP (Try twice if not 1. Then will fail) |
| 172 | 3. Yank the switch |
| 173 | 4. Ping to generate arp packets to switch |
| 174 | 5. Find number of hosts with target IP (Try twice if not 0. Then will fail) |
| 175 | 6. Plug the switch |
| 176 | 7. Ping to generate arp packets to switch |
| 177 | 8. Find number of hosts with target IP (Try twice if not 1. Then will fail) |
| 178 | |
| 179 | |
| 180 | ''' |
| 181 | #************************************************************************************************************************************ |