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