blob: cf559be1a35dea808da492f1f0521e8ba51e636a [file] [log] [blame]
Devin Lim57221b02018-02-14 15:45:36 -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
22from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
23
24class SRClusterRestartFuncs():
25
26 def __init__( self ):
27 self.default = ''
Siddesh167bc882021-03-23 21:03:43 +000028 self.topo = run.getTopo()
Devin Lim57221b02018-02-14 15:45:36 -080029
Siddesh167bc882021-03-23 21:03:43 +000030 def runTest( self, main, caseNum, numNodes, topology, minFlow, testing, killList=[ 0, 1, 2 ] ):
Jon Hall9b0de1f2020-08-24 15:38:04 -070031 try:
Siddesh167bc882021-03-23 21:03:43 +000032 description = "Cluster Restart test with " + self.topo[ topology ][ 'description' ]
Jon Hall9b0de1f2020-08-24 15:38:04 -070033 caseTitle = 'CASE{}_'.format( caseNum ) + testing
34 main.case( description )
35 if not hasattr( main, 'apps' ):
36 run.initTest( main )
Siddesh167bc882021-03-23 21:03:43 +000037 main.cfgName = topology
Jon Hall9b0de1f2020-08-24 15:38:04 -070038 main.Cluster.setRunningNode( numNodes )
39 run.installOnos( main )
Jon Hall06fd0df2021-01-25 15:50:06 -080040 if not main.persistentSetup:
41 run.loadJson( main )
Jon Hall9b0de1f2020-08-24 15:38:04 -070042 run.loadChart( main )
43 if hasattr( main, 'Mininet1' ):
Siddesh167bc882021-03-23 21:03:43 +000044 run.startMininet( main, 'cord_fabric.py', args=self.topo[ topology ][ 'mininetArgs' ] )
Jon Hall9b0de1f2020-08-24 15:38:04 -070045 else:
46 # Run the test with physical devices
47 # TODO: connect TestON to the physical network
48 pass
Jon Hall10e2ab82020-09-15 17:14:54 -070049 # xconnects need to be loaded after topology
50 run.loadXconnects( main )
Jon Hall9b0de1f2020-08-24 15:38:04 -070051 # pre-configured routing and bridging test
52 run.checkFlows( main, minFlowCount=minFlow )
53 run.pingAll( main )
Siddesh167bc882021-03-23 21:03:43 +000054 switch = '{}'.format( self.topo[ topology ][ 'spines' ] + self.topo[ topology ][ 'leaves' ] )
55 link = '{}'.format( ( self.topo[ topology ][ 'spines' ] + self.topo[ topology ][ 'leaves' ] ) * self.topo[ topology ][ 'spines' ] )
Jon Hall9b0de1f2020-08-24 15:38:04 -070056 run.killOnos( main, killList, switch, link, '0' )
Jon Hall32c90f32021-06-24 16:32:44 -070057 run.pingAll( main, caseTitle, dumpFlows=False )
Jon Hall9b0de1f2020-08-24 15:38:04 -070058 run.recoverOnos( main, killList, switch, link, '{}'.format( numNodes ) )
59 run.checkFlows( main, minFlowCount=minFlow, tag=caseTitle )
60 run.pingAll( main, caseTitle )
61 # TODO Dynamic config of hosts in subnet
62 # TODO Dynamic config of host not in subnet
63 # TODO Dynamic config of vlan xconnect
64 # TODO Vrouter integration
65 # TODO Mcast integration
66
67 except Exception as e:
68 main.log.exception( "Error in runTest" )
69 main.skipCase( result="FAIL", msg=e )
Jon Hallf69e3162020-09-01 09:08:44 -070070 finally:
Devin Lim57221b02018-02-14 15:45:36 -080071 run.cleanup( main )