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