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