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