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