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 SRSanityFuncs(): |
| 25 | |
| 26 | def __init__( self ): |
| 27 | self.default = '' |
Siddesh | 167bc88 | 2021-03-23 21:03:43 +0000 | [diff] [blame] | 28 | self.topo = run.getTopo() |
Devin Lim | 57221b0 | 2018-02-14 15:45:36 -0800 | [diff] [blame] | 29 | |
Siddesh | 167bc88 | 2021-03-23 21:03:43 +0000 | [diff] [blame] | 30 | def runTest( self, main, caseNum, numNodes, topology, minFlow ): |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 31 | try: |
| 32 | if not hasattr( main, 'apps' ): |
| 33 | run.initTest( main ) |
Devin Lim | 57221b0 | 2018-02-14 15:45:36 -0800 | [diff] [blame] | 34 | |
Siddesh | 167bc88 | 2021-03-23 21:03:43 +0000 | [diff] [blame] | 35 | description = "Bridging and Routing sanity test with " + self.topo[ topology ][ 'description' ] + " and {} Onos".format( numNodes ) |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 36 | main.case( description ) |
Devin Lim | 57221b0 | 2018-02-14 15:45:36 -0800 | [diff] [blame] | 37 | |
Siddesh | 167bc88 | 2021-03-23 21:03:43 +0000 | [diff] [blame] | 38 | main.cfgName = topology |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 39 | main.Cluster.setRunningNode( numNodes ) |
| 40 | run.installOnos( main ) |
Jon Hall | 06fd0df | 2021-01-25 15:50:06 -0800 | [diff] [blame] | 41 | if not main.persistentSetup: |
| 42 | run.loadJson( main ) |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 43 | run.loadChart( main ) |
Siddesh | 167bc88 | 2021-03-23 21:03:43 +0000 | [diff] [blame] | 44 | run.startMininet( main, 'cord_fabric.py', args=self.topo[ topology ][ 'mininetArgs' ] ) |
Jon Hall | 06fd0df | 2021-01-25 15:50:06 -0800 | [diff] [blame] | 45 | if not main.persistentSetup: |
| 46 | # xconnects need to be loaded after topology |
| 47 | run.loadXconnects( main ) |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 48 | # pre-configured routing and bridging test |
| 49 | run.checkFlows( main, minFlowCount=minFlow ) |
| 50 | run.pingAll( main ) |
| 51 | # TODO Dynamic config of hosts in subnet |
| 52 | # TODO Dynamic config of host not in subnet |
| 53 | # TODO Dynamic config of vlan xconnect |
| 54 | # TODO Vrouter integration |
| 55 | # TODO Mcast integration |
Jon Hall | f69e316 | 2020-09-01 09:08:44 -0700 | [diff] [blame] | 56 | except Exception as e: |
| 57 | main.log.exception( "Error in runTest" ) |
| 58 | main.skipCase( result="FAIL", msg=e ) |
| 59 | finally: |
Jon Hall | 9b0de1f | 2020-08-24 15:38:04 -0700 | [diff] [blame] | 60 | if hasattr( main, 'Mininet1' ): |
| 61 | run.cleanup( main ) |
| 62 | else: |
| 63 | # TODO: disconnect TestON from the physical network |
| 64 | pass |