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