blob: 3b9f19ac945e35c3ee0ffd1751528aef7afd58a7 [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
Andrea Campanellac86154a2017-09-01 11:28:59 +020018import org.onosproject.net.PortNumber;
19
sangho538108b2015-04-08 14:29:20 -070020/**
21 * Statistics of a port.
22 */
23public interface PortStatistics {
24
25 /**
26 * Returns the port number.
27 *
28 * @return port number
Andrea Campanellac86154a2017-09-01 11:28:59 +020029 * @deprecated ONOS 1.12 Magpie please use portNumber()
sangho538108b2015-04-08 14:29:20 -070030 */
Andrea Campanellac86154a2017-09-01 11:28:59 +020031 @Deprecated
Sho SHIMIZU3310a342015-05-13 12:14:05 -070032 int port();
sangho538108b2015-04-08 14:29:20 -070033
34 /**
Andrea Campanellac86154a2017-09-01 11:28:59 +020035 * Returns the port number.
36 *
37 * @return port number
38 */
39 PortNumber portNumber();
40
41 /**
sangho538108b2015-04-08 14:29:20 -070042 * Returns the number of packets received.
43 *
44 * @return the number of packets received
45 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070046 long packetsReceived();
sangho538108b2015-04-08 14:29:20 -070047
48 /**
49 * Returns the number of packets sent.
50 *
51 * @return the number of packets sent
52 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070053 long packetsSent();
sangho538108b2015-04-08 14:29:20 -070054
55 /**
56 * Returns the bytes received.
57 *
58 * @return the bytes received
59 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070060 long bytesReceived();
sangho538108b2015-04-08 14:29:20 -070061
62 /**
63 * Returns the bytes sent.
64 *
65 * @return the bytes sent
66 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070067 long bytesSent();
sangho538108b2015-04-08 14:29:20 -070068
69 /**
70 * Returns the number of packets dropped by RX.
71 *
72 * @return the number of packets dropped by RX
73 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070074 long packetsRxDropped();
sangho538108b2015-04-08 14:29:20 -070075
76 /**
77 * Returns the number of packets dropped by TX.
78 *
79 * @return the number of packets dropped by TX
80 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070081 long packetsTxDropped();
sangho538108b2015-04-08 14:29:20 -070082
83 /**
84 * Returns the number of transmit errors.
85 *
86 * @return the number of transmit errors
87 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070088 long packetsRxErrors();
sangho538108b2015-04-08 14:29:20 -070089
90 /**
91 * Returns the number of receive errors.
92 *
93 * @return the number of receive error
94 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070095 long packetsTxErrors();
sangho538108b2015-04-08 14:29:20 -070096
97 /**
98 * Returns the time port has been alive in seconds.
99 *
100 * @return the time port has been alive in seconds
101 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700102 long durationSec();
sangho538108b2015-04-08 14:29:20 -0700103
104 /**
105 * Returns the time port has been alive in nano seconds.
106 *
107 * @return the time port has been alive in nano seconds
108 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700109 long durationNano();
sangho538108b2015-04-08 14:29:20 -0700110
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}