* 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/web/add_flow.py b/web/add_flow.py
index ec84744..f61e926 100755
--- a/web/add_flow.py
+++ b/web/add_flow.py
@@ -129,8 +129,9 @@
   my_dst_port = my_args[5]
 
   #
-  # Extract the "match" and "action" arguments
+  # Extract the "flowPathFlags", "match" and "action" arguments
   #
+  flowPathFlags = 0L
   match = {}
   matchInPortEnabled = True		# NOTE: Enabled by default
   actions = []
@@ -149,7 +150,12 @@
     arg2 = my_args[idx]
     idx = idx + 1
 
-    if arg1 == "matchInPort":
+    if arg1 == "flowPathFlags":
+      if "DISCARD_FIRST_HOP_ENTRY" in arg2:
+	flowPathFlags = flowPathFlags + 0x1
+      if "KEEP_ONLY_FIRST_HOP_ENTRY" in arg2:
+	flowPathFlags = flowPathFlags + 0x2
+    elif arg1 == "matchInPort":
       # Just mark whether inPort matching is enabled
       matchInPortEnabled = arg2 in ['True', 'true']
       # inPort = {}
@@ -302,6 +308,7 @@
     'my_src_port' : my_src_port,
     'my_dst_dpid' : my_dst_dpid,
     'my_dst_port' : my_dst_port,
+    'flowPathFlags' : flowPathFlags,
     'match' : match,
     'matchInPortEnabled' : matchInPortEnabled,
     'actions' : actions,
@@ -325,6 +332,7 @@
 
   my_flow_id = parsed_args['my_flow_id']
   my_installer_id = parsed_args['my_installer_id']
+  myFlowPathFlags = parsed_args['flowPathFlags']
   match = parsed_args['match']
   matchInPortEnabled = parsed_args['matchInPortEnabled']
   actions = parsed_args['actions']
@@ -335,10 +343,13 @@
   flow_id['value'] = my_flow_id
   installer_id = {}
   installer_id['value'] = my_installer_id
+  flowPathFlags = {}
+  flowPathFlags['flags'] = myFlowPathFlags
 
   flow_path = {}
   flow_path['flowId'] = flow_id
   flow_path['installerId'] = installer_id
+  flow_path['flowPathFlags'] = flowPathFlags
 
   if (len(match) > 0):
     flow_path['flowEntryMatch'] = copy.deepcopy(match)
@@ -461,7 +472,7 @@
 
 
 if __name__ == "__main__":
-  usage_msg = "Usage: %s [Flags] <flow-id> <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port> [Match Conditions] [Actions]\n" % (sys.argv[0])
+  usage_msg = "Usage: %s [Flags] <flow-id> <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port> [Flow Path Flags] [Match Conditions] [Actions]\n" % (sys.argv[0])
   usage_msg = usage_msg + "\n"
   usage_msg = usage_msg + "    Flags:\n"
   usage_msg = usage_msg + "        -m [monitorname]  Monitor and maintain the installed shortest path(s)\n"
@@ -472,6 +483,13 @@
   usage_msg = usage_msg + "        -f <filename>     Read the flow(s) to install from a file\n"
   usage_msg = usage_msg + "                          File format: one line per flow starting with <flow-id>\n"
   usage_msg = usage_msg + "\n"
+  usage_msg = usage_msg + "    Flow Path Flags:\n"
+  usage_msg = usage_msg + "        flowPathFlags <Flags> (flag names separated by ',')\n"
+  usage_msg = usage_msg + "\n"
+  usage_msg = usage_msg + "        Known flags:\n"
+  usage_msg = usage_msg + "            DISCARD_FIRST_HOP_ENTRY    : Discard the first-hop flow entry\n"
+  usage_msg = usage_msg + "            KEEP_ONLY_FIRST_HOP_ENTRY  : Keep only the first-hop flow entry\n"
+  usage_msg = usage_msg + "\n"
   usage_msg = usage_msg + "    Match Conditions:\n"
   usage_msg = usage_msg + "        matchInPort <True|False> (default to True)\n"
   usage_msg = usage_msg + "        matchSrcMac <source MAC address>\n"
diff --git a/web/get_flow.py b/web/get_flow.py
index 9e954fe..6599360 100755
--- a/web/get_flow.py
+++ b/web/get_flow.py
@@ -36,12 +36,23 @@
 def print_flow_path(parsedResult):
   flowId = parsedResult['flowId']['value']
   installerId = parsedResult['installerId']['value']
+  flowPathFlags = parsedResult['flowPathFlags']['flags']
   srcSwitch = parsedResult['dataPath']['srcPort']['dpid']['value']
   srcPort = parsedResult['dataPath']['srcPort']['port']['value']
   dstSwitch = parsedResult['dataPath']['dstPort']['dpid']['value']
   dstPort = parsedResult['dataPath']['dstPort']['port']['value']
 
-  print "FlowPath: (flowId = %s installerId = %s src = %s/%s dst = %s/%s)" % (flowId, installerId, srcSwitch, srcPort, dstSwitch, dstPort)
+  flowPathFlagsStr = ""
+  if (flowPathFlags & 0x1):
+    if flowPathFlagsStr:
+      flowPathFlagsStr += ","
+    flowPathFlagsStr += "DISCARD_FIRST_HOP_ENTRY"
+  if (flowPathFlags & 0x2):
+    if flowPathFlagsStr:
+      flowPathFlagsStr += ","
+    flowPathFlagsStr += "KEEP_ONLY_FIRST_HOP_ENTRY"
+
+  print "FlowPath: (flowId = %s installerId = %s flowPathFlags = 0x%x(%s) src = %s/%s dst = %s/%s)" % (flowId, installerId, flowPathFlags, flowPathFlagsStr, srcSwitch, srcPort, dstSwitch, dstPort)
   match = parsedResult['flowEntryMatch'];
   #
   # Print the common conditions
diff --git a/web/measurement_store_flow.py b/web/measurement_store_flow.py
index dda7fbd..8f6bd73 100755
--- a/web/measurement_store_flow.py
+++ b/web/measurement_store_flow.py
@@ -60,8 +60,9 @@
   my_dst_port = my_args[5]
 
   #
-  # Extract the "match" and "action" arguments
+  # Extract the "flowPathFlags", "match" and "action" arguments
   #
+  flowPathFlags = 0L
   match = {}
   matchInPortEnabled = True		# NOTE: Enabled by default
   actions = []
@@ -80,7 +81,12 @@
     arg2 = my_args[idx]
     idx = idx + 1
 
-    if arg1 == "matchInPort":
+    if arg1 == "flowPathFlags":
+      if "DISCARD_FIRST_HOP_ENTRY" in arg2:
+	flowPathFlags = flowPathFlags + 0x1
+      if "KEEP_ONLY_FIRST_HOP_ENTRY" in arg2:
+	flowPathFlags = flowPathFlags + 0x2
+    elif arg1 == "matchInPort":
       # Just mark whether inPort matching is enabled
       matchInPortEnabled = arg2 in ['True', 'true']
       # inPort = {}
@@ -233,6 +239,7 @@
     'my_src_port' : my_src_port,
     'my_dst_dpid' : my_dst_dpid,
     'my_dst_port' : my_dst_port,
+    'flowPathFlags' : flowPathFlags,
     'match' : match,
     'matchInPortEnabled' : matchInPortEnabled,
     'actions' : actions,
@@ -243,6 +250,7 @@
 
   my_flow_id = parsed_args['my_flow_id']
   my_installer_id = parsed_args['my_installer_id']
+  myFlowPathFlags = parsed_args['flowPathFlags']
   match = parsed_args['match']
   matchInPortEnabled = parsed_args['matchInPortEnabled']
   actions = parsed_args['actions']
@@ -253,10 +261,13 @@
   flow_id['value'] = my_flow_id
   installer_id = {}
   installer_id['value'] = my_installer_id
+  flowPathFlags = {}
+  flowPathFlags['flags'] = myFlowPathFlags
 
   flow_path = {}
   flow_path['flowId'] = flow_id
   flow_path['installerId'] = installer_id
+  flow_path['flowPathFlags'] = flowPathFlags
 
   if (len(match) > 0):
     flow_path['flowEntryMatch'] = copy.deepcopy(match)
@@ -346,12 +357,19 @@
 if __name__ == "__main__":
   usage_msg = "Store Flow Paths into ONOS for measurement purpose.\n"
   usage_msg = usage_msg + "\n"
-  usage_msg = usage_msg + "Usage: %s [Flags] <flow-id> <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port> [Match Conditions] [Actions]\n" % (sys.argv[0])
+  usage_msg = usage_msg + "Usage: %s [Flags] <flow-id> <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port> [Flow Path Flags] [Match Conditions] [Actions]\n" % (sys.argv[0])
   usage_msg = usage_msg + "\n"
   usage_msg = usage_msg + "    Flags:\n"
   usage_msg = usage_msg + "        -f <filename>     Read the flow(s) to install from a file\n"
   usage_msg = usage_msg + "                          File format: one line per flow starting with <flow-id>\n"
   usage_msg = usage_msg + "\n"
+  usage_msg = usage_msg + "    Flow Path Flags:\n"
+  usage_msg = usage_msg + "        flowPathFlags <Flags> (flag names separated by ',')\n"
+  usage_msg = usage_msg + "\n"
+  usage_msg = usage_msg + "        Known flags:\n"
+  usage_msg = usage_msg + "            DISCARD_FIRST_HOP_ENTRY    : Discard the first-hop flow entry\n"
+  usage_msg = usage_msg + "            KEEP_ONLY_FIRST_HOP_ENTRY  : Keep only the first-hop flow entry\n"
+  usage_msg = usage_msg + "\n"
   usage_msg = usage_msg + "    Match Conditions:\n"
   usage_msg = usage_msg + "        matchInPort <True|False> (default to True)\n"
   usage_msg = usage_msg + "        matchSrcMac <source MAC address>\n"
@@ -361,7 +379,6 @@
   usage_msg = usage_msg + "        matchVlanPriority <VLAN priority>\n"
   usage_msg = usage_msg + "        matchSrcIPv4Net <source IPv4 network address>\n"
   usage_msg = usage_msg + "        matchDstIPv4Net <destination IPv4 network address>\n"
-  usage_msg = usage_msg + "\n"
   usage_msg = usage_msg + "        matchIpProto <IP protocol>\n"
   usage_msg = usage_msg + "        matchIpToS <IP ToS (DSCP field, 6 bits)>\n"
   usage_msg = usage_msg + "        matchSrcTcpUdpPort <source TCP/UDP port>\n"