Skip to content

Commit

Permalink
Add support for REMOVE_BUCKET operation in group
Browse files Browse the repository at this point in the history
Signed-off-by: Hongliang Liu <[email protected]>
  • Loading branch information
hongliangl committed Jan 17, 2023
1 parent 21f844c commit 44b5063
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@

.idea/
.vscode/
vendor
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.6.7
v0.6.8
18 changes: 15 additions & 3 deletions ofctrl/fgraphGroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,25 @@ func (self *Group) getGroupModMessage(command int) *openflow15.GroupMod {
groupMod.Type = openflow15.GT_FF
}

for _, bkt := range self.Buckets {
// Add the bucket to group
groupMod.AddBucket(*bkt)
// OFPGC_REMOVE_BUCKET does not need bucket list.
if command != openflow15.OFPGC_REMOVE_BUCKET {
for _, bkt := range self.Buckets {
// Add the bucket to group
groupMod.AddBucket(*bkt)
}
}

if command == openflow15.OFPGC_INSERT_BUCKET {
// In a request of type OFPGC_INSERT_BUCKET, the command_bucket_id field is used to specify the position in the
// current action bucket list to insert new action buckets. Here place the buckets to the end of the current action
// bucket list.
groupMod.CommandBucketId = openflow15.OFPG_BUCKET_LAST
} else if command == openflow15.OFPGC_REMOVE_BUCKET {
// In a request of type OFPGC_REMOVE_BUCKET, the CommandBucketId field is used to specify the identifier of the
// bucket to remove from current action bucket list.
groupMod.CommandBucketId = self.Buckets[0].BucketId
// In a request of type OFPGC_REMOVE_BUCKET, bucket list should be empty when removing a bucket.
groupMod.Buckets = nil
}
groupMod.Command = uint16(command)
return groupMod
Expand Down

0 comments on commit 44b5063

Please sign in to comment.