blob: fa496ddd264fff1c5751f018d5d53d74dfc4a024 [file] [log] [blame]
Jonghwan Hyun3731d6a2017-10-19 11:59:31 -07001"""
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 Wangac02b142018-01-26 14:57:28 -080022from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
Jonghwan Hyun3731d6a2017-10-19 11:59:31 -070023
24class SRBridgingTest ():
25
26 def __init__( self ):
27 self.default = ''
28
29 @staticmethod
30 def runTest( main, test_idx, topology, onosNodes, description, vlan = [] ):
31 topo = dict()
Jonghwan Hyun98fb40a2018-01-04 16:16:28 -080032 # (number of spine switch, number of leaf switch, dual-homed, description, minFlowCount - leaf)
33 topo[ '0x1' ] = ( 0, 1, False, 'single ToR', 28 )
34 topo[ '0x2' ] = ( 0, 2, True, 'dual-homed ToR', 37 )
35 topo[ '2x2' ] = ( 2, 2, False, '2x2 leaf-spine topology', 37 )
Jonghwan Hyun3731d6a2017-10-19 11:59:31 -070036 # TODO: Implement 2x3 topology
Jonghwan Hyun98fb40a2018-01-04 16:16:28 -080037 # topo[ '2x3' ] = ( 2, 3, True, '2x3 leaf-spine topology with dual ToR and single ToR', 28 )
38 topo[ '2x4' ] = ( 2, 4, True, '2x4 dual-homed leaf-spine topology', 53 )
You Wang84f981d2018-01-12 16:11:50 -080039 switchNames = {}
40 switchNames[ '2x2' ] = [ "leaf1", "leaf2", "spine101", "spine102" ]
Jonghwan Hyun3731d6a2017-10-19 11:59:31 -070041
You Wang1cdc5f52017-12-19 16:47:51 -080042 skipPackage = False
43 init = False
Jonghwan Hyun3731d6a2017-10-19 11:59:31 -070044 if not hasattr( main, 'apps' ):
You Wang1cdc5f52017-12-19 16:47:51 -080045 init = True
Jonghwan Hyun3731d6a2017-10-19 11:59:31 -070046 run.initTest( main )
You Wang1cdc5f52017-12-19 16:47:51 -080047 # Skip onos packaging if the clusrer size stays the same
48 if not init and onosNodes == main.Cluster.numCtrls:
49 skipPackage = True
Jonghwan Hyun3731d6a2017-10-19 11:59:31 -070050
51 main.case( '%s, with %s and %d ONOS instance%s' %
52 ( description, topo[ topology ][ 3 ], onosNodes, 's' if onosNodes > 1 else '' ) )
53
54 main.cfgName = 'CASE%01d%01d' % ( test_idx / 10, ( ( test_idx - 1 ) % 10 ) % 4 + 1 )
You Wangac02b142018-01-26 14:57:28 -080055 main.configPath = main.path + "/dependencies/"
Jonghwan Hyun3731d6a2017-10-19 11:59:31 -070056 main.Cluster.setRunningNode( onosNodes )
You Wang1cdc5f52017-12-19 16:47:51 -080057 run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
You Wangd5873482018-01-24 12:30:00 -080058 if hasattr( main, 'Mininet1' ):
59 # Run the test with Mininet
60 mininet_args = ' --spine=%d --leaf=%d' % ( topo[ topology ][ 0 ], topo[ topology ][ 1 ] )
61 if topo[ topology ][ 2 ]:
62 mininet_args += ' --dual-homed'
63 if len( vlan ) > 0 :
64 mininet_args += ' --vlan=%s' % ( ','.join( ['%d' % vlanId for vlanId in vlan ] ) )
Jonghwan Hyun3731d6a2017-10-19 11:59:31 -070065
You Wangd5873482018-01-24 12:30:00 -080066 run.startMininet( main, 'trellis_fabric.py', args=mininet_args )
67 else:
68 # Run the test with physical devices
You Wang84f981d2018-01-12 16:11:50 -080069 run.connectToPhysicalNetwork( main, switchNames[ topology ] )
You Wangd5873482018-01-24 12:30:00 -080070
Jonghwan Hyun98fb40a2018-01-04 16:16:28 -080071 run.checkFlows( main, minFlowCount=topo[ topology ][ 4 ] * topo[ topology ][ 1 ], sleep=5 )
Jonghwan Hyun98fb40a2018-01-04 16:16:28 -080072 leaf_dpid = [ "of:%016d" % ( ls + 1 ) for ls in range( topo[ topology ][ 1 ] ) ]
73 for dpid in leaf_dpid:
74 run.checkFlowsByDpid( main, dpid, topo[ topology ][ 4 ], sleep=5 )
Jonghwan Hyun76a02b72018-01-30 16:40:48 +090075 run.pingAll( main )
You Wangd5873482018-01-24 12:30:00 -080076
77 if hasattr( main, 'Mininet1' ):
78 run.cleanup( main )
79 else:
80 # TODO: disconnect TestON from the physical network
81 pass