Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 1 | """ |
| 2 | Copyright 2016 Open Networking Foundation (ONF) |
| 3 | |
| 4 | Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 5 | the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 6 | or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
| 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 |
| 19 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
| 20 | """ |
| 21 | |
Jon Hall | 602d0a7 | 2017-05-24 16:06:53 -0700 | [diff] [blame] | 22 | def addBucket( main, egressPort="" ): |
| 23 | """ |
| 24 | Description: |
| 25 | Create a single bucket which can be added to a Group. |
| 26 | Optional: |
| 27 | * egressPort: port of egress device |
| 28 | Returns: |
| 29 | * Returns a Bucket |
| 30 | * Returns None in case of error |
| 31 | Note: |
| 32 | The ip and port option are for the requests input's ip and port |
| 33 | of the ONOS node. |
| 34 | """ |
| 35 | try: |
kavitha Alagesan | 373e055 | 2016-11-22 05:22:05 +0530 | [diff] [blame] | 36 | |
Jon Hall | 602d0a7 | 2017-05-24 16:06:53 -0700 | [diff] [blame] | 37 | bucket = { |
| 38 | "treatment": { "instructions": [] } |
| 39 | } |
| 40 | if egressPort: |
| 41 | bucket[ 'treatment' ][ 'instructions' ].append( { |
| 42 | "type": "OUTPUT", |
| 43 | "port": egressPort } ) |
| 44 | return bucket |
kavitha Alagesan | 373e055 | 2016-11-22 05:22:05 +0530 | [diff] [blame] | 45 | |
Jon Hall | 602d0a7 | 2017-05-24 16:06:53 -0700 | [diff] [blame] | 46 | except ( AttributeError, TypeError ): |
| 47 | main.log.exception( self.name + ": Object not as expected" ) |
| 48 | return None |
| 49 | except Exception: |
| 50 | main.log.exception( self.name + ": Uncaught exception!" ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 51 | main.cleanAndExit() |