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