blob: 0653832ca1bd838c1376466deaca545f14e6ac87 [file] [log] [blame]
Simon Hunt1911fe42017-05-02 18:25:58 -07001/*
2 * Copyright 2017-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18package org.onosproject.ui.impl.topo;
19
20import org.onosproject.ui.impl.TrafficMonitorBase;
21import org.onosproject.ui.impl.topo.util.ServicesBundle;
Simon Hunta7aea842017-05-03 19:42:50 -070022import org.onosproject.ui.impl.topo.util.TrafficLink;
23import org.onosproject.ui.topo.Highlights;
Simon Hunt1911fe42017-05-02 18:25:58 -070024import org.slf4j.Logger;
25import org.slf4j.LoggerFactory;
26
Simon Hunta7aea842017-05-03 19:42:50 -070027import java.util.Set;
28
Simon Hunt1911fe42017-05-02 18:25:58 -070029/**
30 * Encapsulates the behavior of monitoring specific traffic patterns in the
31 * Topology-2 view.
32 */
33public class Traffic2Monitor extends TrafficMonitorBase {
34
35 private static final Logger log =
36 LoggerFactory.getLogger(Traffic2Monitor.class);
37
Simon Hunta7aea842017-05-03 19:42:50 -070038 // link back to our message handler (for outbound messages)
Simon Hunt9e2413e2017-05-03 14:25:40 -070039 private final Topo2TrafficMessageHandler msgHandler;
40
Simon Hunt1911fe42017-05-02 18:25:58 -070041 /**
42 * Constructs a traffic monitor.
43 *
Simon Hunt9e2413e2017-05-03 14:25:40 -070044 * @param trafficPeriod traffic task period in ms
Simon Hunt1911fe42017-05-02 18:25:58 -070045 * @param servicesBundle bundle of services
Simon Hunt9e2413e2017-05-03 14:25:40 -070046 * @param msgHandler our message handler
Simon Hunt1911fe42017-05-02 18:25:58 -070047 */
Simon Hunt9e2413e2017-05-03 14:25:40 -070048 public Traffic2Monitor(long trafficPeriod, ServicesBundle servicesBundle,
49 Topo2TrafficMessageHandler msgHandler) {
Simon Hunt1911fe42017-05-02 18:25:58 -070050 super(trafficPeriod, servicesBundle);
Simon Hunt9e2413e2017-05-03 14:25:40 -070051 this.msgHandler = msgHandler;
Simon Hunt1911fe42017-05-02 18:25:58 -070052 }
53
54 @Override
55 protected void sendAllFlowTraffic() {
Simon Hunt9e2413e2017-05-03 14:25:40 -070056 log.debug("TOPO-2-TRAFFIC: sendAllFlowTraffic");
Simon Hunta7aea842017-05-03 19:42:50 -070057 Highlights h = trafficSummary(TrafficLink.StatsType.FLOW_STATS);
58
Simon Hunt1911fe42017-05-02 18:25:58 -070059 // TODO
60 }
61
62 @Override
63 protected void sendAllPortTrafficBits() {
Simon Hunt9e2413e2017-05-03 14:25:40 -070064 log.debug("TOPO-2-TRAFFIC: sendAllPortTrafficBits");
Simon Hunta7aea842017-05-03 19:42:50 -070065 Highlights h = trafficSummary(TrafficLink.StatsType.PORT_STATS);
66
Simon Hunt1911fe42017-05-02 18:25:58 -070067 // TODO
68 }
69
70 @Override
71 protected void sendAllPortTrafficPackets() {
Simon Hunt9e2413e2017-05-03 14:25:40 -070072 log.debug("TOPO-2-TRAFFIC: sendAllPortTrafficPackets");
Simon Hunta7aea842017-05-03 19:42:50 -070073 Highlights h = trafficSummary(TrafficLink.StatsType.PORT_PACKET_STATS);
74
Simon Hunt1911fe42017-05-02 18:25:58 -070075 // TODO
76 }
77
78 @Override
Simon Hunt1911fe42017-05-02 18:25:58 -070079 protected void sendClearHighlights() {
Simon Hunt9e2413e2017-05-03 14:25:40 -070080 log.debug("TOPO-2-TRAFFIC: sendClearHighlights");
Simon Hunta7aea842017-05-03 19:42:50 -070081 Highlights h = new Highlights();
82
Simon Hunt1911fe42017-05-02 18:25:58 -070083 // TODO
84 }
85
Simon Hunt9e2413e2017-05-03 14:25:40 -070086
87 // NOTE: currently this monitor holds no state - nothing to do for these...
88 @Override
89 protected void sendDeviceLinkFlows() {
90 }
91
92 @Override
93 protected void sendSelectedIntentTraffic() {
94 }
95
Simon Hunt1911fe42017-05-02 18:25:58 -070096 @Override
97 protected void clearSelection() {
Simon Hunt1911fe42017-05-02 18:25:58 -070098 }
Simon Hunta7aea842017-05-03 19:42:50 -070099
100 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
101 // -- link aggregation
102
103
104 @Override
105 protected Set<TrafficLink> doAggregation(Set<TrafficLink> linksWithTraffic) {
106 // TODO: figure out how to aggregate the link data...
107 log.debug("Need to aggregate {} links", linksWithTraffic.size());
108
109 return linksWithTraffic;
110 }
Simon Hunt1911fe42017-05-02 18:25:58 -0700111}