kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1 | |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 2 | import sys |
| 3 | import os |
| 4 | import re |
| 5 | import time |
| 6 | import json |
| 7 | import itertools |
| 8 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 9 | |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 10 | class OnosCHO: |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 11 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 12 | def __init__( self ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 13 | self.default = '' |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 14 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 15 | def CASE1( self, main ): |
| 16 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 17 | Startup sequence: |
| 18 | git pull |
| 19 | mvn clean install |
| 20 | onos-package |
| 21 | cell <name> |
| 22 | onos-verify-cell |
| 23 | onos-install -f |
| 24 | onos-wait-for-start |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 25 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 26 | import time |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 27 | |
| 28 | global intentState |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 29 | main.threadID = 0 |
| 30 | main.pingTimeout = 300 |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 31 | main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ] |
| 32 | main.ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 33 | main.ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 34 | main.ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 35 | main.ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ] |
| 36 | main.ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ] |
| 37 | main.ONOS1_port = main.params[ 'CTRL' ][ 'port1' ] |
| 38 | main.ONOS2_port = main.params[ 'CTRL' ][ 'port2' ] |
| 39 | main.ONOS3_port = main.params[ 'CTRL' ][ 'port3' ] |
| 40 | main.ONOS4_port = main.params[ 'CTRL' ][ 'port4' ] |
| 41 | main.ONOS5_port = main.params[ 'CTRL' ][ 'port5' ] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 42 | cell_name = main.params[ 'ENV' ][ 'cellName' ] |
| 43 | git_pull = main.params[ 'GIT' ][ 'autoPull' ] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 44 | git_branch = main.params[ 'GIT' ][ 'branch' ] |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 45 | main.newTopo = "" |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 46 | main.CLIs = [] |
| 47 | main.nodes = [] |
| 48 | for i in range( 1, int(main.numCtrls) + 1 ): |
| 49 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
| 50 | main.nodes.append( getattr( main, 'ONOS' + str( i ) ) ) |
| 51 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 52 | main.case( "Set up test environment" ) |
| 53 | main.log.report( "Set up test environment" ) |
| 54 | main.log.report( "_______________________" ) |
| 55 | |
| 56 | main.step( "Git checkout and pull " + git_branch ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 57 | if git_pull == 'on': |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 58 | checkout_result = main.ONOSbench.gitCheckout( git_branch ) |
| 59 | pull_result = main.ONOSbench.gitPull() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 60 | cp_result = ( checkout_result and pull_result ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 61 | else: |
| 62 | checkout_result = main.TRUE |
| 63 | pull_result = main.TRUE |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 64 | main.log.info( "Skipped git checkout and pull" ) |
| 65 | cp_result = ( checkout_result and pull_result ) |
| 66 | utilities.assert_equals( expect=main.TRUE, actual=cp_result, |
| 67 | onpass="Test step PASS", |
| 68 | onfail="Test step FAIL" ) |
| 69 | |
| 70 | main.step( "mvn clean & install" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 71 | if git_pull == 'on': |
| 72 | mvn_result = main.ONOSbench.cleanInstall() |
| 73 | utilities.assert_equals( expect=main.TRUE, actual=mvn_result, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 74 | onpass="Test step PASS", |
| 75 | onfail="Test step FAIL" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 76 | else: |
| 77 | mvn_result = main.TRUE |
| 78 | main.log.info("Skipped mvn clean install as git pull is disabled in params file") |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 79 | |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 80 | main.ONOSbench.getVersion( report=True ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 81 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 82 | main.step( "Apply Cell environment for ONOS" ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 83 | cell_result = main.ONOSbench.setCell( cell_name ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 84 | utilities.assert_equals( expect=main.TRUE, actual=cell_result, |
| 85 | onpass="Test step PASS", |
| 86 | onfail="Test step FAIL" ) |
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( "Create ONOS package" ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 89 | packageResult = main.ONOSbench.onosPackage() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 90 | utilities.assert_equals( expect=main.TRUE, actual=packageResult, |
| 91 | onpass="Test step PASS", |
| 92 | onfail="Test step FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 93 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 94 | main.step( "Uninstall ONOS package on all Nodes" ) |
| 95 | uninstallResult = main.TRUE |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 96 | for i in range( 1, int( main.numCtrls ) + 1 ): |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 97 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 98 | main.log.info( "Uninstalling package on ONOS Node IP: " + ONOS_ip ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 99 | u_result = main.ONOSbench.onosUninstall( ONOS_ip ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 100 | utilities.assert_equals( expect=main.TRUE, actual=u_result, |
| 101 | onpass="Test step PASS", |
| 102 | onfail="Test step FAIL" ) |
| 103 | uninstallResult = ( uninstallResult and u_result ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 104 | |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 105 | #main.step( "Removing copy-cat logs from ONOS nodes" ) |
| 106 | #main.ONOSbench.onosRemoveRaftLogs() |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 107 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 108 | main.step( "Install ONOS package on all Nodes" ) |
| 109 | installResult = main.TRUE |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 110 | for i in range( 1, int( main.numCtrls ) + 1 ): |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 111 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 112 | main.log.info( "Intsalling package on ONOS Node IP: " + ONOS_ip ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 113 | i_result = main.ONOSbench.onosInstall( node=ONOS_ip ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 114 | utilities.assert_equals( expect=main.TRUE, actual=i_result, |
| 115 | onpass="Test step PASS", |
| 116 | onfail="Test step FAIL" ) |
| 117 | installResult = ( installResult and i_result ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 118 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 119 | main.step( "Verify ONOS nodes UP status" ) |
| 120 | statusResult = main.TRUE |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 121 | for i in range( 1, int( main.numCtrls ) + 1 ): |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 122 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 123 | main.log.info( "ONOS Node " + ONOS_ip + " status:" ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 124 | onos_status = main.ONOSbench.onosStatus( node=ONOS_ip ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 125 | utilities.assert_equals( expect=main.TRUE, actual=onos_status, |
| 126 | onpass="Test step PASS", |
| 127 | onfail="Test step FAIL" ) |
| 128 | statusResult = ( statusResult and onos_status ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 129 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 130 | main.step( "Start ONOS CLI on all nodes" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 131 | cliResult = main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 132 | karafTimeout = "3600000" |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 133 | # need to wait here for sometime. This will be removed once ONOS is |
| 134 | # stable enough |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 135 | time.sleep( 25 ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 136 | main.log.step(" Start ONOS cli using thread ") |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 137 | startCliResult = main.TRUE |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 138 | pool = [] |
| 139 | time1 = time.time() |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 140 | for i in range( int( main.numCtrls) ): |
| 141 | t = main.Thread( target=main.CLIs[i].startOnosCli, |
| 142 | threadID=main.threadID, |
| 143 | name="startOnosCli", |
| 144 | args=[ main.nodes[i].ip_address ] ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 145 | pool.append(t) |
| 146 | t.start() |
| 147 | main.threadID = main.threadID + 1 |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 148 | for t in pool: |
| 149 | t.join() |
| 150 | startCliResult = startCliResult and t.result |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 151 | time2 = time.time() |
| 152 | |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 153 | if not startCliResult: |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 154 | main.log.info("ONOS CLI did not start up properly") |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 155 | #main.cleanup() |
| 156 | #main.exit() |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 157 | else: |
| 158 | main.log.info("Successful CLI startup") |
| 159 | startCliResult = main.TRUE |
| 160 | case1Result = installResult and uninstallResult and statusResult and startCliResult |
| 161 | |
| 162 | main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1)) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 163 | utilities.assert_equals( expect=main.TRUE, actual=case1Result, |
| 164 | onpass="Set up test environment PASS", |
| 165 | onfail="Set up test environment FAIL" ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 166 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 167 | def CASE20( self, main ): |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 168 | """ |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 169 | This test script Loads a new Topology (Att) on CHO setup and balances all switches |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 170 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 171 | import re |
| 172 | import time |
| 173 | import copy |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 174 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 175 | main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] ) |
| 176 | main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] ) |
| 177 | main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 178 | main.pingTimeout = 60 |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 179 | main.log.report( |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 180 | "Load Att topology and Balance all Mininet switches across controllers" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 181 | main.log.report( |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 182 | "________________________________________________________________________" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 183 | main.case( |
| 184 | "Assign and Balance all Mininet switches across controllers" ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 185 | main.step( "Stop any previous Mininet network topology" ) |
| 186 | cliResult = main.TRUE |
| 187 | if main.newTopo == main.params['TOPO3']['topo']: |
| 188 | stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" ) |
| 189 | |
| 190 | main.step( "Start Mininet with Att topology" ) |
| 191 | main.newTopo = main.params['TOPO1']['topo'] |
| 192 | startStatus = main.Mininet1.startNet(topoFile = main.newTopo) |
| 193 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 194 | main.step( "Assign switches to controllers" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 195 | for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 196 | main.Mininet1.assignSwController( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 197 | sw=str( i ), |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 198 | count=int( main.numCtrls ), |
| 199 | ip1=main.ONOS1_ip, |
| 200 | port1=main.ONOS1_port, |
| 201 | ip2=main.ONOS2_ip, |
| 202 | port2=main.ONOS2_port, |
| 203 | ip3=main.ONOS3_ip, |
| 204 | port3=main.ONOS3_port, |
| 205 | ip4=main.ONOS4_ip, |
| 206 | port4=main.ONOS4_port, |
| 207 | ip5=main.ONOS5_ip, |
| 208 | port5=main.ONOS5_port ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 209 | |
| 210 | switch_mastership = main.TRUE |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 211 | for i in range( 1, ( main.numMNswitches + 1 ) ): |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 212 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 213 | print( "Response is " + str( response ) ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 214 | if re.search( "tcp:" + main.ONOS1_ip, response ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 215 | switch_mastership = switch_mastership and main.TRUE |
| 216 | else: |
| 217 | switch_mastership = main.FALSE |
| 218 | |
| 219 | if switch_mastership == main.TRUE: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 220 | main.log.report( "Controller assignment successfull" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 221 | else: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 222 | main.log.report( "Controller assignment failed" ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 223 | time.sleep( 5 ) |
| 224 | #Don't balance master for now.. |
| 225 | """ |
| 226 | main.step( "Balance devices across controllers" ) |
| 227 | for i in range( int( main.numCtrls ) ): |
| 228 | balanceResult = main.ONOScli1.balanceMasters() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 229 | # giving some breathing time for ONOS to complete re-balance |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 230 | time.sleep( 3 ) |
| 231 | """ |
| 232 | case2Result = ( switch_mastership and startStatus ) |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 233 | #time.sleep(45) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 234 | utilities.assert_equals( |
| 235 | expect=main.TRUE, |
| 236 | actual=case2Result, |
| 237 | onpass="Starting new Att topology test PASS", |
| 238 | onfail="Starting new Att topology test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 239 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 240 | def CASE21( self, main ): |
| 241 | """ |
| 242 | This test script Loads a new Topology (Chordal) on CHO setup and balances all switches |
| 243 | """ |
| 244 | import re |
| 245 | import time |
| 246 | import copy |
| 247 | |
| 248 | main.newTopo = main.params['TOPO2']['topo'] |
| 249 | main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] ) |
| 250 | main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] ) |
| 251 | main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] ) |
| 252 | main.pingTimeout = 120 |
| 253 | main.log.report( |
| 254 | "Load Chordal topology and Balance all Mininet switches across controllers" ) |
| 255 | main.log.report( |
| 256 | "________________________________________________________________________" ) |
| 257 | main.case( |
| 258 | "Assign and Balance all Mininet switches across controllers" ) |
| 259 | main.step( "Stop any previous Mininet network topology" ) |
| 260 | #stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" ) |
| 261 | #time.sleep(10) |
| 262 | main.step( "Start Mininet with Chordal topology" ) |
| 263 | startStatus = main.Mininet1.startNet(topoFile = main.newTopo) |
| 264 | time.sleep(15) |
| 265 | main.step( "Assign switches to controllers" ) |
| 266 | for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 ) |
| 267 | main.Mininet1.assignSwController( |
| 268 | sw=str( i ), |
| 269 | count=int( main.numCtrls ), |
| 270 | ip1=main.ONOS1_ip, |
| 271 | port1=main.ONOS1_port, |
| 272 | ip2=main.ONOS2_ip, |
| 273 | port2=main.ONOS2_port, |
| 274 | ip3=main.ONOS3_ip, |
| 275 | port3=main.ONOS3_port, |
| 276 | ip4=main.ONOS4_ip, |
| 277 | port4=main.ONOS4_port, |
| 278 | ip5=main.ONOS5_ip, |
| 279 | port5=main.ONOS5_port ) |
| 280 | |
| 281 | switch_mastership = main.TRUE |
| 282 | for i in range( 1, ( main.numMNswitches + 1 ) ): |
| 283 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 284 | print( "Response is " + str( response ) ) |
| 285 | if re.search( "tcp:" + main.ONOS1_ip, response ): |
| 286 | switch_mastership = switch_mastership and main.TRUE |
| 287 | else: |
| 288 | switch_mastership = main.FALSE |
| 289 | |
| 290 | if switch_mastership == main.TRUE: |
| 291 | main.log.report( "Controller assignment successfull" ) |
| 292 | else: |
| 293 | main.log.report( "Controller assignment failed" ) |
| 294 | time.sleep( 5 ) |
| 295 | |
| 296 | #Don't balance master for now.. |
| 297 | """ |
| 298 | main.step( "Balance devices across controllers" ) |
| 299 | for i in range( int( main.numCtrls ) ): |
| 300 | balanceResult = main.ONOScli1.balanceMasters() |
| 301 | # giving some breathing time for ONOS to complete re-balance |
| 302 | time.sleep( 3 ) |
| 303 | """ |
| 304 | case21Result = switch_mastership |
| 305 | time.sleep(30) |
| 306 | utilities.assert_equals( |
| 307 | expect=main.TRUE, |
| 308 | actual=case21Result, |
| 309 | onpass="Starting new Chordal topology test PASS", |
| 310 | onfail="Starting new Chordal topology test FAIL" ) |
| 311 | |
| 312 | def CASE22( self, main ): |
| 313 | """ |
| 314 | This test script Loads a new Topology (Spine) on CHO setup and balances all switches |
| 315 | """ |
| 316 | import re |
| 317 | import time |
| 318 | import copy |
| 319 | |
| 320 | main.newTopo = main.params['TOPO3']['topo'] |
| 321 | main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] ) |
| 322 | main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] ) |
| 323 | main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] ) |
| 324 | main.pingTimeout = 400 |
| 325 | |
| 326 | main.log.report( |
| 327 | "Load Spine and Leaf topology and Balance all Mininet switches across controllers" ) |
| 328 | main.log.report( |
| 329 | "________________________________________________________________________" ) |
| 330 | # need to wait here for sometime until ONOS bootup |
| 331 | main.case( |
| 332 | "Assign and Balance all Mininet switches across controllers" ) |
| 333 | main.step( "Stop any previous Mininet network topology" ) |
| 334 | #stopStatus = main.Mininet1.stopNet(fileName = "topoSpine" ) |
| 335 | main.step( "Start Mininet with Spine topology" ) |
| 336 | startStatus = main.Mininet1.startNet(topoFile = main.newTopo) |
| 337 | time.sleep(20) |
| 338 | main.step( "Assign switches to controllers" ) |
| 339 | for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 ) |
| 340 | main.Mininet1.assignSwController( |
| 341 | sw=str( i ), |
| 342 | count= 1, |
| 343 | ip1=main.ONOS1_ip, |
| 344 | port1=main.ONOS1_port, |
| 345 | ip2=main.ONOS2_ip, |
| 346 | port2=main.ONOS2_port, |
| 347 | ip3=main.ONOS3_ip, |
| 348 | port3=main.ONOS3_port, |
| 349 | ip4=main.ONOS4_ip, |
| 350 | port4=main.ONOS4_port, |
| 351 | ip5=main.ONOS5_ip, |
| 352 | port5=main.ONOS5_port ) |
| 353 | |
| 354 | switch_mastership = main.TRUE |
| 355 | for i in range( 1, ( main.numMNswitches + 1 ) ): |
| 356 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 357 | print( "Response is " + str( response ) ) |
| 358 | if re.search( "tcp:" + main.ONOS1_ip, response ): |
| 359 | switch_mastership = switch_mastership and main.TRUE |
| 360 | else: |
| 361 | switch_mastership = main.FALSE |
| 362 | |
| 363 | if switch_mastership == main.TRUE: |
| 364 | main.log.report( "Controller assignment successfull" ) |
| 365 | else: |
| 366 | main.log.report( "Controller assignment failed" ) |
| 367 | time.sleep( 5 ) |
| 368 | """ |
| 369 | main.step( "Balance devices across controllers" ) |
| 370 | |
| 371 | for i in range( int( main.numCtrls ) ): |
| 372 | balanceResult = main.ONOScli1.balanceMasters() |
| 373 | # giving some breathing time for ONOS to complete re-balance |
| 374 | time.sleep( 3 ) |
| 375 | |
| 376 | main.step( "Balance devices across controllers" ) |
| 377 | for i in range( int( main.numCtrls ) ): |
| 378 | balanceResult = main.ONOScli1.balanceMasters() |
| 379 | # giving some breathing time for ONOS to complete re-balance |
| 380 | time.sleep( 3 ) |
| 381 | """ |
| 382 | case22Result = switch_mastership |
| 383 | time.sleep(30) |
| 384 | utilities.assert_equals( |
| 385 | expect=main.TRUE, |
| 386 | actual=case22Result, |
| 387 | onpass="Starting new Spine topology test PASS", |
| 388 | onfail="Starting new Spine topology test FAIL" ) |
| 389 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 390 | def CASE3( self, main ): |
| 391 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 392 | This Test case will be extended to collect and store more data related |
| 393 | ONOS state. |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 394 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 395 | import re |
| 396 | import copy |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 397 | main.deviceDPIDs = [] |
| 398 | main.hostMACs = [] |
| 399 | main.deviceLinks = [] |
| 400 | main.deviceActiveLinksCount = [] |
| 401 | main.devicePortsEnabledCount = [] |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 402 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 403 | main.log.report( |
| 404 | "Collect and Store topology details from ONOS before running any Tests" ) |
| 405 | main.log.report( |
| 406 | "____________________________________________________________________" ) |
Hari Krishna | 5afb4cc | 2015-03-23 15:35:15 -0700 | [diff] [blame] | 407 | main.case( "Collect and Store Topology Details from ONOS" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 408 | main.step( "Collect and store current number of switches and links" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 409 | topology_output = main.ONOScli1.topology() |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 410 | topology_result = main.ONOSbench.getTopology( topology_output ) |
Hari Krishna | ef1bd4e | 2015-03-12 16:55:30 -0700 | [diff] [blame] | 411 | numOnosDevices = topology_result[ 'deviceCount' ] |
| 412 | numOnosLinks = topology_result[ 'linkCount' ] |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 413 | topoResult = main.TRUE |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 414 | |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 415 | if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks >= int(numOnosLinks) ) ): |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 416 | main.step( "Store Device DPIDs" ) |
| 417 | for i in range( 1, (main.numMNswitches+1) ): |
| 418 | main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) ) |
| 419 | print "Device DPIDs in Store: \n", str( main.deviceDPIDs ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 420 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 421 | main.step( "Store Host MACs" ) |
| 422 | for i in range( 1, ( main.numMNhosts + 1 ) ): |
| 423 | main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" ) |
| 424 | print "Host MACs in Store: \n", str( main.hostMACs ) |
Hari Krishna | 5afb4cc | 2015-03-23 15:35:15 -0700 | [diff] [blame] | 425 | main.MACsDict = {} |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 426 | print "Creating dictionary of DPID and HostMacs" |
| 427 | for i in range(len(main.hostMACs)): |
Hari Krishna | 5afb4cc | 2015-03-23 15:35:15 -0700 | [diff] [blame] | 428 | main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0] |
| 429 | print main.MACsDict |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 430 | main.step( "Collect and store all Devices Links" ) |
| 431 | linksResult = main.ONOScli1.links( jsonFormat=False ) |
| 432 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 433 | linksResult = ansi_escape.sub( '', linksResult ) |
| 434 | linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" ) |
| 435 | linksResult = linksResult.splitlines() |
| 436 | linksResult = linksResult[ 1: ] |
| 437 | main.deviceLinks = copy.copy( linksResult ) |
| 438 | print "Device Links Stored: \n", str( main.deviceLinks ) |
| 439 | # this will be asserted to check with the params provided count of |
| 440 | # links |
| 441 | print "Length of Links Store", len( main.deviceLinks ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 442 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 443 | main.step( "Collect and store each Device ports enabled Count" ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 444 | time1 = time.time() |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 445 | for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ): |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 446 | pool = [] |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 447 | for cli in main.CLIs: |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 448 | dpid = "of:00000000000000" + format( i,'02x' ) |
| 449 | t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid]) |
| 450 | t.start() |
| 451 | pool.append(t) |
| 452 | i = i + 1 |
| 453 | main.threadID = main.threadID + 1 |
| 454 | for thread in pool: |
| 455 | thread.join() |
| 456 | portResult = thread.result |
| 457 | portTemp = re.split( r'\t+', portResult ) |
| 458 | portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 459 | main.devicePortsEnabledCount.append( portCount ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 460 | print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 461 | time2 = time.time() |
| 462 | main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1)) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 463 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 464 | main.step( "Collect and store each Device active links Count" ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 465 | time1 = time.time() |
| 466 | |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 467 | for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ): |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 468 | pool = [] |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 469 | for cli in main.CLIs: |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 470 | dpid = "of:00000000000000" + format( i,'02x' ) |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 471 | t = main.Thread( target = cli.getDeviceLinksActiveCount, |
| 472 | threadID = main.threadID, |
| 473 | name = "getDevicePortsEnabledCount", |
| 474 | args = [dpid]) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 475 | t.start() |
| 476 | pool.append(t) |
| 477 | i = i + 1 |
| 478 | main.threadID = main.threadID + 1 |
| 479 | for thread in pool: |
| 480 | thread.join() |
| 481 | linkCountResult = thread.result |
| 482 | linkCountTemp = re.split( r'\t+', linkCountResult ) |
| 483 | linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 484 | main.deviceActiveLinksCount.append( linkCount ) |
| 485 | print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount ) |
| 486 | time2 = time.time() |
| 487 | main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1)) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 488 | |
| 489 | else: |
| 490 | main.log.info("Devices (expected): %s, Links (expected): %s" % |
| 491 | ( str( main.numMNswitches ), str( main.numMNlinks ) ) ) |
| 492 | main.log.info("Devices (actual): %s, Links (actual): %s" % |
| 493 | ( numOnosDevices , numOnosLinks ) ) |
| 494 | main.log.info("Topology does not match, exiting CHO test...") |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 495 | topoResult = main.FALSE |
| 496 | |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 497 | #time.sleep(300) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 498 | #main.cleanup() |
| 499 | #main.exit() |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 500 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 501 | # just returning TRUE for now as this one just collects data |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 502 | case3Result = topoResult |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 503 | utilities.assert_equals( expect=main.TRUE, actual=case3Result, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 504 | onpass="Saving ONOS topology data test PASS", |
| 505 | onfail="Saving ONOS topology data test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 506 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 507 | def CASE40( self, main ): |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 508 | """ |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 509 | Verify Reactive forwarding (Att Topology) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 510 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 511 | import re |
| 512 | import copy |
| 513 | import time |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 514 | main.log.report( "Verify Reactive forwarding (Att Topology)" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 515 | main.log.report( "______________________________________________" ) |
| 516 | main.case( "Enable Reactive forwarding and Verify ping all" ) |
| 517 | main.step( "Enable Reactive forwarding" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 518 | installResult = main.TRUE |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 519 | feature = "onos-app-fwd" |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 520 | |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 521 | pool = [] |
| 522 | time1 = time.time() |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 523 | for cli in main.CLIs: |
| 524 | t = main.Thread( target=cli.featureInstall, |
| 525 | threadID=main.threadID, |
| 526 | name="featureInstall", |
| 527 | args=['onos-app-fwd']) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 528 | pool.append(t) |
| 529 | t.start() |
| 530 | main.threadID = main.threadID + 1 |
| 531 | |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 532 | installResult = main.TRUE |
| 533 | for t in pool: |
| 534 | t.join() |
| 535 | installResult = installResult and t.result |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 536 | time2 = time.time() |
| 537 | |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 538 | if not installResult: |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 539 | main.log.info("Did not install onos-app-fwd feature properly") |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 540 | #main.cleanup() |
| 541 | #main.exit() |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 542 | else: |
| 543 | main.log.info("Successful feature:install onos-app-fwd") |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 544 | main.log.info("Time for feature:install onos-app-fwd: %2f seconds" %(time2-time1)) |
| 545 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 546 | time.sleep( 5 ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 547 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 548 | main.step( "Verify Pingall" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 549 | ping_result = main.FALSE |
| 550 | time1 = time.time() |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 551 | ping_result = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 552 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 553 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 554 | main.log.report( |
| 555 | "Time taken for Ping All: " + |
| 556 | str( timeDiff ) + |
| 557 | " seconds" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 558 | |
| 559 | if ping_result == main.TRUE: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 560 | main.log.report( "Pingall Test in Reactive mode successful" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 561 | else: |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 562 | main.log.report( "Pingall Test in Reactive mode failed" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 563 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 564 | main.step( "Disable Reactive forwarding" ) |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 565 | uninstallResult = main.TRUE |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 566 | pool = [] |
| 567 | time1 = time.time() |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 568 | for cli in main.CLIs: |
| 569 | t = main.Thread( target=cli.featureUninstall, |
| 570 | threadID=main.threadID, |
| 571 | name="featureUninstall", |
| 572 | args=['onos-app-fwd']) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 573 | pool.append(t) |
| 574 | t.start() |
| 575 | main.threadID = main.threadID + 1 |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 576 | for t in pool: |
| 577 | t.join() |
| 578 | uninstallResult = uninstallResult and t.result |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 579 | time2 = time.time() |
| 580 | |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 581 | if not uninstallResult: |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 582 | main.log.info("Did not uninstall onos-app-fwd feature properly") |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 583 | #main.cleanup() |
| 584 | #main.exit() |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 585 | else: |
| 586 | main.log.info("Successful feature:uninstall onos-app-fwd") |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 587 | main.log.info("Time for feature:uninstall onos-app-fwd: %2f seconds" %(time2-time1)) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 588 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 589 | # Waiting for reative flows to be cleared. |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 590 | time.sleep( 20 ) |
| 591 | case4Result = installResult and uninstallResult and ping_result |
| 592 | utilities.assert_equals( expect=main.TRUE, actual=case4Result, |
| 593 | onpass="Reactive Mode Pingall test PASS", |
| 594 | onfail="Reactive Mode Pingall test FAIL" ) |
| 595 | |
| 596 | def CASE41( self, main ): |
| 597 | """ |
| 598 | Verify Reactive forwarding (Chordal Topology) |
| 599 | """ |
| 600 | import re |
| 601 | import copy |
| 602 | import time |
| 603 | main.log.report( "Verify Reactive forwarding (Chordal Topology)" ) |
| 604 | main.log.report( "______________________________________________" ) |
| 605 | main.case( "Enable Reactive forwarding and Verify ping all" ) |
| 606 | main.step( "Enable Reactive forwarding" ) |
| 607 | installResult = main.TRUE |
| 608 | feature = "onos-app-fwd" |
| 609 | |
| 610 | pool = [] |
| 611 | time1 = time.time() |
| 612 | for cli in main.CLIs: |
| 613 | t = main.Thread( target=cli.featureInstall, |
| 614 | threadID=main.threadID, |
| 615 | name="featureInstall", |
| 616 | args=['onos-app-fwd']) |
| 617 | pool.append(t) |
| 618 | t.start() |
| 619 | main.threadID = main.threadID + 1 |
| 620 | |
| 621 | installResult = main.TRUE |
| 622 | for t in pool: |
| 623 | t.join() |
| 624 | installResult = installResult and t.result |
| 625 | time2 = time.time() |
| 626 | |
| 627 | if not installResult: |
| 628 | main.log.info("Did not install onos-app-fwd feature properly") |
| 629 | #main.cleanup() |
| 630 | #main.exit() |
| 631 | else: |
| 632 | main.log.info("Successful feature:install onos-app-fwd") |
| 633 | main.log.info("Time for feature:install onos-app-fwd: %2f seconds" %(time2-time1)) |
| 634 | |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 635 | time.sleep( 5 ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 636 | |
| 637 | main.step( "Verify Pingall" ) |
| 638 | ping_result = main.FALSE |
| 639 | time1 = time.time() |
| 640 | ping_result = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 641 | time2 = time.time() |
| 642 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 643 | main.log.report( |
| 644 | "Time taken for Ping All: " + |
| 645 | str( timeDiff ) + |
| 646 | " seconds" ) |
| 647 | |
| 648 | if ping_result == main.TRUE: |
| 649 | main.log.report( "Pingall Test in Reactive mode successful" ) |
| 650 | else: |
| 651 | main.log.report( "Pingall Test in Reactive mode failed" ) |
| 652 | |
| 653 | main.step( "Disable Reactive forwarding" ) |
| 654 | uninstallResult = main.TRUE |
| 655 | pool = [] |
| 656 | time1 = time.time() |
| 657 | for cli in main.CLIs: |
| 658 | t = main.Thread( target=cli.featureUninstall, |
| 659 | threadID=main.threadID, |
| 660 | name="featureUninstall", |
| 661 | args=['onos-app-fwd']) |
| 662 | pool.append(t) |
| 663 | t.start() |
| 664 | main.threadID = main.threadID + 1 |
| 665 | for t in pool: |
| 666 | t.join() |
| 667 | uninstallResult = uninstallResult and t.result |
| 668 | time2 = time.time() |
| 669 | |
| 670 | if not uninstallResult: |
| 671 | main.log.info("Did not uninstall onos-app-fwd feature properly") |
| 672 | #main.cleanup() |
| 673 | #main.exit() |
| 674 | else: |
| 675 | main.log.info("Successful feature:uninstall onos-app-fwd") |
| 676 | main.log.info("Time for feature:uninstall onos-app-fwd: %2f seconds" %(time2-time1)) |
| 677 | |
| 678 | # Waiting for reative flows to be cleared. |
| 679 | time.sleep( 20 ) |
| 680 | case4Result = installResult and uninstallResult and ping_result |
| 681 | utilities.assert_equals( expect=main.TRUE, actual=case4Result, |
| 682 | onpass="Reactive Mode Pingall test PASS", |
| 683 | onfail="Reactive Mode Pingall test FAIL" ) |
| 684 | |
| 685 | def CASE42( self, main ): |
| 686 | """ |
| 687 | Verify Reactive forwarding (Spine Topology) |
| 688 | """ |
| 689 | import re |
| 690 | import copy |
| 691 | import time |
| 692 | main.log.report( "Verify Reactive forwarding (Spine Topology)" ) |
| 693 | main.log.report( "______________________________________________" ) |
| 694 | main.case( "Enable Reactive forwarding and Verify ping all" ) |
| 695 | main.step( "Enable Reactive forwarding" ) |
| 696 | installResult = main.TRUE |
| 697 | feature = "onos-app-fwd" |
| 698 | |
| 699 | pool = [] |
| 700 | time1 = time.time() |
| 701 | for cli in main.CLIs: |
| 702 | t = main.Thread( target=cli.featureInstall, |
| 703 | threadID=main.threadID, |
| 704 | name="featureInstall", |
| 705 | args=['onos-app-fwd']) |
| 706 | pool.append(t) |
| 707 | t.start() |
| 708 | main.threadID = main.threadID + 1 |
| 709 | |
| 710 | installResult = main.TRUE |
| 711 | for t in pool: |
| 712 | t.join() |
| 713 | installResult = installResult and t.result |
| 714 | time2 = time.time() |
| 715 | |
| 716 | if not installResult: |
| 717 | main.log.info("Did not install onos-app-fwd feature properly") |
| 718 | #main.cleanup() |
| 719 | #main.exit() |
| 720 | else: |
| 721 | main.log.info("Successful feature:install onos-app-fwd") |
| 722 | main.log.info("Time for feature:install onos-app-fwd: %2f seconds" %(time2-time1)) |
| 723 | |
| 724 | time.sleep( 5 ) |
| 725 | |
| 726 | main.step( "Verify Pingall" ) |
| 727 | ping_result = main.FALSE |
| 728 | time1 = time.time() |
| 729 | ping_result = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 730 | time2 = time.time() |
| 731 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 732 | main.log.report( |
| 733 | "Time taken for Ping All: " + |
| 734 | str( timeDiff ) + |
| 735 | " seconds" ) |
| 736 | |
| 737 | if ping_result == main.TRUE: |
| 738 | main.log.report( "Pingall Test in Reactive mode successful" ) |
| 739 | else: |
| 740 | main.log.report( "Pingall Test in Reactive mode failed" ) |
| 741 | |
| 742 | main.step( "Disable Reactive forwarding" ) |
| 743 | uninstallResult = main.TRUE |
| 744 | pool = [] |
| 745 | time1 = time.time() |
| 746 | for cli in main.CLIs: |
| 747 | t = main.Thread( target=cli.featureUninstall, |
| 748 | threadID=main.threadID, |
| 749 | name="featureUninstall", |
| 750 | args=['onos-app-fwd']) |
| 751 | pool.append(t) |
| 752 | t.start() |
| 753 | main.threadID = main.threadID + 1 |
| 754 | for t in pool: |
| 755 | t.join() |
| 756 | uninstallResult = uninstallResult and t.result |
| 757 | time2 = time.time() |
| 758 | |
| 759 | if not uninstallResult: |
| 760 | main.log.info("Did not uninstall onos-app-fwd feature properly") |
| 761 | #main.cleanup() |
| 762 | #main.exit() |
| 763 | else: |
| 764 | main.log.info("Successful feature:uninstall onos-app-fwd") |
| 765 | main.log.info("Time for feature:uninstall onos-app-fwd: %2f seconds" %(time2-time1)) |
| 766 | |
| 767 | # Waiting for reative flows to be cleared. |
| 768 | time.sleep( 20 ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 769 | case4Result = installResult and uninstallResult and ping_result |
| 770 | utilities.assert_equals( expect=main.TRUE, actual=case4Result, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 771 | onpass="Reactive Mode Pingall test PASS", |
| 772 | onfail="Reactive Mode Pingall test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 773 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 774 | def CASE5( self, main ): |
| 775 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 776 | Compare current ONOS topology with reference data |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 777 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 778 | import re |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 779 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 780 | devicesDPIDTemp = [] |
| 781 | hostMACsTemp = [] |
| 782 | deviceLinksTemp = [] |
| 783 | deviceActiveLinksCountTemp = [] |
| 784 | devicePortsEnabledCountTemp = [] |
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.log.report( |
| 787 | "Compare ONOS topology with reference data in Stores" ) |
| 788 | main.log.report( "__________________________________________________" ) |
| 789 | main.case( "Compare ONOS topology with reference data" ) |
| 790 | |
| 791 | main.step( "Compare current Device ports enabled with reference" ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 792 | time1 = time.time() |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 793 | for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ): |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 794 | pool = [] |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 795 | for cli in main.CLIs: |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 796 | dpid = "of:00000000000000" + format( i,'02x' ) |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 797 | t = main.Thread(target = cli.getDevicePortsEnabledCount, |
| 798 | threadID = main.threadID, |
| 799 | name = "getDevicePortsEnabledCount", |
| 800 | args = [dpid]) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 801 | t.start() |
| 802 | pool.append(t) |
| 803 | i = i + 1 |
| 804 | main.threadID = main.threadID + 1 |
| 805 | for thread in pool: |
| 806 | thread.join() |
| 807 | portResult = thread.result |
| 808 | portTemp = re.split( r'\t+', portResult ) |
| 809 | portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 810 | devicePortsEnabledCountTemp.append( portCount ) |
| 811 | print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount ) |
| 812 | time2 = time.time() |
| 813 | main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1)) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 814 | main.log.info ( |
| 815 | "Device Enabled ports EXPECTED: %s" % |
| 816 | str( main.devicePortsEnabledCount ) ) |
| 817 | main.log.info ( |
| 818 | "Device Enabled ports ACTUAL: %s" % |
| 819 | str( devicePortsEnabledCountTemp ) ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 820 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 821 | if ( cmp( main.devicePortsEnabledCount, |
| 822 | devicePortsEnabledCountTemp ) == 0 ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 823 | stepResult1 = main.TRUE |
| 824 | else: |
| 825 | stepResult1 = main.FALSE |
| 826 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 827 | main.step( "Compare Device active links with reference" ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 828 | time1 = time.time() |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 829 | for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ): |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 830 | pool = [] |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 831 | for cli in main.CLIs: |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 832 | dpid = "of:00000000000000" + format( i,'02x' ) |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 833 | t = main.Thread(target = cli.getDeviceLinksActiveCount, |
| 834 | threadID = main.threadID, |
| 835 | name = "getDevicePortsEnabledCount", |
| 836 | args = [dpid]) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 837 | t.start() |
| 838 | pool.append(t) |
| 839 | i = i + 1 |
| 840 | main.threadID = main.threadID + 1 |
| 841 | for thread in pool: |
| 842 | thread.join() |
| 843 | linkCountResult = thread.result |
| 844 | linkCountTemp = re.split( r'\t+', linkCountResult ) |
| 845 | linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 846 | deviceActiveLinksCountTemp.append( linkCount ) |
| 847 | print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount ) |
| 848 | time2 = time.time() |
| 849 | main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1)) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 850 | main.log.info ( |
| 851 | "Device Active links EXPECTED: %s" % |
| 852 | str( main.deviceActiveLinksCount ) ) |
| 853 | main.log.info ( |
| 854 | "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) ) |
| 855 | if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ): |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 856 | stepResult2 = main.TRUE |
| 857 | else: |
| 858 | stepResult2 = main.FALSE |
| 859 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 860 | """ |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 861 | place holder for comparing devices, hosts, paths and intents if required. |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 862 | Links and ports data would be incorrect with out devices anyways. |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 863 | """ |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 864 | case5Result = ( stepResult1 and stepResult2 ) |
| 865 | utilities.assert_equals( expect=main.TRUE, actual=case5Result, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 866 | onpass="Compare Topology test PASS", |
| 867 | onfail="Compare Topology test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 868 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 869 | def CASE60( self ): |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 870 | """ |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 871 | Install 300 host intents and verify ping all (Att Topology) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 872 | """ |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 873 | main.log.report( "Add 300 host intents and verify pingall (Att Topology)" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 874 | main.log.report( "_______________________________________" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 875 | import itertools |
Hari Krishna | ef1bd4e | 2015-03-12 16:55:30 -0700 | [diff] [blame] | 876 | import time |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 877 | main.case( "Install 300 host intents" ) |
| 878 | main.step( "Add host Intents" ) |
| 879 | intentResult = main.TRUE |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 880 | hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 881 | |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 882 | intentIdList = [] |
| 883 | time1 = time.time() |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 884 | for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ): |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 885 | pool = [] |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 886 | for cli in main.CLIs: |
| 887 | if i >= len( hostCombos ): |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 888 | break |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 889 | t = main.Thread( target=cli.addHostIntent, |
| 890 | threadID=main.threadID, |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 891 | name="addHostIntent", |
| 892 | args=[hostCombos[i][0],hostCombos[i][1]]) |
| 893 | pool.append(t) |
| 894 | t.start() |
| 895 | i = i + 1 |
| 896 | main.threadID = main.threadID + 1 |
| 897 | for thread in pool: |
| 898 | thread.join() |
| 899 | intentIdList.append(thread.result) |
| 900 | time2 = time.time() |
kelvin-onlab | adfc8db | 2015-03-24 15:52:48 -0700 | [diff] [blame] | 901 | main.log.info("Time for adding host intents: %2f seconds" %(time2-time1)) |
| 902 | |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 903 | intentResult = main.TRUE |
| 904 | intentsJson = main.ONOScli2.intents() |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 905 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 906 | intentsJson = intentsJson) |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 907 | print getIntentStateResult |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 908 | # Takes awhile for all the onos to get the intents |
Hari Krishna | ef1bd4e | 2015-03-12 16:55:30 -0700 | [diff] [blame] | 909 | time.sleep(30) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 910 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 911 | pingResult = main.FALSE |
| 912 | time1 = time.time() |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 913 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 914 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 915 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 916 | main.log.report( |
| 917 | "Time taken for Ping All: " + |
| 918 | str( timeDiff ) + |
| 919 | " seconds" ) |
| 920 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 921 | onpass="PING ALL PASS", |
| 922 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 923 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 924 | case60Result = ( intentResult and pingResult ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 925 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 926 | utilities.assert_equals( |
| 927 | expect=main.TRUE, |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 928 | actual=case60Result, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 929 | onpass="Install 300 Host Intents and Ping All test PASS", |
| 930 | onfail="Install 300 Host Intents and Ping All test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 931 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 932 | def CASE61( self ): |
| 933 | """ |
| 934 | Install 600 host intents and verify ping all for Chordal Topology |
| 935 | """ |
| 936 | main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" ) |
| 937 | main.log.report( "_______________________________________" ) |
| 938 | import itertools |
| 939 | |
| 940 | main.case( "Install 600 host intents" ) |
| 941 | main.step( "Add host Intents" ) |
| 942 | intentResult = main.TRUE |
| 943 | hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) |
| 944 | |
| 945 | intentIdList = [] |
| 946 | time1 = time.time() |
| 947 | |
| 948 | for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ): |
| 949 | pool = [] |
| 950 | for cli in main.CLIs: |
| 951 | if i >= len( hostCombos ): |
| 952 | break |
| 953 | t = main.Thread( target=cli.addHostIntent, |
| 954 | threadID=main.threadID, |
| 955 | name="addHostIntent", |
| 956 | args=[hostCombos[i][0],hostCombos[i][1]]) |
| 957 | pool.append(t) |
| 958 | t.start() |
| 959 | i = i + 1 |
| 960 | main.threadID = main.threadID + 1 |
| 961 | for thread in pool: |
| 962 | thread.join() |
| 963 | intentIdList.append(thread.result) |
| 964 | time2 = time.time() |
| 965 | main.log.info("Time for adding host intents: %2f seconds" %(time2-time1)) |
| 966 | intentResult = main.TRUE |
| 967 | intentsJson = main.ONOScli2.intents() |
| 968 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 969 | intentsJson = intentsJson) |
| 970 | print getIntentStateResult |
| 971 | |
| 972 | main.step( "Verify Ping across all hosts" ) |
| 973 | pingResult = main.FALSE |
| 974 | time1 = time.time() |
| 975 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 976 | time2 = time.time() |
| 977 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 978 | main.log.report( |
| 979 | "Time taken for Ping All: " + |
| 980 | str( timeDiff ) + |
| 981 | " seconds" ) |
| 982 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 983 | onpass="PING ALL PASS", |
| 984 | onfail="PING ALL FAIL" ) |
| 985 | |
| 986 | case14Result = ( intentResult and pingResult ) |
| 987 | |
| 988 | utilities.assert_equals( |
| 989 | expect=main.TRUE, |
| 990 | actual=case14Result, |
| 991 | onpass="Install 300 Host Intents and Ping All test PASS", |
| 992 | onfail="Install 300 Host Intents and Ping All test FAIL" ) |
| 993 | |
| 994 | def CASE62( self ): |
| 995 | """ |
| 996 | Install 2278 host intents and verify ping all for Spine Topology |
| 997 | """ |
| 998 | main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" ) |
| 999 | main.log.report( "_______________________________________" ) |
| 1000 | import itertools |
| 1001 | |
| 1002 | main.case( "Install 2278 host intents" ) |
| 1003 | main.step( "Add host Intents" ) |
| 1004 | intentResult = main.TRUE |
| 1005 | hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) |
| 1006 | main.pingTimeout = 300 |
| 1007 | intentIdList = [] |
| 1008 | time1 = time.time() |
| 1009 | for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ): |
| 1010 | pool = [] |
| 1011 | for cli in main.CLIs: |
| 1012 | if i >= len( hostCombos ): |
| 1013 | break |
| 1014 | t = main.Thread( target=cli.addHostIntent, |
| 1015 | threadID=main.threadID, |
| 1016 | name="addHostIntent", |
| 1017 | args=[hostCombos[i][0],hostCombos[i][1]]) |
| 1018 | pool.append(t) |
| 1019 | t.start() |
| 1020 | i = i + 1 |
| 1021 | main.threadID = main.threadID + 1 |
| 1022 | for thread in pool: |
| 1023 | thread.join() |
| 1024 | intentIdList.append(thread.result) |
| 1025 | time2 = time.time() |
| 1026 | main.log.info("Time for adding host intents: %2f seconds" %(time2-time1)) |
| 1027 | intentResult = main.TRUE |
| 1028 | intentsJson = main.ONOScli2.intents() |
| 1029 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 1030 | intentsJson = intentsJson) |
| 1031 | print getIntentStateResult |
| 1032 | |
| 1033 | main.step( "Verify Ping across all hosts" ) |
| 1034 | pingResult = main.FALSE |
| 1035 | time1 = time.time() |
| 1036 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 1037 | time2 = time.time() |
| 1038 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1039 | main.log.report( |
| 1040 | "Time taken for Ping All: " + |
| 1041 | str( timeDiff ) + |
| 1042 | " seconds" ) |
| 1043 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1044 | onpass="PING ALL PASS", |
| 1045 | onfail="PING ALL FAIL" ) |
| 1046 | |
| 1047 | case15Result = ( intentResult and pingResult ) |
| 1048 | |
| 1049 | utilities.assert_equals( |
| 1050 | expect=main.TRUE, |
| 1051 | actual=case15Result, |
| 1052 | onpass="Install 2278 Host Intents and Ping All test PASS", |
| 1053 | onfail="Install 2278 Host Intents and Ping All test FAIL" ) |
| 1054 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1055 | def CASE70( self, main ): |
| 1056 | """ |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1057 | Randomly bring some core links down and verify ping all ( Host Intents-Att Topo) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1058 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1059 | import random |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1060 | main.randomLink1 = [] |
| 1061 | main.randomLink2 = [] |
| 1062 | main.randomLink3 = [] |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1063 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1064 | link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 1065 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1066 | link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 1067 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1068 | link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 1069 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1070 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1071 | |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1072 | main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" ) |
| 1073 | main.log.report( "___________________________________________________________________________" ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 1074 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 1075 | 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] | 1076 | if ( int( switchLinksToToggle ) == |
| 1077 | 0 or int( switchLinksToToggle ) > 5 ): |
Hari Krishna | 46997e0 | 2015-01-27 11:23:07 -0800 | [diff] [blame] | 1078 | main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1079 | #main.cleanup() |
| 1080 | #main.exit() |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1081 | else: |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 1082 | 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] | 1083 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1084 | main.step( "Cut links on Core devices using user provided range" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1085 | main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 1086 | main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 1087 | main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1088 | for i in range( int( switchLinksToToggle ) ): |
| 1089 | main.Mininet1.link( |
| 1090 | END1=link1End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1091 | END2=main.randomLink1[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1092 | OPTION="down" ) |
| 1093 | main.Mininet1.link( |
| 1094 | END1=link2End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1095 | END2=main.randomLink2[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1096 | OPTION="down" ) |
| 1097 | main.Mininet1.link( |
| 1098 | END1=link3End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1099 | END2=main.randomLink3[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1100 | OPTION="down" ) |
| 1101 | time.sleep( link_sleep ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1102 | |
| 1103 | topology_output = main.ONOScli2.topology() |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 1104 | linkDown = main.ONOSbench.checkStatus( |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1105 | topology_output, main.numMNswitches, str( |
| 1106 | int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1107 | utilities.assert_equals( |
| 1108 | expect=main.TRUE, |
| 1109 | actual=linkDown, |
| 1110 | onpass="Link Down discovered properly", |
| 1111 | onfail="Link down was not discovered in " + |
| 1112 | str( link_sleep ) + |
| 1113 | " seconds" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1114 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1115 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1116 | pingResultLinkDown = main.FALSE |
| 1117 | time1 = time.time() |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 1118 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1119 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1120 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1121 | main.log.report( |
| 1122 | "Time taken for Ping All: " + |
| 1123 | str( timeDiff ) + |
| 1124 | " seconds" ) |
| 1125 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1126 | onpass="PING ALL PASS", |
| 1127 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1128 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1129 | caseResult70 = linkDown and pingResultLinkDown |
| 1130 | utilities.assert_equals( expect=main.TRUE, actual=caseResult70, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1131 | onpass="Random Link cut Test PASS", |
| 1132 | onfail="Random Link cut Test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1133 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1134 | def CASE80( self, main ): |
| 1135 | """ |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1136 | Bring the core links up that are down and verify ping all ( Host Intents-Att Topo ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1137 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1138 | import random |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1139 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1140 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1141 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1142 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1143 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1144 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1145 | main.log.report( |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1146 | "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1147 | main.log.report( |
| 1148 | "__________________________________________________________________" ) |
| 1149 | main.case( |
| 1150 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 1151 | main.step( "Bring randomly cut links on Core devices up" ) |
| 1152 | for i in range( int( switchLinksToToggle ) ): |
| 1153 | main.Mininet1.link( |
| 1154 | END1=link1End1, |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 1155 | END2=main.randomLink1[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1156 | OPTION="up" ) |
| 1157 | main.Mininet1.link( |
| 1158 | END1=link2End1, |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 1159 | END2=main.randomLink2[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1160 | OPTION="up" ) |
| 1161 | main.Mininet1.link( |
| 1162 | END1=link3End1, |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 1163 | END2=main.randomLink3[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1164 | OPTION="up" ) |
| 1165 | time.sleep( link_sleep ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1166 | |
| 1167 | topology_output = main.ONOScli2.topology() |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 1168 | linkUp = main.ONOSbench.checkStatus( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1169 | topology_output, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1170 | main.numMNswitches, |
| 1171 | str( main.numMNlinks ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1172 | utilities.assert_equals( |
| 1173 | expect=main.TRUE, |
| 1174 | actual=linkUp, |
| 1175 | onpass="Link up discovered properly", |
| 1176 | onfail="Link up was not discovered in " + |
| 1177 | str( link_sleep ) + |
| 1178 | " seconds" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1179 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1180 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1181 | pingResultLinkUp = main.FALSE |
| 1182 | time1 = time.time() |
| 1183 | pingResultLinkUp = main.Mininet1.pingall() |
| 1184 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1185 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1186 | main.log.report( |
| 1187 | "Time taken for Ping All: " + |
| 1188 | str( timeDiff ) + |
| 1189 | " seconds" ) |
| 1190 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1191 | onpass="PING ALL PASS", |
| 1192 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1193 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1194 | caseResult80 = linkUp and pingResultLinkUp |
| 1195 | utilities.assert_equals( expect=main.TRUE, actual=caseResult80, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1196 | onpass="Link Up Test PASS", |
| 1197 | onfail="Link Up Test FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1198 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1199 | def CASE71( self, main ): |
| 1200 | """ |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1201 | Randomly bring some core links down and verify ping all ( Host Intents-Att Topo) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1202 | """ |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1203 | import random |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1204 | main.randomLink1 = [] |
| 1205 | main.randomLink2 = [] |
| 1206 | main.randomLink3 = [] |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1207 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1208 | link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 1209 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1210 | link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 1211 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1212 | link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 1213 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1214 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1215 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1216 | main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" ) |
| 1217 | main.log.report( "___________________________________________________________________________" ) |
| 1218 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 1219 | 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] | 1220 | if ( int( switchLinksToToggle ) == |
| 1221 | 0 or int( switchLinksToToggle ) > 5 ): |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1222 | main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1223 | #main.cleanup() |
| 1224 | #main.exit() |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1225 | else: |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1226 | main.log.info( "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] | 1227 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1228 | main.step( "Cut links on Core devices using user provided range" ) |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1229 | main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 1230 | main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 1231 | main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1232 | for i in range( int( switchLinksToToggle ) ): |
| 1233 | main.Mininet1.link( |
| 1234 | END1=link1End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1235 | END2=main.randomLink1[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1236 | OPTION="down" ) |
| 1237 | main.Mininet1.link( |
| 1238 | END1=link2End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1239 | END2=main.randomLink2[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1240 | OPTION="down" ) |
| 1241 | main.Mininet1.link( |
| 1242 | END1=link3End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1243 | END2=main.randomLink3[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1244 | OPTION="down" ) |
| 1245 | time.sleep( link_sleep ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1246 | |
| 1247 | topology_output = main.ONOScli2.topology() |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 1248 | linkDown = main.ONOSbench.checkStatus( |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1249 | topology_output, main.numMNswitches, str( |
| 1250 | int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1251 | utilities.assert_equals( |
| 1252 | expect=main.TRUE, |
| 1253 | actual=linkDown, |
| 1254 | onpass="Link Down discovered properly", |
| 1255 | onfail="Link down was not discovered in " + |
| 1256 | str( link_sleep ) + |
| 1257 | " seconds" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1258 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1259 | main.step( "Verify Ping across all hosts" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1260 | pingResultLinkDown = main.FALSE |
| 1261 | time1 = time.time() |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1262 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1263 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1264 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1265 | main.log.report( |
| 1266 | "Time taken for Ping All: " + |
| 1267 | str( timeDiff ) + |
| 1268 | " seconds" ) |
| 1269 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1270 | onpass="PING ALL PASS", |
| 1271 | onfail="PING ALL FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1272 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1273 | caseResult71 = linkDown and pingResultLinkDown |
| 1274 | utilities.assert_equals( expect=main.TRUE, actual=caseResult71, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1275 | onpass="Random Link cut Test PASS", |
| 1276 | onfail="Random Link cut Test FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1277 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1278 | def CASE81( self, main ): |
| 1279 | """ |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1280 | Bring the core links up that are down and verify ping all ( Host Intents-Att Topo ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1281 | """ |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1282 | import random |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1283 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1284 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1285 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1286 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1287 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1288 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1289 | main.log.report( |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1290 | "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1291 | main.log.report( |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1292 | "__________________________________________________________________" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1293 | main.case( |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1294 | "Host intents - Bring the core links up that are down and verify ping all" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1295 | main.step( "Bring randomly cut links on Core devices up" ) |
| 1296 | for i in range( int( switchLinksToToggle ) ): |
| 1297 | main.Mininet1.link( |
| 1298 | END1=link1End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1299 | END2=main.randomLink1[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1300 | OPTION="up" ) |
| 1301 | main.Mininet1.link( |
| 1302 | END1=link2End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1303 | END2=main.randomLink2[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1304 | OPTION="up" ) |
| 1305 | main.Mininet1.link( |
| 1306 | END1=link3End1, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1307 | END2=main.randomLink3[ i ], |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1308 | OPTION="up" ) |
| 1309 | time.sleep( link_sleep ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1310 | |
| 1311 | topology_output = main.ONOScli2.topology() |
Hari Krishna | d97213e | 2015-01-24 19:30:14 -0800 | [diff] [blame] | 1312 | linkUp = main.ONOSbench.checkStatus( |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1313 | topology_output, |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1314 | main.numMNswitches, |
| 1315 | str( main.numMNlinks ) ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1316 | utilities.assert_equals( |
| 1317 | expect=main.TRUE, |
| 1318 | actual=linkUp, |
| 1319 | onpass="Link up discovered properly", |
| 1320 | onfail="Link up was not discovered in " + |
| 1321 | str( link_sleep ) + |
| 1322 | " seconds" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1323 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1324 | main.step( "Verify Ping across all hosts" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1325 | pingResultLinkUp = main.FALSE |
| 1326 | time1 = time.time() |
| 1327 | pingResultLinkUp = main.Mininet1.pingall() |
| 1328 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1329 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1330 | main.log.report( |
| 1331 | "Time taken for Ping All: " + |
| 1332 | str( timeDiff ) + |
| 1333 | " seconds" ) |
| 1334 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1335 | onpass="PING ALL PASS", |
| 1336 | onfail="PING ALL FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1337 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 1338 | caseResult81 = linkUp and pingResultLinkUp |
| 1339 | utilities.assert_equals( expect=main.TRUE, actual=caseResult81, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1340 | onpass="Link Up Test PASS", |
| 1341 | onfail="Link Up Test FAIL" ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 1342 | |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1343 | def CASE72( self, main ): |
| 1344 | """ |
| 1345 | Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo) |
| 1346 | """ |
| 1347 | import random |
| 1348 | import itertools |
| 1349 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1350 | |
| 1351 | main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" ) |
| 1352 | main.log.report( "___________________________________________________________________________" ) |
| 1353 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 1354 | switches = [] |
| 1355 | switchesComb = [] |
| 1356 | for i in range( main.numMNswitches ): |
| 1357 | switches.append('s%d'%(i+1)) |
| 1358 | switchesLinksComb = list(itertools.combinations(switches,2)) |
| 1359 | main.randomLinks = random.sample(switchesLinksComb, 5 ) |
| 1360 | print main.randomLinks |
| 1361 | main.step( "Cut links on random devices" ) |
| 1362 | |
| 1363 | for switch in main.randomLinks: |
| 1364 | main.Mininet1.link( |
| 1365 | END1=switch[0], |
| 1366 | END2=switch[1], |
| 1367 | OPTION="down") |
| 1368 | time.sleep( link_sleep ) |
| 1369 | |
| 1370 | topology_output = main.ONOScli2.topology() |
| 1371 | linkDown = main.ONOSbench.checkStatus( |
| 1372 | topology_output, main.numMNswitches, str( |
| 1373 | int( main.numMNlinks ) - 5 * 2 ) ) |
| 1374 | utilities.assert_equals( |
| 1375 | expect=main.TRUE, |
| 1376 | actual=linkDown, |
| 1377 | onpass="Link Down discovered properly", |
| 1378 | onfail="Link down was not discovered in " + |
| 1379 | str( link_sleep ) + |
| 1380 | " seconds" ) |
| 1381 | |
| 1382 | main.step( "Verify Ping across all hosts" ) |
| 1383 | pingResultLinkDown = main.FALSE |
| 1384 | time1 = time.time() |
| 1385 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 1386 | time2 = time.time() |
| 1387 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1388 | main.log.report( |
| 1389 | "Time taken for Ping All: " + |
| 1390 | str( timeDiff ) + |
| 1391 | " seconds" ) |
| 1392 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1393 | onpass="PING ALL PASS", |
| 1394 | onfail="PING ALL FAIL" ) |
| 1395 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1396 | caseResult71 = pingResultLinkDown |
| 1397 | utilities.assert_equals( expect=main.TRUE, actual=caseResult71, |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1398 | onpass="Random Link cut Test PASS", |
| 1399 | onfail="Random Link cut Test FAIL" ) |
| 1400 | |
| 1401 | def CASE82( self, main ): |
| 1402 | """ |
| 1403 | Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo ) |
| 1404 | """ |
| 1405 | import random |
| 1406 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1407 | |
| 1408 | main.log.report( |
| 1409 | "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" ) |
| 1410 | main.log.report( |
| 1411 | "__________________________________________________________________" ) |
| 1412 | main.case( |
| 1413 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 1414 | main.step( "Bring randomly cut links on devices up" ) |
| 1415 | |
| 1416 | for switch in main.randomLinks: |
| 1417 | main.Mininet1.link( |
| 1418 | END1=switch[0], |
| 1419 | END2=switch[1], |
| 1420 | OPTION="up") |
| 1421 | |
| 1422 | time.sleep( link_sleep ) |
| 1423 | |
| 1424 | topology_output = main.ONOScli2.topology() |
| 1425 | linkUp = main.ONOSbench.checkStatus( |
| 1426 | topology_output, |
| 1427 | main.numMNswitches, |
| 1428 | str( main.numMNlinks ) ) |
| 1429 | utilities.assert_equals( |
| 1430 | expect=main.TRUE, |
| 1431 | actual=linkUp, |
| 1432 | onpass="Link up discovered properly", |
| 1433 | onfail="Link up was not discovered in " + |
| 1434 | str( link_sleep ) + |
| 1435 | " seconds" ) |
| 1436 | |
| 1437 | main.step( "Verify Ping across all hosts" ) |
| 1438 | pingResultLinkUp = main.FALSE |
| 1439 | time1 = time.time() |
| 1440 | pingResultLinkUp = main.Mininet1.pingall() |
| 1441 | time2 = time.time() |
| 1442 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1443 | main.log.report( |
| 1444 | "Time taken for Ping All: " + |
| 1445 | str( timeDiff ) + |
| 1446 | " seconds" ) |
| 1447 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1448 | onpass="PING ALL PASS", |
| 1449 | onfail="PING ALL FAIL" ) |
| 1450 | |
| 1451 | caseResult82 = linkUp and pingResultLinkUp |
| 1452 | utilities.assert_equals( expect=main.TRUE, actual=caseResult82, |
| 1453 | onpass="Link Up Test PASS", |
| 1454 | onfail="Link Up Test FAIL" ) |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1455 | |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1456 | def CASE73( self, main ): |
| 1457 | """ |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1458 | Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1459 | """ |
| 1460 | import random |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1461 | import itertools |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1462 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1463 | |
| 1464 | main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1465 | main.log.report( "___________________________________________________________________________" ) |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1466 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 1467 | switches = [] |
| 1468 | switchesComb = [] |
| 1469 | for i in range( main.numMNswitches ): |
| 1470 | switches.append('s%d'%(i+1)) |
| 1471 | switchesLinksComb = list(itertools.combinations(switches,2)) |
| 1472 | main.randomLinks = random.sample(switchesLinksComb, 5 ) |
| 1473 | print main.randomLinks |
| 1474 | main.step( "Cut links on random devices" ) |
| 1475 | |
| 1476 | for switch in main.randomLinks: |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1477 | main.Mininet1.link( |
| 1478 | END1=switch[0], |
| 1479 | END2=switch[1], |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1480 | OPTION="down") |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1481 | time.sleep( link_sleep ) |
| 1482 | |
| 1483 | topology_output = main.ONOScli2.topology() |
| 1484 | linkDown = main.ONOSbench.checkStatus( |
| 1485 | topology_output, main.numMNswitches, str( |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1486 | int( main.numMNlinks ) - 5 * 2 ) ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1487 | utilities.assert_equals( |
| 1488 | expect=main.TRUE, |
| 1489 | actual=linkDown, |
| 1490 | onpass="Link Down discovered properly", |
| 1491 | onfail="Link down was not discovered in " + |
| 1492 | str( link_sleep ) + |
| 1493 | " seconds" ) |
| 1494 | |
| 1495 | main.step( "Verify Ping across all hosts" ) |
| 1496 | pingResultLinkDown = main.FALSE |
| 1497 | time1 = time.time() |
| 1498 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 1499 | time2 = time.time() |
| 1500 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1501 | main.log.report( |
| 1502 | "Time taken for Ping All: " + |
| 1503 | str( timeDiff ) + |
| 1504 | " seconds" ) |
| 1505 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1506 | onpass="PING ALL PASS", |
| 1507 | onfail="PING ALL FAIL" ) |
| 1508 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1509 | caseResult73 = pingResultLinkDown |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1510 | utilities.assert_equals( expect=main.TRUE, actual=caseResult73, |
| 1511 | onpass="Random Link cut Test PASS", |
| 1512 | onfail="Random Link cut Test FAIL" ) |
| 1513 | |
| 1514 | def CASE83( self, main ): |
| 1515 | """ |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1516 | Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1517 | """ |
| 1518 | import random |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1519 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1520 | |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1521 | main.log.report( |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1522 | "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1523 | main.log.report( |
| 1524 | "__________________________________________________________________" ) |
| 1525 | main.case( |
| 1526 | "Host intents - Bring the core links up that are down and verify ping all" ) |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1527 | main.step( "Bring randomly cut links on devices up" ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1528 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1529 | for switch in main.randomLinks: |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1530 | main.Mininet1.link( |
| 1531 | END1=switch[0], |
| 1532 | END2=switch[1], |
| 1533 | OPTION="up") |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1534 | |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1535 | time.sleep( link_sleep ) |
| 1536 | |
| 1537 | topology_output = main.ONOScli2.topology() |
| 1538 | linkUp = main.ONOSbench.checkStatus( |
| 1539 | topology_output, |
| 1540 | main.numMNswitches, |
| 1541 | str( main.numMNlinks ) ) |
| 1542 | utilities.assert_equals( |
| 1543 | expect=main.TRUE, |
| 1544 | actual=linkUp, |
| 1545 | onpass="Link up discovered properly", |
| 1546 | onfail="Link up was not discovered in " + |
| 1547 | str( link_sleep ) + |
| 1548 | " seconds" ) |
| 1549 | |
| 1550 | main.step( "Verify Ping across all hosts" ) |
| 1551 | pingResultLinkUp = main.FALSE |
| 1552 | time1 = time.time() |
| 1553 | pingResultLinkUp = main.Mininet1.pingall() |
| 1554 | time2 = time.time() |
| 1555 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1556 | main.log.report( |
| 1557 | "Time taken for Ping All: " + |
| 1558 | str( timeDiff ) + |
| 1559 | " seconds" ) |
| 1560 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1561 | onpass="PING ALL PASS", |
| 1562 | onfail="PING ALL FAIL" ) |
| 1563 | |
| 1564 | caseResult83 = linkUp and pingResultLinkUp |
| 1565 | utilities.assert_equals( expect=main.TRUE, actual=caseResult83, |
| 1566 | onpass="Link Up Test PASS", |
| 1567 | onfail="Link Up Test FAIL" ) |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1568 | |
| 1569 | def CASE74( self, main ): |
| 1570 | """ |
| 1571 | Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo) |
| 1572 | """ |
| 1573 | import random |
| 1574 | main.randomLink1 = [] |
| 1575 | main.randomLink2 = [] |
| 1576 | main.randomLink3 = [] |
| 1577 | main.randomLink4 = [] |
| 1578 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 1579 | link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' ) |
| 1580 | link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' ) |
| 1581 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 1582 | link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' ) |
| 1583 | link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' ) |
| 1584 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1585 | main.pingTimeout = 400 |
| 1586 | |
| 1587 | main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" ) |
| 1588 | main.log.report( "___________________________________________________________________________" ) |
| 1589 | |
| 1590 | linkIndex = range(4) |
| 1591 | linkIndexS9 = random.sample(linkIndex,1)[0] |
| 1592 | linkIndex.remove(linkIndexS9) |
| 1593 | linkIndexS10 = random.sample(linkIndex,1)[0] |
| 1594 | main.randomLink1 = link1End2top[linkIndexS9] |
| 1595 | main.randomLink2 = link2End2top[linkIndexS10] |
| 1596 | main.randomLink3 = random.sample(link1End2bot,1)[0] |
| 1597 | main.randomLink4 = random.sample(link2End2bot,1)[0] |
| 1598 | main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" ) |
| 1599 | main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" ) |
| 1600 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" ) |
| 1601 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" ) |
kelvin-onlab | d878fc2 | 2015-03-27 13:33:41 -0700 | [diff] [blame^] | 1602 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1603 | time.sleep( link_sleep ) |
| 1604 | |
| 1605 | topology_output = main.ONOScli2.topology() |
| 1606 | linkDown = main.ONOSbench.checkStatus( |
| 1607 | topology_output, main.numMNswitches, str( |
| 1608 | int( main.numMNlinks ) - 8 )) |
| 1609 | utilities.assert_equals( |
| 1610 | expect=main.TRUE, |
| 1611 | actual=linkDown, |
| 1612 | onpass="Link Down discovered properly", |
| 1613 | onfail="Link down was not discovered in " + |
| 1614 | str( link_sleep ) + |
| 1615 | " seconds" ) |
| 1616 | |
| 1617 | main.step( "Verify Ping across all hosts" ) |
| 1618 | pingResultLinkDown = main.FALSE |
| 1619 | time1 = time.time() |
| 1620 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 1621 | time2 = time.time() |
| 1622 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1623 | main.log.report( |
| 1624 | "Time taken for Ping All: " + |
| 1625 | str( timeDiff ) + |
| 1626 | " seconds" ) |
| 1627 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1628 | onpass="PING ALL PASS", |
| 1629 | onfail="PING ALL FAIL" ) |
| 1630 | |
| 1631 | caseResult74 = linkDown and pingResultLinkDown |
| 1632 | utilities.assert_equals( expect=main.TRUE, actual=caseResult74, |
| 1633 | onpass="Random Link cut Test PASS", |
| 1634 | onfail="Random Link cut Test FAIL" ) |
| 1635 | |
| 1636 | def CASE84( self, main ): |
| 1637 | """ |
| 1638 | Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo ) |
| 1639 | """ |
| 1640 | import random |
| 1641 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 1642 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 1643 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1644 | main.log.report( |
| 1645 | "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" ) |
| 1646 | main.log.report( |
| 1647 | "__________________________________________________________________" ) |
| 1648 | main.case( |
| 1649 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 1650 | |
| 1651 | main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" ) |
| 1652 | main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" ) |
| 1653 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" ) |
| 1654 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" ) |
| 1655 | |
| 1656 | time.sleep( link_sleep ) |
| 1657 | topology_output = main.ONOScli2.topology() |
| 1658 | linkUp = main.ONOSbench.checkStatus( |
| 1659 | topology_output, |
| 1660 | main.numMNswitches, |
| 1661 | str( main.numMNlinks ) ) |
| 1662 | utilities.assert_equals( |
| 1663 | expect=main.TRUE, |
| 1664 | actual=linkUp, |
| 1665 | onpass="Link up discovered properly", |
| 1666 | onfail="Link up was not discovered in " + |
| 1667 | str( link_sleep ) + |
| 1668 | " seconds" ) |
| 1669 | |
| 1670 | main.step( "Verify Ping across all hosts" ) |
| 1671 | pingResultLinkUp = main.FALSE |
| 1672 | time1 = time.time() |
| 1673 | pingResultLinkUp = main.Mininet1.pingall() |
| 1674 | time2 = time.time() |
| 1675 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1676 | main.log.report( |
| 1677 | "Time taken for Ping All: " + |
| 1678 | str( timeDiff ) + |
| 1679 | " seconds" ) |
| 1680 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1681 | onpass="PING ALL PASS", |
| 1682 | onfail="PING ALL FAIL" ) |
| 1683 | |
| 1684 | caseResult84 = linkUp and pingResultLinkUp |
| 1685 | utilities.assert_equals( expect=main.TRUE, actual=caseResult84, |
| 1686 | onpass="Link Up Test PASS", |
| 1687 | onfail="Link Up Test FAIL" ) |
kelvin-onlab | adfc8db | 2015-03-24 15:52:48 -0700 | [diff] [blame] | 1688 | |
| 1689 | def CASE90( self ): |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1690 | """ |
Hari Krishna | 5afb4cc | 2015-03-23 15:35:15 -0700 | [diff] [blame] | 1691 | Install 600 point intents and verify ping all (Att Topology) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1692 | """ |
Hari Krishna | 5afb4cc | 2015-03-23 15:35:15 -0700 | [diff] [blame] | 1693 | main.log.report( "Add 600 point intents and verify pingall (Att Topology)" ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1694 | main.log.report( "_______________________________________" ) |
| 1695 | import itertools |
| 1696 | import time |
Hari Krishna | 5afb4cc | 2015-03-23 15:35:15 -0700 | [diff] [blame] | 1697 | main.case( "Install 600 point intents" ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1698 | main.step( "Add point Intents" ) |
| 1699 | intentResult = main.TRUE |
| 1700 | deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) ) |
| 1701 | |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1702 | intentIdList = [] |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1703 | time1 = time.time() |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1704 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 1705 | pool = [] |
| 1706 | for cli in main.CLIs: |
| 1707 | if i >= len( deviceCombos ): |
| 1708 | break |
| 1709 | t = main.Thread( target=cli.addPointIntent, |
| 1710 | threadID=main.threadID, |
| 1711 | name="addPointIntent", |
Hari Krishna | 5afb4cc | 2015-03-23 15:35:15 -0700 | [diff] [blame] | 1712 | args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])]) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1713 | pool.append(t) |
Hari Krishna | 5afb4cc | 2015-03-23 15:35:15 -0700 | [diff] [blame] | 1714 | #time.sleep(1) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1715 | t.start() |
| 1716 | i = i + 1 |
| 1717 | main.threadID = main.threadID + 1 |
| 1718 | for thread in pool: |
| 1719 | thread.join() |
| 1720 | intentIdList.append(thread.result) |
| 1721 | time2 = time.time() |
| 1722 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
| 1723 | intentResult = main.TRUE |
| 1724 | intentsJson = main.ONOScli2.intents() |
| 1725 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 1726 | intentsJson = intentsJson) |
| 1727 | print getIntentStateResult |
| 1728 | # Takes awhile for all the onos to get the intents |
| 1729 | time.sleep(30) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1730 | main.step( "Verify Ping across all hosts" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1731 | pingResult = main.FALSE |
| 1732 | time1 = time.time() |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1733 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1734 | time2 = time.time() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1735 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1736 | main.log.report( |
| 1737 | "Time taken for Ping All: " + |
| 1738 | str( timeDiff ) + |
| 1739 | " seconds" ) |
| 1740 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1741 | onpass="PING ALL PASS", |
| 1742 | onfail="PING ALL FAIL" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 1743 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1744 | case90Result = ( intentResult and pingResult ) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 1745 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1746 | utilities.assert_equals( |
| 1747 | expect=main.TRUE, |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1748 | actual=case90Result, |
Hari Krishna | 5afb4cc | 2015-03-23 15:35:15 -0700 | [diff] [blame] | 1749 | onpass="Install 600 point Intents and Ping All test PASS", |
| 1750 | onfail="Install 600 point Intents and Ping All test FAIL" ) |
kelvin-onlab | adfc8db | 2015-03-24 15:52:48 -0700 | [diff] [blame] | 1751 | |
| 1752 | def CASE91( self ): |
| 1753 | """ |
| 1754 | Install ###$$$ point intents and verify ping all (Chordal Topology) |
| 1755 | """ |
| 1756 | main.log.report( "Add ###$$$ point intents and verify pingall (Chordal Topology)" ) |
| 1757 | main.log.report( "_______________________________________" ) |
| 1758 | import itertools |
| 1759 | import time |
| 1760 | main.case( "Install ###$$$ point intents" ) |
| 1761 | main.step( "Add point Intents" ) |
| 1762 | intentResult = main.TRUE |
| 1763 | deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) ) |
| 1764 | |
| 1765 | intentIdList = [] |
| 1766 | time1 = time.time() |
| 1767 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 1768 | pool = [] |
| 1769 | for cli in main.CLIs: |
| 1770 | if i >= len( deviceCombos ): |
| 1771 | break |
| 1772 | t = main.Thread( target=cli.addPointIntent, |
| 1773 | threadID=main.threadID, |
| 1774 | name="addPointIntent", |
| 1775 | args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])]) |
| 1776 | pool.append(t) |
| 1777 | #time.sleep(1) |
| 1778 | t.start() |
| 1779 | i = i + 1 |
| 1780 | main.threadID = main.threadID + 1 |
| 1781 | for thread in pool: |
| 1782 | thread.join() |
| 1783 | intentIdList.append(thread.result) |
| 1784 | time2 = time.time() |
| 1785 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
| 1786 | intentResult = main.TRUE |
| 1787 | intentsJson = main.ONOScli2.intents() |
| 1788 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 1789 | intentsJson = intentsJson) |
| 1790 | print getIntentStateResult |
| 1791 | # Takes awhile for all the onos to get the intents |
| 1792 | time.sleep(30) |
| 1793 | main.step( "Verify Ping across all hosts" ) |
| 1794 | pingResult = main.FALSE |
| 1795 | time1 = time.time() |
| 1796 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 1797 | time2 = time.time() |
| 1798 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1799 | main.log.report( |
| 1800 | "Time taken for Ping All: " + |
| 1801 | str( timeDiff ) + |
| 1802 | " seconds" ) |
| 1803 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1804 | onpass="PING ALL PASS", |
| 1805 | onfail="PING ALL FAIL" ) |
| 1806 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1807 | case91Result = ( intentResult and pingResult ) |
kelvin-onlab | adfc8db | 2015-03-24 15:52:48 -0700 | [diff] [blame] | 1808 | |
| 1809 | utilities.assert_equals( |
| 1810 | expect=main.TRUE, |
kelvin-onlab | d878fc2 | 2015-03-27 13:33:41 -0700 | [diff] [blame^] | 1811 | actual=case91Result, |
kelvin-onlab | adfc8db | 2015-03-24 15:52:48 -0700 | [diff] [blame] | 1812 | onpass="Install ###$$$ point Intents and Ping All test PASS", |
| 1813 | onfail="Install ###$$$ point Intents and Ping All test FAIL" ) |
| 1814 | |
| 1815 | def CASE92( self ): |
| 1816 | """ |
| 1817 | Install $$$### point intents and verify ping all (Spine Topology) |
| 1818 | """ |
| 1819 | main.log.report( "Add $$$### point intents and verify pingall (Spine Topology)" ) |
| 1820 | main.log.report( "_______________________________________" ) |
| 1821 | import itertools |
| 1822 | import time |
| 1823 | main.case( "Install $$$### point intents" ) |
| 1824 | main.step( "Add point Intents" ) |
| 1825 | intentResult = main.TRUE |
| 1826 | deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) ) |
| 1827 | |
| 1828 | intentIdList = [] |
| 1829 | time1 = time.time() |
| 1830 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 1831 | pool = [] |
| 1832 | for cli in main.CLIs: |
| 1833 | if i >= len( deviceCombos ): |
| 1834 | break |
| 1835 | t = main.Thread( target=cli.addPointIntent, |
| 1836 | threadID=main.threadID, |
| 1837 | name="addPointIntent", |
| 1838 | args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])]) |
| 1839 | pool.append(t) |
| 1840 | #time.sleep(1) |
| 1841 | t.start() |
| 1842 | i = i + 1 |
| 1843 | main.threadID = main.threadID + 1 |
| 1844 | for thread in pool: |
| 1845 | thread.join() |
| 1846 | intentIdList.append(thread.result) |
| 1847 | time2 = time.time() |
| 1848 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
| 1849 | intentResult = main.TRUE |
| 1850 | intentsJson = main.ONOScli2.intents() |
| 1851 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 1852 | intentsJson = intentsJson) |
| 1853 | print getIntentStateResult |
| 1854 | # Takes awhile for all the onos to get the intents |
| 1855 | time.sleep(30) |
| 1856 | main.step( "Verify Ping across all hosts" ) |
| 1857 | pingResult = main.FALSE |
| 1858 | time1 = time.time() |
| 1859 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 1860 | time2 = time.time() |
| 1861 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1862 | main.log.report( |
| 1863 | "Time taken for Ping All: " + |
| 1864 | str( timeDiff ) + |
| 1865 | " seconds" ) |
| 1866 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1867 | onpass="PING ALL PASS", |
| 1868 | onfail="PING ALL FAIL" ) |
| 1869 | |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1870 | case92Result = ( intentResult and pingResult ) |
kelvin-onlab | adfc8db | 2015-03-24 15:52:48 -0700 | [diff] [blame] | 1871 | |
| 1872 | utilities.assert_equals( |
| 1873 | expect=main.TRUE, |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 1874 | actual=case92Result, |
kelvin-onlab | adfc8db | 2015-03-24 15:52:48 -0700 | [diff] [blame] | 1875 | onpass="Install $$$### point Intents and Ping All test PASS", |
| 1876 | onfail="Install $$$### point Intents and Ping All test FAIL" ) |
| 1877 | |
| 1878 | def CASE93( self ): |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 1879 | """ |
| 1880 | Install single-multi point intents and verify Ping all works |
| 1881 | for att topology |
| 1882 | """ |
| 1883 | import copy |
| 1884 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 1885 | main.log.report( "___________________________________________" ) |
| 1886 | main.case( "Install single-multi point intents and Ping all" ) |
| 1887 | deviceLinksCopy = copy.copy( main.deviceLinks ) |
| 1888 | main.step( "Install single-multi point intents" ) |
| 1889 | for i in range( len( deviceLinksCopy ) ): |
| 1890 | pointLink = str( |
| 1891 | deviceLinksCopy[ i ] ).replace( |
| 1892 | "src=", |
| 1893 | "" ).replace( |
| 1894 | "dst=", |
| 1895 | "" ).split( ',' ) |
| 1896 | point1 = pointLink[ 0 ].split( '/' ) |
| 1897 | point2 = pointLink[ 1 ].split( '/' ) |
| 1898 | installResult = main.ONOScli1.addPointIntent( |
| 1899 | point1[ 0 ], point2[ 0 ], int( |
| 1900 | point1[ 1 ] ), int( |
| 1901 | point2[ 1 ] ) ) |
| 1902 | if installResult == main.TRUE: |
| 1903 | print "Installed Point intent between :", point1[ 0 ], int( point1[ 1 ] ), point2[ 0 ], int( point2[ 1 ] ) |
| 1904 | |
| 1905 | main.step( "Obtain the intent id's" ) |
| 1906 | intentsList = main.ONOScli1.getAllIntentIds() |
| 1907 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 1908 | intentsList = ansi_escape.sub( '', intentsList ) |
| 1909 | intentsList = intentsList.replace( |
| 1910 | " onos:intents | grep id=", |
| 1911 | "" ).replace( |
| 1912 | "id=", |
| 1913 | "" ).replace( |
| 1914 | "\r\r", |
| 1915 | "" ) |
| 1916 | intentsList = intentsList.splitlines() |
| 1917 | intentsList = intentsList[ 1: ] |
| 1918 | intentIdList = [] |
| 1919 | for i in range( len( intentsList ) ): |
| 1920 | intentsTemp = intentsList[ i ].split( ',' ) |
| 1921 | intentIdList.append( intentsTemp[ 0 ] ) |
| 1922 | print "Intent IDs: ", intentIdList |
| 1923 | print "Total Intents installed: ", len( intentIdList ) |
| 1924 | |
| 1925 | main.step( "Verify Ping across all hosts" ) |
| 1926 | pingResult = main.FALSE |
| 1927 | time1 = time.time() |
| 1928 | pingResult = main.Mininet1.pingall() |
| 1929 | time2 = time.time() |
| 1930 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1931 | main.log.report( |
| 1932 | "Time taken for Ping All: " + |
| 1933 | str( timeDiff ) + |
| 1934 | " seconds" ) |
| 1935 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1936 | onpass="PING ALL PASS", |
| 1937 | onfail="PING ALL FAIL" ) |
| 1938 | |
| 1939 | case8_result = installResult and pingResult |
| 1940 | utilities.assert_equals( |
| 1941 | expect=main.TRUE, |
| 1942 | actual=case8_result, |
| 1943 | onpass="Ping all test after Point intents addition successful", |
| 1944 | onfail="Ping all test after Point intents addition failed" ) |
| 1945 | |
kelvin-onlab | adfc8db | 2015-03-24 15:52:48 -0700 | [diff] [blame] | 1946 | def CASE94( self ): |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 1947 | """ |
| 1948 | Install single-multi point intents and verify Ping all works |
| 1949 | """ |
| 1950 | import copy |
| 1951 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 1952 | main.log.report( "___________________________________________" ) |
| 1953 | main.case( "Install single-multi point intents and Ping all" ) |
| 1954 | deviceLinksCopy = copy.copy( main.deviceLinks ) |
| 1955 | main.step( "Install single-multi point intents" ) |
| 1956 | for i in range( len( deviceLinksCopy ) ): |
| 1957 | pointLink = str( |
| 1958 | deviceLinksCopy[ i ] ).replace( |
| 1959 | "src=", |
| 1960 | "" ).replace( |
| 1961 | "dst=", |
| 1962 | "" ).split( ',' ) |
| 1963 | point1 = pointLink[ 0 ].split( '/' ) |
| 1964 | point2 = pointLink[ 1 ].split( '/' ) |
| 1965 | installResult = main.ONOScli1.addPointIntent( |
| 1966 | point1[ 0 ], point2[ 0 ], int( |
| 1967 | point1[ 1 ] ), int( |
| 1968 | point2[ 1 ] ) ) |
| 1969 | if installResult == main.TRUE: |
| 1970 | print "Installed Point intent between :", point1[ 0 ], int( point1[ 1 ] ), point2[ 0 ], int( point2[ 1 ] ) |
| 1971 | |
| 1972 | main.step( "Obtain the intent id's" ) |
| 1973 | intentsList = main.ONOScli1.getAllIntentIds() |
| 1974 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 1975 | intentsList = ansi_escape.sub( '', intentsList ) |
| 1976 | intentsList = intentsList.replace( |
| 1977 | " onos:intents | grep id=", |
| 1978 | "" ).replace( |
| 1979 | "id=", |
| 1980 | "" ).replace( |
| 1981 | "\r\r", |
| 1982 | "" ) |
| 1983 | intentsList = intentsList.splitlines() |
| 1984 | intentsList = intentsList[ 1: ] |
| 1985 | intentIdList = [] |
| 1986 | for i in range( len( intentsList ) ): |
| 1987 | intentsTemp = intentsList[ i ].split( ',' ) |
| 1988 | intentIdList.append( intentsTemp[ 0 ] ) |
| 1989 | print "Intent IDs: ", intentIdList |
| 1990 | print "Total Intents installed: ", len( intentIdList ) |
| 1991 | |
| 1992 | main.step( "Verify Ping across all hosts" ) |
| 1993 | pingResult = main.FALSE |
| 1994 | time1 = time.time() |
| 1995 | pingResult = main.Mininet1.pingall() |
| 1996 | time2 = time.time() |
| 1997 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1998 | main.log.report( |
| 1999 | "Time taken for Ping All: " + |
| 2000 | str( timeDiff ) + |
| 2001 | " seconds" ) |
| 2002 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2003 | onpass="PING ALL PASS", |
| 2004 | onfail="PING ALL FAIL" ) |
| 2005 | |
| 2006 | case8_result = installResult and pingResult |
| 2007 | utilities.assert_equals( |
| 2008 | expect=main.TRUE, |
| 2009 | actual=case8_result, |
| 2010 | onpass="Ping all test after Point intents addition successful", |
| 2011 | onfail="Ping all test after Point intents addition failed" ) |
| 2012 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 2013 | def CASE10( self ): |
kelvin-onlab | 7642bb1 | 2015-02-27 13:48:17 -0800 | [diff] [blame] | 2014 | import time |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 2015 | """ |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 2016 | Remove all Intents |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 2017 | """ |
| 2018 | main.log.report( "Remove all intents that were installed previously" ) |
| 2019 | main.log.report( "______________________________________________" ) |
| 2020 | main.log.info( "Remove all intents" ) |
| 2021 | main.case( "Removing intents" ) |
| 2022 | main.step( "Obtain the intent id's first" ) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 2023 | intentsList = main.ONOScli1.getAllIntentIds() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 2024 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 2025 | intentsList = ansi_escape.sub( '', intentsList ) |
| 2026 | intentsList = intentsList.replace( |
| 2027 | " onos:intents | grep id=", |
| 2028 | "" ).replace( |
| 2029 | "id=", |
| 2030 | "" ).replace( |
| 2031 | "\r\r", |
| 2032 | "" ) |
| 2033 | intentsList = intentsList.splitlines() |
| 2034 | intentsList = intentsList[ 1: ] |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 2035 | intentIdList = [] |
| 2036 | step1Result = main.TRUE |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 2037 | moreIntents = main.TRUE |
| 2038 | removeIntentCount = 0 |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 2039 | intentsCount = len(intentsList) |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 2040 | print "Current number of intents" , len(intentsList) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 2041 | if ( len( intentsList ) > 1 ): |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 2042 | results = main.TRUE |
kelvin-onlab | 01f1b2c | 2015-03-11 10:41:06 -0700 | [diff] [blame] | 2043 | main.log.info("Removing intent...") |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 2044 | while moreIntents: |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 2045 | if removeIntentCount == 5: |
| 2046 | break |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 2047 | removeIntentCount = removeIntentCount + 1 |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 2048 | intentsList1 = main.ONOScli1.getAllIntentIds() |
kelvin-onlab | 01f1b2c | 2015-03-11 10:41:06 -0700 | [diff] [blame] | 2049 | if len( intentsList1 ) == 0: |
| 2050 | break |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 2051 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 2052 | intentsList1 = ansi_escape.sub( '', intentsList1 ) |
| 2053 | intentsList1 = intentsList1.replace( |
| 2054 | " onos:intents | grep id=", |
| 2055 | "" ).replace( |
| 2056 | " state=", |
| 2057 | "" ).replace( |
| 2058 | "\r\r", |
| 2059 | "" ) |
| 2060 | intentsList1 = intentsList1.splitlines() |
kelvin-onlab | 01f1b2c | 2015-03-11 10:41:06 -0700 | [diff] [blame] | 2061 | intentsList1 = intentsList1[ 1: ] |
| 2062 | print "Round %d intents to remove: " %(removeIntentCount) |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 2063 | print intentsList1 |
| 2064 | intentIdList1 = [] |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 2065 | if ( len( intentsList1 ) > 0 ): |
kelvin-onlab | 01f1b2c | 2015-03-11 10:41:06 -0700 | [diff] [blame] | 2066 | moreIntents = main.TRUE |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 2067 | for i in range( len( intentsList1 ) ): |
| 2068 | intentsTemp1 = intentsList1[ i ].split( ',' ) |
| 2069 | intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] ) |
| 2070 | print "Leftover Intent IDs: ", intentIdList1 |
| 2071 | print len(intentIdList1) |
kelvin-onlab | adfc8db | 2015-03-24 15:52:48 -0700 | [diff] [blame] | 2072 | time1 = time.time() |
| 2073 | for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ): |
| 2074 | pool = [] |
| 2075 | for cli in main.CLIs: |
| 2076 | if i >= len( intentIdList1 ): |
| 2077 | break |
| 2078 | t = main.Thread( target=cli.removeIntent, |
| 2079 | threadID=main.threadID, |
| 2080 | name="removeIntent", |
| 2081 | args=[intentIdList1[i],'org.onosproject.cli',True,False]) |
| 2082 | pool.append(t) |
kelvin-onlab | adfc8db | 2015-03-24 15:52:48 -0700 | [diff] [blame] | 2083 | t.start() |
| 2084 | i = i + 1 |
| 2085 | main.threadID = main.threadID + 1 |
| 2086 | for thread in pool: |
| 2087 | thread.join() |
| 2088 | intentIdList.append(thread.result) |
| 2089 | time2 = time.time() |
| 2090 | main.log.info("Time for removing host intents: %2f seconds" %(time2-time1)) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 2091 | time.sleep(10) |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 2092 | else: |
Hari Krishna | ef1bd4e | 2015-03-12 16:55:30 -0700 | [diff] [blame] | 2093 | time.sleep(15) |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 2094 | if len( main.ONOScli1.intents()): |
Hari Krishna | ef1bd4e | 2015-03-12 16:55:30 -0700 | [diff] [blame] | 2095 | continue |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 2096 | break |
kelvin-onlab | 36c02b1 | 2015-03-11 11:25:55 -0700 | [diff] [blame] | 2097 | |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 2098 | else: |
kelvin-onlab | 65a72d2 | 2015-03-26 13:46:32 -0700 | [diff] [blame] | 2099 | print "Removed %d intents" %(intentsCount) |
Hari Krishna | a43d4e9 | 2014-12-19 13:22:40 -0800 | [diff] [blame] | 2100 | step1Result = main.TRUE |
| 2101 | else: |
| 2102 | print "No Intent IDs found in Intents list: ", intentsList |
| 2103 | step1Result = main.FALSE |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 2104 | |
kelvin-onlab | dc8719b | 2015-03-02 14:01:52 -0800 | [diff] [blame] | 2105 | print main.ONOScli1.intents() |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 2106 | caseResult10 = step1Result |
| 2107 | utilities.assert_equals( expect=main.TRUE, actual=caseResult10, |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 2108 | onpass="Intent removal test successful", |
| 2109 | onfail="Intent removal test failed" ) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 2110 | |
| 2111 | def CASE11( self, main ): |
| 2112 | """ |
| 2113 | Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it |
| 2114 | """ |
| 2115 | import re |
| 2116 | import copy |
| 2117 | import time |
| 2118 | |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 2119 | Thread = imp.load_source('Thread','/home/admin/ONLabTest/TestON/tests/OnosCHO/Thread.py') |
| 2120 | threadID = 0 |
| 2121 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 2122 | main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" ) |
| 2123 | main.log.report( "_____________________________________________________" ) |
| 2124 | main.case( "Enable Intent based Reactive forwarding and Verify ping all" ) |
| 2125 | main.step( "Enable intent based Reactive forwarding" ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 2126 | installResult = main.FALSE |
| 2127 | feature = "onos-app-ifwd" |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 2128 | |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 2129 | pool = [] |
| 2130 | time1 = time.time() |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 2131 | for cli,feature in main.CLIs: |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 2132 | t = main.Thread(target=cli,threadID=threadID, |
| 2133 | name="featureInstall",args=[feature]) |
| 2134 | pool.append(t) |
| 2135 | t.start() |
| 2136 | threadID = threadID + 1 |
| 2137 | |
| 2138 | results = [] |
| 2139 | for thread in pool: |
| 2140 | thread.join() |
| 2141 | results.append(thread.result) |
| 2142 | time2 = time.time() |
| 2143 | |
| 2144 | if( all(result == main.TRUE for result in results) == False): |
| 2145 | main.log.info("Did not install onos-app-ifwd feature properly") |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 2146 | #main.cleanup() |
| 2147 | #main.exit() |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 2148 | else: |
| 2149 | main.log.info("Successful feature:install onos-app-ifwd") |
| 2150 | installResult = main.TRUE |
| 2151 | main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1)) |
| 2152 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 2153 | main.step( "Verify Pingall" ) |
| 2154 | ping_result = main.FALSE |
| 2155 | time1 = time.time() |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 2156 | ping_result = main.Mininet1.pingall(timeout=600) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 2157 | time2 = time.time() |
| 2158 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2159 | main.log.report( |
| 2160 | "Time taken for Ping All: " + |
| 2161 | str( timeDiff ) + |
| 2162 | " seconds" ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 2163 | |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 2164 | if ping_result == main.TRUE: |
| 2165 | main.log.report( "Pingall Test in Reactive mode successful" ) |
| 2166 | else: |
| 2167 | main.log.report( "Pingall Test in Reactive mode failed" ) |
| 2168 | |
| 2169 | main.step( "Disable Intent based Reactive forwarding" ) |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 2170 | uninstallResult = main.FALSE |
| 2171 | |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 2172 | pool = [] |
| 2173 | time1 = time.time() |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 2174 | for cli,feature in main.CLIs: |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 2175 | t = main.Thread(target=cli,threadID=threadID, |
| 2176 | name="featureUninstall",args=[feature]) |
| 2177 | pool.append(t) |
| 2178 | t.start() |
| 2179 | threadID = threadID + 1 |
| 2180 | |
| 2181 | results = [] |
| 2182 | for thread in pool: |
| 2183 | thread.join() |
| 2184 | results.append(thread.result) |
| 2185 | time2 = time.time() |
| 2186 | |
| 2187 | if( all(result == main.TRUE for result in results) == False): |
| 2188 | main.log.info("Did not uninstall onos-app-ifwd feature properly") |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 2189 | uninstallResult = main.FALSE |
| 2190 | #main.cleanup() |
| 2191 | #main.exit() |
kelvin-onlab | 54400a9 | 2015-02-26 18:05:51 -0800 | [diff] [blame] | 2192 | else: |
| 2193 | main.log.info("Successful feature:uninstall onos-app-ifwd") |
| 2194 | uninstallResult = main.TRUE |
| 2195 | main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1)) |
Hari Krishna | 22c3d41 | 2015-02-17 16:48:12 -0800 | [diff] [blame] | 2196 | |
| 2197 | # Waiting for reative flows to be cleared. |
| 2198 | time.sleep( 10 ) |
| 2199 | |
| 2200 | case11Result = installResult and ping_result and uninstallResult |
| 2201 | utilities.assert_equals( expect=main.TRUE, actual=case11Result, |
| 2202 | onpass="Intent based Reactive forwarding Pingall test PASS", |
| 2203 | onfail="Intent based Reactive forwarding Pingall test FAIL" ) |
| 2204 | |
Hari Krishna | b35c6d0 | 2015-03-18 11:13:51 -0700 | [diff] [blame] | 2205 | def CASE99(self): |
| 2206 | import time |
| 2207 | # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE |
| 2208 | main.step( "Stop ONOS on all Nodes" ) |
| 2209 | stopResult = main.TRUE |
| 2210 | for i in range( 1, int( main.numCtrls ) + 1 ): |
| 2211 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 2212 | main.log.info( "Stopping ONOS Node IP: " + ONOS_ip ) |
| 2213 | sresult = main.ONOSbench.onosStop( ONOS_ip ) |
| 2214 | utilities.assert_equals( expect=main.TRUE, actual=sresult, |
| 2215 | onpass="Test step PASS", |
| 2216 | onfail="Test step FAIL" ) |
| 2217 | stopResult = ( stopResult and sresult ) |
| 2218 | |
| 2219 | main.step( "Start ONOS on all Nodes" ) |
| 2220 | startResult = main.TRUE |
| 2221 | for i in range( 1, int( main.numCtrls ) + 1 ): |
| 2222 | ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ] |
| 2223 | main.log.info( "Starting ONOS Node IP: " + ONOS_ip ) |
| 2224 | sresult = main.ONOSbench.onosStart( ONOS_ip ) |
| 2225 | utilities.assert_equals( expect=main.TRUE, actual=sresult, |
| 2226 | onpass="Test step PASS", |
| 2227 | onfail="Test step FAIL" ) |
| 2228 | startResult = ( startResult and sresult ) |
| 2229 | |
| 2230 | main.step( "Start ONOS CLI on all nodes" ) |
| 2231 | cliResult = main.TRUE |
| 2232 | time.sleep( 30 ) |
| 2233 | main.log.step(" Start ONOS cli using thread ") |
| 2234 | pool = [] |
| 2235 | time1 = time.time() |
| 2236 | for i in range( int( main.numCtrls ) ): |
| 2237 | t = main.Thread(target=main.CLIs[i].startOnosCli, |
| 2238 | threadID=main.threadID, |
| 2239 | name="startOnosCli", |
| 2240 | args=[main.nodes[i].ip_address]) |
| 2241 | pool.append(t) |
| 2242 | t.start() |
| 2243 | main.threadID = main.threadID + 1 |
| 2244 | for t in pool: |
| 2245 | t.join() |
| 2246 | cliResult = cliResult and t.result |
| 2247 | time2 = time.time() |
| 2248 | |
| 2249 | if not cliResult: |
| 2250 | main.log.info("ONOS CLI did not start up properly") |
| 2251 | #main.cleanup() |
| 2252 | #main.exit() |
| 2253 | else: |
| 2254 | main.log.info("Successful CLI startup") |
| 2255 | main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1)) |
| 2256 | |
| 2257 | case99Result = ( startResult and cliResult ) |
| 2258 | time.sleep(30) |
| 2259 | utilities.assert_equals( |
| 2260 | expect=main.TRUE, |
| 2261 | actual=case99Result, |
| 2262 | onpass="Starting new Chordal topology test PASS", |
| 2263 | onfail="Starting new Chordal topology test FAIL" ) |
| 2264 | |
| 2265 | |
kelvin-onlab | 78f7d2d | 2015-03-02 17:37:35 -0800 | [diff] [blame] | 2266 | |
kelvin-onlab | c3ab301 | 2015-03-10 15:04:46 -0700 | [diff] [blame] | 2267 | |