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 ] ) |
Jeremy | cd87222 | 2016-03-29 10:08:34 -0700 | [diff] [blame] | 137 | main.flowCompiler = "Flow Rules" |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 138 | |
| 139 | main.case( "Starting up " + str( main.numCtrls ) + |
| 140 | " node(s) ONOS cluster" ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 141 | main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 142 | " node(s) ONOS cluster" |
| 143 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 144 | #kill off all onos processes |
| 145 | main.log.info( "Safety check, killing all ONOS processes" + |
Jon Hall | 70b2ff4 | 2015-11-17 15:49:44 -0800 | [diff] [blame] | 146 | " before initiating environment setup" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 147 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 148 | time.sleep( main.startUpSleep ) |
| 149 | main.step( "Uninstalling ONOS package" ) |
| 150 | onosUninstallResult = main.TRUE |
| 151 | for ip in main.ONOSip: |
| 152 | onosUninstallResult = onosUninstallResult and \ |
| 153 | main.ONOSbench.onosUninstall( nodeIp=ip ) |
| 154 | stepResult = onosUninstallResult |
| 155 | utilities.assert_equals( expect=main.TRUE, |
| 156 | actual=stepResult, |
| 157 | onpass="Successfully uninstalled ONOS package", |
| 158 | onfail="Failed to uninstall ONOS package" ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 159 | time.sleep( main.startUpSleep ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 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 | """ |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 543 | Balance Masters |
| 544 | """ |
| 545 | main.case( "Balance mastership of switches" ) |
| 546 | main.step( "Balancing mastership of switches" ) |
| 547 | |
| 548 | balanceResult = main.FALSE |
| 549 | balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] ) |
| 550 | |
| 551 | utilities.assert_equals( expect=main.TRUE, |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 552 | actual=balanceResult, |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 553 | onpass="Successfully balanced mastership of switches", |
| 554 | onfail="Failed to balance mastership of switches" ) |
| 555 | |
| 556 | def CASE17( self, main ): |
| 557 | """ |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 558 | Use Flow Objectives |
| 559 | """ |
| 560 | main.case( "Enable intent compilation using Flow Objectives" ) |
| 561 | main.step( "Enabling Flow Objectives" ) |
| 562 | |
| 563 | main.flowCompiler = "Flow Objectives" |
| 564 | |
| 565 | cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator" |
| 566 | |
| 567 | stepResult = main.CLIs[ 0 ].setCfg( component=cmd, |
| 568 | propName="useFlowObjectives", value="true" ) |
| 569 | |
| 570 | utilities.assert_equals( expect=main.TRUE, |
| 571 | actual=stepResult, |
| 572 | onpass="Successfully activated Flow Objectives", |
| 573 | onfail="Failed to activate Flow Objectives" ) |
| 574 | |
| 575 | def CASE18( self, main ): |
| 576 | """ |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 577 | Stop mininet and remove scapy host |
| 578 | """ |
| 579 | main.log.report( "Stop Mininet and Scapy" ) |
| 580 | main.case( "Stop Mininet and Scapy" ) |
| 581 | main.caseExplanation = "Stopping the current mininet topology " +\ |
| 582 | "to start up fresh" |
| 583 | main.step( "Stopping and Removing Scapy Host Components" ) |
| 584 | scapyResult = main.TRUE |
| 585 | for host in main.scapyHosts: |
| 586 | scapyResult = scapyResult and host.stopScapy() |
| 587 | main.log.info( "Stopped Scapy Host: {0}".format( host.name ) ) |
| 588 | |
| 589 | for host in main.scapyHosts: |
| 590 | scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name ) |
| 591 | main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) ) |
| 592 | |
| 593 | main.scapyHosts = [] |
| 594 | main.scapyHostIPs = [] |
| 595 | |
| 596 | utilities.assert_equals( expect=main.TRUE, |
| 597 | actual=scapyResult, |
| 598 | onpass="Successfully stopped scapy and removed host components", |
| 599 | onfail="Failed to stop mininet and scapy" ) |
| 600 | |
| 601 | main.step( "Stopping Mininet Topology" ) |
| 602 | mininetResult = main.Mininet1.stopNet( ) |
| 603 | |
| 604 | utilities.assert_equals( expect=main.TRUE, |
| 605 | actual=mininetResult, |
| 606 | onpass="Successfully stopped mininet and scapy", |
| 607 | onfail="Failed to stop mininet and scapy" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 608 | # Exit if topology did not load properly |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 609 | if not ( mininetResult and scapyResult ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 610 | main.cleanup() |
| 611 | main.exit() |
| 612 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 613 | def CASE1000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 614 | """ |
| 615 | Add host intents between 2 host: |
| 616 | - Discover hosts |
| 617 | - Add host intents |
| 618 | - Check intents |
| 619 | - Verify flows |
| 620 | - Ping hosts |
| 621 | - Reroute |
| 622 | - Link down |
| 623 | - Verify flows |
| 624 | - Check topology |
| 625 | - Ping hosts |
| 626 | - Link up |
| 627 | - Verify flows |
| 628 | - Check topology |
| 629 | - Ping hosts |
| 630 | - Remove intents |
| 631 | """ |
| 632 | import time |
| 633 | import json |
| 634 | import re |
| 635 | |
| 636 | # Assert variables - These variable's name|format must be followed |
| 637 | # if you want to use the wrapper function |
| 638 | assert main, "There is no main" |
| 639 | assert main.CLIs, "There is no main.CLIs" |
| 640 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 641 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 642 | main.numSwitch" |
| 643 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 644 | # Save leader candidates |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 645 | intentLeadersOld = main.CLIs[ 0 ].leaderCandidates() |
| 646 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 647 | main.testName = "Host Intents" |
| 648 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 649 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 650 | main.caseExplanation = "This test case tests Host intents using " +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 651 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 652 | "Different type of hosts will be tested in " +\ |
| 653 | "each step such as IPV4, Dual stack, VLAN " +\ |
Jeremy | eb51cb1 | 2016-03-28 17:53:35 -0700 | [diff] [blame] | 654 | "etc;\nThe test will use OF " + main.OFProtocol +\ |
| 655 | " OVS running in Mininet and compile intents" +\ |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 656 | " using " + main.flowCompiler |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 657 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 658 | main.step( "IPV4: Add host intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 659 | main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 660 | host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" } |
| 661 | host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" } |
| 662 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 663 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 664 | installResult = main.intentFunction.installHostIntent( main, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 665 | name='IPV4', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 666 | onosNode='0', |
| 667 | host1=host1, |
| 668 | host2=host2) |
| 669 | if installResult: |
| 670 | testResult = main.intentFunction.testHostIntent( main, |
| 671 | name='IPV4', |
| 672 | intentId = installResult, |
| 673 | onosNode='0', |
| 674 | host1=host1, |
| 675 | host2=host2, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 676 | sw1='s5', |
| 677 | sw2='s2', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 678 | expectedLink = 18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 679 | else: |
| 680 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 681 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 682 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 683 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 684 | onpass=main.assertReturnString, |
| 685 | onfail=main.assertReturnString) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 686 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 687 | main.step( "DUALSTACK1: Add host intents between h3 and h11" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 688 | main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 689 | host1 = { "name":"h3","id":"00:00:00:00:00:03/-1" } |
| 690 | host2 = { "name":"h11","id":"00:00:00:00:00:0B/-1 "} |
| 691 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 692 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 693 | installResult = main.intentFunction.installHostIntent( main, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 694 | name='DUALSTACK', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 695 | onosNode='0', |
| 696 | host1=host1, |
| 697 | host2=host2) |
| 698 | |
| 699 | if installResult: |
| 700 | testResult = main.intentFunction.testHostIntent( main, |
| 701 | name='DUALSTACK', |
| 702 | intentId = installResult, |
| 703 | onosNode='0', |
| 704 | host1=host1, |
| 705 | host2=host2, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 706 | sw1='s5', |
| 707 | sw2='s2', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 708 | expectedLink = 18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 709 | |
| 710 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 711 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 712 | onpass=main.assertReturnString, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 713 | onfail=main.assertReturnString) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 714 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 715 | main.step( "DUALSTACK2: Add host intents between h1 and h11" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 716 | main.assertReturnString = "Assertion Result for dualstack2 host intent\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 717 | host1 = { "name":"h1" } |
| 718 | host2 = { "name":"h11" } |
| 719 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 720 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 721 | installResult = main.intentFunction.installHostIntent( main, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 722 | name='DUALSTACK2', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 723 | onosNode='0', |
| 724 | host1=host1, |
| 725 | host2=host2) |
| 726 | |
| 727 | if installResult: |
| 728 | testResult = main.intentFunction.testHostIntent( main, |
| 729 | name='DUALSTACK2', |
| 730 | intentId = installResult, |
| 731 | onosNode='0', |
| 732 | host1=host1, |
| 733 | host2=host2, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 734 | sw1='s5', |
| 735 | sw2='s2', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 736 | expectedLink = 18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 737 | else: |
| 738 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 739 | |
| 740 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 741 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 742 | onpass=main.assertReturnString, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 743 | onfail=main.assertReturnString) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 744 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 745 | main.step( "1HOP: Add host intents between h1 and h3" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 746 | main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 747 | host1 = { "name":"h1" } |
| 748 | host2 = { "name":"h3" } |
| 749 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 750 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 751 | installResult = main.intentFunction.installHostIntent( main, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 752 | name='1HOP', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 753 | onosNode='0', |
| 754 | host1=host1, |
| 755 | host2=host2) |
| 756 | |
| 757 | if installResult: |
| 758 | testResult = main.intentFunction.testHostIntent( main, |
| 759 | name='1HOP', |
| 760 | intentId = installResult, |
| 761 | onosNode='0', |
| 762 | host1=host1, |
| 763 | host2=host2, |
| 764 | sw1='s5', |
| 765 | sw2='s2', |
| 766 | expectedLink = 18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 767 | else: |
| 768 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 769 | |
| 770 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 771 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 772 | onpass=main.assertReturnString, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 773 | onfail=main.assertReturnString) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 774 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 775 | main.step( "VLAN1: Add vlan host intents between h4 and h12" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 776 | main.assertReturnString = "Assertion Result vlan IPV4\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 777 | host1 = { "name":"h4","id":"00:00:00:00:00:04/100" } |
| 778 | host2 = { "name":"h12","id":"00:00:00:00:00:0C/100 "} |
| 779 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 780 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 781 | installResult = main.intentFunction.installHostIntent( main, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 782 | name='VLAN1', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 783 | onosNode='0', |
| 784 | host1=host1, |
| 785 | host2=host2) |
| 786 | |
| 787 | if installResult: |
| 788 | testResult = main.intentFunction.testHostIntent( main, |
| 789 | name='VLAN1', |
| 790 | intentId = installResult, |
| 791 | onosNode='0', |
| 792 | host1=host1, |
| 793 | host2=host2, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 794 | sw1='s5', |
| 795 | sw2='s2', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 796 | expectedLink = 18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 797 | else: |
| 798 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 799 | |
| 800 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 801 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 802 | onpass=main.assertReturnString, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 803 | onfail=main.assertReturnString) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 804 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 805 | main.step( "VLAN2: Add inter vlan host intents between h13 and h20" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 806 | main.assertReturnString = "Assertion Result different VLAN negative test\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 807 | host1 = { "name":"h13" } |
| 808 | host2 = { "name":"h20" } |
| 809 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 810 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 811 | installResult = main.intentFunction.installHostIntent( main, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 812 | name='VLAN2', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 813 | onosNode='0', |
| 814 | host1=host1, |
| 815 | host2=host2) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 816 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 817 | if installResult: |
| 818 | testResult = main.intentFunction.testHostIntent( main, |
| 819 | name='VLAN2', |
| 820 | intentId = installResult, |
| 821 | onosNode='0', |
| 822 | host1=host1, |
| 823 | host2=host2, |
| 824 | sw1='s5', |
| 825 | sw2='s2', |
| 826 | expectedLink = 18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 827 | else: |
| 828 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 829 | |
| 830 | utilities.assert_equals( expect=main.TRUE, |
| 831 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 832 | onpass=main.assertReturnString, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 833 | onfail=main.assertReturnString) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 834 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 835 | main.step( "Confirm that ONOS leadership is unchanged") |
acsmars | e6b410f | 2015-07-17 14:39:34 -0700 | [diff] [blame] | 836 | intentLeadersNew = main.CLIs[ 0 ].leaderCandidates() |
| 837 | main.intentFunction.checkLeaderChange( intentLeadersOld, |
| 838 | intentLeadersNew ) |
| 839 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 840 | utilities.assert_equals( expect=main.TRUE, |
| 841 | actual=testResult, |
| 842 | onpass="ONOS Leaders Unchanged", |
| 843 | onfail="ONOS Leader Mismatch") |
| 844 | |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 845 | main.intentFunction.report( main ) |
| 846 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 847 | def CASE2000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 848 | """ |
| 849 | Add point intents between 2 hosts: |
| 850 | - Get device ids | ports |
| 851 | - Add point intents |
| 852 | - Check intents |
| 853 | - Verify flows |
| 854 | - Ping hosts |
| 855 | - Reroute |
| 856 | - Link down |
| 857 | - Verify flows |
| 858 | - Check topology |
| 859 | - Ping hosts |
| 860 | - Link up |
| 861 | - Verify flows |
| 862 | - Check topology |
| 863 | - Ping hosts |
| 864 | - Remove intents |
| 865 | """ |
| 866 | import time |
| 867 | import json |
| 868 | import re |
| 869 | |
| 870 | # Assert variables - These variable's name|format must be followed |
| 871 | # if you want to use the wrapper function |
| 872 | assert main, "There is no main" |
| 873 | assert main.CLIs, "There is no main.CLIs" |
| 874 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 875 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 876 | main.numSwitch" |
| 877 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 878 | main.testName = "Point Intents" |
| 879 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 880 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 881 | main.caseExplanation = "This test case will test point to point" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 882 | " intents using " + str( main.numCtrls ) +\ |
| 883 | " node(s) cluster;\n" +\ |
| 884 | "Different type of hosts will be tested in " +\ |
| 885 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 886 | ";\nThe test will use OF " + main.OFProtocol +\ |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 887 | " OVS running in Mininet and compile intents" +\ |
| 888 | " using " + main.flowCompiler |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 889 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 890 | # No option point intents |
| 891 | main.step( "NOOPTION: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 892 | main.assertReturnString = "Assertion Result for NOOPTION point intent\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 893 | senders = [ |
| 894 | { "name":"h1","device":"of:0000000000000005/1" } |
| 895 | ] |
| 896 | recipients = [ |
| 897 | { "name":"h9","device":"of:0000000000000006/1" } |
| 898 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 899 | testResult = main.FALSE |
| 900 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 901 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 902 | main, |
| 903 | name="NOOPTION", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 904 | senders=senders, |
| 905 | recipients=recipients ) |
| 906 | |
| 907 | if installResult: |
| 908 | testResult = main.intentFunction.testPointIntent( |
| 909 | main, |
| 910 | intentId=installResult, |
| 911 | name="NOOPTION", |
| 912 | senders=senders, |
| 913 | recipients=recipients, |
| 914 | sw1="s5", |
| 915 | sw2="s2", |
| 916 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 917 | else: |
| 918 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 919 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 920 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 921 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 922 | onpass=main.assertReturnString, |
| 923 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 924 | |
| 925 | stepResult = main.TRUE |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 926 | main.step( "IPV4: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 927 | main.assertReturnString = "Assertion Result for IPV4 point intent\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 928 | senders = [ |
| 929 | { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" } |
| 930 | ] |
| 931 | recipients = [ |
| 932 | { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09" } |
| 933 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 934 | testResult = main.FALSE |
| 935 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 936 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 937 | main, |
| 938 | name="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 939 | senders=senders, |
| 940 | recipients=recipients, |
| 941 | ethType="IPV4" ) |
| 942 | |
| 943 | if installResult: |
| 944 | testResult = main.intentFunction.testPointIntent( |
| 945 | main, |
| 946 | intentId=installResult, |
| 947 | name="IPV4", |
| 948 | senders=senders, |
| 949 | recipients=recipients, |
| 950 | sw1="s5", |
| 951 | sw2="s2", |
| 952 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 953 | else: |
| 954 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 955 | |
| 956 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 957 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 958 | onpass=main.assertReturnString, |
| 959 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 960 | main.step( "IPV4_2: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 961 | main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 962 | senders = [ |
| 963 | { "name":"h1","device":"of:0000000000000005/1" } |
| 964 | ] |
| 965 | recipients = [ |
| 966 | { "name":"h9","device":"of:0000000000000006/1" } |
| 967 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 968 | testResult = main.FALSE |
| 969 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 970 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 971 | main, |
| 972 | name="IPV4_2", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 973 | senders=senders, |
| 974 | recipients=recipients, |
| 975 | ethType="IPV4" ) |
| 976 | |
| 977 | if installResult: |
| 978 | testResult = main.intentFunction.testPointIntent( |
| 979 | main, |
| 980 | intentId=installResult, |
| 981 | name="IPV4_2", |
| 982 | senders=senders, |
| 983 | recipients=recipients, |
| 984 | sw1="s5", |
| 985 | sw2="s2", |
| 986 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 987 | else: |
| 988 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 989 | |
| 990 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 991 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 992 | onpass=main.assertReturnString, |
| 993 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 994 | |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 995 | main.step( "SDNIP-ICMP: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 996 | 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] | 997 | senders = [ |
| 998 | { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01", |
Jeremy | 6f000c6 | 2016-02-25 17:02:28 -0800 | [diff] [blame] | 999 | "ip":( main.h1.hostIp + "/24" ) } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1000 | ] |
| 1001 | recipients = [ |
| 1002 | { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09", |
Jeremy | 6f000c6 | 2016-02-25 17:02:28 -0800 | [diff] [blame] | 1003 | "ip":( main.h9.hostIp + "/24" ) } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1004 | ] |
Jeremy | 6f000c6 | 2016-02-25 17:02:28 -0800 | [diff] [blame] | 1005 | ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ] |
kelvin-onlab | 79ce049 | 2015-07-27 16:14:39 -0700 | [diff] [blame] | 1006 | # Uneccessary, not including this in the selectors |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1007 | tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 1008 | tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1009 | testResult = main.FALSE |
| 1010 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1011 | installResult = main.intentFunction.installPointIntent( |
| 1012 | main, |
| 1013 | name="SDNIP-ICMP", |
| 1014 | senders=senders, |
| 1015 | recipients=recipients, |
| 1016 | ethType="IPV4", |
| 1017 | ipProto=ipProto, |
| 1018 | tcpSrc=tcpSrc, |
| 1019 | tcpDst=tcpDst ) |
| 1020 | |
| 1021 | if installResult: |
| 1022 | testResult = main.intentFunction.testPointIntent( |
| 1023 | main, |
| 1024 | intentId=installResult, |
| 1025 | name="SDNIP_ICMP", |
| 1026 | senders=senders, |
| 1027 | recipients=recipients, |
| 1028 | sw1="s5", |
| 1029 | sw2="s2", |
| 1030 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1031 | else: |
| 1032 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1033 | |
| 1034 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1035 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1036 | onpass=main.assertReturnString, |
| 1037 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1038 | |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 1039 | main.step( "SDNIP-TCP: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1040 | 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] | 1041 | mac1 = main.hostsData[ 'h1' ][ 'mac' ] |
| 1042 | mac2 = main.hostsData[ 'h9' ][ 'mac' ] |
kelvin-onlab | 58dc39e | 2015-08-06 08:11:09 -0700 | [diff] [blame] | 1043 | ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32" |
| 1044 | ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32" |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1045 | ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ] |
| 1046 | tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 1047 | tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ] |
| 1048 | |
kelvin-onlab | 58dc39e | 2015-08-06 08:11:09 -0700 | [diff] [blame] | 1049 | stepResult = main.intentFunction.pointIntentTcp( |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1050 | main, |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 1051 | name="SDNIP-TCP", |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1052 | host1="h1", |
| 1053 | host2="h9", |
| 1054 | deviceId1="of:0000000000000005/1", |
| 1055 | deviceId2="of:0000000000000006/1", |
| 1056 | mac1=mac1, |
| 1057 | mac2=mac2, |
| 1058 | ethType="IPV4", |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 1059 | ipProto=ipProto, |
| 1060 | ip1=ip1, |
| 1061 | ip2=ip2, |
| 1062 | tcp1=tcp1, |
| 1063 | tcp2=tcp2 ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1064 | |
| 1065 | utilities.assert_equals( expect=main.TRUE, |
Jeremy | 6f000c6 | 2016-02-25 17:02:28 -0800 | [diff] [blame] | 1066 | actual=stepResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1067 | onpass=main.assertReturnString, |
| 1068 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1069 | |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1070 | main.step( "DUALSTACK1: Add point intents between h3 and h11" ) |
| 1071 | 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] | 1072 | senders = [ |
| 1073 | { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" } |
| 1074 | ] |
| 1075 | recipients = [ |
| 1076 | { "name":"h11","device":"of:0000000000000006/3","mac":"00:00:00:00:00:0B" } |
| 1077 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1078 | testResult = main.FALSE |
| 1079 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1080 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1081 | main, |
| 1082 | name="DUALSTACK1", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1083 | senders=senders, |
| 1084 | recipients=recipients, |
| 1085 | ethType="IPV4" ) |
| 1086 | |
| 1087 | if installResult: |
| 1088 | testResult = main.intentFunction.testPointIntent( |
| 1089 | main, |
| 1090 | intentId=installResult, |
| 1091 | name="DUALSTACK1", |
| 1092 | senders=senders, |
| 1093 | recipients=recipients, |
| 1094 | sw1="s5", |
| 1095 | sw2="s2", |
| 1096 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1097 | else: |
| 1098 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1099 | |
| 1100 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1101 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1102 | onpass=main.assertReturnString, |
| 1103 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1104 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1105 | main.step( "VLAN: Add point intents between h5 and h21" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1106 | 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] | 1107 | senders = [ |
| 1108 | { "name":"h5","device":"of:0000000000000005/5","mac":"00:00:00:00:00:05" } |
| 1109 | ] |
| 1110 | recipients = [ |
| 1111 | { "name":"h21","device":"of:0000000000000007/5","mac":"00:00:00:00:00:15" } |
| 1112 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1113 | testResult = main.FALSE |
| 1114 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1115 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1116 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1117 | name="DUALSTACK1", |
| 1118 | senders=senders, |
| 1119 | recipients=recipients, |
| 1120 | ethType="IPV4" ) |
| 1121 | |
| 1122 | if installResult: |
| 1123 | testResult = main.intentFunction.testPointIntent( |
| 1124 | main, |
| 1125 | intentId=installResult, |
| 1126 | name="DUALSTACK1", |
| 1127 | senders=senders, |
| 1128 | recipients=recipients, |
| 1129 | sw1="s5", |
| 1130 | sw2="s2", |
| 1131 | expectedLink=18) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1132 | |
| 1133 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1134 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1135 | onpass=main.assertReturnString, |
| 1136 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1137 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1138 | main.step( "1HOP: Add point intents between h1 and h3" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1139 | 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] | 1140 | senders = [ |
| 1141 | { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" } |
| 1142 | ] |
| 1143 | recipients = [ |
| 1144 | { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" } |
| 1145 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1146 | testResult = main.FALSE |
| 1147 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1148 | installResult = main.intentFunction.installPointIntent( |
| 1149 | main, |
| 1150 | name="1HOP IPV4", |
| 1151 | senders=senders, |
| 1152 | recipients=recipients, |
| 1153 | ethType="IPV4" ) |
| 1154 | |
| 1155 | if installResult: |
| 1156 | testResult = main.intentFunction.testPointIntent( |
| 1157 | main, |
| 1158 | intentId=installResult, |
| 1159 | name="1HOP IPV4", |
| 1160 | senders=senders, |
| 1161 | recipients=recipients, |
| 1162 | sw1="s5", |
| 1163 | sw2="s2", |
| 1164 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1165 | else: |
| 1166 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1167 | |
| 1168 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1169 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1170 | onpass=main.assertReturnString, |
| 1171 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1172 | |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 1173 | main.intentFunction.report( main ) |
| 1174 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1175 | def CASE3000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1176 | """ |
| 1177 | Add single point to multi point intents |
| 1178 | - Get device ids |
| 1179 | - Add single point to multi point intents |
| 1180 | - Check intents |
| 1181 | - Verify flows |
| 1182 | - Ping hosts |
| 1183 | - Reroute |
| 1184 | - Link down |
| 1185 | - Verify flows |
| 1186 | - Check topology |
| 1187 | - Ping hosts |
| 1188 | - Link up |
| 1189 | - Verify flows |
| 1190 | - Check topology |
| 1191 | - Ping hosts |
| 1192 | - Remove intents |
| 1193 | """ |
| 1194 | assert main, "There is no main" |
| 1195 | assert main.CLIs, "There is no main.CLIs" |
| 1196 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 1197 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 1198 | main.numSwitch" |
| 1199 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 1200 | main.testName = "Single to Multi Point Intents" |
| 1201 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 1202 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 1203 | main.caseExplanation = "This test case will test single point to" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 1204 | " multi point intents using " +\ |
| 1205 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 1206 | "Different type of hosts will be tested in " +\ |
| 1207 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 1208 | ";\nThe test will use OF " + main.OFProtocol +\ |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 1209 | " OVS running in Mininet and compile intents" +\ |
| 1210 | " using " + main.flowCompiler |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1211 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1212 | main.step( "NOOPTION: Install and test single point to multi point intents" ) |
| 1213 | main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n" |
| 1214 | senders = [ |
| 1215 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1216 | ] |
| 1217 | recipients = [ |
| 1218 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1219 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1220 | ] |
| 1221 | badSenders=[ { "name":"h9" } ] # Senders that are not in the intent |
| 1222 | badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent |
| 1223 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1224 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1225 | installResult = main.intentFunction.installSingleToMultiIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1226 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1227 | name="NOOPTION", |
| 1228 | senders=senders, |
| 1229 | recipients=recipients, |
| 1230 | sw1="s5", |
| 1231 | sw2="s2") |
| 1232 | |
| 1233 | if installResult: |
| 1234 | testResult = main.intentFunction.testPointIntent( |
| 1235 | main, |
| 1236 | intentId=installResult, |
| 1237 | name="NOOPTION", |
| 1238 | senders=senders, |
| 1239 | recipients=recipients, |
| 1240 | badSenders=badSenders, |
| 1241 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1242 | sw1="s5", |
| 1243 | sw2="s2", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1244 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1245 | else: |
| 1246 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1247 | |
| 1248 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1249 | actual=testResult, |
| 1250 | onpass=main.assertReturnString, |
| 1251 | onfail=main.assertReturnString ) |
| 1252 | |
| 1253 | main.step( "IPV4: Install and test single point to multi point intents" ) |
| 1254 | main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n" |
| 1255 | senders = [ |
| 1256 | { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" } |
| 1257 | ] |
| 1258 | recipients = [ |
| 1259 | { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }, |
| 1260 | { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" } |
| 1261 | ] |
| 1262 | badSenders=[ { "name":"h9" } ] # Senders that are not in the intent |
| 1263 | badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent |
| 1264 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1265 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1266 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 1267 | main, |
| 1268 | name="IPV4", |
| 1269 | senders=senders, |
| 1270 | recipients=recipients, |
| 1271 | ethType="IPV4", |
| 1272 | sw1="s5", |
| 1273 | sw2="s2") |
| 1274 | |
| 1275 | if installResult: |
| 1276 | testResult = main.intentFunction.testPointIntent( |
| 1277 | main, |
| 1278 | intentId=installResult, |
| 1279 | name="IPV4", |
| 1280 | senders=senders, |
| 1281 | recipients=recipients, |
| 1282 | badSenders=badSenders, |
| 1283 | badRecipients=badRecipients, |
| 1284 | sw1="s5", |
| 1285 | sw2="s2", |
| 1286 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1287 | else: |
| 1288 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1289 | |
| 1290 | utilities.assert_equals( expect=main.TRUE, |
| 1291 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1292 | onpass=main.assertReturnString, |
| 1293 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1294 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1295 | main.step( "IPV4_2: Add single point to multi point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1296 | 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] | 1297 | senders = [ |
| 1298 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1299 | ] |
| 1300 | recipients = [ |
| 1301 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1302 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1303 | ] |
| 1304 | badSenders=[ { "name":"h9" } ] # Senders that are not in the intent |
| 1305 | badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent |
| 1306 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1307 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1308 | installResult = main.intentFunction.installSingleToMultiIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1309 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1310 | name="IPV4_2", |
| 1311 | senders=senders, |
| 1312 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1313 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1314 | sw1="s5", |
| 1315 | sw2="s2") |
| 1316 | |
| 1317 | if installResult: |
| 1318 | testResult = main.intentFunction.testPointIntent( |
| 1319 | main, |
| 1320 | intentId=installResult, |
| 1321 | name="IPV4_2", |
| 1322 | senders=senders, |
| 1323 | recipients=recipients, |
| 1324 | badSenders=badSenders, |
| 1325 | badRecipients=badRecipients, |
| 1326 | sw1="s5", |
| 1327 | sw2="s2", |
| 1328 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1329 | else: |
| 1330 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1331 | |
| 1332 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1333 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1334 | onpass=main.assertReturnString, |
| 1335 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1336 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1337 | main.step( "VLAN: Add single point to multi point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1338 | 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] | 1339 | senders = [ |
| 1340 | { "name":"h4", "device":"of:0000000000000005/4", "mac":"00:00:00:00:00:04" } |
| 1341 | ] |
| 1342 | recipients = [ |
| 1343 | { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C" }, |
| 1344 | { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14" } |
| 1345 | ] |
| 1346 | badSenders=[ { "name":"h13" } ] # Senders that are not in the intent |
| 1347 | badRecipients=[ { "name":"h21" } ] # Recipients that are not in the intent |
| 1348 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1349 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1350 | installResult = main.intentFunction.installSingleToMultiIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1351 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1352 | name="IPV4", |
| 1353 | senders=senders, |
| 1354 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1355 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1356 | sw1="s5", |
| 1357 | sw2="s2") |
| 1358 | |
| 1359 | if installResult: |
| 1360 | testResult = main.intentFunction.testPointIntent( |
| 1361 | main, |
| 1362 | intentId=installResult, |
| 1363 | name="IPV4", |
| 1364 | senders=senders, |
| 1365 | recipients=recipients, |
| 1366 | badSenders=badSenders, |
| 1367 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1368 | sw1="s5", |
| 1369 | sw2="s2", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1370 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1371 | else: |
| 1372 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1373 | |
| 1374 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1375 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1376 | onpass=main.assertReturnString, |
| 1377 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1378 | |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 1379 | main.intentFunction.report( main ) |
| 1380 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1381 | def CASE4000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1382 | """ |
| 1383 | Add multi point to single point intents |
| 1384 | - Get device ids |
| 1385 | - Add multi point to single point intents |
| 1386 | - Check intents |
| 1387 | - Verify flows |
| 1388 | - Ping hosts |
| 1389 | - Reroute |
| 1390 | - Link down |
| 1391 | - Verify flows |
| 1392 | - Check topology |
| 1393 | - Ping hosts |
| 1394 | - Link up |
| 1395 | - Verify flows |
| 1396 | - Check topology |
| 1397 | - Ping hosts |
| 1398 | - Remove intents |
| 1399 | """ |
| 1400 | assert main, "There is no main" |
| 1401 | assert main.CLIs, "There is no main.CLIs" |
| 1402 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 1403 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 1404 | main.numSwitch" |
| 1405 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 1406 | main.testName = "Multi To Single Point Intents" |
| 1407 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 1408 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 1409 | main.caseExplanation = "This test case will test single point to" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 1410 | " multi point intents using " +\ |
| 1411 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 1412 | "Different type of hosts will be tested in " +\ |
| 1413 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 1414 | ";\nThe test will use OF " + main.OFProtocol +\ |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 1415 | " OVS running in Mininet and compile intents" +\ |
| 1416 | " using " + main.flowCompiler |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1417 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1418 | main.step( "NOOPTION: Add multi point to single point intents" ) |
| 1419 | main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n" |
| 1420 | senders = [ |
| 1421 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1422 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1423 | ] |
| 1424 | recipients = [ |
| 1425 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1426 | ] |
| 1427 | badSenders=[ { "name":"h17" } ] # Senders that are not in the intent |
| 1428 | badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent |
| 1429 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1430 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1431 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 1432 | main, |
| 1433 | name="NOOPTION", |
| 1434 | senders=senders, |
| 1435 | recipients=recipients, |
| 1436 | sw1="s5", |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1437 | sw2="s2" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1438 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1439 | if installResult: |
| 1440 | testResult = main.intentFunction.testPointIntent( |
| 1441 | main, |
| 1442 | intentId=installResult, |
| 1443 | name="NOOPTION", |
| 1444 | senders=senders, |
| 1445 | recipients=recipients, |
| 1446 | badSenders=badSenders, |
| 1447 | badRecipients=badRecipients, |
| 1448 | sw1="s5", |
| 1449 | sw2="s2", |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1450 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1451 | else: |
| 1452 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1453 | |
| 1454 | utilities.assert_equals( expect=main.TRUE, |
| 1455 | actual=testResult, |
| 1456 | onpass=main.assertReturnString, |
| 1457 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1458 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1459 | main.step( "IPV4: Add multi point to single point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1460 | 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] | 1461 | senders = [ |
| 1462 | { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }, |
| 1463 | { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" } |
| 1464 | ] |
| 1465 | recipients = [ |
| 1466 | { "name":"h8", "device":"of:0000000000000005/8", "mac":"00:00:00:00:00:08" } |
| 1467 | ] |
| 1468 | badSenders=[ { "name":"h17" } ] # Senders that are not in the intent |
| 1469 | badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent |
| 1470 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1471 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1472 | installResult = main.intentFunction.installMultiToSingleIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1473 | main, |
| 1474 | name="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1475 | senders=senders, |
| 1476 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1477 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1478 | sw1="s5", |
| 1479 | sw2="s2") |
| 1480 | |
| 1481 | if installResult: |
| 1482 | testResult = main.intentFunction.testPointIntent( |
| 1483 | main, |
| 1484 | intentId=installResult, |
| 1485 | name="IPV4", |
| 1486 | senders=senders, |
| 1487 | recipients=recipients, |
| 1488 | badSenders=badSenders, |
| 1489 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1490 | sw1="s5", |
| 1491 | sw2="s2", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1492 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1493 | else: |
| 1494 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1495 | |
| 1496 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1497 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1498 | onpass=main.assertReturnString, |
| 1499 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1500 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1501 | main.step( "IPV4_2: Add multi point to single point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1502 | 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] | 1503 | senders = [ |
| 1504 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1505 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1506 | ] |
| 1507 | recipients = [ |
| 1508 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1509 | ] |
| 1510 | badSenders=[ { "name":"h17" } ] # Senders that are not in the intent |
| 1511 | badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent |
| 1512 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1513 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1514 | installResult = main.intentFunction.installMultiToSingleIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1515 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1516 | name="IPV4_2", |
| 1517 | senders=senders, |
| 1518 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1519 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1520 | sw1="s5", |
| 1521 | sw2="s2") |
| 1522 | |
| 1523 | if installResult: |
| 1524 | testResult = main.intentFunction.testPointIntent( |
| 1525 | main, |
| 1526 | intentId=installResult, |
| 1527 | name="IPV4_2", |
| 1528 | senders=senders, |
| 1529 | recipients=recipients, |
| 1530 | badSenders=badSenders, |
| 1531 | badRecipients=badRecipients, |
| 1532 | sw1="s5", |
| 1533 | sw2="s2", |
| 1534 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1535 | else: |
| 1536 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1537 | |
| 1538 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1539 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1540 | onpass=main.assertReturnString, |
| 1541 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1542 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1543 | main.step( "VLAN: Add multi point to single point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1544 | 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] | 1545 | senders = [ |
| 1546 | { "name":"h13", "device":"of:0000000000000006/5" }, |
| 1547 | { "name":"h21", "device":"of:0000000000000007/5" } |
| 1548 | ] |
| 1549 | recipients = [ |
| 1550 | { "name":"h5", "device":"of:0000000000000005/5" } |
| 1551 | ] |
| 1552 | badSenders=[ { "name":"h12" } ] # Senders that are not in the intent |
| 1553 | badRecipients=[ { "name":"h20" } ] # Recipients that are not in the intent |
| 1554 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1555 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1556 | installResult = main.intentFunction.installMultiToSingleIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1557 | main, |
| 1558 | name="VLAN", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1559 | senders=senders, |
| 1560 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1561 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1562 | sw1="s5", |
| 1563 | sw2="s2") |
| 1564 | |
| 1565 | if installResult: |
| 1566 | testResult = main.intentFunction.testPointIntent( |
| 1567 | main, |
| 1568 | intentId=installResult, |
| 1569 | name="VLAN", |
| 1570 | senders=senders, |
| 1571 | recipients=recipients, |
| 1572 | badSenders=badSenders, |
| 1573 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1574 | sw1="s5", |
| 1575 | sw2="s2", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1576 | expectedLink=18) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1577 | else: |
| 1578 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1579 | |
| 1580 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1581 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1582 | onpass=main.assertReturnString, |
| 1583 | onfail=main.assertReturnString ) |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1584 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1585 | main.intentFunction.report( main ) |
| 1586 | |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1587 | def CASE5000( self, main ): |
| 1588 | """ |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1589 | Tests Host Mobility |
| 1590 | Modifies the topology location of h1 |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1591 | """ |
| 1592 | assert main, "There is no main" |
| 1593 | assert main.CLIs, "There is no main.CLIs" |
| 1594 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 1595 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 1596 | main.numSwitch" |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1597 | main.case( "Test host mobility with host intents " ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1598 | main.step( "Testing host mobility by moving h1 from s5 to s6" ) |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1599 | h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ] |
| 1600 | |
Jeremy | 2f190ca | 2016-01-29 15:23:57 -0800 | [diff] [blame] | 1601 | main.log.info( "Moving h1 from s5 to s6") |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1602 | main.Mininet1.moveHost( "h1","s5","s6" ) |
| 1603 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1604 | # Send discovery ping from moved host |
| 1605 | # Moving the host brings down the default interfaces and creates a new one. |
| 1606 | # Scapy is restarted on this host to detect the new interface |
| 1607 | main.h1.stopScapy() |
| 1608 | main.h1.startScapy() |
| 1609 | |
| 1610 | # Discover new host location in ONOS and populate host data. |
| 1611 | # Host 1 IP and MAC should be unchanged |
| 1612 | main.intentFunction.sendDiscoveryArp( main, [ main.h1 ] ) |
| 1613 | main.intentFunction.populateHostData( main ) |
| 1614 | |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 1615 | h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ] |
| 1616 | |
| 1617 | utilities.assert_equals( expect="of:0000000000000006", |
| 1618 | actual=h1PostMove, |
| 1619 | onpass="Mobility: Successfully moved h1 to s6", |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1620 | onfail="Mobility: Failed to move h1 to s6" + |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1621 | " to single point intents" + |
| 1622 | " with IPV4 type and MAC addresses" + |
| 1623 | " in the same VLAN" ) |
| 1624 | |
| 1625 | main.step( "IPV4: Add host intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1626 | 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] | 1627 | host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" } |
| 1628 | host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" } |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1629 | testResult = main.FALSE |
| 1630 | installResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1631 | installResult = main.intentFunction.installHostIntent( main, |
| 1632 | name='IPV4 Mobility IPV4', |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1633 | onosNode='0', |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1634 | host1=host1, |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1635 | host2=host2 ) |
Jeremy | 2f190ca | 2016-01-29 15:23:57 -0800 | [diff] [blame] | 1636 | if installResult: |
| 1637 | testResult = main.intentFunction.testHostIntent( main, |
| 1638 | name='Host Mobility IPV4', |
| 1639 | intentId = installResult, |
| 1640 | onosNode='0', |
| 1641 | host1=host1, |
| 1642 | host2=host2, |
| 1643 | sw1="s6", |
| 1644 | sw2="s2", |
| 1645 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1646 | else: |
| 1647 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1648 | |
| 1649 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1650 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1651 | onpass=main.assertReturnString, |
| 1652 | onfail=main.assertReturnString ) |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 1653 | |
| 1654 | main.intentFunction.report( main ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1655 | |
| 1656 | def CASE6000( self, main ): |
| 1657 | """ |
| 1658 | Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure |
| 1659 | """ |
| 1660 | assert main, "There is no main" |
| 1661 | assert main.CLIs, "There is no main.CLIs" |
| 1662 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 1663 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 1664 | main.numSwitch" |
| 1665 | main.case( "Test Multi to Single End Point Failure" ) |
| 1666 | main.step( "Installing Multi to Single Point intents" ) |
| 1667 | |
| 1668 | main.assertReturnString = "Assertion results for IPV4 multi to single \ |
| 1669 | point intent end point failure with no options set\n" |
| 1670 | senders = [ |
| 1671 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1672 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1673 | ] |
| 1674 | recipients = [ |
| 1675 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1676 | ] |
| 1677 | isolatedSenders = [ |
| 1678 | { "name":"h24"} |
| 1679 | ] |
| 1680 | isolatedRecipients = [] |
| 1681 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1682 | installResult = main.FALSE |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1683 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 1684 | main, |
| 1685 | name="NOOPTION", |
| 1686 | senders=senders, |
| 1687 | recipients=recipients, |
| 1688 | sw1="s5", |
| 1689 | sw2="s2" ) |
| 1690 | |
| 1691 | if installResult: |
| 1692 | testResult = main.intentFunction.testEndPointFail( |
| 1693 | main, |
| 1694 | intentId=installResult, |
| 1695 | name="NOOPTION", |
| 1696 | senders=senders, |
| 1697 | recipients=recipients, |
| 1698 | isolatedSenders=isolatedSenders, |
| 1699 | isolatedRecipients=isolatedRecipients, |
| 1700 | sw1="s6", |
| 1701 | sw2="s2", |
| 1702 | sw3="s4", |
| 1703 | sw4="s1", |
| 1704 | sw5="s3", |
| 1705 | expectedLink1=16, |
| 1706 | expectedLink2=14 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1707 | else: |
| 1708 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1709 | |
| 1710 | utilities.assert_equals( expect=main.TRUE, |
| 1711 | actual=testResult, |
| 1712 | onpass=main.assertReturnString, |
| 1713 | onfail=main.assertReturnString ) |
| 1714 | |
| 1715 | main.step( "IPV4: Add multi point to single point intents" ) |
| 1716 | main.assertReturnString = "Assertion results for IPV4 multi to single \ |
| 1717 | point intent end point failure with IPV4 type and MAC addresses\n" |
| 1718 | senders = [ |
| 1719 | { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }, |
| 1720 | { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" } |
| 1721 | ] |
| 1722 | recipients = [ |
| 1723 | { "name":"h8", "device":"of:0000000000000005/8", "mac":"00:00:00:00:00:08" } |
| 1724 | ] |
| 1725 | isolatedSenders = [ |
| 1726 | { "name":"h24"} |
| 1727 | ] |
| 1728 | isolatedRecipients = [] |
| 1729 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1730 | installResult = main.FALSE |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1731 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 1732 | main, |
| 1733 | name="IPV4", |
| 1734 | senders=senders, |
| 1735 | recipients=recipients, |
| 1736 | ethType="IPV4", |
| 1737 | sw1="s5", |
| 1738 | sw2="s2") |
| 1739 | |
| 1740 | if installResult: |
| 1741 | testResult = main.intentFunction.testEndPointFail( |
| 1742 | main, |
| 1743 | intentId=installResult, |
| 1744 | name="IPV4", |
| 1745 | senders=senders, |
| 1746 | recipients=recipients, |
| 1747 | isolatedSenders=isolatedSenders, |
| 1748 | isolatedRecipients=isolatedRecipients, |
| 1749 | sw1="s6", |
| 1750 | sw2="s2", |
| 1751 | sw3="s4", |
| 1752 | sw4="s1", |
| 1753 | sw5="s3", |
| 1754 | expectedLink1=16, |
| 1755 | expectedLink2=14 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1756 | else: |
| 1757 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1758 | |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1759 | utilities.assert_equals( expect=main.TRUE, |
| 1760 | actual=testResult, |
| 1761 | onpass=main.assertReturnString, |
| 1762 | onfail=main.assertReturnString ) |
| 1763 | |
| 1764 | main.step( "IPV4_2: Add multi point to single point intents" ) |
| 1765 | main.assertReturnString = "Assertion results for IPV4 multi to single \ |
| 1766 | point intent end point failure with IPV4 type and no MAC addresses\n" |
| 1767 | senders = [ |
| 1768 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1769 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1770 | ] |
| 1771 | recipients = [ |
| 1772 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1773 | ] |
| 1774 | isolatedSenders = [ |
| 1775 | { "name":"h24"} |
| 1776 | ] |
| 1777 | isolatedRecipients = [] |
| 1778 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1779 | installResult = main.FALSE |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1780 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 1781 | main, |
| 1782 | name="IPV4_2", |
| 1783 | senders=senders, |
| 1784 | recipients=recipients, |
| 1785 | ethType="IPV4", |
| 1786 | sw1="s5", |
| 1787 | sw2="s2") |
| 1788 | |
| 1789 | if installResult: |
| 1790 | testResult = main.intentFunction.testEndPointFail( |
| 1791 | main, |
| 1792 | intentId=installResult, |
| 1793 | name="IPV4_2", |
| 1794 | senders=senders, |
| 1795 | recipients=recipients, |
| 1796 | isolatedSenders=isolatedSenders, |
| 1797 | isolatedRecipients=isolatedRecipients, |
| 1798 | sw1="s6", |
| 1799 | sw2="s2", |
| 1800 | sw3="s4", |
| 1801 | sw4="s1", |
| 1802 | sw5="s3", |
| 1803 | expectedLink1=16, |
| 1804 | expectedLink2=14 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1805 | else: |
| 1806 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1807 | |
| 1808 | utilities.assert_equals( expect=main.TRUE, |
| 1809 | actual=testResult, |
| 1810 | onpass=main.assertReturnString, |
| 1811 | onfail=main.assertReturnString ) |
| 1812 | |
| 1813 | main.step( "VLAN: Add multi point to single point intents" ) |
| 1814 | main.assertReturnString = "Assertion results for IPV4 multi to single \ |
| 1815 | point intent end point failure with IPV4 type and no MAC addresses in the same VLAN\n" |
| 1816 | senders = [ |
| 1817 | { "name":"h13", "device":"of:0000000000000006/5" }, |
| 1818 | { "name":"h21", "device":"of:0000000000000007/5" } |
| 1819 | ] |
| 1820 | recipients = [ |
| 1821 | { "name":"h5", "device":"of:0000000000000005/5" } |
| 1822 | ] |
| 1823 | isolatedSenders = [ |
| 1824 | { "name":"h21"} |
| 1825 | ] |
| 1826 | isolatedRecipients = [] |
| 1827 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1828 | installResult = main.FALSE |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1829 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 1830 | main, |
| 1831 | name="VLAN", |
| 1832 | senders=senders, |
| 1833 | recipients=recipients, |
| 1834 | ethType="IPV4", |
| 1835 | sw1="s5", |
| 1836 | sw2="s2") |
| 1837 | |
| 1838 | if installResult: |
| 1839 | testResult = main.intentFunction.testEndPointFail( |
| 1840 | main, |
| 1841 | intentId=installResult, |
| 1842 | name="VLAN", |
| 1843 | senders=senders, |
| 1844 | recipients=recipients, |
| 1845 | isolatedSenders=isolatedSenders, |
| 1846 | isolatedRecipients=isolatedRecipients, |
| 1847 | sw1="s6", |
| 1848 | sw2="s2", |
| 1849 | sw3="s4", |
| 1850 | sw4="s1", |
| 1851 | sw5="s3", |
| 1852 | expectedLink1=16, |
| 1853 | expectedLink2=14 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1854 | else: |
| 1855 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1856 | |
| 1857 | utilities.assert_equals( expect=main.TRUE, |
| 1858 | actual=testResult, |
| 1859 | onpass=main.assertReturnString, |
| 1860 | onfail=main.assertReturnString ) |
| 1861 | |
| 1862 | main.step( "NOOPTION: Install and test single point to multi point intents" ) |
| 1863 | main.assertReturnString = "Assertion results for IPV4 single to multi \ |
| 1864 | point intent end point failure with no options set\n" |
| 1865 | senders = [ |
| 1866 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1867 | ] |
| 1868 | recipients = [ |
| 1869 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1870 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1871 | ] |
| 1872 | isolatedSenders = [] |
| 1873 | isolatedRecipients = [ |
| 1874 | { "name":"h24" } |
| 1875 | ] |
| 1876 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1877 | installResult = main.FALSE |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1878 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 1879 | main, |
| 1880 | name="NOOPTION", |
| 1881 | senders=senders, |
| 1882 | recipients=recipients, |
| 1883 | sw1="s5", |
| 1884 | sw2="s2") |
| 1885 | |
| 1886 | if installResult: |
| 1887 | testResult = main.intentFunction.testEndPointFail( |
| 1888 | main, |
| 1889 | intentId=installResult, |
| 1890 | name="NOOPTION", |
| 1891 | senders=senders, |
| 1892 | recipients=recipients, |
| 1893 | isolatedSenders=isolatedSenders, |
| 1894 | isolatedRecipients=isolatedRecipients, |
| 1895 | sw1="s6", |
| 1896 | sw2="s2", |
| 1897 | sw3="s4", |
| 1898 | sw4="s1", |
| 1899 | sw5="s3", |
| 1900 | expectedLink1=16, |
| 1901 | expectedLink2=14 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1902 | else: |
| 1903 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1904 | |
| 1905 | utilities.assert_equals( expect=main.TRUE, |
| 1906 | actual=testResult, |
| 1907 | onpass=main.assertReturnString, |
| 1908 | onfail=main.assertReturnString ) |
| 1909 | |
| 1910 | main.step( "IPV4: Install and test single point to multi point intents" ) |
| 1911 | main.assertReturnString = "Assertion results for IPV4 single to multi \ |
| 1912 | point intent end point failure with IPV4 type and no MAC addresses\n" |
| 1913 | senders = [ |
| 1914 | { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" } |
| 1915 | ] |
| 1916 | recipients = [ |
| 1917 | { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }, |
| 1918 | { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" } |
| 1919 | ] |
| 1920 | isolatedSenders = [] |
| 1921 | isolatedRecipients = [ |
| 1922 | { "name":"h24" } |
| 1923 | ] |
| 1924 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1925 | installResult = main.FALSE |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1926 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 1927 | main, |
| 1928 | name="IPV4", |
| 1929 | senders=senders, |
| 1930 | recipients=recipients, |
| 1931 | ethType="IPV4", |
| 1932 | sw1="s5", |
| 1933 | sw2="s2") |
| 1934 | |
| 1935 | if installResult: |
| 1936 | testResult = main.intentFunction.testEndPointFail( |
| 1937 | main, |
| 1938 | intentId=installResult, |
| 1939 | name="IPV4", |
| 1940 | senders=senders, |
| 1941 | recipients=recipients, |
| 1942 | isolatedSenders=isolatedSenders, |
| 1943 | isolatedRecipients=isolatedRecipients, |
| 1944 | sw1="s6", |
| 1945 | sw2="s2", |
| 1946 | sw3="s4", |
| 1947 | sw4="s1", |
| 1948 | sw5="s3", |
| 1949 | expectedLink1=16, |
| 1950 | expectedLink2=14 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1951 | else: |
| 1952 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1953 | |
| 1954 | utilities.assert_equals( expect=main.TRUE, |
| 1955 | actual=testResult, |
| 1956 | onpass=main.assertReturnString, |
| 1957 | onfail=main.assertReturnString ) |
| 1958 | |
| 1959 | main.step( "IPV4_2: Add single point to multi point intents" ) |
| 1960 | main.assertReturnString = "Assertion results for IPV4 single to multi\ |
| 1961 | point intent endpoint failure with IPV4 type and no MAC addresses\n" |
| 1962 | senders = [ |
| 1963 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1964 | ] |
| 1965 | recipients = [ |
| 1966 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1967 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1968 | ] |
| 1969 | isolatedSenders = [] |
| 1970 | isolatedRecipients = [ |
| 1971 | { "name":"h24" } |
| 1972 | ] |
| 1973 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1974 | installResult = main.FALSE |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1975 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 1976 | main, |
| 1977 | name="IPV4_2", |
| 1978 | senders=senders, |
| 1979 | recipients=recipients, |
| 1980 | ethType="IPV4", |
| 1981 | sw1="s5", |
| 1982 | sw2="s2") |
| 1983 | |
| 1984 | if installResult: |
| 1985 | testResult = main.intentFunction.testEndPointFail( |
| 1986 | main, |
| 1987 | intentId=installResult, |
| 1988 | name="IPV4_2", |
| 1989 | senders=senders, |
| 1990 | recipients=recipients, |
| 1991 | isolatedSenders=isolatedSenders, |
| 1992 | isolatedRecipients=isolatedRecipients, |
| 1993 | sw1="s6", |
| 1994 | sw2="s2", |
| 1995 | sw3="s4", |
| 1996 | sw4="s1", |
| 1997 | sw5="s3", |
| 1998 | expectedLink1=16, |
| 1999 | expectedLink2=14 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 2000 | else: |
| 2001 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2002 | |
| 2003 | utilities.assert_equals( expect=main.TRUE, |
| 2004 | actual=testResult, |
| 2005 | onpass=main.assertReturnString, |
| 2006 | onfail=main.assertReturnString ) |
| 2007 | |
| 2008 | main.step( "VLAN: Add single point to multi point intents" ) |
| 2009 | main.assertReturnString = "Assertion results for IPV4 single to multi point\ |
| 2010 | intent endpoint failure with IPV4 type and MAC addresses in the same VLAN\n" |
| 2011 | senders = [ |
| 2012 | { "name":"h4", "device":"of:0000000000000005/4", "mac":"00:00:00:00:00:04" } |
| 2013 | ] |
| 2014 | recipients = [ |
| 2015 | { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C" }, |
| 2016 | { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14" } |
| 2017 | ] |
| 2018 | isolatedSenders = [] |
| 2019 | isolatedRecipients = [ |
| 2020 | { "name":"h20" } |
| 2021 | ] |
| 2022 | testResult = main.FALSE |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 2023 | installResult = main.FALSE |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2024 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 2025 | main, |
| 2026 | name="IPV4", |
| 2027 | senders=senders, |
| 2028 | recipients=recipients, |
| 2029 | ethType="IPV4", |
| 2030 | sw1="s5", |
| 2031 | sw2="s2") |
| 2032 | |
| 2033 | if installResult: |
| 2034 | testResult = main.intentFunction.testEndPointFail( |
| 2035 | main, |
| 2036 | intentId=installResult, |
| 2037 | name="IPV4", |
| 2038 | senders=senders, |
| 2039 | recipients=recipients, |
| 2040 | isolatedSenders=isolatedSenders, |
| 2041 | isolatedRecipients=isolatedRecipients, |
| 2042 | sw1="s6", |
| 2043 | sw2="s2", |
| 2044 | sw3="s4", |
| 2045 | sw4="s1", |
| 2046 | sw5="s3", |
| 2047 | expectedLink1=16, |
| 2048 | expectedLink2=14 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 2049 | else: |
| 2050 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2051 | |
| 2052 | utilities.assert_equals( expect=main.TRUE, |
| 2053 | actual=testResult, |
| 2054 | onpass=main.assertReturnString, |
| 2055 | onfail=main.assertReturnString ) |
| 2056 | |
Jeremy | 2f190ca | 2016-01-29 15:23:57 -0800 | [diff] [blame] | 2057 | main.intentFunction.report( main ) |