blob: 3dd00fbb305338bf4cee519f3aa34ea24e71ccdd [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 */
34 PortNumber portNumber();
35
36 /**
sangho538108b2015-04-08 14:29:20 -070037 * Returns the number of packets received.
38 *
39 * @return the number of packets received
40 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070041 long packetsReceived();
sangho538108b2015-04-08 14:29:20 -070042
43 /**
44 * Returns the number of packets sent.
45 *
46 * @return the number of packets sent
47 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070048 long packetsSent();
sangho538108b2015-04-08 14:29:20 -070049
50 /**
51 * Returns the bytes received.
52 *
53 * @return the bytes received
54 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070055 long bytesReceived();
sangho538108b2015-04-08 14:29:20 -070056
57 /**
58 * Returns the bytes sent.
59 *
60 * @return the bytes sent
61 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070062 long bytesSent();
sangho538108b2015-04-08 14:29:20 -070063
64 /**
65 * Returns the number of packets dropped by RX.
66 *
67 * @return the number of packets dropped by RX
68 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070069 long packetsRxDropped();
sangho538108b2015-04-08 14:29:20 -070070
71 /**
72 * Returns the number of packets dropped by TX.
73 *
74 * @return the number of packets dropped by TX
75 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070076 long packetsTxDropped();
sangho538108b2015-04-08 14:29:20 -070077
78 /**
79 * Returns the number of transmit errors.
80 *
81 * @return the number of transmit errors
82 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070083 long packetsRxErrors();
sangho538108b2015-04-08 14:29:20 -070084
85 /**
86 * Returns the number of receive errors.
87 *
88 * @return the number of receive error
89 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070090 long packetsTxErrors();
sangho538108b2015-04-08 14:29:20 -070091
92 /**
93 * Returns the time port has been alive in seconds.
94 *
95 * @return the time port has been alive in seconds
96 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070097 long durationSec();
sangho538108b2015-04-08 14:29:20 -070098
99 /**
100 * Returns the time port has been alive in nano seconds.
101 *
102 * @return the time port has been alive in nano seconds
103 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700104 long durationNano();
sangho538108b2015-04-08 14:29:20 -0700105
Laszlo Papp7cf60372018-01-11 00:06:43 +0000106 @Override
107 default Annotations annotations() {
108 return EMPTY;
109 }
110
Saurav Das59232cf2016-04-27 18:35:50 -0700111 /**
112 * Returns true if all the port stats are zero, excluding TxErrors and RxErrors.
113 *
114 * @return boolean true if all port stats are zero
115 */
116 boolean isZero();
117
sangho538108b2015-04-08 14:29:20 -0700118}