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