Jonghwan Hyun | 3731d6a | 2017-10-19 11:59:31 -0700 | [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 Testcaselib import Testcaselib as run |
| 23 | |
| 24 | class 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() |
| 32 | # (number of spine switch, number of leaf switch, dual-homed, description, minFlowCount) |
| 33 | # TODO: Need to check correct number of minFlowCount |
| 34 | topo[ '0x1' ] = ( 0, 1, False, 'single ToR', 15 ) |
| 35 | topo[ '0x2' ] = ( 0, 2, True, 'dual-homed ToR', 15 ) |
| 36 | topo[ '2x2' ] = ( 2, 2, False, '2x2 leaf-spine topology', 116 ) |
| 37 | # TODO: Implement 2x3 topology |
| 38 | # topo[ '2x3' ] = ( 2, 3, True, '2x3 leaf-spine topology with dual ToR and single ToR' ) |
| 39 | topo[ '2x4' ] = ( 2, 4, True, '2x4 dual-homed leaf-spine topology', 116 ) |
| 40 | |
| 41 | if not hasattr( main, 'apps' ): |
| 42 | run.initTest( main ) |
| 43 | |
| 44 | main.case( '%s, with %s and %d ONOS instance%s' % |
| 45 | ( description, 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 ) |
| 50 | mininet_args = ' --spine=%d --leaf=%d' % ( topo[ topology ][ 0 ], topo[ topology ][ 1 ] ) |
| 51 | if topo[ topology ][ 2 ]: |
| 52 | mininet_args += ' --dual-homed' |
| 53 | if len( vlan ) > 0 : |
| 54 | mininet_args += ' --vlan=%s' % ( ','.join( ['%d' % vlanId for vlanId in vlan ] ) ) |
| 55 | |
| 56 | run.startMininet( main, 'trellis_fabric.py', args = mininet_args ) |
| 57 | # TODO: Need to check correct number of minFlowCount |
| 58 | run.checkFlows( main, minFlowCount = topo[ topology ][ 4 ] ) |
| 59 | run.pingAll( main, 'CASE%02d' % test_idx ) |
| 60 | run.cleanup( main ) |