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 | |
You Wang | f5de25b | 2017-01-06 15:13:01 -0800 | [diff] [blame] | 208 | main.step( "Set up ONOS secure SSH" ) |
| 209 | secureSshResult = main.TRUE |
| 210 | for i in range( int( main.numCtrls ) ): |
| 211 | secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] ) |
| 212 | utilities.assert_equals( expect=main.TRUE, actual=secureSshResult, |
| 213 | onpass="Test step PASS", |
| 214 | onfail="Test step FAIL" ) |
| 215 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 216 | time.sleep( main.startUpSleep ) |
| 217 | main.step( "Starting ONOS service" ) |
| 218 | stopResult = main.TRUE |
| 219 | startResult = main.TRUE |
| 220 | onosIsUp = main.TRUE |
| 221 | |
| 222 | for i in range( main.numCtrls ): |
Jeremy Songster | 7edb663 | 2016-04-28 15:44:28 -0700 | [diff] [blame] | 223 | isUp = main.ONOSbench.isup( main.ONOSip[ i ] ) |
| 224 | onosIsUp = onosIsUp and isUp |
| 225 | if isUp == main.TRUE: |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 226 | main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) ) |
| 227 | else: |
| 228 | main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) + |
| 229 | "start ONOS again " ) |
| 230 | stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] ) |
| 231 | startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] ) |
| 232 | if not startResult or stopResult: |
| 233 | 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] | 234 | stepResult = onosIsUp and stopResult and startResult |
| 235 | utilities.assert_equals( expect=main.TRUE, |
| 236 | actual=stepResult, |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 237 | onpass="ONOS service is ready on all nodes", |
| 238 | onfail="ONOS service did not start properly on all nodes" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 239 | |
| 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 ) |
alison | da15727 | 2016-12-22 01:13:21 -0800 | [diff] [blame^] | 1122 | |
| 1123 | main.step("Protected: Add point intents between h1 and h9") |
| 1124 | main.assertReturnString = "Assertion Result for protected point intent\n" |
| 1125 | senders = [ |
| 1126 | {"name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01"} |
| 1127 | ] |
| 1128 | recipients = [ |
| 1129 | {"name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09"} |
| 1130 | ] |
| 1131 | testResult = main.FALSE |
| 1132 | installResult = main.intentFunction.installPointIntent( |
| 1133 | main, |
| 1134 | name="Protected", |
| 1135 | senders=senders, |
| 1136 | recipients=recipients, |
| 1137 | protected=True ) |
| 1138 | |
| 1139 | if installResult: |
| 1140 | testResult = main.intentFunction.testPointIntent( |
| 1141 | main, |
| 1142 | name="Protected", |
| 1143 | intentId=installResult, |
| 1144 | senders=senders, |
| 1145 | recipients=recipients, |
| 1146 | sw1="s5", |
| 1147 | sw2="s2", |
| 1148 | protected=True, |
| 1149 | expectedLink=18 ) |
| 1150 | else: |
| 1151 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1152 | |
| 1153 | utilities.assert_equals( expect=main.TRUE, |
| 1154 | actual=testResult, |
| 1155 | onpass=main.assertReturnString, |
| 1156 | onfail=main.assertReturnString ) |
| 1157 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1158 | main.step( "IPV4_2: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1159 | main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1160 | senders = [ |
| 1161 | { "name":"h1","device":"of:0000000000000005/1" } |
| 1162 | ] |
| 1163 | recipients = [ |
| 1164 | { "name":"h9","device":"of:0000000000000006/1" } |
| 1165 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1166 | testResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1167 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1168 | main, |
| 1169 | name="IPV4_2", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1170 | senders=senders, |
| 1171 | recipients=recipients, |
| 1172 | ethType="IPV4" ) |
| 1173 | |
| 1174 | if installResult: |
| 1175 | testResult = main.intentFunction.testPointIntent( |
| 1176 | main, |
| 1177 | intentId=installResult, |
| 1178 | name="IPV4_2", |
| 1179 | senders=senders, |
| 1180 | recipients=recipients, |
| 1181 | sw1="s5", |
| 1182 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1183 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1184 | else: |
| 1185 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1186 | |
| 1187 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1188 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1189 | onpass=main.assertReturnString, |
| 1190 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1191 | |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 1192 | main.step( "SDNIP-ICMP: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1193 | main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n" |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1194 | senders = [ |
| 1195 | { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01", |
Jeremy | 6f000c6 | 2016-02-25 17:02:28 -0800 | [diff] [blame] | 1196 | "ip":( main.h1.hostIp + "/24" ) } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1197 | ] |
| 1198 | recipients = [ |
| 1199 | { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09", |
Jeremy | 6f000c6 | 2016-02-25 17:02:28 -0800 | [diff] [blame] | 1200 | "ip":( main.h9.hostIp + "/24" ) } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1201 | ] |
Jeremy | 6f000c6 | 2016-02-25 17:02:28 -0800 | [diff] [blame] | 1202 | ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ] |
kelvin-onlab | 79ce049 | 2015-07-27 16:14:39 -0700 | [diff] [blame] | 1203 | # Uneccessary, not including this in the selectors |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1204 | tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 1205 | tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1206 | testResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1207 | installResult = main.intentFunction.installPointIntent( |
| 1208 | main, |
| 1209 | name="SDNIP-ICMP", |
| 1210 | senders=senders, |
| 1211 | recipients=recipients, |
| 1212 | ethType="IPV4", |
| 1213 | ipProto=ipProto, |
| 1214 | tcpSrc=tcpSrc, |
| 1215 | tcpDst=tcpDst ) |
| 1216 | |
| 1217 | if installResult: |
| 1218 | testResult = main.intentFunction.testPointIntent( |
| 1219 | main, |
| 1220 | intentId=installResult, |
| 1221 | name="SDNIP_ICMP", |
| 1222 | senders=senders, |
| 1223 | recipients=recipients, |
| 1224 | sw1="s5", |
| 1225 | sw2="s2", |
Jeremy Songster | e405d3d | 2016-05-17 11:18:57 -0700 | [diff] [blame] | 1226 | expectedLink=18, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1227 | useTCP=True ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1228 | else: |
| 1229 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1230 | |
| 1231 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1232 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1233 | onpass=main.assertReturnString, |
| 1234 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1235 | |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 1236 | main.step( "SDNIP-TCP: Add point intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1237 | 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] | 1238 | mac1 = main.hostsData[ 'h1' ][ 'mac' ] |
| 1239 | mac2 = main.hostsData[ 'h9' ][ 'mac' ] |
kelvin-onlab | 58dc39e | 2015-08-06 08:11:09 -0700 | [diff] [blame] | 1240 | ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32" |
| 1241 | ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32" |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1242 | ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ] |
| 1243 | tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 1244 | tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ] |
| 1245 | |
kelvin-onlab | 58dc39e | 2015-08-06 08:11:09 -0700 | [diff] [blame] | 1246 | stepResult = main.intentFunction.pointIntentTcp( |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1247 | main, |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 1248 | name="SDNIP-TCP", |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1249 | host1="h1", |
| 1250 | host2="h9", |
| 1251 | deviceId1="of:0000000000000005/1", |
| 1252 | deviceId2="of:0000000000000006/1", |
| 1253 | mac1=mac1, |
| 1254 | mac2=mac2, |
| 1255 | ethType="IPV4", |
kelvin-onlab | b55e58e | 2015-08-04 00:13:48 -0700 | [diff] [blame] | 1256 | ipProto=ipProto, |
| 1257 | ip1=ip1, |
| 1258 | ip2=ip2, |
| 1259 | tcp1=tcp1, |
| 1260 | tcp2=tcp2 ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1261 | |
| 1262 | utilities.assert_equals( expect=main.TRUE, |
Jeremy | 6f000c6 | 2016-02-25 17:02:28 -0800 | [diff] [blame] | 1263 | actual=stepResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1264 | onpass=main.assertReturnString, |
| 1265 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1266 | |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1267 | main.step( "DUALSTACK1: Add point intents between h3 and h11" ) |
| 1268 | 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] | 1269 | senders = [ |
| 1270 | { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" } |
| 1271 | ] |
| 1272 | recipients = [ |
| 1273 | { "name":"h11","device":"of:0000000000000006/3","mac":"00:00:00:00:00:0B" } |
| 1274 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1275 | testResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1276 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1277 | main, |
| 1278 | name="DUALSTACK1", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1279 | senders=senders, |
| 1280 | recipients=recipients, |
| 1281 | ethType="IPV4" ) |
| 1282 | |
| 1283 | if installResult: |
| 1284 | testResult = main.intentFunction.testPointIntent( |
| 1285 | main, |
| 1286 | intentId=installResult, |
| 1287 | name="DUALSTACK1", |
| 1288 | senders=senders, |
| 1289 | recipients=recipients, |
| 1290 | sw1="s5", |
| 1291 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1292 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1293 | else: |
| 1294 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1295 | |
| 1296 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1297 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1298 | onpass=main.assertReturnString, |
| 1299 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1300 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1301 | main.step( "VLAN: Add point intents between h5 and h21" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1302 | 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] | 1303 | senders = [ |
Jeremy Songster | 832f9e9 | 2016-05-05 14:30:49 -0700 | [diff] [blame] | 1304 | { "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] | 1305 | ] |
| 1306 | recipients = [ |
Jeremy Songster | 832f9e9 | 2016-05-05 14:30:49 -0700 | [diff] [blame] | 1307 | { "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] | 1308 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1309 | testResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1310 | installResult = main.intentFunction.installPointIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1311 | main, |
Jeremy Songster | 832f9e9 | 2016-05-05 14:30:49 -0700 | [diff] [blame] | 1312 | name="VLAN", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1313 | senders=senders, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1314 | recipients=recipients ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1315 | |
| 1316 | if installResult: |
| 1317 | testResult = main.intentFunction.testPointIntent( |
| 1318 | main, |
| 1319 | intentId=installResult, |
Jeremy Songster | 832f9e9 | 2016-05-05 14:30:49 -0700 | [diff] [blame] | 1320 | name="VLAN", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1321 | senders=senders, |
| 1322 | recipients=recipients, |
| 1323 | sw1="s5", |
| 1324 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1325 | expectedLink=18 ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1326 | |
| 1327 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1328 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1329 | onpass=main.assertReturnString, |
| 1330 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1331 | |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1332 | main.step( "VLAN: Add point intents between h5 and h21" ) |
| 1333 | main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n" |
| 1334 | senders = [ |
| 1335 | { "name":"h4", "vlan":"100" } |
| 1336 | ] |
| 1337 | recipients = [ |
| 1338 | { "name":"h21", "vlan":"200" } |
| 1339 | ] |
| 1340 | testResult = main.FALSE |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1341 | installResult = main.intentFunction.installPointIntent( |
| 1342 | main, |
| 1343 | name="VLAN2", |
| 1344 | senders=senders, |
| 1345 | recipients=recipients, |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1346 | setVlan=200 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1347 | |
| 1348 | if installResult: |
| 1349 | testResult = main.intentFunction.testPointIntent( |
| 1350 | main, |
| 1351 | intentId=installResult, |
| 1352 | name="VLAN2", |
| 1353 | senders=senders, |
| 1354 | recipients=recipients, |
| 1355 | sw1="s5", |
| 1356 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1357 | expectedLink=18 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1358 | |
| 1359 | utilities.assert_equals( expect=main.TRUE, |
| 1360 | actual=testResult, |
| 1361 | onpass=main.assertReturnString, |
| 1362 | onfail=main.assertReturnString ) |
| 1363 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1364 | main.step( "1HOP: Add point intents between h1 and h3" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1365 | 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] | 1366 | senders = [ |
| 1367 | { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" } |
| 1368 | ] |
| 1369 | recipients = [ |
| 1370 | { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" } |
| 1371 | ] |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1372 | testResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1373 | installResult = main.intentFunction.installPointIntent( |
| 1374 | main, |
| 1375 | name="1HOP IPV4", |
| 1376 | senders=senders, |
| 1377 | recipients=recipients, |
| 1378 | ethType="IPV4" ) |
| 1379 | |
| 1380 | if installResult: |
| 1381 | testResult = main.intentFunction.testPointIntent( |
| 1382 | main, |
| 1383 | intentId=installResult, |
| 1384 | name="1HOP IPV4", |
| 1385 | senders=senders, |
| 1386 | recipients=recipients, |
| 1387 | sw1="s5", |
| 1388 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1389 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1390 | else: |
| 1391 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1392 | |
| 1393 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1394 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1395 | onpass=main.assertReturnString, |
| 1396 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1397 | |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1398 | main.step( "Add point to point intents using VLAN Encapsulation" ) |
| 1399 | main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent" |
| 1400 | senders = [ |
| 1401 | { "name":"h1","device":"of:0000000000000005/1" } |
| 1402 | ] |
| 1403 | recipients = [ |
| 1404 | { "name":"h9","device":"of:0000000000000006/1" } |
| 1405 | ] |
| 1406 | testResult = main.FALSE |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1407 | installResult = main.intentFunction.installPointIntent( |
| 1408 | main, |
| 1409 | name="ENCAPSULATION", |
| 1410 | senders=senders, |
| 1411 | recipients=recipients, |
| 1412 | encap="VLAN" ) |
| 1413 | |
| 1414 | if installResult: |
| 1415 | testResult = main.intentFunction.testPointIntent( |
| 1416 | main, |
| 1417 | intentId=installResult, |
| 1418 | name="ENCAPSULATION", |
| 1419 | senders=senders, |
| 1420 | recipients=recipients, |
| 1421 | sw1="s5", |
| 1422 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1423 | expectedLink=18 ) |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1424 | else: |
| 1425 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1426 | |
| 1427 | utilities.assert_equals( expect=main.TRUE, |
| 1428 | actual=testResult, |
| 1429 | onpass=main.assertReturnString, |
| 1430 | onfail=main.assertReturnString ) |
| 1431 | |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1432 | # Testing MPLS would need to update kernel version (Right now is 3.16) |
| 1433 | # main.step( "Add point to point intents using MPLS Encapsulation" ) |
| 1434 | # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent" |
| 1435 | # senders = [ |
| 1436 | # { "name": "h1", "device": "of:0000000000000005/1" } |
| 1437 | # ] |
| 1438 | # recipients = [ |
| 1439 | # { "name": "h9", "device": "of:0000000000000006/1" } |
| 1440 | # ] |
| 1441 | # testResult = main.FALSE |
| 1442 | # installResult = main.intentFunction.installPointIntent( |
| 1443 | # main, |
| 1444 | # name="ENCAPSULATION", |
| 1445 | # senders=senders, |
| 1446 | # recipients=recipients, |
| 1447 | # encap="MPLS" ) |
| 1448 | # |
| 1449 | # if installResult: |
| 1450 | # testResult = main.intentFunction.testPointIntent( |
| 1451 | # main, |
| 1452 | # intentId=installResult, |
| 1453 | # name="ENCAPSULATION", |
| 1454 | # senders=senders, |
| 1455 | # recipients=recipients, |
| 1456 | # sw1="s5", |
| 1457 | # sw2="s2", |
| 1458 | # expectedLink=18 ) |
| 1459 | # else: |
| 1460 | # main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1461 | # |
| 1462 | # utilities.assert_equals( expect=main.TRUE, |
| 1463 | # actual=testResult, |
| 1464 | # onpass=main.assertReturnString, |
| 1465 | # onfail=main.assertReturnString ) |
| 1466 | |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 1467 | main.intentFunction.report( main ) |
| 1468 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1469 | def CASE3000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1470 | """ |
| 1471 | Add single point to multi point intents |
| 1472 | - Get device ids |
| 1473 | - Add single point to multi point intents |
| 1474 | - Check intents |
| 1475 | - Verify flows |
| 1476 | - Ping hosts |
| 1477 | - Reroute |
| 1478 | - Link down |
| 1479 | - Verify flows |
| 1480 | - Check topology |
| 1481 | - Ping hosts |
| 1482 | - Link up |
| 1483 | - Verify flows |
| 1484 | - Check topology |
| 1485 | - Ping hosts |
| 1486 | - Remove intents |
| 1487 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1488 | if main.initialized == main.FALSE: |
| 1489 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 1490 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1491 | assert main, "There is no main" |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1492 | try: |
| 1493 | assert main.CLIs |
| 1494 | except AssertionError: |
| 1495 | main.log.error( "There is no main.CLIs, skipping test cases" ) |
| 1496 | main.initialized = main.FALSE |
| 1497 | main.skipCase() |
| 1498 | try: |
| 1499 | assert main.Mininet1 |
| 1500 | except AssertionError: |
| 1501 | main.log.error( "Mininet handle should be named Mininet1, skipping test cases" ) |
| 1502 | main.initialized = main.FALSE |
| 1503 | main.skipCase() |
| 1504 | try: |
| 1505 | assert main.numSwitch |
| 1506 | except AssertionError: |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1507 | main.log.error( "Place the total number of switch topology in "+ \ |
| 1508 | main.numSwitch ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1509 | main.initialized = main.FALSE |
| 1510 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1511 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 1512 | main.testName = "Single to Multi Point Intents" |
| 1513 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 1514 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 1515 | main.caseExplanation = "This test case will test single point to" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 1516 | " multi point intents using " +\ |
| 1517 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 1518 | "Different type of hosts will be tested in " +\ |
| 1519 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 1520 | ";\nThe test will use OF " + main.OFProtocol +\ |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 1521 | " OVS running in Mininet and compile intents" +\ |
| 1522 | " using " + main.flowCompiler |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1523 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1524 | main.step( "NOOPTION: Install and test single point to multi point intents" ) |
| 1525 | main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n" |
| 1526 | senders = [ |
| 1527 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1528 | ] |
| 1529 | recipients = [ |
| 1530 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1531 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1532 | ] |
| 1533 | badSenders=[ { "name":"h9" } ] # Senders that are not in the intent |
| 1534 | badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent |
| 1535 | testResult = main.FALSE |
| 1536 | installResult = main.intentFunction.installSingleToMultiIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1537 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1538 | name="NOOPTION", |
| 1539 | senders=senders, |
| 1540 | recipients=recipients, |
| 1541 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1542 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1543 | |
| 1544 | if installResult: |
| 1545 | testResult = main.intentFunction.testPointIntent( |
| 1546 | main, |
| 1547 | intentId=installResult, |
| 1548 | name="NOOPTION", |
| 1549 | senders=senders, |
| 1550 | recipients=recipients, |
| 1551 | badSenders=badSenders, |
| 1552 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1553 | sw1="s5", |
| 1554 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1555 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1556 | else: |
| 1557 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1558 | |
| 1559 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1560 | actual=testResult, |
| 1561 | onpass=main.assertReturnString, |
| 1562 | onfail=main.assertReturnString ) |
| 1563 | |
| 1564 | main.step( "IPV4: Install and test single point to multi point intents" ) |
| 1565 | main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n" |
| 1566 | senders = [ |
| 1567 | { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" } |
| 1568 | ] |
| 1569 | recipients = [ |
| 1570 | { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }, |
| 1571 | { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" } |
| 1572 | ] |
| 1573 | badSenders=[ { "name":"h9" } ] # Senders that are not in the intent |
| 1574 | badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent |
| 1575 | testResult = main.FALSE |
| 1576 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 1577 | main, |
| 1578 | name="IPV4", |
| 1579 | senders=senders, |
| 1580 | recipients=recipients, |
| 1581 | ethType="IPV4", |
| 1582 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1583 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1584 | |
| 1585 | if installResult: |
| 1586 | testResult = main.intentFunction.testPointIntent( |
| 1587 | main, |
| 1588 | intentId=installResult, |
| 1589 | name="IPV4", |
| 1590 | senders=senders, |
| 1591 | recipients=recipients, |
| 1592 | badSenders=badSenders, |
| 1593 | badRecipients=badRecipients, |
| 1594 | sw1="s5", |
| 1595 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1596 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1597 | else: |
| 1598 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1599 | |
| 1600 | utilities.assert_equals( expect=main.TRUE, |
| 1601 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1602 | onpass=main.assertReturnString, |
| 1603 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1604 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1605 | main.step( "IPV4_2: Add single point to multi point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1606 | 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] | 1607 | senders = [ |
| 1608 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1609 | ] |
| 1610 | recipients = [ |
| 1611 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1612 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1613 | ] |
| 1614 | badSenders=[ { "name":"h9" } ] # Senders that are not in the intent |
| 1615 | badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent |
| 1616 | testResult = main.FALSE |
| 1617 | installResult = main.intentFunction.installSingleToMultiIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1618 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1619 | name="IPV4_2", |
| 1620 | senders=senders, |
| 1621 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1622 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1623 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1624 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1625 | |
| 1626 | if installResult: |
| 1627 | testResult = main.intentFunction.testPointIntent( |
| 1628 | main, |
| 1629 | intentId=installResult, |
| 1630 | name="IPV4_2", |
| 1631 | senders=senders, |
| 1632 | recipients=recipients, |
| 1633 | badSenders=badSenders, |
| 1634 | badRecipients=badRecipients, |
| 1635 | sw1="s5", |
| 1636 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1637 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1638 | else: |
| 1639 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1640 | |
| 1641 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1642 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1643 | onpass=main.assertReturnString, |
| 1644 | onfail=main.assertReturnString ) |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1645 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1646 | main.step( "VLAN: Add single point to multi point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1647 | 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] | 1648 | senders = [ |
Jeremy Songster | 832f9e9 | 2016-05-05 14:30:49 -0700 | [diff] [blame] | 1649 | { "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] | 1650 | ] |
| 1651 | recipients = [ |
Jeremy Songster | 832f9e9 | 2016-05-05 14:30:49 -0700 | [diff] [blame] | 1652 | { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C", "vlan":"100" }, |
| 1653 | { "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] | 1654 | ] |
| 1655 | badSenders=[ { "name":"h13" } ] # Senders that are not in the intent |
| 1656 | badRecipients=[ { "name":"h21" } ] # Recipients that are not in the intent |
| 1657 | testResult = main.FALSE |
| 1658 | installResult = main.intentFunction.installSingleToMultiIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1659 | main, |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1660 | name="VLAN", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1661 | senders=senders, |
| 1662 | recipients=recipients, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1663 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1664 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1665 | |
| 1666 | if installResult: |
| 1667 | testResult = main.intentFunction.testPointIntent( |
| 1668 | main, |
| 1669 | intentId=installResult, |
Jeremy Songster | 832f9e9 | 2016-05-05 14:30:49 -0700 | [diff] [blame] | 1670 | name="VLAN", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1671 | senders=senders, |
| 1672 | recipients=recipients, |
| 1673 | badSenders=badSenders, |
| 1674 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1675 | sw1="s5", |
| 1676 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1677 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1678 | else: |
| 1679 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1680 | |
| 1681 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1682 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1683 | onpass=main.assertReturnString, |
| 1684 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1685 | |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1686 | main.step( "VLAN: Add single point to multi point intents" ) |
| 1687 | main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n" |
| 1688 | senders = [ |
| 1689 | { "name":"h5", "vlan":"200" } |
| 1690 | ] |
| 1691 | recipients = [ |
| 1692 | { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C", "vlan":"100" }, |
| 1693 | { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14", "vlan":"100" } |
| 1694 | ] |
| 1695 | badSenders=[ { "name":"h13" } ] # Senders that are not in the intent |
| 1696 | badRecipients=[ { "name":"h21" } ] # Recipients that are not in the intent |
| 1697 | testResult = main.FALSE |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1698 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 1699 | main, |
| 1700 | name="VLAN2", |
| 1701 | senders=senders, |
| 1702 | recipients=recipients, |
| 1703 | sw1="s5", |
| 1704 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1705 | setVlan=100 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1706 | |
| 1707 | if installResult: |
| 1708 | testResult = main.intentFunction.testPointIntent( |
| 1709 | main, |
| 1710 | intentId=installResult, |
| 1711 | name="VLAN2", |
| 1712 | senders=senders, |
| 1713 | recipients=recipients, |
| 1714 | badSenders=badSenders, |
| 1715 | badRecipients=badRecipients, |
| 1716 | sw1="s5", |
| 1717 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1718 | expectedLink=18 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1719 | else: |
| 1720 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1721 | |
| 1722 | utilities.assert_equals( expect=main.TRUE, |
| 1723 | actual=testResult, |
| 1724 | onpass=main.assertReturnString, |
| 1725 | onfail=main.assertReturnString ) |
| 1726 | |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 1727 | # Does not support Single point to multi point encapsulation |
| 1728 | # main.step( "ENCAPSULATION: Install and test single point to multi point intents" ) |
| 1729 | # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n" |
| 1730 | # senders = [ |
| 1731 | # { "name":"h8", "device":"of:0000000000000005/8" } |
| 1732 | # ] |
| 1733 | # recipients = [ |
| 1734 | # { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1735 | # { "name":"h24", "device":"of:0000000000000007/8" } |
| 1736 | # ] |
| 1737 | # badSenders=[ { "name":"h9" } ] # Senders that are not in the intent |
| 1738 | # badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent |
| 1739 | # testResult = main.FALSE |
| 1740 | # installResult = main.intentFunction.installSingleToMultiIntent( |
| 1741 | # main, |
| 1742 | # name="ENCAPSULATION", |
| 1743 | # senders=senders, |
| 1744 | # recipients=recipients, |
| 1745 | # sw1="s5", |
| 1746 | # sw2="s2", |
| 1747 | # encap="VLAN" ) |
| 1748 | # |
| 1749 | # if installResult: |
| 1750 | # testResult = main.intentFunction.testPointIntent( |
| 1751 | # main, |
| 1752 | # intentId=installResult, |
| 1753 | # name="ENCAPSULATION", |
| 1754 | # senders=senders, |
| 1755 | # recipients=recipients, |
| 1756 | # badSenders=badSenders, |
| 1757 | # badRecipients=badRecipients, |
| 1758 | # sw1="s5", |
| 1759 | # sw2="s2", |
| 1760 | # expectedLink=18 ) |
| 1761 | # else: |
| 1762 | # main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 1763 | # |
| 1764 | # utilities.assert_equals( expect=main.TRUE, |
| 1765 | # actual=testResult, |
| 1766 | # onpass=main.assertReturnString, |
| 1767 | # onfail=main.assertReturnString ) |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 1768 | |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 1769 | main.intentFunction.report( main ) |
| 1770 | |
kelvin-onlab | b769f56 | 2015-07-15 17:05:10 -0700 | [diff] [blame] | 1771 | def CASE4000( self, main ): |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1772 | """ |
| 1773 | Add multi point to single point intents |
| 1774 | - Get device ids |
| 1775 | - Add multi point to single point intents |
| 1776 | - Check intents |
| 1777 | - Verify flows |
| 1778 | - Ping hosts |
| 1779 | - Reroute |
| 1780 | - Link down |
| 1781 | - Verify flows |
| 1782 | - Check topology |
| 1783 | - Ping hosts |
| 1784 | - Link up |
| 1785 | - Verify flows |
| 1786 | - Check topology |
| 1787 | - Ping hosts |
| 1788 | - Remove intents |
| 1789 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1790 | if main.initialized == main.FALSE: |
| 1791 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 1792 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1793 | assert main, "There is no main" |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1794 | try: |
| 1795 | assert main.CLIs |
| 1796 | except AssertionError: |
| 1797 | main.log.error( "There is no main.CLIs, skipping test cases" ) |
| 1798 | main.initialized = main.FALSE |
| 1799 | main.skipCase() |
| 1800 | try: |
| 1801 | assert main.Mininet1 |
| 1802 | except AssertionError: |
| 1803 | main.log.error( "Mininet handle should be named Mininet1, skipping test cases" ) |
| 1804 | main.initialized = main.FALSE |
| 1805 | main.skipCase() |
| 1806 | try: |
| 1807 | assert main.numSwitch |
| 1808 | except AssertionError: |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1809 | main.log.error( "Place the total number of switch topology in "+\ |
| 1810 | main.numSwitch ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 1811 | main.initialized = main.FALSE |
| 1812 | main.skipCase() |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1813 | |
kelvin-onlab | 7bb2d97 | 2015-08-05 10:56:16 -0700 | [diff] [blame] | 1814 | main.testName = "Multi To Single Point Intents" |
| 1815 | main.case( main.testName + " Test - " + str( main.numCtrls ) + |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 1816 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jon Hall | 783bbf9 | 2015-07-23 14:33:19 -0700 | [diff] [blame] | 1817 | main.caseExplanation = "This test case will test single point to" +\ |
kelvin-onlab | 6dea6e6 | 2015-07-23 13:07:26 -0700 | [diff] [blame] | 1818 | " multi point intents using " +\ |
| 1819 | str( main.numCtrls ) + " node(s) cluster;\n" +\ |
| 1820 | "Different type of hosts will be tested in " +\ |
| 1821 | "each step such as IPV4, Dual stack, VLAN etc" +\ |
| 1822 | ";\nThe test will use OF " + main.OFProtocol +\ |
Jeremy | 6e9748f | 2016-03-25 15:03:39 -0700 | [diff] [blame] | 1823 | " OVS running in Mininet and compile intents" +\ |
| 1824 | " using " + main.flowCompiler |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1825 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1826 | main.step( "NOOPTION: Add multi point to single point intents" ) |
| 1827 | main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n" |
| 1828 | senders = [ |
| 1829 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1830 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1831 | ] |
| 1832 | recipients = [ |
| 1833 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1834 | ] |
| 1835 | badSenders=[ { "name":"h17" } ] # Senders that are not in the intent |
| 1836 | badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent |
| 1837 | testResult = main.FALSE |
| 1838 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 1839 | main, |
| 1840 | name="NOOPTION", |
| 1841 | senders=senders, |
| 1842 | recipients=recipients, |
| 1843 | sw1="s5", |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1844 | sw2="s2" ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1845 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1846 | if installResult: |
| 1847 | testResult = main.intentFunction.testPointIntent( |
| 1848 | main, |
| 1849 | intentId=installResult, |
| 1850 | name="NOOPTION", |
| 1851 | senders=senders, |
| 1852 | recipients=recipients, |
| 1853 | badSenders=badSenders, |
| 1854 | badRecipients=badRecipients, |
| 1855 | sw1="s5", |
| 1856 | sw2="s2", |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 1857 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1858 | else: |
| 1859 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1860 | |
| 1861 | utilities.assert_equals( expect=main.TRUE, |
| 1862 | actual=testResult, |
| 1863 | onpass=main.assertReturnString, |
| 1864 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1865 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1866 | main.step( "IPV4: Add multi point to single point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1867 | 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] | 1868 | senders = [ |
| 1869 | { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }, |
| 1870 | { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" } |
| 1871 | ] |
| 1872 | recipients = [ |
| 1873 | { "name":"h8", "device":"of:0000000000000005/8", "mac":"00:00:00:00:00:08" } |
| 1874 | ] |
| 1875 | badSenders=[ { "name":"h17" } ] # Senders that are not in the intent |
| 1876 | badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent |
| 1877 | testResult = main.FALSE |
| 1878 | installResult = main.intentFunction.installMultiToSingleIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1879 | main, |
| 1880 | name="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1881 | senders=senders, |
| 1882 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1883 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1884 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1885 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1886 | |
| 1887 | if installResult: |
| 1888 | testResult = main.intentFunction.testPointIntent( |
| 1889 | main, |
| 1890 | intentId=installResult, |
| 1891 | name="IPV4", |
| 1892 | senders=senders, |
| 1893 | recipients=recipients, |
| 1894 | badSenders=badSenders, |
| 1895 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1896 | sw1="s5", |
| 1897 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1898 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1899 | else: |
| 1900 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1901 | |
| 1902 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1903 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1904 | onpass=main.assertReturnString, |
| 1905 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1906 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1907 | main.step( "IPV4_2: Add multi point to single point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1908 | 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] | 1909 | senders = [ |
| 1910 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 1911 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 1912 | ] |
| 1913 | recipients = [ |
| 1914 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 1915 | ] |
| 1916 | badSenders=[ { "name":"h17" } ] # Senders that are not in the intent |
| 1917 | badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent |
| 1918 | testResult = main.FALSE |
| 1919 | installResult = main.intentFunction.installMultiToSingleIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1920 | main, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1921 | name="IPV4_2", |
| 1922 | senders=senders, |
| 1923 | recipients=recipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1924 | ethType="IPV4", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1925 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1926 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1927 | |
| 1928 | if installResult: |
| 1929 | testResult = main.intentFunction.testPointIntent( |
| 1930 | main, |
| 1931 | intentId=installResult, |
| 1932 | name="IPV4_2", |
| 1933 | senders=senders, |
| 1934 | recipients=recipients, |
| 1935 | badSenders=badSenders, |
| 1936 | badRecipients=badRecipients, |
| 1937 | sw1="s5", |
| 1938 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1939 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1940 | else: |
| 1941 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1942 | |
| 1943 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1944 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1945 | onpass=main.assertReturnString, |
| 1946 | onfail=main.assertReturnString ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1947 | |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1948 | main.step( "VLAN: Add multi point to single point intents" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1949 | 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] | 1950 | senders = [ |
Jeremy Songster | 832f9e9 | 2016-05-05 14:30:49 -0700 | [diff] [blame] | 1951 | { "name":"h13", "device":"of:0000000000000006/5", "vlan":"200" }, |
| 1952 | { "name":"h21", "device":"of:0000000000000007/5", "vlan":"200" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1953 | ] |
| 1954 | recipients = [ |
Jeremy Songster | 832f9e9 | 2016-05-05 14:30:49 -0700 | [diff] [blame] | 1955 | { "name":"h5", "device":"of:0000000000000005/5", "vlan":"200" } |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1956 | ] |
| 1957 | badSenders=[ { "name":"h12" } ] # Senders that are not in the intent |
| 1958 | badRecipients=[ { "name":"h20" } ] # Recipients that are not in the intent |
| 1959 | testResult = main.FALSE |
| 1960 | installResult = main.intentFunction.installMultiToSingleIntent( |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1961 | main, |
| 1962 | name="VLAN", |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1963 | senders=senders, |
| 1964 | recipients=recipients, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1965 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1966 | sw2="s2" ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1967 | |
| 1968 | if installResult: |
| 1969 | testResult = main.intentFunction.testPointIntent( |
| 1970 | main, |
| 1971 | intentId=installResult, |
| 1972 | name="VLAN", |
| 1973 | senders=senders, |
| 1974 | recipients=recipients, |
| 1975 | badSenders=badSenders, |
| 1976 | badRecipients=badRecipients, |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1977 | sw1="s5", |
| 1978 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 1979 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 1980 | else: |
| 1981 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | d48a68c | 2015-07-13 16:01:36 -0700 | [diff] [blame] | 1982 | |
| 1983 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 1984 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 1985 | onpass=main.assertReturnString, |
| 1986 | onfail=main.assertReturnString ) |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 1987 | |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 1988 | # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383 |
| 1989 | main.step( "VLAN: Add multi point to single point intents" ) |
| 1990 | main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n" |
| 1991 | senders = [ |
| 1992 | { "name":"h13", "device":"of:0000000000000006/5", "vlan":"200" }, |
| 1993 | { "name":"h21", "device":"of:0000000000000007/5", "vlan":"200" } |
| 1994 | ] |
| 1995 | recipients = [ |
| 1996 | { "name":"h4", "vlan":"100" } |
| 1997 | ] |
| 1998 | badSenders=[ { "name":"h12" } ] # Senders that are not in the intent |
| 1999 | badRecipients=[ { "name":"h20" } ] # Recipients that are not in the intent |
| 2000 | testResult = main.FALSE |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 2001 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 2002 | main, |
| 2003 | name="VLAN2", |
| 2004 | senders=senders, |
| 2005 | recipients=recipients, |
| 2006 | sw1="s5", |
| 2007 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 2008 | setVlan=100 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 2009 | |
| 2010 | if installResult: |
| 2011 | testResult = main.intentFunction.testPointIntent( |
| 2012 | main, |
| 2013 | intentId=installResult, |
| 2014 | name="VLAN2", |
| 2015 | senders=senders, |
| 2016 | recipients=recipients, |
| 2017 | badSenders=badSenders, |
| 2018 | badRecipients=badRecipients, |
| 2019 | sw1="s5", |
| 2020 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 2021 | expectedLink=18 ) |
Jeremy Songster | ff55367 | 2016-05-12 17:06:23 -0700 | [diff] [blame] | 2022 | else: |
| 2023 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 2024 | |
| 2025 | utilities.assert_equals( expect=main.TRUE, |
| 2026 | actual=testResult, |
| 2027 | onpass=main.assertReturnString, |
| 2028 | onfail=main.assertReturnString ) |
| 2029 | |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 2030 | main.step( "ENCAPSULATION: Add multi point to single point intents" ) |
| 2031 | main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n" |
| 2032 | senders = [ |
| 2033 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 2034 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 2035 | ] |
| 2036 | recipients = [ |
| 2037 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 2038 | ] |
| 2039 | badSenders=[ { "name":"h17" } ] # Senders that are not in the intent |
| 2040 | badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent |
| 2041 | testResult = main.FALSE |
Jeremy Songster | c032f16 | 2016-08-04 17:14:49 -0700 | [diff] [blame] | 2042 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 2043 | main, |
| 2044 | name="ENCAPSULATION", |
| 2045 | senders=senders, |
| 2046 | recipients=recipients, |
| 2047 | sw1="s5", |
| 2048 | sw2="s2", |
| 2049 | encap="VLAN" ) |
| 2050 | |
| 2051 | if installResult: |
| 2052 | testResult = main.intentFunction.testPointIntent( |
| 2053 | main, |
| 2054 | intentId=installResult, |
| 2055 | name="ENCAPSULATION", |
| 2056 | senders=senders, |
| 2057 | recipients=recipients, |
| 2058 | badSenders=badSenders, |
| 2059 | badRecipients=badRecipients, |
| 2060 | sw1="s5", |
| 2061 | sw2="s2", |
| 2062 | expectedLink=18 ) |
| 2063 | else: |
| 2064 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 2065 | |
| 2066 | utilities.assert_equals( expect=main.TRUE, |
| 2067 | actual=testResult, |
| 2068 | onpass=main.assertReturnString, |
| 2069 | onfail=main.assertReturnString ) |
| 2070 | |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 2071 | # Testing MPLS would need to update kernel version (Right now is 3.16) |
| 2072 | # main.step( "ENCAPSULATION: Add multi point to single point intents" ) |
| 2073 | # main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n" |
| 2074 | # senders = [ |
| 2075 | # { "name": "h16", "device": "of:0000000000000006/8" }, |
| 2076 | # { "name": "h24", "device": "of:0000000000000007/8" } |
| 2077 | # ] |
| 2078 | # recipients = [ |
| 2079 | # { "name": "h8", "device": "of:0000000000000005/8" } |
| 2080 | # ] |
| 2081 | # badSenders = [ { "name": "h17" } ] # Senders that are not in the intent |
| 2082 | # badRecipients = [ {"name": "h9" } ] # Recipients that are not in the intent |
| 2083 | # testResult = main.FALSE |
| 2084 | # installResult = main.intentFunction.installMultiToSingleIntent( |
| 2085 | # main, |
| 2086 | # name="ENCAPSULATION", |
| 2087 | # senders=senders, |
| 2088 | # recipients=recipients, |
| 2089 | # sw1="s5", |
| 2090 | # sw2="s2", |
| 2091 | # encap="MPLS" ) |
| 2092 | # |
| 2093 | # if installResult: |
| 2094 | # testResult = main.intentFunction.testPointIntent( |
| 2095 | # main, |
| 2096 | # intentId=installResult, |
| 2097 | # name="ENCAPSULATION", |
| 2098 | # senders=senders, |
| 2099 | # recipients=recipients, |
| 2100 | # badSenders=badSenders, |
| 2101 | # badRecipients=badRecipients, |
| 2102 | # sw1="s5", |
| 2103 | # sw2="s2", |
| 2104 | # expectedLink=18 ) |
| 2105 | # else: |
| 2106 | # main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 2107 | # |
| 2108 | # utilities.assert_equals( expect=main.TRUE, |
| 2109 | # actual=testResult, |
| 2110 | # onpass=main.assertReturnString, |
| 2111 | # onfail=main.assertReturnString ) |
| 2112 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 2113 | main.intentFunction.report( main ) |
| 2114 | |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 2115 | def CASE5000( self, main ): |
| 2116 | """ |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 2117 | Tests Host Mobility |
| 2118 | Modifies the topology location of h1 |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 2119 | """ |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 2120 | if main.initialized == main.FALSE: |
| 2121 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 2122 | main.skipCase() |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 2123 | assert main, "There is no main" |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 2124 | try: |
| 2125 | assert main.CLIs |
| 2126 | except AssertionError: |
| 2127 | main.log.error( "There is no main.CLIs, skipping test cases" ) |
| 2128 | main.initialized = main.FALSE |
| 2129 | main.skipCase() |
| 2130 | try: |
| 2131 | assert main.Mininet1 |
| 2132 | except AssertionError: |
| 2133 | main.log.error( "Mininet handle should be named Mininet1, skipping test cases" ) |
| 2134 | main.initialized = main.FALSE |
| 2135 | main.skipCase() |
| 2136 | try: |
| 2137 | assert main.numSwitch |
| 2138 | except AssertionError: |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 2139 | main.log.error( "Place the total number of switch topology in "+\ |
| 2140 | main.numSwitch ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 2141 | main.initialized = main.FALSE |
| 2142 | main.skipCase() |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 2143 | main.case( "Test host mobility with host intents " + " - " + str( main.numCtrls ) + |
| 2144 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 2145 | main.step( "Testing host mobility by moving h1 from s5 to s6" ) |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 2146 | |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 2147 | main.log.info( "Moving h1 from s5 to s6" ) |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 2148 | main.Mininet1.moveHost( "h1","s5","s6" ) |
| 2149 | |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 2150 | # Send discovery ping from moved host |
| 2151 | # Moving the host brings down the default interfaces and creates a new one. |
| 2152 | # Scapy is restarted on this host to detect the new interface |
| 2153 | main.h1.stopScapy() |
| 2154 | main.h1.startScapy() |
| 2155 | |
| 2156 | # Discover new host location in ONOS and populate host data. |
| 2157 | # Host 1 IP and MAC should be unchanged |
| 2158 | main.intentFunction.sendDiscoveryArp( main, [ main.h1 ] ) |
| 2159 | main.intentFunction.populateHostData( main ) |
| 2160 | |
acsmars | 1ff5e05 | 2015-07-23 11:27:48 -0700 | [diff] [blame] | 2161 | h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ] |
| 2162 | |
| 2163 | utilities.assert_equals( expect="of:0000000000000006", |
| 2164 | actual=h1PostMove, |
| 2165 | onpass="Mobility: Successfully moved h1 to s6", |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 2166 | onfail="Mobility: Failed to move h1 to s6" + |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 2167 | " to single point intents" + |
| 2168 | " with IPV4 type and MAC addresses" + |
| 2169 | " in the same VLAN" ) |
| 2170 | |
| 2171 | main.step( "IPV4: Add host intents between h1 and h9" ) |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 2172 | 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] | 2173 | host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" } |
| 2174 | host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" } |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 2175 | testResult = main.FALSE |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 2176 | installResult = main.intentFunction.installHostIntent( main, |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 2177 | name="IPV4 Mobility IPV4", |
| 2178 | onosNode=0, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 2179 | host1=host1, |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2180 | host2=host2 ) |
Jeremy | 2f190ca | 2016-01-29 15:23:57 -0800 | [diff] [blame] | 2181 | if installResult: |
| 2182 | testResult = main.intentFunction.testHostIntent( main, |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 2183 | name="Host Mobility IPV4", |
Jeremy | 2f190ca | 2016-01-29 15:23:57 -0800 | [diff] [blame] | 2184 | intentId = installResult, |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 2185 | onosNode=0, |
Jeremy | 2f190ca | 2016-01-29 15:23:57 -0800 | [diff] [blame] | 2186 | host1=host1, |
| 2187 | host2=host2, |
| 2188 | sw1="s6", |
| 2189 | sw2="s2", |
| 2190 | expectedLink=18 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 2191 | else: |
| 2192 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
kelvin-onlab | f34a58a | 2015-07-23 16:41:52 -0700 | [diff] [blame] | 2193 | |
| 2194 | utilities.assert_equals( expect=main.TRUE, |
Jeremy Songster | 1f39bf0 | 2016-01-20 17:17:25 -0800 | [diff] [blame] | 2195 | actual=testResult, |
acsmars | 5d8cc86 | 2015-09-25 09:44:50 -0700 | [diff] [blame] | 2196 | onpass=main.assertReturnString, |
| 2197 | onfail=main.assertReturnString ) |
kelvin-onlab | 016dce2 | 2015-08-10 09:54:11 -0700 | [diff] [blame] | 2198 | |
| 2199 | main.intentFunction.report( main ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2200 | |
| 2201 | def CASE6000( self, main ): |
| 2202 | """ |
| 2203 | Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure |
| 2204 | """ |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2205 | # At some later point discussion on this behavior in MPSP and SPMP intents |
| 2206 | # will be reoppened and this test case may need to be updated to reflect |
| 2207 | # the outcomes of that discussion |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 2208 | if main.initialized == main.FALSE: |
| 2209 | main.log.error( "Test components did not start correctly, skipping further tests" ) |
| 2210 | main.skipCase() |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2211 | assert main, "There is no main" |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 2212 | try: |
| 2213 | assert main.CLIs |
| 2214 | except AssertionError: |
| 2215 | main.log.error( "There is no main.CLIs, skipping test cases" ) |
| 2216 | main.initialized = main.FALSE |
| 2217 | main.skipCase() |
| 2218 | try: |
| 2219 | assert main.Mininet1 |
| 2220 | except AssertionError: |
| 2221 | main.log.error( "Mininet handle should be named Mininet1, skipping test cases" ) |
| 2222 | main.initialized = main.FALSE |
| 2223 | main.skipCase() |
| 2224 | try: |
| 2225 | assert main.numSwitch |
| 2226 | except AssertionError: |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 2227 | main.log.error( "Place the total number of switch topology in " + main.numSwitch ) |
Jeremy | d9e4eb1 | 2016-04-13 12:09:06 -0700 | [diff] [blame] | 2228 | main.initialized = main.FALSE |
| 2229 | main.skipCase() |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 2230 | main.case( "Test Multi to Single End Point Failure" + " - " + str( main.numCtrls ) + |
| 2231 | " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler ) |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2232 | main.step( "Installing Multi to Single Point intents with no options set" ) |
| 2233 | main.assertReturnString = "Assertion results for IPV4 multi to single " +\ |
| 2234 | "point intent end point failure with no options set\n" |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2235 | senders = [ |
| 2236 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 2237 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 2238 | ] |
| 2239 | recipients = [ |
| 2240 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 2241 | ] |
| 2242 | isolatedSenders = [ |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 2243 | { "name":"h24" } |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2244 | ] |
| 2245 | isolatedRecipients = [] |
| 2246 | testResult = main.FALSE |
| 2247 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 2248 | main, |
| 2249 | name="NOOPTION", |
| 2250 | senders=senders, |
| 2251 | recipients=recipients, |
| 2252 | sw1="s5", |
| 2253 | sw2="s2" ) |
| 2254 | |
| 2255 | if installResult: |
| 2256 | testResult = main.intentFunction.testEndPointFail( |
| 2257 | main, |
| 2258 | intentId=installResult, |
| 2259 | name="NOOPTION", |
| 2260 | senders=senders, |
| 2261 | recipients=recipients, |
| 2262 | isolatedSenders=isolatedSenders, |
| 2263 | isolatedRecipients=isolatedRecipients, |
| 2264 | sw1="s6", |
| 2265 | sw2="s2", |
| 2266 | sw3="s4", |
| 2267 | sw4="s1", |
| 2268 | sw5="s3", |
| 2269 | expectedLink1=16, |
| 2270 | expectedLink2=14 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 2271 | else: |
| 2272 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2273 | |
| 2274 | utilities.assert_equals( expect=main.TRUE, |
| 2275 | actual=testResult, |
| 2276 | onpass=main.assertReturnString, |
| 2277 | onfail=main.assertReturnString ) |
| 2278 | |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2279 | main.step( "Installing Multi to Single Point intents with partial failure allowed" ) |
| 2280 | |
| 2281 | main.assertReturnString = "Assertion results for IPV4 multi to single " +\ |
| 2282 | "with partial failures allowed\n" |
| 2283 | senders = [ |
| 2284 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 2285 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 2286 | ] |
| 2287 | recipients = [ |
| 2288 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 2289 | ] |
| 2290 | isolatedSenders = [ |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 2291 | { "name":"h24" } |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2292 | ] |
| 2293 | isolatedRecipients = [] |
| 2294 | testResult = main.FALSE |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2295 | installResult = main.intentFunction.installMultiToSingleIntent( |
| 2296 | main, |
| 2297 | name="NOOPTION", |
| 2298 | senders=senders, |
| 2299 | recipients=recipients, |
| 2300 | sw1="s5", |
| 2301 | sw2="s2", |
| 2302 | partial=True ) |
| 2303 | |
| 2304 | if installResult: |
| 2305 | testResult = main.intentFunction.testEndPointFail( |
| 2306 | main, |
| 2307 | intentId=installResult, |
| 2308 | name="NOOPTION", |
| 2309 | senders=senders, |
| 2310 | recipients=recipients, |
| 2311 | isolatedSenders=isolatedSenders, |
| 2312 | isolatedRecipients=isolatedRecipients, |
| 2313 | sw1="s6", |
| 2314 | sw2="s2", |
| 2315 | sw3="s4", |
| 2316 | sw4="s1", |
| 2317 | sw5="s3", |
| 2318 | expectedLink1=16, |
| 2319 | expectedLink2=14, |
| 2320 | partial=True ) |
| 2321 | else: |
| 2322 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 2323 | |
| 2324 | utilities.assert_equals( expect=main.TRUE, |
| 2325 | actual=testResult, |
| 2326 | onpass=main.assertReturnString, |
| 2327 | onfail=main.assertReturnString ) |
| 2328 | |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2329 | main.step( "NOOPTION: Install and test single point to multi point intents" ) |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2330 | main.assertReturnString = "Assertion results for IPV4 single to multi " +\ |
| 2331 | "point intent with no options set\n" |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2332 | senders = [ |
| 2333 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 2334 | ] |
| 2335 | recipients = [ |
| 2336 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 2337 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 2338 | ] |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2339 | isolatedSenders = [] |
| 2340 | isolatedRecipients = [ |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 2341 | { "name":"h24" } |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2342 | ] |
| 2343 | testResult = main.FALSE |
| 2344 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 2345 | main, |
| 2346 | name="NOOPTION", |
| 2347 | senders=senders, |
| 2348 | recipients=recipients, |
| 2349 | sw1="s5", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 2350 | sw2="s2" ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2351 | |
| 2352 | if installResult: |
| 2353 | testResult = main.intentFunction.testEndPointFail( |
| 2354 | main, |
| 2355 | intentId=installResult, |
| 2356 | name="NOOPTION", |
| 2357 | senders=senders, |
| 2358 | recipients=recipients, |
| 2359 | isolatedSenders=isolatedSenders, |
| 2360 | isolatedRecipients=isolatedRecipients, |
| 2361 | sw1="s6", |
| 2362 | sw2="s2", |
| 2363 | sw3="s4", |
| 2364 | sw4="s1", |
| 2365 | sw5="s3", |
| 2366 | expectedLink1=16, |
| 2367 | expectedLink2=14 ) |
Jeremy | 42df2e7 | 2016-02-23 16:37:46 -0800 | [diff] [blame] | 2368 | else: |
| 2369 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2370 | |
| 2371 | utilities.assert_equals( expect=main.TRUE, |
| 2372 | actual=testResult, |
| 2373 | onpass=main.assertReturnString, |
| 2374 | onfail=main.assertReturnString ) |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2375 | # Right now this functionality doesn't work properly in SPMP intents |
| 2376 | main.step( "NOOPTION: Install and test single point to multi point " +\ |
| 2377 | "intents with partial failures allowed" ) |
| 2378 | main.assertReturnString = "Assertion results for IPV4 single to multi " +\ |
| 2379 | "point intent with partial failures allowed\n" |
| 2380 | senders = [ |
| 2381 | { "name":"h8", "device":"of:0000000000000005/8" } |
| 2382 | ] |
| 2383 | recipients = [ |
| 2384 | { "name":"h16", "device":"of:0000000000000006/8" }, |
| 2385 | { "name":"h24", "device":"of:0000000000000007/8" } |
| 2386 | ] |
| 2387 | isolatedSenders = [] |
| 2388 | isolatedRecipients = [ |
alison | 52b2589 | 2016-09-19 10:53:48 -0700 | [diff] [blame] | 2389 | { "name":"h24" } |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2390 | ] |
| 2391 | testResult = main.FALSE |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2392 | installResult = main.intentFunction.installSingleToMultiIntent( |
| 2393 | main, |
| 2394 | name="NOOPTION", |
| 2395 | senders=senders, |
| 2396 | recipients=recipients, |
| 2397 | sw1="s5", |
| 2398 | sw2="s2", |
Jeremy Songster | e7f3b34 | 2016-08-17 14:56:49 -0700 | [diff] [blame] | 2399 | partial=True ) |
Jeremy Songster | 9385d41 | 2016-06-02 17:57:36 -0700 | [diff] [blame] | 2400 | |
| 2401 | if installResult: |
| 2402 | testResult = main.intentFunction.testEndPointFail( |
| 2403 | main, |
| 2404 | intentId=installResult, |
| 2405 | name="NOOPTION", |
| 2406 | senders=senders, |
| 2407 | recipients=recipients, |
| 2408 | isolatedSenders=isolatedSenders, |
| 2409 | isolatedRecipients=isolatedRecipients, |
| 2410 | sw1="s6", |
| 2411 | sw2="s2", |
| 2412 | sw3="s4", |
| 2413 | sw4="s1", |
| 2414 | sw5="s3", |
| 2415 | expectedLink1=16, |
| 2416 | expectedLink2=14, |
| 2417 | partial=True ) |
| 2418 | else: |
| 2419 | main.CLIs[ 0 ].removeAllIntents( purge=True ) |
| 2420 | |
| 2421 | utilities.assert_equals( expect=main.TRUE, |
| 2422 | actual=testResult, |
| 2423 | onpass=main.assertReturnString, |
| 2424 | onfail=main.assertReturnString ) |
Jeremy | e0cb5eb | 2016-01-27 17:39:09 -0800 | [diff] [blame] | 2425 | |
Chiyu Cheng | ef10950 | 2016-11-21 15:51:38 -0800 | [diff] [blame] | 2426 | main.intentFunction.report( main ) |