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