add implementation of OFMatchV1 match, normalization
diff --git a/java_gen/templates/custom/OFMatchV1Ver10.Builder_normalize_set_wildcards_stanza.java b/java_gen/templates/custom/OFMatchV1Ver10.Builder_normalize_set_wildcards_stanza.java
new file mode 100644
index 0000000..3545f55
--- /dev/null
+++ b/java_gen/templates/custom/OFMatchV1Ver10.Builder_normalize_set_wildcards_stanza.java
@@ -0,0 +1,53 @@
+ // normalize match fields according to current OpenVSwitch behavior. When prerequisites for a field are not met
+ // e.g., eth_type is not set to 0x800, OVS sets the value of corresponding ignored fields (e.g.,
+ // ip_src, tcp_dst) to 0, and sets the wildcard bit to 1.
+ if(ethType.equals(EthType.IPv4)) {
+ // IP
+ if(ipProto.equals(IpProtocol.IP_PROTO_TCP) || ipProto.equals(IpProtocol.IP_PROTO_UDP) || ipProto.equals(IpProtocol.IP_PROTO_ICMP)) {
+ // fully speced, wildcards and all values are fine
+ // normalize 32-63 ipv4 src 'mask' to a full bitmask
+ if((wildcards & OFPFW_NW_SRC_ALL) != 0)
+ wildcards |= OFPFW_NW_SRC_MASK;
+
+ // normalize 32-63 ipv4 dst 'mask' to a full bitmask
+ if((wildcards & OFPFW_NW_DST_ALL) != 0)
+ wildcards |= OFPFW_NW_DST_MASK;
+
+ } else {
+ // normalize 32-63 ipv4 src 'mask' to a full bitmask
+ if((wildcards & OFPFW_NW_SRC_ALL) != 0)
+ wildcards |= OFPFW_NW_SRC_MASK;
+
+ // normalize 32-63 ipv4 dst 'mask' to a full bitmask
+ if((wildcards & OFPFW_NW_DST_ALL) != 0)
+ wildcards |= OFPFW_NW_DST_MASK;
+
+ // not TCP/UDP/ICMP -> Clear TP wildcards for the wire
+ wildcards |= (OFPFW_TP_SRC | OFPFW_TP_DST);
+ tcpSrc = TransportPort.NONE;
+ tcpDst = TransportPort.NONE;
+ }
+ } else if (ethType.equals(EthType.ARP)) {
+ // normalize 32-63 ipv4 src 'mask' to a full bitmask
+ if((wildcards & OFPFW_NW_SRC_ALL) != 0)
+ wildcards |= OFPFW_NW_SRC_MASK;
+
+ // normalize 32-63 ipv4 dst 'mask' to a full bitmask
+ if((wildcards & OFPFW_NW_DST_ALL) != 0)
+ wildcards |= OFPFW_NW_DST_MASK;
+
+ // ARP: clear NW_TOS / TP wildcards for the wire
+ wildcards |= ( OFPFW_NW_TOS | OFPFW_TP_SRC | OFPFW_TP_DST);
+ ipDscp = IpDscp.NONE;
+ tcpSrc = TransportPort.NONE;
+ tcpDst = TransportPort.NONE;
+ } else {
+ // not even IP. Clear NW/TP wildcards for the wire
+ wildcards |= ( OFPFW_NW_TOS | OFPFW_NW_PROTO | OFPFW_NW_SRC_MASK | OFPFW_NW_DST_MASK | OFPFW_TP_SRC | OFPFW_TP_DST);
+ ipDscp = IpDscp.NONE;
+ ipProto = IpProtocol.NONE;
+ ipv4Src = IPv4Address.NONE;
+ ipv4Dst = IPv4Address.NONE;
+ tcpSrc = TransportPort.NONE;
+ tcpDst = TransportPort.NONE;
+ }