blob: 34c2674773c249ccbc902d5b6b6218d340e506ad [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"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700155 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700156 main.topology,
157 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700158 stepResult = topoResult
159 utilities.assert_equals( expect=main.TRUE,
160 actual=stepResult,
161 onpass="Successfully loaded topology",
162 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700163
164 # Set flag to test cases if topology did not load properly
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700165 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700166 main.initialized = main.FALSE
167 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700168
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700169 def CASE11( self, main ):
170 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700171 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700172 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700173 if main.initialized == main.FALSE:
174 main.log.error( "Test components did not start correctly, skipping further tests" )
175 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700176 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700177 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700178 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700179 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700180 "switches to test intents, exits out if " +\
181 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700182
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700183 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700184 args = "--switch ovs,protocols=OpenFlow13"
185 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
186 main.topology,
187 args=args )
188 stepResult = topoResult
189 utilities.assert_equals( expect=main.TRUE,
190 actual=stepResult,
191 onpass="Successfully loaded topology",
192 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700193 # Set flag to skip test cases if topology did not load properly
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700194 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700195 main.initialized = main.FALSE
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700196
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700197 def CASE12( self, main ):
198 """
199 Assign mastership to controllers
200 """
201 import re
202
Jeremyd9e4eb12016-04-13 12:09:06 -0700203 if main.initialized == main.FALSE:
204 main.log.error( "Test components did not start correctly, skipping further tests" )
205 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700206 main.case( "Assign switches to controllers" )
207 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700208 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700209 " switches to ONOS nodes"
210
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700211 switchList = []
212
213 # Creates a list switch name, use getSwitch() function later...
214 for i in range( 1, ( main.numSwitch + 1 ) ):
215 switchList.append( 's' + str( i ) )
216
Devin Lim142b5342017-07-20 15:22:39 -0700217 tempONOSip = main.Cluster.getIps()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700218
You Wanga0f6ff62018-01-11 15:46:30 -0800219 assignResult = main.Network.assignSwController( sw=switchList,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700220 ip=tempONOSip,
alison52b25892016-09-19 10:53:48 -0700221 port="6653" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700222 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700223 main.log.error( "Problem assigning mastership of switches" )
224 main.initialized = main.FALSE
225 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700226
227 for i in range( 1, ( main.numSwitch + 1 ) ):
You Wanga0f6ff62018-01-11 15:46:30 -0800228 response = main.Network.getSwController( "s" + str( i ) )
Jon Hall860b8152017-05-23 10:35:23 -0700229 main.log.debug( "Response is " + str( response ) )
Devin Lim142b5342017-07-20 15:22:39 -0700230 if re.search( "tcp:" + main.Cluster.active( 0 ).ipAddress, response ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700231 assignResult = assignResult and main.TRUE
232 else:
233 assignResult = main.FALSE
234 stepResult = assignResult
235 utilities.assert_equals( expect=main.TRUE,
236 actual=stepResult,
237 onpass="Successfully assigned switches" +
238 "to controller",
239 onfail="Failed to assign switches to " +
240 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700241 if not stepResult:
242 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700243
Jon Hall78be4962017-05-23 14:53:53 -0700244 def CASE13( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700245 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800246 Create Scapy components
247 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700248 if main.initialized == main.FALSE:
249 main.log.error( "Test components did not start correctly, skipping further tests" )
250 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800251 main.case( "Create scapy components" )
252 main.step( "Create scapy components" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800253 scapyResult = main.TRUE
254 for hostName in main.scapyHostNames:
255 main.Scapy1.createHostComponent( hostName )
256 main.scapyHosts.append( getattr( main, hostName ) )
257
258 main.step( "Start scapy components" )
259 for host in main.scapyHosts:
260 host.startHostCli()
261 host.startScapy()
262 host.updateSelf()
263 main.log.debug( host.name )
264 main.log.debug( host.hostIp )
265 main.log.debug( host.hostMac )
266
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800267 utilities.assert_equals( expect=main.TRUE,
268 actual=scapyResult,
269 onpass="Successfully created Scapy Components",
270 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700271 if not scapyResult:
272 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800273
274 def CASE14( self, main ):
275 """
276 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700277 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700278 if main.initialized == main.FALSE:
279 main.log.error( "Test components did not start correctly, skipping further tests" )
280 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700281 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800282 main.step( "Pingall hosts and confirm ONOS discovery" )
Jon Hall78be4962017-05-23 14:53:53 -0700283 utilities.retry( f=main.intents.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700284
Jon Hall78be4962017-05-23 14:53:53 -0700285 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery, retValue=main.FALSE,
286 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700287 utilities.assert_equals( expect=main.TRUE,
288 actual=stepResult,
289 onpass="Successfully discovered hosts",
290 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700291 if not stepResult:
292 main.initialized = main.FALSE
293 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700294
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800295 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700296 stepResult = main.intents.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700297 utilities.assert_equals( expect=main.TRUE,
298 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800299 onpass="Successfully populated hostsData",
300 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700301 if not stepResult:
302 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800303
304 def CASE15( self, main ):
305 """
306 Discover all hosts with scapy arp packets and store its data to a dictionary
307 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700308 if main.initialized == main.FALSE:
309 main.log.error( "Test components did not start correctly, skipping further tests" )
310 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800311 main.case( "Discover all hosts using scapy" )
312 main.step( "Send packets from each host to the first host and confirm onos discovery" )
313
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800314 if len( main.scapyHosts ) < 1:
315 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700316 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800317 main.skipCase()
318
319 # Send ARP packets from each scapy host component
Jon Hall78be4962017-05-23 14:53:53 -0700320 main.intents.sendDiscoveryArp( main, main.scapyHosts )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800321
Jon Hall78be4962017-05-23 14:53:53 -0700322 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800323 retValue=main.FALSE, args=[ main ],
324 attempts=main.checkTopoAttempts, sleep=2 )
325
326 utilities.assert_equals( expect=main.TRUE,
327 actual=stepResult,
328 onpass="ONOS correctly discovered all hosts",
329 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700330 if not stepResult:
331 main.initialized = main.FALSE
332 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800333
334 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700335 stepResult = main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800336 utilities.assert_equals( expect=main.TRUE,
337 actual=stepResult,
338 onpass="Successfully populated hostsData",
339 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700340 if not stepResult:
341 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800342
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800343 def CASE16( self, main ):
344 """
Jeremy42df2e72016-02-23 16:37:46 -0800345 Balance Masters
346 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700347 if main.initialized == main.FALSE:
348 main.log.error( "Test components did not start correctly, skipping further tests" )
349 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800350 main.case( "Balance mastership of switches" )
351 main.step( "Balancing mastership of switches" )
352
Devin Lim142b5342017-07-20 15:22:39 -0700353 balanceResult = utilities.retry( f=main.Cluster.active( 0 ).CLI.balanceMasters, retValue=main.FALSE, args=[] )
Jeremy42df2e72016-02-23 16:37:46 -0800354
355 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700356 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800357 onpass="Successfully balanced mastership of switches",
358 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700359 if not balanceResult:
360 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800361
362 def CASE17( self, main ):
363 """
Jeremy6e9748f2016-03-25 15:03:39 -0700364 Use Flow Objectives
365 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700366 if main.initialized == main.FALSE:
367 main.log.error( "Test components did not start correctly, skipping further tests" )
368 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700369 main.case( "Enable intent compilation using Flow Objectives" )
370 main.step( "Enabling Flow Objectives" )
371
372 main.flowCompiler = "Flow Objectives"
373
374 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
375
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="useFlowObjectives", value="true" )
Devin Lim142b5342017-07-20 15:22:39 -0700378 stepResult &= main.Cluster.active( 0 ).CLI.setCfg( component=cmd,
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700379 propName="defaultFlowObjectiveCompiler",
380 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler' )
Jeremy6e9748f2016-03-25 15:03:39 -0700381
382 utilities.assert_equals( expect=main.TRUE,
383 actual=stepResult,
384 onpass="Successfully activated Flow Objectives",
385 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700386 if not balanceResult:
387 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700388
389 def CASE18( self, main ):
390 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800391 Stop mininet and remove scapy host
392 """
Devin Lim58046fa2017-07-05 16:55:00 -0700393 try:
394 from tests.dependencies.utils import Utils
395 except ImportError:
396 main.log.error( "Utils not found exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -0700397 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700398 try:
399 main.Utils
400 except ( NameError, AttributeError ):
401 main.Utils = Utils()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800402 main.log.report( "Stop Mininet and Scapy" )
403 main.case( "Stop Mininet and Scapy" )
404 main.caseExplanation = "Stopping the current mininet topology " +\
405 "to start up fresh"
406 main.step( "Stopping and Removing Scapy Host Components" )
407 scapyResult = main.TRUE
408 for host in main.scapyHosts:
409 scapyResult = scapyResult and host.stopScapy()
410 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
411
412 for host in main.scapyHosts:
413 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
414 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
415
416 main.scapyHosts = []
417 main.scapyHostIPs = []
418
419 utilities.assert_equals( expect=main.TRUE,
420 actual=scapyResult,
421 onpass="Successfully stopped scapy and removed host components",
422 onfail="Failed to stop mininet and scapy" )
423
Devin Lim58046fa2017-07-05 16:55:00 -0700424 mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700425 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800426 if not ( mininetResult and scapyResult ):
Devin Lim44075962017-08-11 10:56:37 -0700427 main.cleanAndExit()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700428
Jeremy Songster17147f22016-05-31 18:30:52 -0700429 def CASE19( self, main ):
430 """
431 Copy the karaf.log files after each testcase cycle
432 """
Devin Lim58046fa2017-07-05 16:55:00 -0700433 try:
434 from tests.dependencies.utils import Utils
435 except ImportError:
436 main.log.error( "Utils not found exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -0700437 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700438 try:
439 main.Utils
440 except ( NameError, AttributeError ):
441 main.Utils = Utils()
Devin Lim142b5342017-07-20 15:22:39 -0700442 main.Utils.copyKarafLog( "cycle" + str( main.cycle ) )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700443
kelvin-onlabb769f562015-07-15 17:05:10 -0700444 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700445 """
446 Add host intents between 2 host:
447 - Discover hosts
448 - Add host intents
449 - Check intents
450 - Verify flows
451 - Ping hosts
452 - Reroute
453 - Link down
454 - Verify flows
455 - Check topology
456 - Ping hosts
457 - Link up
458 - Verify flows
459 - Check topology
460 - Ping hosts
461 - Remove intents
462 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700463 if main.initialized == main.FALSE:
464 main.log.error( "Test components did not start correctly, skipping further tests" )
465 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700466 # Assert variables - These variable's name|format must be followed
467 # if you want to use the wrapper function
468 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700469 try:
Jeremyd9e4eb12016-04-13 12:09:06 -0700470 assert main.numSwitch
471 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700472 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700473 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700474 main.initialized = main.FALSE
475 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700476
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800477 # Save leader candidates
Devin Lim142b5342017-07-20 15:22:39 -0700478 intentLeadersOld = main.Cluster.active( 0 ).CLI.leaderCandidates()
acsmarse6b410f2015-07-17 14:39:34 -0700479
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700480 main.testName = "Host Intents"
Devin Lim142b5342017-07-20 15:22:39 -0700481 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700482 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700483 main.caseExplanation = "This test case tests Host intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -0700484 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700485 "Different type of hosts will be tested in " +\
486 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700487 "etc;\nThe test will use OF " + main.OFProtocol +\
488 " OVS running in Mininet and compile intents" +\
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700489 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700490
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700491 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700492 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700493 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
494 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800495 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700496 installResult = main.intents.installHostIntent( main,
497 name="IPV4",
498 onosNode=0,
499 host1=host1,
500 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800501 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700502 testResult = main.intents.testHostIntent( main,
503 name="IPV4",
504 intentId=installResult,
505 onosNode=0,
506 host1=host1,
507 host2=host2,
508 sw1="s5",
509 sw2="s2",
510 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800511 else:
Devin Lim142b5342017-07-20 15:22:39 -0700512 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800513
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700514 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800515 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700516 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700517 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700518
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700519 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700520 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700521 host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
Jon Hall78be4962017-05-23 14:53:53 -0700522 host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 " }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800523 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700524 installResult = main.intents.installHostIntent( main,
525 name="DUALSTACK",
526 onosNode=0,
527 host1=host1,
528 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800529
530 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700531 testResult = main.intents.testHostIntent( main,
532 name="DUALSTACK",
533 intentId=installResult,
534 onosNode=0,
535 host1=host1,
536 host2=host2,
537 sw1="s5",
538 sw2="s2",
539 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700540
541 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800542 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700543 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700544 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700545
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700546 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700547 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700548 host1 = { "name": "h1" }
549 host2 = { "name": "h11" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800550 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700551 installResult = main.intents.installHostIntent( main,
552 name="DUALSTACK2",
553 onosNode=0,
554 host1=host1,
555 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800556
557 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700558 testResult = main.intents.testHostIntent( main,
559 name="DUALSTACK2",
560 intentId=installResult,
561 onosNode=0,
562 host1=host1,
563 host2=host2,
564 sw1="s5",
565 sw2="s2",
566 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800567 else:
Devin Lim142b5342017-07-20 15:22:39 -0700568 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700569
570 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800571 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700572 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700573 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700574
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700575 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700576 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jon Hall9c888672017-05-15 18:03:54 -0700577 host1 = { "name": "h1" }
578 host2 = { "name": "h3" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800579 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700580 installResult = main.intents.installHostIntent( main,
581 name="1HOP",
582 onosNode=0,
583 host1=host1,
584 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800585
586 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700587 testResult = main.intents.testHostIntent( main,
588 name="1HOP",
589 intentId=installResult,
590 onosNode=0,
591 host1=host1,
592 host2=host2,
593 sw1="s5",
594 sw2="s2",
595 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800596 else:
Devin Lim142b5342017-07-20 15:22:39 -0700597 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700598
599 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800600 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700601 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700602 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700603
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700604 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700605 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700606 host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
607 host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800608 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700609 installResult = main.intents.installHostIntent( main,
610 name="VLAN1",
611 onosNode=0,
612 host1=host1,
613 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800614 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700615 testResult = main.intents.testHostIntent( main,
616 name="VLAN1",
617 intentId=installResult,
618 onosNode=0,
619 host1=host1,
620 host2=host2,
621 sw1="s5",
622 sw2="s2",
623 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800624 else:
Devin Lim142b5342017-07-20 15:22:39 -0700625 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700626
627 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800628 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700629 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700630 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700631
Jeremy Songsterff553672016-05-12 17:06:23 -0700632 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
633 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700634 host1 = { "name": "h5", "vlan": "200" }
635 host2 = { "name": "h12", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -0700636 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700637 installResult = main.intents.installHostIntent( main,
638 name="VLAN2",
639 onosNode=0,
640 host1=host1,
641 host2=host2 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700642
643 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700644 testResult = main.intents.testHostIntent( main,
645 name="VLAN2",
646 intentId=installResult,
647 onosNode=0,
648 host1=host1,
649 host2=host2,
650 sw1="s5",
651 sw2="s2",
652 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700653 else:
Devin Lim142b5342017-07-20 15:22:39 -0700654 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -0700655
656 utilities.assert_equals( expect=main.TRUE,
657 actual=testResult,
658 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700659 onfail=main.assertReturnString )
Jeremy Songsterff553672016-05-12 17:06:23 -0700660
Jeremy Songsterc032f162016-08-04 17:14:49 -0700661 main.step( "Encapsulation: Add host intents between h1 and h9" )
662 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700663 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
664 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -0700665 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700666 installResult = main.intents.installHostIntent( main,
667 name="ENCAPSULATION",
668 onosNode=0,
669 host1=host1,
670 host2=host2,
671 encap="VLAN" )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700672 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700673 testResult = main.intents.testHostIntent( main,
674 name="ENCAPSULATION",
675 intentId=installResult,
676 onosNode=0,
677 host1=host1,
678 host2=host2,
679 sw1="s5",
680 sw2="s2",
681 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700682 else:
Devin Lim142b5342017-07-20 15:22:39 -0700683 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700684
685 utilities.assert_equals( expect=main.TRUE,
686 actual=testResult,
687 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700688 onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700689
Jon Hall78be4962017-05-23 14:53:53 -0700690 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -0700691 # main.step( "Encapsulation: Add host intents between h1 and h9" )
692 # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
693 # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
694 # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
695 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700696 # installResult = main.intents.installHostIntent( main,
697 # name="ENCAPSULATION",
698 # onosNode=0,
699 # host1=host1,
700 # host2=host2,
701 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -0700702 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700703 # testResult = main.intents.testHostIntent( main,
704 # name="ENCAPSULATION",
705 # intentId=installResult,
706 # onosNode=0,
707 # host1=host1,
708 # host2=host2,
709 # sw1="s5",
710 # sw2="s2",
711 # expectedLink=18 )
alison52b25892016-09-19 10:53:48 -0700712 # else:
Devin Lim142b5342017-07-20 15:22:39 -0700713 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -0700714 #
715 # utilities.assert_equals( expect=main.TRUE,
716 # actual=testResult,
717 # onpass=main.assertReturnString,
718 # onfail=main.assertReturnString )
719
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700720 main.step( "Confirm that ONOS leadership is unchanged" )
Devin Lim142b5342017-07-20 15:22:39 -0700721 intentLeadersNew = main.Cluster.active( 0 ).CLI.leaderCandidates()
Jon Hall78be4962017-05-23 14:53:53 -0700722 testResult = main.intents.checkLeaderChange( intentLeadersOld,
723 intentLeadersNew )
acsmarse6b410f2015-07-17 14:39:34 -0700724
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800725 utilities.assert_equals( expect=main.TRUE,
726 actual=testResult,
727 onpass="ONOS Leaders Unchanged",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700728 onfail="ONOS Leader Mismatch" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800729
Jon Hall78be4962017-05-23 14:53:53 -0700730 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700731
kelvin-onlabb769f562015-07-15 17:05:10 -0700732 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700733 """
734 Add point intents between 2 hosts:
735 - Get device ids | ports
736 - Add point intents
737 - Check intents
738 - Verify flows
739 - Ping hosts
740 - Reroute
741 - Link down
742 - Verify flows
743 - Check topology
744 - Ping hosts
745 - Link up
746 - Verify flows
747 - Check topology
748 - Ping hosts
749 - Remove intents
750 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700751 if main.initialized == main.FALSE:
752 main.log.error( "Test components did not start correctly, skipping further tests" )
753 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700754 # Assert variables - These variable's name|format must be followed
755 # if you want to use the wrapper function
756 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700757 try:
Jeremyd9e4eb12016-04-13 12:09:06 -0700758 assert main.numSwitch
759 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700760 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700761 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700762 main.initialized = main.FALSE
763 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700764
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700765 main.testName = "Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -0700766 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700767 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700768 main.caseExplanation = "This test case will test point to point" +\
Devin Lim142b5342017-07-20 15:22:39 -0700769 " intents using " + str( main.Cluster.numCtrls ) +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700770 " node(s) cluster;\n" +\
771 "Different type of hosts will be tested in " +\
772 "each step such as IPV4, Dual stack, VLAN etc" +\
773 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -0700774 " OVS running in Mininet and compile intents" +\
775 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700776
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700777 # No option point intents
778 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700779 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800780 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700781 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800782 ]
783 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700784 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800785 ]
Jeremy42df2e72016-02-23 16:37:46 -0800786 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700787 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700788 main,
789 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800790 senders=senders,
791 recipients=recipients )
792
793 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700794 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800795 main,
796 intentId=installResult,
797 name="NOOPTION",
798 senders=senders,
799 recipients=recipients,
800 sw1="s5",
801 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700802 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800803 else:
Devin Lim142b5342017-07-20 15:22:39 -0700804 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700805
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700806 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800807 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700808 onpass=main.assertReturnString,
809 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700810
kelvin-onlabb769f562015-07-15 17:05:10 -0700811 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700812 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800813 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700814 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800815 ]
816 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700817 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800818 ]
Jeremy42df2e72016-02-23 16:37:46 -0800819 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700820 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700821 main,
822 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800823 senders=senders,
824 recipients=recipients,
825 ethType="IPV4" )
826
827 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700828 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800829 main,
830 intentId=installResult,
831 name="IPV4",
832 senders=senders,
833 recipients=recipients,
834 sw1="s5",
835 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700836 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800837 else:
Devin Lim142b5342017-07-20 15:22:39 -0700838 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700839
840 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800841 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700842 onpass=main.assertReturnString,
843 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -0800844
Jon Hall78be4962017-05-23 14:53:53 -0700845 main.step( "Protected: Add point intents between h1 and h9" )
alisonda157272016-12-22 01:13:21 -0800846 main.assertReturnString = "Assertion Result for protected point intent\n"
847 senders = [
Jon Hall78be4962017-05-23 14:53:53 -0700848 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
alisonda157272016-12-22 01:13:21 -0800849 ]
850 recipients = [
Jon Hall78be4962017-05-23 14:53:53 -0700851 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
alisonda157272016-12-22 01:13:21 -0800852 ]
853 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700854 installResult = main.intents.installPointIntent(
alisonda157272016-12-22 01:13:21 -0800855 main,
856 name="Protected",
857 senders=senders,
858 recipients=recipients,
859 protected=True )
860
861 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700862 testResult = main.intents.testPointIntent(
alisonda157272016-12-22 01:13:21 -0800863 main,
864 name="Protected",
865 intentId=installResult,
866 senders=senders,
867 recipients=recipients,
868 sw1="s5",
869 sw2="s2",
870 protected=True,
871 expectedLink=18 )
872 else:
Devin Lim142b5342017-07-20 15:22:39 -0700873 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alisonda157272016-12-22 01:13:21 -0800874
875 utilities.assert_equals( expect=main.TRUE,
876 actual=testResult,
877 onpass=main.assertReturnString,
878 onfail=main.assertReturnString )
879
kelvin-onlabb769f562015-07-15 17:05:10 -0700880 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700881 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800882 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700883 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800884 ]
885 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700886 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800887 ]
Jeremy42df2e72016-02-23 16:37:46 -0800888 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700889 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700890 main,
891 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800892 senders=senders,
893 recipients=recipients,
894 ethType="IPV4" )
895
896 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700897 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800898 main,
899 intentId=installResult,
900 name="IPV4_2",
901 senders=senders,
902 recipients=recipients,
903 sw1="s5",
904 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700905 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800906 else:
Devin Lim142b5342017-07-20 15:22:39 -0700907 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700908
909 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800910 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700911 onpass=main.assertReturnString,
912 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700913
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700914 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700915 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800916 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700917 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700918 "ip": ( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800919 ]
920 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700921 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700922 "ip": ( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800923 ]
Jeremy6f000c62016-02-25 17:02:28 -0800924 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -0700925 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800926 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
927 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -0800928 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700929 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800930 main,
931 name="SDNIP-ICMP",
932 senders=senders,
933 recipients=recipients,
934 ethType="IPV4",
935 ipProto=ipProto,
936 tcpSrc=tcpSrc,
937 tcpDst=tcpDst )
938
939 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700940 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800941 main,
942 intentId=installResult,
943 name="SDNIP_ICMP",
944 senders=senders,
945 recipients=recipients,
946 sw1="s5",
947 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -0700948 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700949 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -0800950 else:
Devin Lim142b5342017-07-20 15:22:39 -0700951 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -0700952
953 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800954 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700955 onpass=main.assertReturnString,
956 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700957
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700958 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700959 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -0700960 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
961 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700962 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
963 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -0700964 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
965 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
966 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
967
Jon Hall78be4962017-05-23 14:53:53 -0700968 stepResult = main.intents.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -0700969 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700970 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -0700971 host1="h1",
972 host2="h9",
973 deviceId1="of:0000000000000005/1",
974 deviceId2="of:0000000000000006/1",
975 mac1=mac1,
976 mac2=mac2,
977 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700978 ipProto=ipProto,
979 ip1=ip1,
980 ip2=ip2,
981 tcp1=tcp1,
982 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -0700983
984 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -0800985 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -0700986 onpass=main.assertReturnString,
987 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700988
acsmars5d8cc862015-09-25 09:44:50 -0700989 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
990 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800991 senders = [
Jon Hall9c888672017-05-15 18:03:54 -0700992 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800993 ]
994 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -0700995 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800996 ]
Jeremy42df2e72016-02-23 16:37:46 -0800997 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700998 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700999 main,
1000 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001001 senders=senders,
1002 recipients=recipients,
1003 ethType="IPV4" )
1004
1005 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001006 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001007 main,
1008 intentId=installResult,
1009 name="DUALSTACK1",
1010 senders=senders,
1011 recipients=recipients,
1012 sw1="s5",
1013 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001014 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001015 else:
Devin Lim142b5342017-07-20 15:22:39 -07001016 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001017
1018 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001019 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001020 onpass=main.assertReturnString,
1021 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001022
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001023 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001024 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001025 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001026 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001027 ]
1028 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001029 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001030 ]
Jeremy42df2e72016-02-23 16:37:46 -08001031 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001032 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001033 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001034 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001035 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001036 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001037
1038 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001039 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001040 main,
1041 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001042 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001043 senders=senders,
1044 recipients=recipients,
1045 sw1="s5",
1046 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001047 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001048
1049 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001050 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001051 onpass=main.assertReturnString,
1052 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001053
Jeremy Songsterff553672016-05-12 17:06:23 -07001054 main.step( "VLAN: Add point intents between h5 and h21" )
1055 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1056 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001057 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001058 ]
1059 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001060 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001061 ]
1062 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001063 installResult = main.intents.installPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001064 main,
1065 name="VLAN2",
1066 senders=senders,
1067 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001068 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001069
1070 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001071 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001072 main,
1073 intentId=installResult,
1074 name="VLAN2",
1075 senders=senders,
1076 recipients=recipients,
1077 sw1="s5",
1078 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001079 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001080
1081 utilities.assert_equals( expect=main.TRUE,
1082 actual=testResult,
1083 onpass=main.assertReturnString,
1084 onfail=main.assertReturnString )
1085
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001086 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001087 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001088 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001089 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001090 ]
1091 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001092 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001093 ]
Jeremy42df2e72016-02-23 16:37:46 -08001094 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001095 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001096 main,
1097 name="1HOP IPV4",
1098 senders=senders,
1099 recipients=recipients,
1100 ethType="IPV4" )
1101
1102 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001103 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001104 main,
1105 intentId=installResult,
1106 name="1HOP IPV4",
1107 senders=senders,
1108 recipients=recipients,
1109 sw1="s5",
1110 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001111 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001112 else:
Devin Lim142b5342017-07-20 15:22:39 -07001113 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001114
1115 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001116 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001117 onpass=main.assertReturnString,
1118 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001119
Jeremy Songsterc032f162016-08-04 17:14:49 -07001120 main.step( "Add point to point intents using VLAN Encapsulation" )
1121 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1122 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001123 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001124 ]
1125 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001126 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001127 ]
1128 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001129 installResult = main.intents.installPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001130 main,
1131 name="ENCAPSULATION",
1132 senders=senders,
1133 recipients=recipients,
1134 encap="VLAN" )
1135
1136 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001137 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001138 main,
1139 intentId=installResult,
1140 name="ENCAPSULATION",
1141 senders=senders,
1142 recipients=recipients,
1143 sw1="s5",
1144 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001145 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001146 else:
Devin Lim142b5342017-07-20 15:22:39 -07001147 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001148
1149 utilities.assert_equals( expect=main.TRUE,
1150 actual=testResult,
1151 onpass=main.assertReturnString,
1152 onfail=main.assertReturnString )
1153
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001154 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1155 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1156 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001157 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001158 ]
1159 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001160 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001161 ]
1162 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001163 installResult = main.intents.installPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001164 main,
1165 name="NOOPTION",
1166 senders=senders,
1167 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001168 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001169
1170 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001171 testResult = main.intents.testPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001172 main,
1173 intentId=installResult,
1174 name="NOOPTION",
1175 senders=senders,
1176 recipients=recipients,
1177 sw1="s5",
1178 sw2="s2",
1179 expectedLink=18 )
1180 else:
Devin Lim142b5342017-07-20 15:22:39 -07001181 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001182
1183 utilities.assert_equals( expect=main.TRUE,
1184 actual=testResult,
1185 onpass=main.assertReturnString,
1186 onfail=main.assertReturnString )
1187
Jon Hall78be4962017-05-23 14:53:53 -07001188 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -07001189 # main.step( "Add point to point intents using MPLS Encapsulation" )
1190 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1191 # senders = [
1192 # { "name": "h1", "device": "of:0000000000000005/1" }
1193 # ]
1194 # recipients = [
1195 # { "name": "h9", "device": "of:0000000000000006/1" }
1196 # ]
1197 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001198 # installResult = main.intents.installPointIntent(
alison52b25892016-09-19 10:53:48 -07001199 # main,
1200 # name="ENCAPSULATION",
1201 # senders=senders,
1202 # recipients=recipients,
1203 # encap="MPLS" )
1204 #
1205 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001206 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001207 # main,
1208 # intentId=installResult,
1209 # name="ENCAPSULATION",
1210 # senders=senders,
1211 # recipients=recipients,
1212 # sw1="s5",
1213 # sw2="s2",
1214 # expectedLink=18 )
1215 # else:
Devin Lim142b5342017-07-20 15:22:39 -07001216 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001217 #
1218 # utilities.assert_equals( expect=main.TRUE,
1219 # actual=testResult,
1220 # onpass=main.assertReturnString,
1221 # onfail=main.assertReturnString )
1222
Jon Hall78be4962017-05-23 14:53:53 -07001223 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001224
kelvin-onlabb769f562015-07-15 17:05:10 -07001225 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001226 """
1227 Add single point to multi point intents
1228 - Get device ids
1229 - Add single point to multi point intents
1230 - Check intents
1231 - Verify flows
1232 - Ping hosts
1233 - Reroute
1234 - Link down
1235 - Verify flows
1236 - Check topology
1237 - Ping hosts
1238 - Link up
1239 - Verify flows
1240 - Check topology
1241 - Ping hosts
1242 - Remove intents
1243 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001244 if main.initialized == main.FALSE:
1245 main.log.error( "Test components did not start correctly, skipping further tests" )
1246 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001247 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001248 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001249 assert main.numSwitch
1250 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001251 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001252 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001253 main.initialized = main.FALSE
1254 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001255
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001256 main.testName = "Single to Multi Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -07001257 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001258 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001259 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001260 " multi point intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -07001261 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001262 "Different type of hosts will be tested in " +\
1263 "each step such as IPV4, Dual stack, VLAN etc" +\
1264 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001265 " OVS running in Mininet and compile intents" +\
1266 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001267
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001268 main.step( "NOOPTION: Install and test single point to multi point intents" )
1269 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1270 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001271 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001272 ]
1273 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001274 { "name": "h16", "device": "of:0000000000000006/8" },
1275 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001276 ]
Jon Hall9c888672017-05-15 18:03:54 -07001277 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1278 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001279 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001280 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001281 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001282 name="NOOPTION",
1283 senders=senders,
1284 recipients=recipients,
1285 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001286 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001287
1288 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001289 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001290 main,
1291 intentId=installResult,
1292 name="NOOPTION",
1293 senders=senders,
1294 recipients=recipients,
1295 badSenders=badSenders,
1296 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001297 sw1="s5",
1298 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001299 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001300 else:
Devin Lim142b5342017-07-20 15:22:39 -07001301 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001302
1303 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001304 actual=testResult,
1305 onpass=main.assertReturnString,
1306 onfail=main.assertReturnString )
1307
1308 main.step( "IPV4: Install and test single point to multi point intents" )
1309 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1310 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001311 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001312 ]
1313 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001314 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1315 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001316 ]
Jon Hall9c888672017-05-15 18:03:54 -07001317 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1318 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001319 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001320 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001321 main,
1322 name="IPV4",
1323 senders=senders,
1324 recipients=recipients,
1325 ethType="IPV4",
1326 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001327 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001328
1329 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001330 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001331 main,
1332 intentId=installResult,
1333 name="IPV4",
1334 senders=senders,
1335 recipients=recipients,
1336 badSenders=badSenders,
1337 badRecipients=badRecipients,
1338 sw1="s5",
1339 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001340 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001341 else:
Devin Lim142b5342017-07-20 15:22:39 -07001342 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001343
1344 utilities.assert_equals( expect=main.TRUE,
1345 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001346 onpass=main.assertReturnString,
1347 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001348
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001349 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001350 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 -08001351 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001352 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001353 ]
1354 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001355 { "name": "h16", "device": "of:0000000000000006/8" },
1356 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001357 ]
Jon Hall9c888672017-05-15 18:03:54 -07001358 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1359 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001360 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001361 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001362 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001363 name="IPV4_2",
1364 senders=senders,
1365 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001366 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001367 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001368 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001369
1370 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001371 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001372 main,
1373 intentId=installResult,
1374 name="IPV4_2",
1375 senders=senders,
1376 recipients=recipients,
1377 badSenders=badSenders,
1378 badRecipients=badRecipients,
1379 sw1="s5",
1380 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001381 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001382 else:
Devin Lim142b5342017-07-20 15:22:39 -07001383 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001384
1385 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001386 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001387 onpass=main.assertReturnString,
1388 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001389
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001390 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001391 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 -08001392 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001393 { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001394 ]
1395 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001396 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1397 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001398 ]
Jon Hall9c888672017-05-15 18:03:54 -07001399 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1400 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001401 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001402 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001403 main,
alison52b25892016-09-19 10:53:48 -07001404 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001405 senders=senders,
1406 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001407 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001408 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001409
1410 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001411 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001412 main,
1413 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001414 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001415 senders=senders,
1416 recipients=recipients,
1417 badSenders=badSenders,
1418 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001419 sw1="s5",
1420 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001421 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001422 else:
Devin Lim142b5342017-07-20 15:22:39 -07001423 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001424
1425 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001426 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001427 onpass=main.assertReturnString,
1428 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001429
Jeremy Songsterff553672016-05-12 17:06:23 -07001430 main.step( "VLAN: Add single point to multi point intents" )
1431 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1432 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001433 { "name": "h5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001434 ]
1435 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001436 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1437 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001438 ]
Jon Hall9c888672017-05-15 18:03:54 -07001439 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1440 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001441 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001442 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001443 main,
1444 name="VLAN2",
1445 senders=senders,
1446 recipients=recipients,
1447 sw1="s5",
1448 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001449 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001450
1451 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001452 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001453 main,
1454 intentId=installResult,
1455 name="VLAN2",
1456 senders=senders,
1457 recipients=recipients,
1458 badSenders=badSenders,
1459 badRecipients=badRecipients,
1460 sw1="s5",
1461 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001462 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001463 else:
Devin Lim142b5342017-07-20 15:22:39 -07001464 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -07001465
1466 utilities.assert_equals( expect=main.TRUE,
1467 actual=testResult,
1468 onpass=main.assertReturnString,
1469 onfail=main.assertReturnString )
1470
alison52b25892016-09-19 10:53:48 -07001471 # Does not support Single point to multi point encapsulation
1472 # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1473 # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1474 # senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001475 # { "name": "h8", "device": "of:0000000000000005/8" }
alison52b25892016-09-19 10:53:48 -07001476 # ]
1477 # recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001478 # { "name": "h16", "device": "of:0000000000000006/8" },
1479 # { "name": "h24", "device": "of:0000000000000007/8" }
alison52b25892016-09-19 10:53:48 -07001480 # ]
Jon Hall9c888672017-05-15 18:03:54 -07001481 # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1482 # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
alison52b25892016-09-19 10:53:48 -07001483 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001484 # installResult = main.intents.installSingleToMultiIntent(
alison52b25892016-09-19 10:53:48 -07001485 # main,
1486 # name="ENCAPSULATION",
1487 # senders=senders,
1488 # recipients=recipients,
1489 # sw1="s5",
1490 # sw2="s2",
1491 # encap="VLAN" )
1492 #
1493 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001494 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001495 # main,
1496 # intentId=installResult,
1497 # name="ENCAPSULATION",
1498 # senders=senders,
1499 # recipients=recipients,
1500 # badSenders=badSenders,
1501 # badRecipients=badRecipients,
1502 # sw1="s5",
1503 # sw2="s2",
1504 # expectedLink=18 )
1505 # else:
Devin Lim142b5342017-07-20 15:22:39 -07001506 # main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07001507 #
1508 # utilities.assert_equals( expect=main.TRUE,
1509 # actual=testResult,
1510 # onpass=main.assertReturnString,
1511 # onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001512
Jon Hall78be4962017-05-23 14:53:53 -07001513 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001514
kelvin-onlabb769f562015-07-15 17:05:10 -07001515 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001516 """
1517 Add multi point to single point intents
1518 - Get device ids
1519 - Add multi point to single point intents
1520 - Check intents
1521 - Verify flows
1522 - Ping hosts
1523 - Reroute
1524 - Link down
1525 - Verify flows
1526 - Check topology
1527 - Ping hosts
1528 - Link up
1529 - Verify flows
1530 - Check topology
1531 - Ping hosts
1532 - Remove intents
1533 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001534 if main.initialized == main.FALSE:
1535 main.log.error( "Test components did not start correctly, skipping further tests" )
1536 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001537 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001538 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001539 assert main.numSwitch
1540 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001541 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001542 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001543 main.initialized = main.FALSE
1544 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001545
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001546 main.testName = "Multi To Single Point Intents"
Devin Lim142b5342017-07-20 15:22:39 -07001547 main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001548 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001549 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001550 " multi point intents using " +\
Devin Lim142b5342017-07-20 15:22:39 -07001551 str( main.Cluster.numCtrls ) + " node(s) cluster;\n" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001552 "Different type of hosts will be tested in " +\
1553 "each step such as IPV4, Dual stack, VLAN etc" +\
1554 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001555 " OVS running in Mininet and compile intents" +\
1556 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001557
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001558 main.step( "NOOPTION: Add multi point to single point intents" )
1559 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1560 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001561 { "name": "h16", "device": "of:0000000000000006/8" },
1562 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001563 ]
1564 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001565 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001566 ]
Jon Hall9c888672017-05-15 18:03:54 -07001567 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1568 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001569 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001570 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001571 main,
1572 name="NOOPTION",
1573 senders=senders,
1574 recipients=recipients,
1575 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001576 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001577
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001578 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001579 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001580 main,
1581 intentId=installResult,
1582 name="NOOPTION",
1583 senders=senders,
1584 recipients=recipients,
1585 badSenders=badSenders,
1586 badRecipients=badRecipients,
1587 sw1="s5",
1588 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001589 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001590 else:
Devin Lim142b5342017-07-20 15:22:39 -07001591 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001592
1593 utilities.assert_equals( expect=main.TRUE,
1594 actual=testResult,
1595 onpass=main.assertReturnString,
1596 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001597
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001598 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001599 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 -08001600 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001601 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1602 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001603 ]
1604 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001605 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001606 ]
Jon Hall9c888672017-05-15 18:03:54 -07001607 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1608 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001609 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001610 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001611 main,
1612 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001613 senders=senders,
1614 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001615 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001616 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001617 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001618
1619 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001620 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001621 main,
1622 intentId=installResult,
1623 name="IPV4",
1624 senders=senders,
1625 recipients=recipients,
1626 badSenders=badSenders,
1627 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001628 sw1="s5",
1629 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001630 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001631 else:
Devin Lim142b5342017-07-20 15:22:39 -07001632 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001633
1634 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001635 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001636 onpass=main.assertReturnString,
1637 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001638
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001639 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001640 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 -08001641 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001642 { "name": "h16", "device": "of:0000000000000006/8" },
1643 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001644 ]
1645 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001646 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001647 ]
Jon Hall9c888672017-05-15 18:03:54 -07001648 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1649 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001650 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001651 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001652 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001653 name="IPV4_2",
1654 senders=senders,
1655 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001656 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001657 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001658 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001659
1660 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001661 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001662 main,
1663 intentId=installResult,
1664 name="IPV4_2",
1665 senders=senders,
1666 recipients=recipients,
1667 badSenders=badSenders,
1668 badRecipients=badRecipients,
1669 sw1="s5",
1670 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001671 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001672 else:
Devin Lim142b5342017-07-20 15:22:39 -07001673 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001674
1675 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001676 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001677 onpass=main.assertReturnString,
1678 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001679
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001680 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001681 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 -08001682 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001683 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1684 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001685 ]
1686 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001687 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001688 ]
Jon Hall9c888672017-05-15 18:03:54 -07001689 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1690 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001691 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001692 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001693 main,
1694 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001695 senders=senders,
1696 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001697 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001698 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001699
1700 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001701 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001702 main,
1703 intentId=installResult,
1704 name="VLAN",
1705 senders=senders,
1706 recipients=recipients,
1707 badSenders=badSenders,
1708 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001709 sw1="s5",
1710 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001711 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001712 else:
Devin Lim142b5342017-07-20 15:22:39 -07001713 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001714
1715 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001716 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001717 onpass=main.assertReturnString,
1718 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001719
Jeremy Songsterff553672016-05-12 17:06:23 -07001720 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
1721 main.step( "VLAN: Add multi point to single point intents" )
1722 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
1723 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001724 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1725 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001726 ]
1727 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001728 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001729 ]
Jon Hall9c888672017-05-15 18:03:54 -07001730 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1731 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001732 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001733 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001734 main,
1735 name="VLAN2",
1736 senders=senders,
1737 recipients=recipients,
1738 sw1="s5",
1739 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001740 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001741
1742 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001743 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001744 main,
1745 intentId=installResult,
1746 name="VLAN2",
1747 senders=senders,
1748 recipients=recipients,
1749 badSenders=badSenders,
1750 badRecipients=badRecipients,
1751 sw1="s5",
1752 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001753 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001754 else:
Devin Lim142b5342017-07-20 15:22:39 -07001755 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterff553672016-05-12 17:06:23 -07001756
1757 utilities.assert_equals( expect=main.TRUE,
1758 actual=testResult,
1759 onpass=main.assertReturnString,
1760 onfail=main.assertReturnString )
1761
Jeremy Songsterc032f162016-08-04 17:14:49 -07001762 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1763 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
1764 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001765 { "name": "h16", "device": "of:0000000000000006/8" },
1766 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001767 ]
1768 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001769 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001770 ]
Jon Hall9c888672017-05-15 18:03:54 -07001771 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1772 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07001773 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001774 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001775 main,
1776 name="ENCAPSULATION",
1777 senders=senders,
1778 recipients=recipients,
1779 sw1="s5",
1780 sw2="s2",
1781 encap="VLAN" )
1782
1783 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001784 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001785 main,
1786 intentId=installResult,
1787 name="ENCAPSULATION",
1788 senders=senders,
1789 recipients=recipients,
1790 badSenders=badSenders,
1791 badRecipients=badRecipients,
1792 sw1="s5",
1793 sw2="s2",
1794 expectedLink=18 )
1795 else:
Devin Lim142b5342017-07-20 15:22:39 -07001796 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001797
1798 utilities.assert_equals( expect=main.TRUE,
1799 actual=testResult,
1800 onpass=main.assertReturnString,
1801 onfail=main.assertReturnString )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07001802 """
1803 Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
1804 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1805 main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
1806 senders = [
1807 { "name": "h16", "device": "of:0000000000000006/8" },
1808 { "name": "h24", "device": "of:0000000000000007/8" }
1809 ]
1810 recipients = [
1811 { "name": "h8", "device": "of:0000000000000005/8" }
1812 ]
1813 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1814 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
1815 testResult = main.FALSE
1816 installResult = main.intents.installMultiToSingleIntent(
1817 main,
1818 name="ENCAPSULATION",
1819 senders=senders,
1820 recipients=recipients,
1821 sw1="s5",
1822 sw2="s2",
1823 encap="MPLS" )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001824
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07001825 if installResult:
1826 testResult = main.intents.testPointIntent(
1827 main,
1828 intentId=installResult,
1829 name="ENCAPSULATION",
1830 senders=senders,
1831 recipients=recipients,
1832 badSenders=badSenders,
1833 badRecipients=badRecipients,
1834 sw1="s5",
1835 sw2="s2",
1836 expectedLink=18 )
1837 else:
1838 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
1839
1840 utilities.assert_equals( expect=main.TRUE,
1841 actual=testResult,
1842 onpass=main.assertReturnString,
1843 onfail=main.assertReturnString )
1844 """
alison52b25892016-09-19 10:53:48 -07001845
Jon Hall78be4962017-05-23 14:53:53 -07001846 main.intents.report( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001847
acsmars1ff5e052015-07-23 11:27:48 -07001848 def CASE5000( self, main ):
1849 """
acsmars5d8cc862015-09-25 09:44:50 -07001850 Tests Host Mobility
1851 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07001852 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001853 if main.initialized == main.FALSE:
1854 main.log.error( "Test components did not start correctly, skipping further tests" )
1855 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07001856 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001857 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001858 assert main.numSwitch
1859 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001860 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001861 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001862 main.initialized = main.FALSE
1863 main.skipCase()
Devin Lim142b5342017-07-20 15:22:39 -07001864 main.case( "Test host mobility with host intents " + " - " + str( main.Cluster.numCtrls ) +
alison52b25892016-09-19 10:53:48 -07001865 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001866 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001867
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001868 main.log.info( "Moving h1 from s5 to s6" )
You Wanga0f6ff62018-01-11 15:46:30 -08001869 main.Network.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001870
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001871 # Send discovery ping from moved host
1872 # Moving the host brings down the default interfaces and creates a new one.
1873 # Scapy is restarted on this host to detect the new interface
1874 main.h1.stopScapy()
1875 main.h1.startScapy()
1876
1877 # Discover new host location in ONOS and populate host data.
1878 # Host 1 IP and MAC should be unchanged
Jon Hall78be4962017-05-23 14:53:53 -07001879 main.intents.sendDiscoveryArp( main, [ main.h1 ] )
1880 main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001881
acsmars1ff5e052015-07-23 11:27:48 -07001882 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1883
1884 utilities.assert_equals( expect="of:0000000000000006",
1885 actual=h1PostMove,
1886 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07001887 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001888 " to single point intents" +
1889 " with IPV4 type and MAC addresses" +
1890 " in the same VLAN" )
1891
1892 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001893 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07001894 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
1895 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08001896 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001897 installResult = main.intents.installHostIntent( main,
1898 name="IPV4 Mobility IPV4",
1899 onosNode=0,
1900 host1=host1,
1901 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08001902 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001903 testResult = main.intents.testHostIntent( main,
1904 name="Host Mobility IPV4",
1905 intentId=installResult,
1906 onosNode=0,
1907 host1=host1,
1908 host2=host2,
1909 sw1="s6",
1910 sw2="s2",
1911 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001912 else:
Devin Lim142b5342017-07-20 15:22:39 -07001913 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001914
1915 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001916 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001917 onpass=main.assertReturnString,
1918 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07001919
Jon Hall78be4962017-05-23 14:53:53 -07001920 main.intents.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08001921
1922 def CASE6000( self, main ):
1923 """
1924 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
1925 """
Jeremy Songster9385d412016-06-02 17:57:36 -07001926 # At some later point discussion on this behavior in MPSP and SPMP intents
1927 # will be reoppened and this test case may need to be updated to reflect
1928 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07001929 if main.initialized == main.FALSE:
1930 main.log.error( "Test components did not start correctly, skipping further tests" )
1931 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08001932 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001933 try:
Jeremyd9e4eb12016-04-13 12:09:06 -07001934 assert main.numSwitch
1935 except AssertionError:
alison52b25892016-09-19 10:53:48 -07001936 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001937 main.initialized = main.FALSE
1938 main.skipCase()
Devin Lim142b5342017-07-20 15:22:39 -07001939 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.Cluster.numCtrls ) +
alison52b25892016-09-19 10:53:48 -07001940 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07001941 main.step( "Installing Multi to Single Point intents with no options set" )
1942 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
1943 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08001944 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001945 { "name": "h16", "device": "of:0000000000000006/8" },
1946 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001947 ]
1948 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001949 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001950 ]
1951 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07001952 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08001953 ]
1954 isolatedRecipients = []
1955 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001956 installResult = main.intents.installMultiToSingleIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08001957 main,
1958 name="NOOPTION",
1959 senders=senders,
1960 recipients=recipients,
1961 sw1="s5",
1962 sw2="s2" )
1963
1964 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001965 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08001966 main,
1967 intentId=installResult,
1968 name="NOOPTION",
1969 senders=senders,
1970 recipients=recipients,
1971 isolatedSenders=isolatedSenders,
1972 isolatedRecipients=isolatedRecipients,
1973 sw1="s6",
1974 sw2="s2",
1975 sw3="s4",
1976 sw4="s1",
1977 sw5="s3",
1978 expectedLink1=16,
1979 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08001980 else:
Devin Lim142b5342017-07-20 15:22:39 -07001981 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08001982
1983 utilities.assert_equals( expect=main.TRUE,
1984 actual=testResult,
1985 onpass=main.assertReturnString,
1986 onfail=main.assertReturnString )
1987
Jeremy Songster9385d412016-06-02 17:57:36 -07001988 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
1989
1990 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
1991 "with partial failures allowed\n"
1992 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001993 { "name": "h16", "device": "of:0000000000000006/8" },
1994 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07001995 ]
1996 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001997 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07001998 ]
1999 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002000 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002001 ]
2002 isolatedRecipients = []
2003 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002004 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002005 main,
2006 name="NOOPTION",
2007 senders=senders,
2008 recipients=recipients,
2009 sw1="s5",
2010 sw2="s2",
2011 partial=True )
2012
2013 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002014 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002015 main,
2016 intentId=installResult,
2017 name="NOOPTION",
2018 senders=senders,
2019 recipients=recipients,
2020 isolatedSenders=isolatedSenders,
2021 isolatedRecipients=isolatedRecipients,
2022 sw1="s6",
2023 sw2="s2",
2024 sw3="s4",
2025 sw4="s1",
2026 sw5="s3",
2027 expectedLink1=16,
2028 expectedLink2=14,
2029 partial=True )
2030 else:
Devin Lim142b5342017-07-20 15:22:39 -07002031 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002032
2033 utilities.assert_equals( expect=main.TRUE,
2034 actual=testResult,
2035 onpass=main.assertReturnString,
2036 onfail=main.assertReturnString )
2037
Jeremye0cb5eb2016-01-27 17:39:09 -08002038 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002039 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2040 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002041 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002042 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002043 ]
2044 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002045 { "name": "h16", "device": "of:0000000000000006/8" },
2046 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002047 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002048 isolatedSenders = []
2049 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002050 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002051 ]
2052 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002053 installResult = main.intents.installSingleToMultiIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002054 main,
2055 name="NOOPTION",
2056 senders=senders,
2057 recipients=recipients,
2058 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002059 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002060
2061 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002062 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002063 main,
2064 intentId=installResult,
2065 name="NOOPTION",
2066 senders=senders,
2067 recipients=recipients,
2068 isolatedSenders=isolatedSenders,
2069 isolatedRecipients=isolatedRecipients,
2070 sw1="s6",
2071 sw2="s2",
2072 sw3="s4",
2073 sw4="s1",
2074 sw5="s3",
2075 expectedLink1=16,
2076 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002077 else:
Devin Lim142b5342017-07-20 15:22:39 -07002078 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002079
2080 utilities.assert_equals( expect=main.TRUE,
2081 actual=testResult,
2082 onpass=main.assertReturnString,
2083 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002084 # Right now this functionality doesn't work properly in SPMP intents
Jon Hall78be4962017-05-23 14:53:53 -07002085 main.step( "NOOPTION: Install and test single point to multi point " +
Jeremy Songster9385d412016-06-02 17:57:36 -07002086 "intents with partial failures allowed" )
2087 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2088 "point intent with partial failures allowed\n"
2089 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002090 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002091 ]
2092 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002093 { "name": "h16", "device": "of:0000000000000006/8" },
2094 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002095 ]
2096 isolatedSenders = []
2097 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002098 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002099 ]
2100 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002101 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002102 main,
2103 name="NOOPTION",
2104 senders=senders,
2105 recipients=recipients,
2106 sw1="s5",
2107 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002108 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002109
2110 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002111 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002112 main,
2113 intentId=installResult,
2114 name="NOOPTION",
2115 senders=senders,
2116 recipients=recipients,
2117 isolatedSenders=isolatedSenders,
2118 isolatedRecipients=isolatedRecipients,
2119 sw1="s6",
2120 sw2="s2",
2121 sw3="s4",
2122 sw4="s1",
2123 sw5="s3",
2124 expectedLink1=16,
2125 expectedLink2=14,
2126 partial=True )
2127 else:
Devin Lim142b5342017-07-20 15:22:39 -07002128 main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002129
2130 utilities.assert_equals( expect=main.TRUE,
2131 actual=testResult,
2132 onpass=main.assertReturnString,
2133 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002134
Jon Hall78be4962017-05-23 14:53:53 -07002135 main.intents.report( main )