kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 1 | |
| 2 | # Testing the basic functionality of ONOS Next |
| 3 | # For sanity and driver functionality excercises only. |
| 4 | |
| 5 | import time |
| 6 | import json |
| 7 | |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 8 | class FuncIntent: |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 9 | |
| 10 | def __init__( self ): |
| 11 | self.default = '' |
| 12 | |
| 13 | def CASE10( self, main ): |
| 14 | import time |
| 15 | import os |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 16 | import imp |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 17 | """ |
| 18 | Startup sequence: |
| 19 | cell <name> |
| 20 | onos-verify-cell |
| 21 | onos-remove-raft-log |
| 22 | git pull |
| 23 | mvn clean install |
| 24 | onos-package |
| 25 | onos-install -f |
| 26 | onos-wait-for-start |
| 27 | """ |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 28 | global init |
cameron@onlab.us | 59d29d9 | 2015-05-11 14:31:54 -0700 | [diff] [blame] | 29 | global globalONOSip |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 30 | try: |
| 31 | if type(init) is not bool: |
| 32 | init = False |
| 33 | except NameError: |
| 34 | init = False |
kelvin-onlab | 132bd5b | 2015-05-18 18:15:26 -0700 | [diff] [blame] | 35 | |
| 36 | main.wrapper = imp.load_source( 'FuncIntentFunction', |
| 37 | '/home/admin/ONLabTest/TestON/tests/' + |
| 38 | 'FuncIntent/Dependency/' + |
| 39 | 'FuncIntentFunction.py' ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 40 | #Local variables |
| 41 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 42 | apps = main.params[ 'ENV' ][ 'cellApps' ] |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 43 | gitBranch = main.params[ 'GIT' ][ 'branch' ] |
cameron@onlab.us | 59d29d9 | 2015-05-11 14:31:54 -0700 | [diff] [blame] | 44 | benchIp = os.environ[ 'OCN' ] |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 45 | benchUser = main.params[ 'BENCH' ][ 'user' ] |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 46 | topology = main.params[ 'MININET' ][ 'topo' ] |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 47 | main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] ) |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 48 | main.numLinks = int( main.params[ 'MININET' ][ 'links' ] ) |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 49 | main.numCtrls = main.params[ 'CTRL' ][ 'num' ] |
kelvin-onlab | 132bd5b | 2015-05-18 18:15:26 -0700 | [diff] [blame] | 50 | main.ONOSport = [] |
| 51 | main.hostsData = {} |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 52 | PULLCODE = False |
| 53 | if main.params[ 'GIT' ][ 'pull' ] == 'True': |
| 54 | PULLCODE = True |
| 55 | main.case( "Setting up test environment" ) |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 56 | main.CLIs = [] |
| 57 | for i in range( 1, int( main.numCtrls ) + 1 ): |
| 58 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
kelvin-onlab | 132bd5b | 2015-05-18 18:15:26 -0700 | [diff] [blame] | 59 | main.ONOSport.append( main.params[ 'CTRL' ][ 'port' + str( i ) ] ) |
cameron@onlab.us | 7fd2a52 | 2015-05-14 11:20:33 -0700 | [diff] [blame] | 60 | |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 61 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 62 | if init == False: |
| 63 | init = True |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 64 | |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 65 | main.scale = ( main.params[ 'SCALE' ] ).split( "," ) |
| 66 | main.numCtrls = int( main.scale[ 0 ] ) |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 67 | |
| 68 | if PULLCODE: |
| 69 | main.step( "Git checkout and pull " + gitBranch ) |
| 70 | main.ONOSbench.gitCheckout( gitBranch ) |
| 71 | gitPullResult = main.ONOSbench.gitPull() |
| 72 | if gitPullResult == main.ERROR: |
| 73 | main.log.error( "Error pulling git branch" ) |
| 74 | main.step( "Using mvn clean & install" ) |
| 75 | cleanInstallResult = main.ONOSbench.cleanInstall() |
| 76 | stepResult = cleanInstallResult |
| 77 | utilities.assert_equals( expect=main.TRUE, |
| 78 | actual=stepResult, |
| 79 | onpass="Successfully compiled " + |
| 80 | "latest ONOS", |
| 81 | onfail="Failed to compile " + |
| 82 | "latest ONOS" ) |
| 83 | else: |
| 84 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 85 | "clean install" ) |
kelvin-onlab | 132bd5b | 2015-05-18 18:15:26 -0700 | [diff] [blame] | 86 | |
cameron@onlab.us | 033cc0f | 2015-05-15 15:27:43 -0700 | [diff] [blame] | 87 | globalONOSip = main.ONOSbench.getOnosIps() |
kelvin-onlab | 0a28a74 | 2015-05-18 16:03:13 -0700 | [diff] [blame] | 88 | |
cameron@onlab.us | 033cc0f | 2015-05-15 15:27:43 -0700 | [diff] [blame] | 89 | maxNodes = ( len(globalONOSip) - 2 ) |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 90 | |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 91 | main.numCtrls = int( main.scale[ 0 ] ) |
| 92 | main.scale.remove( main.scale[ 0 ] ) |
cameron@onlab.us | 59d29d9 | 2015-05-11 14:31:54 -0700 | [diff] [blame] | 93 | |
cameron@onlab.us | 033cc0f | 2015-05-15 15:27:43 -0700 | [diff] [blame] | 94 | main.ONOSip = [] |
kelvin-onlab | 0a28a74 | 2015-05-18 16:03:13 -0700 | [diff] [blame] | 95 | for i in range( maxNodes ): |
cameron@onlab.us | 59d29d9 | 2015-05-11 14:31:54 -0700 | [diff] [blame] | 96 | main.ONOSip.append( globalONOSip[i] ) |
| 97 | |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 98 | #kill off all onos processes |
| 99 | main.log.info( "Safety check, killing all ONOS processes" + |
| 100 | " before initiating enviornment setup" ) |
kelvin-onlab | 132bd5b | 2015-05-18 18:15:26 -0700 | [diff] [blame] | 101 | for i in range(maxNodes): |
| 102 | main.ONOSbench.onosDie( globalONOSip[ i ] ) |
| 103 | |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 104 | print "NODE COUNT = ", main.numCtrls |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 105 | main.log.info( "Creating cell file" ) |
| 106 | cellIp = [] |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 107 | for i in range( main.numCtrls ): |
| 108 | cellIp.append( str( main.ONOSip[ i ] ) ) |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 109 | print cellIp |
| 110 | main.ONOSbench.createCellFile( benchIp, cellName, "", |
| 111 | str( apps ), *cellIp ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 112 | |
| 113 | main.step( "Apply cell to environment" ) |
| 114 | cellResult = main.ONOSbench.setCell( cellName ) |
| 115 | verifyResult = main.ONOSbench.verifyCell() |
| 116 | stepResult = cellResult and verifyResult |
| 117 | utilities.assert_equals( expect=main.TRUE, |
| 118 | actual=stepResult, |
| 119 | onpass="Successfully applied cell to " + \ |
| 120 | "environment", |
| 121 | onfail="Failed to apply cell to environment " ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 122 | |
| 123 | main.step( "Creating ONOS package" ) |
| 124 | packageResult = main.ONOSbench.onosPackage() |
| 125 | stepResult = packageResult |
| 126 | utilities.assert_equals( expect=main.TRUE, |
| 127 | actual=stepResult, |
| 128 | onpass="Successfully created ONOS package", |
| 129 | onfail="Failed to create ONOS package" ) |
| 130 | |
| 131 | main.step( "Uninstalling ONOS package" ) |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 132 | onosUninstallResult = main.TRUE |
cameron@onlab.us | 033cc0f | 2015-05-15 15:27:43 -0700 | [diff] [blame] | 133 | for i in range( main.numCtrls ): |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 134 | onosUninstallResult = onosUninstallResult and \ |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 135 | main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 136 | stepResult = onosUninstallResult |
| 137 | utilities.assert_equals( expect=main.TRUE, |
| 138 | actual=stepResult, |
| 139 | onpass="Successfully uninstalled ONOS package", |
| 140 | onfail="Failed to uninstall ONOS package" ) |
| 141 | time.sleep( 5 ) |
| 142 | main.step( "Installing ONOS package" ) |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 143 | onosInstallResult = main.TRUE |
cameron@onlab.us | 033cc0f | 2015-05-15 15:27:43 -0700 | [diff] [blame] | 144 | for i in range( main.numCtrls ): |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 145 | onosInstallResult = onosInstallResult and \ |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 146 | main.ONOSbench.onosInstall( node=main.ONOSip[ i ] ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 147 | stepResult = onosInstallResult |
| 148 | utilities.assert_equals( expect=main.TRUE, |
| 149 | actual=stepResult, |
| 150 | onpass="Successfully installed ONOS package", |
| 151 | onfail="Failed to install ONOS package" ) |
| 152 | |
cameron@onlab.us | 59d29d9 | 2015-05-11 14:31:54 -0700 | [diff] [blame] | 153 | time.sleep( 20 ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 154 | main.step( "Starting ONOS service" ) |
| 155 | stopResult = main.TRUE |
| 156 | startResult = main.TRUE |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 157 | onosIsUp = main.TRUE |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 158 | for i in range( main.numCtrls ): |
| 159 | onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 160 | if onosIsUp == main.TRUE: |
| 161 | main.log.report( "ONOS instance is up and ready" ) |
| 162 | else: |
| 163 | main.log.report( "ONOS instance may not be up, stop and " + |
| 164 | "start ONOS again " ) |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 165 | for i in range( main.numCtrls ): |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 166 | stopResult = stopResult and \ |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 167 | main.ONOSbench.onosStop( main.ONOSip[ i ] ) |
| 168 | for i in range( main.numCtrls ): |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 169 | startResult = startResult and \ |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 170 | main.ONOSbench.onosStart( main.ONOSip[ i ] ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 171 | stepResult = onosIsUp and stopResult and startResult |
| 172 | utilities.assert_equals( expect=main.TRUE, |
| 173 | actual=stepResult, |
| 174 | onpass="ONOS service is ready", |
| 175 | onfail="ONOS service did not start properly" ) |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 176 | |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 177 | main.step( "Start ONOS cli" ) |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 178 | cliResult = main.TRUE |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 179 | for i in range( main.numCtrls ): |
| 180 | cliResult = cliResult and \ |
| 181 | main.CLIs[i].startOnosCli( main.ONOSip[ i ] ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 182 | stepResult = cliResult |
| 183 | utilities.assert_equals( expect=main.TRUE, |
| 184 | actual=stepResult, |
| 185 | onpass="Successfully start ONOS cli", |
| 186 | onfail="Failed to start ONOS cli" ) |
| 187 | |
kelvin-onlab | 0a28a74 | 2015-05-18 16:03:13 -0700 | [diff] [blame] | 188 | def CASE9( self, main ): |
kelvin-onlab | 132bd5b | 2015-05-18 18:15:26 -0700 | [diff] [blame] | 189 | ''' |
| 190 | Report errors/warnings/exceptions |
| 191 | ''' |
| 192 | main.log.info( "Error report: \n" ) |
| 193 | main.ONOSbench.logReport( globalONOSip[0], |
| 194 | [ "INFO", "FOLLOWER", "WARN", "flow", "ERROR" , "Except" ], |
| 195 | "s" ) |
| 196 | #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 197 | |
| 198 | def CASE11( self, main ): |
| 199 | """ |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 200 | Start mininet |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 201 | """ |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 202 | main.log.report( "Start Mininet topology" ) |
kelvin-onlab | 132bd5b | 2015-05-18 18:15:26 -0700 | [diff] [blame] | 203 | main.log.case( "Start Mininet topology" ) |
| 204 | |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 205 | main.step( "Starting Mininet Topology" ) |
| 206 | topoResult = main.Mininet1.startNet( topoFile=topology ) |
| 207 | stepResult = topoResult |
| 208 | utilities.assert_equals( expect=main.TRUE, |
| 209 | actual=stepResult, |
| 210 | onpass="Successfully loaded topology", |
| 211 | onfail="Failed to load topology" ) |
| 212 | # Exit if topology did not load properly |
| 213 | if not topoResult: |
| 214 | main.cleanup() |
| 215 | main.exit() |
| 216 | |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 217 | def CASE12( self, main ): |
| 218 | """ |
| 219 | Assign mastership to controllers |
| 220 | """ |
| 221 | import re |
| 222 | |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 223 | main.case( "Assign switches to controllers" ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 224 | main.step( "Assigning switches to controllers" ) |
| 225 | assignResult = main.TRUE |
kelvin-onlab | 5cbf999 | 2015-05-05 14:34:07 -0700 | [diff] [blame] | 226 | for i in range( 1, ( main.numSwitch + 1 ) ): |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 227 | main.Mininet1.assignSwController( sw=str( i ), |
| 228 | count=1, |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 229 | ip1=main.ONOSip[ 0 ], |
| 230 | port1=main.ONOSport[ 0 ] ) |
kelvin-onlab | 5cbf999 | 2015-05-05 14:34:07 -0700 | [diff] [blame] | 231 | for i in range( 1, ( main.numSwitch + 1 ) ): |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 232 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 233 | print( "Response is " + str( response ) ) |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 234 | if re.search( "tcp:" + main.ONOSip[ 0 ], response ): |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 235 | assignResult = assignResult and main.TRUE |
| 236 | else: |
| 237 | assignResult = main.FALSE |
| 238 | stepResult = assignResult |
| 239 | utilities.assert_equals( expect=main.TRUE, |
| 240 | actual=stepResult, |
| 241 | onpass="Successfully assigned switches" + |
| 242 | "to controller", |
| 243 | onfail="Failed to assign switches to " + |
| 244 | "controller" ) |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 245 | def CASE13( self, main ): |
| 246 | """ |
| 247 | Discover all hosts and store its data to a dictionary |
| 248 | """ |
| 249 | main.case( "Discover all hosts" ) |
| 250 | |
| 251 | stepResult = main.TRUE |
kelvin-onlab | 132bd5b | 2015-05-18 18:15:26 -0700 | [diff] [blame] | 252 | main.step( "Discover all hosts using pingall " ) |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 253 | stepResult = main.wrapper.getHostsData( main ) |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 254 | utilities.assert_equals( expect=main.TRUE, |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 255 | actual=stepResult, |
| 256 | onpass="Successfully discovered hosts", |
| 257 | onfail="Failed to discover hosts" ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 258 | |
kelvin-onlab | 2ff5702 | 2015-05-29 10:48:51 -0700 | [diff] [blame] | 259 | def CASE14( self, main ): |
| 260 | """ |
| 261 | Stop mininet |
| 262 | """ |
| 263 | main.log.report( "Stop Mininet topology" ) |
| 264 | main.log.case( "Stop Mininet topology" ) |
| 265 | |
| 266 | main.step( "Stopping Mininet Topology" ) |
| 267 | topoResult = main.Mininet1.stopNet( ) |
| 268 | stepResult = topoResult |
| 269 | utilities.assert_equals( expect=main.TRUE, |
| 270 | actual=stepResult, |
| 271 | onpass="Successfully stop mininet", |
| 272 | onfail="Failed to stop mininet" ) |
| 273 | # Exit if topology did not load properly |
| 274 | if not topoResult: |
| 275 | main.cleanup() |
| 276 | main.exit() |
| 277 | |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 278 | def CASE1001( self, main ): |
kelvin-onlab | 7c577e8 | 2015-05-07 10:45:16 -0700 | [diff] [blame] | 279 | """ |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 280 | Add host intents between 2 host: |
| 281 | - Discover hosts |
| 282 | - Add host intents |
| 283 | - Check intents |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 284 | - Verify flows |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 285 | - Ping hosts |
| 286 | - Reroute |
| 287 | - Link down |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 288 | - Verify flows |
| 289 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 290 | - Ping hosts |
| 291 | - Link up |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 292 | - Verify flows |
| 293 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 294 | - Ping hosts |
| 295 | - Remove intents |
kelvin-onlab | 7c577e8 | 2015-05-07 10:45:16 -0700 | [diff] [blame] | 296 | """ |
| 297 | import time |
| 298 | import json |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 299 | import re |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 300 | |
| 301 | # Assert variables - These variable's name|format must be followed |
| 302 | # if you want to use the wrapper function |
| 303 | assert main, "There is no main" |
| 304 | assert main.CLIs, "There is no main.CLIs" |
| 305 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 306 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 307 | main.numSwitch" |
| 308 | |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 309 | main.case( "Add host intents between 2 host" ) |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 310 | |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 311 | stepResult = main.TRUE |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 312 | main.step( "IPV4: Add host intents between h1 and h9" ) |
| 313 | stepResult = main.wrapper.hostIntent( main, |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 314 | onosNode='0', |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 315 | name='IPV4', |
| 316 | host1='h1', |
| 317 | host2='h9', |
| 318 | host1Id='00:00:00:00:00:01/-1', |
| 319 | host2Id='00:00:00:00:00:09/-1', |
| 320 | sw1='s5', |
| 321 | sw2='s2', |
| 322 | expectedLink=18 ) |
kelvin-onlab | 7c577e8 | 2015-05-07 10:45:16 -0700 | [diff] [blame] | 323 | |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 324 | utilities.assert_equals( expect=main.TRUE, |
| 325 | actual=stepResult, |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 326 | onpass="IPV4: Add host intent successful", |
| 327 | onfail="IPV4: Add host intent failed" ) |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 328 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 329 | stepResult = main.TRUE |
kelvin-onlab | 381b34c | 2015-05-21 09:21:06 -0700 | [diff] [blame] | 330 | main.step( "DUALSTACK1: Add host intents between h3 and h11" ) |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 331 | stepResult = main.wrapper.hostIntent( main, |
| 332 | name='DUALSTACK', |
| 333 | host1='h3', |
| 334 | host2='h11', |
| 335 | host1Id='00:00:00:00:00:03/-1', |
kelvin-onlab | 132bd5b | 2015-05-18 18:15:26 -0700 | [diff] [blame] | 336 | host2Id='00:00:00:00:00:0B/-1', |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 337 | sw1='s5', |
| 338 | sw2='s2', |
| 339 | expectedLink=18 ) |
| 340 | |
| 341 | utilities.assert_equals( expect=main.TRUE, |
| 342 | actual=stepResult, |
kelvin-onlab | 381b34c | 2015-05-21 09:21:06 -0700 | [diff] [blame] | 343 | onpass="DUALSTACK1: Add host intent" + |
| 344 | " successful", |
| 345 | onfail="DUALSTACK1: Add host intent failed" ) |
| 346 | |
| 347 | stepResult = main.TRUE |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 348 | main.step( "DUALSTACK2: Add host intents between h1 and h11" ) |
kelvin-onlab | 381b34c | 2015-05-21 09:21:06 -0700 | [diff] [blame] | 349 | stepResult = main.wrapper.hostIntent( main, |
| 350 | name='DUALSTACK2', |
| 351 | host1='h1', |
| 352 | host2='h11', |
| 353 | sw1='s5', |
| 354 | sw2='s2', |
| 355 | expectedLink=18 ) |
| 356 | |
| 357 | utilities.assert_equals( expect=main.TRUE, |
| 358 | actual=stepResult, |
| 359 | onpass="DUALSTACK2: Add host intent" + |
| 360 | " successful", |
| 361 | onfail="DUALSTACK2: Add host intent failed" ) |
kelvin-onlab | 7c577e8 | 2015-05-07 10:45:16 -0700 | [diff] [blame] | 362 | |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 363 | stepResult = main.TRUE |
| 364 | main.step( "1HOP: Add host intents between h1 and h3" ) |
| 365 | stepResult = main.wrapper.hostIntent( main, |
| 366 | name='1HOP', |
| 367 | host1='h1', |
| 368 | host2='h3' ) |
| 369 | |
| 370 | utilities.assert_equals( expect=main.TRUE, |
| 371 | actual=stepResult, |
| 372 | onpass="1HOP: Add host intent" + |
| 373 | " successful", |
| 374 | onfail="1HOP: Add host intent failed" ) |
| 375 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 376 | stepResult = main.TRUE |
kaouthera | 6f37d85 | 2015-05-27 13:52:08 -0700 | [diff] [blame] | 377 | main.step( "VLAN1: Add vlan host intents between h4 and h12" ) |
| 378 | stepResult = main.wrapper.hostIntent( main, |
| 379 | name='VLAN1', |
| 380 | host1='h4', |
| 381 | host2='h12', |
| 382 | host1Id='00:00:00:00:00:04/100', |
| 383 | host2Id='00:00:00:00:00:0C/100', |
| 384 | sw1='s5', |
| 385 | sw2='s2', |
| 386 | expectedLink=18 ) |
| 387 | |
| 388 | utilities.assert_equals( expect=main.TRUE, |
| 389 | actual=stepResult, |
kelvin-onlab | 2ff5702 | 2015-05-29 10:48:51 -0700 | [diff] [blame] | 390 | onpass="VLAN1: Add vlan host" + |
| 391 | " intent successful", |
kaouthera | 6f37d85 | 2015-05-27 13:52:08 -0700 | [diff] [blame] | 392 | onfail="VLAN1: Add vlan host intent failed" ) |
kelvin-onlab | 2ff5702 | 2015-05-29 10:48:51 -0700 | [diff] [blame] | 393 | |
kaouthera | 6f37d85 | 2015-05-27 13:52:08 -0700 | [diff] [blame] | 394 | stepResult = main.TRUE |
| 395 | main.step( "VLAN2: Add inter vlan host intents between h13 and h20" ) |
| 396 | stepResult = main.wrapper.hostIntent( main, |
| 397 | name='VLAN2', |
| 398 | host1='h13', |
kelvin-onlab | 2ff5702 | 2015-05-29 10:48:51 -0700 | [diff] [blame] | 399 | host2='h20' ) |
kaouthera | 6f37d85 | 2015-05-27 13:52:08 -0700 | [diff] [blame] | 400 | |
| 401 | utilities.assert_equals( expect=main.FALSE, |
| 402 | actual=stepResult, |
kelvin-onlab | 2ff5702 | 2015-05-29 10:48:51 -0700 | [diff] [blame] | 403 | onpass="VLAN2: Add inter vlan host" + |
| 404 | " intent successful", |
| 405 | onfail="VLAN2: Add inter vlan host" + |
| 406 | " intent failed" ) |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 407 | |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 408 | def CASE1002( self, main ): |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 409 | """ |
| 410 | Add point intents between 2 hosts: |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 411 | - Get device ids | ports |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 412 | - Add point intents |
| 413 | - Check intents |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 414 | - Verify flows |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 415 | - Ping hosts |
| 416 | - Reroute |
| 417 | - Link down |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 418 | - Verify flows |
| 419 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 420 | - Ping hosts |
| 421 | - Link up |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 422 | - Verify flows |
| 423 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 424 | - Ping hosts |
| 425 | - Remove intents |
| 426 | """ |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 427 | import time |
| 428 | import json |
| 429 | import re |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 430 | |
| 431 | # Assert variables - These variable's name|format must be followed |
| 432 | # if you want to use the wrapper function |
| 433 | assert main, "There is no main" |
| 434 | assert main.CLIs, "There is no main.CLIs" |
| 435 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 436 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 437 | main.numSwitch" |
| 438 | |
kelvin-onlab | b223560 | 2015-05-13 17:51:06 -0700 | [diff] [blame] | 439 | main.case( "Add point intents between 2 devices" ) |
| 440 | |
| 441 | stepResult = main.TRUE |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 442 | # No option point intents |
| 443 | main.step( "NOOPTION: Add point intents between h1 and h9" ) |
| 444 | stepResult = main.wrapper.pointIntent( |
| 445 | main, |
| 446 | name="NOOPTION", |
| 447 | host1="h1", |
| 448 | host2="h9", |
| 449 | deviceId1="of:0000000000000005/1", |
| 450 | deviceId2="of:0000000000000006/1", |
| 451 | sw1="s5", |
| 452 | sw2="s2", |
| 453 | expectedLink=18 ) |
| 454 | |
| 455 | stepResult = main.TRUE |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 456 | utilities.assert_equals( expect=main.TRUE, |
| 457 | actual=stepResult, |
| 458 | onpass="NOOPTION: Add point intent successful", |
| 459 | onfail="NOOPTION: Add point intent failed" ) |
| 460 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 461 | stepResult = main.TRUE |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 462 | stepResult = main.wrapper.pointIntent( |
| 463 | main, |
| 464 | name="IPV4", |
| 465 | host1="h1", |
| 466 | host2="h9", |
| 467 | deviceId1="of:0000000000000005/1", |
| 468 | deviceId2="of:0000000000000006/1", |
| 469 | port1="", |
| 470 | port2="", |
| 471 | ethType="IPV4", |
| 472 | mac1="00:00:00:00:00:01", |
| 473 | mac2="00:00:00:00:00:09", |
| 474 | bandwidth="", |
| 475 | lambdaAlloc=False, |
| 476 | ipProto="", |
| 477 | ip1="", |
| 478 | ip2="", |
| 479 | tcp1="", |
| 480 | tcp2="", |
| 481 | sw1="s5", |
| 482 | sw2="s2", |
| 483 | expectedLink=18 ) |
| 484 | |
kelvin-onlab | b223560 | 2015-05-13 17:51:06 -0700 | [diff] [blame] | 485 | utilities.assert_equals( expect=main.TRUE, |
| 486 | actual=stepResult, |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 487 | onpass="IPV4: Add point intent successful", |
| 488 | onfail="IPV4: Add point intent failed" ) |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 489 | |
kelvin-onlab | 381b34c | 2015-05-21 09:21:06 -0700 | [diff] [blame] | 490 | stepResult = main.TRUE |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 491 | stepResult = main.wrapper.pointIntent( |
| 492 | main, |
| 493 | name="IPV4_2", |
| 494 | host1="h1", |
| 495 | host2="h9", |
| 496 | deviceId1="of:0000000000000005/1", |
| 497 | deviceId2="of:0000000000000006/1", |
| 498 | ipProto=1, |
| 499 | ip1="", |
| 500 | ip2="", |
| 501 | tcp1="", |
| 502 | tcp2="", |
| 503 | sw1="s5", |
| 504 | sw2="s2", |
| 505 | expectedLink=18 ) |
| 506 | |
| 507 | utilities.assert_equals( expect=main.TRUE, |
| 508 | actual=stepResult, |
| 509 | onpass="IPV4_2: Add point intent successful", |
| 510 | onfail="IPV4_2: Add point intent failed" ) |
| 511 | |
| 512 | stepResult = main.TRUE |
kelvin-onlab | 381b34c | 2015-05-21 09:21:06 -0700 | [diff] [blame] | 513 | main.step( "DUALSTACK1: Add point intents between h1 and h9" ) |
| 514 | stepResult = main.wrapper.pointIntent( |
| 515 | main, |
| 516 | name="DUALSTACK1", |
| 517 | host1="h3", |
| 518 | host2="h11", |
| 519 | deviceId1="of:0000000000000005", |
| 520 | deviceId2="of:0000000000000006", |
| 521 | port1="3", |
| 522 | port2="3", |
| 523 | ethType="IPV4", |
| 524 | mac1="00:00:00:00:00:03", |
| 525 | mac2="00:00:00:00:00:0B", |
| 526 | bandwidth="", |
| 527 | lambdaAlloc=False, |
| 528 | ipProto="", |
| 529 | ip1="", |
| 530 | ip2="", |
| 531 | tcp1="", |
| 532 | tcp2="", |
| 533 | sw1="s5", |
| 534 | sw2="s2", |
| 535 | expectedLink=18 ) |
| 536 | |
| 537 | utilities.assert_equals( expect=main.TRUE, |
| 538 | actual=stepResult, |
| 539 | onpass="DUALSTACK1: Add point intent" + |
| 540 | " successful", |
kaouthera | 426d0ab | 2015-05-28 17:41:10 -0700 | [diff] [blame] | 541 | onfail="DUALSTACK1: Add point intent failed" ) |
| 542 | stepResult = main.TRUE |
| 543 | main.step( "VLAN: Add point intents between h5 and h21" ) |
| 544 | stepResult = main.wrapper.pointIntent( |
| 545 | main, |
| 546 | name="VLAN", |
| 547 | host1="h5", |
| 548 | host2="h21", |
| 549 | deviceId1="of:0000000000000005/5", |
| 550 | deviceId2="of:0000000000000007/5", |
| 551 | port1="", |
| 552 | port2="", |
| 553 | ethType="IPV4", |
| 554 | mac1="00:00:00:00:00:05", |
| 555 | mac2="00:00:00:00:00:15", |
| 556 | bandwidth="", |
| 557 | lambdaAlloc=False, |
| 558 | ipProto="", |
| 559 | ip1="", |
| 560 | ip2="", |
| 561 | tcp1="", |
| 562 | tcp2="", |
| 563 | sw1="s5", |
| 564 | sw2="s2", |
| 565 | expectedLink=18 ) |
| 566 | |
| 567 | utilities.assert_equals( expect=main.TRUE, |
| 568 | actual=stepResult, |
| 569 | onpass="VLAN: Add point intent successful", |
| 570 | onfail="VLAN: Add point intent failed" ) |
kelvin-onlab | c751ab4 | 2015-05-21 14:09:39 -0700 | [diff] [blame] | 571 | |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 572 | stepResult = main.TRUE |
| 573 | main.step( "1HOP: Add point intents between h1 and h3" ) |
| 574 | stepResult = main.wrapper.hostIntent( main, |
| 575 | name='1HOP', |
| 576 | host1='h1', |
| 577 | host2='h3' ) |
| 578 | |
| 579 | utilities.assert_equals( expect=main.TRUE, |
| 580 | actual=stepResult, |
| 581 | onpass="1HOP: Add point intent" + |
| 582 | " successful", |
| 583 | onfail="1HOP: Add point intent failed" ) |
| 584 | |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 585 | def CASE1003( self, main ): |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 586 | """ |
| 587 | Add single point to multi point intents |
| 588 | - Get device ids |
| 589 | - Add single point to multi point intents |
| 590 | - Check intents |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 591 | - Verify flows |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 592 | - Ping hosts |
| 593 | - Reroute |
| 594 | - Link down |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 595 | - Verify flows |
| 596 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 597 | - Ping hosts |
| 598 | - Link up |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 599 | - Verify flows |
| 600 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 601 | - Ping hosts |
| 602 | - Remove intents |
| 603 | """ |
kelvin-onlab | f0594d7 | 2015-05-19 17:25:12 -0700 | [diff] [blame] | 604 | assert main, "There is no main" |
| 605 | assert main.CLIs, "There is no main.CLIs" |
| 606 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 607 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 608 | main.numSwitch" |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 609 | |
kelvin-onlab | f0594d7 | 2015-05-19 17:25:12 -0700 | [diff] [blame] | 610 | main.case( "Add single point to multi point intents between devices" ) |
| 611 | |
| 612 | stepResult = main.TRUE |
kelvin-onlab | f0594d7 | 2015-05-19 17:25:12 -0700 | [diff] [blame] | 613 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 614 | devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \ |
| 615 | 'of:0000000000000007/8' ] |
| 616 | macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ] |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 617 | |
| 618 | main.step( "NOOPTION: Add single point to multi point intents" ) |
| 619 | stepResult = main.wrapper.singleToMultiIntent( |
| 620 | main, |
| 621 | name="NOOPTION", |
| 622 | hostNames=hostNames, |
| 623 | devices=devices, |
| 624 | sw1="s5", |
| 625 | sw2="s2", |
| 626 | expectedLink=18 ) |
| 627 | |
| 628 | utilities.assert_equals( expect=main.TRUE, |
| 629 | actual=stepResult, |
| 630 | onpass="NOOPTION: Successfully added single " |
| 631 | + " point to multi point intents", |
| 632 | onfail="NOOPTION: Failed to add single point" + |
| 633 | " to multi point intents" ) |
| 634 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 635 | stepResult = main.TRUE |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 636 | main.step( "IPV4: Add single point to multi point intents" ) |
kelvin-onlab | f0594d7 | 2015-05-19 17:25:12 -0700 | [diff] [blame] | 637 | stepResult = main.wrapper.singleToMultiIntent( |
| 638 | main, |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 639 | name="IPV4", |
kelvin-onlab | f0594d7 | 2015-05-19 17:25:12 -0700 | [diff] [blame] | 640 | hostNames=hostNames, |
| 641 | devices=devices, |
| 642 | ports=None, |
| 643 | ethType="IPV4", |
| 644 | macs=macs, |
| 645 | bandwidth="", |
| 646 | lambdaAlloc=False, |
| 647 | ipProto="", |
| 648 | ipAddresses="", |
| 649 | tcp="", |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 650 | sw1="s5", |
| 651 | sw2="s2", |
| 652 | expectedLink=18 ) |
kelvin-onlab | f0594d7 | 2015-05-19 17:25:12 -0700 | [diff] [blame] | 653 | |
| 654 | utilities.assert_equals( expect=main.TRUE, |
| 655 | actual=stepResult, |
| 656 | onpass="IPV4: Successfully added single point" |
| 657 | + " to multi point intents", |
| 658 | onfail="IPV4: Failed to add single point" + |
| 659 | " to multi point intents" ) |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 660 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 661 | stepResult = main.TRUE |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 662 | main.step( "IPV4_2: Add single point to multi point intents" ) |
| 663 | hostNames = [ 'h8', 'h16', 'h24' ] |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 664 | stepResult = main.wrapper.singleToMultiIntent( |
| 665 | main, |
| 666 | name="IPV4", |
| 667 | hostNames=hostNames, |
| 668 | ethType="IPV4", |
| 669 | lambdaAlloc=False ) |
| 670 | |
| 671 | utilities.assert_equals( expect=main.TRUE, |
| 672 | actual=stepResult, |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 673 | onpass="IPV4_2: Successfully added single " |
| 674 | + " point to multi point intents", |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 675 | onfail="IPV4_2: Failed to add single point" + |
| 676 | " to multi point intents" ) |
kaouthera | 426d0ab | 2015-05-28 17:41:10 -0700 | [diff] [blame] | 677 | stepResult = main.TRUE |
| 678 | main.step( "VLAN: Add single point to multi point intents" ) |
| 679 | hostNames = [ 'h4', 'h12', 'h20' ] |
| 680 | devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \ |
| 681 | 'of:0000000000000007/4' ] |
| 682 | macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ] |
| 683 | stepResult = main.wrapper.singleToMultiIntent( |
| 684 | main, |
| 685 | name="VLAN", |
| 686 | hostNames=hostNames, |
| 687 | devices=devices, |
| 688 | ports=None, |
| 689 | ethType="IPV4", |
| 690 | macs=macs, |
| 691 | bandwidth="", |
| 692 | lambdaAlloc=False, |
| 693 | ipProto="", |
| 694 | ipAddresses="", |
| 695 | tcp="", |
| 696 | sw1="s5", |
| 697 | sw2="s2", |
| 698 | expectedLink=18 ) |
| 699 | |
| 700 | utilities.assert_equals( expect=main.TRUE, |
| 701 | actual=stepResult, |
| 702 | onpass="VLAN: Successfully added single point" |
| 703 | + " to multi point intents", |
| 704 | onfail="VLAN: Failed to add single point" + |
| 705 | " to multi point intents" ) |
| 706 | |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 707 | def CASE1004( self, main ): |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 708 | """ |
| 709 | Add multi point to single point intents |
| 710 | - Get device ids |
| 711 | - Add multi point to single point intents |
| 712 | - Check intents |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 713 | - Verify flows |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 714 | - Ping hosts |
| 715 | - Reroute |
| 716 | - Link down |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 717 | - Verify flows |
| 718 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 719 | - Ping hosts |
| 720 | - Link up |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 721 | - Verify flows |
| 722 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 723 | - Ping hosts |
kaouthera | 426d0ab | 2015-05-28 17:41:10 -0700 | [diff] [blame] | 724 | - Remove intents |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 725 | """ |
kelvin-onlab | c751ab4 | 2015-05-21 14:09:39 -0700 | [diff] [blame] | 726 | assert main, "There is no main" |
| 727 | assert main.CLIs, "There is no main.CLIs" |
| 728 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 729 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 730 | main.numSwitch" |
| 731 | |
| 732 | main.case( "Add multi point to single point intents between devices" ) |
| 733 | |
| 734 | stepResult = main.TRUE |
kelvin-onlab | c751ab4 | 2015-05-21 14:09:39 -0700 | [diff] [blame] | 735 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 736 | devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \ |
| 737 | 'of:0000000000000007/8' ] |
| 738 | macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ] |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 739 | |
| 740 | main.step( "NOOPTION: Add multi point to single point intents" ) |
| 741 | stepResult = main.wrapper.multiToSingleIntent( |
| 742 | main, |
| 743 | name="NOOPTION", |
| 744 | hostNames=hostNames, |
| 745 | devices=devices, |
| 746 | sw1="s5", |
| 747 | sw2="s2", |
| 748 | expectedLink=18 ) |
| 749 | |
| 750 | utilities.assert_equals( expect=main.TRUE, |
| 751 | actual=stepResult, |
| 752 | onpass="NOOPTION: Successfully added multi " |
| 753 | + " point to single point intents", |
| 754 | onfail="NOOPTION: Failed to add multi point" + |
| 755 | " to single point intents" ) |
| 756 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 757 | stepResult = main.TRUE |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 758 | main.step( "IPV4: Add multi point to single point intents" ) |
kelvin-onlab | c751ab4 | 2015-05-21 14:09:39 -0700 | [diff] [blame] | 759 | stepResult = main.wrapper.multiToSingleIntent( |
| 760 | main, |
| 761 | name="IPV4", |
| 762 | hostNames=hostNames, |
| 763 | devices=devices, |
| 764 | ports=None, |
| 765 | ethType="IPV4", |
| 766 | macs=macs, |
| 767 | bandwidth="", |
| 768 | lambdaAlloc=False, |
| 769 | ipProto="", |
| 770 | ipAddresses="", |
| 771 | tcp="", |
| 772 | sw1="s5", |
| 773 | sw2="s2", |
| 774 | expectedLink=18 ) |
| 775 | |
| 776 | utilities.assert_equals( expect=main.TRUE, |
| 777 | actual=stepResult, |
| 778 | onpass="IPV4: Successfully added multi point" |
| 779 | + " to single point intents", |
| 780 | onfail="IPV4: Failed to add multi point" + |
| 781 | " to single point intents" ) |
| 782 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 783 | stepResult = main.TRUE |
kelvin-onlab | c751ab4 | 2015-05-21 14:09:39 -0700 | [diff] [blame] | 784 | main.step( "IPV4_2: Add multi point to single point intents" ) |
| 785 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 786 | stepResult = main.wrapper.multiToSingleIntent( |
| 787 | main, |
| 788 | name="IPV4", |
| 789 | hostNames=hostNames, |
| 790 | ethType="IPV4", |
| 791 | lambdaAlloc=False ) |
| 792 | |
| 793 | utilities.assert_equals( expect=main.TRUE, |
| 794 | actual=stepResult, |
| 795 | onpass="IPV4_2: Successfully added multi point" |
| 796 | + " to single point intents", |
| 797 | onfail="IPV4_2: Failed to add multi point" + |
| 798 | " to single point intents" ) |
kaouthera | 426d0ab | 2015-05-28 17:41:10 -0700 | [diff] [blame] | 799 | |
| 800 | stepResult = main.TRUE |
| 801 | main.step( "VLAN: Add multi point to single point intents" ) |
| 802 | hostNames = [ 'h5', 'h13', 'h21' ] |
| 803 | devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \ |
| 804 | 'of:0000000000000007/5' ] |
| 805 | macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ] |
| 806 | stepResult = main.wrapper.multiToSingleIntent( |
| 807 | main, |
| 808 | name="VLAN", |
| 809 | hostNames=hostNames, |
| 810 | devices=devices, |
| 811 | ports=None, |
| 812 | ethType="IPV4", |
| 813 | macs=macs, |
| 814 | bandwidth="", |
| 815 | lambdaAlloc=False, |
| 816 | ipProto="", |
| 817 | ipAddresses="", |
| 818 | tcp="", |
| 819 | sw1="s5", |
| 820 | sw2="s2", |
| 821 | expectedLink=18 ) |
| 822 | |
| 823 | utilities.assert_equals( expect=main.TRUE, |
| 824 | actual=stepResult, |
| 825 | onpass="VLAN: Successfully added multi point" |
| 826 | + " to single point intents", |
| 827 | onfail="VLAN: Failed to add multi point" + |
| 828 | " to single point intents" ) |