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