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