blob: 1bbb0f9893b73a64364ac564d1f811f85bebe7f8 [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
23
24class SRDhcprelayTest ():
25
26 def __init__( self ):
27 self.default = ''
28
29 @staticmethod
30 def runTest( main, testIndex, onosNodes, description, dhcpRelay=False, remoteServer=False, multipleServer=False, ipv6=False, vlan=[], dualHomed=False ):
31 skipPackage = False
32 init = False
33 if not hasattr( main, 'apps' ):
34 init = True
35 run.initTest( main )
36 # Skip onos packaging if the clusrer size stays the same
37 if not init and onosNodes == main.Cluster.numCtrls:
38 skipPackage = True
39
40 main.case( '%s, with %d ONOS instance%s' %
41 ( description, onosNodes, 's' if onosNodes > 1 else '' ) )
42
43 main.cfgName = 'CASE%02d' % testIndex
You Wang53dba1e2018-02-02 17:45:44 -080044 main.resultFileName = 'CASE%02d' % testIndex
45 main.Cluster.setRunningNode( onosNodes )
46 run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
Devin Lim57221b02018-02-14 15:45:36 -080047 run.loadJson( main )
48 run.loadHost( main )
You Wang53dba1e2018-02-02 17:45:44 -080049 if hasattr( main, 'Mininet1' ):
50 # Run the test with Mininet
51 if dualHomed:
52 mininet_args = ' --spine=2 --leaf=4 --dual-homed'
53 else:
54 mininet_args = ' --spine=2 --leaf=2'
55 mininet_args += ' --dhcp-client'
56 if dhcpRelay:
57 mininet_args += ' --dhcp-relay'
58 if multipleServer:
59 mininet_args += ' --multiple-dhcp-server'
60 if remoteServer:
61 mininet_args += ' --remote-dhcp-server'
62 if ipv6:
63 mininet_args += ' --ipv6'
64 if len( vlan ) > 0 :
65 mininet_args += ' --vlan=%s' % ( ','.join( ['%d' % vlanId for vlanId in vlan ] ) )
66
67 run.startMininet( main, 'trellis_fabric.py', args=mininet_args )
68 else:
69 # Run the test with physical devices
70 # TODO: connect TestON to the physical network
71 pass
72 run.verifyOnosHostIp( main )
73 run.verifyNetworkHostIp( main )
74
75 if hasattr( main, 'Mininet1' ):
76 run.cleanup( main )
77 else:
78 # TODO: disconnect TestON from the physical network
79 pass