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 ) |
| 446 | utilities.assert_equals( |
| 447 | expect=main.TRUE, |
| 448 | actual=case4Result, |
| 449 | onpass="Install 300 Host Intents and Ping All test PASS", |
| 450 | onfail="Install 300 Host Intents and Ping All test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 451 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 452 | def CASE70( self, main ): |
| 453 | """ |
| 454 | Randomly bring some core links down and verify ping all ( Host Intents Scenario ) |
| 455 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 456 | import random |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 457 | ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 458 | link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ] |
| 459 | link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 460 | link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ] |
| 461 | link2End2 = main.params[ 'CORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 462 | link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ] |
| 463 | link3End2 = main.params[ 'CORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 464 | switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ] |
| 465 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 466 | |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame^] | 467 | main.log.report( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 468 | main.log.report( "_________________________________________________________________" ) |
| 469 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 470 | 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] | 471 | if ( int( switchLinksToToggle ) == |
| 472 | 0 or int( switchLinksToToggle ) > 5 ): |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame^] | 473 | main.log.info( "Please check you 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] | 474 | main.cleanup() |
| 475 | main.exit() |
| 476 | else: |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame^] | 477 | 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] | 478 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 479 | main.step( "Cut links on Core devices using user provided range" ) |
| 480 | randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 481 | randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 482 | randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 483 | for i in range( int( switchLinksToToggle ) ): |
| 484 | main.Mininet1.link( |
| 485 | END1=link1End1, |
| 486 | END2=randomLink1[ i ], |
| 487 | OPTION="down" ) |
| 488 | main.Mininet1.link( |
| 489 | END1=link2End1, |
| 490 | END2=randomLink2[ i ], |
| 491 | OPTION="down" ) |
| 492 | main.Mininet1.link( |
| 493 | END1=link3End1, |
| 494 | END2=randomLink3[ i ], |
| 495 | OPTION="down" ) |
| 496 | time.sleep( link_sleep ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 497 | |
| 498 | topology_output = main.ONOScli2.topology() |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame^] | 499 | linkDown = main.ONOSbench.checkStatus( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 500 | topology_output, numSwitches, str( |
| 501 | int( numLinks ) - int( switchLinksToToggle ) * 6 ) ) |
| 502 | utilities.assert_equals( |
| 503 | expect=main.TRUE, |
| 504 | actual=linkDown, |
| 505 | onpass="Link Down discovered properly", |
| 506 | onfail="Link down was not discovered in " + |
| 507 | str( link_sleep ) + |
| 508 | " seconds" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 509 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 510 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 511 | pingResultLinkDown = main.FALSE |
| 512 | time1 = time.time() |
| 513 | pingResultLinkDown = main.Mininet1.pingall() |
| 514 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 515 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 516 | main.log.report( |
| 517 | "Time taken for Ping All: " + |
| 518 | str( timeDiff ) + |
| 519 | " seconds" ) |
| 520 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 521 | onpass="PING ALL PASS", |
| 522 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 523 | |
| 524 | caseResult7 = linkDown and pingResultLinkDown |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 525 | utilities.assert_equals( expect=main.TRUE, actual=caseResult7, |
| 526 | onpass="Random Link cut Test PASS", |
| 527 | onfail="Random Link cut Test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 528 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 529 | def CASE80( self, main ): |
| 530 | """ |
| 531 | Bring the core links up that are down and verify ping all ( Host Intents Scenario ) |
| 532 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 533 | import random |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 534 | ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 535 | link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ] |
| 536 | link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ] |
| 537 | link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ] |
| 538 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 539 | switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 540 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 541 | main.log.report( |
| 542 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 543 | main.log.report( |
| 544 | "__________________________________________________________________" ) |
| 545 | main.case( |
| 546 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 547 | main.step( "Bring randomly cut links on Core devices up" ) |
| 548 | for i in range( int( switchLinksToToggle ) ): |
| 549 | main.Mininet1.link( |
| 550 | END1=link1End1, |
| 551 | END2=randomLink1[ i ], |
| 552 | OPTION="up" ) |
| 553 | main.Mininet1.link( |
| 554 | END1=link2End1, |
| 555 | END2=randomLink2[ i ], |
| 556 | OPTION="up" ) |
| 557 | main.Mininet1.link( |
| 558 | END1=link3End1, |
| 559 | END2=randomLink3[ i ], |
| 560 | OPTION="up" ) |
| 561 | time.sleep( link_sleep ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 562 | |
| 563 | topology_output = main.ONOScli2.topology() |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame^] | 564 | linkUp = main.ONOSbench.checkStatus( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 565 | topology_output, |
| 566 | numSwitches, |
| 567 | str( numLinks ) ) |
| 568 | utilities.assert_equals( |
| 569 | expect=main.TRUE, |
| 570 | actual=linkUp, |
| 571 | onpass="Link up discovered properly", |
| 572 | onfail="Link up was not discovered in " + |
| 573 | str( link_sleep ) + |
| 574 | " seconds" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 575 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 576 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 577 | pingResultLinkUp = main.FALSE |
| 578 | time1 = time.time() |
| 579 | pingResultLinkUp = main.Mininet1.pingall() |
| 580 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 581 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 582 | main.log.report( |
| 583 | "Time taken for Ping All: " + |
| 584 | str( timeDiff ) + |
| 585 | " seconds" ) |
| 586 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 587 | onpass="PING ALL PASS", |
| 588 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 589 | |
| 590 | caseResult8 = linkUp and pingResultLinkUp |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 591 | utilities.assert_equals( expect=main.TRUE, actual=caseResult8, |
| 592 | onpass="Link Up Test PASS", |
| 593 | onfail="Link Up Test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 594 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 595 | def CASE71( self, main ): |
| 596 | """ |
| 597 | Randomly bring some core links down and verify ping all ( Point Intents Scenario ) |
| 598 | """ |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 599 | import random |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 600 | ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 601 | link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ] |
| 602 | link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 603 | link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ] |
| 604 | link2End2 = main.params[ 'CORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 605 | link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ] |
| 606 | link3End2 = main.params[ 'CORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 607 | switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ] |
| 608 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 609 | |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame^] | 610 | main.log.report( "Point Intents - Randomly bring some core links down and verify ping all" ) |
| 611 | main.log.report( "__________________________________________________________________" ) |
| 612 | main.case( "Point Intents - Randomly bring some core links down and verify ping all" ) |
| 613 | 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] | 614 | if ( int( switchLinksToToggle ) == |
| 615 | 0 or int( switchLinksToToggle ) > 5 ): |
| 616 | main.log.info( |
| 617 | "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] | 618 | main.cleanup() |
| 619 | main.exit() |
| 620 | else: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 621 | main.log.info( |
| 622 | "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] | 623 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 624 | main.step( "Cut links on Core devices using user provided range" ) |
| 625 | randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 626 | randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 627 | randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 628 | for i in range( int( switchLinksToToggle ) ): |
| 629 | main.Mininet1.link( |
| 630 | END1=link1End1, |
| 631 | END2=randomLink1[ i ], |
| 632 | OPTION="down" ) |
| 633 | main.Mininet1.link( |
| 634 | END1=link2End1, |
| 635 | END2=randomLink2[ i ], |
| 636 | OPTION="down" ) |
| 637 | main.Mininet1.link( |
| 638 | END1=link3End1, |
| 639 | END2=randomLink3[ i ], |
| 640 | OPTION="down" ) |
| 641 | time.sleep( link_sleep ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 642 | |
| 643 | topology_output = main.ONOScli2.topology() |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame^] | 644 | linkDown = main.ONOSbench.checkStatus( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 645 | topology_output, numSwitches, str( |
| 646 | int( numLinks ) - int( switchLinksToToggle ) * 6 ) ) |
| 647 | utilities.assert_equals( |
| 648 | expect=main.TRUE, |
| 649 | actual=linkDown, |
| 650 | onpass="Link Down discovered properly", |
| 651 | onfail="Link down was not discovered in " + |
| 652 | str( link_sleep ) + |
| 653 | " seconds" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 654 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 655 | main.step( "Verify Ping across all hosts" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 656 | pingResultLinkDown = main.FALSE |
| 657 | time1 = time.time() |
| 658 | pingResultLinkDown = main.Mininet1.pingall() |
| 659 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 660 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 661 | main.log.report( |
| 662 | "Time taken for Ping All: " + |
| 663 | str( timeDiff ) + |
| 664 | " seconds" ) |
| 665 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 666 | onpass="PING ALL PASS", |
| 667 | onfail="PING ALL FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 668 | |
| 669 | caseResult7 = linkDown and pingResultLinkDown |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 670 | utilities.assert_equals( expect=main.TRUE, actual=caseResult7, |
| 671 | onpass="Random Link cut Test PASS", |
| 672 | onfail="Random Link cut Test FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 673 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 674 | def CASE81( self, main ): |
| 675 | """ |
| 676 | Bring the core links up that are down and verify ping all ( Point Intents Scenario ) |
| 677 | """ |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 678 | import random |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 679 | ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 680 | link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ] |
| 681 | link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ] |
| 682 | link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ] |
| 683 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 684 | switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ] |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 685 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 686 | main.log.report( |
| 687 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 688 | main.log.report( |
| 689 | "___________________________________________________________________" ) |
| 690 | main.case( |
| 691 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 692 | main.step( "Bring randomly cut links on Core devices up" ) |
| 693 | for i in range( int( switchLinksToToggle ) ): |
| 694 | main.Mininet1.link( |
| 695 | END1=link1End1, |
| 696 | END2=randomLink1[ i ], |
| 697 | OPTION="up" ) |
| 698 | main.Mininet1.link( |
| 699 | END1=link2End1, |
| 700 | END2=randomLink2[ i ], |
| 701 | OPTION="up" ) |
| 702 | main.Mininet1.link( |
| 703 | END1=link3End1, |
| 704 | END2=randomLink3[ i ], |
| 705 | OPTION="up" ) |
| 706 | time.sleep( link_sleep ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 707 | |
| 708 | topology_output = main.ONOScli2.topology() |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame^] | 709 | linkUp = main.ONOSbench.checkStatus( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 710 | topology_output, |
| 711 | numSwitches, |
| 712 | str( numLinks ) ) |
| 713 | utilities.assert_equals( |
| 714 | expect=main.TRUE, |
| 715 | actual=linkUp, |
| 716 | onpass="Link up discovered properly", |
| 717 | onfail="Link up was not discovered in " + |
| 718 | str( link_sleep ) + |
| 719 | " seconds" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 720 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 721 | main.step( "Verify Ping across all hosts" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 722 | pingResultLinkUp = main.FALSE |
| 723 | time1 = time.time() |
| 724 | pingResultLinkUp = main.Mininet1.pingall() |
| 725 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 726 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 727 | main.log.report( |
| 728 | "Time taken for Ping All: " + |
| 729 | str( timeDiff ) + |
| 730 | " seconds" ) |
| 731 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 732 | onpass="PING ALL PASS", |
| 733 | onfail="PING ALL FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 734 | |
| 735 | caseResult8 = linkUp and pingResultLinkUp |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 736 | utilities.assert_equals( expect=main.TRUE, actual=caseResult8, |
| 737 | onpass="Link Up Test PASS", |
| 738 | onfail="Link Up Test FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 739 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 740 | def CASE9( self ): |
| 741 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 742 | Install 114 point intents and verify Ping all works |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 743 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 744 | import copy |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 745 | main.log.report( "Install 114 point intents and verify Ping all" ) |
| 746 | main.log.report( "___________________________________________" ) |
| 747 | main.case( "Install 114 point intents and Ping all" ) |
| 748 | deviceLinks_copy = copy.copy( deviceLinks ) |
| 749 | main.step( "Install 114 point intents" ) |
| 750 | for i in range( len( deviceLinks_copy ) ): |
| 751 | pointLink = str( |
| 752 | deviceLinks_copy[ i ] ).replace( |
| 753 | "src=", |
| 754 | "" ).replace( |
| 755 | "dst=", |
| 756 | "" ).split( ',' ) |
| 757 | point1 = pointLink[ 0 ].split( '/' ) |
| 758 | point2 = pointLink[ 1 ].split( '/' ) |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame^] | 759 | installResult = main.ONOScli1.addPointIntent( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 760 | point1[ 0 ], point2[ 0 ], int( |
| 761 | point1[ 1 ] ), int( |
| 762 | point2[ 1 ] ) ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 763 | if installResult == main.TRUE: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 764 | 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] | 765 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 766 | main.step( "Obtain the intent id's" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 767 | intentsList = main.ONOScli1.getAllIntentIds() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 768 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 769 | intentsList = ansi_escape.sub( '', intentsList ) |
| 770 | intentsList = intentsList.replace( |
| 771 | " onos:intents | grep id=", |
| 772 | "" ).replace( |
| 773 | "id=", |
| 774 | "" ).replace( |
| 775 | "\r\r", |
| 776 | "" ) |
| 777 | intentsList = intentsList.splitlines() |
| 778 | intentsList = intentsList[ 1: ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 779 | intentIdList = [] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 780 | for i in range( len( intentsList ) ): |
| 781 | intentsTemp = intentsList[ i ].split( ',' ) |
| 782 | intentIdList.append( intentsTemp[ 0 ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 783 | print "Intent IDs: ", intentIdList |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 784 | print "Total Intents installed: ", len( intentIdList ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 785 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 786 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 787 | pingResult = main.FALSE |
| 788 | time1 = time.time() |
| 789 | pingResult = main.Mininet1.pingall() |
| 790 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 791 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 792 | main.log.report( |
| 793 | "Time taken for Ping All: " + |
| 794 | str( timeDiff ) + |
| 795 | " seconds" ) |
| 796 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 797 | onpass="PING ALL PASS", |
| 798 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 799 | |
| 800 | case8_result = installResult and pingResult |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 801 | utilities.assert_equals( |
| 802 | expect=main.TRUE, |
| 803 | actual=case8_result, |
| 804 | onpass="Ping all test after Point intents addition successful", |
| 805 | onfail="Ping all test after Point intents addition failed" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 806 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 807 | def CASE10( self ): |
| 808 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 809 | Remove all Intents |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 810 | """ |
| 811 | main.log.report( "Remove all intents that were installed previously" ) |
| 812 | main.log.report( "______________________________________________" ) |
| 813 | main.log.info( "Remove all intents" ) |
| 814 | main.case( "Removing intents" ) |
| 815 | main.step( "Obtain the intent id's first" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 816 | intentsList = main.ONOScli1.getAllIntentIds() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 817 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 818 | intentsList = ansi_escape.sub( '', intentsList ) |
| 819 | intentsList = intentsList.replace( |
| 820 | " onos:intents | grep id=", |
| 821 | "" ).replace( |
| 822 | "id=", |
| 823 | "" ).replace( |
| 824 | "\r\r", |
| 825 | "" ) |
| 826 | intentsList = intentsList.splitlines() |
| 827 | intentsList = intentsList[ 1: ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 828 | intentIdList = [] |
| 829 | step1Result = main.TRUE |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 830 | if ( len( intentsList ) > 1 ): |
| 831 | for i in range( len( intentsList ) ): |
| 832 | intentsTemp = intentsList[ i ].split( ',' ) |
| 833 | intentIdList.append( intentsTemp[ 0 ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 834 | print "Intent IDs: ", intentIdList |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 835 | for id in range( len( intentIdList ) ): |
| 836 | print "Removing intent id (round 1) :", intentIdList[ id ] |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame^] | 837 | main.ONOScli1.removeIntent( intent_id=intentIdList[ id ] ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 838 | time.sleep( 1 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 839 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 840 | main.log.info( |
| 841 | "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] | 842 | intentsList1 = main.ONOScli1.getAllIntentIds() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 843 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 844 | intentsList1 = ansi_escape.sub( '', intentsList1 ) |
| 845 | intentsList1 = intentsList1.replace( |
| 846 | " onos:intents | grep id=", |
| 847 | "" ).replace( |
| 848 | " state=", |
| 849 | "" ).replace( |
| 850 | "\r\r", |
| 851 | "" ) |
| 852 | intentsList1 = intentsList1.splitlines() |
| 853 | intentsList1 = intentsList1[ 1: ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 854 | print "Round 2 (leftover) intents to remove: ", intentsList1 |
| 855 | intentIdList1 = [] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 856 | if ( len( intentsList1 ) > 1 ): |
| 857 | for i in range( len( intentsList1 ) ): |
| 858 | intentsTemp1 = intentsList[ i ].split( ',' ) |
| 859 | intentIdList1.append( intentsTemp1[ 0 ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 860 | print "Leftover Intent IDs: ", intentIdList1 |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 861 | for id in range( len( intentIdList1 ) ): |
| 862 | print "Removing intent id (round 2):", intentIdList1[ id ] |
Hari Krishna | 083cf7b | 2015-01-24 19:30:14 -0800 | [diff] [blame^] | 863 | main.ONOScli1.removeIntent( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 864 | intent_id=intentIdList1[ id ] ) |
| 865 | time.sleep( 2 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 866 | else: |
| 867 | print "There are no more intents that need to be removed" |
| 868 | step1Result = main.TRUE |
| 869 | else: |
| 870 | print "No Intent IDs found in Intents list: ", intentsList |
| 871 | step1Result = main.FALSE |
| 872 | |
| 873 | caseResult7 = step1Result |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 874 | utilities.assert_equals( expect=main.TRUE, actual=caseResult7, |
| 875 | onpass="Intent removal test successful", |
| 876 | onfail="Intent removal test failed" ) |