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 | |
Andrea Campanella | c86154a | 2017-09-01 11:28:59 +0200 | [diff] [blame^] | 18 | import org.onosproject.net.PortNumber; |
| 19 | |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 20 | /** |
| 21 | * Statistics of a port. |
| 22 | */ |
| 23 | public interface PortStatistics { |
| 24 | |
| 25 | /** |
| 26 | * Returns the port number. |
| 27 | * |
| 28 | * @return port number |
Andrea Campanella | c86154a | 2017-09-01 11:28:59 +0200 | [diff] [blame^] | 29 | * @deprecated ONOS 1.12 Magpie please use portNumber() |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 30 | */ |
Andrea Campanella | c86154a | 2017-09-01 11:28:59 +0200 | [diff] [blame^] | 31 | @Deprecated |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 32 | int port(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 33 | |
| 34 | /** |
Andrea Campanella | c86154a | 2017-09-01 11:28:59 +0200 | [diff] [blame^] | 35 | * Returns the port number. |
| 36 | * |
| 37 | * @return port number |
| 38 | */ |
| 39 | PortNumber portNumber(); |
| 40 | |
| 41 | /** |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 42 | * Returns the number of packets received. |
| 43 | * |
| 44 | * @return the number of packets received |
| 45 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 46 | long packetsReceived(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * Returns the number of packets sent. |
| 50 | * |
| 51 | * @return the number of packets sent |
| 52 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 53 | long packetsSent(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 54 | |
| 55 | /** |
| 56 | * Returns the bytes received. |
| 57 | * |
| 58 | * @return the bytes received |
| 59 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 60 | long bytesReceived(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 61 | |
| 62 | /** |
| 63 | * Returns the bytes sent. |
| 64 | * |
| 65 | * @return the bytes sent |
| 66 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 67 | long bytesSent(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 68 | |
| 69 | /** |
| 70 | * Returns the number of packets dropped by RX. |
| 71 | * |
| 72 | * @return the number of packets dropped by RX |
| 73 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 74 | long packetsRxDropped(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 75 | |
| 76 | /** |
| 77 | * Returns the number of packets dropped by TX. |
| 78 | * |
| 79 | * @return the number of packets dropped by TX |
| 80 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 81 | long packetsTxDropped(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * Returns the number of transmit errors. |
| 85 | * |
| 86 | * @return the number of transmit errors |
| 87 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 88 | long packetsRxErrors(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * Returns the number of receive errors. |
| 92 | * |
| 93 | * @return the number of receive error |
| 94 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 95 | long packetsTxErrors(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 96 | |
| 97 | /** |
| 98 | * Returns the time port has been alive in seconds. |
| 99 | * |
| 100 | * @return the time port has been alive in seconds |
| 101 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 102 | long durationSec(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 103 | |
| 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 SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 109 | long durationNano(); |
sangho | 538108b | 2015-04-08 14:29:20 -0700 | [diff] [blame] | 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 | } |