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