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