Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 1 | # Testing the basic intent for ipv6 functionality of ONOS |
| 2 | |
| 3 | class FUNCipv6Intent: |
| 4 | |
| 5 | def __init__( self ): |
| 6 | self.default = '' |
| 7 | |
| 8 | def CASE1( self, main ): |
| 9 | import time |
| 10 | import imp |
| 11 | import re |
| 12 | |
| 13 | """ |
| 14 | - Construct tests variables |
| 15 | - GIT ( optional ) |
| 16 | - Checkout ONOS master branch |
| 17 | - Pull latest ONOS code |
| 18 | - Building ONOS ( optional ) |
| 19 | - Install ONOS package |
| 20 | - Build ONOS package |
| 21 | """ |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 22 | main.case( "Constructing test variables and building ONOS package" ) |
| 23 | main.step( "Constructing test variables" ) |
| 24 | main.caseExplanation = "This test case is mainly for loading " +\ |
| 25 | "from params file, and pull and build the " +\ |
| 26 | " latest ONOS package" |
| 27 | stepResult = main.FALSE |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 28 | # Test variables |
| 29 | try: |
| 30 | main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir ) |
| 31 | main.apps = main.params[ 'ENV' ][ 'cellApps' ] |
| 32 | gitBranch = main.params[ 'GIT' ][ 'branch' ] |
| 33 | main.dependencyPath = main.testOnDirectory + \ |
| 34 | main.params[ 'DEPENDENCY' ][ 'path' ] |
| 35 | main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 36 | main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," ) |
| 37 | if main.ONOSbench.maxNodes: |
| 38 | main.maxNodes = int( main.ONOSbench.maxNodes ) |
| 39 | else: |
| 40 | main.maxNodes = 0 |
| 41 | wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ] |
| 42 | wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ] |
| 43 | wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ] |
| 44 | main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) |
| 45 | main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] ) |
| 46 | main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] ) |
| 47 | main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] ) |
| 48 | main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] ) |
| 49 | main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] ) |
| 50 | gitPull = main.params[ 'GIT' ][ 'pull' ] |
| 51 | main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] ) |
| 52 | main.numLinks = int( main.params[ 'MININET' ][ 'links' ] ) |
| 53 | main.cellData = {} # for creating cell file |
| 54 | main.hostsData = {} |
| 55 | main.CLIs = [] |
| 56 | main.ONOSip = [] |
| 57 | main.assertReturnString = '' # Assembled assert return string |
| 58 | |
| 59 | main.ONOSip = main.ONOSbench.getOnosIps() |
| 60 | print main.ONOSip |
| 61 | |
| 62 | # Assigning ONOS cli handles to a list |
| 63 | for i in range( 1, main.maxNodes + 1 ): |
| 64 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
| 65 | |
| 66 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 67 | main.startUp = imp.load_source( wrapperFile1, |
| 68 | main.dependencyPath + |
| 69 | wrapperFile1 + |
| 70 | ".py" ) |
| 71 | |
| 72 | main.intentFunction = imp.load_source( wrapperFile2, |
| 73 | main.dependencyPath + |
| 74 | wrapperFile2 + |
| 75 | ".py" ) |
| 76 | |
| 77 | main.topo = imp.load_source( wrapperFile3, |
| 78 | main.dependencyPath + |
| 79 | wrapperFile3 + |
| 80 | ".py" ) |
| 81 | |
| 82 | copyResult1 = main.ONOSbench.scp( main.Mininet1, |
| 83 | main.dependencyPath + |
| 84 | main.topology, |
| 85 | main.Mininet1.home, |
| 86 | direction="to" ) |
| 87 | if main.CLIs: |
| 88 | stepResult = main.TRUE |
| 89 | else: |
| 90 | main.log.error( "Did not properly created list of ONOS CLI handle" ) |
| 91 | stepResult = main.FALSE |
| 92 | except Exception as e: |
| 93 | main.log.exception(e) |
| 94 | main.cleanup() |
| 95 | main.exit() |
| 96 | |
| 97 | utilities.assert_equals( expect=main.TRUE, |
| 98 | actual=stepResult, |
| 99 | onpass="Successfully construct " + |
| 100 | "test variables ", |
| 101 | onfail="Failed to construct test variables" ) |
| 102 | |
| 103 | if gitPull == 'True': |
| 104 | main.step( "Building ONOS in " + gitBranch + " branch" ) |
| 105 | onosBuildResult = main.startUp.onosBuild( main, gitBranch ) |
| 106 | stepResult = onosBuildResult |
| 107 | utilities.assert_equals( expect=main.TRUE, |
| 108 | actual=stepResult, |
| 109 | onpass="Successfully compiled " + |
| 110 | "latest ONOS", |
| 111 | onfail="Failed to compile " + |
| 112 | "latest ONOS" ) |
| 113 | else: |
| 114 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 115 | "clean install" ) |
| 116 | main.ONOSbench.getVersion( report=True ) |
| 117 | |
| 118 | def CASE2( self, main ): |
| 119 | """ |
| 120 | - Set up cell |
| 121 | - Create cell file |
| 122 | - Set cell file |
| 123 | - Verify cell file |
| 124 | - Kill ONOS process |
| 125 | - Uninstall ONOS cluster |
| 126 | - Verify ONOS start up |
| 127 | - Install ONOS cluster |
| 128 | - Connect to cli |
| 129 | """ |
| 130 | |
| 131 | # main.scale[ 0 ] determines the current number of ONOS controller |
| 132 | main.numCtrls = int( main.scale[ 0 ] ) |
| 133 | |
| 134 | main.case( "Starting up " + str( main.numCtrls ) + |
| 135 | " node(s) ONOS cluster" ) |
| 136 | main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\ |
| 137 | " node(s) ONOS cluster" |
| 138 | |
| 139 | |
| 140 | |
| 141 | #kill off all onos processes |
| 142 | main.log.info( "Safety check, killing all ONOS processes" + |
Jon Hall | 70b2ff4 | 2015-11-17 15:49:44 -0800 | [diff] [blame] | 143 | " before initiating environment setup" ) |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 144 | |
| 145 | for i in range( main.maxNodes ): |
| 146 | main.ONOSbench.onosDie( main.ONOSip[ i ] ) |
| 147 | |
| 148 | print "NODE COUNT = ", main.numCtrls |
| 149 | |
| 150 | tempOnosIp = [] |
| 151 | for i in range( main.numCtrls ): |
| 152 | tempOnosIp.append( main.ONOSip[i] ) |
| 153 | |
| 154 | main.ONOSbench.createCellFile( main.ONOSbench.ip_address, |
| 155 | "temp", main.Mininet1.ip_address, |
| 156 | main.apps, tempOnosIp ) |
| 157 | |
| 158 | main.step( "Apply cell to environment" ) |
| 159 | cellResult = main.ONOSbench.setCell( "temp" ) |
| 160 | verifyResult = main.ONOSbench.verifyCell() |
| 161 | stepResult = cellResult and verifyResult |
| 162 | utilities.assert_equals( expect=main.TRUE, |
| 163 | actual=stepResult, |
| 164 | onpass="Successfully applied cell to " + \ |
| 165 | "environment", |
| 166 | onfail="Failed to apply cell to environment " ) |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 167 | |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 168 | main.step( "Creating ONOS package" ) |
| 169 | packageResult = main.ONOSbench.onosPackage() |
| 170 | stepResult = packageResult |
| 171 | utilities.assert_equals( expect=main.TRUE, |
| 172 | actual=stepResult, |
| 173 | onpass="Successfully created ONOS package", |
| 174 | onfail="Failed to create ONOS package" ) |
| 175 | |
| 176 | time.sleep( main.startUpSleep ) |
| 177 | main.step( "Uninstalling ONOS package" ) |
| 178 | onosUninstallResult = main.TRUE |
| 179 | for ip in main.ONOSip: |
| 180 | onosUninstallResult = onosUninstallResult and \ |
| 181 | main.ONOSbench.onosUninstall( nodeIp=ip ) |
| 182 | stepResult = onosUninstallResult |
| 183 | utilities.assert_equals( expect=main.TRUE, |
| 184 | actual=stepResult, |
| 185 | onpass="Successfully uninstalled ONOS package", |
| 186 | onfail="Failed to uninstall ONOS package" ) |
| 187 | |
| 188 | time.sleep( main.startUpSleep ) |
| 189 | main.step( "Installing ONOS package" ) |
| 190 | onosInstallResult = main.TRUE |
| 191 | for i in range( main.numCtrls ): |
| 192 | onosInstallResult = onosInstallResult and \ |
| 193 | main.ONOSbench.onosInstall( node=main.ONOSip[ i ] ) |
| 194 | stepResult = onosInstallResult |
| 195 | utilities.assert_equals( expect=main.TRUE, |
| 196 | actual=stepResult, |
| 197 | onpass="Successfully installed ONOS package", |
| 198 | onfail="Failed to install ONOS package" ) |
| 199 | |
| 200 | time.sleep( main.startUpSleep ) |
| 201 | main.step( "Starting ONOS service" ) |
| 202 | stopResult = main.TRUE |
| 203 | startResult = main.TRUE |
| 204 | onosIsUp = main.TRUE |
| 205 | |
| 206 | for i in range( main.numCtrls ): |
| 207 | onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] ) |
| 208 | if onosIsUp == main.TRUE: |
| 209 | main.log.report( "ONOS instance is up and ready" ) |
| 210 | else: |
| 211 | main.log.report( "ONOS instance may not be up, stop and " + |
| 212 | "start ONOS again " ) |
| 213 | |
| 214 | for i in range( main.numCtrls ): |
| 215 | stopResult = stopResult and \ |
| 216 | main.ONOSbench.onosStop( main.ONOSip[ i ] ) |
| 217 | for i in range( main.numCtrls ): |
| 218 | startResult = startResult and \ |
| 219 | main.ONOSbench.onosStart( main.ONOSip[ i ] ) |
| 220 | stepResult = onosIsUp and stopResult and startResult |
| 221 | utilities.assert_equals( expect=main.TRUE, |
| 222 | actual=stepResult, |
| 223 | onpass="ONOS service is ready", |
| 224 | onfail="ONOS service did not start properly" ) |
| 225 | |
| 226 | main.step( "Start ONOS cli" ) |
| 227 | cliResult = main.TRUE |
| 228 | for i in range( main.numCtrls ): |
| 229 | cliResult = cliResult and \ |
| 230 | main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] ) |
| 231 | stepResult = cliResult |
| 232 | utilities.assert_equals( expect=main.TRUE, |
| 233 | actual=stepResult, |
| 234 | onpass="Successfully start ONOS cli", |
| 235 | onfail="Failed to start ONOS cli" ) |
| 236 | |
Jon Hall | 11845ed | 2016-02-11 11:25:31 -0800 | [diff] [blame] | 237 | main.step( "Checking that ONOS is ready" ) |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 238 | for i in range( 3 ): |
Jon Hall | 11845ed | 2016-02-11 11:25:31 -0800 | [diff] [blame] | 239 | ready = True |
Jeremy | 5f82007 | 2016-02-11 13:50:35 -0800 | [diff] [blame] | 240 | for i in range( int( main.scale[ 0 ] ) ): |
| 241 | output = main.CLIs[ i ].summary() |
Jon Hall | 11845ed | 2016-02-11 11:25:31 -0800 | [diff] [blame] | 242 | if not output: |
| 243 | ready = False |
| 244 | time.sleep( 30 ) |
| 245 | utilities.assert_equals( expect=True, actual=ready, |
| 246 | onpass="ONOS summary command succeded", |
| 247 | onfail="ONOS summary command failed" ) |
| 248 | if not ready: |
| 249 | main.cleanup() |
| 250 | main.exit() |
| 251 | |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 252 | main.step( "setup the ipv6NeighbourDiscovery" ) |
| 253 | cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" ) |
| 254 | cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" ) |
| 255 | cfgResult = cfgResult1 and cfgResult2 |
| 256 | utilities.assert_equals( expect=main.TRUE, actual=cfgResult, |
| 257 | onpass="ipv6NeighborDiscovery cfg is set to true", |
| 258 | onfail="Failed to cfg set ipv6NeighborDiscovery" ) |
| 259 | |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 260 | # Remove the first element in main.scale list |
| 261 | main.scale.remove( main.scale[ 0 ] ) |
| 262 | |
| 263 | main.intentFunction.report( main ) |
| 264 | |
| 265 | def CASE11( self, main ): |
| 266 | """ |
| 267 | Start Mininet topology with OF 1.3 switches |
| 268 | """ |
| 269 | main.OFProtocol = "1.3" |
| 270 | main.log.report( "Start Mininet topology with OF 1.3 switches" ) |
| 271 | main.case( "Start Mininet topology with OF 1.3 switches" ) |
| 272 | main.caseExplanation = "Start mininet topology with OF 1.3 " +\ |
| 273 | "switches to test intents, exits out if " +\ |
| 274 | "topology did not start correctly" |
| 275 | |
| 276 | main.step( "Starting Mininet topology with OF 1.3 switches" ) |
| 277 | args = "--switch ovs,protocols=OpenFlow13" |
| 278 | topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath + |
| 279 | main.topology, |
| 280 | args=args ) |
| 281 | stepResult = topoResult |
| 282 | utilities.assert_equals( expect=main.TRUE, |
| 283 | actual=stepResult, |
| 284 | onpass="Successfully loaded topology", |
| 285 | onfail="Failed to load topology" ) |
| 286 | # Exit if topology did not load properly |
| 287 | if not topoResult: |
| 288 | main.cleanup() |
| 289 | main.exit() |
| 290 | |
| 291 | def CASE12( self, main ): |
| 292 | """ |
| 293 | Assign mastership to controllers |
| 294 | """ |
| 295 | import re |
| 296 | |
| 297 | main.case( "Assign switches to controllers" ) |
| 298 | main.step( "Assigning switches to controllers" ) |
| 299 | main.caseExplanation = "Assign OF " + main.OFProtocol +\ |
| 300 | " switches to ONOS nodes" |
| 301 | |
| 302 | assignResult = main.TRUE |
| 303 | switchList = [] |
| 304 | |
| 305 | # Creates a list switch name, use getSwitch() function later... |
| 306 | for i in range( 1, ( main.numSwitch + 1 ) ): |
| 307 | switchList.append( 's' + str( i ) ) |
| 308 | |
| 309 | tempONOSip = [] |
| 310 | for i in range( main.numCtrls ): |
| 311 | tempONOSip.append( main.ONOSip[ i ] ) |
| 312 | |
| 313 | assignResult = main.Mininet1.assignSwController( sw=switchList, |
| 314 | ip=tempONOSip, |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 315 | port='6633' ) |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 316 | if not assignResult: |
| 317 | main.cleanup() |
| 318 | main.exit() |
| 319 | |
| 320 | for i in range( 1, ( main.numSwitch + 1 ) ): |
| 321 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 322 | print( "Response is " + str( response ) ) |
| 323 | if re.search( "tcp:" + main.ONOSip[ 0 ], response ): |
| 324 | assignResult = assignResult and main.TRUE |
| 325 | else: |
| 326 | assignResult = main.FALSE |
| 327 | stepResult = assignResult |
| 328 | utilities.assert_equals( expect=main.TRUE, |
| 329 | actual=stepResult, |
| 330 | onpass="Successfully assigned switches" + |
| 331 | "to controller", |
| 332 | onfail="Failed to assign switches to " + |
| 333 | "controller" ) |
| 334 | |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 335 | def CASE13( self, main ): |
| 336 | """ |
| 337 | Discover all hosts and store its data to a dictionary |
| 338 | """ |
| 339 | main.case( "Discover all hosts" ) |
| 340 | |
| 341 | stepResult = main.TRUE |
| 342 | main.step( "Discover all hosts using pingall " ) |
| 343 | stepResult = main.intentFunction.getHostsData( main ) |
| 344 | utilities.assert_equals( expect=main.TRUE, |
| 345 | actual=stepResult, |
| 346 | onpass="Successfully discovered hosts", |
| 347 | onfail="Failed to discover hosts" ) |
| 348 | |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 349 | def CASE16( self, main ): |
| 350 | """ |
| 351 | Balance Masters |
| 352 | """ |
| 353 | main.case( "Balance mastership of switches" ) |
| 354 | main.step( "Balancing mastership of switches" ) |
| 355 | |
| 356 | balanceResult = main.FALSE |
| 357 | balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] ) |
| 358 | |
| 359 | utilities.assert_equals( expect=main.TRUE, |
| 360 | actual=balanceResult, |
| 361 | onpass="Successfully balanced mastership of switches", |
| 362 | onfail="Failed to balance mastership of switches" ) |
| 363 | |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 364 | def CASE14( self, main ): |
| 365 | """ |
| 366 | Stop mininet |
| 367 | """ |
| 368 | main.log.report( "Stop Mininet topology" ) |
| 369 | main.case( "Stop Mininet topology" ) |
| 370 | main.caseExplanation = "Stopping the current mininet topology " +\ |
| 371 | "to start up fresh" |
| 372 | |
| 373 | main.step( "Stopping Mininet Topology" ) |
| 374 | topoResult = main.Mininet1.stopNet( ) |
| 375 | stepResult = topoResult |
| 376 | utilities.assert_equals( expect=main.TRUE, |
| 377 | actual=stepResult, |
| 378 | onpass="Successfully stop mininet", |
| 379 | onfail="Failed to stop mininet" ) |
| 380 | # Exit if topology did not load properly |
| 381 | if not topoResult: |
| 382 | main.cleanup() |
| 383 | main.exit() |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 384 | |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 385 | def CASE1000( self, main ): |
| 386 | """ |
| 387 | Add host intents between 2 host: |
| 388 | - Discover hosts |
| 389 | - Add host intents |
| 390 | - Check intents |
| 391 | - Verify flows |
| 392 | - Ping hosts |
| 393 | - Reroute |
| 394 | - Link down |
| 395 | - Verify flows |
| 396 | - Check topology |
| 397 | - Ping hosts |
| 398 | - Link up |
| 399 | - Verify flows |
| 400 | - Check topology |
| 401 | - Ping hosts |
| 402 | - Remove intents |
| 403 | """ |
| 404 | import time |
| 405 | import json |
| 406 | import re |
| 407 | |
| 408 | # Assert variables - These variable's name|format must be followed |
| 409 | # if you want to use the wrapper function |
| 410 | assert main, "There is no main" |
| 411 | assert main.CLIs, "There is no main.CLIs" |
| 412 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 413 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 414 | main.numSwitch" |
| 415 | |
| 416 | intentLeadersOld = main.CLIs[ 0 ].leaderCandidates() |
| 417 | |
| 418 | main.testName = "Host Intents" |
| 419 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
| 420 | " NODE(S) - OF " + main.OFProtocol ) |
| 421 | main.caseExplanation = "This test case tests Host intents using " +\ |
| 422 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 423 | "Different type of hosts will be tested in " +\ |
| 424 | "each step such as IPV6, Dual stack, VLAN " +\ |
| 425 | "etc;\nThe test will use OF " + main.OFProtocol\ |
| 426 | + " OVS running in Mininet" |
| 427 | |
| 428 | main.step( "IPV6: Add host intents between h1 and h9" ) |
| 429 | stepResult = main.TRUE |
| 430 | stepResult = main.intentFunction.hostIntent( main, |
| 431 | name='IPV6', |
| 432 | host1='h1', |
| 433 | host2='h9', |
| 434 | host1Id='00:00:00:00:00:01/-1', |
| 435 | host2Id='00:00:00:00:00:09/-1', |
| 436 | sw1='s5', |
| 437 | sw2='s2', |
| 438 | expectedLink=18 ) |
| 439 | |
| 440 | utilities.assert_equals( expect=main.TRUE, |
| 441 | actual=stepResult, |
| 442 | onpass="IPV6: Host intent test successful " + |
| 443 | "between two IPV6 hosts", |
| 444 | onfail="IPV6: Host intent test failed " + |
| 445 | "between two IPV6 hosts") |
| 446 | |
| 447 | main.step( "DUALSTACK1: Add host intents between h3 and h11" ) |
| 448 | stepResult = main.TRUE |
| 449 | stepResult = main.intentFunction.hostIntent( main, |
| 450 | name='DUALSTACK', |
| 451 | host1='h3', |
| 452 | host2='h11', |
| 453 | host1Id='00:00:00:00:00:03/-1', |
| 454 | host2Id='00:00:00:00:00:0B/-1', |
| 455 | sw1='s5', |
| 456 | sw2='s2', |
| 457 | expectedLink=18 ) |
| 458 | |
| 459 | utilities.assert_equals( expect=main.TRUE, |
| 460 | actual=stepResult, |
| 461 | onpass="DUALSTACK: Host intent test " + |
| 462 | "successful between two " + |
| 463 | "dual stack host using IPV6", |
| 464 | onfail="DUALSTACK: Host intent test " + |
| 465 | "failed between two" + |
| 466 | "dual stack host using IPV6" ) |
| 467 | |
| 468 | main.step( "1HOP: Add host intents between h1 and h3" ) |
| 469 | stepResult = main.TRUE |
| 470 | stepResult = main.intentFunction.hostIntent( main, |
| 471 | name='1HOP', |
| 472 | host1='h1', |
| 473 | host2='h9', |
| 474 | host1Id='00:00:00:00:00:01/-1', |
| 475 | host2Id='00:00:00:00:00:09/-1') |
| 476 | |
| 477 | utilities.assert_equals( expect=main.TRUE, |
| 478 | actual=stepResult, |
| 479 | onpass="1HOP: Host intent test " + |
| 480 | "successful between two " + |
| 481 | "host using IPV6 in the same switch", |
| 482 | onfail="1HOP: Host intent test " + |
| 483 | "failed between two" + |
| 484 | "host using IPV6 in the same switch" ) |
| 485 | |
| 486 | main.step( "VLAN: Add vlan host intents between h5 and h24" ) |
| 487 | stepResult = main.TRUE |
| 488 | stepResult = main.intentFunction.hostIntent( main, |
| 489 | name='VLAN1', |
| 490 | host1='h5', |
| 491 | host2='h24', |
| 492 | host1Id='00:00:00:00:00:05/100', |
| 493 | host2Id='00:00:00:00:00:18/100', |
| 494 | sw1='s5', |
| 495 | sw2='s2', |
| 496 | expectedLink=18 ) |
| 497 | |
| 498 | utilities.assert_equals( expect=main.TRUE, |
| 499 | actual=stepResult, |
| 500 | onpass="VLAN: Host intent test " + |
| 501 | "successful between two " + |
| 502 | "host using IPV6 in the same VLAN", |
| 503 | onfail="VLAN1: Host intent test " + |
| 504 | "failed between two" + |
| 505 | "host using IPV6 in the same VLAN" ) |
| 506 | |
| 507 | main.intentFunction.report( main ) |
| 508 | |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 509 | def CASE2000( self, main ): |
| 510 | """ |
| 511 | add point intents between 2 hosts: |
| 512 | - Get device ids | ports |
| 513 | - Add point intents |
| 514 | - Check intents |
| 515 | - Verify flows |
| 516 | - Ping hosts |
| 517 | - Reroute |
| 518 | - Link down |
| 519 | - Verify flows |
| 520 | - Check topology |
| 521 | - Ping hosts |
| 522 | - Link up |
| 523 | - Verify flows |
| 524 | - Check topology |
| 525 | - Ping hosts |
| 526 | - Remove intents |
| 527 | """ |
| 528 | import time |
| 529 | import json |
| 530 | import re |
| 531 | |
| 532 | # Assert variables - These variable's name|format must be followed |
| 533 | # if you want to use the wrapper function |
| 534 | assert main, "There is no main" |
| 535 | assert main.CLIs, "There is no main.CLIs" |
| 536 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 537 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 538 | main.numSwitch" |
| 539 | |
| 540 | main.testName = "Point Intents" |
| 541 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
| 542 | " NODE(S) - OF " + main.OFProtocol ) |
| 543 | main.caseExplanation = "This test case will test point to point" +\ |
| 544 | " intents using " + str( main.numCtrls ) +\ |
| 545 | " node(s) cluster;\n" +\ |
| 546 | "Different type of hosts will be tested in " +\ |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 547 | "each step such as IPV6, Dual stack, VLAN etc" +\ |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 548 | ";\nThe test will use OF " + main.OFProtocol +\ |
| 549 | " OVS running in Mininet" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 550 | # No option point intents |
| 551 | main.step( "NOOPTION: Add point intents between h1 and h9, ipv6 hosts" ) |
| 552 | main.assertReturnString = "Assertion Result for NOOPTION point intent\n" |
| 553 | stepResult = main.TRUE |
| 554 | stepResult = main.intentFunction.pointIntent( |
| 555 | main, |
| 556 | name="NOOPTION", |
| 557 | host1="h1", |
| 558 | host2="h9", |
| 559 | deviceId1="of:0000000000000005/1", |
| 560 | deviceId2="of:0000000000000006/1") |
| 561 | |
| 562 | utilities.assert_equals( expect=main.TRUE, |
| 563 | actual=stepResult, |
| 564 | onpass=main.assertReturnString, |
| 565 | onfail=main.assertReturnString ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 566 | stepResult = main.TRUE |
| 567 | main.step( "IPV6: Add point intents between h1 and h9" ) |
| 568 | main.assertReturnString = "Assertion Result for IPV6 point intent\n" |
| 569 | stepResult = main.intentFunction.pointIntent( |
| 570 | main, |
| 571 | name="IPV6", |
| 572 | host1="h1", |
| 573 | host2="h9", |
| 574 | deviceId1="of:0000000000000005/1", |
| 575 | deviceId2="of:0000000000000006/1", |
| 576 | port1="", |
| 577 | port2="", |
| 578 | ethType="IPV6", |
| 579 | mac1="00:00:00:00:00:01", |
| 580 | mac2="00:00:00:00:00:09", |
| 581 | bandwidth="", |
| 582 | lambdaAlloc=False, |
| 583 | ipProto="", |
| 584 | ip1="", |
| 585 | ip2="", |
| 586 | tcp1="", |
| 587 | tcp2="", |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 588 | sw1="s5", |
| 589 | sw2="s2", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 590 | expectedLink=18 ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 591 | utilities.assert_equals( expect=main.TRUE, |
| 592 | actual=stepResult, |
| 593 | onpass=main.assertReturnString, |
| 594 | onfail=main.assertReturnString ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 595 | main.step( "IPV6_2: Add point intents between h1 and h9" ) |
| 596 | main.assertReturnString = "Assertion Result for IPV6 no mac address point intents\n" |
| 597 | stepResult = main.intentFunction.pointIntent( |
| 598 | main, |
| 599 | name="IPV6_2", |
| 600 | host1="h1", |
| 601 | host2="h9", |
| 602 | deviceId1="of:0000000000000005/1", |
| 603 | deviceId2="of:0000000000000006/1", |
| 604 | ipProto="", |
| 605 | ip1="", |
| 606 | ip2="", |
| 607 | tcp1="", |
| 608 | tcp2="", |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 609 | expectedLink="") |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 610 | utilities.assert_equals( expect=main.TRUE, |
| 611 | actual=stepResult, |
| 612 | onpass=main.assertReturnString, |
| 613 | onfail=main.assertReturnString ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 614 | main.step( "SDNIP-ICMP: Add point intents between h1 and h9" ) |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 615 | main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV6 using ICMP point intents\n" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 616 | mac1 = main.hostsData[ 'h1' ][ 'mac' ] |
| 617 | mac2 = main.hostsData[ 'h9' ][ 'mac' ] |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 618 | main.log.debug(mac2) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 619 | ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ] |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 620 | ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128" |
| 621 | ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 622 | stepResult = main.intentFunction.pointIntent( |
| 623 | main, |
| 624 | name="SDNIP-ICMP", |
| 625 | host1="h1", |
| 626 | host2="h9", |
| 627 | deviceId1="of:0000000000000005/1", |
| 628 | deviceId2="of:0000000000000006/1", |
| 629 | mac1=mac1, |
| 630 | mac2=mac2, |
| 631 | ethType="IPV6", |
| 632 | ipProto=ipProto, |
| 633 | ip1=ip1, |
| 634 | ip2=ip2 ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 635 | utilities.assert_equals( expect=main.TRUE, |
| 636 | actual=stepResult, |
| 637 | onpass=main.assertReturnString, |
| 638 | onfail=main.assertReturnString ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 639 | main.step( "SDNIP-TCP: Add point intents between h1 and h9" ) |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 640 | main.assertReturnString = "Assertion Result for SDNIP-TCP IPV6 using TCP point intents\n" |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 641 | mac1 = main.hostsData[ 'h1' ][ 'mac' ] |
| 642 | mac2 = main.hostsData[ 'h9' ][ 'mac' ] |
| 643 | ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128" |
| 644 | ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 645 | ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ] |
| 646 | tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 647 | tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ] |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 648 | stepResult = main.intentFunction.pointIntentTcp( |
| 649 | main, |
| 650 | name="SDNIP-TCP", |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 651 | host1="h1", |
| 652 | host2="h9", |
| 653 | deviceId1="of:0000000000000005/1", |
| 654 | deviceId2="of:0000000000000006/1", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 655 | mac1=mac1, |
| 656 | mac2=mac2, |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 657 | ethType="IPV6", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 658 | ipProto=ipProto, |
| 659 | ip1=ip1, |
| 660 | ip2=ip2, |
| 661 | tcp1=tcp1, |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 662 | tcp2=tcp2, |
| 663 | sw1="", |
| 664 | sw2="", |
| 665 | expectedLink="" ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 666 | utilities.assert_equals( expect=main.TRUE, |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 667 | actual=stepResult, |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 668 | onpass=main.assertReturnString, |
| 669 | onfail=main.assertReturnString ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 670 | main.step( "DUALSTACK1: Add point intents between h3 and h11" ) |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 671 | main.assertReturnString = "Assertion Result for Dualstack1 IPV6 with mac address point intents\n" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 672 | stepResult = main.intentFunction.pointIntent( |
| 673 | main, |
| 674 | name="DUALSTACK1", |
| 675 | host1="h3", |
| 676 | host2="h11", |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 677 | deviceId1="of:0000000000000005/3", |
| 678 | deviceId2="of:0000000000000006/3", |
| 679 | port1="", |
| 680 | port2="", |
| 681 | ethType="IPV6", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 682 | mac1="00:00:00:00:00:03", |
| 683 | mac2="00:00:00:00:00:0B", |
| 684 | bandwidth="", |
| 685 | lambdaAlloc=False, |
| 686 | ipProto="", |
| 687 | ip1="", |
| 688 | ip2="", |
| 689 | tcp1="", |
| 690 | tcp2="", |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 691 | sw1="s5", |
| 692 | sw2="s2", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 693 | expectedLink=18 ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 694 | utilities.assert_equals( expect=main.TRUE, |
| 695 | actual=stepResult, |
| 696 | onpass=main.assertReturnString, |
| 697 | onfail=main.assertReturnString ) |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 698 | main.step( "VLAN: Add point intents between h5 and h24" ) |
| 699 | main.assertReturnString = "Assertion Result for VLAN IPV6 with mac address point intents\n" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 700 | stepResult = main.intentFunction.pointIntent( |
| 701 | main, |
| 702 | name="VLAN", |
| 703 | host1="h5", |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 704 | host2="h24", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 705 | deviceId1="of:0000000000000005/5", |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 706 | deviceId2="of:0000000000000007/8", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 707 | port1="", |
| 708 | port2="", |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 709 | ethType="IPV6", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 710 | mac1="00:00:00:00:00:05", |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 711 | mac2="00:00:00:00:00:18", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 712 | bandwidth="", |
| 713 | lambdaAlloc=False, |
| 714 | ipProto="", |
| 715 | ip1="", |
| 716 | ip2="", |
| 717 | tcp1="", |
| 718 | tcp2="", |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 719 | sw1="s5", |
| 720 | sw2="s2", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 721 | expectedLink=18 ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 722 | utilities.assert_equals( expect=main.TRUE, |
| 723 | actual=stepResult, |
| 724 | onpass=main.assertReturnString, |
| 725 | onfail=main.assertReturnString ) |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 726 | main.step( "1HOP: Add point intents between h1 and h9" ) |
| 727 | main.assertReturnString = "Assertion Result for 1HOP IPV6 with no mac address point intents\n" |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 728 | stepResult = main.intentFunction.pointIntent( main, |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 729 | name='1HOP', |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 730 | host1="h1", |
| 731 | host2="h9", |
| 732 | deviceId1="of:0000000000000005/1", |
| 733 | deviceId2="of:0000000000000006/1") |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 734 | utilities.assert_equals( expect=main.TRUE, |
| 735 | actual=stepResult, |
| 736 | onpass=main.assertReturnString, |
| 737 | onfail=main.assertReturnString ) |
| 738 | main.intentFunction.report( main ) |
| 739 | |
| 740 | def CASE3000( self, main ): |
| 741 | """ |
| 742 | Add single point to multi point intents |
| 743 | - Get device ids |
| 744 | - Add single point to multi point intents |
| 745 | - Check intents |
| 746 | - Verify flows |
| 747 | - Ping hosts |
| 748 | - Reroute |
| 749 | - Link down |
| 750 | - Verify flows |
| 751 | - Check topology |
| 752 | - Ping hosts |
| 753 | - Link up |
| 754 | - Verify flows |
| 755 | - Check topology |
| 756 | - Ping hosts |
| 757 | - Remove intents |
| 758 | """ |
| 759 | import time |
| 760 | import json |
| 761 | import re |
| 762 | assert main, "There is no main" |
| 763 | assert main.CLIs, "There is no main.CLIs" |
| 764 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 765 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 766 | main.numSwitch" |
| 767 | main.testName = "Single to Multi Point Intents" |
| 768 | main.case( main.testName + " Test - " + str( main.numCtrls ) + " NODE(S) - OF " + main.OFProtocol ) |
| 769 | main.caseExplanation = "This test case will test single point to" +\ |
| 770 | " multi point intents using " +\ |
| 771 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 772 | "Different type of hosts will be tested in " +\ |
| 773 | "each step such as IPV6, Dual stack, VLAN etc" +\ |
| 774 | ";\nThe test will use OF " + main.OFProtocol +\ |
| 775 | " OVS running in Mininet " |
| 776 | main.step( "NOOPTION: Add single point to multi point intents" ) |
| 777 | hostNames = [ 'h1', 'h9', 'h17' ] |
| 778 | devices = [ 'of:0000000000000005/1','of:0000000000000006/1', 'of:0000000000000007/1' ] |
| 779 | main.assertReturnString = "Assertion results for IPV6 single to multi point intent with no options set\n" |
| 780 | stepResult = main.TRUE |
| 781 | stepResult = main.intentFunction.singleToMultiIntent( |
| 782 | main, |
| 783 | name="NOOPTION", |
| 784 | hostNames=hostNames, |
| 785 | devices=devices, |
| 786 | sw1="s5", |
| 787 | sw2="s2", |
| 788 | expectedLink=18) |
| 789 | utilities.assert_equals( expect=main.TRUE, |
| 790 | actual=stepResult, |
| 791 | onpass=main.assertReturnString, |
| 792 | onfail=main.assertReturnString ) |
| 793 | main.step( "IPV6: Add single point to multi point intents" ) |
| 794 | main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses\n" |
| 795 | hostNames = [ 'h1', 'h9', 'h17' ] |
| 796 | devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ] |
| 797 | macs = [ '00:00:00:00:00:01','00:00:00:00:00:09' ,'00:00:00:00:00:11' ] |
| 798 | stepResult = main.TRUE |
| 799 | stepResult = main.intentFunction.singleToMultiIntent( |
| 800 | main, |
| 801 | name="IPV6", |
| 802 | hostNames=hostNames, |
| 803 | devices=devices, |
| 804 | macs=macs, |
| 805 | ethType="IPV6", |
| 806 | sw1="", |
| 807 | sw2="") |
| 808 | utilities.assert_equals( expect=main.TRUE, |
| 809 | actual=stepResult, |
| 810 | onpass=main.assertReturnString, |
| 811 | onfail=main.assertReturnString ) |
| 812 | main.step( "IPV6_2: Add single point to multi point intents" ) |
| 813 | main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and no MAC addresses\n" |
| 814 | hostNames = [ 'h1', 'h9', 'h17' ] |
| 815 | devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ] |
| 816 | stepResult = main.TRUE |
| 817 | stepResult = main.intentFunction.singleToMultiIntent( |
| 818 | main, |
| 819 | name="IPV6_2", |
| 820 | hostNames=hostNames, |
| 821 | devices=devices, |
| 822 | ethType="IPV6", |
| 823 | sw1="", |
| 824 | sw2="") |
| 825 | utilities.assert_equals( expect=main.TRUE, |
| 826 | actual=stepResult, |
| 827 | onpass=main.assertReturnString, |
| 828 | onfail=main.assertReturnString ) |
| 829 | main.step( "VLAN: Add single point to multi point intents" ) |
| 830 | main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses in the same VLAN\n" |
| 831 | hostNames = [ 'h5', 'h24' ] |
| 832 | devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ] |
| 833 | macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ] |
| 834 | stepResult = main.TRUE |
| 835 | stepResult = main.intentFunction.singleToMultiIntent( |
| 836 | main, |
| 837 | name="IPV6", |
| 838 | hostNames=hostNames, |
| 839 | devices=devices, |
| 840 | macs=macs, |
| 841 | ethType="IPV6", |
| 842 | sw1="", |
| 843 | sw2="") |
| 844 | utilities.assert_equals( expect=main.TRUE, |
| 845 | actual=stepResult, |
| 846 | onpass=main.assertReturnString, |
| 847 | onfail=main.assertReturnString ) |
| 848 | main.intentFunction.report( main ) |
| 849 | |
| 850 | def CASE4000( self, main ): |
| 851 | """ |
| 852 | Add multi point to single point intents |
| 853 | - Get device ids |
| 854 | - Add multi point to single point intents |
| 855 | - Check intents |
| 856 | - Verify flows |
| 857 | - Ping hosts |
| 858 | - Reroute |
| 859 | - Link down |
| 860 | - Verify flows |
| 861 | - Check topology |
| 862 | - Ping hosts |
| 863 | - Link up |
| 864 | - Verify flows |
| 865 | - Check topology |
| 866 | - Ping hosts |
| 867 | - Remove intents |
| 868 | """ |
| 869 | assert main, "There is no main" |
| 870 | assert main.CLIs, "There is no main.CLIs" |
| 871 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 872 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 873 | main.numSwitch" |
| 874 | |
| 875 | main.testName = "Multi To Single Point Intents" |
| 876 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
| 877 | " NODE(S) - OF " + main.OFProtocol ) |
| 878 | main.caseExplanation = "This test case will test single point to" +\ |
| 879 | " multi point intents using " +\ |
| 880 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 881 | "Different type of hosts will be tested in " +\ |
| 882 | "each step such as IPV6, Dual stack, VLAN etc" +\ |
| 883 | ";\nThe test will use OF " + main.OFProtocol +\ |
| 884 | " OVS running in Mininet" |
| 885 | |
| 886 | main.step( "NOOPTION: Add multi point to single point intents" ) |
| 887 | main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n" |
| 888 | stepResult = main.TRUE |
| 889 | hostNames = [ 'h17', 'h9' ] |
| 890 | devices = ['of:0000000000000007/1', 'of:0000000000000006/1' ] |
| 891 | stepResult = main.intentFunction.multiToSingleIntent( |
| 892 | main, |
| 893 | name="NOOPTION", |
| 894 | hostNames=hostNames, |
| 895 | devices=devices, |
| 896 | sw1="s6", |
| 897 | sw2="s2", |
| 898 | expectedLink=18 ) |
| 899 | utilities.assert_equals( expect=main.TRUE, |
| 900 | actual=stepResult, |
| 901 | onpass=main.assertReturnString, |
| 902 | onfail=main.assertReturnString ) |
| 903 | main.step( "IPV6: Add multi point to single point intents" ) |
| 904 | main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and MAC addresses\n" |
| 905 | hostNames = [ 'h1', 'h9', 'h17' ] |
| 906 | devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ] |
| 907 | macs = [ '00:00:00:00:00:01','00:00:00:00:00:09' ,'00:00:00:00:00:11' ] |
| 908 | stepResult = main.TRUE |
| 909 | installResult = main.intentFunction.multiToSingleIntent( |
| 910 | main, |
| 911 | name="IPV6", |
| 912 | hostNames=hostNames, |
| 913 | devices=devices, |
| 914 | macs=macs, |
| 915 | ethType="IPV6", |
| 916 | sw1="", |
| 917 | sw2="", |
| 918 | expectedLink="" ) |
| 919 | utilities.assert_equals( expect=main.TRUE, |
| 920 | actual=stepResult, |
| 921 | onpass=main.assertReturnString, |
| 922 | onfail=main.assertReturnString ) |
| 923 | main.step( "IPV6_2: Add multi point to single point intents" ) |
| 924 | main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses\n" |
| 925 | hostNames = [ 'h1', 'h9' ] |
| 926 | devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1' ] |
| 927 | stepResult = main.TRUE |
| 928 | stepResult = main.intentFunction.multiToSingleIntent( |
| 929 | main, |
| 930 | name="IPV6_2", |
| 931 | hostNames=hostNames, |
| 932 | devices=devices, |
| 933 | ethType="IPV6", |
| 934 | sw1="", |
| 935 | sw2="", |
| 936 | expectedLink="") |
| 937 | utilities.assert_equals( expect=main.TRUE, |
| 938 | actual=stepResult, |
| 939 | onpass=main.assertReturnString, |
| 940 | onfail=main.assertReturnString ) |
| 941 | |
| 942 | main.step( "VLAN: Add multi point to single point intents" ) |
| 943 | main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses in the same VLAN\n" |
| 944 | hostNames = [ 'h5', 'h24' ] |
| 945 | devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ] |
| 946 | macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ] |
| 947 | stepResult = main.TRUE |
| 948 | stepResult = main.intentFunction.multiToSingleIntent( |
| 949 | main, |
| 950 | name="VLAN", |
| 951 | hostNames=hostNames, |
| 952 | devices=devices, |
| 953 | macs=macs, |
| 954 | ethType="IPV6", |
| 955 | sw1="", |
| 956 | sw2="", |
| 957 | expectedLink="") |
| 958 | utilities.assert_equals( expect=main.TRUE, |
| 959 | actual=stepResult, |
| 960 | onpass=main.assertReturnString, |
| 961 | onfail=main.assertReturnString ) |
| 962 | main.intentFunction.report( main ) |
| 963 | |
| 964 | def CASE5000( self, main ): |
| 965 | """ |
| 966 | Tests Host Mobility |
| 967 | Modifies the topology location of h1 |
| 968 | """ |
| 969 | assert main, "There is no main" |
| 970 | assert main.CLIs, "There is no main.CLIs" |
| 971 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 972 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 973 | main.numSwitch" |
| 974 | main.case( "Test host mobility with host intents " ) |
| 975 | main.step( "Testing host mobility by moving h1 from s5 to s6" ) |
| 976 | h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ] |
| 977 | |
| 978 | main.log.info( "Moving h1 from s5 to s6") |
| 979 | main.Mininet1.moveHostv6( "h1","s5","s6" ) |
| 980 | main.intentFunction.getHostsData( main ) |
| 981 | h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ] |
| 982 | |
| 983 | utilities.assert_equals( expect="of:0000000000000006", |
| 984 | actual=h1PostMove, |
| 985 | onpass="Mobility: Successfully moved h1 to s6", |
| 986 | onfail="Mobility: Failed to move h1 to s6" + |
| 987 | " to single point intents" + |
| 988 | " with IPV6 type and MAC addresses" + |
| 989 | " in the same VLAN" ) |
| 990 | main.step( "IPV6: Add host intents between h1 and h9" ) |
| 991 | main.assertReturnString = "Assert result for IPV6 host intent between h1, moved, and h9\n" |
| 992 | stepResult = main.TRUE |
| 993 | stepResult = main.intentFunction.hostIntent( main, |
| 994 | name='IPV6 Mobility IPV6', |
| 995 | host1='h1', |
| 996 | host2='h9', |
| 997 | host1Id='00:00:00:00:00:01/-1', |
| 998 | host2Id='00:00:00:00:00:09/-1') |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 999 | |
| 1000 | utilities.assert_equals( expect=main.TRUE, |
| 1001 | actual=stepResult, |
| 1002 | onpass=main.assertReturnString, |
| 1003 | onfail=main.assertReturnString ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 1004 | main.intentFunction.report( main ) |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 1005 | |
| 1006 | def CASE6000( self, main ): |
| 1007 | """ |
| 1008 | Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure |
| 1009 | """ |
| 1010 | assert main, "There is no main" |
| 1011 | assert main.CLIs, "There is no main.CLIs" |
| 1012 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 1013 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 1014 | main.numSwitch" |
| 1015 | main.case( "Test Multi to Single End Point Failure" ) |
| 1016 | main.step( "NOOPTION: test end point failure for multi point to single point intents" ) |
| 1017 | main.assertReturnString = "Assertion results for IPV6 multi to single \ |
| 1018 | point intent end point failure with no options set\n" |
| 1019 | hostNames = [ 'h8', 'h17' ] |
| 1020 | devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ] |
| 1021 | testResult = main.TRUE |
| 1022 | testResult = main.intentFunction.testEndPointFail( |
| 1023 | main, |
| 1024 | name="NOOPTION", |
| 1025 | test="MultipletoSingle", |
| 1026 | hostNames=hostNames, |
| 1027 | devices=devices, |
| 1028 | sw1="s6", |
| 1029 | sw2="s2", |
| 1030 | sw3="s4", |
| 1031 | sw4="s1", |
| 1032 | sw5="s3", |
| 1033 | expectedLink1=16, |
| 1034 | expectedLink2=14 ) |
| 1035 | utilities.assert_equals( expect=main.TRUE, |
| 1036 | actual=testResult, |
| 1037 | onpass=main.assertReturnString, |
| 1038 | onfail=main.assertReturnString ) |
| 1039 | |
| 1040 | main.step( "IPV6: test end point failure for multi point to single point intents" ) |
| 1041 | main.assertReturnString = "Assertion results for IPV6 multi to single \ |
| 1042 | point intent end point failure with IPV6 type and MAC addresses\n" |
| 1043 | hostNames = [ 'h8', 'h9', 'h17' ] |
| 1044 | devices = [ 'of:0000000000000005/8', 'of:0000000000000006/1', 'of:0000000000000007/1' ] |
| 1045 | macs = [ '00:00:00:00:00:08','00:00:00:00:00:09' ,'00:00:00:00:00:11' ] |
| 1046 | testResult = main.TRUE |
| 1047 | testResult = main.intentFunction.testEndPointFail( |
| 1048 | main, |
| 1049 | test="MultipletoSingle", |
| 1050 | name="IPV6", |
| 1051 | hostNames=hostNames, |
| 1052 | devices=devices, |
| 1053 | macs=macs, |
| 1054 | ethType="IPV6", |
| 1055 | sw1="s6", |
| 1056 | sw2="s2", |
| 1057 | sw3="s4", |
| 1058 | sw4="s1", |
| 1059 | sw5="s3", |
| 1060 | expectedLink1=16, |
| 1061 | expectedLink2=14 ) |
| 1062 | utilities.assert_equals( expect=main.TRUE, |
| 1063 | actual=testResult, |
| 1064 | onpass=main.assertReturnString, |
| 1065 | onfail=main.assertReturnString ) |
| 1066 | |
| 1067 | main.step( "IPV6_2: test end point faliure for multi point to single point intents" ) |
| 1068 | main.assertReturnString = "Assertion results for IPV6 multi to single \ |
| 1069 | point intent end point failure with IPV6 type and no MAC addresses\n" |
| 1070 | hostNames = [ 'h8', 'h17' ] |
| 1071 | devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ] |
| 1072 | testResult = main.TRUE |
| 1073 | testResult = main.intentFunction.testEndPointFail( |
| 1074 | main, |
| 1075 | test="MultipletoSingle", |
| 1076 | name="IPV6_2", |
| 1077 | hostNames=hostNames, |
| 1078 | devices=devices, |
| 1079 | ethType="IPV6", |
| 1080 | sw1="s6", |
| 1081 | sw2="s2", |
| 1082 | sw3="s4", |
| 1083 | sw4="s1", |
| 1084 | sw5="s3", |
| 1085 | expectedLink1=16, |
| 1086 | expectedLink2=14 ) |
| 1087 | |
| 1088 | utilities.assert_equals( expect=main.TRUE, |
| 1089 | actual=testResult, |
| 1090 | onpass=main.assertReturnString, |
| 1091 | onfail=main.assertReturnString ) |
| 1092 | |
| 1093 | main.step( "VLAN: test end point failure for multi point to single point intents" ) |
| 1094 | main.assertReturnString = "Assertion results for IPV6 multi to single \ |
| 1095 | point intent end point failure with IPV6 type and no MAC addresses in the same VLAN\n" |
| 1096 | hostNames = [ 'h5', 'h24' ] |
| 1097 | devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ] |
| 1098 | macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ] |
| 1099 | testResult = main.TRUE |
| 1100 | testResult = main.intentFunction.testEndPointFail( |
| 1101 | main, |
| 1102 | test="MultipletoSingle", |
| 1103 | name="VLAN", |
| 1104 | hostNames=hostNames, |
| 1105 | devices=devices, |
| 1106 | ethType="IPV6", |
| 1107 | sw1="s6", |
| 1108 | sw2="s2", |
| 1109 | sw3="s4", |
| 1110 | sw4="s1", |
| 1111 | sw5="s3", |
| 1112 | expectedLink1=16, |
| 1113 | expectedLink2=14 ) |
| 1114 | utilities.assert_equals( expect=main.TRUE, |
| 1115 | actual=testResult, |
| 1116 | onpass=main.assertReturnString, |
| 1117 | onfail=main.assertReturnString ) |
| 1118 | |
| 1119 | main.case( "Test Single to Multiple End Point Failure" ) |
| 1120 | main.step( "NOOPTION: test end point failure for single point to multi point intents" ) |
| 1121 | main.assertReturnString = "Assertion results for IPV6 single to multi \ |
| 1122 | point intent end point failure with no options set\n" |
| 1123 | hostNames = [ 'h8', 'h17' ] |
| 1124 | devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ] |
| 1125 | testResult = main.TRUE |
| 1126 | testResult = main.intentFunction.testEndPointFail( |
| 1127 | main, |
| 1128 | test="SingletoMultiple", |
| 1129 | name="NOOPTION", |
| 1130 | hostNames=hostNames, |
| 1131 | devices=devices, |
| 1132 | sw1="s6", |
| 1133 | sw2="s2", |
| 1134 | sw3="s4", |
| 1135 | sw4="s1", |
| 1136 | sw5="s3", |
| 1137 | expectedLink1=16, |
| 1138 | expectedLink2=14 ) |
| 1139 | utilities.assert_equals( expect=main.TRUE, |
| 1140 | actual=testResult, |
| 1141 | onpass=main.assertReturnString, |
| 1142 | onfail=main.assertReturnString ) |
| 1143 | main.step( "IPV6: test end point failure for single point to multi point intents" ) |
| 1144 | main.assertReturnString = "Assertion results for IPV6 single to multi \ |
| 1145 | point intent end point failure with IPV6 type and MAC addresses\n" |
| 1146 | hostNames = [ 'h8', 'h9', 'h17' ] |
| 1147 | devices = [ 'of:0000000000000005/8', 'of:0000000000000006/1', 'of:0000000000000007/1' ] |
| 1148 | macs = [ '00:00:00:00:00:08','00:00:00:00:00:09' ,'00:00:00:00:00:11' ] |
| 1149 | testResult = main.TRUE |
| 1150 | testResult = main.intentFunction.testEndPointFail( |
| 1151 | main, |
| 1152 | test="SingletoMultiple", |
| 1153 | name="IPV6", |
| 1154 | hostNames=hostNames, |
| 1155 | devices=devices, |
| 1156 | ethType="IPV6", |
| 1157 | macs=macs, |
| 1158 | sw1="s6", |
| 1159 | sw2="s2", |
| 1160 | sw3="s4", |
| 1161 | sw4="s1", |
| 1162 | sw5="s3", |
| 1163 | expectedLink1=16, |
| 1164 | expectedLink2=14 ) |
| 1165 | utilities.assert_equals( expect=main.TRUE, |
| 1166 | actual=testResult, |
| 1167 | onpass=main.assertReturnString, |
| 1168 | onfail=main.assertReturnString ) |
| 1169 | |
| 1170 | main.step( "IPV6_2: test end point failure for single point to multi point intents" ) |
| 1171 | main.assertReturnString = "Assertion results for IPV6 single to multi\ |
| 1172 | point intent endpoint failure with IPV6 type and no MAC addresses\n" |
| 1173 | hostNames = [ 'h8', 'h17' ] |
| 1174 | devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ] |
| 1175 | testResult = main.TRUE |
| 1176 | testResult = main.intentFunction.testEndPointFail( |
| 1177 | main, |
| 1178 | test="SingletoMultiple", |
| 1179 | name="IPV6_2", |
| 1180 | hostNames=hostNames, |
| 1181 | devices=devices, |
| 1182 | ethType="IPV6", |
| 1183 | sw1="s6", |
| 1184 | sw2="s2", |
| 1185 | sw3="s4", |
| 1186 | sw4="s1", |
| 1187 | sw5="s3", |
| 1188 | expectedLink1=16, |
| 1189 | expectedLink2=14 ) |
| 1190 | utilities.assert_equals( expect=main.TRUE, |
| 1191 | actual=testResult, |
| 1192 | onpass=main.assertReturnString, |
| 1193 | onfail=main.assertReturnString ) |
| 1194 | |
| 1195 | main.step( "VLAN: test end point failure for single point to multi point intents" ) |
| 1196 | main.assertReturnString = "Assertion results for IPV6 single to multi point\ |
| 1197 | intent endpoint failure with IPV6 type and MAC addresses in the same VLAN\n" |
| 1198 | hostNames = [ 'h5', 'h24' ] |
| 1199 | devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ] |
| 1200 | macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ] |
| 1201 | testResult = main.TRUE |
| 1202 | testResult = main.intentFunction.testEndPointFail( |
| 1203 | main, |
| 1204 | test="SingletoMultiple", |
| 1205 | name="IPV6", |
| 1206 | hostNames=hostNames, |
| 1207 | devices=devices, |
| 1208 | macs=macs, |
| 1209 | ethType="IPV6", |
| 1210 | sw1="s6", |
| 1211 | sw2="s2", |
| 1212 | sw3="s4", |
| 1213 | sw4="s1", |
| 1214 | sw5="s3", |
| 1215 | expectedLink1=16, |
| 1216 | expectedLink2=14 ) |
| 1217 | utilities.assert_equals( expect=main.TRUE, |
| 1218 | actual=testResult, |
| 1219 | onpass=main.assertReturnString, |
| 1220 | onfail=main.assertReturnString ) |
| 1221 | |
| 1222 | main.intentFunction.report( main ) |