Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1 | import time |
| 2 | import sys |
| 3 | import os |
| 4 | import re |
| 5 | import time |
| 6 | import json |
| 7 | import itertools |
| 8 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 9 | |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 10 | class OnosCHO: |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 11 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 12 | def __init__( self ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 13 | self.default = '' |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 14 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 15 | def CASE1( self, main ): |
| 16 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 17 | Startup sequence: |
| 18 | git pull |
| 19 | mvn clean install |
| 20 | onos-package |
| 21 | cell <name> |
| 22 | onos-verify-cell |
| 23 | onos-install -f |
| 24 | onos-wait-for-start |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 25 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 26 | import time |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 27 | |
| 28 | main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ] |
| 29 | main.ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 30 | main.ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 31 | main.ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 32 | main.ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ] |
| 33 | main.ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ] |
| 34 | main.ONOS1_port = main.params[ 'CTRL' ][ 'port1' ] |
| 35 | main.ONOS2_port = main.params[ 'CTRL' ][ 'port2' ] |
| 36 | main.ONOS3_port = main.params[ 'CTRL' ][ 'port3' ] |
| 37 | main.ONOS4_port = main.params[ 'CTRL' ][ 'port4' ] |
| 38 | main.ONOS5_port = main.params[ 'CTRL' ][ 'port5' ] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 39 | cell_name = main.params[ 'ENV' ][ 'cellName' ] |
| 40 | git_pull = main.params[ 'GIT' ][ 'autoPull' ] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 41 | git_branch = main.params[ 'GIT' ][ 'branch' ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 42 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 43 | main.case( "Set up test environment" ) |
| 44 | main.log.report( "Set up test environment" ) |
| 45 | main.log.report( "_______________________" ) |
| 46 | |
| 47 | main.step( "Git checkout and pull " + git_branch ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 48 | if git_pull == 'on': |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 49 | checkout_result = main.ONOSbench.gitCheckout( git_branch ) |
| 50 | pull_result = main.ONOSbench.gitPull() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 51 | cp_result = ( checkout_result and pull_result ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 52 | else: |
| 53 | checkout_result = main.TRUE |
| 54 | pull_result = main.TRUE |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 55 | main.log.info( "Skipped git checkout and pull" ) |
| 56 | cp_result = ( checkout_result and pull_result ) |
| 57 | utilities.assert_equals( expect=main.TRUE, actual=cp_result, |
| 58 | onpass="Test step PASS", |
| 59 | onfail="Test step FAIL" ) |
| 60 | |
| 61 | main.step( "mvn clean & install" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 62 | if git_pull == 'on': |
| 63 | mvn_result = main.ONOSbench.cleanInstall() |
| 64 | utilities.assert_equals( expect=main.TRUE, actual=mvn_result, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 65 | onpass="Test step PASS", |
| 66 | onfail="Test step FAIL" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 67 | else: |
| 68 | mvn_result = main.TRUE |
| 69 | main.log.info("Skipped mvn clean install as git pull is disabled in params file") |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 70 | |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 71 | main.ONOSbench.getVersion( report=True ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 72 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 73 | main.step( "Apply Cell environment for ONOS" ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 74 | cell_result = main.ONOSbench.setCell( cell_name ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 75 | utilities.assert_equals( expect=main.TRUE, actual=cell_result, |
| 76 | onpass="Test step PASS", |
| 77 | onfail="Test step FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 78 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 79 | main.step( "Create ONOS package" ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 80 | packageResult = main.ONOSbench.onosPackage() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 81 | utilities.assert_equals( expect=main.TRUE, actual=packageResult, |
| 82 | onpass="Test step PASS", |
| 83 | onfail="Test step FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 84 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 85 | main.step( "Uninstall ONOS package on all Nodes" ) |
| 86 | uninstallResult = main.TRUE |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 87 | for i in range( 1, int( main.numCtrls ) + 1 ): |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 88 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 89 | main.log.info( "Unintsalling package on ONOS Node IP: " + ONOS_ip ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 90 | u_result = main.ONOSbench.onosUninstall( ONOS_ip ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 91 | utilities.assert_equals( expect=main.TRUE, actual=u_result, |
| 92 | onpass="Test step PASS", |
| 93 | onfail="Test step FAIL" ) |
| 94 | uninstallResult = ( uninstallResult and u_result ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 95 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 96 | main.step( "Removing copy-cat logs from ONOS nodes" ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 97 | main.ONOSbench.onosRemoveRaftLogs() |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 98 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 99 | main.step( "Install ONOS package on all Nodes" ) |
| 100 | installResult = main.TRUE |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 101 | for i in range( 1, int( main.numCtrls ) + 1 ): |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 102 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 103 | main.log.info( "Intsalling package on ONOS Node IP: " + ONOS_ip ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 104 | i_result = main.ONOSbench.onosInstall( node=ONOS_ip ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 105 | utilities.assert_equals( expect=main.TRUE, actual=i_result, |
| 106 | onpass="Test step PASS", |
| 107 | onfail="Test step FAIL" ) |
| 108 | installResult = ( installResult and i_result ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 109 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 110 | main.step( "Verify ONOS nodes UP status" ) |
| 111 | statusResult = main.TRUE |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 112 | for i in range( 1, int( main.numCtrls ) + 1 ): |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 113 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 114 | main.log.info( "ONOS Node " + ONOS_ip + " status:" ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 115 | onos_status = main.ONOSbench.onosStatus( node=ONOS_ip ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 116 | utilities.assert_equals( expect=main.TRUE, actual=onos_status, |
| 117 | onpass="Test step PASS", |
| 118 | onfail="Test step FAIL" ) |
| 119 | statusResult = ( statusResult and onos_status ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 120 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 121 | main.step( "Start ONOS CLI on all nodes" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 122 | cliResult = main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 123 | karafTimeout = "3600000" |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 124 | # need to wait here for sometime. This will be removed once ONOS is |
| 125 | # stable enough |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 126 | time.sleep( 20 ) |
| 127 | for i in range( 1, int( main.numCtrls ) + 1 ): |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 128 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 129 | ONOScli = 'ONOScli' + str( i ) |
| 130 | main.log.info( "ONOS Node " + ONOS_ip + " cli start:" ) |
| 131 | exec "startcli=main." + ONOScli + \ |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 132 | ".startOnosCli(ONOS_ip, karafTimeout=karafTimeout)" |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 133 | utilities.assert_equals( expect=main.TRUE, actual=startcli, |
| 134 | onpass="Test step PASS", |
| 135 | onfail="Test step FAIL" ) |
| 136 | cliResult = ( cliResult and startcli ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 137 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 138 | case1Result = ( cp_result and cell_result |
| 139 | and packageResult and installResult and statusResult and cliResult ) |
| 140 | utilities.assert_equals( expect=main.TRUE, actual=case1Result, |
| 141 | onpass="Set up test environment PASS", |
| 142 | onfail="Set up test environment FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 143 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 144 | def CASE2( self, main ): |
| 145 | """ |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 146 | This test loads a Topology (ATT) on Mininet and balances all switches. |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 147 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 148 | import re |
| 149 | import time |
| 150 | import copy |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 151 | main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] ) |
| 152 | main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] ) |
| 153 | main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 154 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 155 | main.log.report( |
| 156 | "Assign and Balance all Mininet switches across controllers" ) |
| 157 | main.log.report( |
| 158 | "_________________________________________________________" ) |
| 159 | # need to wait here for sometime. This will be removed once ONOS is |
| 160 | # stable enough |
| 161 | time.sleep( 15 ) |
| 162 | main.case( |
| 163 | "Assign and Balance all Mininet switches across controllers" ) |
| 164 | main.step( "Assign switches to controllers" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 165 | netStatus = main.Mininet1.startNet() |
| 166 | for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 167 | main.Mininet1.assignSwController( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 168 | sw=str( i ), |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 169 | count=int( main.numCtrls ), |
| 170 | ip1=main.ONOS1_ip, |
| 171 | port1=main.ONOS1_port, |
| 172 | ip2=main.ONOS2_ip, |
| 173 | port2=main.ONOS2_port, |
| 174 | ip3=main.ONOS3_ip, |
| 175 | port3=main.ONOS3_port, |
| 176 | ip4=main.ONOS4_ip, |
| 177 | port4=main.ONOS4_port, |
| 178 | ip5=main.ONOS5_ip, |
| 179 | port5=main.ONOS5_port ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 180 | |
| 181 | switch_mastership = main.TRUE |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 182 | for i in range( 1, ( main.numMNswitches + 1 ) ): |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 183 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 184 | print( "Response is " + str( response ) ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 185 | if re.search( "tcp:" + main.ONOS1_ip, response ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 186 | switch_mastership = switch_mastership and main.TRUE |
| 187 | else: |
| 188 | switch_mastership = main.FALSE |
| 189 | |
| 190 | if switch_mastership == main.TRUE: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 191 | main.log.report( "Controller assignment successfull" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 192 | else: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 193 | main.log.report( "Controller assignment failed" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 194 | time.sleep( 15 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 195 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 196 | #main.step( "Balance devices across controllers" ) |
| 197 | #for i in range( int( main.numCtrls ) ): |
| 198 | # balanceResult = main.ONOScli1.balanceMasters() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 199 | # giving some breathing time for ONOS to complete re-balance |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 200 | # time.sleep( 3 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 201 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 202 | #utilities.assert_equals( |
| 203 | # expect=main.TRUE, |
| 204 | # actual=balanceResult, |
| 205 | # onpass="Assign and Balance devices test PASS", |
| 206 | #onfail="Assign and Balance devices test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 207 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 208 | def CASE3( self, main ): |
| 209 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 210 | This Test case will be extended to collect and store more data related |
| 211 | ONOS state. |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 212 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 213 | import re |
| 214 | import copy |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 215 | main.deviceDPIDs = [] |
| 216 | main.hostMACs = [] |
| 217 | main.deviceLinks = [] |
| 218 | main.deviceActiveLinksCount = [] |
| 219 | main.devicePortsEnabledCount = [] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 220 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 221 | main.log.report( |
| 222 | "Collect and Store topology details from ONOS before running any Tests" ) |
| 223 | main.log.report( |
| 224 | "____________________________________________________________________" ) |
| 225 | main.case( "Collect and Store Topology Deatils from ONOS" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 226 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 227 | main.step( "Collect and store current number of switches and links" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 228 | topology_output = main.ONOScli1.topology() |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 229 | topology_result = main.ONOSbench.getTopology( topology_output ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 230 | numOnosDevices = topology_result[ 'devices' ] |
| 231 | numOnosLinks = topology_result[ 'links' ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 232 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 233 | if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ): |
| 234 | main.step( "Store Device DPIDs" ) |
| 235 | for i in range( 1, (main.numMNswitches+1) ): |
| 236 | main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) ) |
| 237 | print "Device DPIDs in Store: \n", str( main.deviceDPIDs ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 238 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 239 | main.step( "Store Host MACs" ) |
| 240 | for i in range( 1, ( main.numMNhosts + 1 ) ): |
| 241 | main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" ) |
| 242 | print "Host MACs in Store: \n", str( main.hostMACs ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 243 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 244 | main.step( "Collect and store all Devices Links" ) |
| 245 | linksResult = main.ONOScli1.links( jsonFormat=False ) |
| 246 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 247 | linksResult = ansi_escape.sub( '', linksResult ) |
| 248 | linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" ) |
| 249 | linksResult = linksResult.splitlines() |
| 250 | linksResult = linksResult[ 1: ] |
| 251 | main.deviceLinks = copy.copy( linksResult ) |
| 252 | print "Device Links Stored: \n", str( main.deviceLinks ) |
| 253 | # this will be asserted to check with the params provided count of |
| 254 | # links |
| 255 | print "Length of Links Store", len( main.deviceLinks ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 256 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 257 | main.step( "Collect and store each Device ports enabled Count" ) |
| 258 | for i in range( 1, ( main.numMNswitches + 1) ): |
| 259 | portResult = main.ONOScli1.getDevicePortsEnabledCount( |
| 260 | "of:00000000000000" + format( i,'02x' ) ) |
| 261 | portTemp = re.split( r'\t+', portResult ) |
| 262 | portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 263 | main.devicePortsEnabledCount.append( portCount ) |
| 264 | print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 265 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 266 | main.step( "Collect and store each Device active links Count" ) |
| 267 | for i in range( 1, ( main.numMNswitches + 1) ): |
| 268 | linkCountResult = main.ONOScli1.getDeviceLinksActiveCount( |
| 269 | "of:00000000000000" + format( i,'02x' ) ) |
| 270 | linkCountTemp = re.split( r'\t+', linkCountResult ) |
| 271 | linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 272 | main.deviceActiveLinksCount.append( linkCount ) |
| 273 | print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount ) |
| 274 | |
| 275 | else: |
| 276 | main.log.info("Devices (expected): %s, Links (expected): %s" % |
| 277 | ( str( main.numMNswitches ), str( main.numMNlinks ) ) ) |
| 278 | main.log.info("Devices (actual): %s, Links (actual): %s" % |
| 279 | ( numOnosDevices , numOnosLinks ) ) |
| 280 | main.log.info("Topology does not match, exiting CHO test...") |
| 281 | time.sleep(300) |
| 282 | #main.cleanup() |
| 283 | #main.exit() |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 284 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 285 | # just returning TRUE for now as this one just collects data |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 286 | case3Result = main.TRUE |
| 287 | utilities.assert_equals( expect=main.TRUE, actual=case3Result, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 288 | onpass="Saving ONOS topology data test PASS", |
| 289 | onfail="Saving ONOS topology data test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 290 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 291 | def CASE4( self, main ): |
| 292 | """ |
| 293 | Enable onos-app-fwd, Verify Reactive forwarding through ping all and Disable it |
| 294 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 295 | import re |
| 296 | import copy |
| 297 | import time |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 298 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 299 | main.log.report( "Enable Reactive forwarding and Verify ping all" ) |
| 300 | main.log.report( "______________________________________________" ) |
| 301 | main.case( "Enable Reactive forwarding and Verify ping all" ) |
| 302 | main.step( "Enable Reactive forwarding" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 303 | installResult = main.TRUE |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 304 | for i in range( 1, int( main.numCtrls ) + 1 ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 305 | onosFeature = 'onos-app-fwd' |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 306 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 307 | ONOScli = 'ONOScli' + str( i ) |
| 308 | main.log.info( "Enabling Reactive mode on ONOS Node " + ONOS_ip ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 309 | exec "inResult=main." + ONOScli + ".featureInstall(onosFeature)" |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 310 | time.sleep( 3 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 311 | installResult = inResult and installResult |
| 312 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 313 | time.sleep( 5 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 314 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 315 | main.step( "Verify Pingall" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 316 | ping_result = main.FALSE |
| 317 | time1 = time.time() |
| 318 | ping_result = main.Mininet1.pingall() |
| 319 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 320 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 321 | main.log.report( |
| 322 | "Time taken for Ping All: " + |
| 323 | str( timeDiff ) + |
| 324 | " seconds" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 325 | |
| 326 | if ping_result == main.TRUE: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 327 | main.log.report( "Pingall Test in Reactive mode successful" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 328 | else: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 329 | main.log.report( "Pingall Test in Reactive mode failed" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 330 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 331 | main.step( "Disable Reactive forwarding" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 332 | uninstallResult = main.TRUE |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 333 | for i in range( 1, int( main.numCtrls ) + 1 ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 334 | onosFeature = 'onos-app-fwd' |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 335 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 336 | ONOScli = 'ONOScli' + str( i ) |
| 337 | main.log.info( "Disabling Reactive mode on ONOS Node " + ONOS_ip ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 338 | exec "unResult=main." + ONOScli + ".featureUninstall(onosFeature)" |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 339 | uninstallResult = unResult and uninstallResult |
| 340 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 341 | # Waiting for reative flows to be cleared. |
| 342 | time.sleep( 10 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 343 | |
| 344 | case3Result = installResult and ping_result and uninstallResult |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 345 | utilities.assert_equals( expect=main.TRUE, actual=case3Result, |
| 346 | onpass="Reactive Mode Pingall test PASS", |
| 347 | onfail="Reactive Mode Pingall test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 348 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 349 | def CASE5( self, main ): |
| 350 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 351 | Compare current ONOS topology with reference data |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 352 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 353 | import re |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 354 | devicesDPIDTemp = [] |
| 355 | hostMACsTemp = [] |
| 356 | deviceLinksTemp = [] |
| 357 | deviceActiveLinksCountTemp = [] |
| 358 | devicePortsEnabledCountTemp = [] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 359 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 360 | main.log.report( |
| 361 | "Compare ONOS topology with reference data in Stores" ) |
| 362 | main.log.report( "__________________________________________________" ) |
| 363 | main.case( "Compare ONOS topology with reference data" ) |
| 364 | |
| 365 | main.step( "Compare current Device ports enabled with reference" ) |
| 366 | for i in range( 1, 26 ): |
| 367 | portResult = main.ONOScli1.getDevicePortsEnabledCount( |
| 368 | "of:00000000000000" + |
| 369 | format( |
| 370 | i, |
| 371 | '02x' ) ) |
| 372 | portTemp = re.split( r'\t+', portResult ) |
| 373 | portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 374 | devicePortsEnabledCountTemp.append( portCount ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 375 | time.sleep( 2 ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 376 | main.log.info ( |
| 377 | "Device Enabled ports EXPECTED: %s" % |
| 378 | str( main.devicePortsEnabledCount ) ) |
| 379 | main.log.info ( |
| 380 | "Device Enabled ports ACTUAL: %s" % |
| 381 | str( devicePortsEnabledCountTemp ) ) |
| 382 | if ( cmp( main.devicePortsEnabledCount, |
| 383 | devicePortsEnabledCountTemp ) == 0 ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 384 | stepResult1 = main.TRUE |
| 385 | else: |
| 386 | stepResult1 = main.FALSE |
| 387 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 388 | main.step( "Compare Device active links with reference" ) |
| 389 | for i in range( 1, 26 ): |
| 390 | linkResult = main.ONOScli1.getDeviceLinksActiveCount( |
| 391 | "of:00000000000000" + |
| 392 | format( |
| 393 | i, |
| 394 | '02x' ) ) |
| 395 | linkTemp = re.split( r'\t+', linkResult ) |
| 396 | linkCount = linkTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 397 | deviceActiveLinksCountTemp.append( linkCount ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 398 | time.sleep( 3 ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 399 | main.log.info ( |
| 400 | "Device Active links EXPECTED: %s" % |
| 401 | str( main.deviceActiveLinksCount ) ) |
| 402 | main.log.info ( |
| 403 | "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) ) |
| 404 | if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 405 | stepResult2 = main.TRUE |
| 406 | else: |
| 407 | stepResult2 = main.FALSE |
| 408 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 409 | """ |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 410 | place holder for comparing devices, hosts, paths and intents if required. |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 411 | Links and ports data would be incorrect with out devices anyways. |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 412 | """ |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 413 | case5Result = ( stepResult1 and stepResult2 ) |
| 414 | utilities.assert_equals( expect=main.TRUE, actual=case5Result, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 415 | onpass="Compare Topology test PASS", |
| 416 | onfail="Compare Topology test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 417 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 418 | def CASE6( self ): |
| 419 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 420 | Install 300 host intents and verify ping all |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 421 | """ |
| 422 | main.log.report( "Add 300 host intents and verify pingall" ) |
| 423 | main.log.report( "_______________________________________" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 424 | import itertools |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 425 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 426 | main.case( "Install 300 host intents" ) |
| 427 | main.step( "Add host Intents" ) |
| 428 | intentResult = main.TRUE |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 429 | hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 430 | for i in range( len( hostCombos ) ): |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 431 | iResult = main.ONOScli1.addHostIntent( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 432 | hostCombos[ i ][ 0 ], |
| 433 | hostCombos[ i ][ 1 ] ) |
| 434 | intentResult = ( intentResult and iResult ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 435 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 436 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 437 | pingResult = main.FALSE |
| 438 | time1 = time.time() |
| 439 | pingResult = main.Mininet1.pingall() |
| 440 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 441 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 442 | main.log.report( |
| 443 | "Time taken for Ping All: " + |
| 444 | str( timeDiff ) + |
| 445 | " seconds" ) |
| 446 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 447 | onpass="PING ALL PASS", |
| 448 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 449 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 450 | case4Result = ( intentResult and pingResult ) |
Hari Krishna | 46997e0 | 2015-01-27 11:23:07 -0800 | [diff] [blame] | 451 | #case4Result = pingResult |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 452 | utilities.assert_equals( |
| 453 | expect=main.TRUE, |
| 454 | actual=case4Result, |
| 455 | onpass="Install 300 Host Intents and Ping All test PASS", |
| 456 | onfail="Install 300 Host Intents and Ping All test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 457 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 458 | def CASE70( self, main ): |
| 459 | """ |
| 460 | Randomly bring some core links down and verify ping all ( Host Intents Scenario ) |
| 461 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 462 | import random |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 463 | main.randomLink1 = [] |
| 464 | main.randomLink2 = [] |
| 465 | main.randomLink3 = [] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 466 | link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ] |
| 467 | link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 468 | link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ] |
| 469 | link2End2 = main.params[ 'CORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 470 | link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ] |
| 471 | link3End2 = main.params[ 'CORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 472 | switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ] |
| 473 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 474 | |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 475 | main.log.report( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 476 | main.log.report( "_________________________________________________________________" ) |
| 477 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 478 | main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 479 | if ( int( switchLinksToToggle ) == |
| 480 | 0 or int( switchLinksToToggle ) > 5 ): |
Hari Krishna | 46997e0 | 2015-01-27 11:23:07 -0800 | [diff] [blame] | 481 | main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 482 | main.cleanup() |
| 483 | main.exit() |
| 484 | else: |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 485 | main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 486 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 487 | main.step( "Cut links on Core devices using user provided range" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 488 | main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 489 | main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 490 | main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 491 | for i in range( int( switchLinksToToggle ) ): |
| 492 | main.Mininet1.link( |
| 493 | END1=link1End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 494 | END2=main.randomLink1[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 495 | OPTION="down" ) |
| 496 | main.Mininet1.link( |
| 497 | END1=link2End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 498 | END2=main.randomLink2[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 499 | OPTION="down" ) |
| 500 | main.Mininet1.link( |
| 501 | END1=link3End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 502 | END2=main.randomLink3[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 503 | OPTION="down" ) |
| 504 | time.sleep( link_sleep ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 505 | |
| 506 | topology_output = main.ONOScli2.topology() |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 507 | linkDown = main.ONOSbench.checkStatus( |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 508 | topology_output, main.numMNswitches, str( |
| 509 | int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 510 | utilities.assert_equals( |
| 511 | expect=main.TRUE, |
| 512 | actual=linkDown, |
| 513 | onpass="Link Down discovered properly", |
| 514 | onfail="Link down was not discovered in " + |
| 515 | str( link_sleep ) + |
| 516 | " seconds" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 517 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 518 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 519 | pingResultLinkDown = main.FALSE |
| 520 | time1 = time.time() |
| 521 | pingResultLinkDown = main.Mininet1.pingall() |
| 522 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 523 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 524 | main.log.report( |
| 525 | "Time taken for Ping All: " + |
| 526 | str( timeDiff ) + |
| 527 | " seconds" ) |
| 528 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 529 | onpass="PING ALL PASS", |
| 530 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 531 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 532 | caseResult70 = linkDown and pingResultLinkDown |
| 533 | utilities.assert_equals( expect=main.TRUE, actual=caseResult70, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 534 | onpass="Random Link cut Test PASS", |
| 535 | onfail="Random Link cut Test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 536 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 537 | def CASE80( self, main ): |
| 538 | """ |
| 539 | Bring the core links up that are down and verify ping all ( Host Intents Scenario ) |
| 540 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 541 | import random |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 542 | link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ] |
| 543 | link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ] |
| 544 | link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ] |
| 545 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 546 | switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 547 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 548 | main.log.report( |
| 549 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 550 | main.log.report( |
| 551 | "__________________________________________________________________" ) |
| 552 | main.case( |
| 553 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 554 | main.step( "Bring randomly cut links on Core devices up" ) |
| 555 | for i in range( int( switchLinksToToggle ) ): |
| 556 | main.Mininet1.link( |
| 557 | END1=link1End1, |
| 558 | END2=randomLink1[ i ], |
| 559 | OPTION="up" ) |
| 560 | main.Mininet1.link( |
| 561 | END1=link2End1, |
| 562 | END2=randomLink2[ i ], |
| 563 | OPTION="up" ) |
| 564 | main.Mininet1.link( |
| 565 | END1=link3End1, |
| 566 | END2=randomLink3[ i ], |
| 567 | OPTION="up" ) |
| 568 | time.sleep( link_sleep ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 569 | |
| 570 | topology_output = main.ONOScli2.topology() |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 571 | linkUp = main.ONOSbench.checkStatus( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 572 | topology_output, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 573 | main.numMNswitches, |
| 574 | str( main.numMNlinks ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 575 | utilities.assert_equals( |
| 576 | expect=main.TRUE, |
| 577 | actual=linkUp, |
| 578 | onpass="Link up discovered properly", |
| 579 | onfail="Link up was not discovered in " + |
| 580 | str( link_sleep ) + |
| 581 | " seconds" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 582 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 583 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 584 | pingResultLinkUp = main.FALSE |
| 585 | time1 = time.time() |
| 586 | pingResultLinkUp = main.Mininet1.pingall() |
| 587 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 588 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 589 | main.log.report( |
| 590 | "Time taken for Ping All: " + |
| 591 | str( timeDiff ) + |
| 592 | " seconds" ) |
| 593 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 594 | onpass="PING ALL PASS", |
| 595 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 596 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 597 | caseResult80 = linkUp and pingResultLinkUp |
| 598 | utilities.assert_equals( expect=main.TRUE, actual=caseResult80, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 599 | onpass="Link Up Test PASS", |
| 600 | onfail="Link Up Test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 601 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 602 | def CASE71( self, main ): |
| 603 | """ |
| 604 | Randomly bring some core links down and verify ping all ( Point Intents Scenario ) |
| 605 | """ |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 606 | import random |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 607 | main.randomLink1 = [] |
| 608 | main.randomLink2 = [] |
| 609 | main.randomLink3 = [] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 610 | link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ] |
| 611 | link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 612 | link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ] |
| 613 | link2End2 = main.params[ 'CORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 614 | link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ] |
| 615 | link3End2 = main.params[ 'CORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 616 | switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ] |
| 617 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 618 | |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 619 | main.log.report( "Point Intents - Randomly bring some core links down and verify ping all" ) |
| 620 | main.log.report( "__________________________________________________________________" ) |
| 621 | main.case( "Point Intents - Randomly bring some core links down and verify ping all" ) |
| 622 | main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 623 | if ( int( switchLinksToToggle ) == |
| 624 | 0 or int( switchLinksToToggle ) > 5 ): |
| 625 | main.log.info( |
| 626 | "Please check you PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 627 | main.cleanup() |
| 628 | main.exit() |
| 629 | else: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 630 | main.log.info( |
| 631 | "User provided Core switch links range to toggle is correct, proceeding to run the test" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 632 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 633 | main.step( "Cut links on Core devices using user provided range" ) |
| 634 | randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 635 | randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 636 | randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 637 | for i in range( int( switchLinksToToggle ) ): |
| 638 | main.Mininet1.link( |
| 639 | END1=link1End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 640 | END2=main.randomLink1[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 641 | OPTION="down" ) |
| 642 | main.Mininet1.link( |
| 643 | END1=link2End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 644 | END2=main.randomLink2[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 645 | OPTION="down" ) |
| 646 | main.Mininet1.link( |
| 647 | END1=link3End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 648 | END2=main.randomLink3[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 649 | OPTION="down" ) |
| 650 | time.sleep( link_sleep ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 651 | |
| 652 | topology_output = main.ONOScli2.topology() |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 653 | linkDown = main.ONOSbench.checkStatus( |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 654 | topology_output, main.numSwitches, str( |
| 655 | int( main.numLinks ) - int( switchLinksToToggle ) * 6 ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 656 | utilities.assert_equals( |
| 657 | expect=main.TRUE, |
| 658 | actual=linkDown, |
| 659 | onpass="Link Down discovered properly", |
| 660 | onfail="Link down was not discovered in " + |
| 661 | str( link_sleep ) + |
| 662 | " seconds" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 663 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 664 | main.step( "Verify Ping across all hosts" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 665 | pingResultLinkDown = main.FALSE |
| 666 | time1 = time.time() |
| 667 | pingResultLinkDown = main.Mininet1.pingall() |
| 668 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 669 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 670 | main.log.report( |
| 671 | "Time taken for Ping All: " + |
| 672 | str( timeDiff ) + |
| 673 | " seconds" ) |
| 674 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 675 | onpass="PING ALL PASS", |
| 676 | onfail="PING ALL FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 677 | |
| 678 | caseResult7 = linkDown and pingResultLinkDown |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 679 | utilities.assert_equals( expect=main.TRUE, actual=caseResult7, |
| 680 | onpass="Random Link cut Test PASS", |
| 681 | onfail="Random Link cut Test FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 682 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 683 | def CASE81( self, main ): |
| 684 | """ |
| 685 | Bring the core links up that are down and verify ping all ( Point Intents Scenario ) |
| 686 | """ |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 687 | import random |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 688 | link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ] |
| 689 | link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ] |
| 690 | link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ] |
| 691 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 692 | switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ] |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 693 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 694 | main.log.report( |
| 695 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 696 | main.log.report( |
| 697 | "___________________________________________________________________" ) |
| 698 | main.case( |
| 699 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 700 | main.step( "Bring randomly cut links on Core devices up" ) |
| 701 | for i in range( int( switchLinksToToggle ) ): |
| 702 | main.Mininet1.link( |
| 703 | END1=link1End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 704 | END2=main.randomLink1[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 705 | OPTION="up" ) |
| 706 | main.Mininet1.link( |
| 707 | END1=link2End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 708 | END2=main.randomLink2[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 709 | OPTION="up" ) |
| 710 | main.Mininet1.link( |
| 711 | END1=link3End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 712 | END2=main.randomLink3[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 713 | OPTION="up" ) |
| 714 | time.sleep( link_sleep ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 715 | |
| 716 | topology_output = main.ONOScli2.topology() |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 717 | linkUp = main.ONOSbench.checkStatus( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 718 | topology_output, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 719 | main.numMNswitches, |
| 720 | str( main.numMNlinks ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 721 | utilities.assert_equals( |
| 722 | expect=main.TRUE, |
| 723 | actual=linkUp, |
| 724 | onpass="Link up discovered properly", |
| 725 | onfail="Link up was not discovered in " + |
| 726 | str( link_sleep ) + |
| 727 | " seconds" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 728 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 729 | main.step( "Verify Ping across all hosts" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 730 | pingResultLinkUp = main.FALSE |
| 731 | time1 = time.time() |
| 732 | pingResultLinkUp = main.Mininet1.pingall() |
| 733 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 734 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 735 | main.log.report( |
| 736 | "Time taken for Ping All: " + |
| 737 | str( timeDiff ) + |
| 738 | " seconds" ) |
| 739 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 740 | onpass="PING ALL PASS", |
| 741 | onfail="PING ALL FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 742 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 743 | caseResult81 = linkUp and pingResultLinkUp |
| 744 | utilities.assert_equals( expect=main.TRUE, actual=caseResult81, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 745 | onpass="Link Up Test PASS", |
| 746 | onfail="Link Up Test FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 747 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 748 | def CASE9( self ): |
| 749 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 750 | Install 114 point intents and verify Ping all works |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 751 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 752 | import copy |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 753 | main.log.report( "Install 114 point intents and verify Ping all" ) |
| 754 | main.log.report( "___________________________________________" ) |
| 755 | main.case( "Install 114 point intents and Ping all" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 756 | deviceLinksCopy = copy.copy( main.deviceLinks ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 757 | main.step( "Install 114 point intents" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 758 | for i in range( len( deviceLinksCopy ) ): |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 759 | pointLink = str( |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 760 | deviceLinksCopy[ i ] ).replace( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 761 | "src=", |
| 762 | "" ).replace( |
| 763 | "dst=", |
| 764 | "" ).split( ',' ) |
| 765 | point1 = pointLink[ 0 ].split( '/' ) |
| 766 | point2 = pointLink[ 1 ].split( '/' ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 767 | installResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 768 | point1[ 0 ], point2[ 0 ], int( |
| 769 | point1[ 1 ] ), int( |
| 770 | point2[ 1 ] ) ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 771 | if installResult == main.TRUE: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 772 | print "Installed Point intent between :", point1[ 0 ], int( point1[ 1 ] ), point2[ 0 ], int( point2[ 1 ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 773 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 774 | main.step( "Obtain the intent id's" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 775 | intentsList = main.ONOScli1.getAllIntentIds() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 776 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 777 | intentsList = ansi_escape.sub( '', intentsList ) |
| 778 | intentsList = intentsList.replace( |
| 779 | " onos:intents | grep id=", |
| 780 | "" ).replace( |
| 781 | "id=", |
| 782 | "" ).replace( |
| 783 | "\r\r", |
| 784 | "" ) |
| 785 | intentsList = intentsList.splitlines() |
| 786 | intentsList = intentsList[ 1: ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 787 | intentIdList = [] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 788 | for i in range( len( intentsList ) ): |
| 789 | intentsTemp = intentsList[ i ].split( ',' ) |
| 790 | intentIdList.append( intentsTemp[ 0 ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 791 | print "Intent IDs: ", intentIdList |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 792 | print "Total Intents installed: ", len( intentIdList ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 793 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 794 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 795 | pingResult = main.FALSE |
| 796 | time1 = time.time() |
| 797 | pingResult = main.Mininet1.pingall() |
| 798 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 799 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 800 | main.log.report( |
| 801 | "Time taken for Ping All: " + |
| 802 | str( timeDiff ) + |
| 803 | " seconds" ) |
| 804 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 805 | onpass="PING ALL PASS", |
| 806 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 807 | |
| 808 | case8_result = installResult and pingResult |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 809 | utilities.assert_equals( |
| 810 | expect=main.TRUE, |
| 811 | actual=case8_result, |
| 812 | onpass="Ping all test after Point intents addition successful", |
| 813 | onfail="Ping all test after Point intents addition failed" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 814 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 815 | def CASE10( self ): |
| 816 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 817 | Remove all Intents |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 818 | """ |
| 819 | main.log.report( "Remove all intents that were installed previously" ) |
| 820 | main.log.report( "______________________________________________" ) |
| 821 | main.log.info( "Remove all intents" ) |
| 822 | main.case( "Removing intents" ) |
| 823 | main.step( "Obtain the intent id's first" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 824 | intentsList = main.ONOScli1.getAllIntentIds() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 825 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 826 | intentsList = ansi_escape.sub( '', intentsList ) |
| 827 | intentsList = intentsList.replace( |
| 828 | " onos:intents | grep id=", |
| 829 | "" ).replace( |
| 830 | "id=", |
| 831 | "" ).replace( |
| 832 | "\r\r", |
| 833 | "" ) |
| 834 | intentsList = intentsList.splitlines() |
| 835 | intentsList = intentsList[ 1: ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 836 | intentIdList = [] |
| 837 | step1Result = main.TRUE |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 838 | if ( len( intentsList ) > 1 ): |
| 839 | for i in range( len( intentsList ) ): |
| 840 | intentsTemp = intentsList[ i ].split( ',' ) |
| 841 | intentIdList.append( intentsTemp[ 0 ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 842 | print "Intent IDs: ", intentIdList |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 843 | for id in range( len( intentIdList ) ): |
| 844 | print "Removing intent id (round 1) :", intentIdList[ id ] |
Hari Krishna | 46997e0 | 2015-01-27 11:23:07 -0800 | [diff] [blame] | 845 | main.ONOScli1.removeIntent( intentId=intentIdList[ id ] ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 846 | #time.sleep( 1 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 847 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 848 | main.log.info( |
| 849 | "Verify all intents are removed and if any leftovers try remove one more time" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 850 | intentsList1 = main.ONOScli1.getAllIntentIds() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 851 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 852 | intentsList1 = ansi_escape.sub( '', intentsList1 ) |
| 853 | intentsList1 = intentsList1.replace( |
| 854 | " onos:intents | grep id=", |
| 855 | "" ).replace( |
| 856 | " state=", |
| 857 | "" ).replace( |
| 858 | "\r\r", |
| 859 | "" ) |
| 860 | intentsList1 = intentsList1.splitlines() |
| 861 | intentsList1 = intentsList1[ 1: ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 862 | print "Round 2 (leftover) intents to remove: ", intentsList1 |
| 863 | intentIdList1 = [] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 864 | if ( len( intentsList1 ) > 1 ): |
| 865 | for i in range( len( intentsList1 ) ): |
| 866 | intentsTemp1 = intentsList[ i ].split( ',' ) |
| 867 | intentIdList1.append( intentsTemp1[ 0 ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 868 | print "Leftover Intent IDs: ", intentIdList1 |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 869 | for id in range( len( intentIdList1 ) ): |
| 870 | print "Removing intent id (round 2):", intentIdList1[ id ] |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 871 | main.ONOScli1.removeIntent( |
Hari Krishna | 46997e0 | 2015-01-27 11:23:07 -0800 | [diff] [blame] | 872 | intentId=intentIdList1[ id ] ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 873 | #time.sleep( 2 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 874 | else: |
| 875 | print "There are no more intents that need to be removed" |
| 876 | step1Result = main.TRUE |
| 877 | else: |
| 878 | print "No Intent IDs found in Intents list: ", intentsList |
| 879 | step1Result = main.FALSE |
| 880 | |
| 881 | caseResult7 = step1Result |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 882 | utilities.assert_equals( expect=main.TRUE, actual=caseResult7, |
| 883 | onpass="Intent removal test successful", |
| 884 | onfail="Intent removal test failed" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 885 | |
| 886 | def CASE11( self, main ): |
| 887 | """ |
| 888 | Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it |
| 889 | """ |
| 890 | import re |
| 891 | import copy |
| 892 | import time |
| 893 | |
| 894 | main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" ) |
| 895 | main.log.report( "_____________________________________________________" ) |
| 896 | main.case( "Enable Intent based Reactive forwarding and Verify ping all" ) |
| 897 | main.step( "Enable intent based Reactive forwarding" ) |
| 898 | installResult = main.TRUE |
| 899 | for i in range( 1, int( main.numCtrls ) + 1 ): |
| 900 | onosFeature = 'onos-app-ifwd' |
| 901 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 902 | ONOScli = 'ONOScli' + str( i ) |
| 903 | main.log.info( "Enabling Intent based Reactive forwarding on ONOS Node " + ONOS_ip ) |
| 904 | exec "inResult=main." + ONOScli + ".featureInstall(onosFeature)" |
| 905 | time.sleep( 3 ) |
| 906 | installResult = inResult and installResult |
| 907 | |
| 908 | time.sleep( 5 ) |
| 909 | |
| 910 | main.step( "Verify Pingall" ) |
| 911 | ping_result = main.FALSE |
| 912 | time1 = time.time() |
| 913 | ping_result = main.Mininet1.pingall() |
| 914 | time2 = time.time() |
| 915 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 916 | main.log.report( |
| 917 | "Time taken for Ping All: " + |
| 918 | str( timeDiff ) + |
| 919 | " seconds" ) |
| 920 | |
| 921 | if ping_result == main.TRUE: |
| 922 | main.log.report( "Pingall Test in Reactive mode successful" ) |
| 923 | else: |
| 924 | main.log.report( "Pingall Test in Reactive mode failed" ) |
| 925 | |
| 926 | main.step( "Disable Intent based Reactive forwarding" ) |
| 927 | uninstallResult = main.TRUE |
| 928 | for i in range( 1, int( main.numCtrls ) + 1 ): |
| 929 | onosFeature = 'onos-app-ifwd' |
| 930 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 931 | ONOScli = 'ONOScli' + str( i ) |
| 932 | main.log.info( "Disabling Intent based Reactive forwarding on ONOS Node " + ONOS_ip ) |
| 933 | exec "unResult=main." + ONOScli + ".featureUninstall(onosFeature)" |
| 934 | uninstallResult = unResult and uninstallResult |
| 935 | |
| 936 | # Waiting for reative flows to be cleared. |
| 937 | time.sleep( 10 ) |
| 938 | |
| 939 | case11Result = installResult and ping_result and uninstallResult |
| 940 | utilities.assert_equals( expect=main.TRUE, actual=case11Result, |
| 941 | onpass="Intent based Reactive forwarding Pingall test PASS", |
| 942 | onfail="Intent based Reactive forwarding Pingall test FAIL" ) |
| 943 | |
| 944 | def CASE12( self, main ): |
| 945 | """ |
| 946 | This test script Loads a new Topology (Chordal) on CHO setup and balances all switches |
| 947 | """ |
| 948 | import re |
| 949 | import time |
| 950 | import copy |
| 951 | |
| 952 | newTopo = main.params['TOPO2']['topo'] |
| 953 | main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] ) |
| 954 | main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] ) |
| 955 | main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] ) |
| 956 | |
| 957 | main.log.report( |
| 958 | "Load Chordal topology and Balance all Mininet switches across controllers" ) |
| 959 | main.log.report( |
| 960 | "________________________________________________________________________" ) |
| 961 | # need to wait here for sometime until ONOS bootup |
| 962 | time.sleep( 15 ) |
| 963 | main.case( |
| 964 | "Assign and Balance all Mininet switches across controllers" ) |
| 965 | main.step( "Stop any previous Mininet network topology" ) |
| 966 | stopStatus = main.Mininet1.stopNet() |
| 967 | |
| 968 | # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE |
| 969 | main.step( "Stop ONOS on all Nodes" ) |
| 970 | stopResult = main.TRUE |
| 971 | for i in range( 1, int( main.numCtrls ) + 1 ): |
| 972 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 973 | main.log.info( "Stopping ONOS Node IP: " + ONOS_ip ) |
| 974 | sresult = main.ONOSbench.onosStop( ONOS_ip ) |
| 975 | utilities.assert_equals( expect=main.TRUE, actual=sresult, |
| 976 | onpass="Test step PASS", |
| 977 | onfail="Test step FAIL" ) |
| 978 | stopResult = ( stopResult and sresult ) |
| 979 | |
| 980 | main.step( "Start Mininet with Chordal topology" ) |
| 981 | startStatus = main.Mininet1.startNet(topoFile = newTopo) |
| 982 | |
| 983 | main.step( "Assign switches to controllers" ) |
| 984 | for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 ) |
| 985 | main.Mininet1.assignSwController( |
| 986 | sw=str( i ), |
| 987 | count=int( main.numCtrls ), |
| 988 | ip1=main.ONOS1_ip, |
| 989 | port1=main.ONOS1_port, |
| 990 | ip2=main.ONOS2_ip, |
| 991 | port2=main.ONOS2_port, |
| 992 | ip3=main.ONOS3_ip, |
| 993 | port3=main.ONOS3_port, |
| 994 | ip4=main.ONOS4_ip, |
| 995 | port4=main.ONOS4_port, |
| 996 | ip5=main.ONOS5_ip, |
| 997 | port5=main.ONOS5_port ) |
| 998 | |
| 999 | switch_mastership = main.TRUE |
| 1000 | for i in range( 1, ( main.numMNswitches + 1 ) ): |
| 1001 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 1002 | print( "Response is " + str( response ) ) |
| 1003 | if re.search( "tcp:" + main.ONOS1_ip, response ): |
| 1004 | switch_mastership = switch_mastership and main.TRUE |
| 1005 | else: |
| 1006 | switch_mastership = main.FALSE |
| 1007 | |
| 1008 | if switch_mastership == main.TRUE: |
| 1009 | main.log.report( "Controller assignment successfull" ) |
| 1010 | else: |
| 1011 | main.log.report( "Controller assignment failed" ) |
| 1012 | time.sleep( 5 ) |
| 1013 | |
| 1014 | main.step( "Start ONOS on all Nodes" ) |
| 1015 | startResult = main.TRUE |
| 1016 | for i in range( 1, int( main.numCtrls ) + 1 ): |
| 1017 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 1018 | main.log.info( "Starting ONOS Node IP: " + ONOS_ip ) |
| 1019 | sresult = main.ONOSbench.onosStart( ONOS_ip ) |
| 1020 | utilities.assert_equals( expect=main.TRUE, actual=sresult, |
| 1021 | onpass="Test step PASS", |
| 1022 | onfail="Test step FAIL" ) |
| 1023 | startResult = ( startResult and sresult ) |
| 1024 | |
| 1025 | main.step( "Start ONOS CLI on all nodes" ) |
| 1026 | cliResult = main.TRUE |
| 1027 | #karafTimeout = "3600000" # This is not needed here as it is already set before. |
| 1028 | # need to wait here sometime for ONOS to bootup. |
| 1029 | time.sleep( 30 ) |
| 1030 | for i in range( 1, int( main.numCtrls ) + 1 ): |
| 1031 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 1032 | ONOScli = 'ONOScli' + str( i ) |
| 1033 | main.log.info( "ONOS Node " + ONOS_ip + " cli start:" ) |
| 1034 | exec "startcli=main." + ONOScli + \ |
| 1035 | ".startOnosCli(ONOS_ip)" |
| 1036 | utilities.assert_equals( expect=main.TRUE, actual=startcli, |
| 1037 | onpass="Test step PASS", |
| 1038 | onfail="Test step FAIL" ) |
| 1039 | cliResult = ( cliResult and startcli ) |
| 1040 | |
| 1041 | main.step( "Balance devices across controllers" ) |
| 1042 | for i in range( int( main.numCtrls ) ): |
| 1043 | balanceResult = main.ONOScli1.balanceMasters() |
| 1044 | # giving some breathing time for ONOS to complete re-balance |
| 1045 | time.sleep( 3 ) |
| 1046 | |
| 1047 | case12Result = ( startResult and cliResult ) |
| 1048 | utilities.assert_equals( |
| 1049 | expect=main.TRUE, |
| 1050 | actual=case12Result, |
| 1051 | onpass="Starting new Chordal topology test PASS", |
| 1052 | onfail="Starting new Chordal topology test FAIL" ) |
| 1053 | |
| 1054 | def CASE13( self, main ): |
| 1055 | """ |
| 1056 | This test script Loads a new Topology (Spine) on CHO setup and balances all switches |
| 1057 | """ |
| 1058 | import re |
| 1059 | import time |
| 1060 | import copy |
| 1061 | |
| 1062 | newTopo = main.params['TOPO3']['topo'] |
| 1063 | main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] ) |
| 1064 | main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] ) |
| 1065 | main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] ) |
| 1066 | |
| 1067 | main.log.report( |
| 1068 | "Load Spine and Leaf topology and Balance all Mininet switches across controllers" ) |
| 1069 | main.log.report( |
| 1070 | "________________________________________________________________________" ) |
| 1071 | # need to wait here for sometime until ONOS bootup |
| 1072 | time.sleep( 15 ) |
| 1073 | main.case( |
| 1074 | "Assign and Balance all Mininet switches across controllers" ) |
| 1075 | main.step( "Stop any previous Mininet network topology" ) |
| 1076 | stopStatus = main.Mininet1.stopNet() |
| 1077 | |
| 1078 | # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE |
| 1079 | main.step( "Stop ONOS on all Nodes" ) |
| 1080 | stopResult = main.TRUE |
| 1081 | for i in range( 1, int( main.numCtrls ) + 1 ): |
| 1082 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 1083 | main.log.info( "Stopping ONOS Node IP: " + ONOS_ip ) |
| 1084 | sresult = main.ONOSbench.onosStop( ONOS_ip ) |
| 1085 | utilities.assert_equals( expect=main.TRUE, actual=sresult, |
| 1086 | onpass="Test step PASS", |
| 1087 | onfail="Test step FAIL" ) |
| 1088 | stopResult = ( stopResult and sresult ) |
| 1089 | |
| 1090 | main.step( "Start Mininet with Spine topology" ) |
| 1091 | startStatus = main.Mininet1.startNet(topoFile = newTopo) |
| 1092 | |
| 1093 | main.step( "Assign switches to controllers" ) |
| 1094 | for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 ) |
| 1095 | main.Mininet1.assignSwController( |
| 1096 | sw=str( i ), |
| 1097 | count=int( main.numCtrls ), |
| 1098 | ip1=main.ONOS1_ip, |
| 1099 | port1=main.ONOS1_port, |
| 1100 | ip2=main.ONOS2_ip, |
| 1101 | port2=main.ONOS2_port, |
| 1102 | ip3=main.ONOS3_ip, |
| 1103 | port3=main.ONOS3_port, |
| 1104 | ip4=main.ONOS4_ip, |
| 1105 | port4=main.ONOS4_port, |
| 1106 | ip5=main.ONOS5_ip, |
| 1107 | port5=main.ONOS5_port ) |
| 1108 | |
| 1109 | switch_mastership = main.TRUE |
| 1110 | for i in range( 1, ( main.numMNswitches + 1 ) ): |
| 1111 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 1112 | print( "Response is " + str( response ) ) |
| 1113 | if re.search( "tcp:" + main.ONOS1_ip, response ): |
| 1114 | switch_mastership = switch_mastership and main.TRUE |
| 1115 | else: |
| 1116 | switch_mastership = main.FALSE |
| 1117 | |
| 1118 | if switch_mastership == main.TRUE: |
| 1119 | main.log.report( "Controller assignment successfull" ) |
| 1120 | else: |
| 1121 | main.log.report( "Controller assignment failed" ) |
| 1122 | time.sleep( 5 ) |
| 1123 | |
| 1124 | main.step( "Start ONOS on all Nodes" ) |
| 1125 | startResult = main.TRUE |
| 1126 | for i in range( 1, int( main.numCtrls ) + 1 ): |
| 1127 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 1128 | main.log.info( "Starting ONOS Node IP: " + ONOS_ip ) |
| 1129 | sresult = main.ONOSbench.onosStart( ONOS_ip ) |
| 1130 | utilities.assert_equals( expect=main.TRUE, actual=sresult, |
| 1131 | onpass="Test step PASS", |
| 1132 | onfail="Test step FAIL" ) |
| 1133 | startResult = ( startResult and sresult ) |
| 1134 | |
| 1135 | main.step( "Start ONOS CLI on all nodes" ) |
| 1136 | cliResult = main.TRUE |
| 1137 | #karafTimeout = "3600000" # This is not needed here as it is already set before. |
| 1138 | # need to wait here sometime for ONOS to bootup. |
| 1139 | time.sleep( 30 ) |
| 1140 | for i in range( 1, int( main.numCtrls ) + 1 ): |
| 1141 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 1142 | ONOScli = 'ONOScli' + str( i ) |
| 1143 | main.log.info( "ONOS Node " + ONOS_ip + " cli start:" ) |
| 1144 | exec "startcli=main." + ONOScli + \ |
| 1145 | ".startOnosCli(ONOS_ip)" |
| 1146 | utilities.assert_equals( expect=main.TRUE, actual=startcli, |
| 1147 | onpass="Test step PASS", |
| 1148 | onfail="Test step FAIL" ) |
| 1149 | cliResult = ( cliResult and startcli ) |
| 1150 | |
| 1151 | main.step( "Balance devices across controllers" ) |
| 1152 | for i in range( int( main.numCtrls ) ): |
| 1153 | balanceResult = main.ONOScli1.balanceMasters() |
| 1154 | # giving some breathing time for ONOS to complete re-balance |
| 1155 | time.sleep( 3 ) |
| 1156 | |
| 1157 | case13Result = ( startResult and cliResult ) |
| 1158 | utilities.assert_equals( |
| 1159 | expect=main.TRUE, |
| 1160 | actual=case13Result, |
| 1161 | onpass="Starting new Spine topology test PASS", |
| 1162 | onfail="Starting new Spine topology test FAIL" ) |