blob: 0f0caac6c9c1c8c276b6aefa054bcbac33dd41d6 [file] [log] [blame]
Andreas Pantelopoulos90f0b102018-02-01 13:21:45 -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
Andreas Pantelopoulosf6ed5012018-02-08 21:26:01 -080023import time
Andreas Pantelopoulos90f0b102018-02-01 13:21:45 -080024
25class SRRoutingTest ():
26
27 topo = {}
28
29 def __init__( self ):
30 self.default = ''
31
32 @staticmethod
Andreas Pantelopoulosb7904ce2018-02-07 16:24:49 -080033 def runTest( main, test_idx, onosNodes, dhcp, routers, ipv4, ipv6, description):
Andreas Pantelopoulos90f0b102018-02-01 13:21:45 -080034
35 skipPackage = False
36 init = False
37 if not hasattr( main, 'apps' ):
38 init = True
39 run.initTest( main )
40
41 # Skip onos packaging if the cluster size stays the same
42 if not init and onosNodes == main.Cluster.numCtrls:
43 skipPackage = True
44
45 main.case('%s, ONOS instance%s' %
46 (description, onosNodes))
47
48 main.cfgName = 'COMCAST_CONFIG_ipv4=%d_ipv6=%d_dhcp=%d_routers=%d' % \
49 (ipv4, ipv6, dhcp, routers)
50 main.configPath = main.path + "/dependencies/"
51 main.resultFileName = 'CASE%02d' % test_idx
52 main.Cluster.setRunningNode(onosNodes)
53
54 run.installOnos(main, skipPackage=skipPackage, cliSleep=5,
55 parallel=False)
56
Andreas Pantelopoulosf6ed5012018-02-08 21:26:01 -080057 # wait some
58 time.sleep(5)
59
Andreas Pantelopoulos90f0b102018-02-01 13:21:45 -080060 if hasattr(main, 'Mininet1'):
61 # Run the test with Mininet
62 mininet_args = ' --dhcp=%s --routers=%s --ipv6=%s --ipv4=%s' % (dhcp, routers, ipv6, ipv4)
63 run.startMininet(main, 'comcast_fabric.py', args=mininet_args)
64 else:
65 # Run the test with physical devices
66 # TODO: connect TestON to the physical network
67 pass
68
Andreas Pantelopoulosf6ed5012018-02-08 21:26:01 -080069 # wait some time for onos to install the rules!
70 time.sleep(15)
71
Andreas Pantelopoulos90f0b102018-02-01 13:21:45 -080072 # ping hosts
Andreas Pantelopoulosf6ed5012018-02-08 21:26:01 -080073 run.pingAllBasedOnIp( main, 'CASE%02d' % test_idx )
Andreas Pantelopoulos90f0b102018-02-01 13:21:45 -080074
75 if hasattr(main, 'Mininet1'):
76 run.cleanup(main)
77 else:
78 # TODO: disconnect TestON from the physical network
79 pass