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