admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 2 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 3 | Created on 28-Nov-2012 |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 4 | Copyright 2012 Open Networking Foundation ( ONF ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 5 | |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 6 | author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 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> |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 11 | |
| 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 |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 15 | ( at your option ) any later version. |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 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/>. |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 24 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 25 | class StepParams: |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 26 | |
| 27 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 28 | This example shows the usage of the STEP level parameters, in params file the |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 29 | [ [ CASE1 ] ] |
| 30 | [ [ [ STEP1 ] ] ] |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 31 | 'host' = 'h2' |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 32 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 33 | We can get this STEP level parameter like : |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 34 | main.params[ 'CASE1' ][ 'STEP1' ][ 'host' ] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 35 | |
| 36 | |
| 37 | ofautomation>run StepParams example 1 |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 38 | """ |
| 39 | def __init__( self ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 40 | self.default = "" |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 41 | |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 42 | def CASE1( self, main ): |
| 43 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 44 | This example will showcase the usage of STEP level parameters to specify the host as h2 |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 45 | """ |
| 46 | main.case( "Using STEP level parameters to specify the host as h2" ) |
| 47 | main.step( "Host IP Checking using checkIP" ) |
| 48 | result = main.Mininet1.checkIP( main.params[ 'CASE1' ][ 'STEP1' ][ 'host' ] ) |
| 49 | main.step( "Verifying the result" ) |
| 50 | utilities.assert_equals( expect=main.TRUE, actual=result, onpass="Host h2 IP address configured", onfail="Host h2 IP address didn't configured" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 51 | |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 52 | def CASE2( self, main ): |
| 53 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 54 | This example will showcase the usage of STEP level parameters to specify the host as h3 |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 55 | """ |
| 56 | main.case( "Using STEP level parameters to specify the host as h3" ) |
| 57 | main.step( "Host IP Checking using checkIP" ) |
| 58 | result = main.Mininet1.checkIP( main.params[ 'CASE2' ][ 'STEP1' ][ 'host' ] ) |
| 59 | main.step( "Verifying the result" ) |
| 60 | utilities.assert_equals( expect=main.TRUE, actual=result, onpass="Host h3 IP address configured", onfail="Host h3 IP address didn't configured" ) |