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