kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1 | |
| 2 | # Testing the basic intent functionality of ONOS |
| 3 | |
| 4 | import time |
| 5 | import json |
| 6 | |
| 7 | class FUNCintent: |
| 8 | |
| 9 | def __init__( self ): |
| 10 | self.default = '' |
| 11 | |
| 12 | def CASE1( self, main ): |
| 13 | import time |
| 14 | import os |
| 15 | import imp |
| 16 | |
| 17 | """ |
| 18 | - Construct tests variables |
| 19 | - GIT ( optional ) |
| 20 | - Checkout ONOS master branch |
| 21 | - Pull latest ONOS code |
| 22 | - Building ONOS ( optional ) |
| 23 | - Install ONOS package |
| 24 | - Build ONOS package |
| 25 | """ |
| 26 | |
| 27 | main.case( "Constructing test variables and building ONOS package" ) |
| 28 | main.step( "Constructing test variables" ) |
| 29 | stepResult = main.FALSE |
| 30 | |
| 31 | # Test variables |
| 32 | main.testOnDirectory = os.path.dirname( os.getcwd ( ) ) |
| 33 | main.apps = main.params[ 'ENV' ][ 'cellApps' ] |
| 34 | gitBranch = main.params[ 'GIT' ][ 'branch' ] |
| 35 | main.dependencyPath = main.testOnDirectory + \ |
| 36 | main.params[ 'DEPENDENCY' ][ 'path' ] |
| 37 | main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 38 | main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," ) |
| 39 | main.maxNodes = int( main.ONOSbench.maxNodes ) |
| 40 | wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ] |
| 41 | wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ] |
| 42 | main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) |
| 43 | main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] ) |
| 44 | main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] ) |
| 45 | gitPull = main.params[ 'GIT' ][ 'pull' ] |
| 46 | main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] ) |
| 47 | main.numLinks = int( main.params[ 'MININET' ][ 'links' ] ) |
| 48 | main.cellData = {} # for creating cell file |
| 49 | main.hostsData = {} |
| 50 | main.CLIs = [] |
| 51 | main.ONOSip = [] |
| 52 | |
| 53 | main.ONOSip = main.ONOSbench.getOnosIps() |
| 54 | print main.ONOSip |
| 55 | |
| 56 | # Assigning ONOS cli handles to a list |
| 57 | for i in range( 1, main.maxNodes + 1 ): |
| 58 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
| 59 | |
| 60 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 61 | main.startUp = imp.load_source( wrapperFile1, |
| 62 | main.dependencyPath + |
| 63 | wrapperFile1 + |
| 64 | ".py" ) |
| 65 | |
| 66 | main.intentFunction = imp.load_source( wrapperFile2, |
| 67 | main.dependencyPath + |
| 68 | wrapperFile2 + |
| 69 | ".py" ) |
| 70 | |
| 71 | copyResult = main.ONOSbench.copyMininetFile( main.topology, |
| 72 | main.dependencyPath, |
| 73 | main.Mininet1.user_name, |
| 74 | main.Mininet1.ip_address ) |
| 75 | if main.CLIs: |
| 76 | stepResult = main.TRUE |
| 77 | else: |
| 78 | main.log.error( "Did not properly created list of ONOS CLI handle" ) |
| 79 | stepResult = main.FALSE |
| 80 | |
| 81 | utilities.assert_equals( expect=main.TRUE, |
| 82 | actual=stepResult, |
| 83 | onpass="Successfully construct " + |
| 84 | "test variables ", |
| 85 | onfail="Failed to construct test variables" ) |
| 86 | |
| 87 | if gitPull == 'True': |
| 88 | main.step( "Building ONOS in " + gitBranch + " branch" ) |
| 89 | onosBuildResult = main.startUp.onosBuild( main, gitBranch ) |
| 90 | stepResult = onosBuildResult |
| 91 | utilities.assert_equals( expect=main.TRUE, |
| 92 | actual=stepResult, |
| 93 | onpass="Successfully compiled " + |
| 94 | "latest ONOS", |
| 95 | onfail="Failed to compile " + |
| 96 | "latest ONOS" ) |
| 97 | else: |
| 98 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 99 | "clean install" ) |
Jon Hall | 106be08 | 2015-07-22 09:53:00 -0700 | [diff] [blame] | 100 | main.ONOSbench.getVersion( report=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 101 | |
| 102 | def CASE2( self, main ): |
| 103 | """ |
| 104 | - Set up cell |
| 105 | - Create cell file |
| 106 | - Set cell file |
| 107 | - Verify cell file |
| 108 | - Kill ONOS process |
| 109 | - Uninstall ONOS cluster |
| 110 | - Verify ONOS start up |
| 111 | - Install ONOS cluster |
| 112 | - Connect to cli |
| 113 | """ |
| 114 | |
| 115 | # main.scale[ 0 ] determines the current number of ONOS controller |
| 116 | main.numCtrls = int( main.scale[ 0 ] ) |
| 117 | |
| 118 | main.case( "Starting up " + str( main.numCtrls ) + |
| 119 | " node(s) ONOS cluster" ) |
| 120 | |
| 121 | #kill off all onos processes |
| 122 | main.log.info( "Safety check, killing all ONOS processes" + |
| 123 | " before initiating enviornment setup" ) |
| 124 | |
| 125 | for i in range( main.maxNodes ): |
| 126 | main.ONOSbench.onosDie( main.ONOSip[ i ] ) |
| 127 | |
| 128 | print "NODE COUNT = ", main.numCtrls |
| 129 | |
| 130 | tempOnosIp = [] |
| 131 | for i in range( main.numCtrls ): |
| 132 | tempOnosIp.append( main.ONOSip[i] ) |
| 133 | |
| 134 | main.ONOSbench.createCellFile( main.ONOSbench.ip_address, "temp", main.Mininet1.ip_address, main.apps, tempOnosIp ) |
| 135 | |
| 136 | main.step( "Apply cell to environment" ) |
| 137 | cellResult = main.ONOSbench.setCell( "temp" ) |
| 138 | verifyResult = main.ONOSbench.verifyCell() |
| 139 | stepResult = cellResult and verifyResult |
| 140 | utilities.assert_equals( expect=main.TRUE, |
| 141 | actual=stepResult, |
| 142 | onpass="Successfully applied cell to " + \ |
| 143 | "environment", |
| 144 | onfail="Failed to apply cell to environment " ) |
| 145 | |
| 146 | main.step( "Creating ONOS package" ) |
| 147 | packageResult = main.ONOSbench.onosPackage() |
| 148 | stepResult = packageResult |
| 149 | utilities.assert_equals( expect=main.TRUE, |
| 150 | actual=stepResult, |
| 151 | onpass="Successfully created ONOS package", |
| 152 | onfail="Failed to create ONOS package" ) |
| 153 | |
| 154 | time.sleep( main.startUpSleep ) |
| 155 | main.step( "Uninstalling ONOS package" ) |
| 156 | onosUninstallResult = main.TRUE |
| 157 | for i in range( main.numCtrls ): |
| 158 | onosUninstallResult = onosUninstallResult and \ |
| 159 | main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] ) |
| 160 | stepResult = onosUninstallResult |
| 161 | utilities.assert_equals( expect=main.TRUE, |
| 162 | actual=stepResult, |
| 163 | onpass="Successfully uninstalled ONOS package", |
| 164 | onfail="Failed to uninstall ONOS package" ) |
| 165 | |
| 166 | time.sleep( main.startUpSleep ) |
| 167 | main.step( "Installing ONOS package" ) |
| 168 | onosInstallResult = main.TRUE |
| 169 | for i in range( main.numCtrls ): |
| 170 | onosInstallResult = onosInstallResult and \ |
| 171 | main.ONOSbench.onosInstall( node=main.ONOSip[ i ] ) |
| 172 | stepResult = onosInstallResult |
| 173 | utilities.assert_equals( expect=main.TRUE, |
| 174 | actual=stepResult, |
| 175 | onpass="Successfully installed ONOS package", |
| 176 | onfail="Failed to install ONOS package" ) |
| 177 | |
| 178 | time.sleep( main.startUpSleep ) |
| 179 | main.step( "Starting ONOS service" ) |
| 180 | stopResult = main.TRUE |
| 181 | startResult = main.TRUE |
| 182 | onosIsUp = main.TRUE |
| 183 | |
| 184 | for i in range( main.numCtrls ): |
| 185 | onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] ) |
| 186 | if onosIsUp == main.TRUE: |
| 187 | main.log.report( "ONOS instance is up and ready" ) |
| 188 | else: |
| 189 | main.log.report( "ONOS instance may not be up, stop and " + |
| 190 | "start ONOS again " ) |
| 191 | for i in range( main.numCtrls ): |
| 192 | stopResult = stopResult and \ |
| 193 | main.ONOSbench.onosStop( main.ONOSip[ i ] ) |
| 194 | for i in range( main.numCtrls ): |
| 195 | startResult = startResult and \ |
| 196 | main.ONOSbench.onosStart( main.ONOSip[ i ] ) |
| 197 | stepResult = onosIsUp and stopResult and startResult |
| 198 | utilities.assert_equals( expect=main.TRUE, |
| 199 | actual=stepResult, |
| 200 | onpass="ONOS service is ready", |
| 201 | onfail="ONOS service did not start properly" ) |
| 202 | |
| 203 | main.step( "Start ONOS cli" ) |
| 204 | cliResult = main.TRUE |
| 205 | for i in range( main.numCtrls ): |
| 206 | cliResult = cliResult and \ |
| 207 | main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] ) |
| 208 | stepResult = cliResult |
| 209 | utilities.assert_equals( expect=main.TRUE, |
| 210 | actual=stepResult, |
| 211 | onpass="Successfully start ONOS cli", |
| 212 | onfail="Failed to start ONOS cli" ) |
| 213 | |
| 214 | # Remove the first element in main.scale list |
| 215 | main.scale.remove( main.scale[ 0 ] ) |
| 216 | |
| 217 | def CASE9( self, main ): |
| 218 | ''' |
| 219 | Report errors/warnings/exceptions |
| 220 | ''' |
| 221 | main.log.info( "Error report: \n" ) |
| 222 | main.ONOSbench.logReport( globalONOSip[0], |
| 223 | [ "INFO", "FOLLOWER", "WARN", "flow", "ERROR" , "Except" ], |
| 224 | "s" ) |
| 225 | #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" ) |
| 226 | |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 227 | def CASE10( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 228 | """ |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame^] | 229 | Start Mininet topology with OF 1.0 switches |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 230 | """ |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame^] | 231 | main.log.report( "Start Mininet topology with OF 1.0 switches" ) |
| 232 | main.log.case( "Start Mininet topology with OF 1.0 switches" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 233 | |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame^] | 234 | main.step( "Start Mininet topology with OF 1.0 switches" ) |
| 235 | args = "--switch ovs,protocols=OpenFlow10" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 236 | topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath + |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame^] | 237 | main.topology, |
| 238 | args=args ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 239 | stepResult = topoResult |
| 240 | utilities.assert_equals( expect=main.TRUE, |
| 241 | actual=stepResult, |
| 242 | onpass="Successfully loaded topology", |
| 243 | onfail="Failed to load topology" ) |
| 244 | # Exit if topology did not load properly |
| 245 | if not topoResult: |
| 246 | main.cleanup() |
| 247 | main.exit() |
| 248 | |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 249 | def CASE11( self, main ): |
| 250 | """ |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame^] | 251 | Start Mininet topology with OF 1.3 switches |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 252 | """ |
| 253 | main.log.report( "Start Mininet topology with OF 1.3 switches" ) |
| 254 | main.log.case( "Start Mininet topology with OF 1.3 switches" ) |
| 255 | |
| 256 | main.step( "Start Mininet topology with OF 1.3 switches" ) |
| 257 | args = "--switch ovs,protocols=OpenFlow13" |
| 258 | topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath + |
| 259 | main.topology, |
| 260 | args=args ) |
| 261 | stepResult = topoResult |
| 262 | utilities.assert_equals( expect=main.TRUE, |
| 263 | actual=stepResult, |
| 264 | onpass="Successfully loaded topology", |
| 265 | onfail="Failed to load topology" ) |
| 266 | # Exit if topology did not load properly |
| 267 | if not topoResult: |
| 268 | main.cleanup() |
| 269 | main.exit() |
| 270 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 271 | def CASE12( self, main ): |
| 272 | """ |
| 273 | Assign mastership to controllers |
| 274 | """ |
| 275 | import re |
| 276 | |
| 277 | main.case( "Assign switches to controllers" ) |
| 278 | main.step( "Assigning switches to controllers" ) |
| 279 | assignResult = main.TRUE |
| 280 | switchList = [] |
| 281 | |
| 282 | # Creates a list switch name, use getSwitch() function later... |
| 283 | for i in range( 1, ( main.numSwitch + 1 ) ): |
| 284 | switchList.append( 's' + str( i ) ) |
| 285 | |
| 286 | tempONOSip = [] |
| 287 | for i in range( main.numCtrls ): |
| 288 | tempONOSip.append( main.ONOSip[ i ] ) |
| 289 | |
| 290 | assignResult = main.Mininet1.assignSwController( sw=switchList, |
| 291 | ip=tempONOSip, |
| 292 | port='6633' ) |
| 293 | if not assignResult: |
| 294 | main.cleanup() |
| 295 | main.exit() |
| 296 | |
| 297 | for i in range( 1, ( main.numSwitch + 1 ) ): |
| 298 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 299 | print( "Response is " + str( response ) ) |
| 300 | if re.search( "tcp:" + main.ONOSip[ 0 ], response ): |
| 301 | assignResult = assignResult and main.TRUE |
| 302 | else: |
| 303 | assignResult = main.FALSE |
| 304 | stepResult = assignResult |
| 305 | utilities.assert_equals( expect=main.TRUE, |
| 306 | actual=stepResult, |
| 307 | onpass="Successfully assigned switches" + |
| 308 | "to controller", |
| 309 | onfail="Failed to assign switches to " + |
| 310 | "controller" ) |
| 311 | def CASE13( self, main ): |
| 312 | """ |
| 313 | Discover all hosts and store its data to a dictionary |
| 314 | """ |
| 315 | main.case( "Discover all hosts" ) |
| 316 | |
| 317 | stepResult = main.TRUE |
| 318 | main.step( "Discover all hosts using pingall " ) |
| 319 | stepResult = main.intentFunction.getHostsData( main ) |
| 320 | utilities.assert_equals( expect=main.TRUE, |
| 321 | actual=stepResult, |
| 322 | onpass="Successfully discovered hosts", |
| 323 | onfail="Failed to discover hosts" ) |
| 324 | |
| 325 | def CASE14( self, main ): |
| 326 | """ |
| 327 | Stop mininet |
| 328 | """ |
| 329 | main.log.report( "Stop Mininet topology" ) |
| 330 | main.log.case( "Stop Mininet topology" ) |
| 331 | |
| 332 | main.step( "Stopping Mininet Topology" ) |
| 333 | topoResult = main.Mininet1.stopNet( ) |
| 334 | stepResult = topoResult |
| 335 | utilities.assert_equals( expect=main.TRUE, |
| 336 | actual=stepResult, |
| 337 | onpass="Successfully stop mininet", |
| 338 | onfail="Failed to stop mininet" ) |
| 339 | # Exit if topology did not load properly |
| 340 | if not topoResult: |
| 341 | main.cleanup() |
| 342 | main.exit() |
| 343 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 344 | def CASE1000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 345 | """ |
| 346 | Add host intents between 2 host: |
| 347 | - Discover hosts |
| 348 | - Add host intents |
| 349 | - Check intents |
| 350 | - Verify flows |
| 351 | - Ping hosts |
| 352 | - Reroute |
| 353 | - Link down |
| 354 | - Verify flows |
| 355 | - Check topology |
| 356 | - Ping hosts |
| 357 | - Link up |
| 358 | - Verify flows |
| 359 | - Check topology |
| 360 | - Ping hosts |
| 361 | - Remove intents |
| 362 | """ |
| 363 | import time |
| 364 | import json |
| 365 | import re |
| 366 | |
| 367 | # Assert variables - These variable's name|format must be followed |
| 368 | # if you want to use the wrapper function |
| 369 | assert main, "There is no main" |
| 370 | assert main.CLIs, "There is no main.CLIs" |
| 371 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 372 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 373 | main.numSwitch" |
| 374 | |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 375 | intentLeadersOld = main.CLIs[ 0 ].leaderCandidates() |
| 376 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 377 | main.case( "Add host intents between 2 host" ) |
| 378 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 379 | main.step( "IPV4: Add host intents between h1 and h9" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 380 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 381 | stepResult = main.intentFunction.hostIntent( main, |
| 382 | onosNode='0', |
| 383 | name='IPV4', |
| 384 | host1='h1', |
| 385 | host2='h9', |
| 386 | host1Id='00:00:00:00:00:01/-1', |
| 387 | host2Id='00:00:00:00:00:09/-1', |
| 388 | sw1='s5', |
| 389 | sw2='s2', |
| 390 | expectedLink=18 ) |
| 391 | |
| 392 | utilities.assert_equals( expect=main.TRUE, |
| 393 | actual=stepResult, |
| 394 | onpass="IPV4: Add host intent successful", |
| 395 | onfail="IPV4: Add host intent failed" ) |
| 396 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 397 | main.step( "DUALSTACK1: Add host intents between h3 and h11" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 398 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 399 | stepResult = main.intentFunction.hostIntent( main, |
| 400 | name='DUALSTACK', |
| 401 | host1='h3', |
| 402 | host2='h11', |
| 403 | host1Id='00:00:00:00:00:03/-1', |
| 404 | host2Id='00:00:00:00:00:0B/-1', |
| 405 | sw1='s5', |
| 406 | sw2='s2', |
| 407 | expectedLink=18 ) |
| 408 | |
| 409 | utilities.assert_equals( expect=main.TRUE, |
| 410 | actual=stepResult, |
| 411 | onpass="DUALSTACK1: Add host intent" + |
| 412 | " successful", |
| 413 | onfail="DUALSTACK1: Add host intent failed" ) |
| 414 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 415 | main.step( "DUALSTACK2: Add host intents between h1 and h11" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 416 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 417 | stepResult = main.intentFunction.hostIntent( main, |
| 418 | name='DUALSTACK2', |
| 419 | host1='h1', |
| 420 | host2='h11', |
| 421 | sw1='s5', |
| 422 | sw2='s2', |
| 423 | expectedLink=18 ) |
| 424 | |
| 425 | utilities.assert_equals( expect=main.TRUE, |
| 426 | actual=stepResult, |
| 427 | onpass="DUALSTACK2: Add host intent" + |
| 428 | " successful", |
| 429 | onfail="DUALSTACK2: Add host intent failed" ) |
| 430 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 431 | main.step( "1HOP: Add host intents between h1 and h3" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 432 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 433 | stepResult = main.intentFunction.hostIntent( main, |
| 434 | name='1HOP', |
| 435 | host1='h1', |
| 436 | host2='h3' ) |
| 437 | |
| 438 | utilities.assert_equals( expect=main.TRUE, |
| 439 | actual=stepResult, |
| 440 | onpass="1HOP: Add host intent" + |
| 441 | " successful", |
| 442 | onfail="1HOP: Add host intent failed" ) |
| 443 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 444 | main.step( "VLAN1: Add vlan host intents between h4 and h12" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 445 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 446 | stepResult = main.intentFunction.hostIntent( main, |
| 447 | name='VLAN1', |
| 448 | host1='h4', |
| 449 | host2='h12', |
| 450 | host1Id='00:00:00:00:00:04/100', |
| 451 | host2Id='00:00:00:00:00:0C/100', |
| 452 | sw1='s5', |
| 453 | sw2='s2', |
| 454 | expectedLink=18 ) |
| 455 | |
| 456 | utilities.assert_equals( expect=main.TRUE, |
| 457 | actual=stepResult, |
| 458 | onpass="VLAN1: Add vlan host" + |
| 459 | " intent successful", |
| 460 | onfail="VLAN1: Add vlan host intent failed" ) |
| 461 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 462 | main.step( "VLAN2: Add inter vlan host intents between h13 and h20" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 463 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 464 | stepResult = main.intentFunction.hostIntent( main, |
| 465 | name='VLAN2', |
| 466 | host1='h13', |
| 467 | host2='h20' ) |
| 468 | |
| 469 | utilities.assert_equals( expect=main.FALSE, |
| 470 | actual=stepResult, |
| 471 | onpass="VLAN2: Add inter vlan host" + |
| 472 | " intent successful", |
| 473 | onfail="VLAN2: Add inter vlan host" + |
| 474 | " intent failed" ) |
| 475 | |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 476 | |
| 477 | intentLeadersNew = main.CLIs[ 0 ].leaderCandidates() |
| 478 | main.intentFunction.checkLeaderChange( intentLeadersOld, |
| 479 | intentLeadersNew ) |
| 480 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 481 | def CASE2000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 482 | """ |
| 483 | Add point intents between 2 hosts: |
| 484 | - Get device ids | ports |
| 485 | - Add point intents |
| 486 | - Check intents |
| 487 | - Verify flows |
| 488 | - Ping hosts |
| 489 | - Reroute |
| 490 | - Link down |
| 491 | - Verify flows |
| 492 | - Check topology |
| 493 | - Ping hosts |
| 494 | - Link up |
| 495 | - Verify flows |
| 496 | - Check topology |
| 497 | - Ping hosts |
| 498 | - Remove intents |
| 499 | """ |
| 500 | import time |
| 501 | import json |
| 502 | import re |
| 503 | |
| 504 | # Assert variables - These variable's name|format must be followed |
| 505 | # if you want to use the wrapper function |
| 506 | assert main, "There is no main" |
| 507 | assert main.CLIs, "There is no main.CLIs" |
| 508 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 509 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 510 | main.numSwitch" |
| 511 | |
| 512 | main.case( "Add point intents between 2 devices" ) |
| 513 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 514 | # No option point intents |
| 515 | main.step( "NOOPTION: Add point intents between h1 and h9" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 516 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 517 | stepResult = main.intentFunction.pointIntent( |
| 518 | main, |
| 519 | name="NOOPTION", |
| 520 | host1="h1", |
| 521 | host2="h9", |
| 522 | deviceId1="of:0000000000000005/1", |
| 523 | deviceId2="of:0000000000000006/1", |
| 524 | sw1="s5", |
| 525 | sw2="s2", |
| 526 | expectedLink=18 ) |
| 527 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 528 | utilities.assert_equals( expect=main.TRUE, |
| 529 | actual=stepResult, |
| 530 | onpass="NOOPTION: Add point intent successful", |
| 531 | onfail="NOOPTION: Add point intent failed" ) |
| 532 | |
| 533 | stepResult = main.TRUE |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 534 | main.step( "IPV4: Add point intents between h1 and h9" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 535 | stepResult = main.intentFunction.pointIntent( |
| 536 | main, |
| 537 | name="IPV4", |
| 538 | host1="h1", |
| 539 | host2="h9", |
| 540 | deviceId1="of:0000000000000005/1", |
| 541 | deviceId2="of:0000000000000006/1", |
| 542 | port1="", |
| 543 | port2="", |
| 544 | ethType="IPV4", |
| 545 | mac1="00:00:00:00:00:01", |
| 546 | mac2="00:00:00:00:00:09", |
| 547 | bandwidth="", |
| 548 | lambdaAlloc=False, |
| 549 | ipProto="", |
| 550 | ip1="", |
| 551 | ip2="", |
| 552 | tcp1="", |
| 553 | tcp2="", |
| 554 | sw1="s5", |
| 555 | sw2="s2", |
| 556 | expectedLink=18 ) |
| 557 | |
| 558 | utilities.assert_equals( expect=main.TRUE, |
| 559 | actual=stepResult, |
| 560 | onpass="IPV4: Add point intent successful", |
| 561 | onfail="IPV4: Add point intent failed" ) |
| 562 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 563 | main.step( "IPV4_2: Add point intents between h1 and h9" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 564 | stepResult = main.TRUE |
| 565 | stepResult = main.intentFunction.pointIntent( |
| 566 | main, |
| 567 | name="IPV4_2", |
| 568 | host1="h1", |
| 569 | host2="h9", |
| 570 | deviceId1="of:0000000000000005/1", |
| 571 | deviceId2="of:0000000000000006/1", |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 572 | ipProto="", |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 573 | ip1="", |
| 574 | ip2="", |
| 575 | tcp1="", |
| 576 | tcp2="", |
| 577 | sw1="s5", |
| 578 | sw2="s2", |
| 579 | expectedLink=18 ) |
| 580 | |
| 581 | utilities.assert_equals( expect=main.TRUE, |
| 582 | actual=stepResult, |
| 583 | onpass="IPV4_2: Add point intent successful", |
| 584 | onfail="IPV4_2: Add point intent failed" ) |
| 585 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 586 | main.step( "SDNIP-TCP: Add point intents between h1 and h9" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 587 | stepResult = main.TRUE |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 588 | mac1 = main.hostsData[ 'h1' ][ 'mac' ] |
| 589 | mac2 = main.hostsData[ 'h9' ][ 'mac' ] |
| 590 | ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24" |
| 591 | ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24" |
| 592 | ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ] |
| 593 | tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 594 | tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ] |
| 595 | |
| 596 | stepResult = main.intentFunction.pointIntent( |
| 597 | main, |
| 598 | name="SDNIP-TCP", |
| 599 | host1="h1", |
| 600 | host2="h9", |
| 601 | deviceId1="of:0000000000000005/1", |
| 602 | deviceId2="of:0000000000000006/1", |
| 603 | mac1=mac1, |
| 604 | mac2=mac2, |
| 605 | ethType="IPV4", |
| 606 | ipProto=ipProto, |
| 607 | ip1=ip1, |
| 608 | ip2=ip2, |
| 609 | tcp1=tcp1, |
| 610 | tcp2=tcp2 ) |
| 611 | |
| 612 | utilities.assert_equals( expect=main.TRUE, |
| 613 | actual=stepResult, |
| 614 | onpass="SDNIP-TCP: Add point intent successful", |
| 615 | onfail="SDNIP-TCP: Add point intent failed" ) |
| 616 | |
| 617 | main.step( "SDNIP-ICMP: Add point intents between h1 and h9" ) |
| 618 | stepResult = main.TRUE |
| 619 | mac1 = main.hostsData[ 'h1' ][ 'mac' ] |
| 620 | mac2 = main.hostsData[ 'h9' ][ 'mac' ] |
| 621 | ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24" |
| 622 | ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24" |
| 623 | ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ] |
| 624 | tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 625 | tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ] |
| 626 | |
| 627 | stepResult = main.intentFunction.pointIntent( |
| 628 | main, |
| 629 | name="SDNIP-ICMP", |
| 630 | host1="h1", |
| 631 | host2="h9", |
| 632 | deviceId1="of:0000000000000005/1", |
| 633 | deviceId2="of:0000000000000006/1", |
| 634 | mac1=mac1, |
| 635 | mac2=mac2, |
| 636 | ethType="IPV4", |
| 637 | ipProto=ipProto ) |
| 638 | |
| 639 | utilities.assert_equals( expect=main.TRUE, |
| 640 | actual=stepResult, |
| 641 | onpass="SDNIP-ICMP: Add point intent successful", |
| 642 | onfail="SDNIP-ICMP: Add point intent failed" ) |
| 643 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 644 | main.step( "DUALSTACK1: Add point intents between h1 and h9" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 645 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 646 | stepResult = main.intentFunction.pointIntent( |
| 647 | main, |
| 648 | name="DUALSTACK1", |
| 649 | host1="h3", |
| 650 | host2="h11", |
| 651 | deviceId1="of:0000000000000005", |
| 652 | deviceId2="of:0000000000000006", |
| 653 | port1="3", |
| 654 | port2="3", |
| 655 | ethType="IPV4", |
| 656 | mac1="00:00:00:00:00:03", |
| 657 | mac2="00:00:00:00:00:0B", |
| 658 | bandwidth="", |
| 659 | lambdaAlloc=False, |
| 660 | ipProto="", |
| 661 | ip1="", |
| 662 | ip2="", |
| 663 | tcp1="", |
| 664 | tcp2="", |
| 665 | sw1="s5", |
| 666 | sw2="s2", |
| 667 | expectedLink=18 ) |
| 668 | |
| 669 | utilities.assert_equals( expect=main.TRUE, |
| 670 | actual=stepResult, |
| 671 | onpass="DUALSTACK1: Add point intent" + |
| 672 | " successful", |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 673 | onfail="DUALSTACK1: Add point intent failed" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 674 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 675 | main.step( "VLAN: Add point intents between h5 and h21" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 676 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 677 | stepResult = main.intentFunction.pointIntent( |
| 678 | main, |
| 679 | name="VLAN", |
| 680 | host1="h5", |
| 681 | host2="h21", |
| 682 | deviceId1="of:0000000000000005/5", |
| 683 | deviceId2="of:0000000000000007/5", |
| 684 | port1="", |
| 685 | port2="", |
| 686 | ethType="IPV4", |
| 687 | mac1="00:00:00:00:00:05", |
| 688 | mac2="00:00:00:00:00:15", |
| 689 | bandwidth="", |
| 690 | lambdaAlloc=False, |
| 691 | ipProto="", |
| 692 | ip1="", |
| 693 | ip2="", |
| 694 | tcp1="", |
| 695 | tcp2="", |
| 696 | sw1="s5", |
| 697 | sw2="s2", |
| 698 | expectedLink=18 ) |
| 699 | |
| 700 | utilities.assert_equals( expect=main.TRUE, |
| 701 | actual=stepResult, |
| 702 | onpass="VLAN: Add point intent successful", |
| 703 | onfail="VLAN: Add point intent failed" ) |
| 704 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 705 | main.step( "1HOP: Add point intents between h1 and h3" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 706 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 707 | stepResult = main.intentFunction.hostIntent( main, |
| 708 | name='1HOP', |
| 709 | host1='h1', |
| 710 | host2='h3' ) |
| 711 | |
| 712 | utilities.assert_equals( expect=main.TRUE, |
| 713 | actual=stepResult, |
| 714 | onpass="1HOP: Add point intent" + |
| 715 | " successful", |
| 716 | onfail="1HOP: Add point intent failed" ) |
| 717 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 718 | def CASE3000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 719 | """ |
| 720 | Add single point to multi point intents |
| 721 | - Get device ids |
| 722 | - Add single point to multi point intents |
| 723 | - Check intents |
| 724 | - Verify flows |
| 725 | - Ping hosts |
| 726 | - Reroute |
| 727 | - Link down |
| 728 | - Verify flows |
| 729 | - Check topology |
| 730 | - Ping hosts |
| 731 | - Link up |
| 732 | - Verify flows |
| 733 | - Check topology |
| 734 | - Ping hosts |
| 735 | - Remove intents |
| 736 | """ |
| 737 | assert main, "There is no main" |
| 738 | assert main.CLIs, "There is no main.CLIs" |
| 739 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 740 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 741 | main.numSwitch" |
| 742 | |
| 743 | main.case( "Add single point to multi point intents between devices" ) |
| 744 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 745 | main.step( "NOOPTION: Add single point to multi point intents" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 746 | stepResult = main.TRUE |
| 747 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 748 | devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \ |
| 749 | 'of:0000000000000007/8' ] |
| 750 | macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ] |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 751 | stepResult = main.intentFunction.singleToMultiIntent( |
| 752 | main, |
| 753 | name="NOOPTION", |
| 754 | hostNames=hostNames, |
| 755 | devices=devices, |
| 756 | sw1="s5", |
| 757 | sw2="s2", |
| 758 | expectedLink=18 ) |
| 759 | |
| 760 | utilities.assert_equals( expect=main.TRUE, |
| 761 | actual=stepResult, |
| 762 | onpass="NOOPTION: Successfully added single " |
| 763 | + " point to multi point intents", |
| 764 | onfail="NOOPTION: Failed to add single point" + |
| 765 | " to multi point intents" ) |
| 766 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 767 | main.step( "IPV4: Add single point to multi point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 768 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 769 | stepResult = main.intentFunction.singleToMultiIntent( |
| 770 | main, |
| 771 | name="IPV4", |
| 772 | hostNames=hostNames, |
| 773 | devices=devices, |
| 774 | ports=None, |
| 775 | ethType="IPV4", |
| 776 | macs=macs, |
| 777 | bandwidth="", |
| 778 | lambdaAlloc=False, |
| 779 | ipProto="", |
| 780 | ipAddresses="", |
| 781 | tcp="", |
| 782 | sw1="s5", |
| 783 | sw2="s2", |
| 784 | expectedLink=18 ) |
| 785 | |
| 786 | utilities.assert_equals( expect=main.TRUE, |
| 787 | actual=stepResult, |
| 788 | onpass="IPV4: Successfully added single point" |
| 789 | + " to multi point intents", |
| 790 | onfail="IPV4: Failed to add single point" + |
| 791 | " to multi point intents" ) |
| 792 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 793 | main.step( "IPV4_2: Add single point to multi point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 794 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 795 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 796 | stepResult = main.intentFunction.singleToMultiIntent( |
| 797 | main, |
| 798 | name="IPV4", |
| 799 | hostNames=hostNames, |
| 800 | ethType="IPV4", |
| 801 | lambdaAlloc=False ) |
| 802 | |
| 803 | utilities.assert_equals( expect=main.TRUE, |
| 804 | actual=stepResult, |
| 805 | onpass="IPV4_2: Successfully added single " |
| 806 | + " point to multi point intents", |
| 807 | onfail="IPV4_2: Failed to add single point" + |
| 808 | " to multi point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 809 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 810 | main.step( "VLAN: Add single point to multi point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 811 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 812 | hostNames = [ 'h4', 'h12', 'h20' ] |
| 813 | devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \ |
| 814 | 'of:0000000000000007/4' ] |
| 815 | macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ] |
| 816 | stepResult = main.intentFunction.singleToMultiIntent( |
| 817 | main, |
| 818 | name="VLAN", |
| 819 | hostNames=hostNames, |
| 820 | devices=devices, |
| 821 | ports=None, |
| 822 | ethType="IPV4", |
| 823 | macs=macs, |
| 824 | bandwidth="", |
| 825 | lambdaAlloc=False, |
| 826 | ipProto="", |
| 827 | ipAddresses="", |
| 828 | tcp="", |
| 829 | sw1="s5", |
| 830 | sw2="s2", |
| 831 | expectedLink=18 ) |
| 832 | |
| 833 | utilities.assert_equals( expect=main.TRUE, |
| 834 | actual=stepResult, |
| 835 | onpass="VLAN: Successfully added single point" |
| 836 | + " to multi point intents", |
| 837 | onfail="VLAN: Failed to add single point" + |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 838 | " to multi point intents" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 839 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 840 | def CASE4000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 841 | """ |
| 842 | Add multi point to single point intents |
| 843 | - Get device ids |
| 844 | - Add multi point to single point intents |
| 845 | - Check intents |
| 846 | - Verify flows |
| 847 | - Ping hosts |
| 848 | - Reroute |
| 849 | - Link down |
| 850 | - Verify flows |
| 851 | - Check topology |
| 852 | - Ping hosts |
| 853 | - Link up |
| 854 | - Verify flows |
| 855 | - Check topology |
| 856 | - Ping hosts |
| 857 | - Remove intents |
| 858 | """ |
| 859 | assert main, "There is no main" |
| 860 | assert main.CLIs, "There is no main.CLIs" |
| 861 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 862 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 863 | main.numSwitch" |
| 864 | |
| 865 | main.case( "Add multi point to single point intents between devices" ) |
| 866 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 867 | main.step( "NOOPTION: Add multi point to single point intents" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 868 | stepResult = main.TRUE |
| 869 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 870 | devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \ |
| 871 | 'of:0000000000000007/8' ] |
| 872 | macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ] |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 873 | stepResult = main.intentFunction.multiToSingleIntent( |
| 874 | main, |
| 875 | name="NOOPTION", |
| 876 | hostNames=hostNames, |
| 877 | devices=devices, |
| 878 | sw1="s5", |
| 879 | sw2="s2", |
| 880 | expectedLink=18 ) |
| 881 | |
| 882 | utilities.assert_equals( expect=main.TRUE, |
| 883 | actual=stepResult, |
| 884 | onpass="NOOPTION: Successfully added multi " |
| 885 | + " point to single point intents", |
| 886 | onfail="NOOPTION: Failed to add multi point" + |
| 887 | " to single point intents" ) |
| 888 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 889 | main.step( "IPV4: Add multi point to single point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 890 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 891 | stepResult = main.intentFunction.multiToSingleIntent( |
| 892 | main, |
| 893 | name="IPV4", |
| 894 | hostNames=hostNames, |
| 895 | devices=devices, |
| 896 | ports=None, |
| 897 | ethType="IPV4", |
| 898 | macs=macs, |
| 899 | bandwidth="", |
| 900 | lambdaAlloc=False, |
| 901 | ipProto="", |
| 902 | ipAddresses="", |
| 903 | tcp="", |
| 904 | sw1="s5", |
| 905 | sw2="s2", |
| 906 | expectedLink=18 ) |
| 907 | |
| 908 | utilities.assert_equals( expect=main.TRUE, |
| 909 | actual=stepResult, |
| 910 | onpass="IPV4: Successfully added multi point" |
| 911 | + " to single point intents", |
| 912 | onfail="IPV4: Failed to add multi point" + |
| 913 | " to single point intents" ) |
| 914 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 915 | main.step( "IPV4_2: Add multi point to single point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 916 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 917 | hostNames = [ 'h8', 'h16', 'h24' ] |
| 918 | stepResult = main.intentFunction.multiToSingleIntent( |
| 919 | main, |
| 920 | name="IPV4", |
| 921 | hostNames=hostNames, |
| 922 | ethType="IPV4", |
| 923 | lambdaAlloc=False ) |
| 924 | |
| 925 | utilities.assert_equals( expect=main.TRUE, |
| 926 | actual=stepResult, |
| 927 | onpass="IPV4_2: Successfully added multi point" |
| 928 | + " to single point intents", |
| 929 | onfail="IPV4_2: Failed to add multi point" + |
| 930 | " to single point intents" ) |
| 931 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 932 | main.step( "VLAN: Add multi point to single point intents" ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 933 | stepResult = main.TRUE |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 934 | hostNames = [ 'h5', 'h13', 'h21' ] |
| 935 | devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \ |
| 936 | 'of:0000000000000007/5' ] |
| 937 | macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ] |
| 938 | stepResult = main.intentFunction.multiToSingleIntent( |
| 939 | main, |
| 940 | name="VLAN", |
| 941 | hostNames=hostNames, |
| 942 | devices=devices, |
| 943 | ports=None, |
| 944 | ethType="IPV4", |
| 945 | macs=macs, |
| 946 | bandwidth="", |
| 947 | lambdaAlloc=False, |
| 948 | ipProto="", |
| 949 | ipAddresses="", |
| 950 | tcp="", |
| 951 | sw1="s5", |
| 952 | sw2="s2", |
| 953 | expectedLink=18 ) |
| 954 | |
| 955 | utilities.assert_equals( expect=main.TRUE, |
| 956 | actual=stepResult, |
| 957 | onpass="VLAN: Successfully added multi point" |
| 958 | + " to single point intents", |
| 959 | onfail="VLAN: Failed to add multi point" + |
| 960 | " to single point intents" ) |