admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | ''' |
| 3 | Created on 28-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> |
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 |
| 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/>. |
| 24 | ''' |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 25 | class Topology: |
| 26 | ''' |
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 | This example shows, how we can use the topology file: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 29 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 30 | In topo file we can specify the component like below: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 31 | [TOPOLOGY] |
| 32 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 33 | [[COMPONENT]] |
| 34 | [[["Mininet1"]]] |
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 | The usage of this component in the test script like below: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 37 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 38 | main.Mininet1.checkIP(main.params['CASE1']['destination']) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 39 | |
| 40 | Here we are using the Mininet1 which of type Mininet |
| 41 | |
| 42 | |
| 43 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 44 | ofautomation>run Topology example 1 |
| 45 | will execute this example. |
| 46 | ''' |
| 47 | def __init__(self): |
| 48 | self.default = "" |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 49 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 50 | def CASE1(self,main): |
| 51 | ''' |
| 52 | This will showcase the usage of Topology |
| 53 | ''' |
| 54 | main.case("Usage of Topology") |
| 55 | main.step("Mininet1 specified in Topology , using the Mininet1 to check host ip") |
| 56 | result = main.Mininet1.checkIP(main.params['CASE1']['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 h2 IP address configured",onfail="Host h2 IP address didn't configured") |
| 59 | |
| 60 | |