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