sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 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 | package org.onosproject.net.device; |
| 17 | |
Laszlo Papp | 7cf6037 | 2018-01-11 00:06:43 +0000 | [diff] [blame] | 18 | import org.onosproject.net.Annotated; |
| 19 | import org.onosproject.net.Annotations; |
Andrea Campanella | c86154a | 2017-09-01 11:28:59 +0200 | [diff] [blame] | 20 | import org.onosproject.net.PortNumber; |
| 21 | |
Laszlo Papp | 7cf6037 | 2018-01-11 00:06:43 +0000 | [diff] [blame] | 22 | import static org.onosproject.net.DefaultAnnotations.EMPTY; |
| 23 | |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 24 | /** |
| 25 | * Statistics of a port. |
| 26 | */ |
Laszlo Papp | 7cf6037 | 2018-01-11 00:06:43 +0000 | [diff] [blame] | 27 | public interface PortStatistics extends Annotated { |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * Returns the port number. |
| 31 | * |
| 32 | * @return port number |
Andrea Campanella | c86154a | 2017-09-01 11:28:59 +0200 | [diff] [blame] | 33 | */ |
| 34 | PortNumber portNumber(); |
| 35 | |
| 36 | /** |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 37 | * Returns the number of packets received. |
| 38 | * |
| 39 | * @return the number of packets received |
| 40 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 41 | long packetsReceived(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 42 | |
| 43 | /** |
| 44 | * Returns the number of packets sent. |
| 45 | * |
| 46 | * @return the number of packets sent |
| 47 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 48 | long packetsSent(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * Returns the bytes received. |
| 52 | * |
| 53 | * @return the bytes received |
| 54 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 55 | long bytesReceived(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 56 | |
| 57 | /** |
| 58 | * Returns the bytes sent. |
| 59 | * |
| 60 | * @return the bytes sent |
| 61 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 62 | long bytesSent(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 63 | |
| 64 | /** |
| 65 | * Returns the number of packets dropped by RX. |
| 66 | * |
| 67 | * @return the number of packets dropped by RX |
| 68 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 69 | long packetsRxDropped(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 70 | |
| 71 | /** |
| 72 | * Returns the number of packets dropped by TX. |
| 73 | * |
| 74 | * @return the number of packets dropped by TX |
| 75 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 76 | long packetsTxDropped(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 77 | |
| 78 | /** |
| 79 | * Returns the number of transmit errors. |
| 80 | * |
| 81 | * @return the number of transmit errors |
| 82 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 83 | long packetsRxErrors(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 84 | |
| 85 | /** |
| 86 | * Returns the number of receive errors. |
| 87 | * |
| 88 | * @return the number of receive error |
| 89 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 90 | long packetsTxErrors(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 91 | |
| 92 | /** |
| 93 | * Returns the time port has been alive in seconds. |
| 94 | * |
| 95 | * @return the time port has been alive in seconds |
| 96 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 97 | long durationSec(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 98 | |
| 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 SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 104 | long durationNano(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 105 | |
Laszlo Papp | 7cf6037 | 2018-01-11 00:06:43 +0000 | [diff] [blame] | 106 | @Override |
| 107 | default Annotations annotations() { |
| 108 | return EMPTY; |
| 109 | } |
| 110 | |
Saurav Das | 59232cf | 2016-04-27 18:35:50 -0700 | [diff] [blame] | 111 | /** |
| 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 | |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 118 | } |