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