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