* 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/core/INetMapTopologyObjects.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
index 3a5c9e2..04f9384 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
@@ -247,13 +247,6 @@
 		public void removeFlowEntry(final IFlowEntry flowEntry);
 
 		@JsonIgnore
-		@Property("matchEthernetFrameType")
-		public Short getMatchEthernetFrameType();
-
-		@Property("matchEthernetFrameType")
-		public void setMatchEthernetFrameType(Short matchEthernetFrameType);
-
-		@JsonIgnore
 		@Property("matchSrcMac")
 		public String getMatchSrcMac();
 
@@ -268,6 +261,27 @@
 		public void setMatchDstMac(String matchDstMac);
 
 		@JsonIgnore
+		@Property("matchEthernetFrameType")
+		public Short getMatchEthernetFrameType();
+
+		@Property("matchEthernetFrameType")
+		public void setMatchEthernetFrameType(Short matchEthernetFrameType);
+
+		@JsonIgnore
+		@Property("matchVlanId")
+		public Short getMatchVlanId();
+
+		@Property("matchVlanId")
+		public void setMatchVlanId(Short matchVlanId);
+
+		@JsonIgnore
+		@Property("matchVlanPriority")
+		public Byte getMatchVlanPriority();
+
+		@Property("matchVlanPriority")
+		public void setMatchVlanPriority(Byte matchVlanPriority);
+
+		@JsonIgnore
 		@Property("matchSrcIPv4Net")
 		public String getMatchSrcIPv4Net();
 
@@ -280,7 +294,35 @@
 
 		@Property("matchDstIPv4Net")
 		public void setMatchDstIPv4Net(String matchDstIPv4Net);
-		
+
+		@JsonIgnore
+		@Property("matchIpProto")
+		public Byte getMatchIpProto();
+
+		@Property("matchIpProto")
+		public void setMatchIpProto(Byte matchIpProto);
+
+		@JsonIgnore
+		@Property("matchIpToS")
+		public Byte getMatchIpToS();
+
+		@Property("matchIpToS")
+		public void setMatchIpToS(Byte matchIpToS);
+
+		@JsonIgnore
+		@Property("matchSrcTcpUdpPort")
+		public Short getMatchSrcTcpUdpPort();
+
+		@Property("matchSrcTcpUdpPort")
+		public void setMatchSrcTcpUdpPort(Short matchSrcTcpUdpPort);
+
+		@JsonIgnore
+		@Property("matchDstTcpUdpPort")
+		public Short getMatchDstTcpUdpPort();
+
+		@Property("matchDstTcpUdpPort")
+		public void setMatchDstTcpUdpPort(Short matchDstTcpUdpPort);
+
 		@JsonIgnore
 		@GremlinGroovy("it.in('flow').out('switch')")
 		public Iterable<ISwitchObject> getSwitches();
@@ -340,12 +382,6 @@
 		@Property("matchInPort")
 		public void setMatchInPort(Short matchInPort);
 
-		@Property("matchEthernetFrameType")
-		public Short getMatchEthernetFrameType();
-
-		@Property("matchEthernetFrameType")
-		public void setMatchEthernetFrameType(Short matchEthernetFrameType);
-
 		@Property("matchSrcMac")
 		public String getMatchSrcMac();
 
@@ -358,6 +394,24 @@
 		@Property("matchDstMac")
 		public void setMatchDstMac(String matchDstMac);
 
+		@Property("matchEthernetFrameType")
+		public Short getMatchEthernetFrameType();
+
+		@Property("matchEthernetFrameType")
+		public void setMatchEthernetFrameType(Short matchEthernetFrameType);
+
+		@Property("matchVlanId")
+		public Short getMatchVlanId();
+
+		@Property("matchVlanId")
+		public void setMatchVlanId(Short matchVlanId);
+
+		@Property("matchVlanPriority")
+		public Byte getMatchVlanPriority();
+
+		@Property("matchVlanPriority")
+		public void setMatchVlanPriority(Byte matchVlanPriority);
+
 		@Property("matchSrcIPv4Net")
 		public String getMatchSrcIPv4Net();
 
@@ -370,6 +424,30 @@
 		@Property("matchDstIPv4Net")
 		public void setMatchDstIPv4Net(String matchDstIPv4Net);
 
+		@Property("matchIpProto")
+		public Byte getMatchIpProto();
+
+		@Property("matchIpProto")
+		public void setMatchIpProto(Byte matchIpProto);
+
+		@Property("matchIpToS")
+		public Byte getMatchIpToS();
+
+		@Property("matchIpToS")
+		public void setMatchIpToS(Byte matchIpToS);
+
+		@Property("matchSrcTcpUdpPort")
+		public Short getMatchSrcTcpUdpPort();
+
+		@Property("matchSrcTcpUdpPort")
+		public void setMatchSrcTcpUdpPort(Short matchSrcTcpUdpPort);
+
+		@Property("matchDstTcpUdpPort")
+		public Short getMatchDstTcpUdpPort();
+
+		@Property("matchDstTcpUdpPort")
+		public void setMatchDstTcpUdpPort(Short matchDstTcpUdpPort);
+
 		@Property("actionOutput")
 		public Short getActionOutput();
 
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
index 25a214a..6fd5c03 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -570,31 +570,55 @@
 	// - flowPath.installerId()
 	// - flowPath.dataPath().srcPort()
 	// - flowPath.dataPath().dstPort()
-	// - flowPath.matchEthernetFrameType()
-	// - flowPath.matchSrcIPv4Net()
-	// - flowPath.matchDstIPv4Net()
 	// - flowPath.matchSrcMac()
 	// - flowPath.matchDstMac()
+	// - flowPath.matchEthernetFrameType()
+	// - flowPath.matchVlanId()
+	// - flowPath.matchVlanPriority()
+	// - flowPath.matchSrcIPv4Net()
+	// - flowPath.matchDstIPv4Net()
+	// - flowPath.matchIpProto()
+	// - flowPath.matchIpToS()
+	// - flowPath.matchSrcTcpUdpPort()
+	// - flowPath.matchDstTcpUdpPort()
 	//
 	flowObj.setInstallerId(flowPath.installerId().toString());
 	flowObj.setSrcSwitch(flowPath.dataPath().srcPort().dpid().toString());
 	flowObj.setSrcPort(flowPath.dataPath().srcPort().port().value());
 	flowObj.setDstSwitch(flowPath.dataPath().dstPort().dpid().toString());
 	flowObj.setDstPort(flowPath.dataPath().dstPort().port().value());
+	if (flowPath.flowEntryMatch().matchSrcMac()) {
+	    flowObj.setMatchSrcMac(flowPath.flowEntryMatch().srcMac().toString());
+	}
+	if (flowPath.flowEntryMatch().matchDstMac()) {
+	    flowObj.setMatchDstMac(flowPath.flowEntryMatch().dstMac().toString());
+	}
 	if (flowPath.flowEntryMatch().matchEthernetFrameType()) {
 	    flowObj.setMatchEthernetFrameType(flowPath.flowEntryMatch().ethernetFrameType());
 	}
+	if (flowPath.flowEntryMatch().matchVlanId()) {
+	    flowObj.setMatchVlanId(flowPath.flowEntryMatch().vlanId());
+	}
+	if (flowPath.flowEntryMatch().matchVlanPriority()) {
+	    flowObj.setMatchVlanPriority(flowPath.flowEntryMatch().vlanPriority());
+	}
 	if (flowPath.flowEntryMatch().matchSrcIPv4Net()) {
 	    flowObj.setMatchSrcIPv4Net(flowPath.flowEntryMatch().srcIPv4Net().toString());
 	}
 	if (flowPath.flowEntryMatch().matchDstIPv4Net()) {
 	    flowObj.setMatchDstIPv4Net(flowPath.flowEntryMatch().dstIPv4Net().toString());
 	}
-	if (flowPath.flowEntryMatch().matchSrcMac()) {
-	    flowObj.setMatchSrcMac(flowPath.flowEntryMatch().srcMac().toString());
+	if (flowPath.flowEntryMatch().matchIpProto()) {
+	    flowObj.setMatchIpProto(flowPath.flowEntryMatch().ipProto());
 	}
-	if (flowPath.flowEntryMatch().matchDstMac()) {
-	    flowObj.setMatchDstMac(flowPath.flowEntryMatch().dstMac().toString());
+	if (flowPath.flowEntryMatch().matchIpToS()) {
+	    flowObj.setMatchIpToS(flowPath.flowEntryMatch().ipToS());
+	}
+	if (flowPath.flowEntryMatch().matchSrcTcpUdpPort()) {
+	    flowObj.setMatchSrcTcpUdpPort(flowPath.flowEntryMatch().srcTcpUdpPort());
+	}
+	if (flowPath.flowEntryMatch().matchDstTcpUdpPort()) {
+	    flowObj.setMatchDstTcpUdpPort(flowPath.flowEntryMatch().dstTcpUdpPort());
 	}
 
 	if (dataPathSummaryStr != null) {
@@ -696,11 +720,17 @@
 	// - flowEntry.flowEntrySwitchState()
 	// - flowEntry.flowEntryErrorState()
 	// - flowEntry.matchInPort()
-	// - flowEntry.matchEthernetFrameType()
-	// - flowEntry.matchSrcIPv4Net()
-	// - flowEntry.matchDstIPv4Net()
 	// - flowEntry.matchSrcMac()
 	// - flowEntry.matchDstMac()
+	// - flowEntry.matchEthernetFrameType()
+	// - flowEntry.matchVlanId()
+	// - flowEntry.matchVlanPriority()
+	// - flowEntry.matchSrcIPv4Net()
+	// - flowEntry.matchDstIPv4Net()
+	// - flowEntry.matchIpProto()
+	// - flowEntry.matchIpToS()
+	// - flowEntry.matchSrcTcpUdpPort()
+	// - flowEntry.matchDstTcpUdpPort()
 	// - flowEntry.actionOutput()
 	//
 	ISwitchObject sw =
@@ -714,20 +744,38 @@
 	    flowEntryObj.setMatchInPort(flowEntry.flowEntryMatch().inPort().value());
 	    flowEntryObj.setInPort(inport);
 	}
+	if (flowEntry.flowEntryMatch().matchSrcMac()) {
+	    flowEntryObj.setMatchSrcMac(flowEntry.flowEntryMatch().srcMac().toString());
+	}
+	if (flowEntry.flowEntryMatch().matchDstMac()) {
+	    flowEntryObj.setMatchDstMac(flowEntry.flowEntryMatch().dstMac().toString());
+	}
 	if (flowEntry.flowEntryMatch().matchEthernetFrameType()) {
 	    flowEntryObj.setMatchEthernetFrameType(flowEntry.flowEntryMatch().ethernetFrameType());
 	}
+	if (flowEntry.flowEntryMatch().matchVlanId()) {
+	    flowEntryObj.setMatchVlanId(flowEntry.flowEntryMatch().vlanId());
+	}
+	if (flowEntry.flowEntryMatch().matchVlanPriority()) {
+	    flowEntryObj.setMatchVlanPriority(flowEntry.flowEntryMatch().vlanPriority());
+	}
 	if (flowEntry.flowEntryMatch().matchSrcIPv4Net()) {
 	    flowEntryObj.setMatchSrcIPv4Net(flowEntry.flowEntryMatch().srcIPv4Net().toString());
 	}
 	if (flowEntry.flowEntryMatch().matchDstIPv4Net()) {
 	    flowEntryObj.setMatchDstIPv4Net(flowEntry.flowEntryMatch().dstIPv4Net().toString());
 	}
-	if (flowEntry.flowEntryMatch().matchSrcMac()) {
-	    flowEntryObj.setMatchSrcMac(flowEntry.flowEntryMatch().srcMac().toString());
+	if (flowEntry.flowEntryMatch().matchIpProto()) {
+	    flowEntryObj.setMatchIpProto(flowEntry.flowEntryMatch().ipProto());
 	}
-	if (flowEntry.flowEntryMatch().matchDstMac()) {
-	    flowEntryObj.setMatchDstMac(flowEntry.flowEntryMatch().dstMac().toString());
+	if (flowEntry.flowEntryMatch().matchIpToS()) {
+	    flowEntryObj.setMatchIpToS(flowEntry.flowEntryMatch().ipToS());
+	}
+	if (flowEntry.flowEntryMatch().matchSrcTcpUdpPort()) {
+	    flowEntryObj.setMatchSrcTcpUdpPort(flowEntry.flowEntryMatch().srcTcpUdpPort());
+	}
+	if (flowEntry.flowEntryMatch().matchDstTcpUdpPort()) {
+	    flowEntryObj.setMatchDstTcpUdpPort(flowEntry.flowEntryMatch().dstTcpUdpPort());
 	}
 
 	for (FlowEntryAction fa : flowEntry.flowEntryActions()) {
@@ -1293,21 +1341,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);
+
 	    flowPath.setFlowEntryMatch(match);
 	}
 
@@ -1356,21 +1423,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);
 
 	//
@@ -1553,6 +1638,24 @@
 	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_IN_PORT);
 	}
 
+	// Match the Source MAC address
+	String matchSrcMac = flowEntryObj.getMatchSrcMac();
+	if (matchSrcMac == null)
+	    matchSrcMac = flowObj.getMatchSrcMac();
+	if (matchSrcMac != null) {
+	    match.setDataLayerSource(matchSrcMac);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_SRC);
+	}
+
+	// Match the Destination MAC address
+	String matchDstMac = flowEntryObj.getMatchDstMac();
+	if (matchDstMac == null)
+	    matchDstMac = flowObj.getMatchDstMac();
+	if (matchDstMac != null) {
+	    match.setDataLayerDestination(matchDstMac);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_DST);
+	}
+
 	// Match the Ethernet Frame Type
 	Short matchEthernetFrameType = flowEntryObj.getMatchEthernetFrameType();
 	if (matchEthernetFrameType == null)
@@ -1562,6 +1665,24 @@
 	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_TYPE);
 	}
 
+	// Match the VLAN ID
+	Short matchVlanId = flowEntryObj.getMatchVlanId();
+	if (matchVlanId == null)
+	    matchVlanId = flowObj.getMatchVlanId();
+	if (matchVlanId != null) {
+	    match.setDataLayerVirtualLan(matchVlanId);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_VLAN);
+	}
+
+	// Match the VLAN priority
+	Byte matchVlanPriority = flowEntryObj.getMatchVlanPriority();
+	if (matchVlanPriority == null)
+	    matchVlanPriority = flowObj.getMatchVlanPriority();
+	if (matchVlanPriority != null) {
+	    match.setDataLayerVirtualLanPriorityCodePoint(matchVlanPriority);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_VLAN_PCP);
+	}
+
 	// Match the Source IPv4 Network prefix
 	String matchSrcIPv4Net = flowEntryObj.getMatchSrcIPv4Net();
 	if (matchSrcIPv4Net == null)
@@ -1578,22 +1699,40 @@
 	    match.setFromCIDR(matchDstIPv4Net, OFMatch.STR_NW_DST);
 	}
 
-	// Match the Source MAC address
-	String matchSrcMac = flowEntryObj.getMatchSrcMac();
-	if (matchSrcMac == null)
-	    matchSrcMac = flowObj.getMatchSrcMac();
-	if (matchSrcMac != null) {
-	    match.setDataLayerSource(matchSrcMac);
-	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_SRC);
+	// Match the IP protocol
+	Byte matchIpProto = flowEntryObj.getMatchIpProto();
+	if (matchIpProto == null)
+	    matchIpProto = flowObj.getMatchIpProto();
+	if (matchIpProto != null) {
+	    match.setNetworkTypeOfService(matchIpProto);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_NW_PROTO);
 	}
 
-	// Match the Destination MAC address
-	String matchDstMac = flowEntryObj.getMatchDstMac();
-	if (matchDstMac == null)
-	    matchDstMac = flowObj.getMatchDstMac();
-	if (matchDstMac != null) {
-	    match.setDataLayerDestination(matchDstMac);
-	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_DST);
+	// Match the IP ToS (DSCP field, 6 bits)
+	Byte matchIpToS = flowEntryObj.getMatchIpToS();
+	if (matchIpToS == null)
+	    matchIpToS = flowObj.getMatchIpToS();
+	if (matchIpToS != null) {
+	    match.setNetworkTypeOfService(matchIpToS);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_NW_TOS);
+	}
+
+	// Match the Source TCP/UDP port
+	Short matchSrcTcpUdpPort = flowEntryObj.getMatchSrcTcpUdpPort();
+	if (matchSrcTcpUdpPort == null)
+	    matchSrcTcpUdpPort = flowObj.getMatchSrcTcpUdpPort();
+	if (matchSrcTcpUdpPort != null) {
+	    match.setTransportSource(matchSrcTcpUdpPort);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_TP_SRC);
+	}
+
+	// Match the Destination TCP/UDP port
+	Short matchDstTcpUdpPort = flowEntryObj.getMatchDstTcpUdpPort();
+	if (matchDstTcpUdpPort == null)
+	    matchDstTcpUdpPort = flowObj.getMatchDstTcpUdpPort();
+	if (matchDstTcpUdpPort != null) {
+	    match.setTransportDestination(matchDstTcpUdpPort);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_TP_DST);
 	}
 
 	//
@@ -1712,6 +1851,26 @@
 	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_IN_PORT);
 	}
 
+	// Match the Source MAC address
+	MACAddress matchSrcMac = flowEntryMatch.srcMac();
+	if ((matchSrcMac == null) && (flowPathMatch != null)) {
+	    matchSrcMac = flowPathMatch.srcMac();
+	}
+	if (matchSrcMac != null) {
+	    match.setDataLayerSource(matchSrcMac.toString());
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_SRC);
+	}
+
+	// Match the Destination MAC address
+	MACAddress matchDstMac = flowEntryMatch.dstMac();
+	if ((matchDstMac == null) && (flowPathMatch != null)) {
+	    matchDstMac = flowPathMatch.dstMac();
+	}
+	if (matchDstMac != null) {
+	    match.setDataLayerDestination(matchDstMac.toString());
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_DST);
+	}
+
 	// Match the Ethernet Frame Type
 	Short matchEthernetFrameType = flowEntryMatch.ethernetFrameType();
 	if ((matchEthernetFrameType == null) && (flowPathMatch != null)) {
@@ -1722,6 +1881,26 @@
 	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_TYPE);
 	}
 
+	// Match the VLAN ID
+	Short matchVlanId = flowEntryMatch.vlanId();
+	if ((matchVlanId == null) && (flowPathMatch != null)) {
+	    matchVlanId = flowPathMatch.vlanId();
+	}
+	if (matchVlanId != null) {
+	    match.setDataLayerVirtualLan(matchVlanId);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_VLAN);
+	}
+
+	// Match the VLAN priority
+	Byte matchVlanPriority = flowEntryMatch.vlanPriority();
+	if ((matchVlanPriority == null) && (flowPathMatch != null)) {
+	    matchVlanPriority = flowPathMatch.vlanPriority();
+	}
+	if (matchVlanPriority != null) {
+	    match.setDataLayerVirtualLanPriorityCodePoint(matchVlanPriority);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_VLAN_PCP);
+	}
+
 	// Match the Source IPv4 Network prefix
 	IPv4Net matchSrcIPv4Net = flowEntryMatch.srcIPv4Net();
 	if ((matchSrcIPv4Net == null) && (flowPathMatch != null)) {
@@ -1740,24 +1919,44 @@
 	    match.setFromCIDR(matchDstIPv4Net.toString(), OFMatch.STR_NW_DST);
 	}
 
-	// Match the Source MAC address
-	MACAddress matchSrcMac = flowEntryMatch.srcMac();
-	if ((matchSrcMac == null) && (flowPathMatch != null)) {
-	    matchSrcMac = flowPathMatch.srcMac();
+	// Match the IP protocol
+	Byte matchIpProto = flowEntryMatch.ipProto();
+	if ((matchIpProto == null) && (flowPathMatch != null)) {
+	    matchIpProto = flowPathMatch.ipProto();
 	}
-	if (matchSrcMac != null) {
-	    match.setDataLayerSource(matchSrcMac.toString());
-	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_SRC);
+	if (matchIpProto != null) {
+	    match.setNetworkProtocol(matchIpProto);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_NW_PROTO);
 	}
 
-	// Match the Destination MAC address
-	MACAddress matchDstMac = flowEntryMatch.dstMac();
-	if ((matchDstMac == null) && (flowPathMatch != null)) {
-	    matchDstMac = flowPathMatch.dstMac();
+	// Match the IP ToS (DSCP field, 6 bits)
+	Byte matchIpToS = flowEntryMatch.ipToS();
+	if ((matchIpToS == null) && (flowPathMatch != null)) {
+	    matchIpToS = flowPathMatch.ipToS();
 	}
-	if (matchDstMac != null) {
-	    match.setDataLayerDestination(matchDstMac.toString());
-	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_DST);
+	if (matchIpToS != null) {
+	    match.setNetworkTypeOfService(matchIpToS);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_NW_TOS);
+	}
+
+	// Match the Source TCP/UDP port
+	Short matchSrcTcpUdpPort = flowEntryMatch.srcTcpUdpPort();
+	if ((matchSrcTcpUdpPort == null) && (flowPathMatch != null)) {
+	    matchSrcTcpUdpPort = flowPathMatch.srcTcpUdpPort();
+	}
+	if (matchSrcTcpUdpPort != null) {
+	    match.setTransportSource(matchSrcTcpUdpPort);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_TP_SRC);
+	}
+
+	// Match the Destination TCP/UDP port
+	Short matchDstTcpUdpPort = flowEntryMatch.dstTcpUdpPort();
+	if ((matchDstTcpUdpPort == null) && (flowPathMatch != null)) {
+	    matchDstTcpUdpPort = flowPathMatch.dstTcpUdpPort();
+	}
+	if (matchDstTcpUdpPort != null) {
+	    match.setTransportDestination(matchDstTcpUdpPort);
+	    match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_TP_DST);
 	}
 
 	//
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);
 
     	    //