Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 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 | |
Georgios Katsikas | 2ebd8a0 | 2018-06-27 18:32:50 +0200 | [diff] [blame] | 17 | package org.onosproject.drivers.server.devices.nic; |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 18 | |
| 19 | import org.onlab.packet.MacAddress; |
| 20 | |
| 21 | import static org.onosproject.net.Port.Type; |
| 22 | |
| 23 | /** |
| 24 | * Represents an abstraction of a |
Georgios Katsikas | 13ccba6 | 2020-03-18 12:05:03 +0100 | [diff] [blame^] | 25 | * network interface card (NIC) device. |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 26 | */ |
| 27 | public interface NicDevice extends Comparable { |
| 28 | |
| 29 | /** |
Georgios Katsikas | 13ccba6 | 2020-03-18 12:05:03 +0100 | [diff] [blame^] | 30 | * Maximum link speed in Mbps. |
| 31 | */ |
| 32 | static final long MAX_SPEED = 400000; |
| 33 | |
| 34 | /** |
Georgios Katsikas | 80e0b9f | 2018-07-21 20:29:18 +0200 | [diff] [blame] | 35 | * Returns the name of this NIC. |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 36 | * |
Georgios Katsikas | 80e0b9f | 2018-07-21 20:29:18 +0200 | [diff] [blame] | 37 | * @return NIC name |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 38 | */ |
Georgios Katsikas | 80e0b9f | 2018-07-21 20:29:18 +0200 | [diff] [blame] | 39 | String name(); |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 40 | |
| 41 | /** |
| 42 | * Returns the port number of this NIC. |
| 43 | * |
Georgios Katsikas | 80e0b9f | 2018-07-21 20:29:18 +0200 | [diff] [blame] | 44 | * @return NIC port number |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 45 | */ |
Georgios Katsikas | 80e0b9f | 2018-07-21 20:29:18 +0200 | [diff] [blame] | 46 | long portNumber(); |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * Returns the type of the port of this NIC. |
| 50 | * |
Georgios Katsikas | 80e0b9f | 2018-07-21 20:29:18 +0200 | [diff] [blame] | 51 | * @return NIC port type |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 52 | */ |
| 53 | Type portType(); |
| 54 | |
| 55 | /** |
| 56 | * Returns the speed of the NIC in Mbps. |
| 57 | * |
Georgios Katsikas | 80e0b9f | 2018-07-21 20:29:18 +0200 | [diff] [blame] | 58 | * @return NIC speed in Mbps |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 59 | */ |
| 60 | long speed(); |
| 61 | |
| 62 | /** |
| 63 | * Returns the current status of the NIC. |
| 64 | * |
Georgios Katsikas | 80e0b9f | 2018-07-21 20:29:18 +0200 | [diff] [blame] | 65 | * @return NIC status (up=true, down=false) |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 66 | */ |
| 67 | boolean status(); |
| 68 | |
| 69 | /** |
| 70 | * Sets the current status of the NIC. |
| 71 | * |
| 72 | * @param status boolean NIC status (up=true, down=false) |
| 73 | */ |
| 74 | void setStatus(boolean status); |
| 75 | |
| 76 | /** |
| 77 | * Returns the MAC address of the NIC. |
| 78 | * |
Georgios Katsikas | 80e0b9f | 2018-07-21 20:29:18 +0200 | [diff] [blame] | 79 | * @return hardware address of the NIC |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 80 | */ |
| 81 | MacAddress macAddress(); |
| 82 | |
| 83 | /** |
| 84 | * Returns the Rx filter mechanisms supported by the NIC. |
| 85 | * |
| 86 | * @return Rx filter mechanisms |
| 87 | */ |
| 88 | NicRxFilter rxFilterMechanisms(); |
| 89 | |
| 90 | /** |
| 91 | * Sets the Rx filter mechanisms supported by the NIC. |
| 92 | * |
| 93 | * @param rxFilterMechanisms Rx filter mechanisms |
| 94 | */ |
| 95 | void setRxFilterMechanisms(NicRxFilter rxFilterMechanisms); |
| 96 | |
| 97 | /** |
| 98 | * Adds a new Rx filter to the NIC. |
| 99 | * |
| 100 | * @param rxFilter an Rx filter to be added to the set |
| 101 | */ |
| 102 | void addRxFilterMechanism(NicRxFilter.RxFilter rxFilter); |
| 103 | |
| 104 | } |