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 = [] |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 59 | main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' ) |
| 60 | main.scapyHosts = [] # List of scapy hosts for iterating |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 61 | main.assertReturnString = '' # Assembled assert return string |
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 | main.ONOSip = main.ONOSbench.getOnosIps() |
| 64 | print main.ONOSip |
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 | # Assigning ONOS cli handles to a list |
| 67 | for i in range( 1, main.maxNodes + 1 ): |
| 68 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 69 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 70 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 71 | main.startUp = imp.load_source( wrapperFile1, |
| 72 | main.dependencyPath + |
| 73 | wrapperFile1 + |
| 74 | ".py" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 75 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 76 | main.intentFunction = imp.load_source( wrapperFile2, |
| 77 | main.dependencyPath + |
| 78 | wrapperFile2 + |
| 79 | ".py" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 80 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 81 | main.topo = imp.load_source( wrapperFile3, |
| 82 | main.dependencyPath + |
| 83 | wrapperFile3 + |
| 84 | ".py" ) |
| 85 | |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 86 | copyResult1 = main.ONOSbench.scp( main.Mininet1, |
| 87 | main.dependencyPath + |
| 88 | main.topology, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 89 | main.Mininet1.home + "custom/", |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 90 | direction="to" ) |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 91 | if main.CLIs: |
| 92 | stepResult = main.TRUE |
| 93 | else: |
| 94 | main.log.error( "Did not properly created list of ONOS CLI handle" ) |
| 95 | stepResult = main.FALSE |
| 96 | except Exception as e: |
| 97 | main.log.exception(e) |
| 98 | main.cleanup() |
| 99 | main.exit() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 100 | |
| 101 | utilities.assert_equals( expect=main.TRUE, |
| 102 | actual=stepResult, |
| 103 | onpass="Successfully construct " + |
| 104 | "test variables ", |
| 105 | onfail="Failed to construct test variables" ) |
| 106 | |
| 107 | if gitPull == 'True': |
| 108 | main.step( "Building ONOS in " + gitBranch + " branch" ) |
| 109 | onosBuildResult = main.startUp.onosBuild( main, gitBranch ) |
| 110 | stepResult = onosBuildResult |
| 111 | utilities.assert_equals( expect=main.TRUE, |
| 112 | actual=stepResult, |
| 113 | onpass="Successfully compiled " + |
| 114 | "latest ONOS", |
| 115 | onfail="Failed to compile " + |
| 116 | "latest ONOS" ) |
| 117 | else: |
| 118 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 119 | "clean install" ) |
Jon Hall | 106be08 | 2015-07-22 09:53:00 -0700 | [diff] [blame] | 120 | main.ONOSbench.getVersion( report=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 121 | |
| 122 | def CASE2( self, main ): |
| 123 | """ |
| 124 | - Set up cell |
| 125 | - Create cell file |
| 126 | - Set cell file |
| 127 | - Verify cell file |
| 128 | - Kill ONOS process |
| 129 | - Uninstall ONOS cluster |
| 130 | - Verify ONOS start up |
| 131 | - Install ONOS cluster |
| 132 | - Connect to cli |
| 133 | """ |
| 134 | |
| 135 | # main.scale[ 0 ] determines the current number of ONOS controller |
| 136 | main.numCtrls = int( main.scale[ 0 ] ) |
| 137 | |
| 138 | main.case( "Starting up " + str( main.numCtrls ) + |
| 139 | " node(s) ONOS cluster" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 140 | main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 141 | " node(s) ONOS cluster" |
| 142 | |
| 143 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 144 | |
| 145 | #kill off all onos processes |
| 146 | main.log.info( "Safety check, killing all ONOS processes" + |
Jon Hall | 70b2ff4 | 2015-11-17 15:49:44 -0800 | [diff] [blame] | 147 | " before initiating environment setup" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 148 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 149 | time.sleep( main.startUpSleep ) |
| 150 | main.step( "Uninstalling ONOS package" ) |
| 151 | onosUninstallResult = main.TRUE |
| 152 | for ip in main.ONOSip: |
| 153 | onosUninstallResult = onosUninstallResult and \ |
| 154 | main.ONOSbench.onosUninstall( nodeIp=ip ) |
| 155 | stepResult = onosUninstallResult |
| 156 | utilities.assert_equals( expect=main.TRUE, |
| 157 | actual=stepResult, |
| 158 | onpass="Successfully uninstalled ONOS package", |
| 159 | onfail="Failed to uninstall ONOS package" ) |
| 160 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 161 | for i in range( main.maxNodes ): |
| 162 | main.ONOSbench.onosDie( main.ONOSip[ i ] ) |
| 163 | |
| 164 | print "NODE COUNT = ", main.numCtrls |
| 165 | |
| 166 | tempOnosIp = [] |
| 167 | for i in range( main.numCtrls ): |
| 168 | tempOnosIp.append( main.ONOSip[i] ) |
| 169 | |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 170 | main.ONOSbench.createCellFile( main.ONOSbench.ip_address, |
| 171 | "temp", main.Mininet1.ip_address, |
| 172 | main.apps, tempOnosIp ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 173 | |
| 174 | main.step( "Apply cell to environment" ) |
| 175 | cellResult = main.ONOSbench.setCell( "temp" ) |
| 176 | verifyResult = main.ONOSbench.verifyCell() |
| 177 | stepResult = cellResult and verifyResult |
| 178 | utilities.assert_equals( expect=main.TRUE, |
| 179 | actual=stepResult, |
| 180 | onpass="Successfully applied cell to " + \ |
| 181 | "environment", |
| 182 | onfail="Failed to apply cell to environment " ) |
| 183 | |
| 184 | main.step( "Creating ONOS package" ) |
| 185 | packageResult = main.ONOSbench.onosPackage() |
| 186 | stepResult = packageResult |
| 187 | utilities.assert_equals( expect=main.TRUE, |
| 188 | actual=stepResult, |
| 189 | onpass="Successfully created ONOS package", |
| 190 | onfail="Failed to create ONOS package" ) |
| 191 | |
| 192 | time.sleep( main.startUpSleep ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 193 | main.step( "Installing ONOS package" ) |
| 194 | onosInstallResult = main.TRUE |
| 195 | for i in range( main.numCtrls ): |
| 196 | onosInstallResult = onosInstallResult and \ |
| 197 | main.ONOSbench.onosInstall( node=main.ONOSip[ i ] ) |
| 198 | stepResult = onosInstallResult |
| 199 | utilities.assert_equals( expect=main.TRUE, |
| 200 | actual=stepResult, |
| 201 | onpass="Successfully installed ONOS package", |
| 202 | onfail="Failed to install ONOS package" ) |
| 203 | |
| 204 | time.sleep( main.startUpSleep ) |
| 205 | main.step( "Starting ONOS service" ) |
| 206 | stopResult = main.TRUE |
| 207 | startResult = main.TRUE |
| 208 | onosIsUp = main.TRUE |
| 209 | |
| 210 | for i in range( main.numCtrls ): |
| 211 | onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] ) |
| 212 | if onosIsUp == main.TRUE: |
| 213 | main.log.report( "ONOS instance is up and ready" ) |
| 214 | else: |
| 215 | main.log.report( "ONOS instance may not be up, stop and " + |
| 216 | "start ONOS again " ) |
acsmars | 2ec91d6 | 2015-09-16 11:15:48 -0700 | [diff] [blame] | 217 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 218 | for i in range( main.numCtrls ): |
| 219 | stopResult = stopResult and \ |
| 220 | main.ONOSbench.onosStop( main.ONOSip[ i ] ) |
| 221 | for i in range( main.numCtrls ): |
| 222 | startResult = startResult and \ |
| 223 | main.ONOSbench.onosStart( main.ONOSip[ i ] ) |
| 224 | stepResult = onosIsUp and stopResult and startResult |
| 225 | utilities.assert_equals( expect=main.TRUE, |
| 226 | actual=stepResult, |
| 227 | onpass="ONOS service is ready", |
| 228 | onfail="ONOS service did not start properly" ) |
| 229 | |
| 230 | main.step( "Start ONOS cli" ) |
| 231 | cliResult = main.TRUE |
| 232 | for i in range( main.numCtrls ): |
| 233 | cliResult = cliResult and \ |
| 234 | main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] ) |
| 235 | stepResult = cliResult |
| 236 | utilities.assert_equals( expect=main.TRUE, |
| 237 | actual=stepResult, |
| 238 | onpass="Successfully start ONOS cli", |
| 239 | onfail="Failed to start ONOS cli" ) |
| 240 | |
| 241 | # Remove the first element in main.scale list |
| 242 | main.scale.remove( main.scale[ 0 ] ) |
| 243 | |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 244 | main.intentFunction.report( main ) |
| 245 | |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 246 | def CASE8( self, main ): |
| 247 | """ |
acsmars | 59a4c55 | 2015-09-10 18:11:19 -0700 | [diff] [blame] | 248 | Compare ONOS Topology to Mininet Topology |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 249 | """ |
| 250 | import json |
| 251 | |
| 252 | main.case( "Compare ONOS Topology view to Mininet topology" ) |
| 253 | main.caseExplanation = "Compare topology elements between Mininet" +\ |
| 254 | " and ONOS" |
| 255 | |
acsmars | 59a4c55 | 2015-09-10 18:11:19 -0700 | [diff] [blame] | 256 | main.log.info( "Gathering topology information from Mininet" ) |
| 257 | devicesResults = main.FALSE # Overall Boolean for device correctness |
| 258 | linksResults = main.FALSE # Overall Boolean for link correctness |
| 259 | hostsResults = main.FALSE # Overall Boolean for host correctness |
| 260 | deviceFails = [] # Nodes where devices are incorrect |
| 261 | linkFails = [] # Nodes where links are incorrect |
| 262 | hostFails = [] # Nodes where hosts are incorrect |
| 263 | attempts = main.checkTopoAttempts # Remaining Attempts |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 264 | |
| 265 | mnSwitches = main.Mininet1.getSwitches() |
| 266 | mnLinks = main.Mininet1.getLinks() |
| 267 | mnHosts = main.Mininet1.getHosts() |
| 268 | |
Jon Hall | 70b2ff4 | 2015-11-17 15:49:44 -0800 | [diff] [blame] | 269 | main.step( "Comparing Mininet topology to ONOS topology" ) |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 270 | |
acsmars | 59a4c55 | 2015-09-10 18:11:19 -0700 | [diff] [blame] | 271 | while ( attempts >= 0 ) and\ |
| 272 | ( not devicesResults or not linksResults or not hostsResults ): |
| 273 | time.sleep( 2 ) |
| 274 | if not devicesResults: |
| 275 | devices = main.topo.getAllDevices( main ) |
| 276 | ports = main.topo.getAllPorts( main ) |
| 277 | devicesResults = main.TRUE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 278 | deviceFails = [] # Reset for each failed attempt |
acsmars | 59a4c55 | 2015-09-10 18:11:19 -0700 | [diff] [blame] | 279 | if not linksResults: |
| 280 | links = main.topo.getAllLinks( main ) |
| 281 | linksResults = main.TRUE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 282 | linkFails = [] # Reset for each failed attempt |
acsmars | 59a4c55 | 2015-09-10 18:11:19 -0700 | [diff] [blame] | 283 | if not hostsResults: |
| 284 | hosts = main.topo.getAllHosts( main ) |
| 285 | hostsResults = main.TRUE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 286 | hostFails = [] # Reset for each failed attempt |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 287 | |
acsmars | 59a4c55 | 2015-09-10 18:11:19 -0700 | [diff] [blame] | 288 | # Check for matching topology on each node |
| 289 | for controller in range( main.numCtrls ): |
| 290 | controllerStr = str( controller + 1 ) # ONOS node number |
| 291 | # Compare Devices |
| 292 | if devices[ controller ] and ports[ controller ] and\ |
| 293 | "Error" not in devices[ controller ] and\ |
| 294 | "Error" not in ports[ controller ]: |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 295 | |
acsmars | 2ec91d6 | 2015-09-16 11:15:48 -0700 | [diff] [blame] | 296 | try: |
| 297 | deviceData = json.loads( devices[ controller ] ) |
| 298 | portData = json.loads( ports[ controller ] ) |
| 299 | except (TypeError,ValueError): |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 300 | main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ), str( ports[ controller ] ) ) ) |
acsmars | 2ec91d6 | 2015-09-16 11:15:48 -0700 | [diff] [blame] | 301 | currentDevicesResult = main.FALSE |
| 302 | else: |
| 303 | currentDevicesResult = main.Mininet1.compareSwitches( |
| 304 | mnSwitches,deviceData,portData ) |
acsmars | 59a4c55 | 2015-09-10 18:11:19 -0700 | [diff] [blame] | 305 | else: |
| 306 | currentDevicesResult = main.FALSE |
| 307 | if not currentDevicesResult: |
| 308 | deviceFails.append( controllerStr ) |
| 309 | devicesResults = devicesResults and currentDevicesResult |
| 310 | # Compare Links |
| 311 | if links[ controller ] and "Error" not in links[ controller ]: |
acsmars | 2ec91d6 | 2015-09-16 11:15:48 -0700 | [diff] [blame] | 312 | try: |
| 313 | linkData = json.loads( links[ controller ] ) |
| 314 | except (TypeError,ValueError): |
| 315 | main.log.error("Could not load json:" + str( links[ controller ] ) ) |
| 316 | currentLinksResult = main.FALSE |
| 317 | else: |
| 318 | currentLinksResult = main.Mininet1.compareLinks( |
| 319 | mnSwitches, mnLinks,linkData ) |
acsmars | 59a4c55 | 2015-09-10 18:11:19 -0700 | [diff] [blame] | 320 | else: |
| 321 | currentLinksResult = main.FALSE |
| 322 | if not currentLinksResult: |
| 323 | linkFails.append( controllerStr ) |
| 324 | linksResults = linksResults and currentLinksResult |
| 325 | # Compare Hosts |
acsmars | 2ec91d6 | 2015-09-16 11:15:48 -0700 | [diff] [blame] | 326 | if hosts[ controller ] and "Error" not in hosts[ controller ]: |
| 327 | try: |
| 328 | hostData = json.loads( hosts[ controller ] ) |
| 329 | except (TypeError,ValueError): |
| 330 | main.log.error("Could not load json:" + str( hosts[ controller ] ) ) |
| 331 | currentHostsResult = main.FALSE |
| 332 | else: |
| 333 | currentHostsResult = main.Mininet1.compareHosts( |
| 334 | mnHosts,hostData ) |
acsmars | 59a4c55 | 2015-09-10 18:11:19 -0700 | [diff] [blame] | 335 | else: |
| 336 | currentHostsResult = main.FALSE |
| 337 | if not currentHostsResult: |
| 338 | hostFails.append( controllerStr ) |
| 339 | hostsResults = hostsResults and currentHostsResult |
| 340 | # Decrement Attempts Remaining |
| 341 | attempts -= 1 |
| 342 | |
| 343 | |
| 344 | utilities.assert_equals( expect=[], |
| 345 | actual=deviceFails, |
| 346 | onpass="ONOS correctly discovered all devices", |
| 347 | onfail="ONOS incorrectly discovered devices on nodes: " + |
| 348 | str( deviceFails ) ) |
| 349 | utilities.assert_equals( expect=[], |
| 350 | actual=linkFails, |
| 351 | onpass="ONOS correctly discovered all links", |
| 352 | onfail="ONOS incorrectly discovered links on nodes: " + |
| 353 | str( linkFails ) ) |
| 354 | utilities.assert_equals( expect=[], |
| 355 | actual=hostFails, |
| 356 | onpass="ONOS correctly discovered all hosts", |
| 357 | onfail="ONOS incorrectly discovered hosts on nodes: " + |
| 358 | str( hostFails ) ) |
Jon Hall | 46d4825 | 2015-08-03 11:41:16 -0700 | [diff] [blame] | 359 | topoResults = hostsResults and linksResults and devicesResults |
| 360 | utilities.assert_equals( expect=main.TRUE, |
| 361 | actual=topoResults, |
| 362 | onpass="ONOS correctly discovered the topology", |
| 363 | onfail="ONOS incorrectly discovered the topology" ) |
Jon Hall | a3e0243 | 2015-07-24 15:55:42 -0700 | [diff] [blame] | 364 | |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 365 | def CASE10( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 366 | """ |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 367 | Start Mininet topology with OF 1.0 switches |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 368 | """ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 369 | main.OFProtocol = "1.0" |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 370 | main.log.report( "Start Mininet topology with OF 1.0 switches" ) |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 371 | main.case( "Start Mininet topology with OF 1.0 switches" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 372 | main.caseExplanation = "Start mininet topology with OF 1.0 " +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 373 | "switches to test intents, exits out if " +\ |
| 374 | "topology did not start correctly" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 375 | |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 376 | main.step( "Starting Mininet topology with OF 1.0 switches" ) |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 377 | args = "--switch ovs,protocols=OpenFlow10" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 378 | topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath + |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 379 | main.topology, |
| 380 | args=args ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 381 | stepResult = topoResult |
| 382 | utilities.assert_equals( expect=main.TRUE, |
| 383 | actual=stepResult, |
| 384 | onpass="Successfully loaded topology", |
| 385 | onfail="Failed to load topology" ) |
| 386 | # Exit if topology did not load properly |
| 387 | if not topoResult: |
| 388 | main.cleanup() |
| 389 | main.exit() |
| 390 | |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 391 | def CASE11( self, main ): |
| 392 | """ |
kelvin-onlab | b0b0dcb | 2015-07-22 16:51:33 -0700 | [diff] [blame] | 393 | Start Mininet topology with OF 1.3 switches |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 394 | """ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 395 | main.OFProtocol = "1.3" |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 396 | main.log.report( "Start Mininet topology with OF 1.3 switches" ) |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 397 | main.case( "Start Mininet topology with OF 1.3 switches" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 398 | main.caseExplanation = "Start mininet topology with OF 1.3 " +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 399 | "switches to test intents, exits out if " +\ |
| 400 | "topology did not start correctly" |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 401 | |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 402 | main.step( "Starting Mininet topology with OF 1.3 switches" ) |
kelvin-onlab | b5cfab3 | 2015-07-22 16:38:22 -0700 | [diff] [blame] | 403 | args = "--switch ovs,protocols=OpenFlow13" |
| 404 | topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath + |
| 405 | main.topology, |
| 406 | args=args ) |
| 407 | stepResult = topoResult |
| 408 | utilities.assert_equals( expect=main.TRUE, |
| 409 | actual=stepResult, |
| 410 | onpass="Successfully loaded topology", |
| 411 | onfail="Failed to load topology" ) |
| 412 | # Exit if topology did not load properly |
| 413 | if not topoResult: |
| 414 | main.cleanup() |
| 415 | main.exit() |
| 416 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 417 | def CASE12( self, main ): |
| 418 | """ |
| 419 | Assign mastership to controllers |
| 420 | """ |
| 421 | import re |
| 422 | |
| 423 | main.case( "Assign switches to controllers" ) |
| 424 | main.step( "Assigning switches to controllers" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 425 | main.caseExplanation = "Assign OF " + main.OFProtocol +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 426 | " switches to ONOS nodes" |
| 427 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 428 | assignResult = main.TRUE |
| 429 | switchList = [] |
| 430 | |
| 431 | # Creates a list switch name, use getSwitch() function later... |
| 432 | for i in range( 1, ( main.numSwitch + 1 ) ): |
| 433 | switchList.append( 's' + str( i ) ) |
| 434 | |
| 435 | tempONOSip = [] |
| 436 | for i in range( main.numCtrls ): |
| 437 | tempONOSip.append( main.ONOSip[ i ] ) |
| 438 | |
| 439 | assignResult = main.Mininet1.assignSwController( sw=switchList, |
| 440 | ip=tempONOSip, |
Charles Chan | 029be65 | 2015-08-24 01:46:10 +0800 | [diff] [blame] | 441 | port='6653' ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 442 | if not assignResult: |
| 443 | main.cleanup() |
| 444 | main.exit() |
| 445 | |
| 446 | for i in range( 1, ( main.numSwitch + 1 ) ): |
| 447 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 448 | print( "Response is " + str( response ) ) |
| 449 | if re.search( "tcp:" + main.ONOSip[ 0 ], response ): |
| 450 | assignResult = assignResult and main.TRUE |
| 451 | else: |
| 452 | assignResult = main.FALSE |
| 453 | stepResult = assignResult |
| 454 | utilities.assert_equals( expect=main.TRUE, |
| 455 | actual=stepResult, |
| 456 | onpass="Successfully assigned switches" + |
| 457 | "to controller", |
| 458 | onfail="Failed to assign switches to " + |
| 459 | "controller" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 460 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 461 | def CASE13( self,main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 462 | """ |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 463 | Create Scapy components |
| 464 | """ |
| 465 | main.case( "Create scapy components" ) |
| 466 | main.step( "Create scapy components" ) |
| 467 | import json |
| 468 | scapyResult = main.TRUE |
| 469 | for hostName in main.scapyHostNames: |
| 470 | main.Scapy1.createHostComponent( hostName ) |
| 471 | main.scapyHosts.append( getattr( main, hostName ) ) |
| 472 | |
| 473 | main.step( "Start scapy components" ) |
| 474 | for host in main.scapyHosts: |
| 475 | host.startHostCli() |
| 476 | host.startScapy() |
| 477 | host.updateSelf() |
| 478 | main.log.debug( host.name ) |
| 479 | main.log.debug( host.hostIp ) |
| 480 | main.log.debug( host.hostMac ) |
| 481 | |
| 482 | |
| 483 | utilities.assert_equals( expect=main.TRUE, |
| 484 | actual=scapyResult, |
| 485 | onpass="Successfully created Scapy Components", |
| 486 | onfail="Failed to discover Scapy Components" ) |
| 487 | |
| 488 | def CASE14( self, main ): |
| 489 | """ |
| 490 | Discover all hosts with fwd and pingall and store its data in a dictionary |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 491 | """ |
| 492 | main.case( "Discover all hosts" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 493 | main.step( "Pingall hosts and confirm ONOS discovery" ) |
| 494 | utilities.retry( f=main.intentFunction.fwdPingall, retValue=main.FALSE, args=[ main ] ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 495 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 496 | utilities.retry( f=main.intentFunction.confirmHostDiscovery, retValue=main.FALSE, |
| 497 | args=[ main ], attempts=main.checkTopoAttempts, sleep=2 ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 498 | utilities.assert_equals( expect=main.TRUE, |
| 499 | actual=stepResult, |
| 500 | onpass="Successfully discovered hosts", |
| 501 | onfail="Failed to discover hosts" ) |
| 502 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 503 | main.step( "Populate hostsData" ) |
| 504 | stepResult = main.intentFunction.populateHostData( main ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 505 | utilities.assert_equals( expect=main.TRUE, |
| 506 | actual=stepResult, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 507 | onpass="Successfully populated hostsData", |
| 508 | onfail="Failed to populate hostsData" ) |
| 509 | |
| 510 | def CASE15( self, main ): |
| 511 | """ |
| 512 | Discover all hosts with scapy arp packets and store its data to a dictionary |
| 513 | """ |
| 514 | main.case( "Discover all hosts using scapy" ) |
| 515 | main.step( "Send packets from each host to the first host and confirm onos discovery" ) |
| 516 | |
| 517 | import collections |
| 518 | if len( main.scapyHosts ) < 1: |
| 519 | main.log.error( "No scapy hosts have been created" ) |
| 520 | main.skipCase() |
| 521 | |
| 522 | # Send ARP packets from each scapy host component |
| 523 | main.intentFunction.sendDiscoveryArp( main, main.scapyHosts ) |
| 524 | |
| 525 | stepResult = utilities.retry( f=main.intentFunction.confirmHostDiscovery, |
| 526 | retValue=main.FALSE, args=[ main ], |
| 527 | attempts=main.checkTopoAttempts, sleep=2 ) |
| 528 | |
| 529 | utilities.assert_equals( expect=main.TRUE, |
| 530 | actual=stepResult, |
| 531 | onpass="ONOS correctly discovered all hosts", |
| 532 | onfail="ONOS incorrectly discovered hosts" ) |
| 533 | |
| 534 | main.step( "Populate hostsData" ) |
| 535 | stepResult = main.intentFunction.populateHostData( main ) |
| 536 | utilities.assert_equals( expect=main.TRUE, |
| 537 | actual=stepResult, |
| 538 | onpass="Successfully populated hostsData", |
| 539 | onfail="Failed to populate hostsData" ) |
| 540 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 541 | def CASE16( self, main ): |
| 542 | """ |
| 543 | Stop mininet and remove scapy host |
| 544 | """ |
| 545 | main.log.report( "Stop Mininet and Scapy" ) |
| 546 | main.case( "Stop Mininet and Scapy" ) |
| 547 | main.caseExplanation = "Stopping the current mininet topology " +\ |
| 548 | "to start up fresh" |
| 549 | main.step( "Stopping and Removing Scapy Host Components" ) |
| 550 | scapyResult = main.TRUE |
| 551 | for host in main.scapyHosts: |
| 552 | scapyResult = scapyResult and host.stopScapy() |
| 553 | main.log.info( "Stopped Scapy Host: {0}".format( host.name ) ) |
| 554 | |
| 555 | for host in main.scapyHosts: |
| 556 | scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name ) |
| 557 | main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) ) |
| 558 | |
| 559 | main.scapyHosts = [] |
| 560 | main.scapyHostIPs = [] |
| 561 | |
| 562 | utilities.assert_equals( expect=main.TRUE, |
| 563 | actual=scapyResult, |
| 564 | onpass="Successfully stopped scapy and removed host components", |
| 565 | onfail="Failed to stop mininet and scapy" ) |
| 566 | |
| 567 | main.step( "Stopping Mininet Topology" ) |
| 568 | mininetResult = main.Mininet1.stopNet( ) |
| 569 | |
| 570 | utilities.assert_equals( expect=main.TRUE, |
| 571 | actual=mininetResult, |
| 572 | onpass="Successfully stopped mininet and scapy", |
| 573 | onfail="Failed to stop mininet and scapy" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 574 | # Exit if topology did not load properly |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 575 | if not ( mininetResult and scapyResult ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 576 | main.cleanup() |
| 577 | main.exit() |
| 578 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 579 | def CASE1000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 580 | """ |
| 581 | Add host intents between 2 host: |
| 582 | - Discover hosts |
| 583 | - Add host intents |
| 584 | - Check intents |
| 585 | - Verify flows |
| 586 | - Ping hosts |
| 587 | - Reroute |
| 588 | - Link down |
| 589 | - Verify flows |
| 590 | - Check topology |
| 591 | - Ping hosts |
| 592 | - Link up |
| 593 | - Verify flows |
| 594 | - Check topology |
| 595 | - Ping hosts |
| 596 | - Remove intents |
| 597 | """ |
| 598 | import time |
| 599 | import json |
| 600 | import re |
| 601 | |
| 602 | # Assert variables - These variable's name|format must be followed |
| 603 | # if you want to use the wrapper function |
| 604 | assert main, "There is no main" |
| 605 | assert main.CLIs, "There is no main.CLIs" |
| 606 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 607 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 608 | main.numSwitch" |
| 609 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 610 | # Save leader candidates |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 611 | intentLeadersOld = main.CLIs[ 0 ].leaderCandidates() |
| 612 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 613 | main.testName = "Host Intents" |
| 614 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
kelvin-onlab | 4cfa81c | 2015-07-24 11:36:23 -0700 | [diff] [blame] | 615 | " NODE(S) - OF " + main.OFProtocol ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 616 | main.caseExplanation = "This test case tests Host intents using " +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 617 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 618 | "Different type of hosts will be tested in " +\ |
| 619 | "each step such as IPV4, Dual stack, VLAN " +\ |
| 620 | "etc;\nThe test will use OF " + main.OFProtocol\ |
kelvin-onlab | 4cfa81c | 2015-07-24 11:36:23 -0700 | [diff] [blame] | 621 | + " OVS running in Mininet" |
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( "IPV4: Add host intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 624 | main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 625 | host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" } |
| 626 | host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" } |
| 627 | testResult = main.FALSE |
| 628 | installResult = main.intentFunction.installHostIntent( main, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 629 | name='IPV4', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 630 | onosNode='0', |
| 631 | host1=host1, |
| 632 | host2=host2) |
| 633 | if installResult: |
| 634 | testResult = main.intentFunction.testHostIntent( main, |
| 635 | name='IPV4', |
| 636 | intentId = installResult, |
| 637 | onosNode='0', |
| 638 | host1=host1, |
| 639 | host2=host2, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 640 | sw1='s5', |
| 641 | sw2='s2', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 642 | expectedLink = 18) |
| 643 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 644 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 645 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 646 | onpass=main.assertReturnString, |
| 647 | onfail=main.assertReturnString) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 648 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 649 | main.step( "DUALSTACK1: Add host intents between h3 and h11" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 650 | main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 651 | host1 = { "name":"h3","id":"00:00:00:00:00:03/-1" } |
| 652 | host2 = { "name":"h11","id":"00:00:00:00:00:0B/-1 "} |
| 653 | testResult = main.FALSE |
| 654 | installResult = main.intentFunction.installHostIntent( main, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 655 | name='DUALSTACK', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 656 | onosNode='0', |
| 657 | host1=host1, |
| 658 | host2=host2) |
| 659 | |
| 660 | if installResult: |
| 661 | testResult = main.intentFunction.testHostIntent( main, |
| 662 | name='DUALSTACK', |
| 663 | intentId = installResult, |
| 664 | onosNode='0', |
| 665 | host1=host1, |
| 666 | host2=host2, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 667 | sw1='s5', |
| 668 | sw2='s2', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 669 | expectedLink = 18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 670 | |
| 671 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 672 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 673 | onpass=main.assertReturnString, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 674 | onfail=main.assertReturnString) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 675 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 676 | main.step( "DUALSTACK2: Add host intents between h1 and h11" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 677 | main.assertReturnString = "Assertion Result for dualstack2 host intent\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 678 | host1 = { "name":"h1" } |
| 679 | host2 = { "name":"h11" } |
| 680 | testResult = main.FALSE |
| 681 | installResult = main.intentFunction.installHostIntent( main, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 682 | name='DUALSTACK2', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 683 | onosNode='0', |
| 684 | host1=host1, |
| 685 | host2=host2) |
| 686 | |
| 687 | if installResult: |
| 688 | testResult = main.intentFunction.testHostIntent( main, |
| 689 | name='DUALSTACK2', |
| 690 | intentId = installResult, |
| 691 | onosNode='0', |
| 692 | host1=host1, |
| 693 | host2=host2, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 694 | sw1='s5', |
| 695 | sw2='s2', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 696 | expectedLink = 18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 697 | |
| 698 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 699 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 700 | onpass=main.assertReturnString, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 701 | onfail=main.assertReturnString) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 702 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 703 | main.step( "1HOP: Add host intents between h1 and h3" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 704 | main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 705 | host1 = { "name":"h1" } |
| 706 | host2 = { "name":"h3" } |
| 707 | testResult = main.FALSE |
| 708 | installResult = main.intentFunction.installHostIntent( main, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 709 | name='1HOP', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 710 | onosNode='0', |
| 711 | host1=host1, |
| 712 | host2=host2) |
| 713 | |
| 714 | if installResult: |
| 715 | testResult = main.intentFunction.testHostIntent( main, |
| 716 | name='1HOP', |
| 717 | intentId = installResult, |
| 718 | onosNode='0', |
| 719 | host1=host1, |
| 720 | host2=host2, |
| 721 | sw1='s5', |
| 722 | sw2='s2', |
| 723 | expectedLink = 18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 724 | |
| 725 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 726 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 727 | onpass=main.assertReturnString, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 728 | onfail=main.assertReturnString) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 729 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 730 | main.step( "VLAN1: Add vlan host intents between h4 and h12" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 731 | main.assertReturnString = "Assertion Result vlan IPV4\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 732 | host1 = { "name":"h4","id":"00:00:00:00:00:04/100" } |
| 733 | host2 = { "name":"h12","id":"00:00:00:00:00:0C/100 "} |
| 734 | testResult = main.FALSE |
| 735 | installResult = main.intentFunction.installHostIntent( main, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 736 | name='VLAN1', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 737 | onosNode='0', |
| 738 | host1=host1, |
| 739 | host2=host2) |
| 740 | |
| 741 | if installResult: |
| 742 | testResult = main.intentFunction.testHostIntent( main, |
| 743 | name='VLAN1', |
| 744 | intentId = installResult, |
| 745 | onosNode='0', |
| 746 | host1=host1, |
| 747 | host2=host2, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 748 | sw1='s5', |
| 749 | sw2='s2', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 750 | expectedLink = 18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 751 | |
| 752 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 753 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 754 | onpass=main.assertReturnString, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 755 | onfail=main.assertReturnString) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 756 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 757 | main.step( "VLAN2: Add inter vlan host intents between h13 and h20" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 758 | main.assertReturnString = "Assertion Result different VLAN negative test\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 759 | host1 = { "name":"h13" } |
| 760 | host2 = { "name":"h20" } |
| 761 | testResult = main.FALSE |
| 762 | installResult = main.intentFunction.installHostIntent( main, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 763 | name='VLAN2', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 764 | onosNode='0', |
| 765 | host1=host1, |
| 766 | host2=host2) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 767 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 768 | if installResult: |
| 769 | testResult = main.intentFunction.testHostIntent( main, |
| 770 | name='VLAN2', |
| 771 | intentId = installResult, |
| 772 | onosNode='0', |
| 773 | host1=host1, |
| 774 | host2=host2, |
| 775 | sw1='s5', |
| 776 | sw2='s2', |
| 777 | expectedLink = 18) |
| 778 | |
| 779 | utilities.assert_equals( expect=main.TRUE, |
| 780 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 781 | onpass=main.assertReturnString, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 782 | onfail=main.assertReturnString) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 783 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 784 | main.step( "Confirm that ONOS leadership is unchanged") |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 785 | intentLeadersNew = main.CLIs[ 0 ].leaderCandidates() |
| 786 | main.intentFunction.checkLeaderChange( intentLeadersOld, |
| 787 | intentLeadersNew ) |
| 788 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 789 | utilities.assert_equals( expect=main.TRUE, |
| 790 | actual=testResult, |
| 791 | onpass="ONOS Leaders Unchanged", |
| 792 | onfail="ONOS Leader Mismatch") |
| 793 | |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 794 | main.intentFunction.report( main ) |
| 795 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 796 | def CASE2000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 797 | """ |
| 798 | Add point intents between 2 hosts: |
| 799 | - Get device ids | ports |
| 800 | - Add point intents |
| 801 | - Check intents |
| 802 | - Verify flows |
| 803 | - Ping hosts |
| 804 | - Reroute |
| 805 | - Link down |
| 806 | - Verify flows |
| 807 | - Check topology |
| 808 | - Ping hosts |
| 809 | - Link up |
| 810 | - Verify flows |
| 811 | - Check topology |
| 812 | - Ping hosts |
| 813 | - Remove intents |
| 814 | """ |
| 815 | import time |
| 816 | import json |
| 817 | import re |
| 818 | |
| 819 | # Assert variables - These variable's name|format must be followed |
| 820 | # if you want to use the wrapper function |
| 821 | assert main, "There is no main" |
| 822 | assert main.CLIs, "There is no main.CLIs" |
| 823 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 824 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 825 | main.numSwitch" |
| 826 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 827 | main.testName = "Point Intents" |
| 828 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
kelvin-onlab | 4cfa81c | 2015-07-24 11:36:23 -0700 | [diff] [blame] | 829 | " NODE(S) - OF " + main.OFProtocol ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 830 | main.caseExplanation = "This test case will test point to point" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 831 | " intents using " + str( main.numCtrls ) +\ |
| 832 | " node(s) cluster;\n" +\ |
| 833 | "Different type of hosts will be tested in " +\ |
| 834 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 835 | ";\nThe test will use OF " + main.OFProtocol +\ |
kelvin-onlab | 4cfa81c | 2015-07-24 11:36:23 -0700 | [diff] [blame] | 836 | " OVS running in Mininet" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 837 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 838 | # No option point intents |
| 839 | main.step( "NOOPTION: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 840 | main.assertReturnString = "Assertion Result for NOOPTION point intent\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 841 | senders = [ |
| 842 | { "name":"h1","device":"of:0000000000000005/1" } |
| 843 | ] |
| 844 | recipients = [ |
| 845 | { "name":"h9","device":"of:0000000000000006/1" } |
| 846 | ] |
| 847 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 848 | main, |
| 849 | name="NOOPTION", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 850 | senders=senders, |
| 851 | recipients=recipients ) |
| 852 | |
| 853 | if installResult: |
| 854 | testResult = main.intentFunction.testPointIntent( |
| 855 | main, |
| 856 | intentId=installResult, |
| 857 | name="NOOPTION", |
| 858 | senders=senders, |
| 859 | recipients=recipients, |
| 860 | sw1="s5", |
| 861 | sw2="s2", |
| 862 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 863 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 864 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 865 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 866 | onpass=main.assertReturnString, |
| 867 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 868 | |
| 869 | stepResult = main.TRUE |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 870 | main.step( "IPV4: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 871 | main.assertReturnString = "Assertion Result for IPV4 point intent\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 872 | senders = [ |
| 873 | { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" } |
| 874 | ] |
| 875 | recipients = [ |
| 876 | { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09" } |
| 877 | ] |
| 878 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 879 | main, |
| 880 | name="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 881 | senders=senders, |
| 882 | recipients=recipients, |
| 883 | ethType="IPV4" ) |
| 884 | |
| 885 | if installResult: |
| 886 | testResult = main.intentFunction.testPointIntent( |
| 887 | main, |
| 888 | intentId=installResult, |
| 889 | name="IPV4", |
| 890 | senders=senders, |
| 891 | recipients=recipients, |
| 892 | sw1="s5", |
| 893 | sw2="s2", |
| 894 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 895 | |
| 896 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 897 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 898 | onpass=main.assertReturnString, |
| 899 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 900 | main.step( "IPV4_2: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 901 | main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 902 | senders = [ |
| 903 | { "name":"h1","device":"of:0000000000000005/1" } |
| 904 | ] |
| 905 | recipients = [ |
| 906 | { "name":"h9","device":"of:0000000000000006/1" } |
| 907 | ] |
| 908 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 909 | main, |
| 910 | name="IPV4_2", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 911 | senders=senders, |
| 912 | recipients=recipients, |
| 913 | ethType="IPV4" ) |
| 914 | |
| 915 | if installResult: |
| 916 | testResult = main.intentFunction.testPointIntent( |
| 917 | main, |
| 918 | intentId=installResult, |
| 919 | name="IPV4_2", |
| 920 | senders=senders, |
| 921 | recipients=recipients, |
| 922 | sw1="s5", |
| 923 | sw2="s2", |
| 924 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 925 | |
| 926 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 927 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 928 | onpass=main.assertReturnString, |
| 929 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 930 | |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 931 | main.step( "SDNIP-ICMP: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 932 | main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 933 | senders = [ |
| 934 | { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01", |
| 935 | "ip":main.h1.hostIp } |
| 936 | ] |
| 937 | recipients = [ |
| 938 | { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09", |
| 939 | "ip":main.h9.hostIp } |
| 940 | ] |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 941 | ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ] |
kelvin-onlab | 79ce049 | 2015-07-27 16:14:39 -0700 | [diff] [blame] | 942 | # Uneccessary, not including this in the selectors |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 943 | tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 944 | tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ] |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 945 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 946 | installResult = main.intentFunction.installPointIntent( |
| 947 | main, |
| 948 | name="SDNIP-ICMP", |
| 949 | senders=senders, |
| 950 | recipients=recipients, |
| 951 | ethType="IPV4", |
| 952 | ipProto=ipProto, |
| 953 | tcpSrc=tcpSrc, |
| 954 | tcpDst=tcpDst ) |
| 955 | |
| 956 | if installResult: |
| 957 | testResult = main.intentFunction.testPointIntent( |
| 958 | main, |
| 959 | intentId=installResult, |
| 960 | name="SDNIP_ICMP", |
| 961 | senders=senders, |
| 962 | recipients=recipients, |
| 963 | sw1="s5", |
| 964 | sw2="s2", |
| 965 | expectedLink=18) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 966 | |
| 967 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 968 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 969 | onpass=main.assertReturnString, |
| 970 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 971 | |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 972 | main.step( "SDNIP-TCP: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 973 | main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n" |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 974 | mac1 = main.hostsData[ 'h1' ][ 'mac' ] |
| 975 | mac2 = main.hostsData[ 'h9' ][ 'mac' ] |
kelvin-onlab | 58dc39e | 2015-08-06 08:11:09 -0700 | [diff] [blame] | 976 | ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32" |
| 977 | ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32" |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 978 | ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ] |
| 979 | tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 980 | tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ] |
| 981 | |
kelvin-onlab | 58dc39e | 2015-08-06 08:11:09 -0700 | [diff] [blame] | 982 | stepResult = main.intentFunction.pointIntentTcp( |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 983 | main, |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 984 | name="SDNIP-TCP", |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 985 | host1="h1", |
| 986 | host2="h9", |
| 987 | deviceId1="of:0000000000000005/1", |
| 988 | deviceId2="of:0000000000000006/1", |
| 989 | mac1=mac1, |
| 990 | mac2=mac2, |
| 991 | ethType="IPV4", |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 992 | ipProto=ipProto, |
| 993 | ip1=ip1, |
| 994 | ip2=ip2, |
| 995 | tcp1=tcp1, |
| 996 | tcp2=tcp2 ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 997 | |
| 998 | utilities.assert_equals( expect=main.TRUE, |
| 999 | actual=stepResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1000 | onpass=main.assertReturnString, |
| 1001 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1002 | |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1003 | main.step( "DUALSTACK1: Add point intents between h3 and h11" ) |
| 1004 | main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1005 | senders = [ |
| 1006 | { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" } |
| 1007 | ] |
| 1008 | recipients = [ |
| 1009 | { "name":"h11","device":"of:0000000000000006/3","mac":"00:00:00:00:00:0B" } |
| 1010 | ] |
| 1011 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1012 | main, |
| 1013 | name="DUALSTACK1", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1014 | senders=senders, |
| 1015 | recipients=recipients, |
| 1016 | ethType="IPV4" ) |
| 1017 | |
| 1018 | if installResult: |
| 1019 | testResult = main.intentFunction.testPointIntent( |
| 1020 | main, |
| 1021 | intentId=installResult, |
| 1022 | name="DUALSTACK1", |
| 1023 | senders=senders, |
| 1024 | recipients=recipients, |
| 1025 | sw1="s5", |
| 1026 | sw2="s2", |
| 1027 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1028 | |
| 1029 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1030 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1031 | onpass=main.assertReturnString, |
| 1032 | onfail=main.assertReturnString ) |
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 point intents between h5 and h21" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1035 | main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1036 | senders = [ |
| 1037 | { "name":"h5","device":"of:0000000000000005/5","mac":"00:00:00:00:00:05" } |
| 1038 | ] |
| 1039 | recipients = [ |
| 1040 | { "name":"h21","device":"of:0000000000000007/5","mac":"00:00:00:00:00:15" } |
| 1041 | ] |
| 1042 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1043 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1044 | name="DUALSTACK1", |
| 1045 | senders=senders, |
| 1046 | recipients=recipients, |
| 1047 | ethType="IPV4" ) |
| 1048 | |
| 1049 | if installResult: |
| 1050 | testResult = main.intentFunction.testPointIntent( |
| 1051 | main, |
| 1052 | intentId=installResult, |
| 1053 | name="DUALSTACK1", |
| 1054 | senders=senders, |
| 1055 | recipients=recipients, |
| 1056 | sw1="s5", |
| 1057 | sw2="s2", |
| 1058 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1059 | |
| 1060 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1061 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1062 | onpass=main.assertReturnString, |
| 1063 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1064 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1065 | main.step( "1HOP: Add point intents between h1 and h3" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1066 | main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1067 | senders = [ |
| 1068 | { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" } |
| 1069 | ] |
| 1070 | recipients = [ |
| 1071 | { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" } |
| 1072 | ] |
| 1073 | installResult = main.intentFunction.installPointIntent( |
| 1074 | main, |
| 1075 | name="1HOP IPV4", |
| 1076 | senders=senders, |
| 1077 | recipients=recipients, |
| 1078 | ethType="IPV4" ) |
| 1079 | |
| 1080 | if installResult: |
| 1081 | testResult = main.intentFunction.testPointIntent( |
| 1082 | main, |
| 1083 | intentId=installResult, |
| 1084 | name="1HOP IPV4", |
| 1085 | senders=senders, |
| 1086 | recipients=recipients, |
| 1087 | sw1="s5", |
| 1088 | sw2="s2", |
| 1089 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1090 | |
| 1091 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1092 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1093 | onpass=main.assertReturnString, |
| 1094 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1095 | |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 1096 | main.intentFunction.report( main ) |
| 1097 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1098 | def CASE3000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1099 | """ |
| 1100 | Add single point to multi point intents |
| 1101 | - Get device ids |
| 1102 | - Add single point to multi point intents |
| 1103 | - Check intents |
| 1104 | - Verify flows |
| 1105 | - Ping hosts |
| 1106 | - Reroute |
| 1107 | - Link down |
| 1108 | - Verify flows |
| 1109 | - Check topology |
| 1110 | - Ping hosts |
| 1111 | - Link up |
| 1112 | - Verify flows |
| 1113 | - Check topology |
| 1114 | - Ping hosts |
| 1115 | - Remove intents |
| 1116 | """ |
| 1117 | assert main, "There is no main" |
| 1118 | assert main.CLIs, "There is no main.CLIs" |
| 1119 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 1120 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 1121 | main.numSwitch" |
| 1122 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 1123 | main.testName = "Single to Multi Point Intents" |
| 1124 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
| 1125 | " NODE(S) - OF " + main.OFProtocol ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 1126 | main.caseExplanation = "This test case will test single point to" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 1127 | " multi point intents using " +\ |
| 1128 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 1129 | "Different type of hosts will be tested in " +\ |
| 1130 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 1131 | ";\nThe test will use OF " + main.OFProtocol +\ |
kelvin-onlab | 4cfa81c | 2015-07-24 11:36:23 -0700 | [diff] [blame] | 1132 | " OVS running in Mininet" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1133 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1134 | main.step( "NOOPTION: Install and test single point to multi point intents" ) |
| 1135 | main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n" |
| 1136 | senders = [ |
| 1137 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1138 | ] |
| 1139 | recipients = [ |
| 1140 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1141 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1142 | ] |
| 1143 | badSenders=[ { "name":"h9" } ] # Senders that are not in the intent |
| 1144 | badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent |
| 1145 | testResult = main.FALSE |
| 1146 | installResult = main.intentFunction.installSingleToMultiIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1147 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1148 | name="NOOPTION", |
| 1149 | senders=senders, |
| 1150 | recipients=recipients, |
| 1151 | sw1="s5", |
| 1152 | sw2="s2") |
| 1153 | |
| 1154 | if installResult: |
| 1155 | testResult = main.intentFunction.testPointIntent( |
| 1156 | main, |
| 1157 | intentId=installResult, |
| 1158 | name="NOOPTION", |
| 1159 | senders=senders, |
| 1160 | recipients=recipients, |
| 1161 | badSenders=badSenders, |
| 1162 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1163 | sw1="s5", |
| 1164 | sw2="s2", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1165 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1166 | |
| 1167 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1168 | actual=testResult, |
| 1169 | onpass=main.assertReturnString, |
| 1170 | onfail=main.assertReturnString ) |
| 1171 | |
| 1172 | main.step( "IPV4: Install and test single point to multi point intents" ) |
| 1173 | main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n" |
| 1174 | senders = [ |
| 1175 | { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" } |
| 1176 | ] |
| 1177 | recipients = [ |
| 1178 | { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }, |
| 1179 | { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" } |
| 1180 | ] |
| 1181 | badSenders=[ { "name":"h9" } ] # Senders that are not in the intent |
| 1182 | badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent |
| 1183 | testResult = main.FALSE |
| 1184 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 1185 | main, |
| 1186 | name="IPV4", |
| 1187 | senders=senders, |
| 1188 | recipients=recipients, |
| 1189 | ethType="IPV4", |
| 1190 | sw1="s5", |
| 1191 | sw2="s2") |
| 1192 | |
| 1193 | if installResult: |
| 1194 | testResult = main.intentFunction.testPointIntent( |
| 1195 | main, |
| 1196 | intentId=installResult, |
| 1197 | name="IPV4", |
| 1198 | senders=senders, |
| 1199 | recipients=recipients, |
| 1200 | badSenders=badSenders, |
| 1201 | badRecipients=badRecipients, |
| 1202 | sw1="s5", |
| 1203 | sw2="s2", |
| 1204 | expectedLink=18) |
| 1205 | |
| 1206 | utilities.assert_equals( expect=main.TRUE, |
| 1207 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1208 | onpass=main.assertReturnString, |
| 1209 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1210 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1211 | main.step( "IPV4_2: Add single point to multi point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1212 | main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and no MAC addresses\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1213 | senders = [ |
| 1214 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1215 | ] |
| 1216 | recipients = [ |
| 1217 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1218 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1219 | ] |
| 1220 | badSenders=[ { "name":"h9" } ] # Senders that are not in the intent |
| 1221 | badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent |
| 1222 | testResult = main.FALSE |
| 1223 | installResult = main.intentFunction.installSingleToMultiIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1224 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1225 | name="IPV4_2", |
| 1226 | senders=senders, |
| 1227 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1228 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1229 | sw1="s5", |
| 1230 | sw2="s2") |
| 1231 | |
| 1232 | if installResult: |
| 1233 | testResult = main.intentFunction.testPointIntent( |
| 1234 | main, |
| 1235 | intentId=installResult, |
| 1236 | name="IPV4_2", |
| 1237 | senders=senders, |
| 1238 | recipients=recipients, |
| 1239 | badSenders=badSenders, |
| 1240 | badRecipients=badRecipients, |
| 1241 | sw1="s5", |
| 1242 | sw2="s2", |
| 1243 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1244 | |
| 1245 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1246 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1247 | onpass=main.assertReturnString, |
| 1248 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1249 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1250 | main.step( "VLAN: Add single point to multi point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1251 | main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses in the same VLAN\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1252 | senders = [ |
| 1253 | { "name":"h4", "device":"of:0000000000000005/4", "mac":"00:00:00:00:00:04" } |
| 1254 | ] |
| 1255 | recipients = [ |
| 1256 | { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C" }, |
| 1257 | { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14" } |
| 1258 | ] |
| 1259 | badSenders=[ { "name":"h13" } ] # Senders that are not in the intent |
| 1260 | badRecipients=[ { "name":"h21" } ] # Recipients that are not in the intent |
| 1261 | testResult = main.FALSE |
| 1262 | installResult = main.intentFunction.installSingleToMultiIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1263 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1264 | name="IPV4", |
| 1265 | senders=senders, |
| 1266 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1267 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1268 | sw1="s5", |
| 1269 | sw2="s2") |
| 1270 | |
| 1271 | if installResult: |
| 1272 | testResult = main.intentFunction.testPointIntent( |
| 1273 | main, |
| 1274 | intentId=installResult, |
| 1275 | name="IPV4", |
| 1276 | senders=senders, |
| 1277 | recipients=recipients, |
| 1278 | badSenders=badSenders, |
| 1279 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1280 | sw1="s5", |
| 1281 | sw2="s2", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1282 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1283 | |
| 1284 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1285 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1286 | onpass=main.assertReturnString, |
| 1287 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1288 | |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 1289 | main.intentFunction.report( main ) |
| 1290 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1291 | def CASE4000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1292 | """ |
| 1293 | Add multi point to single point intents |
| 1294 | - Get device ids |
| 1295 | - Add multi point to single point intents |
| 1296 | - Check intents |
| 1297 | - Verify flows |
| 1298 | - Ping hosts |
| 1299 | - Reroute |
| 1300 | - Link down |
| 1301 | - Verify flows |
| 1302 | - Check topology |
| 1303 | - Ping hosts |
| 1304 | - Link up |
| 1305 | - Verify flows |
| 1306 | - Check topology |
| 1307 | - Ping hosts |
| 1308 | - Remove intents |
| 1309 | """ |
| 1310 | assert main, "There is no main" |
| 1311 | assert main.CLIs, "There is no main.CLIs" |
| 1312 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 1313 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 1314 | main.numSwitch" |
| 1315 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 1316 | main.testName = "Multi To Single Point Intents" |
| 1317 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
| 1318 | " NODE(S) - OF " + main.OFProtocol ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 1319 | main.caseExplanation = "This test case will test single point to" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 1320 | " multi point intents using " +\ |
| 1321 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 1322 | "Different type of hosts will be tested in " +\ |
| 1323 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 1324 | ";\nThe test will use OF " + main.OFProtocol +\ |
kelvin-onlab | 4cfa81c | 2015-07-24 11:36:23 -0700 | [diff] [blame] | 1325 | " OVS running in Mininet" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1326 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1327 | main.step( "NOOPTION: Add multi point to single point intents" ) |
| 1328 | main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n" |
| 1329 | senders = [ |
| 1330 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1331 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1332 | ] |
| 1333 | recipients = [ |
| 1334 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1335 | ] |
| 1336 | badSenders=[ { "name":"h17" } ] # Senders that are not in the intent |
| 1337 | badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent |
| 1338 | testResult = main.FALSE |
| 1339 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 1340 | main, |
| 1341 | name="NOOPTION", |
| 1342 | senders=senders, |
| 1343 | recipients=recipients, |
| 1344 | sw1="s5", |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1345 | sw2="s2" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1346 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1347 | if installResult: |
| 1348 | testResult = main.intentFunction.testPointIntent( |
| 1349 | main, |
| 1350 | intentId=installResult, |
| 1351 | name="NOOPTION", |
| 1352 | senders=senders, |
| 1353 | recipients=recipients, |
| 1354 | badSenders=badSenders, |
| 1355 | badRecipients=badRecipients, |
| 1356 | sw1="s5", |
| 1357 | sw2="s2", |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1358 | expectedLink=18 ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1359 | |
| 1360 | utilities.assert_equals( expect=main.TRUE, |
| 1361 | actual=testResult, |
| 1362 | onpass=main.assertReturnString, |
| 1363 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1364 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1365 | main.step( "IPV4: Add multi point to single point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1366 | main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and MAC addresses\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1367 | senders = [ |
| 1368 | { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }, |
| 1369 | { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" } |
| 1370 | ] |
| 1371 | recipients = [ |
| 1372 | { "name":"h8", "device":"of:0000000000000005/8", "mac":"00:00:00:00:00:08" } |
| 1373 | ] |
| 1374 | badSenders=[ { "name":"h17" } ] # Senders that are not in the intent |
| 1375 | badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent |
| 1376 | testResult = main.FALSE |
| 1377 | installResult = main.intentFunction.installMultiToSingleIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1378 | main, |
| 1379 | name="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1380 | senders=senders, |
| 1381 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1382 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1383 | sw1="s5", |
| 1384 | sw2="s2") |
| 1385 | |
| 1386 | if installResult: |
| 1387 | testResult = main.intentFunction.testPointIntent( |
| 1388 | main, |
| 1389 | intentId=installResult, |
| 1390 | name="IPV4", |
| 1391 | senders=senders, |
| 1392 | recipients=recipients, |
| 1393 | badSenders=badSenders, |
| 1394 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1395 | sw1="s5", |
| 1396 | sw2="s2", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1397 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1398 | |
| 1399 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1400 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1401 | onpass=main.assertReturnString, |
| 1402 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1403 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1404 | main.step( "IPV4_2: Add multi point to single point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1405 | main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and no MAC addresses\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1406 | senders = [ |
| 1407 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1408 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1409 | ] |
| 1410 | recipients = [ |
| 1411 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1412 | ] |
| 1413 | badSenders=[ { "name":"h17" } ] # Senders that are not in the intent |
| 1414 | badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent |
| 1415 | testResult = main.FALSE |
| 1416 | installResult = main.intentFunction.installMultiToSingleIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1417 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1418 | name="IPV4_2", |
| 1419 | senders=senders, |
| 1420 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1421 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1422 | sw1="s5", |
| 1423 | sw2="s2") |
| 1424 | |
| 1425 | if installResult: |
| 1426 | testResult = main.intentFunction.testPointIntent( |
| 1427 | main, |
| 1428 | intentId=installResult, |
| 1429 | name="IPV4_2", |
| 1430 | senders=senders, |
| 1431 | recipients=recipients, |
| 1432 | badSenders=badSenders, |
| 1433 | badRecipients=badRecipients, |
| 1434 | sw1="s5", |
| 1435 | sw2="s2", |
| 1436 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1437 | |
| 1438 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1439 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1440 | onpass=main.assertReturnString, |
| 1441 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1442 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1443 | main.step( "VLAN: Add multi point to single point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1444 | main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and no MAC addresses in the same VLAN\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1445 | senders = [ |
| 1446 | { "name":"h13", "device":"of:0000000000000006/5" }, |
| 1447 | { "name":"h21", "device":"of:0000000000000007/5" } |
| 1448 | ] |
| 1449 | recipients = [ |
| 1450 | { "name":"h5", "device":"of:0000000000000005/5" } |
| 1451 | ] |
| 1452 | badSenders=[ { "name":"h12" } ] # Senders that are not in the intent |
| 1453 | badRecipients=[ { "name":"h20" } ] # Recipients that are not in the intent |
| 1454 | testResult = main.FALSE |
| 1455 | installResult = main.intentFunction.installMultiToSingleIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1456 | main, |
| 1457 | name="VLAN", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1458 | senders=senders, |
| 1459 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1460 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1461 | sw1="s5", |
| 1462 | sw2="s2") |
| 1463 | |
| 1464 | if installResult: |
| 1465 | testResult = main.intentFunction.testPointIntent( |
| 1466 | main, |
| 1467 | intentId=installResult, |
| 1468 | name="VLAN", |
| 1469 | senders=senders, |
| 1470 | recipients=recipients, |
| 1471 | badSenders=badSenders, |
| 1472 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1473 | sw1="s5", |
| 1474 | sw2="s2", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1475 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1476 | |
| 1477 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1478 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1479 | onpass=main.assertReturnString, |
| 1480 | onfail=main.assertReturnString ) |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1481 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1482 | main.intentFunction.report( main ) |
| 1483 | |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1484 | def CASE5000( self, main ): |
| 1485 | """ |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1486 | Tests Host Mobility |
| 1487 | Modifies the topology location of h1 |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1488 | """ |
| 1489 | assert main, "There is no main" |
| 1490 | assert main.CLIs, "There is no main.CLIs" |
| 1491 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 1492 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 1493 | main.numSwitch" |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1494 | main.case( "Test host mobility with host intents " ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1495 | main.step( "Testing host mobility by moving h1 from s5 to s6" ) |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1496 | h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ] |
| 1497 | |
Jeremy | 2f190ca | 2016-01-29 15:23:57 -0800 | [diff] [blame] | 1498 | main.log.info( "Moving h1 from s5 to s6") |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1499 | main.Mininet1.moveHost( "h1","s5","s6" ) |
| 1500 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1501 | # Send discovery ping from moved host |
| 1502 | # Moving the host brings down the default interfaces and creates a new one. |
| 1503 | # Scapy is restarted on this host to detect the new interface |
| 1504 | main.h1.stopScapy() |
| 1505 | main.h1.startScapy() |
| 1506 | |
| 1507 | # Discover new host location in ONOS and populate host data. |
| 1508 | # Host 1 IP and MAC should be unchanged |
| 1509 | main.intentFunction.sendDiscoveryArp( main, [ main.h1 ] ) |
| 1510 | main.intentFunction.populateHostData( main ) |
| 1511 | |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1512 | h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ] |
| 1513 | |
| 1514 | utilities.assert_equals( expect="of:0000000000000006", |
| 1515 | actual=h1PostMove, |
| 1516 | onpass="Mobility: Successfully moved h1 to s6", |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1517 | onfail="Mobility: Failed to move h1 to s6" + |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1518 | " to single point intents" + |
| 1519 | " with IPV4 type and MAC addresses" + |
| 1520 | " in the same VLAN" ) |
| 1521 | |
| 1522 | main.step( "IPV4: Add host intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1523 | main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1524 | host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" } |
| 1525 | host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" } |
| 1526 | |
| 1527 | installResult = main.intentFunction.installHostIntent( main, |
| 1528 | name='IPV4 Mobility IPV4', |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1529 | onosNode='0', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1530 | host1=host1, |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1531 | host2=host2 ) |
Jeremy | 2f190ca | 2016-01-29 15:23:57 -0800 | [diff] [blame] | 1532 | if installResult: |
| 1533 | testResult = main.intentFunction.testHostIntent( main, |
| 1534 | name='Host Mobility IPV4', |
| 1535 | intentId = installResult, |
| 1536 | onosNode='0', |
| 1537 | host1=host1, |
| 1538 | host2=host2, |
| 1539 | sw1="s6", |
| 1540 | sw2="s2", |
| 1541 | expectedLink=18 ) |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1542 | |
| 1543 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1544 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1545 | onpass=main.assertReturnString, |
| 1546 | onfail=main.assertReturnString ) |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 1547 | |
| 1548 | main.intentFunction.report( main ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1549 | |
| 1550 | def CASE6000( self, main ): |
| 1551 | """ |
| 1552 | Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure |
| 1553 | """ |
| 1554 | assert main, "There is no main" |
| 1555 | assert main.CLIs, "There is no main.CLIs" |
| 1556 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 1557 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 1558 | main.numSwitch" |
| 1559 | main.case( "Test Multi to Single End Point Failure" ) |
| 1560 | main.step( "Installing Multi to Single Point intents" ) |
| 1561 | |
| 1562 | main.assertReturnString = "Assertion results for IPV4 multi to single \ |
| 1563 | point intent end point failure with no options set\n" |
| 1564 | senders = [ |
| 1565 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1566 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1567 | ] |
| 1568 | recipients = [ |
| 1569 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1570 | ] |
| 1571 | isolatedSenders = [ |
| 1572 | { "name":"h24"} |
| 1573 | ] |
| 1574 | isolatedRecipients = [] |
| 1575 | testResult = main.FALSE |
| 1576 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 1577 | main, |
| 1578 | name="NOOPTION", |
| 1579 | senders=senders, |
| 1580 | recipients=recipients, |
| 1581 | sw1="s5", |
| 1582 | sw2="s2" ) |
| 1583 | |
| 1584 | if installResult: |
| 1585 | testResult = main.intentFunction.testEndPointFail( |
| 1586 | main, |
| 1587 | intentId=installResult, |
| 1588 | name="NOOPTION", |
| 1589 | senders=senders, |
| 1590 | recipients=recipients, |
| 1591 | isolatedSenders=isolatedSenders, |
| 1592 | isolatedRecipients=isolatedRecipients, |
| 1593 | sw1="s6", |
| 1594 | sw2="s2", |
| 1595 | sw3="s4", |
| 1596 | sw4="s1", |
| 1597 | sw5="s3", |
| 1598 | expectedLink1=16, |
| 1599 | expectedLink2=14 ) |
| 1600 | |
| 1601 | utilities.assert_equals( expect=main.TRUE, |
| 1602 | actual=testResult, |
| 1603 | onpass=main.assertReturnString, |
| 1604 | onfail=main.assertReturnString ) |
| 1605 | |
| 1606 | main.step( "IPV4: Add multi point to single point intents" ) |
| 1607 | main.assertReturnString = "Assertion results for IPV4 multi to single \ |
| 1608 | point intent end point failure with IPV4 type and MAC addresses\n" |
| 1609 | senders = [ |
| 1610 | { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }, |
| 1611 | { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" } |
| 1612 | ] |
| 1613 | recipients = [ |
| 1614 | { "name":"h8", "device":"of:0000000000000005/8", "mac":"00:00:00:00:00:08" } |
| 1615 | ] |
| 1616 | isolatedSenders = [ |
| 1617 | { "name":"h24"} |
| 1618 | ] |
| 1619 | isolatedRecipients = [] |
| 1620 | testResult = main.FALSE |
| 1621 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 1622 | main, |
| 1623 | name="IPV4", |
| 1624 | senders=senders, |
| 1625 | recipients=recipients, |
| 1626 | ethType="IPV4", |
| 1627 | sw1="s5", |
| 1628 | sw2="s2") |
| 1629 | |
| 1630 | if installResult: |
| 1631 | testResult = main.intentFunction.testEndPointFail( |
| 1632 | main, |
| 1633 | intentId=installResult, |
| 1634 | name="IPV4", |
| 1635 | senders=senders, |
| 1636 | recipients=recipients, |
| 1637 | isolatedSenders=isolatedSenders, |
| 1638 | isolatedRecipients=isolatedRecipients, |
| 1639 | sw1="s6", |
| 1640 | sw2="s2", |
| 1641 | sw3="s4", |
| 1642 | sw4="s1", |
| 1643 | sw5="s3", |
| 1644 | expectedLink1=16, |
| 1645 | expectedLink2=14 ) |
| 1646 | utilities.assert_equals( expect=main.TRUE, |
| 1647 | actual=testResult, |
| 1648 | onpass=main.assertReturnString, |
| 1649 | onfail=main.assertReturnString ) |
| 1650 | |
| 1651 | main.step( "IPV4_2: Add multi point to single point intents" ) |
| 1652 | main.assertReturnString = "Assertion results for IPV4 multi to single \ |
| 1653 | point intent end point failure with IPV4 type and no MAC addresses\n" |
| 1654 | senders = [ |
| 1655 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1656 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1657 | ] |
| 1658 | recipients = [ |
| 1659 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1660 | ] |
| 1661 | isolatedSenders = [ |
| 1662 | { "name":"h24"} |
| 1663 | ] |
| 1664 | isolatedRecipients = [] |
| 1665 | testResult = main.FALSE |
| 1666 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 1667 | main, |
| 1668 | name="IPV4_2", |
| 1669 | senders=senders, |
| 1670 | recipients=recipients, |
| 1671 | ethType="IPV4", |
| 1672 | sw1="s5", |
| 1673 | sw2="s2") |
| 1674 | |
| 1675 | if installResult: |
| 1676 | testResult = main.intentFunction.testEndPointFail( |
| 1677 | main, |
| 1678 | intentId=installResult, |
| 1679 | name="IPV4_2", |
| 1680 | senders=senders, |
| 1681 | recipients=recipients, |
| 1682 | isolatedSenders=isolatedSenders, |
| 1683 | isolatedRecipients=isolatedRecipients, |
| 1684 | sw1="s6", |
| 1685 | sw2="s2", |
| 1686 | sw3="s4", |
| 1687 | sw4="s1", |
| 1688 | sw5="s3", |
| 1689 | expectedLink1=16, |
| 1690 | expectedLink2=14 ) |
| 1691 | |
| 1692 | utilities.assert_equals( expect=main.TRUE, |
| 1693 | actual=testResult, |
| 1694 | onpass=main.assertReturnString, |
| 1695 | onfail=main.assertReturnString ) |
| 1696 | |
| 1697 | main.step( "VLAN: Add multi point to single point intents" ) |
| 1698 | main.assertReturnString = "Assertion results for IPV4 multi to single \ |
| 1699 | point intent end point failure with IPV4 type and no MAC addresses in the same VLAN\n" |
| 1700 | senders = [ |
| 1701 | { "name":"h13", "device":"of:0000000000000006/5" }, |
| 1702 | { "name":"h21", "device":"of:0000000000000007/5" } |
| 1703 | ] |
| 1704 | recipients = [ |
| 1705 | { "name":"h5", "device":"of:0000000000000005/5" } |
| 1706 | ] |
| 1707 | isolatedSenders = [ |
| 1708 | { "name":"h21"} |
| 1709 | ] |
| 1710 | isolatedRecipients = [] |
| 1711 | testResult = main.FALSE |
| 1712 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 1713 | main, |
| 1714 | name="VLAN", |
| 1715 | senders=senders, |
| 1716 | recipients=recipients, |
| 1717 | ethType="IPV4", |
| 1718 | sw1="s5", |
| 1719 | sw2="s2") |
| 1720 | |
| 1721 | if installResult: |
| 1722 | testResult = main.intentFunction.testEndPointFail( |
| 1723 | main, |
| 1724 | intentId=installResult, |
| 1725 | name="VLAN", |
| 1726 | senders=senders, |
| 1727 | recipients=recipients, |
| 1728 | isolatedSenders=isolatedSenders, |
| 1729 | isolatedRecipients=isolatedRecipients, |
| 1730 | sw1="s6", |
| 1731 | sw2="s2", |
| 1732 | sw3="s4", |
| 1733 | sw4="s1", |
| 1734 | sw5="s3", |
| 1735 | expectedLink1=16, |
| 1736 | expectedLink2=14 ) |
| 1737 | |
| 1738 | utilities.assert_equals( expect=main.TRUE, |
| 1739 | actual=testResult, |
| 1740 | onpass=main.assertReturnString, |
| 1741 | onfail=main.assertReturnString ) |
| 1742 | |
| 1743 | main.step( "NOOPTION: Install and test single point to multi point intents" ) |
| 1744 | main.assertReturnString = "Assertion results for IPV4 single to multi \ |
| 1745 | point intent end point failure with no options set\n" |
| 1746 | senders = [ |
| 1747 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1748 | ] |
| 1749 | recipients = [ |
| 1750 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1751 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1752 | ] |
| 1753 | isolatedSenders = [] |
| 1754 | isolatedRecipients = [ |
| 1755 | { "name":"h24" } |
| 1756 | ] |
| 1757 | testResult = main.FALSE |
| 1758 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 1759 | main, |
| 1760 | name="NOOPTION", |
| 1761 | senders=senders, |
| 1762 | recipients=recipients, |
| 1763 | sw1="s5", |
| 1764 | sw2="s2") |
| 1765 | |
| 1766 | if installResult: |
| 1767 | testResult = main.intentFunction.testEndPointFail( |
| 1768 | main, |
| 1769 | intentId=installResult, |
| 1770 | name="NOOPTION", |
| 1771 | senders=senders, |
| 1772 | recipients=recipients, |
| 1773 | isolatedSenders=isolatedSenders, |
| 1774 | isolatedRecipients=isolatedRecipients, |
| 1775 | sw1="s6", |
| 1776 | sw2="s2", |
| 1777 | sw3="s4", |
| 1778 | sw4="s1", |
| 1779 | sw5="s3", |
| 1780 | expectedLink1=16, |
| 1781 | expectedLink2=14 ) |
| 1782 | |
| 1783 | utilities.assert_equals( expect=main.TRUE, |
| 1784 | actual=testResult, |
| 1785 | onpass=main.assertReturnString, |
| 1786 | onfail=main.assertReturnString ) |
| 1787 | |
| 1788 | main.step( "IPV4: Install and test single point to multi point intents" ) |
| 1789 | main.assertReturnString = "Assertion results for IPV4 single to multi \ |
| 1790 | point intent end point failure with IPV4 type and no MAC addresses\n" |
| 1791 | senders = [ |
| 1792 | { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" } |
| 1793 | ] |
| 1794 | recipients = [ |
| 1795 | { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }, |
| 1796 | { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" } |
| 1797 | ] |
| 1798 | isolatedSenders = [] |
| 1799 | isolatedRecipients = [ |
| 1800 | { "name":"h24" } |
| 1801 | ] |
| 1802 | testResult = main.FALSE |
| 1803 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 1804 | main, |
| 1805 | name="IPV4", |
| 1806 | senders=senders, |
| 1807 | recipients=recipients, |
| 1808 | ethType="IPV4", |
| 1809 | sw1="s5", |
| 1810 | sw2="s2") |
| 1811 | |
| 1812 | if installResult: |
| 1813 | testResult = main.intentFunction.testEndPointFail( |
| 1814 | main, |
| 1815 | intentId=installResult, |
| 1816 | name="IPV4", |
| 1817 | senders=senders, |
| 1818 | recipients=recipients, |
| 1819 | isolatedSenders=isolatedSenders, |
| 1820 | isolatedRecipients=isolatedRecipients, |
| 1821 | sw1="s6", |
| 1822 | sw2="s2", |
| 1823 | sw3="s4", |
| 1824 | sw4="s1", |
| 1825 | sw5="s3", |
| 1826 | expectedLink1=16, |
| 1827 | expectedLink2=14 ) |
| 1828 | |
| 1829 | utilities.assert_equals( expect=main.TRUE, |
| 1830 | actual=testResult, |
| 1831 | onpass=main.assertReturnString, |
| 1832 | onfail=main.assertReturnString ) |
| 1833 | |
| 1834 | main.step( "IPV4_2: Add single point to multi point intents" ) |
| 1835 | main.assertReturnString = "Assertion results for IPV4 single to multi\ |
| 1836 | point intent endpoint failure with IPV4 type and no MAC addresses\n" |
| 1837 | senders = [ |
| 1838 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1839 | ] |
| 1840 | recipients = [ |
| 1841 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1842 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1843 | ] |
| 1844 | isolatedSenders = [] |
| 1845 | isolatedRecipients = [ |
| 1846 | { "name":"h24" } |
| 1847 | ] |
| 1848 | testResult = main.FALSE |
| 1849 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 1850 | main, |
| 1851 | name="IPV4_2", |
| 1852 | senders=senders, |
| 1853 | recipients=recipients, |
| 1854 | ethType="IPV4", |
| 1855 | sw1="s5", |
| 1856 | sw2="s2") |
| 1857 | |
| 1858 | if installResult: |
| 1859 | testResult = main.intentFunction.testEndPointFail( |
| 1860 | main, |
| 1861 | intentId=installResult, |
| 1862 | name="IPV4_2", |
| 1863 | senders=senders, |
| 1864 | recipients=recipients, |
| 1865 | isolatedSenders=isolatedSenders, |
| 1866 | isolatedRecipients=isolatedRecipients, |
| 1867 | sw1="s6", |
| 1868 | sw2="s2", |
| 1869 | sw3="s4", |
| 1870 | sw4="s1", |
| 1871 | sw5="s3", |
| 1872 | expectedLink1=16, |
| 1873 | expectedLink2=14 ) |
| 1874 | |
| 1875 | utilities.assert_equals( expect=main.TRUE, |
| 1876 | actual=testResult, |
| 1877 | onpass=main.assertReturnString, |
| 1878 | onfail=main.assertReturnString ) |
| 1879 | |
| 1880 | main.step( "VLAN: Add single point to multi point intents" ) |
| 1881 | main.assertReturnString = "Assertion results for IPV4 single to multi point\ |
| 1882 | intent endpoint failure with IPV4 type and MAC addresses in the same VLAN\n" |
| 1883 | senders = [ |
| 1884 | { "name":"h4", "device":"of:0000000000000005/4", "mac":"00:00:00:00:00:04" } |
| 1885 | ] |
| 1886 | recipients = [ |
| 1887 | { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C" }, |
| 1888 | { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14" } |
| 1889 | ] |
| 1890 | isolatedSenders = [] |
| 1891 | isolatedRecipients = [ |
| 1892 | { "name":"h20" } |
| 1893 | ] |
| 1894 | testResult = main.FALSE |
| 1895 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 1896 | main, |
| 1897 | name="IPV4", |
| 1898 | senders=senders, |
| 1899 | recipients=recipients, |
| 1900 | ethType="IPV4", |
| 1901 | sw1="s5", |
| 1902 | sw2="s2") |
| 1903 | |
| 1904 | if installResult: |
| 1905 | testResult = main.intentFunction.testEndPointFail( |
| 1906 | main, |
| 1907 | intentId=installResult, |
| 1908 | name="IPV4", |
| 1909 | senders=senders, |
| 1910 | recipients=recipients, |
| 1911 | isolatedSenders=isolatedSenders, |
| 1912 | isolatedRecipients=isolatedRecipients, |
| 1913 | sw1="s6", |
| 1914 | sw2="s2", |
| 1915 | sw3="s4", |
| 1916 | sw4="s1", |
| 1917 | sw5="s3", |
| 1918 | expectedLink1=16, |
| 1919 | expectedLink2=14 ) |
| 1920 | |
| 1921 | utilities.assert_equals( expect=main.TRUE, |
| 1922 | actual=testResult, |
| 1923 | onpass=main.assertReturnString, |
| 1924 | onfail=main.assertReturnString ) |
| 1925 | |
Jeremy | 2f190ca | 2016-01-29 15:23:57 -0800 | [diff] [blame] | 1926 | main.intentFunction.report( main ) |