blob: d988c14e6cd6df93b806e60b3cbd6f626218697c [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001#!/usr/bin/env python
2'''
3Created on 26-Nov-2012
4
5@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
6
7 TestON is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
11
12 TestON is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
Jon Hall4ba53f02015-07-29 13:07:41 -070018 along with TestON. If not, see <http://www.gnu.org/licenses/>.
adminbae64d82013-08-01 10:50:15 -070019
Jon Hall4ba53f02015-07-29 13:07:41 -070020'''
adminbae64d82013-08-01 10:50:15 -070021class CaseParams:
22 '''
23 This example shows the usage of the CASE level parameters, in params file the
24 [[CASE]]
25 'destination' = 'h2'
Jon Hall4ba53f02015-07-29 13:07:41 -070026
adminbae64d82013-08-01 10:50:15 -070027 We can get this CASE level parameter like :
28 main.params['CASE1']['destination']
Jon Hall4ba53f02015-07-29 13:07:41 -070029
30
adminbae64d82013-08-01 10:50:15 -070031 cd ~/bin/
32 ofautomation>run CaseParams example 1
33 will execute this example.
34 '''
Jon Hall4ba53f02015-07-29 13:07:41 -070035
adminbae64d82013-08-01 10:50:15 -070036 def __init__(self):
37 self.default = ""
Jon Hall4ba53f02015-07-29 13:07:41 -070038
adminbae64d82013-08-01 10:50:15 -070039 def CASE1(self,main):
40 '''
41 This test case will showcase usage of CASE level parameters to specify the host as h2
42 '''
43 main.case("Using CASE level parameters to specify the host as h2")
44 main.step("Host IP Checking using checkIP")
45 result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
46 main.step("Verifying the result")
Jon Hall4ba53f02015-07-29 13:07:41 -070047 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host h2 IP address configured",onfail="Host h2 IP address didn't configured")
48
adminbae64d82013-08-01 10:50:15 -070049
50 def CASE2(self,main):
51 '''
52 This test case will showcase usage of CASE level parameters to specify the host as h3
53 '''
54 main.case("Using CASE level parameters to specify the host as h3")
55 main.step("Host IP Checking using checkIP")
56 result = main.Mininet1.checkIP(main.params['CASE2']['destination'])
57 main.step("Verifying the result")
Jon Hall4ba53f02015-07-29 13:07:41 -070058 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host h3 IP address configured",onfail="Host h3 IP address didn't configured")