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