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