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