* Add FlowPathFlags to the FlowPath header.

* Implement DISCARD_FIRST_HOP_ENTRY and KEEP_ONLY_FIRST_HOP_ENTRY flags:
  - DISCARD_FIRST_HOP_ENTRY : After computing the shortest-path, the
    first-hop entry is discarded
  - KEEP_ONLY_FIRST_HOP_ENTRY : After computing the shortest-path,
    only the the first hop entry is kept, and the rest are discarded.
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 04f9384..2672a6b 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
@@ -200,6 +200,13 @@
 		@Property("installer_id")
 		public void setInstallerId(String installerId);
 
+		@JsonProperty("flowPathFlags")
+		@Property("flow_path_flags")
+		public Long getFlowPathFlags();
+
+		@Property("flow_path_flags")
+		public void setFlowPathFlags(Long flowPathFlags);
+
 		@JsonProperty("srcDpid")
 		@Property("src_switch")
 		public String getSrcSwitch();
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 ebef1f4..969d41e 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -48,6 +48,7 @@
 import net.onrc.onos.ofcontroller.util.FlowEntryUserState;
 import net.onrc.onos.ofcontroller.util.FlowId;
 import net.onrc.onos.ofcontroller.util.FlowPath;
+import net.onrc.onos.ofcontroller.util.FlowPathFlags;
 import net.onrc.onos.ofcontroller.util.IPv4Net;
 import net.onrc.onos.ofcontroller.util.Port;
 import net.onrc.onos.ofcontroller.util.SwitchPort;
@@ -330,9 +331,11 @@
 		    Short srcPortShort = flowPathObj.getSrcPort();
 		    String dstDpidStr = flowPathObj.getDstSwitch();
 		    Short dstPortShort = flowPathObj.getDstPort();
+		    Long flowPathFlagsLong = flowPathObj.getFlowPathFlags();
 		    if ((srcPortShort == null) ||
 			(dstDpidStr == null) ||
-			(dstPortShort == null)) {
+			(dstPortShort == null) ||
+			(flowPathFlagsLong == null)) {
 			continue;
 		    }
 
@@ -341,6 +344,7 @@
 		    Port dstPort = new Port(dstPortShort);
 		    SwitchPort srcSwitchPort = new SwitchPort(srcDpid, srcPort);
 		    SwitchPort dstSwitchPort = new SwitchPort(dstDpid, dstPort);
+		    FlowPathFlags flowPathFlags = new FlowPathFlags(flowPathFlagsLong);
 
 		    counterMyFlowPaths++;
 
@@ -363,6 +367,7 @@
 			dataPath.setSrcPort(srcSwitchPort);
 			dataPath.setDstPort(dstSwitchPort);
 		    }
+		    dataPath.applyFlowPathFlags(flowPathFlags);
 
 		    String newDataPathSummaryStr = dataPath.dataPathSummary();
 		    if (dataPathSummaryStr.equals(newDataPathSummaryStr))
@@ -568,6 +573,7 @@
 	//
 	// Set the Flow attributes:
 	// - flowPath.installerId()
+	// - flowPath.flowPathFlags()
 	// - flowPath.dataPath().srcPort()
 	// - flowPath.dataPath().dstPort()
 	// - flowPath.matchSrcMac()
@@ -583,6 +589,7 @@
 	// - flowPath.matchDstTcpUdpPort()
 	//
 	flowObj.setInstallerId(flowPath.installerId().toString());
+	flowObj.setFlowPathFlags(flowPath.flowPathFlags().flags());
 	flowObj.setSrcSwitch(flowPath.dataPath().srcPort().dpid().toString());
 	flowObj.setSrcPort(flowPath.dataPath().srcPort().port().value());
 	flowObj.setDstSwitch(flowPath.dataPath().dstPort().dpid().toString());
@@ -1314,6 +1321,7 @@
 	//
 	String flowIdStr = flowObj.getFlowId();
 	String installerIdStr = flowObj.getInstallerId();
+	Long flowPathFlags = flowObj.getFlowPathFlags();
 	String srcSwitchStr = flowObj.getSrcSwitch();
 	Short srcPortShort = flowObj.getSrcPort();
 	String dstSwitchStr = flowObj.getDstSwitch();
@@ -1321,6 +1329,7 @@
 
 	if ((flowIdStr == null) ||
 	    (installerIdStr == null) ||
+	    (flowPathFlags == null) ||
 	    (srcSwitchStr == null) ||
 	    (srcPortShort == null) ||
 	    (dstSwitchStr == null) ||
@@ -1332,6 +1341,7 @@
 	FlowPath flowPath = new FlowPath();
 	flowPath.setFlowId(new FlowId(flowIdStr));
 	flowPath.setInstallerId(new CallerId(installerIdStr));
+	flowPath.setFlowPathFlags(new FlowPathFlags(flowPathFlags));
 	flowPath.dataPath().srcPort().setDpid(new Dpid(srcSwitchStr));
 	flowPath.dataPath().srcPort().setPort(new Port(srcPortShort));
 	flowPath.dataPath().dstPort().setDpid(new Dpid(dstSwitchStr));
@@ -1505,6 +1515,7 @@
 	FlowPath computedFlowPath = new FlowPath();
 	computedFlowPath.setFlowId(new FlowId(flowPath.flowId().value()));
 	computedFlowPath.setInstallerId(new CallerId(flowPath.installerId().value()));
+	computedFlowPath.setFlowPathFlags(new FlowPathFlags(flowPath.flowPathFlags().flags()));
 	computedFlowPath.setDataPath(dataPath);
 	computedFlowPath.setFlowEntryMatch(new FlowEntryMatch(flowPath.flowEntryMatch()));
 
@@ -2107,6 +2118,7 @@
 	    dataPath.setSrcPort(flowPath.dataPath().srcPort());
 	    dataPath.setDstPort(flowPath.dataPath().dstPort());
 	}
+	dataPath.applyFlowPathFlags(flowPath.flowPathFlags());
 
 	//
 	// Set the incoming port matching and the outgoing port output
@@ -2135,6 +2147,7 @@
 	FlowPath computedFlowPath = new FlowPath();
 	computedFlowPath.setFlowId(new FlowId(flowPath.flowId().value()));
 	computedFlowPath.setInstallerId(new CallerId(flowPath.installerId().value()));
+	computedFlowPath.setFlowPathFlags(new FlowPathFlags(flowPath.flowPathFlags().flags()));
 	computedFlowPath.setDataPath(dataPath);
 	computedFlowPath.setFlowEntryMatch(new FlowEntryMatch(flowPath.flowEntryMatch()));
 
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java
index 9d2e0c9..2a75c6a 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java
@@ -53,10 +53,11 @@
 	if (flowPath != null) {
 	    FlowPath addedFlowPath =
 		flowService.addAndMaintainShortestPathFlow(flowPath);
-	    if (addedFlowPath == null)
+	    if (addedFlowPath == null) {
 		result = new FlowId();		// Error: Return empty Flow Id
-	    else
+	    } else {
 		result = addedFlowPath.flowId();
+	    }
 	}
 
         return result;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java b/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
index 5f96414..9b06743 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
@@ -76,6 +76,31 @@
     }
 
     /**
+     * Apply Flow Path Flags to the pre-computed Data Path.
+     *
+     * @param flowPathFlags the Flow Path Flags to apply.
+     */
+    public void applyFlowPathFlags(FlowPathFlags flowPathFlags) {
+	if (flowPathFlags == null)
+	    return;		// Nothing to do
+
+	// Discard the first Flow Entry
+	if (flowPathFlags.isDiscardFirstHopEntry()) {
+	    if (flowEntries.size() > 0)
+		flowEntries.remove(0);
+	}
+
+	// Keep only the first Flow Entry
+	if (flowPathFlags.isKeepOnlyFirstHopEntry()) {
+	    if (flowEntries.size() > 1) {
+		FlowEntry flowEntry = flowEntries.get(0);
+		flowEntries.clear();
+		flowEntries.add(flowEntry);
+	    }
+	}
+    }
+
+    /**
      * Get a string with the summary of the shortest-path data path
      * computation.
      *
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 4a8fc7b..2f4d421 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
@@ -5,6 +5,7 @@
 import net.floodlightcontroller.util.MACAddress;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.util.FlowPathFlags;
 
 import org.codehaus.jackson.annotate.JsonProperty;
 
@@ -14,6 +15,7 @@
 public class FlowPath implements Comparable<FlowPath> {
     private FlowId flowId;		// The Flow ID
     private CallerId installerId;	// The Caller ID of the path installer
+    private FlowPathFlags flowPathFlags; // The Flow Path flags
     private DataPath dataPath;		// The data path
     private FlowEntryMatch flowEntryMatch; // Common Flow Entry Match for all
 					// Flow Entries
@@ -22,6 +24,7 @@
      * Default constructor.
      */
     public FlowPath() {
+	flowPathFlags = new FlowPathFlags();
 	dataPath = new DataPath();
     }
 
@@ -32,6 +35,7 @@
     	dataPath = new DataPath();
     	this.setFlowId(new FlowId(flowObj.getFlowId()));
     	this.setInstallerId(new CallerId(flowObj.getInstallerId()));
+	this.setFlowPathFlags(new FlowPathFlags(flowObj.getFlowPathFlags()));
     	this.dataPath().srcPort().setDpid(new Dpid(flowObj.getSrcSwitch()));
     	this.dataPath().srcPort().setPort(new Port(flowObj.getSrcPort()));
     	this.dataPath().dstPort().setDpid(new Dpid(flowObj.getDstSwitch()));
@@ -190,6 +194,24 @@
     }
 
     /**
+     * Get the flow path flags.
+     *
+     * @return the flow path flags.
+     */
+    @JsonProperty("flowPathFlags")
+    public FlowPathFlags flowPathFlags() { return flowPathFlags; }
+
+    /**
+     * Set the flow path flags.
+     *
+     * @param flowPathFlags the flow path flags to set.
+     */
+    @JsonProperty("flowPathFlags")
+    public void setFlowPathFlags(FlowPathFlags flowPathFlags) {
+	this.flowPathFlags = flowPathFlags;
+    }
+
+    /**
      * Get the flow path's data path.
      *
      * @return the flow path's data path.
@@ -230,7 +252,7 @@
      * Convert the flow path to a string.
      *
      * The string has the following form:
-     *  [flowId=XXX installerId=XXX dataPath=XXX]
+     *  [flowId=XXX installerId=XXX flowPathFlags=XXX dataPath=XXX]
      *
      * @return the flow path as a string.
      */
@@ -238,6 +260,7 @@
     public String toString() {
 	String ret = "[flowId=" + this.flowId.toString();
 	ret += " installerId=" + this.installerId.toString();
+	ret += " flowPathFlags=" + this.flowPathFlags.toString();
 	if (dataPath != null)
 	    ret += " dataPath=" + this.dataPath.toString();
 	if (flowEntryMatch != null)
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java
new file mode 100644
index 0000000..63241f0
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java
@@ -0,0 +1,128 @@
+package net.onrc.onos.ofcontroller.util;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * The class representing the Flow Path flags.
+ */
+public class FlowPathFlags {
+    private long flags;
+
+    // Discard the first-hop Flow Entry
+    private final long DISCARD_FIRST_HOP_ENTRY		= (1 << 0);
+
+    // Keep only the first-hop Flow Entry
+    private final long KEEP_ONLY_FIRST_HOP_ENTRY	= (1 << 1);
+
+    /**
+     * Default constructor.
+     */
+    public FlowPathFlags() {
+	this.flags = 0;
+    }
+
+    /**
+     * Constructor for given flags.
+     *
+     * @param flags the flags value to set.
+     */
+    public FlowPathFlags(long flags) {
+	this.flags = flags;
+    }
+
+    /**
+     * Constructor for given flags as a string.
+     *
+     * The string value should contain the name of each flags to set. E.g.:
+     *  "DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY"
+     * @param flagsStr the string value of the flags to set.
+     */
+    public FlowPathFlags(String flagsStr) {
+	this.setFlagsStr(flagsStr);
+    }
+
+    /**
+     * Get the flags.
+     *
+     * @return the flags.
+     */
+    @JsonProperty("flags")
+    public long flags() { return flags; }
+
+    /**
+     * Set the flags.
+     *
+     * @param flags the flags value to set.
+     */
+    @JsonProperty("flags")
+    public void setFlags(long flags) {
+	this.flags = flags;
+    }
+
+    /**
+     * Set the flags as a string.
+     *
+     * The string value should contain the name of each flags to set. E.g.:
+     *  "DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY"
+     * @param flagsStr the string value of the flags to set.
+     */
+    @JsonProperty("flagsStr")
+    public void setFlagsStr(String flagsStr) {
+	this.flags = 0L;
+
+	// Test all flags
+	if (flagsStr.contains("DISCARD_FIRST_HOP_ENTRY"))
+	    this.flags |= DISCARD_FIRST_HOP_ENTRY;
+	if (flagsStr.contains("KEEP_ONLY_FIRST_HOP_ENTRY"))
+	    this.flags |= KEEP_ONLY_FIRST_HOP_ENTRY;
+    }
+
+    /**
+     * Test whether the DISCARD_FIRST_HOP_ENTRY flag is set.
+     *
+     * @return true if the DISCARD_FIRST_HOP_ENTRY flag is set,
+     * otherwise false.
+     */
+    public boolean isDiscardFirstHopEntry() {
+	return ((flags & DISCARD_FIRST_HOP_ENTRY) != 0);
+    }
+
+    /**
+     * Test whether the KEEP_ONLY_FIRST_HOP_ENTRY flag is set.
+     *
+     * @return true if the KEEP_ONLY_FIRST_HOP_ENTRY flag is set,
+     * otherwise false.
+     */
+    public boolean isKeepOnlyFirstHopEntry() {
+	return ((flags & KEEP_ONLY_FIRST_HOP_ENTRY) != 0);
+    }
+
+    /**
+     * Convert the Flow Path Flags to a string.
+     *
+     * The string has the following form:
+     *  [flags=DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY]
+     *
+     * @return the Flow Path flags as a string.
+     */
+    @Override
+    public String toString() {
+	String flagsStr = null;
+	String ret = "[flags=";
+
+	// Test all flags
+	if ((this.flags & DISCARD_FIRST_HOP_ENTRY) != 0) {
+	    if (flagsStr != null)
+		flagsStr += ",";
+	    flagsStr += "DISCARD_FIRST_HOP_ENTRY";
+	}
+	if ((this.flags & KEEP_ONLY_FIRST_HOP_ENTRY) != 0) {
+	    if (flagsStr != null)
+		flagsStr += ",";
+	    flagsStr += "KEEP_ONLY_FIRST_HOP_ENTRY";
+	}
+	ret += "]";
+
+	return ret;
+    }
+}