blob: 290a26abb643abefc68990e5ca27c01f803f0680 [file] [log] [blame]
kavitha Alagesan373e0552016-11-22 05:22:05 +05301def addBucket( main , egressPort = "" ):
2 """
3 Description:
4 Create a single bucket which can be added to a Group.
5 Optional:
6 * egressPort: port of egress device
7 Returns:
8 * Returns a Bucket
9 * Returns None in case of error
10 Note:
11 The ip and port option are for the requests input's ip and port
12 of the ONOS node.
13 """
14 try:
15
16 bucket = {
17 "treatment":{ "instructions":[] }
18 }
19 if egressPort:
20 bucket[ 'treatment' ][ 'instructions' ].append( {
21 "type":"OUTPUT",
22 "port":egressPort } )
23 return bucket
24
25 except ( AttributeError, TypeError ):
26 main.log.exception( self.name + ": Object not as expected" )
27 return None
28 except Exception:
29 main.log.exception( self.name + ": Uncaught exception!" )
30 main.cleanup()
31 main.exit()