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