blob: f58e4f8d686e9a4ed5fe80ea1fb749fc1760c63b [file] [log] [blame]
Jonghwan Hyun812c70f2018-02-16 16:33:16 -08001"""
2Copyright 2017 Open Networking Foundation ( ONF )
3
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
11 ( at your option ) any later version.
12
13 TestON is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20"""
21
You Wang68568b12019-03-04 11:49:57 -080022import tests.USECASE.SegmentRouting.dependencies.cfgtranslator as translator
23
Jonghwan Hyun812c70f2018-02-16 16:33:16 -080024class SRDynamicConfTest:
25 def __init__( self ):
26 self.default = ''
Siddesh167bc882021-03-23 21:03:43 +000027 self.topo = run.getTopo()
Jonghwan Hyun812c70f2018-02-16 16:33:16 -080028
29 @staticmethod
30 def runTest( main, testIndex, topology, onosNodes, description, vlan=( 0, 0, 0, 0 ) ):
31 '''
32 Tests connectivity for each test case.
33 Configuration files:
34 - (0x1, 0x2, 2x2, 2x4).json: device configuration, fed to ONOS before configuration change
35 - CASE*.json: interface configuration, fed to ONOS before configuration change
36 - CASE*0.chart: ping chart, used to check connectivity before configuration change.
37 Shared among same test scenario with different topology.
38 - CASE*0_after.chart: ping chart, used to check connectivity after configuration change.
39 Shared among same test scenario with different topology.
40 Only used when ping chart is updated.
41 '''
Jonghwan Hyun812c70f2018-02-16 16:33:16 -080042 try:
Jon Hall9b0de1f2020-08-24 15:38:04 -070043 fanout = 4
44 switchNames = {}
45 switchNames[ '2x2' ] = [ "leaf1", "leaf2", "spine101", "spine102" ]
46
47 TAG = 'CASE%d' % testIndex
48 skipPackage = False
49 init = False
Siddesh167bc882021-03-23 21:03:43 +000050 dualHomed = self.topo[ topology ][ 'dual-homed' ]
51 portNum = self.topo[ topology ][ 'description' ]
Jon Hall9b0de1f2020-08-24 15:38:04 -070052 defaultIntf = 'bond0' if dualHomed else 'eth0'
53
54 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
55 if not hasattr( main, 'apps' ):
56 init = True
57 run.initTest( main )
58 # Skip onos packaging if the clusrer size stays the same
59 if not init and onosNodes == main.Cluster.numCtrls:
60 skipPackage = True
61
62 main.case( '%s, with %s and %d ONOS instance%s' %
Siddesh167bc882021-03-23 21:03:43 +000063 ( description, self.topo[ topology ][ 'description' ], onosNodes, 's' if onosNodes > 1 else '' ) )
Jon Hall9b0de1f2020-08-24 15:38:04 -070064 main.cfgName = topology
65 main.Cluster.setRunningNode( onosNodes )
66 run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
67
68 # Provide common configuration
69 # TODO: Generate json and chart dynamically, according to topologies and scenarios
You Wang68568b12019-03-04 11:49:57 -080070 if main.useBmv2:
71 # Translate configuration file from OVS-OFDPA to BMv2 driver
Jon Hall9b0de1f2020-08-24 15:38:04 -070072 translator.bmv2ToOfdpa( main ) # Try to cleanup if switching between switch types
Jon Hall06fd0df2021-01-25 15:50:06 -080073 switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', '' )
74 if switchPrefix is None:
75 switchPrefix = ''
Jon Hall9b0de1f2020-08-24 15:38:04 -070076 translator.ofdpaToBmv2( main, switchPrefix=switchPrefix )
You Wang68568b12019-03-04 11:49:57 -080077 else:
Jon Hall9b0de1f2020-08-24 15:38:04 -070078 translator.bmv2ToOfdpa( main )
Jon Hall06fd0df2021-01-25 15:50:06 -080079 if not main.persistentSetup:
80 run.loadJson( main )
Jon Hall9b0de1f2020-08-24 15:38:04 -070081 run.loadChart( main )
82
83 # Provide topology-specific interface configuration
84 import json
85 try:
86 intfCfg = "%s%s%s.json" % ( main.configPath, main.forJson, TAG )
87 if main.useBmv2:
88 # Translate configuration file from OVS-OFDPA to BMv2 driver
Jon Hallf69e3162020-09-01 09:08:44 -070089 translator.bmv2ToOfdpa( main, intfCfg ) # Try to cleanup if switching between switch types
Jon Hall9b0de1f2020-08-24 15:38:04 -070090 switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
91 translator.ofdpaToBmv2( main, switchPrefix=switchPrefix, cfgFile=intfCfg )
92 else:
93 translator.bmv2ToOfdpa( main, intfCfg )
94 with open( intfCfg ) as cfg:
95 main.Cluster.active( 0 ).REST.setNetCfg( json.load( cfg ) )
96 except IOError:
97 # Load default interface configuration
98 defaultIntfCfg = "%s%s%s_ports.json" % ( main.configPath, main.forJson, topology )
99 if main.useBmv2:
100 # Translate configuration file from OVS-OFDPA to BMv2 driver
Jon Hallf69e3162020-09-01 09:08:44 -0700101 translator.bmv2ToOfdpa( main, defaultIntfCfg ) # Try to cleanup if switching between switch types
Jon Hall9b0de1f2020-08-24 15:38:04 -0700102 switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
103 translator.ofdpaToBmv2( main, switchPrefix=switchPrefix, cfgFile=defaultIntfCfg )
104 else:
105 translator.bmv2ToOfdpa( main, defaultIntfCfg )
106 with open( defaultIntfCfg ) as cfg:
107 main.Cluster.active( 0 ).REST.setNetCfg( json.load( cfg ) )
108
109 try:
110 with open( "%s%sCASE%d.chart" % (main.configPath, main.forChart, testIndex / 10 * 10) ) as chart:
111 main.pingChart = json.load( chart )
112 except IOError:
113 # Load default chart
114 with open( "%s%sdefault.chart" % (main.configPath, main.forChart) ) as chart:
115 main.pingChart = json.load( chart )
116
117 # Set up topology
118 if hasattr( main, 'Mininet1' ):
Jon Hallf69e3162020-09-01 09:08:44 -0700119 run.mnDockerSetup( main )
Jon Hall9b0de1f2020-08-24 15:38:04 -0700120 # Run the test with mininet topology
121 mininet_args = ' --spine=%d --leaf=%d --fanout=%d' \
Siddesh167bc882021-03-23 21:03:43 +0000122 % ( self.topo[ topology ][ 'spines' ], self.topo[ topology ][ 'leaves' ], fanout )
Jon Hall9b0de1f2020-08-24 15:38:04 -0700123 if len( vlan ) > 0 :
124 mininet_args += ' --vlan=%s' % ( ','.join( [ '%d' % vlanId for vlanId in vlan ] ) )
Siddesh167bc882021-03-23 21:03:43 +0000125 if self.topo[ topology ][ 'spines' ] > 0:
Jon Hall9b0de1f2020-08-24 15:38:04 -0700126 mininet_args += ',0,0,0,0'
127 if dualHomed:
128 mininet_args += ' --dual-homed'
129 if main.useBmv2:
Jon Hallf69e3162020-09-01 09:08:44 -0700130 mininet_args += ' --switch %s' % main.switchType
131 main.log.info( "Using %s switch" % main.switchType )
Jon Hall9b0de1f2020-08-24 15:38:04 -0700132
133 run.startMininet( main, 'trellis_fabric.py', args=mininet_args )
134 else:
135 # Run the test with physical devices
136 run.connectToPhysicalNetwork( main, switchNames[ topology ] )
137
138 # minFlowCountPerLeaf = 13 + [# of ports] * 5 + [# of hosts] * 2 + [# of vlan ids]
Siddesh167bc882021-03-23 21:03:43 +0000139 minFlowCountPerLeaf = 13 + ( fanout + self.topo[ topology ][ 'spines' ]) * 5 + fanout * 2 + len( set( vlan ) )
Jon Hall32c90f32021-06-24 16:32:44 -0700140 run.checkFlows( main, minFlowCount=minFlowCountPerLeaf * self.topo[ topology ][ 'leaves' ], sleep=5, dumpFlows=False )
Jon Hall9b0de1f2020-08-24 15:38:04 -0700141 # Check connectivity before changing interface configuration
142 run.pingAll( main, '%s_Before' % TAG, retryAttempts=2 )
143
You Wang68568b12019-03-04 11:49:57 -0800144 if main.useBmv2:
Siddesh167bc882021-03-23 21:03:43 +0000145 leaf_dpid = [ "device:bmv2:leaf%d" % ( ls + 1 ) for ls in range( self.topo[ topology ][ 'leaves' ] ) ]
You Wang68568b12019-03-04 11:49:57 -0800146 else:
Siddesh167bc882021-03-23 21:03:43 +0000147 leaf_dpid = [ "of:%016d" % ( ls + 1 ) for ls in range( self.topo[ topology ][ 'leaves' ] ) ]
Jon Hall9b0de1f2020-08-24 15:38:04 -0700148 for dpid in leaf_dpid:
149 run.checkFlowsByDpid( main, dpid, minFlowCountPerLeaf, sleep=5 )
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800150
Jon Hall9b0de1f2020-08-24 15:38:04 -0700151 # Testcase-specific interface configuration change
152 if testIndex / 10 == 1:
153 # CASE11-14
154 if hasattr( main, 'Mininet1' ):
155 # Assign vlan tag 10 to host h1
156 main.Mininet1.assignVLAN( 'h1', 'h1-%s' % defaultIntf, '10' )
157 # Update port configuration of port 1
158 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
159 [ '10.0.2.254/24', ], tagged=[ 10, ] )
160 else:
161 # TODO: update physical device configuration, same for all test cases
162 pass
163 elif testIndex / 10 == 2:
164 # CASE21-24
165 if hasattr( main, 'Mininet1' ):
166 # Update port configuration of port 1
167 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
168 [ '10.0.2.254/24', ], untagged=20 )
169 elif testIndex / 10 == 3:
170 # CASE31-34
171 if hasattr( main, 'Mininet1' ):
172 # Update port configuration of port 1
173 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
174 [ '10.0.2.254/24', ], untagged=110 )
175 # Update port configuration of port 2
176 SRDynamicConfTest.updateIntfCfg( main, portNum + 1, dualHomed,
177 [ '10.0.2.254/24', ], untagged=110 )
178 elif testIndex / 10 == 4:
179 # CASE41-44
180 if hasattr( main, 'Mininet1' ):
181 # Assign vlan tag 20 to host h1
182 main.Mininet1.assignVLAN( 'h1', 'h1-%s' % defaultIntf, '20')
183 # Update port configuration of port 1
184 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
185 [ '10.0.2.254/24', ], tagged=[ 20, ] )
186 elif testIndex / 10 == 5:
187 # CASE51-54
188 if hasattr( main, 'Mininet1' ):
189 # Update port configuration of port 1
190 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
191 [ '10.0.2.254/24', ], tagged=[ 20, ], native=10 )
192 elif testIndex / 10 == 6:
193 # CASE61-64
194 if hasattr( main, 'Mininet1' ):
195 # Update port configuration of port 1
196 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
197 [ '10.0.2.254/24', ], tagged=[ 120, ], native=110 )
198 # Update port configuration of port 2
199 SRDynamicConfTest.updateIntfCfg( main, portNum + 1, dualHomed,
200 [ '10.0.2.254/24', ], tagged=[ 120, ], native=110 )
201 elif testIndex / 10 == 7:
202 # CASE71-74
203 if hasattr( main, 'Mininet1' ):
204 # Update host configuration of h1
205 main.Mininet1.removeVLAN( 'h1', 'h1-%s.10' % defaultIntf )
206 # Update port configuration of port 1
207 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
208 [ '10.0.2.254/24', ], untagged=10 )
209 elif testIndex / 10 == 8:
210 # CASE81-84
211 if hasattr( main, 'Mininet1' ):
212 # Update port configuration of port 1
213 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
214 [ '10.0.2.254/24', ], tagged=[ 20, ], native=10 )
215 elif testIndex / 10 == 9:
216 # CASE91-94
217 if hasattr( main, 'Mininet1' ):
218 # Update host configuration
219 main.Mininet1.removeVLAN( 'h1', 'h1-%s.10' % defaultIntf )
220 main.Mininet1.removeVLAN( 'h2', 'h2-%s.10' % defaultIntf )
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800221
Jon Hall9b0de1f2020-08-24 15:38:04 -0700222 # Update port configuration
223 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
224 [ '10.0.2.254/24', ], tagged=[ 120, ], native=110 )
225 SRDynamicConfTest.updateIntfCfg( main, portNum + 1, dualHomed,
226 [ '10.0.2.254/24', ], tagged=[ 120, ], native=110 )
227 elif testIndex / 10 == 10:
228 # CASE101-104
229 if hasattr( main, 'Mininet1' ):
230 # Update port configuration
231 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
232 [ '10.0.2.254/24', ], untagged=20 )
233 elif testIndex / 10 == 11:
234 # CASE111-114
235 if hasattr( main, 'Mininet1' ):
236 # Update port configuration
237 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
238 [ '10.0.2.254/24', ], tagged=[ 20, ] )
239 elif testIndex / 10 == 12:
240 # CASE121-124
241 if hasattr( main, 'Mininet1' ):
242 # Update port configuration
243 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
244 [ '10.0.2.254/24', ], tagged=[ 20, ], native=110 )
245 SRDynamicConfTest.updateIntfCfg( main, portNum + 1, dualHomed,
246 [ '10.0.2.254/24', ], tagged=[ 20, ], native=110 )
247 elif testIndex / 10 == 13:
248 # CASE131-134
249 if hasattr( main, 'Mininet1' ):
250 # Update port configuration
251 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
252 [ '10.0.2.254/24', ], tagged=[ 120, ], native=10 )
253 elif testIndex / 10 == 14:
254 # CASE141-144
255 if hasattr( main, 'Mininet1' ):
256 # Update port configuration
257 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
258 [ '10.0.2.254/24', ], tagged=[ 20, ] )
259 elif testIndex / 10 == 15:
260 # CASE151-154
261 if hasattr( main, 'Mininet1' ):
262 # Update port configuration
263 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
264 [ '10.0.2.254/24', ], tagged=[ 120, ] )
265 elif testIndex / 10 == 16:
266 # CASE161-164
267 if hasattr( main, 'Mininet1' ):
268 # Update port configuration
269 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
270 [ '10.0.2.254/24', ], tagged=[ 20, ], native=10 )
271 elif testIndex / 10 == 17:
272 # CASE171-174
273 if hasattr( main, 'Mininet1' ):
274 # Update port configuration
275 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
276 [ '10.0.2.254/24', ], tagged=[ 120, ] )
277 elif testIndex / 10 == 18:
278 # CASE181-184
279 if hasattr( main, 'Mininet1' ):
280 # Update port configuration
281 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
282 [ '10.0.2.254/24', ], tagged=[ 20, ], native=10 )
283 elif testIndex / 10 == 19:
284 # CASE191-194
285 if hasattr( main, 'Mininet1' ):
286 # Update port configuration
287 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
288 [ '10.0.2.254/24', ], untagged=20 )
289 elif testIndex / 10 == 20:
290 # CASE201-204
291 if hasattr( main, 'Mininet1' ):
292 # Update port configuration
293 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
294 [ '10.0.2.254/24', ], tagged=[ 20 ] )
295 elif testIndex / 10 == 21:
296 # CASE211-214
297 if hasattr( main, 'Mininet1' ):
298 # Update port configuration
299 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
300 [ '10.0.2.254/24', ], tagged=[ 20 ], native=110 )
301 elif testIndex / 10 == 22:
302 # CASE221-224
303 if hasattr( main, 'Mininet1' ):
304 # Update port configuration
305 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
306 [ '10.0.2.254/24', ], tagged=[ 120 ], native=10 )
307 elif testIndex / 10 == 23:
308 # CASE231-234
309 if hasattr( main, "Mininet1" ):
310 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
311 [ '10.0.2.254/24', ], tagged=[ 10, ] )
312 for dpid in leaf_dpid:
313 run.checkFlowsByDpid( main, dpid, minFlowCountPerLeaf, sleep=5 )
314 main.pingChart[ 'leaf1' ][ 'expect' ] = False
315 run.pingAll( main, '%s_1' % TAG, retryAttempts=2 )
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800316
Jon Hall9b0de1f2020-08-24 15:38:04 -0700317 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
318 [ '10.0.2.254/24', ], untagged=50 )
319 for dpid in leaf_dpid:
320 run.checkFlowsByDpid( main, dpid, minFlowCountPerLeaf, sleep=5 )
321 run.pingAll( main, '%s_2' % TAG, retryAttempts=2 )
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800322
Jon Hall9b0de1f2020-08-24 15:38:04 -0700323 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
324 [ '10.0.2.254/24', ], tagged=[ 20, ] )
325 for dpid in leaf_dpid:
326 run.checkFlowsByDpid( main, dpid, minFlowCountPerLeaf, sleep=5 )
327 run.pingAll( main, '%s_3' % TAG, retryAttempts=2 )
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800328
Jon Hall9b0de1f2020-08-24 15:38:04 -0700329 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
330 [ '10.0.2.254/24', ], tagged=[ 40, ], native=10 )
331 for dpid in leaf_dpid:
332 run.checkFlowsByDpid( main, dpid, minFlowCountPerLeaf, sleep=5 )
333 main.pingChart[ 'leaf1' ][ 'expect' ] = True
334 run.pingAll( main, '%s_4' % TAG, retryAttempts=2 )
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800335
Jon Hall9b0de1f2020-08-24 15:38:04 -0700336 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
337 [ '10.0.2.254/24', ], tagged=[ 20, ] )
338 for dpid in leaf_dpid:
339 run.checkFlowsByDpid( main, dpid, minFlowCountPerLeaf, sleep=5 )
340 main.pingChart[ 'leaf1' ][ 'expect' ] = False
341 run.pingAll( main, '%s_5' % TAG, retryAttempts=2 )
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800342
Jon Hall9b0de1f2020-08-24 15:38:04 -0700343 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
344 [ '10.0.2.254/24', ], untagged= 20 )
345 for dpid in leaf_dpid:
346 run.checkFlowsByDpid( main, dpid, minFlowCountPerLeaf, sleep=5 )
347 run.pingAll( main, '%s_6' % TAG, retryAttempts=2 )
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800348
Jon Hall9b0de1f2020-08-24 15:38:04 -0700349 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
350 [ '10.0.2.254/24', ], untagged= 10 )
351 for dpid in leaf_dpid:
352 run.checkFlowsByDpid( main, dpid, minFlowCountPerLeaf, sleep=5 )
353 main.pingChart[ 'leaf1' ][ 'expect' ] = True
354 elif testIndex / 10 == 24:
355 # CASE243-244
356 # Only for 2x2 and 2x4 topology, to test reachability from other leaf
357 if hasattr( main, "Mininet1" ):
358 # Update host IP and default GW
359 main.Mininet1.changeIP( 'h1', 'h1-%s' % defaultIntf, '10.0.6.1', '255.255.255.0' )
360 main.Mininet1.changeDefaultGateway( 'h1', '10.0.6.254' )
361 # Update port configuration
362 SRDynamicConfTest.updateIntfCfg( main, portNum, dualHomed,
363 [ '10.0.6.254/24', ], untagged=60 )
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800364
Jon Hall9b0de1f2020-08-24 15:38:04 -0700365 # Update ping chart in case it is changed
366 try:
367 with open( "%s%sCASE%d_after.chart" % (main.configPath, main.forChart, testIndex / 10 * 10 ) ) as chart:
368 main.pingChart = json.load(chart)
369 except IOError:
370 main.log.debug( "Ping chart is not changed" )
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800371
Jon Hall9b0de1f2020-08-24 15:38:04 -0700372 # Check connectivity after changing interface configuration
Jon Hall32c90f32021-06-24 16:32:44 -0700373 run.checkFlows( main, minFlowCount=minFlowCountPerLeaf * self.topo[ topology ][ 'leaves' ], sleep=5, dumpFlows=False )
Jon Hall9b0de1f2020-08-24 15:38:04 -0700374 run.pingAll( main, '%s_After' % TAG, retryAttempts=2 )
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800375
Jon Hall9b0de1f2020-08-24 15:38:04 -0700376 except Exception as e:
377 main.log.exception( "Error in runTest" )
378 main.skipCase( result="FAIL", msg=e )
Jon Hallf69e3162020-09-01 09:08:44 -0700379 finally:
380 run.cleanup( main )
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800381
382 @staticmethod
383 def updateIntfCfg( main, portNum, dualHomed, ips=[], untagged=0, tagged=[], native=0 ):
384 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
You Wang68568b12019-03-04 11:49:57 -0800385 if main.useBmv2:
386 run.updateIntfCfg( main, "device:bmv2:leaf1/%d" % portNum,
Jonghwan Hyun812c70f2018-02-16 16:33:16 -0800387 ips=ips, untagged=untagged, tagged=tagged, native=native )
You Wang68568b12019-03-04 11:49:57 -0800388 else:
389 run.updateIntfCfg( main, "of:0000000000000001/%d" % portNum,
390 ips=ips, untagged=untagged, tagged=tagged, native=native )
391 if dualHomed:
392 if main.useBmv2:
393 run.updateIntfCfg( main, "device:bmv2:leaf2/%d" % portNum,
394 ips=ips, untagged=untagged, tagged=tagged, native=native )
395 else:
396 run.updateIntfCfg( main, "of:0000000000000002/%d" % portNum,
397 ips=ips, untagged=untagged, tagged=tagged, native=native )