blob: f78768e1d0c2228c013070547ca6ee93229bd7a4 [file] [log] [blame]
sangho538108b2015-04-08 14:29:20 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
sangho538108b2015-04-08 14:29:20 -07003 *
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 */
16package org.onosproject.net.device;
17
Laszlo Papp7cf60372018-01-11 00:06:43 +000018import org.onosproject.net.Annotated;
19import org.onosproject.net.Annotations;
Andrea Campanellac86154a2017-09-01 11:28:59 +020020import org.onosproject.net.PortNumber;
21
Laszlo Papp7cf60372018-01-11 00:06:43 +000022import static org.onosproject.net.DefaultAnnotations.EMPTY;
23
sangho538108b2015-04-08 14:29:20 -070024/**
25 * Statistics of a port.
26 */
Laszlo Papp7cf60372018-01-11 00:06:43 +000027public interface PortStatistics extends Annotated {
sangho538108b2015-04-08 14:29:20 -070028
29 /**
30 * Returns the port number.
31 *
32 * @return port number
Andrea Campanellac86154a2017-09-01 11:28:59 +020033 * @deprecated ONOS 1.12 Magpie please use portNumber()
sangho538108b2015-04-08 14:29:20 -070034 */
Andrea Campanellac86154a2017-09-01 11:28:59 +020035 @Deprecated
Sho SHIMIZU3310a342015-05-13 12:14:05 -070036 int port();
sangho538108b2015-04-08 14:29:20 -070037
38 /**
Andrea Campanellac86154a2017-09-01 11:28:59 +020039 * Returns the port number.
40 *
41 * @return port number
42 */
43 PortNumber portNumber();
44
45 /**
sangho538108b2015-04-08 14:29:20 -070046 * Returns the number of packets received.
47 *
48 * @return the number of packets received
49 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070050 long packetsReceived();
sangho538108b2015-04-08 14:29:20 -070051
52 /**
53 * Returns the number of packets sent.
54 *
55 * @return the number of packets sent
56 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070057 long packetsSent();
sangho538108b2015-04-08 14:29:20 -070058
59 /**
60 * Returns the bytes received.
61 *
62 * @return the bytes received
63 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070064 long bytesReceived();
sangho538108b2015-04-08 14:29:20 -070065
66 /**
67 * Returns the bytes sent.
68 *
69 * @return the bytes sent
70 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070071 long bytesSent();
sangho538108b2015-04-08 14:29:20 -070072
73 /**
74 * Returns the number of packets dropped by RX.
75 *
76 * @return the number of packets dropped by RX
77 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070078 long packetsRxDropped();
sangho538108b2015-04-08 14:29:20 -070079
80 /**
81 * Returns the number of packets dropped by TX.
82 *
83 * @return the number of packets dropped by TX
84 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070085 long packetsTxDropped();
sangho538108b2015-04-08 14:29:20 -070086
87 /**
88 * Returns the number of transmit errors.
89 *
90 * @return the number of transmit errors
91 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070092 long packetsRxErrors();
sangho538108b2015-04-08 14:29:20 -070093
94 /**
95 * Returns the number of receive errors.
96 *
97 * @return the number of receive error
98 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070099 long packetsTxErrors();
sangho538108b2015-04-08 14:29:20 -0700100
101 /**
102 * Returns the time port has been alive in seconds.
103 *
104 * @return the time port has been alive in seconds
105 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700106 long durationSec();
sangho538108b2015-04-08 14:29:20 -0700107
108 /**
109 * Returns the time port has been alive in nano seconds.
110 *
111 * @return the time port has been alive in nano seconds
112 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700113 long durationNano();
sangho538108b2015-04-08 14:29:20 -0700114
Laszlo Papp7cf60372018-01-11 00:06:43 +0000115 @Override
116 default Annotations annotations() {
117 return EMPTY;
118 }
119
Saurav Das59232cf2016-04-27 18:35:50 -0700120 /**
121 * Returns true if all the port stats are zero, excluding TxErrors and RxErrors.
122 *
123 * @return boolean true if all port stats are zero
124 */
125 boolean isZero();
126
sangho538108b2015-04-08 14:29:20 -0700127}