* 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/web/add_flow.py b/web/add_flow.py
index 4f502f6..ec84744 100755
--- a/web/add_flow.py
+++ b/web/add_flow.py
@@ -166,21 +166,15 @@
       dstMac['value'] = arg2
       match['dstMac'] = dstMac
       # match['matchDstMac'] = True
+    elif arg1 == "matchEthernetFrameType":
+      match['ethernetFrameType'] = int(arg2, 0)
+      # match['matchEthernetFrameType'] = True
     elif arg1 == "matchVlanId":
       match['vlanId'] = int(arg2, 0)
       # match['matchVlanId'] = True
     elif arg1 == "matchVlanPriority":
       match['vlanPriority'] = int(arg2, 0)
       # match['matchVlanPriority'] = True
-    elif arg1 == "matchEthernetFrameType":
-      match['ethernetFrameType'] = int(arg2, 0)
-      # match['matchEthernetFrameType'] = True
-    elif arg1 == "matchIpToS":
-      match['ipToS'] = int(arg2, 0)
-      # match['matchIpToS'] = True
-    elif arg1 == "matchIpProto":
-      match['ipProto'] = int(arg2, 0)
-      # match['matchIpProto'] = True
     elif arg1 == "matchSrcIPv4Net":
       srcIPv4Net = {}
       srcIPv4Net['value'] = arg2
@@ -191,6 +185,12 @@
       dstIPv4Net['value'] = arg2
       match['dstIPv4Net'] = dstIPv4Net
       # match['matchDstIPv4Net'] = True
+    elif arg1 == "matchIpProto":
+      match['ipProto'] = int(arg2, 0)
+      # match['matchIpProto'] = True
+    elif arg1 == "matchIpToS":
+      match['ipToS'] = int(arg2, 0)
+      # match['matchIpToS'] = True
     elif arg1 == "matchSrcTcpUdpPort":
       match['srcTcpUdpPort'] = int(arg2, 0)
       # match['matchSrcTcpUdpPort'] = True
@@ -223,24 +223,6 @@
       action['actionSetVlanPriority'] = vlanPriority
       # action['actionType'] = 'ACTION_SET_VLAN_PCP'
       actions.append(copy.deepcopy(action))
-    elif arg1 == "actionSetIpToS":
-      ipToS = {}
-      ipToS['ipToS'] = int(arg2, 0)
-      action['actionSetIpToS'] = ipToS
-      # action['actionType'] = 'ACTION_SET_NW_TOS'
-      actions.append(copy.deepcopy(action))
-    elif arg1 == "actionSetTcpUdpSrcPort":
-      tcpUdpSrcPort = {}
-      tcpUdpSrcPort['port'] = int(arg2, 0)
-      action['actionSetTcpUdpSrcPort'] = tcpUdpSrcPort
-      # action['actionType'] = 'ACTION_SET_TP_SRC'
-      actions.append(copy.deepcopy(action))
-    elif arg1 == "actionSetTcpUdpDstPort":
-      tcpUdpDstPort = {}
-      tcpUdpDstPort['port'] = int(arg2, 0)
-      action['actionSetTcpUdpDstPort'] = tcpUdpDstPort
-      # action['actionType'] = 'ACTION_SET_TP_DST'
-      actions.append(copy.deepcopy(action))
     elif arg1 == "actionStripVlan":
       stripVlan = {}
       stripVlan['stripVlan'] = arg2 in ['True', 'true']
@@ -279,6 +261,24 @@
       action['actionSetIPv4DstAddr'] = setIPv4DstAddr
       # action['actionType'] = 'ACTION_SET_NW_DST'
       actions.append(copy.deepcopy(action))
+    elif arg1 == "actionSetIpToS":
+      ipToS = {}
+      ipToS['ipToS'] = int(arg2, 0)
+      action['actionSetIpToS'] = ipToS
+      # action['actionType'] = 'ACTION_SET_NW_TOS'
+      actions.append(copy.deepcopy(action))
+    elif arg1 == "actionSetTcpUdpSrcPort":
+      tcpUdpSrcPort = {}
+      tcpUdpSrcPort['port'] = int(arg2, 0)
+      action['actionSetTcpUdpSrcPort'] = tcpUdpSrcPort
+      # action['actionType'] = 'ACTION_SET_TP_SRC'
+      actions.append(copy.deepcopy(action))
+    elif arg1 == "actionSetTcpUdpDstPort":
+      tcpUdpDstPort = {}
+      tcpUdpDstPort['port'] = int(arg2, 0)
+      action['actionSetTcpUdpDstPort'] = tcpUdpDstPort
+      # action['actionType'] = 'ACTION_SET_TP_DST'
+      actions.append(copy.deepcopy(action))
     elif arg1 == "actionEnqueue":
       # TODO: Implement ACTION_ENQUEUE
       actionEnqueue = {}
@@ -476,15 +476,13 @@
   usage_msg = usage_msg + "        matchInPort <True|False> (default to True)\n"
   usage_msg = usage_msg + "        matchSrcMac <source MAC address>\n"
   usage_msg = usage_msg + "        matchDstMac <destination MAC address>\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 + "        matchEthernetFrameType <Ethernet frame type>\n"
-  usage_msg = usage_msg + "\n"
-  usage_msg = usage_msg + "    Match Conditions (not implemented yet):\n"
   usage_msg = usage_msg + "        matchVlanId <VLAN ID>\n"
   usage_msg = usage_msg + "        matchVlanPriority <VLAN priority>\n"
-  usage_msg = usage_msg + "        matchIpToS <IP ToS (DSCP field, 6 bits)>\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 + "        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"
   usage_msg = usage_msg + "        matchDstTcpUdpPort <destination TCP/UDP port>\n"
   usage_msg = usage_msg + "\n"
diff --git a/web/config.json b/web/config.json
new file mode 100644
index 0000000..04b2100
--- /dev/null
+++ b/web/config.json
@@ -0,0 +1,26 @@
+{
+    "LB": false, 
+    "TESTBED": "sw",
+    "ONOS_DEFAULT_HOST": "localhost",
+    "ONOS_GUI3_CONTROL_HOST": "http://localhost:8081", 
+    "ONOS_GUI3_HOST": "http://localhost:8080", 
+    "cluster_basename": "onosgui", 
+    "controllers": [
+        "onosgui1", 
+        "onosgui2", 
+        "onosgui3", 
+        "onosgui4", 
+        "onosgui5", 
+        "onosgui6", 
+        "onosgui7", 
+        "onosgui8"
+    ], 
+    "core_switches": [
+        "00:00:00:00:ba:5e:ba:11", 
+        "00:00:00:00:00:00:ba:12", 
+        "00:00:20:4e:7f:51:8a:35", 
+        "00:00:00:00:ba:5e:ba:13", 
+        "00:00:00:08:a2:08:f9:01", 
+        "00:00:00:16:97:08:9a:46"
+    ]
+}
diff --git a/web/get_flow.py b/web/get_flow.py
index 033176d..9e954fe 100755
--- a/web/get_flow.py
+++ b/web/get_flow.py
@@ -55,20 +55,20 @@
     matchSrcMac = match['matchSrcMac']
     dstMac = match['dstMac']
     matchDstMac = match['matchDstMac']
+    ethernetFrameType = match['ethernetFrameType']
+    matchEthernetFrameType = match['matchEthernetFrameType']
     vlanId = match['vlanId']
     matchVlanId = match['matchVlanId']
     vlanPriority = match['vlanPriority']
     matchVlanPriority = match['matchVlanPriority']
-    ethernetFrameType = match['ethernetFrameType']
-    matchEthernetFrameType = match['matchEthernetFrameType']
-    ipToS = match['ipToS']
-    matchIpToS = match['matchIpToS']
-    ipProto = match['ipProto']
-    matchIpProto = match['matchIpProto']
     srcIPv4Net = match['srcIPv4Net']
     matchSrcIPv4Net = match['matchSrcIPv4Net']
     dstIPv4Net = match['dstIPv4Net']
     matchDstIPv4Net = match['matchDstIPv4Net']
+    ipProto = match['ipProto']
+    matchIpProto = match['matchIpProto']
+    ipToS = match['ipToS']
+    matchIpToS = match['matchIpToS']
     srcTcpUdpPort = match['srcTcpUdpPort']
     matchSrcTcpUdpPort = match['matchSrcTcpUdpPort']
     dstTcpUdpPort = match['dstTcpUdpPort']
@@ -79,20 +79,20 @@
       print "    srcMac: %s" % srcMac['value']
     if matchDstMac == True:
       print "    dstMac: %s" % dstMac['value']
+    if matchEthernetFrameType == True:
+      print "    ethernetFrameType: %s" % hex(ethernetFrameType)
     if matchVlanId == True:
       print "    vlanId: %s" % vlanId
     if matchVlanPriority == True:
       print "    vlanPriority: %s" % vlanPriority
-    if matchEthernetFrameType == True:
-      print "    ethernetFrameType: %s" % hex(ethernetFrameType)
-    if matchIpToS == True:
-      print "    ipToS: %s" % ipToS
-    if matchIpProto == True:
-      print "    ipProto: %s" % ipProto
     if matchSrcIPv4Net == True:
       print "    srcIPv4Net: %s" % srcIPv4Net['value']
     if matchDstIPv4Net == True:
       print "    dstIPv4Net: %s" % dstIPv4Net['value']
+    if matchIpProto == True:
+      print "    ipProto: %s" % ipProto
+    if matchIpToS == True:
+      print "    ipToS: %s" % ipToS
     if matchSrcTcpUdpPort == True:
       print "    srcTcpUdpPort: %s" % srcTcpUdpPort
     if matchDstTcpUdpPort == True:
@@ -119,20 +119,20 @@
       matchSrcMac = match['matchSrcMac']
       dstMac = match['dstMac']
       matchDstMac = match['matchDstMac']
+      ethernetFrameType = match['ethernetFrameType']
+      matchEthernetFrameType = match['matchEthernetFrameType']
       vlanId = match['vlanId']
       matchVlanId = match['matchVlanId']
       vlanPriority = match['vlanPriority']
       matchVlanPriority = match['matchVlanPriority']
-      ethernetFrameType = match['ethernetFrameType']
-      matchEthernetFrameType = match['matchEthernetFrameType']
-      ipToS = match['ipToS']
-      matchIpToS = match['matchIpToS']
-      ipProto = match['ipProto']
-      matchIpProto = match['matchIpProto']
       srcIPv4Net = match['srcIPv4Net']
       matchSrcIPv4Net = match['matchSrcIPv4Net']
       dstIPv4Net = match['dstIPv4Net']
       matchDstIPv4Net = match['matchDstIPv4Net']
+      ipProto = match['ipProto']
+      matchIpProto = match['matchIpProto']
+      ipToS = match['ipToS']
+      matchIpToS = match['matchIpToS']
       srcTcpUdpPort = match['srcTcpUdpPort']
       matchSrcTcpUdpPort = match['matchSrcTcpUdpPort']
       dstTcpUdpPort = match['dstTcpUdpPort']
@@ -143,20 +143,20 @@
 	print "    srcMac: %s" % srcMac['value']
       if matchDstMac == True:
 	print "    dstMac: %s" % dstMac['value']
+      if matchEthernetFrameType == True:
+	print "    ethernetFrameType: %s" % hex(ethernetFrameType)
       if matchVlanId == True:
 	print "    vlanId: %s" % vlanId
       if matchVlanPriority == True:
 	print "    vlanPriority: %s" % vlanPriority
-      if matchEthernetFrameType == True:
-	print "    ethernetFrameType: %s" % hex(ethernetFrameType)
-      if matchIpToS == True:
-	print "    ipToS: %s" % ipToS
-      if matchIpProto == True:
-	print "    ipProto: %s" % ipProto
       if matchSrcIPv4Net == True:
 	print "    srcIPv4Net: %s" % srcIPv4Net['value']
       if matchDstIPv4Net == True:
 	print "    dstIPv4Net: %s" % dstIPv4Net['value']
+      if matchIpProto == True:
+	print "    ipProto: %s" % ipProto
+      if matchIpToS == True:
+	print "    ipToS: %s" % ipToS
       if matchSrcTcpUdpPort == True:
 	print "    srcTcpUdpPort: %s" % srcTcpUdpPort
       if matchDstTcpUdpPort == True:
diff --git a/web/measurement_store_flow.py b/web/measurement_store_flow.py
index 637ab3e..dda7fbd 100755
--- a/web/measurement_store_flow.py
+++ b/web/measurement_store_flow.py
@@ -97,21 +97,15 @@
       dstMac['value'] = arg2
       match['dstMac'] = dstMac
       # match['matchDstMac'] = True
+    elif arg1 == "matchEthernetFrameType":
+      match['ethernetFrameType'] = int(arg2, 0)
+      # match['matchEthernetFrameType'] = True
     elif arg1 == "matchVlanId":
       match['vlanId'] = int(arg2, 0)
       # match['matchVlanId'] = True
     elif arg1 == "matchVlanPriority":
       match['vlanPriority'] = int(arg2, 0)
       # match['matchVlanPriority'] = True
-    elif arg1 == "matchEthernetFrameType":
-      match['ethernetFrameType'] = int(arg2, 0)
-      # match['matchEthernetFrameType'] = True
-    elif arg1 == "matchIpToS":
-      match['ipToS'] = int(arg2, 0)
-      # match['matchIpToS'] = True
-    elif arg1 == "matchIpProto":
-      match['ipProto'] = int(arg2, 0)
-      # match['matchIpProto'] = True
     elif arg1 == "matchSrcIPv4Net":
       srcIPv4Net = {}
       srcIPv4Net['value'] = arg2
@@ -122,6 +116,12 @@
       dstIPv4Net['value'] = arg2
       match['dstIPv4Net'] = dstIPv4Net
       # match['matchDstIPv4Net'] = True
+    elif arg1 == "matchIpProto":
+      match['ipProto'] = int(arg2, 0)
+      # match['matchIpProto'] = True
+    elif arg1 == "matchIpToS":
+      match['ipToS'] = int(arg2, 0)
+      # match['matchIpToS'] = True
     elif arg1 == "matchSrcTcpUdpPort":
       match['srcTcpUdpPort'] = int(arg2, 0)
       # match['matchSrcTcpUdpPort'] = True
@@ -154,24 +154,6 @@
       action['actionSetVlanPriority'] = vlanPriority
       # action['actionType'] = 'ACTION_SET_VLAN_PCP'
       actions.append(copy.deepcopy(action))
-    elif arg1 == "actionSetIpToS":
-      ipToS = {}
-      ipToS['ipToS'] = int(arg2, 0)
-      action['actionSetIpToS'] = ipToS
-      # action['actionType'] = 'ACTION_SET_NW_TOS'
-      actions.append(copy.deepcopy(action))
-    elif arg1 == "actionSetTcpUdpSrcPort":
-      tcpUdpSrcPort = {}
-      tcpUdpSrcPort['port'] = int(arg2, 0)
-      action['actionSetTcpUdpSrcPort'] = tcpUdpSrcPort
-      # action['actionType'] = 'ACTION_SET_TP_SRC'
-      actions.append(copy.deepcopy(action))
-    elif arg1 == "actionSetTcpUdpDstPort":
-      tcpUdpDstPort = {}
-      tcpUdpDstPort['port'] = int(arg2, 0)
-      action['actionSetTcpUdpDstPort'] = tcpUdpDstPort
-      # action['actionType'] = 'ACTION_SET_TP_DST'
-      actions.append(copy.deepcopy(action))
     elif arg1 == "actionStripVlan":
       stripVlan = {}
       stripVlan['stripVlan'] = arg2 in ['True', 'true']
@@ -210,6 +192,24 @@
       action['actionSetIPv4DstAddr'] = setIPv4DstAddr
       # action['actionType'] = 'ACTION_SET_NW_DST'
       actions.append(copy.deepcopy(action))
+    elif arg1 == "actionSetIpToS":
+      ipToS = {}
+      ipToS['ipToS'] = int(arg2, 0)
+      action['actionSetIpToS'] = ipToS
+      # action['actionType'] = 'ACTION_SET_NW_TOS'
+      actions.append(copy.deepcopy(action))
+    elif arg1 == "actionSetTcpUdpSrcPort":
+      tcpUdpSrcPort = {}
+      tcpUdpSrcPort['port'] = int(arg2, 0)
+      action['actionSetTcpUdpSrcPort'] = tcpUdpSrcPort
+      # action['actionType'] = 'ACTION_SET_TP_SRC'
+      actions.append(copy.deepcopy(action))
+    elif arg1 == "actionSetTcpUdpDstPort":
+      tcpUdpDstPort = {}
+      tcpUdpDstPort['port'] = int(arg2, 0)
+      action['actionSetTcpUdpDstPort'] = tcpUdpDstPort
+      # action['actionType'] = 'ACTION_SET_TP_DST'
+      actions.append(copy.deepcopy(action))
     elif arg1 == "actionEnqueue":
       # TODO: Implement ACTION_ENQUEUE
       actionEnqueue = {}
@@ -356,15 +356,14 @@
   usage_msg = usage_msg + "        matchInPort <True|False> (default to True)\n"
   usage_msg = usage_msg + "        matchSrcMac <source MAC address>\n"
   usage_msg = usage_msg + "        matchDstMac <destination MAC address>\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 + "        matchEthernetFrameType <Ethernet frame type>\n"
-  usage_msg = usage_msg + "\n"
-  usage_msg = usage_msg + "    Match Conditions (not implemented yet):\n"
   usage_msg = usage_msg + "        matchVlanId <VLAN ID>\n"
   usage_msg = usage_msg + "        matchVlanPriority <VLAN priority>\n"
-  usage_msg = usage_msg + "        matchIpToS <IP ToS (DSCP field, 6 bits)>\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"
   usage_msg = usage_msg + "        matchDstTcpUdpPort <destination TCP/UDP port>\n"
   usage_msg = usage_msg + "\n"