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