blob: 46220dea68755db2a1263d15efa1eb57b66af827 [file] [log] [blame]
You Wang53dba1e2018-02-02 17:45:44 -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
You Wang68568b12019-03-04 11:49:57 -080023import tests.USECASE.SegmentRouting.dependencies.cfgtranslator as translator
You Wang53dba1e2018-02-02 17:45:44 -080024
25class SRDhcprelayTest ():
26
27 def __init__( self ):
28 self.default = ''
29
30 @staticmethod
31 def runTest( main, testIndex, onosNodes, description, dhcpRelay=False, remoteServer=False, multipleServer=False, ipv6=False, vlan=[], dualHomed=False ):
32 skipPackage = False
33 init = False
34 if not hasattr( main, 'apps' ):
35 init = True
36 run.initTest( main )
37 # Skip onos packaging if the clusrer size stays the same
38 if not init and onosNodes == main.Cluster.numCtrls:
39 skipPackage = True
40
41 main.case( '%s, with %d ONOS instance%s' %
42 ( description, onosNodes, 's' if onosNodes > 1 else '' ) )
43
44 main.cfgName = 'CASE%02d' % testIndex
You Wang53dba1e2018-02-02 17:45:44 -080045 main.resultFileName = 'CASE%02d' % testIndex
46 main.Cluster.setRunningNode( onosNodes )
47 run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
You Wang68568b12019-03-04 11:49:57 -080048 if main.useBmv2:
49 # Translate configuration file from OVS-OFDPA to BMv2 driver
50 translator.ofdpaToBmv2( main )
51 else:
52 translator.bmv2ToOfdpa( main )
Devin Lim57221b02018-02-14 15:45:36 -080053 run.loadJson( main )
54 run.loadHost( main )
You Wang53dba1e2018-02-02 17:45:44 -080055 if hasattr( main, 'Mininet1' ):
56 # Run the test with Mininet
57 if dualHomed:
58 mininet_args = ' --spine=2 --leaf=4 --dual-homed'
59 else:
60 mininet_args = ' --spine=2 --leaf=2'
61 mininet_args += ' --dhcp-client'
62 if dhcpRelay:
63 mininet_args += ' --dhcp-relay'
64 if multipleServer:
65 mininet_args += ' --multiple-dhcp-server'
66 if remoteServer:
67 mininet_args += ' --remote-dhcp-server'
68 if ipv6:
69 mininet_args += ' --ipv6'
70 if len( vlan ) > 0 :
71 mininet_args += ' --vlan=%s' % ( ','.join( ['%d' % vlanId for vlanId in vlan ] ) )
You Wang68568b12019-03-04 11:49:57 -080072 if main.useBmv2:
73 mininet_args += ' --switch bmv2'
74 main.log.info( "Using BMv2 switch" )
You Wang53dba1e2018-02-02 17:45:44 -080075
76 run.startMininet( main, 'trellis_fabric.py', args=mininet_args )
77 else:
78 # Run the test with physical devices
79 # TODO: connect TestON to the physical network
80 pass
81 run.verifyOnosHostIp( main )
82 run.verifyNetworkHostIp( main )
83
You Wang5df1c6d2018-04-06 18:02:02 -070084 run.cleanup( main )