admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | ''' |
| 3 | Created 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 Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 19 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
| 20 | ''' |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 21 | class StepParams: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 22 | ''' |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 23 | This example shows the usage of the STEP level parameters, in params file the |
| 24 | [[CASE1]] |
| 25 | [[[STEP1]]] |
| 26 | 'host' = 'h2' |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 27 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 28 | We can get this STEP level parameter like : |
| 29 | main.params['CASE1']['STEP1']['host'] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 30 | |
| 31 | |
| 32 | ofautomation>run StepParams example 1 |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 33 | ''' |
| 34 | def __init__(self): |
| 35 | self.default = "" |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 36 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 37 | 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 Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 45 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host h2 IP address configured",onfail="Host h2 IP address didn't configured") |
| 46 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 47 | |
| 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 Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 56 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host h3 IP address configured",onfail="Host h3 IP address didn't configured") |