blob: e822c29f040792a6582d9da0f54e444d21ceb198 [file] [log] [blame]
Pier6a0c4de2018-03-18 16:01:30 -07001"""
2Copyright 2018 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
22from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
23
24class SRMulticastTest ():
25
26 def __init__( self ):
27 self.default = ''
28 self.topo = dict()
29 # (number of spine switch, number of leaf switch, dual-homed, description, minFlowCount - leaf)
30 self.topo[ '2x2' ] = ( 2, 2, False, '2x2 leaf-spine topology', 1 )
31 self.switchNames = {}
32 self.switchNames[ '2x2' ] = [ "leaf205", "leaf206", "spine227", "spine228" ]
33
34 def runTest( self, main, test_idx, topology, onosNodes, description, vlan = [] ):
35 skipPackage = False
36 init = False
37 if not hasattr( main, 'apps' ):
38 init = True
39 run.initTest( main )
40 # Skip onos packaging if the cluster size stays the same
41 if not init and onosNodes == main.Cluster.numCtrls:
42 skipPackage = True
43
44 main.case( '%s, with %s and %d ONOS instance%s' %
45 ( description, self.topo[ topology ][ 3 ], onosNodes, 's' if onosNodes > 1 else '' ) )
46
47 main.cfgName = 'CASE%01d%01d' % ( test_idx / 10, ( ( test_idx - 1 ) % 10 ) % 4 + 1 )
48 main.Cluster.setRunningNode( onosNodes )
49 run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
50 if hasattr( main, 'Mininet1' ):
51 # TODO Mininet implementation
52 pass
53 else:
54 # Run the test with physical devices
55 run.connectToPhysicalNetwork( main, self.switchNames[ topology ] )
56 # Check if the devices are up
57 run.checkDevices( main, switches=len(self.switchNames[ topology ]))
58 # Check the flows against the devices
59 run.checkFlows( main, minFlowCount=self.topo[ topology ][ 4 ] * self.topo[ topology ][ 1 ], sleep=5 )
60 # Clean up the environment
61 run.cleanup( main, physical=(not hasattr( main, 'Mininet1' )))