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 | * @deprecated ONOS 1.12 Magpie please use portNumber() |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 34 | */ |
Andrea Campanella | c86154a | 2017-09-01 11:28:59 +0200 | [diff] [blame] | 35 | @Deprecated |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 36 | int port(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 37 | |
| 38 | /** |
Andrea Campanella | c86154a | 2017-09-01 11:28:59 +0200 | [diff] [blame] | 39 | * Returns the port number. |
| 40 | * |
| 41 | * @return port number |
| 42 | */ |
| 43 | PortNumber portNumber(); |
| 44 | |
| 45 | /** |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 46 | * Returns the number of packets received. |
| 47 | * |
| 48 | * @return the number of packets received |
| 49 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 50 | long packetsReceived(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 51 | |
| 52 | /** |
| 53 | * Returns the number of packets sent. |
| 54 | * |
| 55 | * @return the number of packets sent |
| 56 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 57 | long packetsSent(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * Returns the bytes received. |
| 61 | * |
| 62 | * @return the bytes received |
| 63 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 64 | long bytesReceived(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 65 | |
| 66 | /** |
| 67 | * Returns the bytes sent. |
| 68 | * |
| 69 | * @return the bytes sent |
| 70 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 71 | long bytesSent(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 72 | |
| 73 | /** |
| 74 | * Returns the number of packets dropped by RX. |
| 75 | * |
| 76 | * @return the number of packets dropped by RX |
| 77 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 78 | long packetsRxDropped(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 79 | |
| 80 | /** |
| 81 | * Returns the number of packets dropped by TX. |
| 82 | * |
| 83 | * @return the number of packets dropped by TX |
| 84 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 85 | long packetsTxDropped(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 86 | |
| 87 | /** |
| 88 | * Returns the number of transmit errors. |
| 89 | * |
| 90 | * @return the number of transmit errors |
| 91 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 92 | long packetsRxErrors(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 93 | |
| 94 | /** |
| 95 | * Returns the number of receive errors. |
| 96 | * |
| 97 | * @return the number of receive error |
| 98 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 99 | long packetsTxErrors(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 100 | |
| 101 | /** |
| 102 | * Returns the time port has been alive in seconds. |
| 103 | * |
| 104 | * @return the time port has been alive in seconds |
| 105 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 106 | long durationSec(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 107 | |
| 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 SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 113 | long durationNano(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 114 | |
Laszlo Papp | 7cf6037 | 2018-01-11 00:06:43 +0000 | [diff] [blame] | 115 | @Override |
| 116 | default Annotations annotations() { |
| 117 | return EMPTY; |
| 118 | } |
| 119 | |
Saurav Das | 59232cf | 2016-04-27 18:35:50 -0700 | [diff] [blame] | 120 | /** |
| 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 | |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 127 | } |