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