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