Devin Lim | 57221b0 | 2018-02-14 15:45:36 -0800 | [diff] [blame] | 1 | """ |
| 2 | Copyright 2017 Open Networking Foundation ( ONF ) |
| 3 | |
| 4 | Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 5 | the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 6 | or 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 | |
| 22 | from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run |
| 23 | |
| 24 | class SRClusterRestartFuncs(): |
| 25 | |
| 26 | def __init__( self ): |
| 27 | self.default = '' |
| 28 | self.topo = dict() |
| 29 | self.topo[ '0x1' ] = ( 0, 1, '--leaf=1 --spine=0', 'single switch' ) |
| 30 | self.topo[ '2x2' ] = ( 2, 2, '', '2x2 Leaf-spine' ) |
| 31 | self.topo[ '4x4' ] = ( 4, 4, '--leaf=4 --spine=4', '4x4 Leaf-spine' ) |
| 32 | |
| 33 | def runTest( self, main, caseNum, numNodes, Topo, minFlow, testing, killList=[ 0, 1, 2 ] ): |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 34 | try: |
| 35 | description = "Cluster Restart test with " + self.topo[ Topo ][ 3 ] |
| 36 | caseTitle = 'CASE{}_'.format( caseNum ) + testing |
| 37 | main.case( description ) |
| 38 | if not hasattr( main, 'apps' ): |
| 39 | run.initTest( main ) |
| 40 | main.cfgName = Topo |
| 41 | main.Cluster.setRunningNode( numNodes ) |
| 42 | run.installOnos( main ) |
| 43 | run.loadJson( main ) |
| 44 | run.loadChart( main ) |
| 45 | if hasattr( main, 'Mininet1' ): |
| 46 | run.startMininet( main, 'cord_fabric.py', args=self.topo[ Topo ][ 2 ] ) |
| 47 | else: |
| 48 | # Run the test with physical devices |
| 49 | # TODO: connect TestON to the physical network |
| 50 | pass |
Jon Hall | 10e2ab8 | 2020-09-15 17:14:54 -0700 | [diff] [blame^] | 51 | # xconnects need to be loaded after topology |
| 52 | run.loadXconnects( main ) |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 53 | # pre-configured routing and bridging test |
| 54 | run.checkFlows( main, minFlowCount=minFlow ) |
| 55 | run.pingAll( main ) |
| 56 | switch = '{}'.format( self.topo[ Topo ][ 0 ] + self.topo[ Topo ][ 1 ] ) |
| 57 | link = '{}'.format( ( self.topo[ Topo ][ 0 ] + self.topo[ Topo ][ 1 ] ) * self.topo[ Topo ][ 0 ] ) |
| 58 | run.killOnos( main, killList, switch, link, '0' ) |
| 59 | run.pingAll( main, caseTitle, dumpflows=False ) |
| 60 | run.recoverOnos( main, killList, switch, link, '{}'.format( numNodes ) ) |
| 61 | run.checkFlows( main, minFlowCount=minFlow, tag=caseTitle ) |
| 62 | run.pingAll( main, caseTitle ) |
| 63 | # TODO Dynamic config of hosts in subnet |
| 64 | # TODO Dynamic config of host not in subnet |
| 65 | # TODO Dynamic config of vlan xconnect |
| 66 | # TODO Vrouter integration |
| 67 | # TODO Mcast integration |
| 68 | |
| 69 | except Exception as e: |
| 70 | main.log.exception( "Error in runTest" ) |
| 71 | main.skipCase( result="FAIL", msg=e ) |
Jon Hall | f69e316 | 2020-09-01 09:08:44 -0700 | [diff] [blame] | 72 | finally: |
Devin Lim | 57221b0 | 2018-02-14 15:45:36 -0800 | [diff] [blame] | 73 | run.cleanup( main ) |