blob: 1ac4f7a44a3bb191f683689cde1c0b087ea47972 [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
44 main.configPath = main.path + "/dependencies/"
45 main.resultFileName = 'CASE%02d' % testIndex
46 main.Cluster.setRunningNode( onosNodes )
47 run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
48 import json
49 with open( "%s/json/%s.host" % ( main.configPath, main.cfgName ) ) as host:
50 main.expectedHosts = json.load( host )
51 if hasattr( main, 'Mininet1' ):
52 # Run the test with Mininet
53 if dualHomed:
54 mininet_args = ' --spine=2 --leaf=4 --dual-homed'
55 else:
56 mininet_args = ' --spine=2 --leaf=2'
57 mininet_args += ' --dhcp-client'
58 if dhcpRelay:
59 mininet_args += ' --dhcp-relay'
60 if multipleServer:
61 mininet_args += ' --multiple-dhcp-server'
62 if remoteServer:
63 mininet_args += ' --remote-dhcp-server'
64 if ipv6:
65 mininet_args += ' --ipv6'
66 if len( vlan ) > 0 :
67 mininet_args += ' --vlan=%s' % ( ','.join( ['%d' % vlanId for vlanId in vlan ] ) )
68
69 run.startMininet( main, 'trellis_fabric.py', args=mininet_args )
70 else:
71 # Run the test with physical devices
72 # TODO: connect TestON to the physical network
73 pass
74 run.verifyOnosHostIp( main )
75 run.verifyNetworkHostIp( main )
76
77 if hasattr( main, 'Mininet1' ):
78 run.cleanup( main )
79 else:
80 # TODO: disconnect TestON from the physical network
81 pass