Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 1 | """ |
| 2 | Copyright 2015 Open Networking Foundation (ONF) |
| 3 | |
| 4 | Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 5 | the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 6 | or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
| 7 | |
| 8 | TestON is free software: you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation, either version 2 of the License, or |
| 11 | (at your option) any later version. |
| 12 | |
| 13 | TestON is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
| 20 | """ |
| 21 | |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 22 | # Testing the basic intent for ipv6 functionality of ONOS |
| 23 | |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 24 | |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 25 | class FUNCipv6Intent: |
| 26 | |
| 27 | def __init__( self ): |
| 28 | self.default = '' |
| 29 | |
| 30 | def CASE1( self, main ): |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 31 | import imp |
| 32 | import re |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 33 | """ |
| 34 | - Construct tests variables |
| 35 | - GIT ( optional ) |
| 36 | - Checkout ONOS master branch |
| 37 | - Pull latest ONOS code |
| 38 | - Building ONOS ( optional ) |
| 39 | - Install ONOS package |
| 40 | - Build ONOS package |
| 41 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 42 | try: |
| 43 | from tests.dependencies.ONOSSetup import ONOSSetup |
| 44 | main.testSetUp = ONOSSetup() |
| 45 | except ImportError: |
| 46 | main.log.error( "ONOSSetup not found. exiting the test" ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 47 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 48 | main.testSetUp.envSetupDescription() |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 49 | stepResult = main.FALSE |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 50 | # Test variables |
| 51 | try: |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 52 | main.apps = main.params[ 'ENV' ][ 'cellApps' ] |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 53 | main.dependencyPath = main.testOnDirectory + \ |
| 54 | main.params[ 'DEPENDENCY' ][ 'path' ] |
| 55 | main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 56 | main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," ) |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 57 | wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ] |
| 58 | wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ] |
| 59 | wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ] |
| 60 | main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) |
| 61 | main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] ) |
| 62 | main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] ) |
| 63 | main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] ) |
| 64 | main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] ) |
| 65 | main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] ) |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 66 | main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] ) |
| 67 | main.numLinks = int( main.params[ 'MININET' ][ 'links' ] ) |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 68 | main.hostsData = {} |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 69 | main.assertReturnString = '' # Assembled assert return string |
| 70 | |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 71 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 72 | |
| 73 | main.intentFunction = imp.load_source( wrapperFile2, |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 74 | main.dependencyPath + |
| 75 | wrapperFile2 + |
| 76 | ".py" ) |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 77 | |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 78 | copyResult1 = main.ONOSbench.scp( main.Mininet1, |
| 79 | main.dependencyPath + |
| 80 | main.topology, |
| 81 | main.Mininet1.home, |
| 82 | direction="to" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 83 | stepResult = main.testSetUp.envSetup() |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 84 | except Exception as e: |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 85 | main.testSetUp.envSetupException( e ) |
| 86 | main.testSetUp.evnSetupConclusion( stepResult ) |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 87 | |
| 88 | def CASE2( self, main ): |
| 89 | """ |
| 90 | - Set up cell |
| 91 | - Create cell file |
| 92 | - Set cell file |
| 93 | - Verify cell file |
| 94 | - Kill ONOS process |
| 95 | - Uninstall ONOS cluster |
| 96 | - Verify ONOS start up |
| 97 | - Install ONOS cluster |
| 98 | - Connect to cli |
| 99 | """ |
alison | a2905c1 | 2016-09-19 15:18:07 -0700 | [diff] [blame] | 100 | import time |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 101 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 102 | main.initialized = main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True ) |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 103 | |
Jon Hall | 11845ed | 2016-02-11 11:25:31 -0800 | [diff] [blame] | 104 | main.step( "Checking that ONOS is ready" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 105 | |
| 106 | ready = utilities.retry( main.Cluster.command, |
| 107 | False, |
| 108 | kwargs={ "function":"summary", "contentCheck":True }, |
| 109 | sleep=30, |
| 110 | attempts=3 ) |
Jon Hall | 11845ed | 2016-02-11 11:25:31 -0800 | [diff] [blame] | 111 | utilities.assert_equals( expect=True, actual=ready, |
| 112 | onpass="ONOS summary command succeded", |
| 113 | onfail="ONOS summary command failed" ) |
| 114 | if not ready: |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 115 | main.cleanAndExit() |
| 116 | main.cleanAndExit() |
Jon Hall | 11845ed | 2016-02-11 11:25:31 -0800 | [diff] [blame] | 117 | |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 118 | main.step( "setup the ipv6NeighbourDiscovery" ) |
You Wang | 6ce33b0 | 2017-08-08 13:05:09 -0700 | [diff] [blame] | 119 | cfgResult1 = main.Cluster.active( 0 ).CLI.setCfg( "org.onosproject.net.neighbour.impl.NeighbourResolutionManager", "ndpEnabled", "true" ) |
| 120 | cfgResult2 = main.Cluster.active( 0 ).CLI.setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "requestIpv6ND", "true" ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 121 | cfgResult = cfgResult1 and cfgResult2 |
| 122 | utilities.assert_equals( expect=main.TRUE, actual=cfgResult, |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 123 | onpass="ipv6NeighborDiscovery cfg is set to true", |
| 124 | onfail="Failed to cfg set ipv6NeighborDiscovery" ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 125 | |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 126 | main.intentFunction.report( main ) |
| 127 | |
| 128 | def CASE11( self, main ): |
| 129 | """ |
| 130 | Start Mininet topology with OF 1.3 switches |
| 131 | """ |
| 132 | main.OFProtocol = "1.3" |
| 133 | main.log.report( "Start Mininet topology with OF 1.3 switches" ) |
| 134 | main.case( "Start Mininet topology with OF 1.3 switches" ) |
| 135 | main.caseExplanation = "Start mininet topology with OF 1.3 " +\ |
| 136 | "switches to test intents, exits out if " +\ |
| 137 | "topology did not start correctly" |
| 138 | |
| 139 | main.step( "Starting Mininet topology with OF 1.3 switches" ) |
| 140 | args = "--switch ovs,protocols=OpenFlow13" |
| 141 | topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath + |
| 142 | main.topology, |
| 143 | args=args ) |
| 144 | stepResult = topoResult |
| 145 | utilities.assert_equals( expect=main.TRUE, |
| 146 | actual=stepResult, |
| 147 | onpass="Successfully loaded topology", |
| 148 | onfail="Failed to load topology" ) |
| 149 | # Exit if topology did not load properly |
| 150 | if not topoResult: |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 151 | main.cleanAndExit() |
| 152 | main.cleanAndExit() |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 153 | |
| 154 | def CASE12( self, main ): |
| 155 | """ |
| 156 | Assign mastership to controllers |
| 157 | """ |
| 158 | import re |
| 159 | |
| 160 | main.case( "Assign switches to controllers" ) |
| 161 | main.step( "Assigning switches to controllers" ) |
| 162 | main.caseExplanation = "Assign OF " + main.OFProtocol +\ |
| 163 | " switches to ONOS nodes" |
| 164 | |
| 165 | assignResult = main.TRUE |
| 166 | switchList = [] |
| 167 | |
| 168 | # Creates a list switch name, use getSwitch() function later... |
| 169 | for i in range( 1, ( main.numSwitch + 1 ) ): |
| 170 | switchList.append( 's' + str( i ) ) |
| 171 | |
| 172 | tempONOSip = [] |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 173 | for ctrl in main.Cluster.active(): |
| 174 | tempONOSip.append( ctrl.ipAddress ) |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 175 | |
| 176 | assignResult = main.Mininet1.assignSwController( sw=switchList, |
| 177 | ip=tempONOSip, |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 178 | port='6633' ) |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 179 | if not assignResult: |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 180 | main.cleanAndExit() |
| 181 | main.cleanAndExit() |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 182 | |
| 183 | for i in range( 1, ( main.numSwitch + 1 ) ): |
| 184 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 185 | print( "Response is " + str( response ) ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 186 | if re.search( "tcp:" + main.Cluster.active( 0 ).ipAddress, response ): |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 187 | assignResult = assignResult and main.TRUE |
| 188 | else: |
| 189 | assignResult = main.FALSE |
| 190 | stepResult = assignResult |
| 191 | utilities.assert_equals( expect=main.TRUE, |
| 192 | actual=stepResult, |
| 193 | onpass="Successfully assigned switches" + |
| 194 | "to controller", |
| 195 | onfail="Failed to assign switches to " + |
| 196 | "controller" ) |
| 197 | |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 198 | def CASE13( self, main ): |
| 199 | """ |
| 200 | Discover all hosts and store its data to a dictionary |
| 201 | """ |
| 202 | main.case( "Discover all hosts" ) |
| 203 | |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 204 | main.step( "Discover all hosts using pingall " ) |
| 205 | stepResult = main.intentFunction.getHostsData( main ) |
| 206 | utilities.assert_equals( expect=main.TRUE, |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 207 | actual=stepResult, |
| 208 | onpass="Successfully discovered hosts", |
| 209 | onfail="Failed to discover hosts" ) |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 210 | |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 211 | def CASE16( self, main ): |
| 212 | """ |
| 213 | Balance Masters |
| 214 | """ |
| 215 | main.case( "Balance mastership of switches" ) |
| 216 | main.step( "Balancing mastership of switches" ) |
| 217 | |
| 218 | balanceResult = main.FALSE |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 219 | balanceResult = utilities.retry( f=main.Cluster.active( 0 ).CLI.balanceMasters, retValue=main.FALSE, args=[] ) |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 220 | |
| 221 | utilities.assert_equals( expect=main.TRUE, |
| 222 | actual=balanceResult, |
| 223 | onpass="Successfully balanced mastership of switches", |
| 224 | onfail="Failed to balance mastership of switches" ) |
| 225 | |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 226 | def CASE14( self, main ): |
| 227 | """ |
| 228 | Stop mininet |
| 229 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 230 | try: |
| 231 | from tests.dependencies.utils import Utils |
| 232 | except ImportError: |
| 233 | main.log.error( "Utils not found exiting the test" ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 234 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 235 | try: |
| 236 | main.Utils |
| 237 | except ( NameError, AttributeError ): |
| 238 | main.Utils = Utils() |
| 239 | main.Utils.mininetCleanIntro() |
| 240 | topoResult = main.Utils.mininetCleanup( main.Mininet1 ) |
Subhash Kumar Singh | c73b3a7 | 2015-11-03 21:34:04 -0800 | [diff] [blame] | 241 | # Exit if topology did not load properly |
| 242 | if not topoResult: |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 243 | main.cleanAndExit() |
| 244 | main.cleanAndExit() |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 245 | |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 246 | def CASE1000( self, main ): |
| 247 | """ |
| 248 | Add host intents between 2 host: |
| 249 | - Discover hosts |
| 250 | - Add host intents |
| 251 | - Check intents |
| 252 | - Verify flows |
| 253 | - Ping hosts |
| 254 | - Reroute |
| 255 | - Link down |
| 256 | - Verify flows |
| 257 | - Check topology |
| 258 | - Ping hosts |
| 259 | - Link up |
| 260 | - Verify flows |
| 261 | - Check topology |
| 262 | - Ping hosts |
| 263 | - Remove intents |
| 264 | """ |
| 265 | import time |
| 266 | import json |
| 267 | import re |
| 268 | |
| 269 | # Assert variables - These variable's name|format must be followed |
| 270 | # if you want to use the wrapper function |
| 271 | assert main, "There is no main" |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 272 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 273 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 274 | main.numSwitch" |
| 275 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 276 | intentLeadersOld = main.Cluster.active( 0 ).CLI.leaderCandidates() |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 277 | |
| 278 | main.testName = "Host Intents" |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 279 | main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) + |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 280 | " NODE(S) - OF " + main.OFProtocol ) |
| 281 | main.caseExplanation = "This test case tests Host intents using " +\ |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 282 | str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\ |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 283 | "Different type of hosts will be tested in " +\ |
| 284 | "each step such as IPV6, Dual stack, VLAN " +\ |
| 285 | "etc;\nThe test will use OF " + main.OFProtocol\ |
| 286 | + " OVS running in Mininet" |
| 287 | |
| 288 | main.step( "IPV6: Add host intents between h1 and h9" ) |
| 289 | stepResult = main.TRUE |
| 290 | stepResult = main.intentFunction.hostIntent( main, |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 291 | name='IPV6', |
| 292 | host1='h1', |
| 293 | host2='h9', |
| 294 | host1Id='00:00:00:00:00:01/-1', |
| 295 | host2Id='00:00:00:00:00:09/-1', |
| 296 | sw1='s5', |
| 297 | sw2='s2', |
| 298 | expectedLink=18 ) |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 299 | |
| 300 | utilities.assert_equals( expect=main.TRUE, |
| 301 | actual=stepResult, |
| 302 | onpass="IPV6: Host intent test successful " + |
| 303 | "between two IPV6 hosts", |
| 304 | onfail="IPV6: Host intent test failed " + |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 305 | "between two IPV6 hosts" ) |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 306 | |
| 307 | main.step( "DUALSTACK1: Add host intents between h3 and h11" ) |
| 308 | stepResult = main.TRUE |
| 309 | stepResult = main.intentFunction.hostIntent( main, |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 310 | name='DUALSTACK', |
| 311 | host1='h3', |
| 312 | host2='h11', |
| 313 | host1Id='00:00:00:00:00:03/-1', |
| 314 | host2Id='00:00:00:00:00:0B/-1', |
| 315 | sw1='s5', |
| 316 | sw2='s2', |
| 317 | expectedLink=18 ) |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 318 | |
| 319 | utilities.assert_equals( expect=main.TRUE, |
| 320 | actual=stepResult, |
| 321 | onpass="DUALSTACK: Host intent test " + |
| 322 | "successful between two " + |
| 323 | "dual stack host using IPV6", |
| 324 | onfail="DUALSTACK: Host intent test " + |
| 325 | "failed between two" + |
| 326 | "dual stack host using IPV6" ) |
| 327 | |
| 328 | main.step( "1HOP: Add host intents between h1 and h3" ) |
| 329 | stepResult = main.TRUE |
| 330 | stepResult = main.intentFunction.hostIntent( main, |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 331 | name='1HOP', |
| 332 | host1='h1', |
| 333 | host2='h9', |
| 334 | host1Id='00:00:00:00:00:01/-1', |
| 335 | host2Id='00:00:00:00:00:09/-1' ) |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 336 | |
| 337 | utilities.assert_equals( expect=main.TRUE, |
| 338 | actual=stepResult, |
| 339 | onpass="1HOP: Host intent test " + |
| 340 | "successful between two " + |
| 341 | "host using IPV6 in the same switch", |
| 342 | onfail="1HOP: Host intent test " + |
| 343 | "failed between two" + |
| 344 | "host using IPV6 in the same switch" ) |
| 345 | |
| 346 | main.step( "VLAN: Add vlan host intents between h5 and h24" ) |
| 347 | stepResult = main.TRUE |
| 348 | stepResult = main.intentFunction.hostIntent( main, |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 349 | name='VLAN1', |
| 350 | host1='h5', |
| 351 | host2='h24', |
| 352 | host1Id='00:00:00:00:00:05/100', |
| 353 | host2Id='00:00:00:00:00:18/100', |
| 354 | sw1='s5', |
| 355 | sw2='s2', |
| 356 | expectedLink=18 ) |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 357 | |
| 358 | utilities.assert_equals( expect=main.TRUE, |
| 359 | actual=stepResult, |
| 360 | onpass="VLAN: Host intent test " + |
| 361 | "successful between two " + |
| 362 | "host using IPV6 in the same VLAN", |
| 363 | onfail="VLAN1: Host intent test " + |
| 364 | "failed between two" + |
| 365 | "host using IPV6 in the same VLAN" ) |
| 366 | |
| 367 | main.intentFunction.report( main ) |
| 368 | |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 369 | def CASE2000( self, main ): |
| 370 | """ |
| 371 | add point intents between 2 hosts: |
| 372 | - Get device ids | ports |
| 373 | - Add point intents |
| 374 | - Check intents |
| 375 | - Verify flows |
| 376 | - Ping hosts |
| 377 | - Reroute |
| 378 | - Link down |
| 379 | - Verify flows |
| 380 | - Check topology |
| 381 | - Ping hosts |
| 382 | - Link up |
| 383 | - Verify flows |
| 384 | - Check topology |
| 385 | - Ping hosts |
| 386 | - Remove intents |
| 387 | """ |
| 388 | import time |
| 389 | import json |
| 390 | import re |
| 391 | |
| 392 | # Assert variables - These variable's name|format must be followed |
| 393 | # if you want to use the wrapper function |
| 394 | assert main, "There is no main" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 395 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 396 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 397 | main.numSwitch" |
| 398 | |
| 399 | main.testName = "Point Intents" |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 400 | main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) + |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 401 | " NODE(S) - OF " + main.OFProtocol ) |
| 402 | main.caseExplanation = "This test case will test point to point" +\ |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 403 | " intents using " + str( main.Cluster.numCtrls ) +\ |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 404 | " node(s) cluster;\n" +\ |
| 405 | "Different type of hosts will be tested in " +\ |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 406 | "each step such as IPV6, Dual stack, VLAN etc" +\ |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 407 | ";\nThe test will use OF " + main.OFProtocol +\ |
| 408 | " OVS running in Mininet" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 409 | # No option point intents |
| 410 | main.step( "NOOPTION: Add point intents between h1 and h9, ipv6 hosts" ) |
| 411 | main.assertReturnString = "Assertion Result for NOOPTION point intent\n" |
| 412 | stepResult = main.TRUE |
| 413 | stepResult = main.intentFunction.pointIntent( |
| 414 | main, |
| 415 | name="NOOPTION", |
| 416 | host1="h1", |
| 417 | host2="h9", |
| 418 | deviceId1="of:0000000000000005/1", |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 419 | deviceId2="of:0000000000000006/1" ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 420 | |
| 421 | utilities.assert_equals( expect=main.TRUE, |
| 422 | actual=stepResult, |
| 423 | onpass=main.assertReturnString, |
| 424 | onfail=main.assertReturnString ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 425 | stepResult = main.TRUE |
| 426 | main.step( "IPV6: Add point intents between h1 and h9" ) |
| 427 | main.assertReturnString = "Assertion Result for IPV6 point intent\n" |
| 428 | stepResult = main.intentFunction.pointIntent( |
| 429 | main, |
| 430 | name="IPV6", |
| 431 | host1="h1", |
| 432 | host2="h9", |
| 433 | deviceId1="of:0000000000000005/1", |
| 434 | deviceId2="of:0000000000000006/1", |
| 435 | port1="", |
| 436 | port2="", |
| 437 | ethType="IPV6", |
| 438 | mac1="00:00:00:00:00:01", |
| 439 | mac2="00:00:00:00:00:09", |
| 440 | bandwidth="", |
| 441 | lambdaAlloc=False, |
| 442 | ipProto="", |
| 443 | ip1="", |
| 444 | ip2="", |
| 445 | tcp1="", |
| 446 | tcp2="", |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 447 | sw1="s5", |
| 448 | sw2="s2", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 449 | expectedLink=18 ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 450 | utilities.assert_equals( expect=main.TRUE, |
| 451 | actual=stepResult, |
| 452 | onpass=main.assertReturnString, |
| 453 | onfail=main.assertReturnString ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 454 | main.step( "IPV6_2: Add point intents between h1 and h9" ) |
| 455 | main.assertReturnString = "Assertion Result for IPV6 no mac address point intents\n" |
| 456 | stepResult = main.intentFunction.pointIntent( |
| 457 | main, |
| 458 | name="IPV6_2", |
| 459 | host1="h1", |
| 460 | host2="h9", |
| 461 | deviceId1="of:0000000000000005/1", |
| 462 | deviceId2="of:0000000000000006/1", |
| 463 | ipProto="", |
| 464 | ip1="", |
| 465 | ip2="", |
| 466 | tcp1="", |
| 467 | tcp2="", |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 468 | expectedLink="" ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 469 | utilities.assert_equals( expect=main.TRUE, |
| 470 | actual=stepResult, |
| 471 | onpass=main.assertReturnString, |
| 472 | onfail=main.assertReturnString ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 473 | main.step( "SDNIP-ICMP: Add point intents between h1 and h9" ) |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 474 | main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV6 using ICMP point intents\n" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 475 | mac1 = main.hostsData[ 'h1' ][ 'mac' ] |
| 476 | mac2 = main.hostsData[ 'h9' ][ 'mac' ] |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 477 | main.log.debug( mac2 ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 478 | ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ] |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 479 | ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128" |
| 480 | ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 481 | stepResult = main.intentFunction.pointIntent( |
| 482 | main, |
| 483 | name="SDNIP-ICMP", |
| 484 | host1="h1", |
| 485 | host2="h9", |
| 486 | deviceId1="of:0000000000000005/1", |
| 487 | deviceId2="of:0000000000000006/1", |
| 488 | mac1=mac1, |
| 489 | mac2=mac2, |
| 490 | ethType="IPV6", |
| 491 | ipProto=ipProto, |
| 492 | ip1=ip1, |
| 493 | ip2=ip2 ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 494 | utilities.assert_equals( expect=main.TRUE, |
| 495 | actual=stepResult, |
| 496 | onpass=main.assertReturnString, |
| 497 | onfail=main.assertReturnString ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 498 | main.step( "SDNIP-TCP: Add point intents between h1 and h9" ) |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 499 | main.assertReturnString = "Assertion Result for SDNIP-TCP IPV6 using TCP point intents\n" |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 500 | mac1 = main.hostsData[ 'h1' ][ 'mac' ] |
| 501 | mac2 = main.hostsData[ 'h9' ][ 'mac' ] |
| 502 | ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128" |
| 503 | ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 504 | ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ] |
| 505 | tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ] |
| 506 | tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ] |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 507 | stepResult = main.intentFunction.pointIntentTcp( |
| 508 | main, |
| 509 | name="SDNIP-TCP", |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 510 | host1="h1", |
| 511 | host2="h9", |
| 512 | deviceId1="of:0000000000000005/1", |
| 513 | deviceId2="of:0000000000000006/1", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 514 | mac1=mac1, |
| 515 | mac2=mac2, |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 516 | ethType="IPV6", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 517 | ipProto=ipProto, |
| 518 | ip1=ip1, |
| 519 | ip2=ip2, |
| 520 | tcp1=tcp1, |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 521 | tcp2=tcp2, |
| 522 | sw1="", |
| 523 | sw2="", |
| 524 | expectedLink="" ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 525 | utilities.assert_equals( expect=main.TRUE, |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 526 | actual=stepResult, |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 527 | onpass=main.assertReturnString, |
| 528 | onfail=main.assertReturnString ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 529 | main.step( "DUALSTACK1: Add point intents between h3 and h11" ) |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 530 | main.assertReturnString = "Assertion Result for Dualstack1 IPV6 with mac address point intents\n" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 531 | stepResult = main.intentFunction.pointIntent( |
| 532 | main, |
| 533 | name="DUALSTACK1", |
| 534 | host1="h3", |
| 535 | host2="h11", |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 536 | deviceId1="of:0000000000000005/3", |
| 537 | deviceId2="of:0000000000000006/3", |
| 538 | port1="", |
| 539 | port2="", |
| 540 | ethType="IPV6", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 541 | mac1="00:00:00:00:00:03", |
| 542 | mac2="00:00:00:00:00:0B", |
| 543 | bandwidth="", |
| 544 | lambdaAlloc=False, |
| 545 | ipProto="", |
| 546 | ip1="", |
| 547 | ip2="", |
| 548 | tcp1="", |
| 549 | tcp2="", |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 550 | sw1="s5", |
| 551 | sw2="s2", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 552 | expectedLink=18 ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 553 | utilities.assert_equals( expect=main.TRUE, |
| 554 | actual=stepResult, |
| 555 | onpass=main.assertReturnString, |
| 556 | onfail=main.assertReturnString ) |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 557 | main.step( "VLAN: Add point intents between h5 and h24" ) |
| 558 | main.assertReturnString = "Assertion Result for VLAN IPV6 with mac address point intents\n" |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 559 | stepResult = main.intentFunction.pointIntent( |
| 560 | main, |
| 561 | name="VLAN", |
| 562 | host1="h5", |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 563 | host2="h24", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 564 | deviceId1="of:0000000000000005/5", |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 565 | deviceId2="of:0000000000000007/8", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 566 | port1="", |
| 567 | port2="", |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 568 | ethType="IPV6", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 569 | mac1="00:00:00:00:00:05", |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 570 | mac2="00:00:00:00:00:18", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 571 | bandwidth="", |
| 572 | lambdaAlloc=False, |
| 573 | ipProto="", |
| 574 | ip1="", |
| 575 | ip2="", |
| 576 | tcp1="", |
| 577 | tcp2="", |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 578 | sw1="s5", |
| 579 | sw2="s2", |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 580 | expectedLink=18 ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 581 | utilities.assert_equals( expect=main.TRUE, |
| 582 | actual=stepResult, |
| 583 | onpass=main.assertReturnString, |
| 584 | onfail=main.assertReturnString ) |
sathishm | ad95346 | 2015-12-03 17:42:07 +0530 | [diff] [blame] | 585 | main.step( "1HOP: Add point intents between h1 and h9" ) |
| 586 | main.assertReturnString = "Assertion Result for 1HOP IPV6 with no mac address point intents\n" |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 587 | stepResult = main.intentFunction.pointIntent( main, |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 588 | name='1HOP', |
| 589 | host1="h1", |
| 590 | host2="h9", |
| 591 | deviceId1="of:0000000000000005/1", |
| 592 | deviceId2="of:0000000000000006/1" ) |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 593 | utilities.assert_equals( expect=main.TRUE, |
| 594 | actual=stepResult, |
| 595 | onpass=main.assertReturnString, |
| 596 | onfail=main.assertReturnString ) |
| 597 | main.intentFunction.report( main ) |
| 598 | |
| 599 | def CASE3000( self, main ): |
| 600 | """ |
| 601 | Add single point to multi point intents |
| 602 | - Get device ids |
| 603 | - Add single point to multi point intents |
| 604 | - Check intents |
| 605 | - Verify flows |
| 606 | - Ping hosts |
| 607 | - Reroute |
| 608 | - Link down |
| 609 | - Verify flows |
| 610 | - Check topology |
| 611 | - Ping hosts |
| 612 | - Link up |
| 613 | - Verify flows |
| 614 | - Check topology |
| 615 | - Ping hosts |
| 616 | - Remove intents |
| 617 | """ |
| 618 | import time |
| 619 | import json |
| 620 | import re |
| 621 | assert main, "There is no main" |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 622 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 623 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 624 | main.numSwitch" |
| 625 | main.testName = "Single to Multi Point Intents" |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 626 | main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) + " NODE(S) - OF " + main.OFProtocol ) |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 627 | main.caseExplanation = "This test case will test single point to" +\ |
| 628 | " multi point intents using " +\ |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 629 | str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\ |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 630 | "Different type of hosts will be tested in " +\ |
| 631 | "each step such as IPV6, Dual stack, VLAN etc" +\ |
| 632 | ";\nThe test will use OF " + main.OFProtocol +\ |
| 633 | " OVS running in Mininet " |
| 634 | main.step( "NOOPTION: Add single point to multi point intents" ) |
| 635 | hostNames = [ 'h1', 'h9', 'h17' ] |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 636 | devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ] |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 637 | main.assertReturnString = "Assertion results for IPV6 single to multi point intent with no options set\n" |
| 638 | stepResult = main.TRUE |
| 639 | stepResult = main.intentFunction.singleToMultiIntent( |
| 640 | main, |
| 641 | name="NOOPTION", |
| 642 | hostNames=hostNames, |
| 643 | devices=devices, |
| 644 | sw1="s5", |
| 645 | sw2="s2", |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 646 | expectedLink=18 ) |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 647 | utilities.assert_equals( expect=main.TRUE, |
| 648 | actual=stepResult, |
| 649 | onpass=main.assertReturnString, |
| 650 | onfail=main.assertReturnString ) |
| 651 | main.step( "IPV6: Add single point to multi point intents" ) |
| 652 | main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses\n" |
| 653 | hostNames = [ 'h1', 'h9', 'h17' ] |
| 654 | devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ] |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 655 | macs = [ '00:00:00:00:00:01', '00:00:00:00:00:09', '00:00:00:00:00:11' ] |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 656 | stepResult = main.TRUE |
| 657 | stepResult = main.intentFunction.singleToMultiIntent( |
| 658 | main, |
| 659 | name="IPV6", |
| 660 | hostNames=hostNames, |
| 661 | devices=devices, |
| 662 | macs=macs, |
| 663 | ethType="IPV6", |
| 664 | sw1="", |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 665 | sw2="" ) |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 666 | utilities.assert_equals( expect=main.TRUE, |
| 667 | actual=stepResult, |
| 668 | onpass=main.assertReturnString, |
| 669 | onfail=main.assertReturnString ) |
| 670 | main.step( "IPV6_2: Add single point to multi point intents" ) |
| 671 | main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and no MAC addresses\n" |
| 672 | hostNames = [ 'h1', 'h9', 'h17' ] |
| 673 | devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ] |
| 674 | stepResult = main.TRUE |
| 675 | stepResult = main.intentFunction.singleToMultiIntent( |
| 676 | main, |
| 677 | name="IPV6_2", |
| 678 | hostNames=hostNames, |
| 679 | devices=devices, |
| 680 | ethType="IPV6", |
| 681 | sw1="", |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 682 | sw2="" ) |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 683 | utilities.assert_equals( expect=main.TRUE, |
| 684 | actual=stepResult, |
| 685 | onpass=main.assertReturnString, |
| 686 | onfail=main.assertReturnString ) |
| 687 | main.step( "VLAN: Add single point to multi point intents" ) |
| 688 | main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses in the same VLAN\n" |
| 689 | hostNames = [ 'h5', 'h24' ] |
| 690 | devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ] |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 691 | macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ] |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 692 | stepResult = main.TRUE |
| 693 | stepResult = main.intentFunction.singleToMultiIntent( |
| 694 | main, |
| 695 | name="IPV6", |
| 696 | hostNames=hostNames, |
| 697 | devices=devices, |
| 698 | macs=macs, |
| 699 | ethType="IPV6", |
| 700 | sw1="", |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 701 | sw2="" ) |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 702 | utilities.assert_equals( expect=main.TRUE, |
| 703 | actual=stepResult, |
| 704 | onpass=main.assertReturnString, |
| 705 | onfail=main.assertReturnString ) |
| 706 | main.intentFunction.report( main ) |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 707 | |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 708 | def CASE4000( self, main ): |
| 709 | """ |
| 710 | Add multi point to single point intents |
| 711 | - Get device ids |
| 712 | - Add multi point to single point intents |
| 713 | - Check intents |
| 714 | - Verify flows |
| 715 | - Ping hosts |
| 716 | - Reroute |
| 717 | - Link down |
| 718 | - Verify flows |
| 719 | - Check topology |
| 720 | - Ping hosts |
| 721 | - Link up |
| 722 | - Verify flows |
| 723 | - Check topology |
| 724 | - Ping hosts |
| 725 | - Remove intents |
| 726 | """ |
| 727 | assert main, "There is no main" |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 728 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 729 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 730 | main.numSwitch" |
| 731 | |
| 732 | main.testName = "Multi To Single Point Intents" |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 733 | main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) + |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 734 | " NODE(S) - OF " + main.OFProtocol ) |
| 735 | main.caseExplanation = "This test case will test single point to" +\ |
| 736 | " multi point intents using " +\ |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 737 | str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\ |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 738 | "Different type of hosts will be tested in " +\ |
| 739 | "each step such as IPV6, Dual stack, VLAN etc" +\ |
| 740 | ";\nThe test will use OF " + main.OFProtocol +\ |
| 741 | " OVS running in Mininet" |
| 742 | |
| 743 | main.step( "NOOPTION: Add multi point to single point intents" ) |
| 744 | main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n" |
| 745 | stepResult = main.TRUE |
| 746 | hostNames = [ 'h17', 'h9' ] |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 747 | devices = [ 'of:0000000000000007/1', 'of:0000000000000006/1' ] |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 748 | stepResult = main.intentFunction.multiToSingleIntent( |
| 749 | main, |
| 750 | name="NOOPTION", |
| 751 | hostNames=hostNames, |
| 752 | devices=devices, |
| 753 | sw1="s6", |
| 754 | sw2="s2", |
| 755 | expectedLink=18 ) |
| 756 | utilities.assert_equals( expect=main.TRUE, |
| 757 | actual=stepResult, |
| 758 | onpass=main.assertReturnString, |
| 759 | onfail=main.assertReturnString ) |
| 760 | main.step( "IPV6: Add multi point to single point intents" ) |
| 761 | main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and MAC addresses\n" |
| 762 | hostNames = [ 'h1', 'h9', 'h17' ] |
| 763 | devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ] |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 764 | macs = [ '00:00:00:00:00:01', '00:00:00:00:00:09', '00:00:00:00:00:11' ] |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 765 | stepResult = main.TRUE |
| 766 | installResult = main.intentFunction.multiToSingleIntent( |
| 767 | main, |
| 768 | name="IPV6", |
| 769 | hostNames=hostNames, |
| 770 | devices=devices, |
| 771 | macs=macs, |
| 772 | ethType="IPV6", |
| 773 | sw1="", |
| 774 | sw2="", |
| 775 | expectedLink="" ) |
| 776 | utilities.assert_equals( expect=main.TRUE, |
| 777 | actual=stepResult, |
| 778 | onpass=main.assertReturnString, |
| 779 | onfail=main.assertReturnString ) |
| 780 | main.step( "IPV6_2: Add multi point to single point intents" ) |
| 781 | main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses\n" |
| 782 | hostNames = [ 'h1', 'h9' ] |
| 783 | devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1' ] |
| 784 | stepResult = main.TRUE |
| 785 | stepResult = main.intentFunction.multiToSingleIntent( |
| 786 | main, |
| 787 | name="IPV6_2", |
| 788 | hostNames=hostNames, |
| 789 | devices=devices, |
| 790 | ethType="IPV6", |
| 791 | sw1="", |
| 792 | sw2="", |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 793 | expectedLink="" ) |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 794 | utilities.assert_equals( expect=main.TRUE, |
| 795 | actual=stepResult, |
| 796 | onpass=main.assertReturnString, |
| 797 | onfail=main.assertReturnString ) |
| 798 | |
| 799 | main.step( "VLAN: Add multi point to single point intents" ) |
| 800 | main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses in the same VLAN\n" |
| 801 | hostNames = [ 'h5', 'h24' ] |
| 802 | devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ] |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 803 | macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ] |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 804 | stepResult = main.TRUE |
| 805 | stepResult = main.intentFunction.multiToSingleIntent( |
| 806 | main, |
| 807 | name="VLAN", |
| 808 | hostNames=hostNames, |
| 809 | devices=devices, |
| 810 | macs=macs, |
| 811 | ethType="IPV6", |
| 812 | sw1="", |
| 813 | sw2="", |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 814 | expectedLink="" ) |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 815 | utilities.assert_equals( expect=main.TRUE, |
| 816 | actual=stepResult, |
| 817 | onpass=main.assertReturnString, |
| 818 | onfail=main.assertReturnString ) |
| 819 | main.intentFunction.report( main ) |
| 820 | |
| 821 | def CASE5000( self, main ): |
| 822 | """ |
| 823 | Tests Host Mobility |
| 824 | Modifies the topology location of h1 |
| 825 | """ |
| 826 | assert main, "There is no main" |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 827 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 828 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 829 | main.numSwitch" |
| 830 | main.case( "Test host mobility with host intents " ) |
| 831 | main.step( "Testing host mobility by moving h1 from s5 to s6" ) |
| 832 | h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ] |
| 833 | |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 834 | main.log.info( "Moving h1 from s5 to s6" ) |
| 835 | main.Mininet1.moveHostv6( "h1", "s5", "s6" ) |
Jon Hall | 439c891 | 2016-04-15 02:22:03 -0700 | [diff] [blame] | 836 | main.intentFunction.getHostsData( main ) |
| 837 | h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ] |
| 838 | |
| 839 | utilities.assert_equals( expect="of:0000000000000006", |
| 840 | actual=h1PostMove, |
| 841 | onpass="Mobility: Successfully moved h1 to s6", |
| 842 | onfail="Mobility: Failed to move h1 to s6" + |
| 843 | " to single point intents" + |
| 844 | " with IPV6 type and MAC addresses" + |
| 845 | " in the same VLAN" ) |
| 846 | main.step( "IPV6: Add host intents between h1 and h9" ) |
| 847 | main.assertReturnString = "Assert result for IPV6 host intent between h1, moved, and h9\n" |
| 848 | stepResult = main.TRUE |
| 849 | stepResult = main.intentFunction.hostIntent( main, |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 850 | name='IPV6 Mobility IPV6', |
| 851 | host1='h1', |
| 852 | host2='h9', |
| 853 | host1Id='00:00:00:00:00:01/-1', |
| 854 | host2Id='00:00:00:00:00:09/-1' ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 855 | |
| 856 | utilities.assert_equals( expect=main.TRUE, |
| 857 | actual=stepResult, |
| 858 | onpass=main.assertReturnString, |
| 859 | onfail=main.assertReturnString ) |
Subhash Kumar Singh | 5ea4d30 | 2015-11-05 14:36:52 +0530 | [diff] [blame] | 860 | main.intentFunction.report( main ) |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 861 | |
| 862 | def CASE6000( self, main ): |
| 863 | """ |
| 864 | Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure |
| 865 | """ |
| 866 | assert main, "There is no main" |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 867 | assert main.Mininet1, "Mininet handle should be named Mininet1" |
| 868 | assert main.numSwitch, "Placed the total number of switch topology in \ |
| 869 | main.numSwitch" |
| 870 | main.case( "Test Multi to Single End Point Failure" ) |
| 871 | main.step( "NOOPTION: test end point failure for multi point to single point intents" ) |
| 872 | main.assertReturnString = "Assertion results for IPV6 multi to single \ |
| 873 | point intent end point failure with no options set\n" |
| 874 | hostNames = [ 'h8', 'h17' ] |
| 875 | devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ] |
| 876 | testResult = main.TRUE |
| 877 | testResult = main.intentFunction.testEndPointFail( |
| 878 | main, |
| 879 | name="NOOPTION", |
| 880 | test="MultipletoSingle", |
| 881 | hostNames=hostNames, |
| 882 | devices=devices, |
| 883 | sw1="s6", |
| 884 | sw2="s2", |
| 885 | sw3="s4", |
| 886 | sw4="s1", |
| 887 | sw5="s3", |
| 888 | expectedLink1=16, |
| 889 | expectedLink2=14 ) |
| 890 | utilities.assert_equals( expect=main.TRUE, |
| 891 | actual=testResult, |
| 892 | onpass=main.assertReturnString, |
| 893 | onfail=main.assertReturnString ) |
| 894 | |
| 895 | main.step( "IPV6: test end point failure for multi point to single point intents" ) |
| 896 | main.assertReturnString = "Assertion results for IPV6 multi to single \ |
| 897 | point intent end point failure with IPV6 type and MAC addresses\n" |
| 898 | hostNames = [ 'h8', 'h9', 'h17' ] |
| 899 | devices = [ 'of:0000000000000005/8', 'of:0000000000000006/1', 'of:0000000000000007/1' ] |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 900 | macs = [ '00:00:00:00:00:08', '00:00:00:00:00:09', '00:00:00:00:00:11' ] |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 901 | testResult = main.TRUE |
| 902 | testResult = main.intentFunction.testEndPointFail( |
| 903 | main, |
| 904 | test="MultipletoSingle", |
| 905 | name="IPV6", |
| 906 | hostNames=hostNames, |
| 907 | devices=devices, |
| 908 | macs=macs, |
| 909 | ethType="IPV6", |
| 910 | sw1="s6", |
| 911 | sw2="s2", |
| 912 | sw3="s4", |
| 913 | sw4="s1", |
| 914 | sw5="s3", |
| 915 | expectedLink1=16, |
| 916 | expectedLink2=14 ) |
| 917 | utilities.assert_equals( expect=main.TRUE, |
| 918 | actual=testResult, |
| 919 | onpass=main.assertReturnString, |
| 920 | onfail=main.assertReturnString ) |
| 921 | |
| 922 | main.step( "IPV6_2: test end point faliure for multi point to single point intents" ) |
| 923 | main.assertReturnString = "Assertion results for IPV6 multi to single \ |
| 924 | point intent end point failure with IPV6 type and no MAC addresses\n" |
| 925 | hostNames = [ 'h8', 'h17' ] |
| 926 | devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ] |
| 927 | testResult = main.TRUE |
| 928 | testResult = main.intentFunction.testEndPointFail( |
| 929 | main, |
| 930 | test="MultipletoSingle", |
| 931 | name="IPV6_2", |
| 932 | hostNames=hostNames, |
| 933 | devices=devices, |
| 934 | ethType="IPV6", |
| 935 | sw1="s6", |
| 936 | sw2="s2", |
| 937 | sw3="s4", |
| 938 | sw4="s1", |
| 939 | sw5="s3", |
| 940 | expectedLink1=16, |
| 941 | expectedLink2=14 ) |
| 942 | |
| 943 | utilities.assert_equals( expect=main.TRUE, |
| 944 | actual=testResult, |
| 945 | onpass=main.assertReturnString, |
| 946 | onfail=main.assertReturnString ) |
| 947 | |
| 948 | main.step( "VLAN: test end point failure for multi point to single point intents" ) |
| 949 | main.assertReturnString = "Assertion results for IPV6 multi to single \ |
| 950 | point intent end point failure with IPV6 type and no MAC addresses in the same VLAN\n" |
| 951 | hostNames = [ 'h5', 'h24' ] |
| 952 | devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ] |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 953 | macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ] |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 954 | testResult = main.TRUE |
| 955 | testResult = main.intentFunction.testEndPointFail( |
| 956 | main, |
| 957 | test="MultipletoSingle", |
| 958 | name="VLAN", |
| 959 | hostNames=hostNames, |
| 960 | devices=devices, |
| 961 | ethType="IPV6", |
| 962 | sw1="s6", |
| 963 | sw2="s2", |
| 964 | sw3="s4", |
| 965 | sw4="s1", |
| 966 | sw5="s3", |
| 967 | expectedLink1=16, |
| 968 | expectedLink2=14 ) |
| 969 | utilities.assert_equals( expect=main.TRUE, |
| 970 | actual=testResult, |
| 971 | onpass=main.assertReturnString, |
| 972 | onfail=main.assertReturnString ) |
| 973 | |
| 974 | main.case( "Test Single to Multiple End Point Failure" ) |
| 975 | main.step( "NOOPTION: test end point failure for single point to multi point intents" ) |
| 976 | main.assertReturnString = "Assertion results for IPV6 single to multi \ |
| 977 | point intent end point failure with no options set\n" |
| 978 | hostNames = [ 'h8', 'h17' ] |
| 979 | devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ] |
| 980 | testResult = main.TRUE |
| 981 | testResult = main.intentFunction.testEndPointFail( |
| 982 | main, |
| 983 | test="SingletoMultiple", |
| 984 | name="NOOPTION", |
| 985 | hostNames=hostNames, |
| 986 | devices=devices, |
| 987 | sw1="s6", |
| 988 | sw2="s2", |
| 989 | sw3="s4", |
| 990 | sw4="s1", |
| 991 | sw5="s3", |
| 992 | expectedLink1=16, |
| 993 | expectedLink2=14 ) |
| 994 | utilities.assert_equals( expect=main.TRUE, |
| 995 | actual=testResult, |
| 996 | onpass=main.assertReturnString, |
| 997 | onfail=main.assertReturnString ) |
| 998 | main.step( "IPV6: test end point failure for single point to multi point intents" ) |
| 999 | main.assertReturnString = "Assertion results for IPV6 single to multi \ |
| 1000 | point intent end point failure with IPV6 type and MAC addresses\n" |
| 1001 | hostNames = [ 'h8', 'h9', 'h17' ] |
| 1002 | devices = [ 'of:0000000000000005/8', 'of:0000000000000006/1', 'of:0000000000000007/1' ] |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 1003 | macs = [ '00:00:00:00:00:08', '00:00:00:00:00:09', '00:00:00:00:00:11' ] |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 1004 | testResult = main.TRUE |
| 1005 | testResult = main.intentFunction.testEndPointFail( |
| 1006 | main, |
| 1007 | test="SingletoMultiple", |
| 1008 | name="IPV6", |
| 1009 | hostNames=hostNames, |
| 1010 | devices=devices, |
| 1011 | ethType="IPV6", |
| 1012 | macs=macs, |
| 1013 | sw1="s6", |
| 1014 | sw2="s2", |
| 1015 | sw3="s4", |
| 1016 | sw4="s1", |
| 1017 | sw5="s3", |
| 1018 | expectedLink1=16, |
| 1019 | expectedLink2=14 ) |
| 1020 | utilities.assert_equals( expect=main.TRUE, |
| 1021 | actual=testResult, |
| 1022 | onpass=main.assertReturnString, |
| 1023 | onfail=main.assertReturnString ) |
| 1024 | |
| 1025 | main.step( "IPV6_2: test end point failure for single point to multi point intents" ) |
| 1026 | main.assertReturnString = "Assertion results for IPV6 single to multi\ |
| 1027 | point intent endpoint failure with IPV6 type and no MAC addresses\n" |
| 1028 | hostNames = [ 'h8', 'h17' ] |
| 1029 | devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ] |
| 1030 | testResult = main.TRUE |
| 1031 | testResult = main.intentFunction.testEndPointFail( |
| 1032 | main, |
| 1033 | test="SingletoMultiple", |
| 1034 | name="IPV6_2", |
| 1035 | hostNames=hostNames, |
| 1036 | devices=devices, |
| 1037 | ethType="IPV6", |
| 1038 | sw1="s6", |
| 1039 | sw2="s2", |
| 1040 | sw3="s4", |
| 1041 | sw4="s1", |
| 1042 | sw5="s3", |
| 1043 | expectedLink1=16, |
| 1044 | expectedLink2=14 ) |
| 1045 | utilities.assert_equals( expect=main.TRUE, |
| 1046 | actual=testResult, |
| 1047 | onpass=main.assertReturnString, |
| 1048 | onfail=main.assertReturnString ) |
| 1049 | |
| 1050 | main.step( "VLAN: test end point failure for single point to multi point intents" ) |
| 1051 | main.assertReturnString = "Assertion results for IPV6 single to multi point\ |
| 1052 | intent endpoint failure with IPV6 type and MAC addresses in the same VLAN\n" |
| 1053 | hostNames = [ 'h5', 'h24' ] |
| 1054 | devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ] |
Jon Hall | 314b74a | 2017-05-24 16:25:52 -0700 | [diff] [blame] | 1055 | macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ] |
sathishm | c436225 | 2016-04-20 18:29:48 +0530 | [diff] [blame] | 1056 | testResult = main.TRUE |
| 1057 | testResult = main.intentFunction.testEndPointFail( |
| 1058 | main, |
| 1059 | test="SingletoMultiple", |
| 1060 | name="IPV6", |
| 1061 | hostNames=hostNames, |
| 1062 | devices=devices, |
| 1063 | macs=macs, |
| 1064 | ethType="IPV6", |
| 1065 | sw1="s6", |
| 1066 | sw2="s2", |
| 1067 | sw3="s4", |
| 1068 | sw4="s1", |
| 1069 | sw5="s3", |
| 1070 | expectedLink1=16, |
| 1071 | expectedLink2=14 ) |
| 1072 | utilities.assert_equals( expect=main.TRUE, |
| 1073 | actual=testResult, |
| 1074 | onpass=main.assertReturnString, |
| 1075 | onfail=main.assertReturnString ) |
| 1076 | |
| 1077 | main.intentFunction.report( main ) |