blob: 7e4c2fad830b988851bc2834596e1c231892bece [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001#!/usr/bin/env python
2'''
3Created on 28-Nov-2012
4
5@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
6
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
Jon Hall4ba53f02015-07-29 13:07:41 -070019 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20'''
adminbae64d82013-08-01 10:50:15 -070021class StepParams:
Jon Hall4ba53f02015-07-29 13:07:41 -070022 '''
adminbae64d82013-08-01 10:50:15 -070023 This example shows the usage of the STEP level parameters, in params file the
24 [[CASE1]]
25 [[[STEP1]]]
26 'host' = 'h2'
Jon Hall4ba53f02015-07-29 13:07:41 -070027
adminbae64d82013-08-01 10:50:15 -070028 We can get this STEP level parameter like :
29 main.params['CASE1']['STEP1']['host']
Jon Hall4ba53f02015-07-29 13:07:41 -070030
31
32 ofautomation>run StepParams example 1
adminbae64d82013-08-01 10:50:15 -070033 '''
34 def __init__(self):
35 self.default = ""
Jon Hall4ba53f02015-07-29 13:07:41 -070036
adminbae64d82013-08-01 10:50:15 -070037 def CASE1(self,main):
38 '''
39 This example will showcase the usage of STEP level parameters to specify the host as h2
40 '''
41 main.case("Using STEP level parameters to specify the host as h2")
42 main.step("Host IP Checking using checkIP")
43 result = main.Mininet1.checkIP(main.params['CASE1']['STEP1']['host'])
44 main.step("Verifying the result")
Jon Hall4ba53f02015-07-29 13:07:41 -070045 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host h2 IP address configured",onfail="Host h2 IP address didn't configured")
46
adminbae64d82013-08-01 10:50:15 -070047
48 def CASE2(self,main):
49 '''
50 This example will showcase the usage of STEP level parameters to specify the host as h3
51 '''
52 main.case("Using STEP level parameters to specify the host as h3")
53 main.step("Host IP Checking using checkIP")
54 result = main.Mininet1.checkIP(main.params['CASE2']['STEP1']['host'])
55 main.step("Verifying the result")
Jon Hall4ba53f02015-07-29 13:07:41 -070056 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host h3 IP address configured",onfail="Host h3 IP address didn't configured")