Fixed a few blemishes in the packet processor GUI view code.
Change-Id: I9e109b9d8432de52862809719284d627320d5d6f
Showing
4 changed files
with
24 additions
and
22 deletions
... | @@ -67,6 +67,8 @@ import java.util.concurrent.ScheduledExecutorService; | ... | @@ -67,6 +67,8 @@ import java.util.concurrent.ScheduledExecutorService; |
67 | import static com.google.common.base.Strings.isNullOrEmpty; | 67 | import static com.google.common.base.Strings.isNullOrEmpty; |
68 | import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; | 68 | import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; |
69 | import static java.util.concurrent.TimeUnit.SECONDS; | 69 | import static java.util.concurrent.TimeUnit.SECONDS; |
70 | +import static org.onlab.packet.Ethernet.TYPE_BSN; | ||
71 | +import static org.onlab.packet.Ethernet.TYPE_LLDP; | ||
70 | import static org.onlab.util.Tools.get; | 72 | import static org.onlab.util.Tools.get; |
71 | import static org.onlab.util.Tools.groupedThreads; | 73 | import static org.onlab.util.Tools.groupedThreads; |
72 | import static org.onosproject.net.Link.Type.DIRECT; | 74 | import static org.onosproject.net.Link.Type.DIRECT; |
... | @@ -326,10 +328,10 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -326,10 +328,10 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
326 | */ | 328 | */ |
327 | private void requestIntercepts() { | 329 | private void requestIntercepts() { |
328 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); | 330 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); |
329 | - selector.matchEthType(Ethernet.TYPE_LLDP); | 331 | + selector.matchEthType(TYPE_LLDP); |
330 | packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId); | 332 | packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId); |
331 | 333 | ||
332 | - selector.matchEthType(Ethernet.TYPE_BSN); | 334 | + selector.matchEthType(TYPE_BSN); |
333 | if (useBDDP) { | 335 | if (useBDDP) { |
334 | packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId); | 336 | packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId); |
335 | } else { | 337 | } else { |
... | @@ -342,9 +344,9 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -342,9 +344,9 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
342 | */ | 344 | */ |
343 | private void withdrawIntercepts() { | 345 | private void withdrawIntercepts() { |
344 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); | 346 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); |
345 | - selector.matchEthType(Ethernet.TYPE_LLDP); | 347 | + selector.matchEthType(TYPE_LLDP); |
346 | packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId); | 348 | packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId); |
347 | - selector.matchEthType(Ethernet.TYPE_BSN); | 349 | + selector.matchEthType(TYPE_BSN); |
348 | packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId); | 350 | packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId); |
349 | } | 351 | } |
350 | 352 | ||
... | @@ -474,9 +476,15 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -474,9 +476,15 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider { |
474 | private class InternalPacketProcessor implements PacketProcessor { | 476 | private class InternalPacketProcessor implements PacketProcessor { |
475 | @Override | 477 | @Override |
476 | public void process(PacketContext context) { | 478 | public void process(PacketContext context) { |
477 | - if (context == null) { | 479 | + if (context == null || context.isHandled()) { |
478 | return; | 480 | return; |
479 | } | 481 | } |
482 | + | ||
483 | + Ethernet eth = context.inPacket().parsed(); | ||
484 | + if (eth == null || (eth.getEtherType() != TYPE_LLDP && eth.getEtherType() != TYPE_BSN)) { | ||
485 | + return; | ||
486 | + } | ||
487 | + | ||
480 | LinkDiscovery ld = discoverers.get(context.inPacket().receivedFrom().deviceId()); | 488 | LinkDiscovery ld = discoverers.get(context.inPacket().receivedFrom().deviceId()); |
481 | if (ld == null) { | 489 | if (ld == null) { |
482 | return; | 490 | return; | ... | ... |
... | @@ -40,6 +40,10 @@ public class ProcessorViewMessageHandler extends UiMessageHandler { | ... | @@ -40,6 +40,10 @@ public class ProcessorViewMessageHandler extends UiMessageHandler { |
40 | private static final String PROCESSOR_DATA_RESP = "processorDataResponse"; | 40 | private static final String PROCESSOR_DATA_RESP = "processorDataResponse"; |
41 | private static final String PROCESSORS = "processors"; | 41 | private static final String PROCESSORS = "processors"; |
42 | 42 | ||
43 | + private static final String OBSERVER = "observer"; | ||
44 | + private static final String DIRECTOR = "director"; | ||
45 | + private static final String ADVISOR = "advisor"; | ||
46 | + | ||
43 | private static final String ID = "id"; | 47 | private static final String ID = "id"; |
44 | private static final String TYPE = "type"; | 48 | private static final String TYPE = "type"; |
45 | private static final String PRIORITY = "priority"; | 49 | private static final String PRIORITY = "priority"; |
... | @@ -58,7 +62,7 @@ public class ProcessorViewMessageHandler extends UiMessageHandler { | ... | @@ -58,7 +62,7 @@ public class ProcessorViewMessageHandler extends UiMessageHandler { |
58 | return ImmutableSet.of(new ProcessorDataRequest()); | 62 | return ImmutableSet.of(new ProcessorDataRequest()); |
59 | } | 63 | } |
60 | 64 | ||
61 | - // handler for link table requests | 65 | + // handler for packet processor table requests |
62 | private final class ProcessorDataRequest extends TableRequestHandler { | 66 | private final class ProcessorDataRequest extends TableRequestHandler { |
63 | private ProcessorDataRequest() { | 67 | private ProcessorDataRequest() { |
64 | super(PROCESSOR_DATA_REQ, PROCESSOR_DATA_RESP, PROCESSORS); | 68 | super(PROCESSOR_DATA_REQ, PROCESSOR_DATA_RESP, PROCESSORS); |
... | @@ -70,11 +74,6 @@ public class ProcessorViewMessageHandler extends UiMessageHandler { | ... | @@ -70,11 +74,6 @@ public class ProcessorViewMessageHandler extends UiMessageHandler { |
70 | } | 74 | } |
71 | 75 | ||
72 | @Override | 76 | @Override |
73 | - protected String defaultColumnId() { | ||
74 | - return ID; | ||
75 | - } | ||
76 | - | ||
77 | - @Override | ||
78 | protected TableModel createTableModel() { | 77 | protected TableModel createTableModel() { |
79 | TableModel tm = super.createTableModel(); | 78 | TableModel tm = super.createTableModel(); |
80 | tm.setFormatter(AVG_MS, new NumberFormatter()); | 79 | tm.setFormatter(AVG_MS, new NumberFormatter()); |
... | @@ -93,12 +92,11 @@ public class ProcessorViewMessageHandler extends UiMessageHandler { | ... | @@ -93,12 +92,11 @@ public class ProcessorViewMessageHandler extends UiMessageHandler { |
93 | .cell(PRIORITY, processorPriority(entry.priority())) | 92 | .cell(PRIORITY, processorPriority(entry.priority())) |
94 | .cell(PROCESSOR, entry.processor().getClass().getName()) | 93 | .cell(PROCESSOR, entry.processor().getClass().getName()) |
95 | .cell(PACKETS, entry.invocations()) | 94 | .cell(PACKETS, entry.invocations()) |
96 | - .cell(AVG_MS, entry.averageNanos() / NANOS_IN_MS); | 95 | + .cell(AVG_MS, (double) entry.averageNanos() / NANOS_IN_MS); |
97 | } | 96 | } |
98 | 97 | ||
99 | private String processorType(int p) { | 98 | private String processorType(int p) { |
100 | - return p > DIRECTOR_MAX ? "observer" : | 99 | + return p > DIRECTOR_MAX ? OBSERVER : p > ADVISOR_MAX ? DIRECTOR : ADVISOR; |
101 | - p > ADVISOR_MAX ? "director" : "observer"; | ||
102 | } | 100 | } |
103 | 101 | ||
104 | private int processorPriority(int p) { | 102 | private int processorPriority(int p) { | ... | ... |
... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
16 | icon icon-id="processorTable" icon-size="36"></div> | 16 | icon icon-id="processorTable" icon-size="36"></div> |
17 | 17 | ||
18 | <div class="active" | 18 | <div class="active" |
19 | - icon icon-id="requestTable" icon-size="36" | 19 | + icon icon-id="requestTable" icon-size="36"git sta |
20 | tooltip tt-msg="requestTip" | 20 | tooltip tt-msg="requestTip" |
21 | ng-click="nav('request')"></div> | 21 | ng-click="nav('request')"></div> |
22 | --> | 22 | --> |
... | @@ -30,11 +30,11 @@ | ... | @@ -30,11 +30,11 @@ |
30 | <div class="table-header" onos-sortable-header> | 30 | <div class="table-header" onos-sortable-header> |
31 | <table> | 31 | <table> |
32 | <tr> | 32 | <tr> |
33 | - <td class="type" colId="type" sortable col-width="80px">Type </td> | ||
34 | <td class="number" colId="priority" sortable col-width="80px">Priority </td> | 33 | <td class="number" colId="priority" sortable col-width="80px">Priority </td> |
34 | + <td colId="type" sortable col-width="80px">Type </td> | ||
35 | <td colId="processor" sortable col-width="500px">Class </td> | 35 | <td colId="processor" sortable col-width="500px">Class </td> |
36 | <td class="number" colId="packets" sortable col-width="100px">Packets </td> | 36 | <td class="number" colId="packets" sortable col-width="100px">Packets </td> |
37 | - <td class="number" colId="avgMillis" sortable col-width="80px">Average (ms) </td> | 37 | + <td class="number" colId="avgMillis" sortable col-width="100px">Average (ms) </td> |
38 | </tr> | 38 | </tr> |
39 | </table> | 39 | </table> |
40 | </div> | 40 | </div> |
... | @@ -49,8 +49,8 @@ | ... | @@ -49,8 +49,8 @@ |
49 | 49 | ||
50 | <tr ng-repeat="processor in tableData track by $index" | 50 | <tr ng-repeat="processor in tableData track by $index" |
51 | ng-repeat-complete row-id="{{processor.id}}"> | 51 | ng-repeat-complete row-id="{{processor.id}}"> |
52 | - <td class="type">{{processor.type}}</td> | ||
53 | <td class="number">{{processor.priority}}</td> | 52 | <td class="number">{{processor.priority}}</td> |
53 | + <td>{{processor.type}}</td> | ||
54 | <td>{{processor.processor}}</td> | 54 | <td>{{processor.processor}}</td> |
55 | <td class="number">{{processor.packets}}</td> | 55 | <td class="number">{{processor.packets}}</td> |
56 | <td class="number">{{processor.avgMillis}}</td> | 56 | <td class="number">{{processor.avgMillis}}</td> | ... | ... |
-
Please register or login to post a comment