VOL-3212: Add support for fetching SetVlanVid and SetVlanPcp from
flow instructions.
Change-Id: I6e94e0357f0d6337fb5c6f4731b06f21190b81c8
diff --git a/VERSION b/VERSION
index 1ed341f..f15386a 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.2.10-dev
+3.2.10
diff --git a/pkg/flows/flow_utils.go b/pkg/flows/flow_utils.go
index 66e719c..9b800bf 100644
--- a/pkg/flows/flow_utils.go
+++ b/pkg/flows/flow_utils.go
@@ -491,6 +491,35 @@
return nil
}
+func GetSetActionField(ctx context.Context, flow *ofp.OfpFlowStats, ofbType ofp.OxmOfbFieldTypes) (uint32, bool) {
+ if flow == nil {
+ return 0, false
+ }
+ for _, instruction := range flow.Instructions {
+ if instruction.Type == uint32(APPLY_ACTIONS) {
+ actions := instruction.GetActions()
+ for _, action := range actions.GetActions() {
+ if action.Type == SET_FIELD {
+ setField := action.GetSetField()
+ if setField.Field.GetOfbField().Type == ofbType {
+ switch ofbType {
+ case VLAN_PCP:
+ return setField.Field.GetOfbField().GetVlanPcp(), true
+ case VLAN_VID:
+ return setField.Field.GetOfbField().GetVlanVid(), true
+ default:
+ logger.Errorw(ctx, "unsupported-ofb-field-type", log.Fields{"ofbType": ofbType})
+ return 0, false
+ }
+ }
+ }
+ }
+ return 0, false
+ }
+ }
+ return 0, false
+}
+
func GetTunnelId(flow *ofp.OfpFlowStats) uint64 {
if flow == nil {
return 0