Fixed a few blemishes in the packet processor GUI view code.

Change-Id: I9e109b9d8432de52862809719284d627320d5d6f
diff --git a/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LLDPLinkProvider.java b/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LLDPLinkProvider.java
index 386d838..97c4d2f 100644
--- a/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LLDPLinkProvider.java
+++ b/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LLDPLinkProvider.java
@@ -67,6 +67,8 @@
 import static com.google.common.base.Strings.isNullOrEmpty;
 import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
 import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.onlab.packet.Ethernet.TYPE_BSN;
+import static org.onlab.packet.Ethernet.TYPE_LLDP;
 import static org.onlab.util.Tools.get;
 import static org.onlab.util.Tools.groupedThreads;
 import static org.onosproject.net.Link.Type.DIRECT;
@@ -326,10 +328,10 @@
      */
     private void requestIntercepts() {
         TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
-        selector.matchEthType(Ethernet.TYPE_LLDP);
+        selector.matchEthType(TYPE_LLDP);
         packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId);
 
-        selector.matchEthType(Ethernet.TYPE_BSN);
+        selector.matchEthType(TYPE_BSN);
         if (useBDDP) {
             packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId);
         } else {
@@ -342,9 +344,9 @@
      */
     private void withdrawIntercepts() {
         TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
-        selector.matchEthType(Ethernet.TYPE_LLDP);
+        selector.matchEthType(TYPE_LLDP);
         packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId);
-        selector.matchEthType(Ethernet.TYPE_BSN);
+        selector.matchEthType(TYPE_BSN);
         packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId);
     }
 
@@ -474,9 +476,15 @@
     private class InternalPacketProcessor implements PacketProcessor {
         @Override
         public void process(PacketContext context) {
-            if (context == null) {
+            if (context == null || context.isHandled()) {
                 return;
             }
+
+            Ethernet eth = context.inPacket().parsed();
+            if (eth == null || (eth.getEtherType() != TYPE_LLDP && eth.getEtherType() != TYPE_BSN)) {
+                return;
+            }
+
             LinkDiscovery ld = discoverers.get(context.inPacket().receivedFrom().deviceId());
             if (ld == null) {
                 return;
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/ProcessorViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/ProcessorViewMessageHandler.java
index 652116c..5d97504 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/ProcessorViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/ProcessorViewMessageHandler.java
@@ -40,6 +40,10 @@
     private static final String PROCESSOR_DATA_RESP = "processorDataResponse";
     private static final String PROCESSORS = "processors";
 
+    private static final String OBSERVER = "observer";
+    private static final String DIRECTOR = "director";
+    private static final String ADVISOR = "advisor";
+
     private static final String ID = "id";
     private static final String TYPE = "type";
     private static final String PRIORITY = "priority";
@@ -58,7 +62,7 @@
         return ImmutableSet.of(new ProcessorDataRequest());
     }
 
-    // handler for link table requests
+    // handler for packet processor table requests
     private final class ProcessorDataRequest extends TableRequestHandler {
         private ProcessorDataRequest() {
             super(PROCESSOR_DATA_REQ, PROCESSOR_DATA_RESP, PROCESSORS);
@@ -70,11 +74,6 @@
         }
 
         @Override
-        protected String defaultColumnId() {
-            return ID;
-        }
-
-        @Override
         protected TableModel createTableModel() {
             TableModel tm = super.createTableModel();
             tm.setFormatter(AVG_MS, new NumberFormatter());
@@ -93,12 +92,11 @@
                     .cell(PRIORITY, processorPriority(entry.priority()))
                     .cell(PROCESSOR, entry.processor().getClass().getName())
                     .cell(PACKETS, entry.invocations())
-                    .cell(AVG_MS, entry.averageNanos() / NANOS_IN_MS);
+                    .cell(AVG_MS, (double) entry.averageNanos() / NANOS_IN_MS);
         }
 
         private String processorType(int p) {
-            return p > DIRECTOR_MAX ? "observer" :
-                    p > ADVISOR_MAX ? "director" : "observer";
+            return p > DIRECTOR_MAX ? OBSERVER : p > ADVISOR_MAX ? DIRECTOR : ADVISOR;
         }
 
         private int processorPriority(int p) {
diff --git a/web/gui/src/main/webapp/app/view/processor/processor.css b/web/gui/src/main/webapp/app/view/processor/processor.css
index f4c22aa..12cf637 100644
--- a/web/gui/src/main/webapp/app/view/processor/processor.css
+++ b/web/gui/src/main/webapp/app/view/processor/processor.css
@@ -44,10 +44,6 @@
     text-align: right;
 }
 
-#ov-processor td.type {
-    text-align: center;
-}
-
 #ov-processor tr.no-data td {
     text-align: center;
 }
diff --git a/web/gui/src/main/webapp/app/view/processor/processor.html b/web/gui/src/main/webapp/app/view/processor/processor.html
index 24e126e..1c61504 100644
--- a/web/gui/src/main/webapp/app/view/processor/processor.html
+++ b/web/gui/src/main/webapp/app/view/processor/processor.html
@@ -16,7 +16,7 @@
                  icon icon-id="processorTable" icon-size="36"></div>
 
             <div class="active"
-                 icon icon-id="requestTable" icon-size="36"
+                 icon icon-id="requestTable" icon-size="36"git sta
                  tooltip tt-msg="requestTip"
                  ng-click="nav('request')"></div>
             -->
@@ -30,11 +30,11 @@
         <div class="table-header" onos-sortable-header>
             <table>
                 <tr>
-                    <td class="type" colId="type" sortable col-width="80px">Type </td>
                     <td class="number" colId="priority" sortable col-width="80px">Priority </td>
+                    <td colId="type" sortable col-width="80px">Type </td>
                     <td colId="processor" sortable col-width="500px">Class </td>
                     <td class="number"  colId="packets" sortable col-width="100px">Packets </td>
-                    <td class="number" colId="avgMillis" sortable col-width="80px">Average (ms) </td>
+                    <td class="number" colId="avgMillis" sortable col-width="100px">Average (ms) </td>
                 </tr>
             </table>
         </div>
@@ -49,8 +49,8 @@
 
                 <tr ng-repeat="processor in tableData track by $index"
                     ng-repeat-complete row-id="{{processor.id}}">
-                    <td class="type">{{processor.type}}</td>
                     <td class="number">{{processor.priority}}</td>
+                    <td>{{processor.type}}</td>
                     <td>{{processor.processor}}</td>
                     <td class="number">{{processor.packets}}</td>
                     <td class="number">{{processor.avgMillis}}</td>