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