* Implement the missing OpenFlow 1.0 matching conditions

* Code cleanup: reorder the implementation of the matching
  conditions so the order everywhere is always same and matches the
  order of listing those conditions in the OpenFlow-1.0 spec.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java
index 0b79c01..a721ff2 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java
@@ -72,13 +72,13 @@
     private Field<Port> inPort;		// Matching input switch port
     private Field<MACAddress> srcMac;	// Matching source MAC address
     private Field<MACAddress> dstMac;	// Matching destination MAC address
+    private Field<Short> ethernetFrameType; // Matching Ethernet frame type
     private Field<Short> vlanId;	// Matching VLAN ID
     private Field<Byte> vlanPriority;	// Matching VLAN priority
-    private Field<Short> ethernetFrameType; // Matching Ethernet frame type
-    private Field<Byte> ipToS;		// Matching IP ToS (DSCP field, 6 bits)
-    private Field<Byte> ipProto;	// Matching IP protocol
     private Field<IPv4Net> srcIPv4Net;	// Matching source IPv4 prefix
     private Field<IPv4Net> dstIPv4Net;	// Matching destination IPv4 prefix
+    private Field<Byte> ipProto;	// Matching IP protocol
+    private Field<Byte> ipToS;		// Matching IP ToS (DSCP field, 6 bits)
     private Field<Short> srcTcpUdpPort;	// Matching source TCP/UDP port
     private Field<Short> dstTcpUdpPort;	// Matching destination TCP/UDP port
 
@@ -100,20 +100,20 @@
 	    this.enableSrcMac(other.srcMac.value());
 	if ((other.dstMac != null) && other.dstMac.enabled())
 	    this.enableDstMac(other.dstMac.value());
+	if ((other.ethernetFrameType != null) && other.ethernetFrameType.enabled())
+	    this.enableEthernetFrameType(other.ethernetFrameType.value());
 	if ((other.vlanId != null) && other.vlanId.enabled())
 	    this.enableVlanId(other.vlanId.value());
 	if ((other.vlanPriority != null) && other.vlanPriority.enabled())
 	    this.enableVlanPriority(other.vlanPriority.value());
-	if ((other.ethernetFrameType != null) && other.ethernetFrameType.enabled())
-	    this.enableEthernetFrameType(other.ethernetFrameType.value());
-	if ((other.ipToS != null) && other.ipToS.enabled())
-	    this.enableIpToS(other.ipToS.value());
-	if ((other.ipProto != null) && other.ipProto.enabled())
-	    this.enableIpProto(other.ipProto.value());
 	if ((other.srcIPv4Net != null) && other.srcIPv4Net.enabled())
 	    this.enableSrcIPv4Net(other.srcIPv4Net.value());
 	if ((other.dstIPv4Net != null) && other.dstIPv4Net.enabled())
 	    this.enableDstIPv4Net(other.dstIPv4Net.value());
+	if ((other.ipProto != null) && other.ipProto.enabled())
+	    this.enableIpProto(other.ipProto.value());
+	if ((other.ipToS != null) && other.ipToS.enabled())
+	    this.enableIpToS(other.ipToS.value());
 	if ((other.srcTcpUdpPort != null) && other.srcTcpUdpPort.enabled())
 	    this.enableSrcTcpUdpPort(other.srcTcpUdpPort.value());
 	if ((other.dstTcpUdpPort != null) && other.dstTcpUdpPort.enabled())
@@ -244,6 +244,48 @@
     }
 
     /**
+     * Get the matching Ethernet frame type.
+     *
+     * @return the matching Ethernet frame type.
+     */
+    @JsonProperty("ethernetFrameType")
+    public Short ethernetFrameType() {
+	if (ethernetFrameType != null)
+	    return ethernetFrameType.value();
+	return null;
+    }
+
+    /**
+     * Enable the matching on Ethernet frame type.
+     *
+     * @param ethernetFrameType the Ethernet frame type value to enable for
+     * matching.
+     */
+    @JsonProperty("ethernetFrameType")
+    public void enableEthernetFrameType(Short ethernetFrameType) {
+	this.ethernetFrameType = new Field<Short>(ethernetFrameType);
+    }
+
+    /**
+     * Disable the matching on Ethernet frame type.
+     */
+    public void disableEthernetFrameType() {
+	this.ethernetFrameType = null;
+    }
+
+    /**
+     * Test if matching on Ethernet frame type is enabled.
+     *
+     * @return true if matching on Ethernet frame type is enabled.
+     */
+    @JsonProperty("matchEthernetFrameType")
+    public boolean matchEthernetFrameType() {
+	if (ethernetFrameType != null)
+	    return ethernetFrameType.enabled();
+	return false;
+    }
+
+    /**
      * Get the matching VLAN ID.
      *
      * @return the matching VLAN ID.
@@ -326,130 +368,6 @@
     }
 
     /**
-     * Get the matching Ethernet frame type.
-     *
-     * @return the matching Ethernet frame type.
-     */
-    @JsonProperty("ethernetFrameType")
-    public Short ethernetFrameType() {
-	if (ethernetFrameType != null)
-	    return ethernetFrameType.value();
-	return null;
-    }
-
-    /**
-     * Enable the matching on Ethernet frame type.
-     *
-     * @param ethernetFrameType the Ethernet frame type value to enable for
-     * matching.
-     */
-    @JsonProperty("ethernetFrameType")
-    public void enableEthernetFrameType(Short ethernetFrameType) {
-	this.ethernetFrameType = new Field<Short>(ethernetFrameType);
-    }
-
-    /**
-     * Disable the matching on Ethernet frame type.
-     */
-    public void disableEthernetFrameType() {
-	this.ethernetFrameType = null;
-    }
-
-    /**
-     * Test if matching on Ethernet frame type is enabled.
-     *
-     * @return true if matching on Ethernet frame type is enabled.
-     */
-    @JsonProperty("matchEthernetFrameType")
-    public boolean matchEthernetFrameType() {
-	if (ethernetFrameType != null)
-	    return ethernetFrameType.enabled();
-	return false;
-    }
-
-    /**
-     * Get the matching IP ToS (DSCP field, 6 bits)
-     *
-     * @return the matching IP ToS.
-     */
-    @JsonProperty("ipToS")
-    public Byte ipToS() {
-	if (ipToS != null)
-	    return ipToS.value();
-	return null;
-    }
-
-    /**
-     * Enable the matching on IP ToS (DSCP field, 6 bits).
-     *
-     * @param ipToS the IP ToS value to enable for matching.
-     */
-    @JsonProperty("ipToS")
-    public void enableIpToS(Byte ipToS) {
-	this.ipToS = new Field<Byte>(ipToS);
-    }
-
-    /**
-     * Disable the matching on IP ToS (DSCP field, 6 bits).
-     */
-    public void disableIpToS() {
-	this.ipToS = null;
-    }
-
-    /**
-     * Test if matching on IP ToS (DSCP field, 6 bits) is enabled.
-     *
-     * @return true if matching on IP ToS is enabled.
-     */
-    @JsonProperty("matchIpToS")
-    public boolean matchIpToS() {
-	if (ipToS != null)
-	    return ipToS.enabled();
-	return false;
-    }
-
-    /**
-     * Get the matching IP protocol.
-     *
-     * @return the matching IP protocol.
-     */
-    @JsonProperty("ipProto")
-    public Byte ipProto() {
-	if (ipProto != null)
-	    return ipProto.value();
-	return null;
-    }
-
-    /**
-     * Enable the matching on IP protocol.
-     *
-     * @param ipProto the IP protocol value to enable for matching.
-     */
-    @JsonProperty("ipProto")
-    public void enableIpProto(Byte ipProto) {
-	this.ipProto = new Field<Byte>(ipProto);
-    }
-
-    /**
-     * Disable the matching on IP protocol.
-     */
-    public void disableIpProto() {
-	this.ipProto = null;
-    }
-
-    /**
-     * Test if matching on IP protocol is enabled.
-     *
-     * @return true if matching on IP protocol is enabled.
-     */
-    @JsonProperty("matchIpProto")
-    public boolean matchIpProto() {
-	if (ipProto != null)
-	    return ipProto.enabled();
-	return false;
-    }
-
-    /**
      * Get the matching source IPv4 prefix.
      *
      * @return the matching source IPv4 prefix.
@@ -533,6 +451,88 @@
     }
 
     /**
+     * Get the matching IP protocol.
+     *
+     * @return the matching IP protocol.
+     */
+    @JsonProperty("ipProto")
+    public Byte ipProto() {
+	if (ipProto != null)
+	    return ipProto.value();
+	return null;
+    }
+
+    /**
+     * Enable the matching on IP protocol.
+     *
+     * @param ipProto the IP protocol value to enable for matching.
+     */
+    @JsonProperty("ipProto")
+    public void enableIpProto(Byte ipProto) {
+	this.ipProto = new Field<Byte>(ipProto);
+    }
+
+    /**
+     * Disable the matching on IP protocol.
+     */
+    public void disableIpProto() {
+	this.ipProto = null;
+    }
+
+    /**
+     * Test if matching on IP protocol is enabled.
+     *
+     * @return true if matching on IP protocol is enabled.
+     */
+    @JsonProperty("matchIpProto")
+    public boolean matchIpProto() {
+	if (ipProto != null)
+	    return ipProto.enabled();
+	return false;
+    }
+
+    /**
+     * Get the matching IP ToS (DSCP field, 6 bits)
+     *
+     * @return the matching IP ToS.
+     */
+    @JsonProperty("ipToS")
+    public Byte ipToS() {
+	if (ipToS != null)
+	    return ipToS.value();
+	return null;
+    }
+
+    /**
+     * Enable the matching on IP ToS (DSCP field, 6 bits).
+     *
+     * @param ipToS the IP ToS value to enable for matching.
+     */
+    @JsonProperty("ipToS")
+    public void enableIpToS(Byte ipToS) {
+	this.ipToS = new Field<Byte>(ipToS);
+    }
+
+    /**
+     * Disable the matching on IP ToS (DSCP field, 6 bits).
+     */
+    public void disableIpToS() {
+	this.ipToS = null;
+    }
+
+    /**
+     * Test if matching on IP ToS (DSCP field, 6 bits) is enabled.
+     *
+     * @return true if matching on IP ToS is enabled.
+     */
+    @JsonProperty("matchIpToS")
+    public boolean matchIpToS() {
+	if (ipToS != null)
+	    return ipToS.enabled();
+	return false;
+    }
+
+    /**
      * Get the matching source TCP/UDP port.
      *
      * @return the matching source TCP/UDP port.
@@ -649,6 +649,12 @@
 	    addSpace = true;
 	    ret += "dstMac=" + this.dstMac().toString();
 	}
+	if (matchEthernetFrameType()) {
+	    if (addSpace)
+		ret += " ";
+	    addSpace = true;
+	    ret += "ethernetFrameType=" + this.ethernetFrameType().toString();
+	}
 	if (matchVlanId()) {
 	    if (addSpace)
 		ret += " ";
@@ -661,24 +667,6 @@
 	    addSpace = true;
 	    ret += "vlanPriority=" + this.vlanPriority().toString();
 	}
-	if (matchEthernetFrameType()) {
-	    if (addSpace)
-		ret += " ";
-	    addSpace = true;
-	    ret += "ethernetFrameType=" + this.ethernetFrameType().toString();
-	}
-	if (matchIpToS()) {
-	    if (addSpace)
-		ret += " ";
-	    addSpace = true;
-	    ret += "ipToS=" + this.ipToS().toString();
-	}
-	if (matchIpProto()) {
-	    if (addSpace)
-		ret += " ";
-	    addSpace = true;
-	    ret += "ipProto=" + this.ipProto().toString();
-	}
 	if (matchSrcIPv4Net()) {
 	    if (addSpace)
 		ret += " ";
@@ -691,6 +679,18 @@
 	    addSpace = true;
 	    ret += "dstIPv4Net=" + this.dstIPv4Net().toString();
 	}
+	if (matchIpProto()) {
+	    if (addSpace)
+		ret += " ";
+	    addSpace = true;
+	    ret += "ipProto=" + this.ipProto().toString();
+	}
+	if (matchIpToS()) {
+	    if (addSpace)
+		ret += " ";
+	    addSpace = true;
+	    ret += "ipToS=" + this.ipToS().toString();
+	}
 	if (matchSrcTcpUdpPort()) {
 	    if (addSpace)
 		ret += " ";
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
index f9385e7..4a8fc7b 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
@@ -41,21 +41,40 @@
 	//
 	{
     	    FlowEntryMatch match = new FlowEntryMatch();
-    	    Short matchEthernetFrameType = flowObj.getMatchEthernetFrameType();
-    	    if (matchEthernetFrameType != null)
-    		match.enableEthernetFrameType(matchEthernetFrameType);
-    	    String matchSrcIPv4Net = flowObj.getMatchSrcIPv4Net();
-    	    if (matchSrcIPv4Net != null)
-    		match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
-    	    String matchDstIPv4Net = flowObj.getMatchDstIPv4Net();
-    	    if (matchDstIPv4Net != null)
-    		match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
     	    String matchSrcMac = flowObj.getMatchSrcMac();
     	    if (matchSrcMac != null)
     		match.enableSrcMac(MACAddress.valueOf(matchSrcMac));
     	    String matchDstMac = flowObj.getMatchDstMac();
     	    if (matchDstMac != null)
     		match.enableDstMac(MACAddress.valueOf(matchDstMac));
+    	    Short matchEthernetFrameType = flowObj.getMatchEthernetFrameType();
+    	    if (matchEthernetFrameType != null)
+    		match.enableEthernetFrameType(matchEthernetFrameType);
+    	    Short matchVlanId = flowObj.getMatchVlanId();
+    	    if (matchVlanId != null)
+    		match.enableVlanId(matchVlanId);
+    	    Byte matchVlanPriority = flowObj.getMatchVlanPriority();
+    	    if (matchVlanPriority != null)
+    		match.enableVlanPriority(matchVlanPriority);
+    	    String matchSrcIPv4Net = flowObj.getMatchSrcIPv4Net();
+    	    if (matchSrcIPv4Net != null)
+    		match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
+    	    String matchDstIPv4Net = flowObj.getMatchDstIPv4Net();
+    	    if (matchDstIPv4Net != null)
+    		match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
+    	    Byte matchIpProto = flowObj.getMatchIpProto();
+    	    if (matchIpProto != null)
+    		match.enableIpProto(matchIpProto);
+    	    Byte matchIpToS = flowObj.getMatchIpToS();
+    	    if (matchIpToS != null)
+    		match.enableIpToS(matchIpToS);
+    	    Short matchSrcTcpUdpPort = flowObj.getMatchSrcTcpUdpPort();
+    	    if (matchSrcTcpUdpPort != null)
+    		match.enableSrcTcpUdpPort(matchSrcTcpUdpPort);
+    	    Short matchDstTcpUdpPort = flowObj.getMatchDstTcpUdpPort();
+    	    if (matchDstTcpUdpPort != null)
+    		match.enableDstTcpUdpPort(matchDstTcpUdpPort);
+
     	    this.setFlowEntryMatch(match);
 	}
 
@@ -75,21 +94,39 @@
     	    Short matchInPort = flowEntryObj.getMatchInPort();
     	    if (matchInPort != null)
     		match.enableInPort(new Port(matchInPort));
-    	    Short matchEthernetFrameType = flowEntryObj.getMatchEthernetFrameType();
-    	    if (matchEthernetFrameType != null)
-    		match.enableEthernetFrameType(matchEthernetFrameType);
-    	    String matchSrcIPv4Net = flowEntryObj.getMatchSrcIPv4Net();
-    	    if (matchSrcIPv4Net != null)
-    		match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
-    	    String matchDstIPv4Net = flowEntryObj.getMatchDstIPv4Net();
-    	    if (matchDstIPv4Net != null)
-    		match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
     	    String matchSrcMac = flowEntryObj.getMatchSrcMac();
     	    if (matchSrcMac != null)
     		match.enableSrcMac(MACAddress.valueOf(matchSrcMac));
     	    String matchDstMac = flowEntryObj.getMatchDstMac();
     	    if (matchDstMac != null)
     		match.enableDstMac(MACAddress.valueOf(matchDstMac));
+    	    Short matchEthernetFrameType = flowEntryObj.getMatchEthernetFrameType();
+    	    if (matchEthernetFrameType != null)
+    		match.enableEthernetFrameType(matchEthernetFrameType);
+    	    Short matchVlanId = flowEntryObj.getMatchVlanId();
+    	    if (matchVlanId != null)
+    		match.enableVlanId(matchVlanId);
+    	    Byte matchVlanPriority = flowEntryObj.getMatchVlanPriority();
+    	    if (matchVlanPriority != null)
+    		match.enableVlanPriority(matchVlanPriority);
+    	    String matchSrcIPv4Net = flowEntryObj.getMatchSrcIPv4Net();
+    	    if (matchSrcIPv4Net != null)
+    		match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
+    	    String matchDstIPv4Net = flowEntryObj.getMatchDstIPv4Net();
+    	    if (matchDstIPv4Net != null)
+    		match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
+    	    Byte matchIpProto = flowEntryObj.getMatchIpProto();
+    	    if (matchIpProto != null)
+    		match.enableIpProto(matchIpProto);
+    	    Byte matchIpToS = flowEntryObj.getMatchIpToS();
+    	    if (matchIpToS != null)
+    		match.enableIpToS(matchIpToS);
+    	    Short matchSrcTcpUdpPort = flowEntryObj.getMatchSrcTcpUdpPort();
+    	    if (matchSrcTcpUdpPort != null)
+    		match.enableSrcTcpUdpPort(matchSrcTcpUdpPort);
+    	    Short matchDstTcpUdpPort = flowEntryObj.getMatchDstTcpUdpPort();
+    	    if (matchDstTcpUdpPort != null)
+    		match.enableDstTcpUdpPort(matchDstTcpUdpPort);
     	    flowEntry.setFlowEntryMatch(match);
 
     	    //