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 | fa6ada8 | 2015-06-11 13:06:24 -0700 | [diff] [blame] | 226 | switchList = [] |
| 227 | |
| 228 | # Creates a list switch name, use getSwitch() function later... |
kelvin-onlab | 5cbf999 | 2015-05-05 14:34:07 -0700 | [diff] [blame] | 229 | for i in range( 1, ( main.numSwitch + 1 ) ): |
kelvin-onlab | fa6ada8 | 2015-06-11 13:06:24 -0700 | [diff] [blame] | 230 | switchList.append( 's' + str( i ) ) |
| 231 | |
| 232 | assignResult = main.Mininet1.assignSwController( sw=switchList, |
| 233 | ip=main.ONOSip, |
| 234 | port=main.ONOSport ) |
| 235 | if not assignResult: |
| 236 | main.cleanup() |
| 237 | main.exit() |
| 238 | |
kelvin-onlab | 5cbf999 | 2015-05-05 14:34:07 -0700 | [diff] [blame] | 239 | for i in range( 1, ( main.numSwitch + 1 ) ): |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 240 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 241 | print( "Response is " + str( response ) ) |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 242 | if re.search( "tcp:" + main.ONOSip[ 0 ], response ): |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 243 | assignResult = assignResult and main.TRUE |
| 244 | else: |
| 245 | assignResult = main.FALSE |
| 246 | stepResult = assignResult |
| 247 | utilities.assert_equals( expect=main.TRUE, |
| 248 | actual=stepResult, |
| 249 | onpass="Successfully assigned switches" + |
| 250 | "to controller", |
| 251 | onfail="Failed to assign switches to " + |
| 252 | "controller" ) |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 253 | def CASE13( self, main ): |
| 254 | """ |
| 255 | Discover all hosts and store its data to a dictionary |
| 256 | """ |
| 257 | main.case( "Discover all hosts" ) |
| 258 | |
| 259 | stepResult = main.TRUE |
kelvin-onlab | 132bd5b | 2015-05-18 18:15:26 -0700 | [diff] [blame] | 260 | main.step( "Discover all hosts using pingall " ) |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 261 | stepResult = main.wrapper.getHostsData( main ) |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 262 | utilities.assert_equals( expect=main.TRUE, |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 263 | actual=stepResult, |
| 264 | onpass="Successfully discovered hosts", |
| 265 | onfail="Failed to discover hosts" ) |
kelvin-onlab | 4ff9cc1 | 2015-05-05 11:14:42 -0700 | [diff] [blame] | 266 | |
kelvin-onlab | 2ff5702 | 2015-05-29 10:48:51 -0700 | [diff] [blame] | 267 | def CASE14( self, main ): |
| 268 | """ |
| 269 | Stop mininet |
| 270 | """ |
| 271 | main.log.report( "Stop Mininet topology" ) |
| 272 | main.log.case( "Stop Mininet topology" ) |
| 273 | |
| 274 | main.step( "Stopping Mininet Topology" ) |
| 275 | topoResult = main.Mininet1.stopNet( ) |
| 276 | stepResult = topoResult |
| 277 | utilities.assert_equals( expect=main.TRUE, |
| 278 | actual=stepResult, |
| 279 | onpass="Successfully stop mininet", |
| 280 | onfail="Failed to stop mininet" ) |
| 281 | # Exit if topology did not load properly |
| 282 | if not topoResult: |
| 283 | main.cleanup() |
| 284 | main.exit() |
| 285 | |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 286 | def CASE1001( self, main ): |
kelvin-onlab | 7c577e8 | 2015-05-07 10:45:16 -0700 | [diff] [blame] | 287 | """ |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 288 | Add host intents between 2 host: |
| 289 | - Discover hosts |
| 290 | - Add host intents |
| 291 | - Check intents |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 292 | - Verify flows |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 293 | - Ping hosts |
| 294 | - Reroute |
| 295 | - Link down |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 296 | - Verify flows |
| 297 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 298 | - Ping hosts |
| 299 | - Link up |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 300 | - Verify flows |
| 301 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 302 | - Ping hosts |
| 303 | - Remove intents |
kelvin-onlab | 7c577e8 | 2015-05-07 10:45:16 -0700 | [diff] [blame] | 304 | """ |
| 305 | import time |
| 306 | import json |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 307 | import re |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 308 | |
| 309 | # Assert variables - These variable's name|format must be followed |
| 310 | # if you want to use the wrapper function |
| 311 | assert main, "There is no main" |
| 312 | assert main.CLIs, "There is no main.CLIs" |
| 313 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 314 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 315 | main.numSwitch" |
| 316 | |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 317 | main.case( "Add host intents between 2 host" ) |
kelvin-onlab | 05cf773 | 2015-05-08 14:25:46 -0700 | [diff] [blame] | 318 | |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 319 | stepResult = main.TRUE |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 320 | main.step( "IPV4: Add host intents between h1 and h9" ) |
| 321 | stepResult = main.wrapper.hostIntent( main, |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 322 | onosNode='0', |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 323 | name='IPV4', |
| 324 | host1='h1', |
| 325 | host2='h9', |
| 326 | host1Id='00:00:00:00:00:01/-1', |
| 327 | host2Id='00:00:00:00:00:09/-1', |
| 328 | sw1='s5', |
| 329 | sw2='s2', |
| 330 | expectedLink=18 ) |
kelvin-onlab | 7c577e8 | 2015-05-07 10:45:16 -0700 | [diff] [blame] | 331 | |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 332 | utilities.assert_equals( expect=main.TRUE, |
| 333 | actual=stepResult, |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 334 | onpass="IPV4: Add host intent successful", |
| 335 | onfail="IPV4: Add host intent failed" ) |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 336 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 337 | stepResult = main.TRUE |
kelvin-onlab | 381b34c | 2015-05-21 09:21:06 -0700 | [diff] [blame] | 338 | main.step( "DUALSTACK1: Add host intents between h3 and h11" ) |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 339 | stepResult = main.wrapper.hostIntent( main, |
| 340 | name='DUALSTACK', |
| 341 | host1='h3', |
| 342 | host2='h11', |
| 343 | host1Id='00:00:00:00:00:03/-1', |
kelvin-onlab | 132bd5b | 2015-05-18 18:15:26 -0700 | [diff] [blame] | 344 | host2Id='00:00:00:00:00:0B/-1', |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 345 | sw1='s5', |
| 346 | sw2='s2', |
| 347 | expectedLink=18 ) |
| 348 | |
| 349 | utilities.assert_equals( expect=main.TRUE, |
| 350 | actual=stepResult, |
kelvin-onlab | 381b34c | 2015-05-21 09:21:06 -0700 | [diff] [blame] | 351 | onpass="DUALSTACK1: Add host intent" + |
| 352 | " successful", |
| 353 | onfail="DUALSTACK1: Add host intent failed" ) |
| 354 | |
| 355 | stepResult = main.TRUE |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 356 | main.step( "DUALSTACK2: Add host intents between h1 and h11" ) |
kelvin-onlab | 381b34c | 2015-05-21 09:21:06 -0700 | [diff] [blame] | 357 | stepResult = main.wrapper.hostIntent( main, |
| 358 | name='DUALSTACK2', |
| 359 | host1='h1', |
| 360 | host2='h11', |
| 361 | sw1='s5', |
| 362 | sw2='s2', |
| 363 | expectedLink=18 ) |
| 364 | |
| 365 | utilities.assert_equals( expect=main.TRUE, |
| 366 | actual=stepResult, |
| 367 | onpass="DUALSTACK2: Add host intent" + |
| 368 | " successful", |
| 369 | onfail="DUALSTACK2: Add host intent failed" ) |
kelvin-onlab | 7c577e8 | 2015-05-07 10:45:16 -0700 | [diff] [blame] | 370 | |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 371 | stepResult = main.TRUE |
| 372 | main.step( "1HOP: Add host intents between h1 and h3" ) |
| 373 | stepResult = main.wrapper.hostIntent( main, |
| 374 | name='1HOP', |
| 375 | host1='h1', |
| 376 | host2='h3' ) |
| 377 | |
| 378 | utilities.assert_equals( expect=main.TRUE, |
| 379 | actual=stepResult, |
| 380 | onpass="1HOP: Add host intent" + |
| 381 | " successful", |
| 382 | onfail="1HOP: Add host intent failed" ) |
| 383 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 384 | stepResult = main.TRUE |
kaouthera | 6f37d85 | 2015-05-27 13:52:08 -0700 | [diff] [blame] | 385 | main.step( "VLAN1: Add vlan host intents between h4 and h12" ) |
| 386 | stepResult = main.wrapper.hostIntent( main, |
| 387 | name='VLAN1', |
| 388 | host1='h4', |
| 389 | host2='h12', |
| 390 | host1Id='00:00:00:00:00:04/100', |
| 391 | host2Id='00:00:00:00:00:0C/100', |
| 392 | sw1='s5', |
| 393 | sw2='s2', |
| 394 | expectedLink=18 ) |
| 395 | |
| 396 | utilities.assert_equals( expect=main.TRUE, |
| 397 | actual=stepResult, |
kelvin-onlab | 2ff5702 | 2015-05-29 10:48:51 -0700 | [diff] [blame] | 398 | onpass="VLAN1: Add vlan host" + |
| 399 | " intent successful", |
kaouthera | 6f37d85 | 2015-05-27 13:52:08 -0700 | [diff] [blame] | 400 | onfail="VLAN1: Add vlan host intent failed" ) |
kelvin-onlab | 2ff5702 | 2015-05-29 10:48:51 -0700 | [diff] [blame] | 401 | |
kaouthera | 6f37d85 | 2015-05-27 13:52:08 -0700 | [diff] [blame] | 402 | stepResult = main.TRUE |
| 403 | main.step( "VLAN2: Add inter vlan host intents between h13 and h20" ) |
| 404 | stepResult = main.wrapper.hostIntent( main, |
| 405 | name='VLAN2', |
| 406 | host1='h13', |
kelvin-onlab | 2ff5702 | 2015-05-29 10:48:51 -0700 | [diff] [blame] | 407 | host2='h20' ) |
kaouthera | 6f37d85 | 2015-05-27 13:52:08 -0700 | [diff] [blame] | 408 | |
| 409 | utilities.assert_equals( expect=main.FALSE, |
| 410 | actual=stepResult, |
kelvin-onlab | 2ff5702 | 2015-05-29 10:48:51 -0700 | [diff] [blame] | 411 | onpass="VLAN2: Add inter vlan host" + |
| 412 | " intent successful", |
| 413 | onfail="VLAN2: Add inter vlan host" + |
| 414 | " intent failed" ) |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 415 | |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 416 | def CASE1002( self, main ): |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 417 | """ |
| 418 | Add point intents between 2 hosts: |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 419 | - Get device ids | ports |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 420 | - Add point intents |
| 421 | - Check intents |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 422 | - Verify flows |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 423 | - Ping hosts |
| 424 | - Reroute |
| 425 | - Link down |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 426 | - Verify flows |
| 427 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 428 | - Ping hosts |
| 429 | - Link up |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 430 | - Verify flows |
| 431 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 432 | - Ping hosts |
| 433 | - Remove intents |
| 434 | """ |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 435 | import time |
| 436 | import json |
| 437 | import re |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 438 | |
| 439 | # Assert variables - These variable's name|format must be followed |
| 440 | # if you want to use the wrapper function |
| 441 | assert main, "There is no main" |
| 442 | assert main.CLIs, "There is no main.CLIs" |
| 443 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 444 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 445 | main.numSwitch" |
| 446 | |
kelvin-onlab | b223560 | 2015-05-13 17:51:06 -0700 | [diff] [blame] | 447 | main.case( "Add point intents between 2 devices" ) |
| 448 | |
| 449 | stepResult = main.TRUE |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 450 | # No option point intents |
| 451 | main.step( "NOOPTION: Add point intents between h1 and h9" ) |
| 452 | stepResult = main.wrapper.pointIntent( |
| 453 | main, |
| 454 | name="NOOPTION", |
| 455 | host1="h1", |
| 456 | host2="h9", |
| 457 | deviceId1="of:0000000000000005/1", |
| 458 | deviceId2="of:0000000000000006/1", |
| 459 | sw1="s5", |
| 460 | sw2="s2", |
| 461 | expectedLink=18 ) |
| 462 | |
| 463 | stepResult = main.TRUE |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 464 | utilities.assert_equals( expect=main.TRUE, |
| 465 | actual=stepResult, |
| 466 | onpass="NOOPTION: Add point intent successful", |
| 467 | onfail="NOOPTION: Add point intent failed" ) |
| 468 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 469 | stepResult = main.TRUE |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 470 | stepResult = main.wrapper.pointIntent( |
| 471 | main, |
| 472 | name="IPV4", |
| 473 | host1="h1", |
| 474 | host2="h9", |
| 475 | deviceId1="of:0000000000000005/1", |
| 476 | deviceId2="of:0000000000000006/1", |
| 477 | port1="", |
| 478 | port2="", |
| 479 | ethType="IPV4", |
| 480 | mac1="00:00:00:00:00:01", |
| 481 | mac2="00:00:00:00:00:09", |
| 482 | bandwidth="", |
| 483 | lambdaAlloc=False, |
| 484 | ipProto="", |
| 485 | ip1="", |
| 486 | ip2="", |
| 487 | tcp1="", |
| 488 | tcp2="", |
| 489 | sw1="s5", |
| 490 | sw2="s2", |
| 491 | expectedLink=18 ) |
| 492 | |
kelvin-onlab | b223560 | 2015-05-13 17:51:06 -0700 | [diff] [blame] | 493 | utilities.assert_equals( expect=main.TRUE, |
| 494 | actual=stepResult, |
kelvin-onlab | 2ccad6e | 2015-05-18 10:36:54 -0700 | [diff] [blame] | 495 | onpass="IPV4: Add point intent successful", |
| 496 | onfail="IPV4: Add point intent failed" ) |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 497 | |
kelvin-onlab | 381b34c | 2015-05-21 09:21:06 -0700 | [diff] [blame] | 498 | stepResult = main.TRUE |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 499 | stepResult = main.wrapper.pointIntent( |
| 500 | main, |
| 501 | name="IPV4_2", |
| 502 | host1="h1", |
| 503 | host2="h9", |
| 504 | deviceId1="of:0000000000000005/1", |
| 505 | deviceId2="of:0000000000000006/1", |
| 506 | ipProto=1, |
| 507 | ip1="", |
| 508 | ip2="", |
| 509 | tcp1="", |
| 510 | tcp2="", |
| 511 | sw1="s5", |
| 512 | sw2="s2", |
| 513 | expectedLink=18 ) |
| 514 | |
| 515 | utilities.assert_equals( expect=main.TRUE, |
| 516 | actual=stepResult, |
| 517 | onpass="IPV4_2: Add point intent successful", |
| 518 | onfail="IPV4_2: Add point intent failed" ) |
| 519 | |
| 520 | stepResult = main.TRUE |
kelvin-onlab | 381b34c | 2015-05-21 09:21:06 -0700 | [diff] [blame] | 521 | main.step( "DUALSTACK1: Add point intents between h1 and h9" ) |
| 522 | stepResult = main.wrapper.pointIntent( |
| 523 | main, |
| 524 | name="DUALSTACK1", |
| 525 | host1="h3", |
| 526 | host2="h11", |
| 527 | deviceId1="of:0000000000000005", |
| 528 | deviceId2="of:0000000000000006", |
| 529 | port1="3", |
| 530 | port2="3", |
| 531 | ethType="IPV4", |
| 532 | mac1="00:00:00:00:00:03", |
| 533 | mac2="00:00:00:00:00:0B", |
| 534 | bandwidth="", |
| 535 | lambdaAlloc=False, |
| 536 | ipProto="", |
| 537 | ip1="", |
| 538 | ip2="", |
| 539 | tcp1="", |
| 540 | tcp2="", |
| 541 | sw1="s5", |
| 542 | sw2="s2", |
| 543 | expectedLink=18 ) |
| 544 | |
| 545 | utilities.assert_equals( expect=main.TRUE, |
| 546 | actual=stepResult, |
| 547 | onpass="DUALSTACK1: Add point intent" + |
| 548 | " successful", |
kaouthera | 426d0ab | 2015-05-28 17:41:10 -0700 | [diff] [blame] | 549 | onfail="DUALSTACK1: Add point intent failed" ) |
| 550 | stepResult = main.TRUE |
| 551 | main.step( "VLAN: Add point intents between h5 and h21" ) |
| 552 | stepResult = main.wrapper.pointIntent( |
| 553 | main, |
| 554 | name="VLAN", |
| 555 | host1="h5", |
| 556 | host2="h21", |
| 557 | deviceId1="of:0000000000000005/5", |
| 558 | deviceId2="of:0000000000000007/5", |
| 559 | port1="", |
| 560 | port2="", |
| 561 | ethType="IPV4", |
| 562 | mac1="00:00:00:00:00:05", |
| 563 | mac2="00:00:00:00:00:15", |
| 564 | bandwidth="", |
| 565 | lambdaAlloc=False, |
| 566 | ipProto="", |
| 567 | ip1="", |
| 568 | ip2="", |
| 569 | tcp1="", |
| 570 | tcp2="", |
| 571 | sw1="s5", |
| 572 | sw2="s2", |
| 573 | expectedLink=18 ) |
| 574 | |
| 575 | utilities.assert_equals( expect=main.TRUE, |
| 576 | actual=stepResult, |
| 577 | onpass="VLAN: Add point intent successful", |
| 578 | onfail="VLAN: Add point intent failed" ) |
kelvin-onlab | c751ab4 | 2015-05-21 14:09:39 -0700 | [diff] [blame] | 579 | |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 580 | stepResult = main.TRUE |
| 581 | main.step( "1HOP: Add point intents between h1 and h3" ) |
| 582 | stepResult = main.wrapper.hostIntent( main, |
| 583 | name='1HOP', |
| 584 | host1='h1', |
| 585 | host2='h3' ) |
| 586 | |
| 587 | utilities.assert_equals( expect=main.TRUE, |
| 588 | actual=stepResult, |
| 589 | onpass="1HOP: Add point intent" + |
| 590 | " successful", |
| 591 | onfail="1HOP: Add point intent failed" ) |
| 592 | |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 593 | def CASE1003( self, main ): |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 594 | """ |
| 595 | Add single point to multi point intents |
| 596 | - Get device ids |
| 597 | - Add single point to multi point intents |
| 598 | - Check intents |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 599 | - Verify flows |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 600 | - Ping hosts |
| 601 | - Reroute |
| 602 | - Link down |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 603 | - Verify flows |
| 604 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 605 | - Ping hosts |
| 606 | - Link up |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 607 | - Verify flows |
| 608 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 609 | - Ping hosts |
| 610 | - Remove intents |
| 611 | """ |
kelvin-onlab | f0594d7 | 2015-05-19 17:25:12 -0700 | [diff] [blame] | 612 | assert main, "There is no main" |
| 613 | assert main.CLIs, "There is no main.CLIs" |
| 614 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 615 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 616 | main.numSwitch" |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 617 | |
kelvin-onlab | f0594d7 | 2015-05-19 17:25:12 -0700 | [diff] [blame] | 618 | main.case( "Add single point to multi point intents between devices" ) |
| 619 | |
| 620 | stepResult = main.TRUE |
kelvin-onlab | f0594d7 | 2015-05-19 17:25:12 -0700 | [diff] [blame] | 621 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 622 | devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \ |
| 623 | 'of:0000000000000007/8' ] |
| 624 | 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] | 625 | |
| 626 | main.step( "NOOPTION: Add single point to multi point intents" ) |
| 627 | stepResult = main.wrapper.singleToMultiIntent( |
| 628 | main, |
| 629 | name="NOOPTION", |
| 630 | hostNames=hostNames, |
| 631 | devices=devices, |
| 632 | sw1="s5", |
| 633 | sw2="s2", |
| 634 | expectedLink=18 ) |
| 635 | |
| 636 | utilities.assert_equals( expect=main.TRUE, |
| 637 | actual=stepResult, |
| 638 | onpass="NOOPTION: Successfully added single " |
| 639 | + " point to multi point intents", |
| 640 | onfail="NOOPTION: Failed to add single point" + |
| 641 | " to multi point intents" ) |
| 642 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 643 | stepResult = main.TRUE |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 644 | main.step( "IPV4: Add single point to multi point intents" ) |
kelvin-onlab | f0594d7 | 2015-05-19 17:25:12 -0700 | [diff] [blame] | 645 | stepResult = main.wrapper.singleToMultiIntent( |
| 646 | main, |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 647 | name="IPV4", |
kelvin-onlab | f0594d7 | 2015-05-19 17:25:12 -0700 | [diff] [blame] | 648 | hostNames=hostNames, |
| 649 | devices=devices, |
| 650 | ports=None, |
| 651 | ethType="IPV4", |
| 652 | macs=macs, |
| 653 | bandwidth="", |
| 654 | lambdaAlloc=False, |
| 655 | ipProto="", |
| 656 | ipAddresses="", |
| 657 | tcp="", |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 658 | sw1="s5", |
| 659 | sw2="s2", |
| 660 | expectedLink=18 ) |
kelvin-onlab | f0594d7 | 2015-05-19 17:25:12 -0700 | [diff] [blame] | 661 | |
| 662 | utilities.assert_equals( expect=main.TRUE, |
| 663 | actual=stepResult, |
| 664 | onpass="IPV4: Successfully added single point" |
| 665 | + " to multi point intents", |
| 666 | onfail="IPV4: Failed to add single point" + |
| 667 | " to multi point intents" ) |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 668 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 669 | stepResult = main.TRUE |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 670 | main.step( "IPV4_2: Add single point to multi point intents" ) |
| 671 | hostNames = [ 'h8', 'h16', 'h24' ] |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 672 | stepResult = main.wrapper.singleToMultiIntent( |
| 673 | main, |
| 674 | name="IPV4", |
| 675 | hostNames=hostNames, |
| 676 | ethType="IPV4", |
| 677 | lambdaAlloc=False ) |
| 678 | |
| 679 | utilities.assert_equals( expect=main.TRUE, |
| 680 | actual=stepResult, |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 681 | onpass="IPV4_2: Successfully added single " |
| 682 | + " point to multi point intents", |
kelvin-onlab | 0890001 | 2015-05-20 14:30:44 -0700 | [diff] [blame] | 683 | onfail="IPV4_2: Failed to add single point" + |
| 684 | " to multi point intents" ) |
kaouthera | 426d0ab | 2015-05-28 17:41:10 -0700 | [diff] [blame] | 685 | stepResult = main.TRUE |
| 686 | main.step( "VLAN: Add single point to multi point intents" ) |
| 687 | hostNames = [ 'h4', 'h12', 'h20' ] |
| 688 | devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \ |
| 689 | 'of:0000000000000007/4' ] |
| 690 | macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ] |
| 691 | stepResult = main.wrapper.singleToMultiIntent( |
| 692 | main, |
| 693 | name="VLAN", |
| 694 | hostNames=hostNames, |
| 695 | devices=devices, |
| 696 | ports=None, |
| 697 | ethType="IPV4", |
| 698 | macs=macs, |
| 699 | bandwidth="", |
| 700 | lambdaAlloc=False, |
| 701 | ipProto="", |
| 702 | ipAddresses="", |
| 703 | tcp="", |
| 704 | sw1="s5", |
| 705 | sw2="s2", |
| 706 | expectedLink=18 ) |
| 707 | |
| 708 | utilities.assert_equals( expect=main.TRUE, |
| 709 | actual=stepResult, |
| 710 | onpass="VLAN: Successfully added single point" |
| 711 | + " to multi point intents", |
| 712 | onfail="VLAN: Failed to add single point" + |
| 713 | " to multi point intents" ) |
| 714 | |
kelvin-onlab | f70fd54 | 2015-05-07 18:41:40 -0700 | [diff] [blame] | 715 | def CASE1004( self, main ): |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 716 | """ |
| 717 | Add multi point to single point intents |
| 718 | - Get device ids |
| 719 | - Add multi point to single point intents |
| 720 | - Check intents |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 721 | - Verify flows |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 722 | - Ping hosts |
| 723 | - Reroute |
| 724 | - Link down |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 725 | - Verify flows |
| 726 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 727 | - Ping hosts |
| 728 | - Link up |
kelvin-onlab | e5239e5 | 2015-05-13 14:46:45 -0700 | [diff] [blame] | 729 | - Verify flows |
| 730 | - Check topology |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 731 | - Ping hosts |
kaouthera | 426d0ab | 2015-05-28 17:41:10 -0700 | [diff] [blame] | 732 | - Remove intents |
kelvin-onlab | 65782a8 | 2015-05-07 14:12:13 -0700 | [diff] [blame] | 733 | """ |
kelvin-onlab | c751ab4 | 2015-05-21 14:09:39 -0700 | [diff] [blame] | 734 | assert main, "There is no main" |
| 735 | assert main.CLIs, "There is no main.CLIs" |
| 736 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 737 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 738 | main.numSwitch" |
| 739 | |
| 740 | main.case( "Add multi point to single point intents between devices" ) |
| 741 | |
| 742 | stepResult = main.TRUE |
kelvin-onlab | c751ab4 | 2015-05-21 14:09:39 -0700 | [diff] [blame] | 743 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 744 | devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \ |
| 745 | 'of:0000000000000007/8' ] |
| 746 | 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] | 747 | |
| 748 | main.step( "NOOPTION: Add multi point to single point intents" ) |
| 749 | stepResult = main.wrapper.multiToSingleIntent( |
| 750 | main, |
| 751 | name="NOOPTION", |
| 752 | hostNames=hostNames, |
| 753 | devices=devices, |
| 754 | sw1="s5", |
| 755 | sw2="s2", |
| 756 | expectedLink=18 ) |
| 757 | |
| 758 | utilities.assert_equals( expect=main.TRUE, |
| 759 | actual=stepResult, |
| 760 | onpass="NOOPTION: Successfully added multi " |
| 761 | + " point to single point intents", |
| 762 | onfail="NOOPTION: Failed to add multi point" + |
| 763 | " to single point intents" ) |
| 764 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 765 | stepResult = main.TRUE |
kelvin-onlab | f2ec6e0 | 2015-05-27 14:15:28 -0700 | [diff] [blame] | 766 | main.step( "IPV4: Add multi point to single point intents" ) |
kelvin-onlab | c751ab4 | 2015-05-21 14:09:39 -0700 | [diff] [blame] | 767 | stepResult = main.wrapper.multiToSingleIntent( |
| 768 | main, |
| 769 | name="IPV4", |
| 770 | hostNames=hostNames, |
| 771 | devices=devices, |
| 772 | ports=None, |
| 773 | ethType="IPV4", |
| 774 | macs=macs, |
| 775 | bandwidth="", |
| 776 | lambdaAlloc=False, |
| 777 | ipProto="", |
| 778 | ipAddresses="", |
| 779 | tcp="", |
| 780 | sw1="s5", |
| 781 | sw2="s2", |
| 782 | expectedLink=18 ) |
| 783 | |
| 784 | utilities.assert_equals( expect=main.TRUE, |
| 785 | actual=stepResult, |
| 786 | onpass="IPV4: Successfully added multi point" |
| 787 | + " to single point intents", |
| 788 | onfail="IPV4: Failed to add multi point" + |
| 789 | " to single point intents" ) |
| 790 | |
kelvin-onlab | a297c4d | 2015-06-01 13:53:55 -0700 | [diff] [blame] | 791 | stepResult = main.TRUE |
kelvin-onlab | c751ab4 | 2015-05-21 14:09:39 -0700 | [diff] [blame] | 792 | main.step( "IPV4_2: Add multi point to single point intents" ) |
| 793 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 794 | stepResult = main.wrapper.multiToSingleIntent( |
| 795 | main, |
| 796 | name="IPV4", |
| 797 | hostNames=hostNames, |
| 798 | ethType="IPV4", |
| 799 | lambdaAlloc=False ) |
| 800 | |
| 801 | utilities.assert_equals( expect=main.TRUE, |
| 802 | actual=stepResult, |
| 803 | onpass="IPV4_2: Successfully added multi point" |
| 804 | + " to single point intents", |
| 805 | onfail="IPV4_2: Failed to add multi point" + |
| 806 | " to single point intents" ) |
kaouthera | 426d0ab | 2015-05-28 17:41:10 -0700 | [diff] [blame] | 807 | |
| 808 | stepResult = main.TRUE |
| 809 | main.step( "VLAN: Add multi point to single point intents" ) |
| 810 | hostNames = [ 'h5', 'h13', 'h21' ] |
| 811 | devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \ |
| 812 | 'of:0000000000000007/5' ] |
| 813 | macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ] |
| 814 | stepResult = main.wrapper.multiToSingleIntent( |
| 815 | main, |
| 816 | name="VLAN", |
| 817 | hostNames=hostNames, |
| 818 | devices=devices, |
| 819 | ports=None, |
| 820 | ethType="IPV4", |
| 821 | macs=macs, |
| 822 | bandwidth="", |
| 823 | lambdaAlloc=False, |
| 824 | ipProto="", |
| 825 | ipAddresses="", |
| 826 | tcp="", |
| 827 | sw1="s5", |
| 828 | sw2="s2", |
| 829 | expectedLink=18 ) |
| 830 | |
| 831 | utilities.assert_equals( expect=main.TRUE, |
| 832 | actual=stepResult, |
| 833 | onpass="VLAN: Successfully added multi point" |
| 834 | + " to single point intents", |
| 835 | onfail="VLAN: Failed to add multi point" + |
| 836 | " to single point intents" ) |