blob: 4f6b715fd83f5f9a4a7d783ee509ccf9a10ba1e5 [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07001"""
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07002Copyright 2015 Open Networking Foundation ( ONF )
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07003
4Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7
8 TestON is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070011 ( at your option ) any later version.
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -070012
13 TestON is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20"""
kelvin-onlabd48a68c2015-07-13 16:01:36 -070021# Testing the basic intent functionality of ONOS
22
Jon Hall78be4962017-05-23 14:53:53 -070023
kelvin-onlabd48a68c2015-07-13 16:01:36 -070024class FUNCintent:
25
26 def __init__( self ):
27 self.default = ''
28
29 def CASE1( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -070030 import imp
Jon Hallf632d202015-07-30 15:45:11 -070031 import re
kelvin-onlabd48a68c2015-07-13 16:01:36 -070032 """
33 - Construct tests variables
34 - GIT ( optional )
35 - Checkout ONOS master branch
36 - Pull latest ONOS code
37 - Building ONOS ( optional )
38 - Install ONOS package
39 - Build ONOS package
40 """
Devin Lim58046fa2017-07-05 16:55:00 -070041 try:
42 from tests.dependencies.ONOSSetup import ONOSSetup
43 main.testSetUp = ONOSSetup()
44 except ImportError:
45 main.log.error( "ONOSSetup not found. exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -070046 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -070047 main.testSetUp.envSetupDescription()
kelvin-onlabd48a68c2015-07-13 16:01:36 -070048 stepResult = main.FALSE
49
You Wanga0f6ff62018-01-11 15:46:30 -080050 from tests.dependencies.Network import Network
51 main.Network = Network()
52
kelvin-onlabd48a68c2015-07-13 16:01:36 -070053 # Test variables
Jon Halla3e02432015-07-24 15:55:42 -070054 try:
Jon Halla3e02432015-07-24 15:55:42 -070055 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
Jon Halla3e02432015-07-24 15:55:42 -070056 main.dependencyPath = main.testOnDirectory + \
57 main.params[ 'DEPENDENCY' ][ 'path' ]
58 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
59 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
Devin Lim58046fa2017-07-05 16:55:00 -070060
Jon Halla3e02432015-07-24 15:55:42 -070061 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
62 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
63 wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
64 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
65 main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
acsmarscfa52272015-08-06 15:21:45 -070066 main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
Jon Halla3e02432015-07-24 15:55:42 -070067 main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
68 main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
Shreyaca8990f2017-03-16 11:43:11 -070069 main.checkConnectionSleep = int( main.params[ 'SLEEP' ][ 'checkConnection' ] )
70 main.checkFlowCountSleep = int( main.params[ 'SLEEP' ][ 'checkFlowCount' ] )
71 main.checkIntentHostSleep = int( main.params[ 'SLEEP' ][ 'checkIntentHost' ] )
72 main.checkIntentPointSleep = int( main.params[ 'SLEEP' ][ 'checkIntentPoint' ] )
acsmars59a4c552015-09-10 18:11:19 -070073 main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
Jeremy Songster306ed7a2016-07-19 10:59:07 -070074 main.flowDurationSleep = int( main.params[ 'SLEEP' ][ 'flowDuration' ] )
Devin Lima4f95bc2017-08-11 11:13:03 -070075 main.generalAttemptsNum = int( main.params[ 'RETRY' ][ 'generalAttempts' ] )
76 main.middleAttemptsNum = int( main.params[ 'RETRY' ][ 'middleAttempts' ] )
77 main.minimumAttemptsNum = int( main.params[ 'RETRY' ][ 'minimumAttempts' ] )
78 main.checkConnectionAttNum = int( main.params[ 'RETRY' ][ 'checkConnectionAtt' ] )
79 main.removeIntentAttNum = int( main.params[ 'RETRY' ][ 'removeIntentAtt' ] )
Jon Halla3e02432015-07-24 15:55:42 -070080 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
81 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
Jon Halla3e02432015-07-24 15:55:42 -070082 main.hostsData = {}
Jeremy Songster1f39bf02016-01-20 17:17:25 -080083 main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
84 main.scapyHosts = [] # List of scapy hosts for iterating
acsmars5d8cc862015-09-25 09:44:50 -070085 main.assertReturnString = '' # Assembled assert return string
Jon Hall78be4962017-05-23 14:53:53 -070086 main.cycle = 0 # How many times FUNCintent has run through its tests
kelvin-onlabd48a68c2015-07-13 16:01:36 -070087
Jon Halla3e02432015-07-24 15:55:42 -070088 # -- INIT SECTION, ONLY RUNS ONCE -- #
kelvin-onlabd48a68c2015-07-13 16:01:36 -070089
Jon Hall78be4962017-05-23 14:53:53 -070090 main.intents = imp.load_source( wrapperFile2,
Jon Halla3e02432015-07-24 15:55:42 -070091 main.dependencyPath +
92 wrapperFile2 +
93 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070094
You Wanga0f6ff62018-01-11 15:46:30 -080095 if hasattr( main, "Mininet1" ):
96 copyResult1 = main.ONOSbench.scp( main.Mininet1,
97 main.dependencyPath +
98 main.topology,
99 main.Mininet1.home + "custom/",
100 direction="to" )
Devin Lim58046fa2017-07-05 16:55:00 -0700101
Devin Lim142b5342017-07-20 15:22:39 -0700102 stepResult = main.testSetUp.envSetup()
Jon Halla3e02432015-07-24 15:55:42 -0700103 except Exception as e:
Devin Lim58046fa2017-07-05 16:55:00 -0700104 main.testSetUp.envSetupException( e )
105 main.testSetUp.evnSetupConclusion( stepResult )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700106
107 def CASE2( self, main ):
108 """
109 - Set up cell
110 - Create cell file
111 - Set cell file
112 - Verify cell file
113 - Kill ONOS process
114 - Uninstall ONOS cluster
115 - Verify ONOS start up
116 - Install ONOS cluster
117 - Connect to cli
118 """
Jeremycd872222016-03-29 10:08:34 -0700119 main.flowCompiler = "Flow Rules"
You Wanga0f6ff62018-01-11 15:46:30 -0800120 main.initialized = main.testSetUp.ONOSSetUp( main.Cluster, True )
Jon Hall78be4962017-05-23 14:53:53 -0700121 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700122
Jon Halla3e02432015-07-24 15:55:42 -0700123 def CASE8( self, main ):
124 """
acsmars59a4c552015-09-10 18:11:19 -0700125 Compare ONOS Topology to Mininet Topology
Jon Halla3e02432015-07-24 15:55:42 -0700126 """
Devin Lim58046fa2017-07-05 16:55:00 -0700127 import time
128 try:
129 from tests.dependencies.topology import Topology
130 except ImportError:
131 main.log.error( "Topology not found exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -0700132 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700133 try:
134 main.topoRelated
135 except ( NameError, AttributeError ):
136 main.topoRelated = Topology()
137 main.topoRelated.compareTopos( main.Mininet1, main.checkTopoAttempts )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700138
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700139 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700140 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700141 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700142 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700143 if main.initialized == main.FALSE:
144 main.log.error( "Test components did not start correctly, skipping further tests" )
145 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700146 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700147 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700148 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700149 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700150 "switches to test intents, exits out if " +\
151 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700152
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700153 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700154 args = "--switch ovs,protocols=OpenFlow10"
Devin Lim29a9e3d2018-01-30 14:09:47 -0800155 topoResult = main.Mininet1.startNet( topoFile=main.Mininet1.home + "/custom/" + main.topology,
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700156 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700157 stepResult = topoResult
158 utilities.assert_equals( expect=main.TRUE,
159 actual=stepResult,
160 onpass="Successfully loaded topology",
161 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700162
163 # Set flag to test cases if topology did not load properly
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700164 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700165 main.initialized = main.FALSE
166 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700167
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700168 def CASE11( self, main ):
169 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700170 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700171 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700172 if main.initialized == main.FALSE:
173 main.log.error( "Test components did not start correctly, skipping further tests" )
174 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700175 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700176 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700177 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700178 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700179 "switches to test intents, exits out if " +\
180 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700181
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700182 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700183 args = "--switch ovs,protocols=OpenFlow13"
Devin Lim29a9e3d2018-01-30 14:09:47 -0800184 topoResult = main.Mininet1.startNet( topoFile=main.Mininet1.home + "/custom/" + main.topology,
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700185 args=args )
186 stepResult = topoResult
187 utilities.assert_equals( expect=main.TRUE,
188 actual=stepResult,
189 onpass="Successfully loaded topology",
190 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700191 # Set flag to skip test cases if topology did not load properly
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700192 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700193 main.initialized = main.FALSE
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700194
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700195 def CASE12( self, main ):
196 """
197 Assign mastership to controllers
198 """
199 import re
200
Jeremyd9e4eb12016-04-13 12:09:06 -0700201 if main.initialized == main.FALSE:
202 main.log.error( "Test components did not start correctly, skipping further tests" )
203 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700204 main.case( "Assign switches to controllers" )
205 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700206 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700207 " switches to ONOS nodes"
208
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700209 switchList = []
210
211 # Creates a list switch name, use getSwitch() function later...
212 for i in range( 1, ( main.numSwitch + 1 ) ):
213 switchList.append( 's' + str( i ) )
214
Devin Lim142b5342017-07-20 15:22:39 -0700215 tempONOSip = main.Cluster.getIps()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700216
You Wanga0f6ff62018-01-11 15:46:30 -0800217 assignResult = main.Network.assignSwController( sw=switchList,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700218 ip=tempONOSip,
alison52b25892016-09-19 10:53:48 -0700219 port="6653" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700220 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700221 main.log.error( "Problem assigning mastership of switches" )
222 main.initialized = main.FALSE
223 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700224
225 for i in range( 1, ( main.numSwitch + 1 ) ):
You Wanga0f6ff62018-01-11 15:46:30 -0800226 response = main.Network.getSwController( "s" + str( i ) )
Jon Hall860b8152017-05-23 10:35:23 -0700227 main.log.debug( "Response is " + str( response ) )
Devin Lim142b5342017-07-20 15:22:39 -0700228 if re.search( "tcp:" + main.Cluster.active( 0 ).ipAddress, response ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700229 assignResult = assignResult and main.TRUE
230 else:
231 assignResult = main.FALSE
232 stepResult = assignResult
233 utilities.assert_equals( expect=main.TRUE,
234 actual=stepResult,
235 onpass="Successfully assigned switches" +
236 "to controller",
237 onfail="Failed to assign switches to " +
238 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700239 if not stepResult:
240 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700241
Jon Hall78be4962017-05-23 14:53:53 -0700242 def CASE13( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700243 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800244 Create Scapy components
245 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700246 if main.initialized == main.FALSE:
247 main.log.error( "Test components did not start correctly, skipping further tests" )
248 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800249 main.case( "Create scapy components" )
250 main.step( "Create scapy components" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800251 scapyResult = main.TRUE
252 for hostName in main.scapyHostNames:
253 main.Scapy1.createHostComponent( hostName )
254 main.scapyHosts.append( getattr( main, hostName ) )
255
256 main.step( "Start scapy components" )
257 for host in main.scapyHosts:
258 host.startHostCli()
259 host.startScapy()
260 host.updateSelf()
261 main.log.debug( host.name )
262 main.log.debug( host.hostIp )
263 main.log.debug( host.hostMac )
264
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800265 utilities.assert_equals( expect=main.TRUE,
266 actual=scapyResult,
267 onpass="Successfully created Scapy Components",
268 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700269 if not scapyResult:
270 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800271
272 def CASE14( self, main ):
273 """
274 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700275 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700276 if main.initialized == main.FALSE:
277 main.log.error( "Test components did not start correctly, skipping further tests" )
278 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700279 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800280 main.step( "Pingall hosts and confirm ONOS discovery" )
Jon Hall78be4962017-05-23 14:53:53 -0700281 utilities.retry( f=main.intents.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700282
Jon Hall78be4962017-05-23 14:53:53 -0700283 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery, retValue=main.FALSE,
284 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700285 utilities.assert_equals( expect=main.TRUE,
286 actual=stepResult,
287 onpass="Successfully discovered hosts",
288 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700289 if not stepResult:
290 main.initialized = main.FALSE
291 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700292
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800293 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700294 stepResult = main.intents.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700295 utilities.assert_equals( expect=main.TRUE,
296 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800297 onpass="Successfully populated hostsData",
298 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700299 if not stepResult:
300 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800301
302 def CASE15( self, main ):
303 """
304 Discover all hosts with scapy arp packets and store its data to a dictionary
305 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700306 if main.initialized == main.FALSE:
307 main.log.error( "Test components did not start correctly, skipping further tests" )
308 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800309 main.case( "Discover all hosts using scapy" )
310 main.step( "Send packets from each host to the first host and confirm onos discovery" )
311
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800312 if len( main.scapyHosts ) < 1:
313 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700314 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800315 main.skipCase()
316
317 # Send ARP packets from each scapy host component
Jon Hall78be4962017-05-23 14:53:53 -0700318 main.intents.sendDiscoveryArp( main, main.scapyHosts )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800319
Jon Hall78be4962017-05-23 14:53:53 -0700320 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800321 retValue=main.FALSE, args=[ main ],
322 attempts=main.checkTopoAttempts, sleep=2 )
323
324 utilities.assert_equals( expect=main.TRUE,
325 actual=stepResult,
326 onpass="ONOS correctly discovered all hosts",
327 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700328 if not stepResult:
329 main.initialized = main.FALSE
330 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800331
332 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700333 stepResult = main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800334 utilities.assert_equals( expect=main.TRUE,
335 actual=stepResult,
336 onpass="Successfully populated hostsData",
337 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700338 if not stepResult:
339 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800340
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800341 def CASE16( self, main ):
342 """
Jeremy42df2e72016-02-23 16:37:46 -0800343 Balance Masters
344 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700345 if main.initialized == main.FALSE:
346 main.log.error( "Test components did not start correctly, skipping further tests" )
347 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800348 main.case( "Balance mastership of switches" )
349 main.step( "Balancing mastership of switches" )
350
Devin Lim142b5342017-07-20 15:22:39 -0700351 balanceResult = utilities.retry( f=main.Cluster.active( 0 ).CLI.balanceMasters, retValue=main.FALSE, args=[] )
Jeremy42df2e72016-02-23 16:37:46 -0800352
353 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700354 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800355 onpass="Successfully balanced mastership of switches",
356 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700357 if not balanceResult:
358 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800359
360 def CASE17( self, main ):
361 """
Jeremy6e9748f2016-03-25 15:03:39 -0700362 Use Flow Objectives
363 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700364 if main.initialized == main.FALSE:
365 main.log.error( "Test components did not start correctly, skipping further tests" )
366 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700367 main.case( "Enable intent compilation using Flow Objectives" )
368 main.step( "Enabling Flow Objectives" )
369
370 main.flowCompiler = "Flow Objectives"
371
372 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
373
Devin Lim142b5342017-07-20 15:22:39 -0700374 stepResult = main.Cluster.active( 0 ).CLI.setCfg( component=cmd,
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700375 propName="useFlowObjectives", value="true" )
Devin Lim142b5342017-07-20 15:22:39 -0700376 stepResult &= main.Cluster.active( 0 ).CLI.setCfg( component=cmd,
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700377 propName="defaultFlowObjectiveCompiler",
378 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler' )
Jeremy6e9748f2016-03-25 15:03:39 -0700379
380 utilities.assert_equals( expect=main.TRUE,
381 actual=stepResult,
382 onpass="Successfully activated Flow Objectives",
383 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700384 if not balanceResult:
385 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700386
387 def CASE18( self, main ):
388 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800389 Stop mininet and remove scapy host
390 """
Devin Lim58046fa2017-07-05 16:55:00 -0700391 try:
392 from tests.dependencies.utils import Utils
393 except ImportError:
394 main.log.error( "Utils not found exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -0700395 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700396 try:
397 main.Utils
398 except ( NameError, AttributeError ):
399 main.Utils = Utils()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800400 main.log.report( "Stop Mininet and Scapy" )
401 main.case( "Stop Mininet and Scapy" )
402 main.caseExplanation = "Stopping the current mininet topology " +\
403 "to start up fresh"
404 main.step( "Stopping and Removing Scapy Host Components" )
405 scapyResult = main.TRUE
406 for host in main.scapyHosts:
407 scapyResult = scapyResult and host.stopScapy()
408 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
409
410 for host in main.scapyHosts:
411 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
412 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
413
414 main.scapyHosts = []
415 main.scapyHostIPs = []
416
417 utilities.assert_equals( expect=main.TRUE,
418 actual=scapyResult,
419 onpass="Successfully stopped scapy and removed host components",
420 onfail="Failed to stop mininet and scapy" )
421
Devin Lim58046fa2017-07-05 16:55:00 -0700422 mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700423 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800424 if not ( mininetResult and scapyResult ):
Devin Lim44075962017-08-11 10:56:37 -0700425 main.cleanAndExit()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700426
Jeremy Songster17147f22016-05-31 18:30:52 -0700427 def CASE19( self, main ):
428 """
429 Copy the karaf.log files after each testcase cycle
430 """
Devin Lim58046fa2017-07-05 16:55:00 -0700431 try:
432 from tests.dependencies.utils import Utils
433 except ImportError:
434 main.log.error( "Utils not found exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -0700435 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700436 try:
437 main.Utils
438 except ( NameError, AttributeError ):
439 main.Utils = Utils()
Devin Lim142b5342017-07-20 15:22:39 -0700440 main.Utils.copyKarafLog( "cycle" + str( main.cycle ) )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700441
kelvin-onlabb769f562015-07-15 17:05:10 -0700442 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700443 """
444 Add host intents between 2 host:
445 - Discover hosts
446 - Add host intents
447 - Check intents
448 - Verify flows
449 - Ping hosts
450 - Reroute
451 - Link down
452 - Verify flows
453 - Check topology
454 - Ping hosts
455 - Link up
456 - Verify flows
457 - Check topology
458 - Ping hosts
459 - Remove intents
460 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700461 if main.initialized == main.FALSE:
462 main.log.error( "Test components did not start correctly, skipping further tests" )
463 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700464 # Assert variables - These variable's name|format must be followed
465 # if you want to use the wrapper function
466 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700467 try:
Jeremyd9e4eb12016-04-13 12:09:06 -0700468 assert main.numSwitch
469 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700470 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700471 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700472 main.initialized = main.FALSE
473 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700474
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800475 # Save leader candidates
Devin Lim142b5342017-07-20 15:22:39 -0700476 intentLeadersOld = main.Cluster.active( 0 ).CLI.leaderCandidates()
acsmarse6b410f2015-07-17 14:39:34 -0700477
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700478 main.testName = "Host Intents"
Devin Lim142b5342017-07-20 15:22:39 -0700479 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700480 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700481 main.caseExplanation = "This test case tests Host intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -0700482 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700483 "Different type of hosts will be tested in " +\
484 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700485 "etc;\nThe test will use OF " + main.OFProtocol +\
486 " OVS running in Mininet and compile intents" +\
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700487 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700488
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700489 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700490 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700491 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
492 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800493 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700494 installResult = main.intents.installHostIntent( main,
495 name="IPV4",
496 onosNode=0,
497 host1=host1,
498 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800499 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700500 testResult = main.intents.testHostIntent( main,
501 name="IPV4",
502 intentId=installResult,
503 onosNode=0,
504 host1=host1,
505 host2=host2,
506 sw1="s5",
507 sw2="s2",
508 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800509 else:
Devin Lim142b5342017-07-20 15:22:39 -0700510 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800511
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700512 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800513 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700514 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700515 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700516
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700517 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700518 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700519 host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
Jon Hall78be4962017-05-23 14:53:53 -0700520 host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 " }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800521 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700522 installResult = main.intents.installHostIntent( main,
523 name="DUALSTACK",
524 onosNode=0,
525 host1=host1,
526 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800527
528 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700529 testResult = main.intents.testHostIntent( main,
530 name="DUALSTACK",
531 intentId=installResult,
532 onosNode=0,
533 host1=host1,
534 host2=host2,
535 sw1="s5",
536 sw2="s2",
537 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700538
539 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800540 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700541 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700542 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700543
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700544 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700545 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700546 host1 = { "name": "h1" }
547 host2 = { "name": "h11" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800548 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700549 installResult = main.intents.installHostIntent( main,
550 name="DUALSTACK2",
551 onosNode=0,
552 host1=host1,
553 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800554
555 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700556 testResult = main.intents.testHostIntent( main,
557 name="DUALSTACK2",
558 intentId=installResult,
559 onosNode=0,
560 host1=host1,
561 host2=host2,
562 sw1="s5",
563 sw2="s2",
564 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800565 else:
Devin Lim142b5342017-07-20 15:22:39 -0700566 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700567
568 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800569 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700570 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700571 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700572
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700573 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700574 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jon Hall9c888672017-05-15 18:03:54 -0700575 host1 = { "name": "h1" }
576 host2 = { "name": "h3" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800577 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700578 installResult = main.intents.installHostIntent( main,
579 name="1HOP",
580 onosNode=0,
581 host1=host1,
582 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800583
584 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700585 testResult = main.intents.testHostIntent( main,
586 name="1HOP",
587 intentId=installResult,
588 onosNode=0,
589 host1=host1,
590 host2=host2,
591 sw1="s5",
592 sw2="s2",
593 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800594 else:
Devin Lim142b5342017-07-20 15:22:39 -0700595 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700596
597 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800598 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700599 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700600 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700601
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700602 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700603 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700604 host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
605 host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800606 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700607 installResult = main.intents.installHostIntent( main,
608 name="VLAN1",
609 onosNode=0,
610 host1=host1,
611 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800612 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700613 testResult = main.intents.testHostIntent( main,
614 name="VLAN1",
615 intentId=installResult,
616 onosNode=0,
617 host1=host1,
618 host2=host2,
619 sw1="s5",
620 sw2="s2",
621 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800622 else:
Devin Lim142b5342017-07-20 15:22:39 -0700623 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700624
625 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800626 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700627 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700628 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700629
Jeremy Songsterff553672016-05-12 17:06:23 -0700630 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
631 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700632 host1 = { "name": "h5", "vlan": "200" }
633 host2 = { "name": "h12", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -0700634 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700635 installResult = main.intents.installHostIntent( main,
636 name="VLAN2",
637 onosNode=0,
638 host1=host1,
639 host2=host2 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700640
641 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700642 testResult = main.intents.testHostIntent( main,
643 name="VLAN2",
644 intentId=installResult,
645 onosNode=0,
646 host1=host1,
647 host2=host2,
648 sw1="s5",
649 sw2="s2",
650 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700651 else:
Devin Lim142b5342017-07-20 15:22:39 -0700652 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -0700653
654 utilities.assert_equals( expect=main.TRUE,
655 actual=testResult,
656 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700657 onfail=main.assertReturnString )
Jeremy Songsterff553672016-05-12 17:06:23 -0700658
Jeremy Songsterc032f162016-08-04 17:14:49 -0700659 main.step( "Encapsulation: Add host intents between h1 and h9" )
660 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700661 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
662 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -0700663 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700664 installResult = main.intents.installHostIntent( main,
665 name="ENCAPSULATION",
666 onosNode=0,
667 host1=host1,
668 host2=host2,
669 encap="VLAN" )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700670 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700671 testResult = main.intents.testHostIntent( main,
672 name="ENCAPSULATION",
673 intentId=installResult,
674 onosNode=0,
675 host1=host1,
676 host2=host2,
677 sw1="s5",
678 sw2="s2",
679 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700680 else:
Devin Lim142b5342017-07-20 15:22:39 -0700681 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700682
683 utilities.assert_equals( expect=main.TRUE,
684 actual=testResult,
685 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700686 onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700687
Jon Hall78be4962017-05-23 14:53:53 -0700688 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -0700689 # main.step( "Encapsulation: Add host intents between h1 and h9" )
690 # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
691 # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
692 # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
693 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700694 # installResult = main.intents.installHostIntent( main,
695 # name="ENCAPSULATION",
696 # onosNode=0,
697 # host1=host1,
698 # host2=host2,
699 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -0700700 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700701 # testResult = main.intents.testHostIntent( main,
702 # name="ENCAPSULATION",
703 # intentId=installResult,
704 # onosNode=0,
705 # host1=host1,
706 # host2=host2,
707 # sw1="s5",
708 # sw2="s2",
709 # expectedLink=18 )
alison52b25892016-09-19 10:53:48 -0700710 # else:
Devin Lim142b5342017-07-20 15:22:39 -0700711 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -0700712 #
713 # utilities.assert_equals( expect=main.TRUE,
714 # actual=testResult,
715 # onpass=main.assertReturnString,
716 # onfail=main.assertReturnString )
717
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700718 main.step( "Confirm that ONOS leadership is unchanged" )
Devin Lim142b5342017-07-20 15:22:39 -0700719 intentLeadersNew = main.Cluster.active( 0 ).CLI.leaderCandidates()
Jon Hall78be4962017-05-23 14:53:53 -0700720 testResult = main.intents.checkLeaderChange( intentLeadersOld,
721 intentLeadersNew )
acsmarse6b410f2015-07-17 14:39:34 -0700722
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800723 utilities.assert_equals( expect=main.TRUE,
724 actual=testResult,
725 onpass="ONOS Leaders Unchanged",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700726 onfail="ONOS Leader Mismatch" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800727
Jon Hall78be4962017-05-23 14:53:53 -0700728 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700729
kelvin-onlabb769f562015-07-15 17:05:10 -0700730 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700731 """
732 Add point intents between 2 hosts:
733 - Get device ids | ports
734 - Add point intents
735 - Check intents
736 - Verify flows
737 - Ping hosts
738 - Reroute
739 - Link down
740 - Verify flows
741 - Check topology
742 - Ping hosts
743 - Link up
744 - Verify flows
745 - Check topology
746 - Ping hosts
747 - Remove intents
748 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700749 if main.initialized == main.FALSE:
750 main.log.error( "Test components did not start correctly, skipping further tests" )
751 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700752 # Assert variables - These variable's name|format must be followed
753 # if you want to use the wrapper function
754 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700755 try:
Jeremyd9e4eb12016-04-13 12:09:06 -0700756 assert main.numSwitch
757 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700758 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700759 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700760 main.initialized = main.FALSE
761 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700762
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700763 main.testName = "Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -0700764 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700765 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700766 main.caseExplanation = "This test case will test point to point" +\
Devin Lim142b5342017-07-20 15:22:39 -0700767 " intents using " + str( main.Cluster.numCtrls ) +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700768 " node(s) cluster;\n" +\
769 "Different type of hosts will be tested in " +\
770 "each step such as IPV4, Dual stack, VLAN etc" +\
771 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -0700772 " OVS running in Mininet and compile intents" +\
773 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700774
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700775 # No option point intents
776 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700777 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800778 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700779 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800780 ]
781 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700782 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800783 ]
Jeremy42df2e72016-02-23 16:37:46 -0800784 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700785 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700786 main,
787 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800788 senders=senders,
789 recipients=recipients )
790
791 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700792 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800793 main,
794 intentId=installResult,
795 name="NOOPTION",
796 senders=senders,
797 recipients=recipients,
798 sw1="s5",
799 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700800 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800801 else:
Devin Lim142b5342017-07-20 15:22:39 -0700802 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700803
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700804 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800805 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700806 onpass=main.assertReturnString,
807 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700808
kelvin-onlabb769f562015-07-15 17:05:10 -0700809 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700810 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800811 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700812 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800813 ]
814 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700815 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800816 ]
Jeremy42df2e72016-02-23 16:37:46 -0800817 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700818 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700819 main,
820 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800821 senders=senders,
822 recipients=recipients,
823 ethType="IPV4" )
824
825 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700826 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800827 main,
828 intentId=installResult,
829 name="IPV4",
830 senders=senders,
831 recipients=recipients,
832 sw1="s5",
833 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700834 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800835 else:
Devin Lim142b5342017-07-20 15:22:39 -0700836 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700837
838 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800839 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700840 onpass=main.assertReturnString,
841 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -0800842
Jon Hall78be4962017-05-23 14:53:53 -0700843 main.step( "Protected: Add point intents between h1 and h9" )
alisonda157272016-12-22 01:13:21 -0800844 main.assertReturnString = "Assertion Result for protected point intent\n"
845 senders = [
Jon Hall78be4962017-05-23 14:53:53 -0700846 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
alisonda157272016-12-22 01:13:21 -0800847 ]
848 recipients = [
Jon Hall78be4962017-05-23 14:53:53 -0700849 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
alisonda157272016-12-22 01:13:21 -0800850 ]
851 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700852 installResult = main.intents.installPointIntent(
alisonda157272016-12-22 01:13:21 -0800853 main,
854 name="Protected",
855 senders=senders,
856 recipients=recipients,
857 protected=True )
858
859 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700860 testResult = main.intents.testPointIntent(
alisonda157272016-12-22 01:13:21 -0800861 main,
862 name="Protected",
863 intentId=installResult,
864 senders=senders,
865 recipients=recipients,
866 sw1="s5",
867 sw2="s2",
868 protected=True,
869 expectedLink=18 )
870 else:
Devin Lim142b5342017-07-20 15:22:39 -0700871 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alisonda157272016-12-22 01:13:21 -0800872
873 utilities.assert_equals( expect=main.TRUE,
874 actual=testResult,
875 onpass=main.assertReturnString,
876 onfail=main.assertReturnString )
877
kelvin-onlabb769f562015-07-15 17:05:10 -0700878 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700879 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800880 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700881 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800882 ]
883 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700884 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800885 ]
Jeremy42df2e72016-02-23 16:37:46 -0800886 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700887 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700888 main,
889 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800890 senders=senders,
891 recipients=recipients,
892 ethType="IPV4" )
893
894 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700895 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800896 main,
897 intentId=installResult,
898 name="IPV4_2",
899 senders=senders,
900 recipients=recipients,
901 sw1="s5",
902 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700903 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800904 else:
Devin Lim142b5342017-07-20 15:22:39 -0700905 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700906
907 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800908 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700909 onpass=main.assertReturnString,
910 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700911
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700912 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700913 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800914 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700915 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700916 "ip": ( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800917 ]
918 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700919 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700920 "ip": ( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800921 ]
Jeremy6f000c62016-02-25 17:02:28 -0800922 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -0700923 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800924 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
925 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -0800926 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700927 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800928 main,
929 name="SDNIP-ICMP",
930 senders=senders,
931 recipients=recipients,
932 ethType="IPV4",
933 ipProto=ipProto,
934 tcpSrc=tcpSrc,
935 tcpDst=tcpDst )
936
937 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700938 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800939 main,
940 intentId=installResult,
941 name="SDNIP_ICMP",
942 senders=senders,
943 recipients=recipients,
944 sw1="s5",
945 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -0700946 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700947 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -0800948 else:
Devin Lim142b5342017-07-20 15:22:39 -0700949 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -0700950
951 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800952 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700953 onpass=main.assertReturnString,
954 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700955
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700956 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700957 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -0700958 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
959 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700960 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
961 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -0700962 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
963 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
964 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
965
Jon Hall78be4962017-05-23 14:53:53 -0700966 stepResult = main.intents.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -0700967 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700968 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -0700969 host1="h1",
970 host2="h9",
971 deviceId1="of:0000000000000005/1",
972 deviceId2="of:0000000000000006/1",
973 mac1=mac1,
974 mac2=mac2,
975 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700976 ipProto=ipProto,
977 ip1=ip1,
978 ip2=ip2,
979 tcp1=tcp1,
980 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -0700981
982 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -0800983 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -0700984 onpass=main.assertReturnString,
985 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700986
acsmars5d8cc862015-09-25 09:44:50 -0700987 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
988 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800989 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700990 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800991 ]
992 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700993 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800994 ]
Jeremy42df2e72016-02-23 16:37:46 -0800995 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700996 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700997 main,
998 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800999 senders=senders,
1000 recipients=recipients,
1001 ethType="IPV4" )
1002
1003 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001004 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001005 main,
1006 intentId=installResult,
1007 name="DUALSTACK1",
1008 senders=senders,
1009 recipients=recipients,
1010 sw1="s5",
1011 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001012 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001013 else:
Devin Lim142b5342017-07-20 15:22:39 -07001014 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001015
1016 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001017 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001018 onpass=main.assertReturnString,
1019 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001020
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001021 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001022 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001023 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001024 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001025 ]
1026 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001027 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001028 ]
Jeremy42df2e72016-02-23 16:37:46 -08001029 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001030 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001031 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001032 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001033 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001034 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001035
1036 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001037 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001038 main,
1039 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001040 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001041 senders=senders,
1042 recipients=recipients,
1043 sw1="s5",
1044 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001045 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001046
1047 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001048 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001049 onpass=main.assertReturnString,
1050 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001051
Jeremy Songsterff553672016-05-12 17:06:23 -07001052 main.step( "VLAN: Add point intents between h5 and h21" )
1053 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1054 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001055 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001056 ]
1057 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001058 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001059 ]
1060 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001061 installResult = main.intents.installPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001062 main,
1063 name="VLAN2",
1064 senders=senders,
1065 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001066 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001067
1068 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001069 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001070 main,
1071 intentId=installResult,
1072 name="VLAN2",
1073 senders=senders,
1074 recipients=recipients,
1075 sw1="s5",
1076 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001077 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001078
1079 utilities.assert_equals( expect=main.TRUE,
1080 actual=testResult,
1081 onpass=main.assertReturnString,
1082 onfail=main.assertReturnString )
1083
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001084 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001085 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001086 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001087 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001088 ]
1089 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001090 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001091 ]
Jeremy42df2e72016-02-23 16:37:46 -08001092 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001093 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001094 main,
1095 name="1HOP IPV4",
1096 senders=senders,
1097 recipients=recipients,
1098 ethType="IPV4" )
1099
1100 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001101 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001102 main,
1103 intentId=installResult,
1104 name="1HOP IPV4",
1105 senders=senders,
1106 recipients=recipients,
1107 sw1="s5",
1108 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001109 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001110 else:
Devin Lim142b5342017-07-20 15:22:39 -07001111 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001112
1113 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001114 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001115 onpass=main.assertReturnString,
1116 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001117
Jeremy Songsterc032f162016-08-04 17:14:49 -07001118 main.step( "Add point to point intents using VLAN Encapsulation" )
1119 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1120 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001121 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001122 ]
1123 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001124 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001125 ]
1126 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001127 installResult = main.intents.installPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001128 main,
1129 name="ENCAPSULATION",
1130 senders=senders,
1131 recipients=recipients,
1132 encap="VLAN" )
1133
1134 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001135 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001136 main,
1137 intentId=installResult,
1138 name="ENCAPSULATION",
1139 senders=senders,
1140 recipients=recipients,
1141 sw1="s5",
1142 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001143 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001144 else:
Devin Lim142b5342017-07-20 15:22:39 -07001145 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001146
1147 utilities.assert_equals( expect=main.TRUE,
1148 actual=testResult,
1149 onpass=main.assertReturnString,
1150 onfail=main.assertReturnString )
1151
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001152 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1153 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1154 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001155 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001156 ]
1157 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001158 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001159 ]
1160 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001161 installResult = main.intents.installPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001162 main,
1163 name="NOOPTION",
1164 senders=senders,
1165 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001166 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001167
1168 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001169 testResult = main.intents.testPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001170 main,
1171 intentId=installResult,
1172 name="NOOPTION",
1173 senders=senders,
1174 recipients=recipients,
1175 sw1="s5",
1176 sw2="s2",
1177 expectedLink=18 )
1178 else:
Devin Lim142b5342017-07-20 15:22:39 -07001179 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001180
1181 utilities.assert_equals( expect=main.TRUE,
1182 actual=testResult,
1183 onpass=main.assertReturnString,
1184 onfail=main.assertReturnString )
1185
Jon Hall78be4962017-05-23 14:53:53 -07001186 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -07001187 # main.step( "Add point to point intents using MPLS Encapsulation" )
1188 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1189 # senders = [
1190 # { "name": "h1", "device": "of:0000000000000005/1" }
1191 # ]
1192 # recipients = [
1193 # { "name": "h9", "device": "of:0000000000000006/1" }
1194 # ]
1195 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001196 # installResult = main.intents.installPointIntent(
alison52b25892016-09-19 10:53:48 -07001197 # main,
1198 # name="ENCAPSULATION",
1199 # senders=senders,
1200 # recipients=recipients,
1201 # encap="MPLS" )
1202 #
1203 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001204 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001205 # main,
1206 # intentId=installResult,
1207 # name="ENCAPSULATION",
1208 # senders=senders,
1209 # recipients=recipients,
1210 # sw1="s5",
1211 # sw2="s2",
1212 # expectedLink=18 )
1213 # else:
Devin Lim142b5342017-07-20 15:22:39 -07001214 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001215 #
1216 # utilities.assert_equals( expect=main.TRUE,
1217 # actual=testResult,
1218 # onpass=main.assertReturnString,
1219 # onfail=main.assertReturnString )
1220
Jon Hall78be4962017-05-23 14:53:53 -07001221 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001222
kelvin-onlabb769f562015-07-15 17:05:10 -07001223 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001224 """
1225 Add single point to multi point intents
1226 - Get device ids
1227 - Add single point to multi point intents
1228 - Check intents
1229 - Verify flows
1230 - Ping hosts
1231 - Reroute
1232 - Link down
1233 - Verify flows
1234 - Check topology
1235 - Ping hosts
1236 - Link up
1237 - Verify flows
1238 - Check topology
1239 - Ping hosts
1240 - Remove intents
1241 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001242 if main.initialized == main.FALSE:
1243 main.log.error( "Test components did not start correctly, skipping further tests" )
1244 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001245 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001246 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001247 assert main.numSwitch
1248 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001249 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001250 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001251 main.initialized = main.FALSE
1252 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001253
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001254 main.testName = "Single to Multi Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -07001255 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001256 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001257 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001258 " multi point intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -07001259 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001260 "Different type of hosts will be tested in " +\
1261 "each step such as IPV4, Dual stack, VLAN etc" +\
1262 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001263 " OVS running in Mininet and compile intents" +\
1264 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001265
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001266 main.step( "NOOPTION: Install and test single point to multi point intents" )
1267 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1268 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001269 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001270 ]
1271 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001272 { "name": "h16", "device": "of:0000000000000006/8" },
1273 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001274 ]
Jon Hall9c888672017-05-15 18:03:54 -07001275 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1276 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001277 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001278 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001279 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001280 name="NOOPTION",
1281 senders=senders,
1282 recipients=recipients,
1283 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001284 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001285
1286 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001287 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001288 main,
1289 intentId=installResult,
1290 name="NOOPTION",
1291 senders=senders,
1292 recipients=recipients,
1293 badSenders=badSenders,
1294 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001295 sw1="s5",
1296 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001297 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001298 else:
Devin Lim142b5342017-07-20 15:22:39 -07001299 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001300
1301 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001302 actual=testResult,
1303 onpass=main.assertReturnString,
1304 onfail=main.assertReturnString )
1305
1306 main.step( "IPV4: Install and test single point to multi point intents" )
1307 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1308 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001309 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001310 ]
1311 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001312 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1313 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001314 ]
Jon Hall9c888672017-05-15 18:03:54 -07001315 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1316 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001317 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001318 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001319 main,
1320 name="IPV4",
1321 senders=senders,
1322 recipients=recipients,
1323 ethType="IPV4",
1324 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001325 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001326
1327 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001328 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001329 main,
1330 intentId=installResult,
1331 name="IPV4",
1332 senders=senders,
1333 recipients=recipients,
1334 badSenders=badSenders,
1335 badRecipients=badRecipients,
1336 sw1="s5",
1337 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001338 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001339 else:
Devin Lim142b5342017-07-20 15:22:39 -07001340 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001341
1342 utilities.assert_equals( expect=main.TRUE,
1343 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001344 onpass=main.assertReturnString,
1345 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001346
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001347 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001348 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and no MAC addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001349 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001350 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001351 ]
1352 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001353 { "name": "h16", "device": "of:0000000000000006/8" },
1354 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001355 ]
Jon Hall9c888672017-05-15 18:03:54 -07001356 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1357 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001358 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001359 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001360 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001361 name="IPV4_2",
1362 senders=senders,
1363 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001364 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001365 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001366 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001367
1368 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001369 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001370 main,
1371 intentId=installResult,
1372 name="IPV4_2",
1373 senders=senders,
1374 recipients=recipients,
1375 badSenders=badSenders,
1376 badRecipients=badRecipients,
1377 sw1="s5",
1378 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001379 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001380 else:
Devin Lim142b5342017-07-20 15:22:39 -07001381 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001382
1383 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001384 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001385 onpass=main.assertReturnString,
1386 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001387
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001388 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001389 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses in the same VLAN\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001390 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001391 { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001392 ]
1393 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001394 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1395 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001396 ]
Jon Hall9c888672017-05-15 18:03:54 -07001397 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1398 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001399 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001400 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001401 main,
alison52b25892016-09-19 10:53:48 -07001402 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001403 senders=senders,
1404 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001405 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001406 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001407
1408 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001409 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001410 main,
1411 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001412 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001413 senders=senders,
1414 recipients=recipients,
1415 badSenders=badSenders,
1416 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001417 sw1="s5",
1418 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001419 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001420 else:
Devin Lim142b5342017-07-20 15:22:39 -07001421 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001422
1423 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001424 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001425 onpass=main.assertReturnString,
1426 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001427
Jeremy Songsterff553672016-05-12 17:06:23 -07001428 main.step( "VLAN: Add single point to multi point intents" )
1429 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1430 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001431 { "name": "h5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001432 ]
1433 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001434 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1435 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001436 ]
Jon Hall9c888672017-05-15 18:03:54 -07001437 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1438 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001439 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001440 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001441 main,
1442 name="VLAN2",
1443 senders=senders,
1444 recipients=recipients,
1445 sw1="s5",
1446 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001447 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001448
1449 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001450 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001451 main,
1452 intentId=installResult,
1453 name="VLAN2",
1454 senders=senders,
1455 recipients=recipients,
1456 badSenders=badSenders,
1457 badRecipients=badRecipients,
1458 sw1="s5",
1459 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001460 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001461 else:
Devin Lim142b5342017-07-20 15:22:39 -07001462 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -07001463
1464 utilities.assert_equals( expect=main.TRUE,
1465 actual=testResult,
1466 onpass=main.assertReturnString,
1467 onfail=main.assertReturnString )
1468
alison52b25892016-09-19 10:53:48 -07001469 # Does not support Single point to multi point encapsulation
1470 # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1471 # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1472 # senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001473 # { "name": "h8", "device": "of:0000000000000005/8" }
alison52b25892016-09-19 10:53:48 -07001474 # ]
1475 # recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001476 # { "name": "h16", "device": "of:0000000000000006/8" },
1477 # { "name": "h24", "device": "of:0000000000000007/8" }
alison52b25892016-09-19 10:53:48 -07001478 # ]
Jon Hall9c888672017-05-15 18:03:54 -07001479 # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1480 # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
alison52b25892016-09-19 10:53:48 -07001481 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001482 # installResult = main.intents.installSingleToMultiIntent(
alison52b25892016-09-19 10:53:48 -07001483 # main,
1484 # name="ENCAPSULATION",
1485 # senders=senders,
1486 # recipients=recipients,
1487 # sw1="s5",
1488 # sw2="s2",
1489 # encap="VLAN" )
1490 #
1491 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001492 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001493 # main,
1494 # intentId=installResult,
1495 # name="ENCAPSULATION",
1496 # senders=senders,
1497 # recipients=recipients,
1498 # badSenders=badSenders,
1499 # badRecipients=badRecipients,
1500 # sw1="s5",
1501 # sw2="s2",
1502 # expectedLink=18 )
1503 # else:
Devin Lim142b5342017-07-20 15:22:39 -07001504 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001505 #
1506 # utilities.assert_equals( expect=main.TRUE,
1507 # actual=testResult,
1508 # onpass=main.assertReturnString,
1509 # onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001510
Jon Hall78be4962017-05-23 14:53:53 -07001511 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001512
kelvin-onlabb769f562015-07-15 17:05:10 -07001513 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001514 """
1515 Add multi point to single point intents
1516 - Get device ids
1517 - Add multi point to single point intents
1518 - Check intents
1519 - Verify flows
1520 - Ping hosts
1521 - Reroute
1522 - Link down
1523 - Verify flows
1524 - Check topology
1525 - Ping hosts
1526 - Link up
1527 - Verify flows
1528 - Check topology
1529 - Ping hosts
1530 - Remove intents
1531 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001532 if main.initialized == main.FALSE:
1533 main.log.error( "Test components did not start correctly, skipping further tests" )
1534 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001535 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001536 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001537 assert main.numSwitch
1538 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001539 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001540 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001541 main.initialized = main.FALSE
1542 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001543
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001544 main.testName = "Multi To Single Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -07001545 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001546 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001547 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001548 " multi point intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -07001549 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001550 "Different type of hosts will be tested in " +\
1551 "each step such as IPV4, Dual stack, VLAN etc" +\
1552 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001553 " OVS running in Mininet and compile intents" +\
1554 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001555
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001556 main.step( "NOOPTION: Add multi point to single point intents" )
1557 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1558 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001559 { "name": "h16", "device": "of:0000000000000006/8" },
1560 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001561 ]
1562 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001563 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001564 ]
Jon Hall9c888672017-05-15 18:03:54 -07001565 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1566 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001567 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001568 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001569 main,
1570 name="NOOPTION",
1571 senders=senders,
1572 recipients=recipients,
1573 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001574 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001575
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001576 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001577 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001578 main,
1579 intentId=installResult,
1580 name="NOOPTION",
1581 senders=senders,
1582 recipients=recipients,
1583 badSenders=badSenders,
1584 badRecipients=badRecipients,
1585 sw1="s5",
1586 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001587 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001588 else:
Devin Lim142b5342017-07-20 15:22:39 -07001589 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001590
1591 utilities.assert_equals( expect=main.TRUE,
1592 actual=testResult,
1593 onpass=main.assertReturnString,
1594 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001595
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001596 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001597 main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and MAC addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001598 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001599 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1600 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001601 ]
1602 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001603 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001604 ]
Jon Hall9c888672017-05-15 18:03:54 -07001605 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1606 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001607 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001608 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001609 main,
1610 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001611 senders=senders,
1612 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001613 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001614 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001615 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001616
1617 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001618 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001619 main,
1620 intentId=installResult,
1621 name="IPV4",
1622 senders=senders,
1623 recipients=recipients,
1624 badSenders=badSenders,
1625 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001626 sw1="s5",
1627 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001628 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001629 else:
Devin Lim142b5342017-07-20 15:22:39 -07001630 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001631
1632 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001633 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001634 onpass=main.assertReturnString,
1635 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001636
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001637 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001638 main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and no MAC addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001639 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001640 { "name": "h16", "device": "of:0000000000000006/8" },
1641 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001642 ]
1643 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001644 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001645 ]
Jon Hall9c888672017-05-15 18:03:54 -07001646 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1647 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001648 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001649 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001650 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001651 name="IPV4_2",
1652 senders=senders,
1653 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001654 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001655 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001656 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001657
1658 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001659 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001660 main,
1661 intentId=installResult,
1662 name="IPV4_2",
1663 senders=senders,
1664 recipients=recipients,
1665 badSenders=badSenders,
1666 badRecipients=badRecipients,
1667 sw1="s5",
1668 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001669 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001670 else:
Devin Lim142b5342017-07-20 15:22:39 -07001671 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001672
1673 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001674 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001675 onpass=main.assertReturnString,
1676 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001677
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001678 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001679 main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and no MAC addresses in the same VLAN\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001680 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001681 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1682 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001683 ]
1684 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001685 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001686 ]
Jon Hall9c888672017-05-15 18:03:54 -07001687 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1688 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001689 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001690 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001691 main,
1692 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001693 senders=senders,
1694 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001695 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001696 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001697
1698 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001699 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001700 main,
1701 intentId=installResult,
1702 name="VLAN",
1703 senders=senders,
1704 recipients=recipients,
1705 badSenders=badSenders,
1706 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001707 sw1="s5",
1708 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001709 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001710 else:
Devin Lim142b5342017-07-20 15:22:39 -07001711 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001712
1713 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001714 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001715 onpass=main.assertReturnString,
1716 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001717
Jeremy Songsterff553672016-05-12 17:06:23 -07001718 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
1719 main.step( "VLAN: Add multi point to single point intents" )
1720 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
1721 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001722 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1723 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001724 ]
1725 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001726 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001727 ]
Jon Hall9c888672017-05-15 18:03:54 -07001728 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1729 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001730 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001731 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001732 main,
1733 name="VLAN2",
1734 senders=senders,
1735 recipients=recipients,
1736 sw1="s5",
1737 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001738 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001739
1740 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001741 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001742 main,
1743 intentId=installResult,
1744 name="VLAN2",
1745 senders=senders,
1746 recipients=recipients,
1747 badSenders=badSenders,
1748 badRecipients=badRecipients,
1749 sw1="s5",
1750 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001751 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001752 else:
Devin Lim142b5342017-07-20 15:22:39 -07001753 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -07001754
1755 utilities.assert_equals( expect=main.TRUE,
1756 actual=testResult,
1757 onpass=main.assertReturnString,
1758 onfail=main.assertReturnString )
1759
Jeremy Songsterc032f162016-08-04 17:14:49 -07001760 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1761 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
1762 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001763 { "name": "h16", "device": "of:0000000000000006/8" },
1764 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001765 ]
1766 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001767 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001768 ]
Jon Hall9c888672017-05-15 18:03:54 -07001769 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1770 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07001771 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001772 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001773 main,
1774 name="ENCAPSULATION",
1775 senders=senders,
1776 recipients=recipients,
1777 sw1="s5",
1778 sw2="s2",
1779 encap="VLAN" )
1780
1781 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001782 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001783 main,
1784 intentId=installResult,
1785 name="ENCAPSULATION",
1786 senders=senders,
1787 recipients=recipients,
1788 badSenders=badSenders,
1789 badRecipients=badRecipients,
1790 sw1="s5",
1791 sw2="s2",
1792 expectedLink=18 )
1793 else:
Devin Lim142b5342017-07-20 15:22:39 -07001794 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001795
1796 utilities.assert_equals( expect=main.TRUE,
1797 actual=testResult,
1798 onpass=main.assertReturnString,
1799 onfail=main.assertReturnString )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07001800 """
1801 Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
1802 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1803 main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
1804 senders = [
1805 { "name": "h16", "device": "of:0000000000000006/8" },
1806 { "name": "h24", "device": "of:0000000000000007/8" }
1807 ]
1808 recipients = [
1809 { "name": "h8", "device": "of:0000000000000005/8" }
1810 ]
1811 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1812 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
1813 testResult = main.FALSE
1814 installResult = main.intents.installMultiToSingleIntent(
1815 main,
1816 name="ENCAPSULATION",
1817 senders=senders,
1818 recipients=recipients,
1819 sw1="s5",
1820 sw2="s2",
1821 encap="MPLS" )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001822
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07001823 if installResult:
1824 testResult = main.intents.testPointIntent(
1825 main,
1826 intentId=installResult,
1827 name="ENCAPSULATION",
1828 senders=senders,
1829 recipients=recipients,
1830 badSenders=badSenders,
1831 badRecipients=badRecipients,
1832 sw1="s5",
1833 sw2="s2",
1834 expectedLink=18 )
1835 else:
1836 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
1837
1838 utilities.assert_equals( expect=main.TRUE,
1839 actual=testResult,
1840 onpass=main.assertReturnString,
1841 onfail=main.assertReturnString )
1842 """
alison52b25892016-09-19 10:53:48 -07001843
Jon Hall78be4962017-05-23 14:53:53 -07001844 main.intents.report( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001845
acsmars1ff5e052015-07-23 11:27:48 -07001846 def CASE5000( self, main ):
1847 """
acsmars5d8cc862015-09-25 09:44:50 -07001848 Tests Host Mobility
1849 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07001850 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001851 if main.initialized == main.FALSE:
1852 main.log.error( "Test components did not start correctly, skipping further tests" )
1853 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07001854 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001855 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001856 assert main.numSwitch
1857 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001858 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001859 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001860 main.initialized = main.FALSE
1861 main.skipCase()
Devin Lim142b5342017-07-20 15:22:39 -07001862 main.case( "Test host mobility with host intents " + " - " + str( main.Cluster.numCtrls ) +
alison52b25892016-09-19 10:53:48 -07001863 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001864 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001865
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001866 main.log.info( "Moving h1 from s5 to s6" )
You Wanga0f6ff62018-01-11 15:46:30 -08001867 main.Network.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001868
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001869 # Send discovery ping from moved host
1870 # Moving the host brings down the default interfaces and creates a new one.
1871 # Scapy is restarted on this host to detect the new interface
1872 main.h1.stopScapy()
1873 main.h1.startScapy()
1874
1875 # Discover new host location in ONOS and populate host data.
1876 # Host 1 IP and MAC should be unchanged
Jon Hall78be4962017-05-23 14:53:53 -07001877 main.intents.sendDiscoveryArp( main, [ main.h1 ] )
1878 main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001879
acsmars1ff5e052015-07-23 11:27:48 -07001880 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1881
1882 utilities.assert_equals( expect="of:0000000000000006",
1883 actual=h1PostMove,
1884 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07001885 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001886 " to single point intents" +
1887 " with IPV4 type and MAC addresses" +
1888 " in the same VLAN" )
1889
1890 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001891 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07001892 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
1893 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08001894 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001895 installResult = main.intents.installHostIntent( main,
1896 name="IPV4 Mobility IPV4",
1897 onosNode=0,
1898 host1=host1,
1899 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08001900 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001901 testResult = main.intents.testHostIntent( main,
1902 name="Host Mobility IPV4",
1903 intentId=installResult,
1904 onosNode=0,
1905 host1=host1,
1906 host2=host2,
1907 sw1="s6",
1908 sw2="s2",
1909 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001910 else:
Devin Lim142b5342017-07-20 15:22:39 -07001911 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001912
1913 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001914 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001915 onpass=main.assertReturnString,
1916 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07001917
Jon Hall78be4962017-05-23 14:53:53 -07001918 main.intents.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08001919
1920 def CASE6000( self, main ):
1921 """
1922 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
1923 """
Jeremy Songster9385d412016-06-02 17:57:36 -07001924 # At some later point discussion on this behavior in MPSP and SPMP intents
1925 # will be reoppened and this test case may need to be updated to reflect
1926 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07001927 if main.initialized == main.FALSE:
1928 main.log.error( "Test components did not start correctly, skipping further tests" )
1929 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08001930 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001931 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001932 assert main.numSwitch
1933 except AssertionError:
alison52b25892016-09-19 10:53:48 -07001934 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001935 main.initialized = main.FALSE
1936 main.skipCase()
Devin Lim142b5342017-07-20 15:22:39 -07001937 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.Cluster.numCtrls ) +
alison52b25892016-09-19 10:53:48 -07001938 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07001939 main.step( "Installing Multi to Single Point intents with no options set" )
1940 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
1941 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08001942 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001943 { "name": "h16", "device": "of:0000000000000006/8" },
1944 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001945 ]
1946 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001947 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001948 ]
1949 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07001950 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001951 ]
1952 isolatedRecipients = []
1953 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001954 installResult = main.intents.installMultiToSingleIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08001955 main,
1956 name="NOOPTION",
1957 senders=senders,
1958 recipients=recipients,
1959 sw1="s5",
1960 sw2="s2" )
1961
1962 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001963 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08001964 main,
1965 intentId=installResult,
1966 name="NOOPTION",
1967 senders=senders,
1968 recipients=recipients,
1969 isolatedSenders=isolatedSenders,
1970 isolatedRecipients=isolatedRecipients,
1971 sw1="s6",
1972 sw2="s2",
1973 sw3="s4",
1974 sw4="s1",
1975 sw5="s3",
1976 expectedLink1=16,
1977 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08001978 else:
Devin Lim142b5342017-07-20 15:22:39 -07001979 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08001980
1981 utilities.assert_equals( expect=main.TRUE,
1982 actual=testResult,
1983 onpass=main.assertReturnString,
1984 onfail=main.assertReturnString )
1985
Jeremy Songster9385d412016-06-02 17:57:36 -07001986 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
1987
1988 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
1989 "with partial failures allowed\n"
1990 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001991 { "name": "h16", "device": "of:0000000000000006/8" },
1992 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07001993 ]
1994 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001995 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07001996 ]
1997 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07001998 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07001999 ]
2000 isolatedRecipients = []
2001 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002002 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002003 main,
2004 name="NOOPTION",
2005 senders=senders,
2006 recipients=recipients,
2007 sw1="s5",
2008 sw2="s2",
2009 partial=True )
2010
2011 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002012 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002013 main,
2014 intentId=installResult,
2015 name="NOOPTION",
2016 senders=senders,
2017 recipients=recipients,
2018 isolatedSenders=isolatedSenders,
2019 isolatedRecipients=isolatedRecipients,
2020 sw1="s6",
2021 sw2="s2",
2022 sw3="s4",
2023 sw4="s1",
2024 sw5="s3",
2025 expectedLink1=16,
2026 expectedLink2=14,
2027 partial=True )
2028 else:
Devin Lim142b5342017-07-20 15:22:39 -07002029 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002030
2031 utilities.assert_equals( expect=main.TRUE,
2032 actual=testResult,
2033 onpass=main.assertReturnString,
2034 onfail=main.assertReturnString )
2035
Jeremye0cb5eb2016-01-27 17:39:09 -08002036 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002037 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2038 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002039 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002040 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002041 ]
2042 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002043 { "name": "h16", "device": "of:0000000000000006/8" },
2044 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002045 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002046 isolatedSenders = []
2047 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002048 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002049 ]
2050 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002051 installResult = main.intents.installSingleToMultiIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002052 main,
2053 name="NOOPTION",
2054 senders=senders,
2055 recipients=recipients,
2056 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002057 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002058
2059 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002060 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002061 main,
2062 intentId=installResult,
2063 name="NOOPTION",
2064 senders=senders,
2065 recipients=recipients,
2066 isolatedSenders=isolatedSenders,
2067 isolatedRecipients=isolatedRecipients,
2068 sw1="s6",
2069 sw2="s2",
2070 sw3="s4",
2071 sw4="s1",
2072 sw5="s3",
2073 expectedLink1=16,
2074 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002075 else:
Devin Lim142b5342017-07-20 15:22:39 -07002076 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002077
2078 utilities.assert_equals( expect=main.TRUE,
2079 actual=testResult,
2080 onpass=main.assertReturnString,
2081 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002082 # Right now this functionality doesn't work properly in SPMP intents
Jon Hall78be4962017-05-23 14:53:53 -07002083 main.step( "NOOPTION: Install and test single point to multi point " +
Jeremy Songster9385d412016-06-02 17:57:36 -07002084 "intents with partial failures allowed" )
2085 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2086 "point intent with partial failures allowed\n"
2087 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002088 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002089 ]
2090 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002091 { "name": "h16", "device": "of:0000000000000006/8" },
2092 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002093 ]
2094 isolatedSenders = []
2095 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002096 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002097 ]
2098 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002099 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002100 main,
2101 name="NOOPTION",
2102 senders=senders,
2103 recipients=recipients,
2104 sw1="s5",
2105 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002106 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002107
2108 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002109 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002110 main,
2111 intentId=installResult,
2112 name="NOOPTION",
2113 senders=senders,
2114 recipients=recipients,
2115 isolatedSenders=isolatedSenders,
2116 isolatedRecipients=isolatedRecipients,
2117 sw1="s6",
2118 sw2="s2",
2119 sw3="s4",
2120 sw4="s1",
2121 sw5="s3",
2122 expectedLink1=16,
2123 expectedLink2=14,
2124 partial=True )
2125 else:
Devin Lim142b5342017-07-20 15:22:39 -07002126 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002127
2128 utilities.assert_equals( expect=main.TRUE,
2129 actual=testResult,
2130 onpass=main.assertReturnString,
2131 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002132
Jon Hall78be4962017-05-23 14:53:53 -07002133 main.intents.report( main )