blob: 394d2df6da56150a6fda516bc22419a9d8c3d9e5 [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07001"""
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07002Copyright 2016 Open Networking Foundation ( ONF )
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07003
4Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6or 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
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070011 ( at your option ) any later version.
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -070012
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"""
Jon Hall602d0a72017-05-24 16:06:53 -070021def addBucket( main, egressPort="" ):
22 """
23 Description:
24 Create a single bucket which can be added to a Group.
25 Optional:
26 * egressPort: port of egress device
27 Returns:
28 * Returns a Bucket
29 * Returns None in case of error
30 Note:
31 The ip and port option are for the requests input's ip and port
32 of the ONOS node.
33 """
34 try:
kavitha Alagesan373e0552016-11-22 05:22:05 +053035
Jon Hall602d0a72017-05-24 16:06:53 -070036 bucket = {
37 "treatment": { "instructions": [] }
38 }
39 if egressPort:
40 bucket[ 'treatment' ][ 'instructions' ].append( {
41 "type": "OUTPUT",
42 "port": egressPort } )
43 return bucket
kavitha Alagesan373e0552016-11-22 05:22:05 +053044
Jon Hall602d0a72017-05-24 16:06:53 -070045 except ( AttributeError, TypeError ):
46 main.log.exception( self.name + ": Object not as expected" )
47 return None
48 except Exception:
49 main.log.exception( self.name + ": Uncaught exception!" )
Devin Lim44075962017-08-11 10:56:37 -070050 main.cleanAndExit()