[VOL-3066] Ofagent must support VLAN_PCP and ETH_DST fields
Change-Id: I605a47bb12d1a9dac59112e4cfcb4f4229dadeda
diff --git a/VERSION b/VERSION
index 26aaba0..538ee20 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.2.0
+1.2.1-dev
diff --git a/internal/pkg/openflow/flowMod.go b/internal/pkg/openflow/flowMod.go
index bd8ea4a..a087cef 100644
--- a/internal/pkg/openflow/flowMod.go
+++ b/internal/pkg/openflow/flowMod.go
@@ -122,6 +122,10 @@
field.Value = &voltha.OfpOxmOfbField_Ipv4Dst{
Ipv4Dst: binary.BigEndian.Uint32(val.(net.IP)),
}
+ case voltha.OxmOfbFieldTypes_OFPXMT_OFB_ETH_DST:
+ field.Value = &voltha.OfpOxmOfbField_EthDst{
+ EthDst: val.(net.HardwareAddr),
+ }
case voltha.OxmOfbFieldTypes_OFPXMT_OFB_UDP_SRC:
field.Value = &voltha.OfpOxmOfbField_UdpSrc{
UdpSrc: uint32(val.(uint16)),
@@ -134,6 +138,10 @@
field.Value = &voltha.OfpOxmOfbField_VlanVid{
VlanVid: uint32((val.(uint16) & 0xfff) | 0x1000),
}
+ case voltha.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_PCP:
+ field.Value = &voltha.OfpOxmOfbField_VlanPcp{
+ VlanPcp: uint32(val.(uint8)),
+ }
case 200: // voltha-protos doesn't actually have a type for vlan_mask
field = voltha.OfpOxmOfbField{Type: voltha.OxmOfbFieldTypes(oxmMap["vlan_vid"])}
field.HasMask = true
diff --git a/internal/pkg/openflow/parseGrpcReturn.go b/internal/pkg/openflow/parseGrpcReturn.go
index b9e4e29..9967d9b 100644
--- a/internal/pkg/openflow/parseGrpcReturn.go
+++ b/internal/pkg/openflow/parseGrpcReturn.go
@@ -104,6 +104,17 @@
val := ofbField.GetValue().(*openflow_13.OfpOxmOfbField_TableMetadata)
ofpMetadata.Value = val.TableMetadata
return ofpMetadata
+ case voltha.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_PCP:
+ ofpVlanPcp := ofp.NewOxmVlanPcp()
+ val := ofbField.GetValue()
+ vlanPcp := val.(*openflow_13.OfpOxmOfbField_VlanPcp)
+ ofpVlanPcp.Value = uint8(vlanPcp.VlanPcp)
+ return ofpVlanPcp
+ case voltha.OxmOfbFieldTypes_OFPXMT_OFB_ETH_DST:
+ ofpEthDst := ofp.NewOxmEthDst()
+ val := ofbField.GetValue().(*openflow_13.OfpOxmOfbField_EthDst)
+ ofpEthDst.Value = val.EthDst
+ return ofpEthDst
default:
if logger.V(log.WarnLevel) {
js, _ := json.Marshal(ofbField)
diff --git a/internal/pkg/openflow/utils.go b/internal/pkg/openflow/utils.go
index 8745087..ffe4e52 100644
--- a/internal/pkg/openflow/utils.go
+++ b/internal/pkg/openflow/utils.go
@@ -103,8 +103,13 @@
var vlanVid openflow_13.OfpOxmOfbField_VlanVid
var VlanVid = loxiSetField.Field.GetOXMValue().(uint16)
vlanVid.VlanVid = uint32(VlanVid)
-
ofpOxmOfbField.Value = &vlanVid
+ case "vlan_pcp":
+ ofpOxmOfbField.Type = openflow_13.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_PCP
+ var vlanPcp openflow_13.OfpOxmOfbField_VlanPcp
+ var VlanPcp = loxiSetField.Field.GetOXMValue().(uint8)
+ vlanPcp.VlanPcp = uint32(VlanPcp)
+ ofpOxmOfbField.Value = &vlanPcp
}
ofpOxmField_OfbField.OfbField = &ofpOxmOfbField
ofpOxmField.Field = &ofpOxmField_OfbField