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 = '' |
| 14 | global deviceDPIDs |
| 15 | global hostMACs |
| 16 | global deviceLinks |
| 17 | global deviceActiveLinksCount |
| 18 | global devicePortsEnabledCount |
| 19 | global installedIntents |
| 20 | global randomLink1, randomLink2, randomLink3, numSwitches, numLinks |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 21 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 22 | def CASE1( self, main ): |
| 23 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 24 | Startup sequence: |
| 25 | git pull |
| 26 | mvn clean install |
| 27 | onos-package |
| 28 | cell <name> |
| 29 | onos-verify-cell |
| 30 | onos-install -f |
| 31 | onos-wait-for-start |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 32 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 33 | import time |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 34 | cell_name = main.params[ 'ENV' ][ 'cellName' ] |
| 35 | git_pull = main.params[ 'GIT' ][ 'autoPull' ] |
| 36 | numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ] |
| 37 | git_branch = main.params[ 'GIT' ][ 'branch' ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 38 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 39 | main.case( "Set up test environment" ) |
| 40 | main.log.report( "Set up test environment" ) |
| 41 | main.log.report( "_______________________" ) |
| 42 | |
| 43 | main.step( "Git checkout and pull " + git_branch ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 44 | if git_pull == 'on': |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 45 | checkout_result = main.ONOSbench.gitCheckout( git_branch ) |
| 46 | pull_result = main.ONOSbench.gitPull() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 47 | cp_result = ( checkout_result and pull_result ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 48 | else: |
| 49 | checkout_result = main.TRUE |
| 50 | pull_result = main.TRUE |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 51 | main.log.info( "Skipped git checkout and pull" ) |
| 52 | cp_result = ( checkout_result and pull_result ) |
| 53 | utilities.assert_equals( expect=main.TRUE, actual=cp_result, |
| 54 | onpass="Test step PASS", |
| 55 | onfail="Test step FAIL" ) |
| 56 | |
| 57 | main.step( "mvn clean & install" ) |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 58 | mvn_result = main.ONOSbench.cleanInstall() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 59 | utilities.assert_equals( expect=main.TRUE, actual=mvn_result, |
| 60 | onpass="Test step PASS", |
| 61 | onfail="Test step FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 62 | |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 63 | main.ONOSbench.getVersion( report=True ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 64 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 65 | main.step( "Apply Cell environment for ONOS" ) |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 66 | cell_result = main.ONOSbench.setCell( cell_name ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 67 | utilities.assert_equals( expect=main.TRUE, actual=cell_result, |
| 68 | onpass="Test step PASS", |
| 69 | onfail="Test step FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 70 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 71 | main.step( "Create ONOS package" ) |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 72 | packageResult = main.ONOSbench.onosPackage() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 73 | utilities.assert_equals( expect=main.TRUE, actual=packageResult, |
| 74 | onpass="Test step PASS", |
| 75 | onfail="Test step FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 76 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 77 | main.step( "Uninstall ONOS package on all Nodes" ) |
| 78 | uninstallResult = main.TRUE |
| 79 | for i in range( 1, int( numCtrls ) + 1 ): |
| 80 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 81 | main.log.info( "Unintsalling package on ONOS Node IP: " + ONOS_ip ) |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 82 | u_result = main.ONOSbench.onosUninstall( ONOS_ip ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 83 | utilities.assert_equals( expect=main.TRUE, actual=u_result, |
| 84 | onpass="Test step PASS", |
| 85 | onfail="Test step FAIL" ) |
| 86 | uninstallResult = ( uninstallResult and u_result ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 87 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 88 | main.step( "Removing copy-cat logs from ONOS nodes" ) |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 89 | main.ONOSbench.onosRemoveRaftLogs() |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 90 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 91 | main.step( "Install ONOS package on all Nodes" ) |
| 92 | installResult = main.TRUE |
| 93 | for i in range( 1, int( numCtrls ) + 1 ): |
| 94 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 95 | main.log.info( "Intsalling package on ONOS Node IP: " + ONOS_ip ) |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 96 | i_result = main.ONOSbench.onosInstall( node=ONOS_ip ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 97 | utilities.assert_equals( expect=main.TRUE, actual=i_result, |
| 98 | onpass="Test step PASS", |
| 99 | onfail="Test step FAIL" ) |
| 100 | installResult = ( installResult and i_result ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 101 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 102 | main.step( "Verify ONOS nodes UP status" ) |
| 103 | statusResult = main.TRUE |
| 104 | for i in range( 1, int( numCtrls ) + 1 ): |
| 105 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 106 | main.log.info( "ONOS Node " + ONOS_ip + " status:" ) |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 107 | onos_status = main.ONOSbench.onosStatus( node=ONOS_ip ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 108 | utilities.assert_equals( expect=main.TRUE, actual=onos_status, |
| 109 | onpass="Test step PASS", |
| 110 | onfail="Test step FAIL" ) |
| 111 | statusResult = ( statusResult and onos_status ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 112 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 113 | main.step( "Start ONOS CLI on all nodes" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 114 | cliResult = main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 115 | karafTimeout = "3600000" |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 116 | # need to wait here for sometime. This will be removed once ONOS is |
| 117 | # stable enough |
| 118 | time.sleep( 15 ) |
| 119 | for i in range( 1, int( numCtrls ) + 1 ): |
| 120 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 121 | ONOScli = 'ONOScli' + str( i ) |
| 122 | main.log.info( "ONOS Node " + ONOS_ip + " cli start:" ) |
| 123 | exec "startcli=main." + ONOScli + \ |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 124 | ".startOnosCli(ONOS_ip, karafTimeout=karafTimeout)" |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 125 | utilities.assert_equals( expect=main.TRUE, actual=startcli, |
| 126 | onpass="Test step PASS", |
| 127 | onfail="Test step FAIL" ) |
| 128 | cliResult = ( cliResult and startcli ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 129 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 130 | case1Result = ( cp_result and cell_result |
| 131 | and packageResult and installResult and statusResult and cliResult ) |
| 132 | utilities.assert_equals( expect=main.TRUE, actual=case1Result, |
| 133 | onpass="Set up test environment PASS", |
| 134 | onfail="Set up test environment FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 135 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 136 | def CASE2( self, main ): |
| 137 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 138 | This test script still needs more refactoring |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 139 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 140 | import re |
| 141 | import time |
| 142 | import copy |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 143 | numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ] |
| 144 | ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 145 | ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 146 | ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 147 | ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ] |
| 148 | ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ] |
| 149 | ONOS1_port = main.params[ 'CTRL' ][ 'port1' ] |
| 150 | ONOS2_port = main.params[ 'CTRL' ][ 'port2' ] |
| 151 | ONOS3_port = main.params[ 'CTRL' ][ 'port3' ] |
| 152 | ONOS4_port = main.params[ 'CTRL' ][ 'port4' ] |
| 153 | ONOS5_port = main.params[ 'CTRL' ][ 'port5' ] |
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 | numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ] |
| 156 | main.log.report( |
| 157 | "Assign and Balance all Mininet switches across controllers" ) |
| 158 | main.log.report( |
| 159 | "_________________________________________________________" ) |
| 160 | # need to wait here for sometime. This will be removed once ONOS is |
| 161 | # stable enough |
| 162 | time.sleep( 15 ) |
| 163 | main.case( |
| 164 | "Assign and Balance all Mininet switches across controllers" ) |
| 165 | main.step( "Assign switches to controllers" ) |
| 166 | for i in range( 1, 26 ): # 1 to ( num of switches +1 ) |
Hari Krishna | 083cf7b | 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 ), |
| 169 | count=int( numCtrls ), |
| 170 | ip1=ONOS1_ip, |
| 171 | port1=ONOS1_port, |
| 172 | ip2=ONOS2_ip, |
| 173 | port2=ONOS2_port, |
| 174 | ip3=ONOS3_ip, |
| 175 | port3=ONOS3_port, |
| 176 | ip4=ONOS4_ip, |
| 177 | port4=ONOS4_port, |
| 178 | ip5=ONOS5_ip, |
| 179 | port5=ONOS5_port ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 180 | |
| 181 | switch_mastership = main.TRUE |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 182 | for i in range( 1, 26 ): |
Hari Krishna | 083cf7b | 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 ) ) |
| 185 | if re.search( "tcp:" + 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" ) |
| 194 | time.sleep( 5 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 195 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 196 | main.step( "Balance devices across controllers" ) |
| 197 | for i in range( int( numCtrls ) ): |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 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 |
| 200 | time.sleep( 3 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 201 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -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 |
| 215 | deviceDPIDs = [] |
| 216 | hostMACs = [] |
| 217 | deviceLinks = [] |
| 218 | deviceActiveLinksCount = [] |
| 219 | devicePortsEnabledCount = [] |
| 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 | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 229 | topology_result = main.ONOSbench.getTopology( topology_output ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 230 | numSwitches = topology_result[ 'devices' ] |
| 231 | numLinks = topology_result[ 'links' ] |
| 232 | main.log.info( |
| 233 | "Currently there are %s switches and %s links" % |
| 234 | ( str( numSwitches ), str( numLinks ) ) ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 235 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 236 | main.step( "Store Device DPIDs" ) |
| 237 | for i in range( 1, 26 ): |
| 238 | deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) ) |
| 239 | print "Device DPIDs in Store: \n", str( deviceDPIDs ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 240 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 241 | main.step( "Store Host MACs" ) |
| 242 | for i in range( 1, 26 ): |
| 243 | hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" ) |
| 244 | print "Host MACs in Store: \n", str( hostMACs ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 245 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 246 | main.step( "Collect and store all Devices Links" ) |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 247 | linksResult = main.ONOScli1.links( jsonFormat=False ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 248 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 249 | linksResult = ansi_escape.sub( '', linksResult ) |
| 250 | linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" ) |
| 251 | linksResult = linksResult.splitlines() |
| 252 | linksResult = linksResult[ 1: ] |
| 253 | deviceLinks = copy.copy( linksResult ) |
| 254 | print "Device Links Stored: \n", str( deviceLinks ) |
| 255 | # this will be asserted to check with the params provided count of |
| 256 | # links |
| 257 | print "Length of Links Store", len( deviceLinks ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 258 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 259 | main.step( "Collect and store each Device ports enabled Count" ) |
| 260 | for i in range( 1, 26 ): |
| 261 | portResult = main.ONOScli1.getDevicePortsEnabledCount( |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 262 | "of:00000000000000" + format( i,'02x' ) ) |
| 263 | print portResult |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 264 | portTemp = re.split( r'\t+', portResult ) |
| 265 | portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 266 | devicePortsEnabledCount.append( portCount ) |
| 267 | print "Device Enabled Port Counts Stored: \n", str( devicePortsEnabledCount ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 268 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 269 | main.step( "Collect and store each Device active links Count" ) |
| 270 | for i in range( 1, 26 ): |
| 271 | linkCountResult = main.ONOScli1.getDeviceLinksActiveCount( |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 272 | "of:00000000000000" + format( i,'02x' ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 273 | linkCountTemp = re.split( r'\t+', linkCountResult ) |
| 274 | linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 275 | deviceActiveLinksCount.append( linkCount ) |
| 276 | print "Device Active Links Count Stored: \n", str( deviceActiveLinksCount ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 277 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 278 | # just returning TRUE for now as this one just collects data |
| 279 | caseResult = main.TRUE |
| 280 | utilities.assert_equals( expect=main.TRUE, actual=case1Result, |
| 281 | onpass="Saving ONOS topology data test PASS", |
| 282 | onfail="Saving ONOS topology data test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 283 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 284 | def CASE4( self, main ): |
| 285 | """ |
| 286 | Enable onos-app-fwd, Verify Reactive forwarding through ping all and Disable it |
| 287 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 288 | import re |
| 289 | import copy |
| 290 | import time |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 291 | numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ] |
| 292 | main.log.report( "Enable Reactive forwarding and Verify ping all" ) |
| 293 | main.log.report( "______________________________________________" ) |
| 294 | main.case( "Enable Reactive forwarding and Verify ping all" ) |
| 295 | main.step( "Enable Reactive forwarding" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 296 | installResult = main.TRUE |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 297 | for i in range( 1, int( numCtrls ) + 1 ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 298 | onosFeature = 'onos-app-fwd' |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 299 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 300 | ONOScli = 'ONOScli' + str( i ) |
| 301 | main.log.info( "Enabling Reactive mode on ONOS Node " + ONOS_ip ) |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 302 | exec "inResult=main." + ONOScli + ".featureInstall(onosFeature)" |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 303 | time.sleep( 3 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 304 | installResult = inResult and installResult |
| 305 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 306 | time.sleep( 5 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 307 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 308 | main.step( "Verify Pingall" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 309 | ping_result = main.FALSE |
| 310 | time1 = time.time() |
| 311 | ping_result = main.Mininet1.pingall() |
| 312 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 313 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 314 | main.log.report( |
| 315 | "Time taken for Ping All: " + |
| 316 | str( timeDiff ) + |
| 317 | " seconds" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 318 | |
| 319 | if ping_result == main.TRUE: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 320 | main.log.report( "Pingall Test in Reactive mode successful" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 321 | else: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 322 | main.log.report( "Pingall Test in Reactive mode failed" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 323 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 324 | main.step( "Disable Reactive forwarding" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 325 | uninstallResult = main.TRUE |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 326 | for i in range( 1, int( numCtrls ) + 1 ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 327 | onosFeature = 'onos-app-fwd' |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 328 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 329 | ONOScli = 'ONOScli' + str( i ) |
| 330 | main.log.info( "Disabling Reactive mode on ONOS Node " + ONOS_ip ) |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 331 | exec "unResult=main." + ONOScli + ".featureUninstall(onosFeature)" |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 332 | uninstallResult = unResult and uninstallResult |
| 333 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 334 | # Waiting for reative flows to be cleared. |
| 335 | time.sleep( 10 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 336 | |
| 337 | case3Result = installResult and ping_result and uninstallResult |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 338 | utilities.assert_equals( expect=main.TRUE, actual=case3Result, |
| 339 | onpass="Reactive Mode Pingall test PASS", |
| 340 | onfail="Reactive Mode Pingall test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 341 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 342 | def CASE5( self, main ): |
| 343 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 344 | Compare current ONOS topology with reference data |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 345 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 346 | import re |
| 347 | devicesDPID_tmp = [] |
| 348 | hostMACs_tmp = [] |
| 349 | deviceLinks_tmp = [] |
| 350 | deviceActiveLinksCount_tmp = [] |
| 351 | devicePortsEnabledCount_tmp = [] |
| 352 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 353 | main.log.report( |
| 354 | "Compare ONOS topology with reference data in Stores" ) |
| 355 | main.log.report( "__________________________________________________" ) |
| 356 | main.case( "Compare ONOS topology with reference data" ) |
| 357 | |
| 358 | main.step( "Compare current Device ports enabled with reference" ) |
| 359 | for i in range( 1, 26 ): |
| 360 | portResult = main.ONOScli1.getDevicePortsEnabledCount( |
| 361 | "of:00000000000000" + |
| 362 | format( |
| 363 | i, |
| 364 | '02x' ) ) |
| 365 | portTemp = re.split( r'\t+', portResult ) |
| 366 | portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 367 | devicePortsEnabledCount_tmp.append( portCount ) |
| 368 | time.sleep( 2 ) |
| 369 | print ( |
| 370 | "Device Enabled ports EXPECTED: \n" + |
| 371 | str( devicePortsEnabledCount ) ) |
| 372 | print ( |
| 373 | "Device Enabled ports ACTUAL: \n" + |
| 374 | str( devicePortsEnabledCount_tmp ) ) |
| 375 | if ( cmp( devicePortsEnabledCount, |
| 376 | devicePortsEnabledCount_tmp ) == 0 ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 377 | stepResult1 = main.TRUE |
| 378 | else: |
| 379 | stepResult1 = main.FALSE |
| 380 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 381 | main.step( "Compare Device active links with reference" ) |
| 382 | for i in range( 1, 26 ): |
| 383 | linkResult = main.ONOScli1.getDeviceLinksActiveCount( |
| 384 | "of:00000000000000" + |
| 385 | format( |
| 386 | i, |
| 387 | '02x' ) ) |
| 388 | linkTemp = re.split( r'\t+', linkResult ) |
| 389 | linkCount = linkTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 390 | deviceActiveLinksCount_tmp.append( linkCount ) |
| 391 | time.sleep( 3 ) |
| 392 | print ( |
| 393 | "Device Active links EXPECTED: \n" + |
| 394 | str( deviceActiveLinksCount ) ) |
| 395 | print ( |
| 396 | "Device Active links ACTUAL: \n" + |
| 397 | str( deviceActiveLinksCount_tmp ) ) |
| 398 | if ( cmp( deviceActiveLinksCount, deviceActiveLinksCount_tmp ) == 0 ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 399 | stepResult2 = main.TRUE |
| 400 | else: |
| 401 | stepResult2 = main.FALSE |
| 402 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 403 | """ |
| 404 | place holder for comparing devices, hosts and paths if required. |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 405 | Links and ports data would be incorrect with out devices anyways. |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 406 | """ |
| 407 | caseResult = ( stepResult1 and stepResult2 ) |
| 408 | utilities.assert_equals( expect=main.TRUE, actual=case1Result, |
| 409 | onpass="Compare Topology test PASS", |
| 410 | onfail="Compare Topology test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 411 | if caseResult == main.TRUE: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 412 | main.log.report( "Compare Topology test Pass" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 413 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 414 | def CASE6( self ): |
| 415 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 416 | Install 300 host intents and verify ping all |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 417 | """ |
| 418 | main.log.report( "Add 300 host intents and verify pingall" ) |
| 419 | main.log.report( "_______________________________________" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 420 | import itertools |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 421 | main.case( "Install 300 host intents" ) |
| 422 | main.step( "Add host Intents" ) |
| 423 | intentResult = main.TRUE |
| 424 | hostCombos = list( itertools.combinations( hostMACs, 2 ) ) |
| 425 | for i in range( len( hostCombos ) ): |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 426 | iResult = main.ONOScli1.addHostIntent( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 427 | hostCombos[ i ][ 0 ], |
| 428 | hostCombos[ i ][ 1 ] ) |
| 429 | intentResult = ( intentResult and iResult ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 430 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 431 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 432 | pingResult = main.FALSE |
| 433 | time1 = time.time() |
| 434 | pingResult = main.Mininet1.pingall() |
| 435 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 436 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 437 | main.log.report( |
| 438 | "Time taken for Ping All: " + |
| 439 | str( timeDiff ) + |
| 440 | " seconds" ) |
| 441 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 442 | onpass="PING ALL PASS", |
| 443 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 444 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 445 | case4Result = ( intentResult and pingResult ) |
Hari Krishna | 1c7509b | 2015-01-27 11:23:07 -0800 | [diff] [blame^] | 446 | #case4Result = pingResult |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 447 | utilities.assert_equals( |
| 448 | expect=main.TRUE, |
| 449 | actual=case4Result, |
| 450 | onpass="Install 300 Host Intents and Ping All test PASS", |
| 451 | onfail="Install 300 Host Intents and Ping All test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 452 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 453 | def CASE70( self, main ): |
| 454 | """ |
| 455 | Randomly bring some core links down and verify ping all ( Host Intents Scenario ) |
| 456 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 457 | import random |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 458 | ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 459 | link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ] |
| 460 | link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 461 | link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ] |
| 462 | link2End2 = main.params[ 'CORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 463 | link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ] |
| 464 | link3End2 = main.params[ 'CORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 465 | switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ] |
| 466 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 467 | |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 468 | main.log.report( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 469 | main.log.report( "_________________________________________________________________" ) |
| 470 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 471 | 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] | 472 | if ( int( switchLinksToToggle ) == |
| 473 | 0 or int( switchLinksToToggle ) > 5 ): |
Hari Krishna | 1c7509b | 2015-01-27 11:23:07 -0800 | [diff] [blame^] | 474 | 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] | 475 | main.cleanup() |
| 476 | main.exit() |
| 477 | else: |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 478 | 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] | 479 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 480 | main.step( "Cut links on Core devices using user provided range" ) |
| 481 | randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 482 | randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 483 | randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 484 | for i in range( int( switchLinksToToggle ) ): |
| 485 | main.Mininet1.link( |
| 486 | END1=link1End1, |
| 487 | END2=randomLink1[ i ], |
| 488 | OPTION="down" ) |
| 489 | main.Mininet1.link( |
| 490 | END1=link2End1, |
| 491 | END2=randomLink2[ i ], |
| 492 | OPTION="down" ) |
| 493 | main.Mininet1.link( |
| 494 | END1=link3End1, |
| 495 | END2=randomLink3[ i ], |
| 496 | OPTION="down" ) |
| 497 | time.sleep( link_sleep ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 498 | |
| 499 | topology_output = main.ONOScli2.topology() |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 500 | linkDown = main.ONOSbench.checkStatus( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 501 | topology_output, numSwitches, str( |
| 502 | int( numLinks ) - int( switchLinksToToggle ) * 6 ) ) |
| 503 | utilities.assert_equals( |
| 504 | expect=main.TRUE, |
| 505 | actual=linkDown, |
| 506 | onpass="Link Down discovered properly", |
| 507 | onfail="Link down was not discovered in " + |
| 508 | str( link_sleep ) + |
| 509 | " seconds" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 510 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 511 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 512 | pingResultLinkDown = main.FALSE |
| 513 | time1 = time.time() |
| 514 | pingResultLinkDown = main.Mininet1.pingall() |
| 515 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 516 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 517 | main.log.report( |
| 518 | "Time taken for Ping All: " + |
| 519 | str( timeDiff ) + |
| 520 | " seconds" ) |
| 521 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 522 | onpass="PING ALL PASS", |
| 523 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 524 | |
| 525 | caseResult7 = linkDown and pingResultLinkDown |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 526 | utilities.assert_equals( expect=main.TRUE, actual=caseResult7, |
| 527 | onpass="Random Link cut Test PASS", |
| 528 | onfail="Random Link cut Test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 529 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 530 | def CASE80( self, main ): |
| 531 | """ |
| 532 | Bring the core links up that are down and verify ping all ( Host Intents Scenario ) |
| 533 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 534 | import random |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 535 | ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 536 | link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ] |
| 537 | link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ] |
| 538 | link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ] |
| 539 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 540 | switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 541 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 542 | main.log.report( |
| 543 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 544 | main.log.report( |
| 545 | "__________________________________________________________________" ) |
| 546 | main.case( |
| 547 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 548 | main.step( "Bring randomly cut links on Core devices up" ) |
| 549 | for i in range( int( switchLinksToToggle ) ): |
| 550 | main.Mininet1.link( |
| 551 | END1=link1End1, |
| 552 | END2=randomLink1[ i ], |
| 553 | OPTION="up" ) |
| 554 | main.Mininet1.link( |
| 555 | END1=link2End1, |
| 556 | END2=randomLink2[ i ], |
| 557 | OPTION="up" ) |
| 558 | main.Mininet1.link( |
| 559 | END1=link3End1, |
| 560 | END2=randomLink3[ i ], |
| 561 | OPTION="up" ) |
| 562 | time.sleep( link_sleep ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 563 | |
| 564 | topology_output = main.ONOScli2.topology() |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 565 | linkUp = main.ONOSbench.checkStatus( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 566 | topology_output, |
| 567 | numSwitches, |
| 568 | str( numLinks ) ) |
| 569 | utilities.assert_equals( |
| 570 | expect=main.TRUE, |
| 571 | actual=linkUp, |
| 572 | onpass="Link up discovered properly", |
| 573 | onfail="Link up was not discovered in " + |
| 574 | str( link_sleep ) + |
| 575 | " seconds" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 576 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 577 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 578 | pingResultLinkUp = main.FALSE |
| 579 | time1 = time.time() |
| 580 | pingResultLinkUp = main.Mininet1.pingall() |
| 581 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 582 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 583 | main.log.report( |
| 584 | "Time taken for Ping All: " + |
| 585 | str( timeDiff ) + |
| 586 | " seconds" ) |
| 587 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 588 | onpass="PING ALL PASS", |
| 589 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 590 | |
| 591 | caseResult8 = linkUp and pingResultLinkUp |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 592 | utilities.assert_equals( expect=main.TRUE, actual=caseResult8, |
| 593 | onpass="Link Up Test PASS", |
| 594 | onfail="Link Up Test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 595 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 596 | def CASE71( self, main ): |
| 597 | """ |
| 598 | Randomly bring some core links down and verify ping all ( Point Intents Scenario ) |
| 599 | """ |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 600 | import random |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 601 | ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 602 | link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ] |
| 603 | link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 604 | link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ] |
| 605 | link2End2 = main.params[ 'CORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 606 | link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ] |
| 607 | link3End2 = main.params[ 'CORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 608 | switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ] |
| 609 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 610 | |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 611 | main.log.report( "Point Intents - Randomly bring some core links down and verify ping all" ) |
| 612 | main.log.report( "__________________________________________________________________" ) |
| 613 | main.case( "Point Intents - Randomly bring some core links down and verify ping all" ) |
| 614 | 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] | 615 | if ( int( switchLinksToToggle ) == |
| 616 | 0 or int( switchLinksToToggle ) > 5 ): |
| 617 | main.log.info( |
| 618 | "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] | 619 | main.cleanup() |
| 620 | main.exit() |
| 621 | else: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 622 | main.log.info( |
| 623 | "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] | 624 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 625 | main.step( "Cut links on Core devices using user provided range" ) |
| 626 | randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 627 | randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 628 | randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 629 | for i in range( int( switchLinksToToggle ) ): |
| 630 | main.Mininet1.link( |
| 631 | END1=link1End1, |
| 632 | END2=randomLink1[ i ], |
| 633 | OPTION="down" ) |
| 634 | main.Mininet1.link( |
| 635 | END1=link2End1, |
| 636 | END2=randomLink2[ i ], |
| 637 | OPTION="down" ) |
| 638 | main.Mininet1.link( |
| 639 | END1=link3End1, |
| 640 | END2=randomLink3[ i ], |
| 641 | OPTION="down" ) |
| 642 | time.sleep( link_sleep ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 643 | |
| 644 | topology_output = main.ONOScli2.topology() |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 645 | linkDown = main.ONOSbench.checkStatus( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 646 | topology_output, numSwitches, str( |
| 647 | int( numLinks ) - int( switchLinksToToggle ) * 6 ) ) |
| 648 | utilities.assert_equals( |
| 649 | expect=main.TRUE, |
| 650 | actual=linkDown, |
| 651 | onpass="Link Down discovered properly", |
| 652 | onfail="Link down was not discovered in " + |
| 653 | str( link_sleep ) + |
| 654 | " seconds" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 655 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 656 | main.step( "Verify Ping across all hosts" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 657 | pingResultLinkDown = main.FALSE |
| 658 | time1 = time.time() |
| 659 | pingResultLinkDown = main.Mininet1.pingall() |
| 660 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 661 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 662 | main.log.report( |
| 663 | "Time taken for Ping All: " + |
| 664 | str( timeDiff ) + |
| 665 | " seconds" ) |
| 666 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 667 | onpass="PING ALL PASS", |
| 668 | onfail="PING ALL FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 669 | |
| 670 | caseResult7 = linkDown and pingResultLinkDown |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 671 | utilities.assert_equals( expect=main.TRUE, actual=caseResult7, |
| 672 | onpass="Random Link cut Test PASS", |
| 673 | onfail="Random Link cut Test FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 674 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 675 | def CASE81( self, main ): |
| 676 | """ |
| 677 | Bring the core links up that are down and verify ping all ( Point Intents Scenario ) |
| 678 | """ |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 679 | import random |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 680 | ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 681 | link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ] |
| 682 | link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ] |
| 683 | link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ] |
| 684 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 685 | switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ] |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 686 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 687 | main.log.report( |
| 688 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 689 | main.log.report( |
| 690 | "___________________________________________________________________" ) |
| 691 | main.case( |
| 692 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 693 | main.step( "Bring randomly cut links on Core devices up" ) |
| 694 | for i in range( int( switchLinksToToggle ) ): |
| 695 | main.Mininet1.link( |
| 696 | END1=link1End1, |
| 697 | END2=randomLink1[ i ], |
| 698 | OPTION="up" ) |
| 699 | main.Mininet1.link( |
| 700 | END1=link2End1, |
| 701 | END2=randomLink2[ i ], |
| 702 | OPTION="up" ) |
| 703 | main.Mininet1.link( |
| 704 | END1=link3End1, |
| 705 | END2=randomLink3[ i ], |
| 706 | OPTION="up" ) |
| 707 | time.sleep( link_sleep ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 708 | |
| 709 | topology_output = main.ONOScli2.topology() |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 710 | linkUp = main.ONOSbench.checkStatus( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 711 | topology_output, |
| 712 | numSwitches, |
| 713 | str( numLinks ) ) |
| 714 | utilities.assert_equals( |
| 715 | expect=main.TRUE, |
| 716 | actual=linkUp, |
| 717 | onpass="Link up discovered properly", |
| 718 | onfail="Link up was not discovered in " + |
| 719 | str( link_sleep ) + |
| 720 | " seconds" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 721 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 722 | main.step( "Verify Ping across all hosts" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 723 | pingResultLinkUp = main.FALSE |
| 724 | time1 = time.time() |
| 725 | pingResultLinkUp = main.Mininet1.pingall() |
| 726 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 727 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 728 | main.log.report( |
| 729 | "Time taken for Ping All: " + |
| 730 | str( timeDiff ) + |
| 731 | " seconds" ) |
| 732 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 733 | onpass="PING ALL PASS", |
| 734 | onfail="PING ALL FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 735 | |
| 736 | caseResult8 = linkUp and pingResultLinkUp |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 737 | utilities.assert_equals( expect=main.TRUE, actual=caseResult8, |
| 738 | onpass="Link Up Test PASS", |
| 739 | onfail="Link Up Test FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 740 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 741 | def CASE9( self ): |
| 742 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 743 | Install 114 point intents and verify Ping all works |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 744 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 745 | import copy |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 746 | main.log.report( "Install 114 point intents and verify Ping all" ) |
| 747 | main.log.report( "___________________________________________" ) |
| 748 | main.case( "Install 114 point intents and Ping all" ) |
| 749 | deviceLinks_copy = copy.copy( deviceLinks ) |
| 750 | main.step( "Install 114 point intents" ) |
| 751 | for i in range( len( deviceLinks_copy ) ): |
| 752 | pointLink = str( |
| 753 | deviceLinks_copy[ i ] ).replace( |
| 754 | "src=", |
| 755 | "" ).replace( |
| 756 | "dst=", |
| 757 | "" ).split( ',' ) |
| 758 | point1 = pointLink[ 0 ].split( '/' ) |
| 759 | point2 = pointLink[ 1 ].split( '/' ) |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 760 | installResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 761 | point1[ 0 ], point2[ 0 ], int( |
| 762 | point1[ 1 ] ), int( |
| 763 | point2[ 1 ] ) ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 764 | if installResult == main.TRUE: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 765 | 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] | 766 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 767 | main.step( "Obtain the intent id's" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 768 | intentsList = main.ONOScli1.getAllIntentIds() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 769 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 770 | intentsList = ansi_escape.sub( '', intentsList ) |
| 771 | intentsList = intentsList.replace( |
| 772 | " onos:intents | grep id=", |
| 773 | "" ).replace( |
| 774 | "id=", |
| 775 | "" ).replace( |
| 776 | "\r\r", |
| 777 | "" ) |
| 778 | intentsList = intentsList.splitlines() |
| 779 | intentsList = intentsList[ 1: ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 780 | intentIdList = [] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 781 | for i in range( len( intentsList ) ): |
| 782 | intentsTemp = intentsList[ i ].split( ',' ) |
| 783 | intentIdList.append( intentsTemp[ 0 ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 784 | print "Intent IDs: ", intentIdList |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 785 | print "Total Intents installed: ", len( intentIdList ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 786 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 787 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 788 | pingResult = main.FALSE |
| 789 | time1 = time.time() |
| 790 | pingResult = main.Mininet1.pingall() |
| 791 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 792 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 793 | main.log.report( |
| 794 | "Time taken for Ping All: " + |
| 795 | str( timeDiff ) + |
| 796 | " seconds" ) |
| 797 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 798 | onpass="PING ALL PASS", |
| 799 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 800 | |
| 801 | case8_result = installResult and pingResult |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 802 | utilities.assert_equals( |
| 803 | expect=main.TRUE, |
| 804 | actual=case8_result, |
| 805 | onpass="Ping all test after Point intents addition successful", |
| 806 | onfail="Ping all test after Point intents addition failed" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 807 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 808 | def CASE10( self ): |
| 809 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 810 | Remove all Intents |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 811 | """ |
| 812 | main.log.report( "Remove all intents that were installed previously" ) |
| 813 | main.log.report( "______________________________________________" ) |
| 814 | main.log.info( "Remove all intents" ) |
| 815 | main.case( "Removing intents" ) |
| 816 | main.step( "Obtain the intent id's first" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 817 | intentsList = main.ONOScli1.getAllIntentIds() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 818 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 819 | intentsList = ansi_escape.sub( '', intentsList ) |
| 820 | intentsList = intentsList.replace( |
| 821 | " onos:intents | grep id=", |
| 822 | "" ).replace( |
| 823 | "id=", |
| 824 | "" ).replace( |
| 825 | "\r\r", |
| 826 | "" ) |
| 827 | intentsList = intentsList.splitlines() |
| 828 | intentsList = intentsList[ 1: ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 829 | intentIdList = [] |
| 830 | step1Result = main.TRUE |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 831 | if ( len( intentsList ) > 1 ): |
| 832 | for i in range( len( intentsList ) ): |
| 833 | intentsTemp = intentsList[ i ].split( ',' ) |
| 834 | intentIdList.append( intentsTemp[ 0 ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 835 | print "Intent IDs: ", intentIdList |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 836 | for id in range( len( intentIdList ) ): |
| 837 | print "Removing intent id (round 1) :", intentIdList[ id ] |
Hari Krishna | 1c7509b | 2015-01-27 11:23:07 -0800 | [diff] [blame^] | 838 | main.ONOScli1.removeIntent( intentId=intentIdList[ id ] ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 839 | time.sleep( 1 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 840 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 841 | main.log.info( |
| 842 | "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] | 843 | intentsList1 = main.ONOScli1.getAllIntentIds() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 844 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 845 | intentsList1 = ansi_escape.sub( '', intentsList1 ) |
| 846 | intentsList1 = intentsList1.replace( |
| 847 | " onos:intents | grep id=", |
| 848 | "" ).replace( |
| 849 | " state=", |
| 850 | "" ).replace( |
| 851 | "\r\r", |
| 852 | "" ) |
| 853 | intentsList1 = intentsList1.splitlines() |
| 854 | intentsList1 = intentsList1[ 1: ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 855 | print "Round 2 (leftover) intents to remove: ", intentsList1 |
| 856 | intentIdList1 = [] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 857 | if ( len( intentsList1 ) > 1 ): |
| 858 | for i in range( len( intentsList1 ) ): |
| 859 | intentsTemp1 = intentsList[ i ].split( ',' ) |
| 860 | intentIdList1.append( intentsTemp1[ 0 ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 861 | print "Leftover Intent IDs: ", intentIdList1 |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 862 | for id in range( len( intentIdList1 ) ): |
| 863 | print "Removing intent id (round 2):", intentIdList1[ id ] |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 864 | main.ONOScli1.removeIntent( |
Hari Krishna | 1c7509b | 2015-01-27 11:23:07 -0800 | [diff] [blame^] | 865 | intentId=intentIdList1[ id ] ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 866 | time.sleep( 2 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 867 | else: |
| 868 | print "There are no more intents that need to be removed" |
| 869 | step1Result = main.TRUE |
| 870 | else: |
| 871 | print "No Intent IDs found in Intents list: ", intentsList |
| 872 | step1Result = main.FALSE |
| 873 | |
| 874 | caseResult7 = step1Result |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 875 | utilities.assert_equals( expect=main.TRUE, actual=caseResult7, |
| 876 | onpass="Intent removal test successful", |
| 877 | onfail="Intent removal test failed" ) |