admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | ''' |
| 3 | Created on 26-Nov-2012 |
Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 4 | Copyright 2012 Open Networking Foundation (ONF) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 5 | |
| 6 | @author: Anil Kumar (anilkumar.s@paxterrasolutions.com) |
| 7 | |
Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 8 | Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 9 | the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 10 | or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
| 11 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 12 | TestON is free software: you can redistribute it and/or modify |
| 13 | it under the terms of the GNU General Public License as published by |
| 14 | the Free Software Foundation, either version 2 of the License, or |
| 15 | (at your option) any later version. |
| 16 | |
| 17 | TestON is distributed in the hope that it will be useful, |
| 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | GNU General Public License for more details. |
| 21 | |
| 22 | You should have received a copy of the GNU General Public License |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 23 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 24 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 25 | ''' |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 26 | class CaseParams: |
| 27 | ''' |
| 28 | This example shows the usage of the CASE level parameters, in params file the |
| 29 | [[CASE]] |
| 30 | 'destination' = 'h2' |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 31 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 32 | We can get this CASE level parameter like : |
| 33 | main.params['CASE1']['destination'] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 34 | |
| 35 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 36 | cd ~/bin/ |
| 37 | ofautomation>run CaseParams example 1 |
| 38 | will execute this example. |
| 39 | ''' |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 40 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 41 | def __init__(self): |
| 42 | self.default = "" |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 43 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 44 | def CASE1(self,main): |
| 45 | ''' |
| 46 | This test case will showcase usage of CASE level parameters to specify the host as h2 |
| 47 | ''' |
| 48 | main.case("Using CASE level parameters to specify the host as h2") |
| 49 | main.step("Host IP Checking using checkIP") |
| 50 | result = main.Mininet1.checkIP(main.params['CASE1']['destination']) |
| 51 | main.step("Verifying the result") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 52 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host h2 IP address configured",onfail="Host h2 IP address didn't configured") |
| 53 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 54 | |
| 55 | def CASE2(self,main): |
| 56 | ''' |
| 57 | This test case will showcase usage of CASE level parameters to specify the host as h3 |
| 58 | ''' |
| 59 | main.case("Using CASE level parameters to specify the host as h3") |
| 60 | main.step("Host IP Checking using checkIP") |
| 61 | result = main.Mininet1.checkIP(main.params['CASE2']['destination']) |
| 62 | main.step("Verifying the result") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 63 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host h3 IP address configured",onfail="Host h3 IP address didn't configured") |