blob: 511a5fb36d549c321e684d19b11fc104d5446caa [file] [log] [blame]
Georgios Katsikas83600982017-05-28 20:41:45 +02001/*
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 Katsikas2ebd8a02018-06-27 18:32:50 +020017package org.onosproject.drivers.server.devices.nic;
Georgios Katsikas83600982017-05-28 20:41:45 +020018
19import org.onlab.packet.MacAddress;
20
21import static org.onosproject.net.Port.Type;
22
23/**
24 * Represents an abstraction of a
Georgios Katsikas13ccba62020-03-18 12:05:03 +010025 * network interface card (NIC) device.
Georgios Katsikas83600982017-05-28 20:41:45 +020026 */
27public interface NicDevice extends Comparable {
28
29 /**
Georgios Katsikas13ccba62020-03-18 12:05:03 +010030 * Maximum link speed in Mbps.
31 */
32 static final long MAX_SPEED = 400000;
33
34 /**
Georgios Katsikas80e0b9f2018-07-21 20:29:18 +020035 * Returns the name of this NIC.
Georgios Katsikas83600982017-05-28 20:41:45 +020036 *
Georgios Katsikas80e0b9f2018-07-21 20:29:18 +020037 * @return NIC name
Georgios Katsikas83600982017-05-28 20:41:45 +020038 */
Georgios Katsikas80e0b9f2018-07-21 20:29:18 +020039 String name();
Georgios Katsikas83600982017-05-28 20:41:45 +020040
41 /**
42 * Returns the port number of this NIC.
43 *
Georgios Katsikas80e0b9f2018-07-21 20:29:18 +020044 * @return NIC port number
Georgios Katsikas83600982017-05-28 20:41:45 +020045 */
Georgios Katsikas80e0b9f2018-07-21 20:29:18 +020046 long portNumber();
Georgios Katsikas83600982017-05-28 20:41:45 +020047
48 /**
49 * Returns the type of the port of this NIC.
50 *
Georgios Katsikas80e0b9f2018-07-21 20:29:18 +020051 * @return NIC port type
Georgios Katsikas83600982017-05-28 20:41:45 +020052 */
53 Type portType();
54
55 /**
56 * Returns the speed of the NIC in Mbps.
57 *
Georgios Katsikas80e0b9f2018-07-21 20:29:18 +020058 * @return NIC speed in Mbps
Georgios Katsikas83600982017-05-28 20:41:45 +020059 */
60 long speed();
61
62 /**
63 * Returns the current status of the NIC.
64 *
Georgios Katsikas80e0b9f2018-07-21 20:29:18 +020065 * @return NIC status (up=true, down=false)
Georgios Katsikas83600982017-05-28 20:41:45 +020066 */
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 Katsikas80e0b9f2018-07-21 20:29:18 +020079 * @return hardware address of the NIC
Georgios Katsikas83600982017-05-28 20:41:45 +020080 */
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}