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