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