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