Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Foundation |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.host; |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 17 | |
Yuta HIGUCHI | 5fa3dc0 | 2014-10-15 17:08:13 -0700 | [diff] [blame] | 18 | import java.util.Set; |
| 19 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 20 | import org.onosproject.net.Description; |
| 21 | import org.onosproject.net.HostLocation; |
Pavlin Radoslavov | 33f228a | 2014-10-27 19:33:16 -0700 | [diff] [blame] | 22 | import org.onlab.packet.IpAddress; |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 23 | import org.onlab.packet.MacAddress; |
| 24 | import org.onlab.packet.VlanId; |
Jonghwan Hyun | 2c95acf | 2018-03-14 16:47:34 -0700 | [diff] [blame] | 25 | import org.onlab.packet.EthType; |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 26 | |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 27 | /** |
| 28 | * Information describing host and its location. |
| 29 | */ |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 30 | public interface HostDescription extends Description { |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 31 | |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 32 | /** |
| 33 | * Returns the MAC address associated with this host (NIC). |
| 34 | * |
| 35 | * @return the MAC address of this host |
| 36 | */ |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 37 | MacAddress hwAddress(); |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * Returns the VLAN associated with this host. |
| 41 | * |
| 42 | * @return the VLAN ID value |
| 43 | */ |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 44 | VlanId vlan(); |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
Jonghwan Hyun | 2c95acf | 2018-03-14 16:47:34 -0700 | [diff] [blame] | 47 | * Returns the inner VLAN associated with this host. |
| 48 | * |
| 49 | * @return VLAN ID value; VlanId.NONE if only one VLAN ID is associated with this host |
| 50 | */ |
| 51 | default VlanId innerVlan() { |
| 52 | return VlanId.NONE; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Returns the TPID of the outermost VLAN associated with this host. |
| 57 | * |
| 58 | * @return TPID of the outermost VLAN header |
| 59 | */ |
| 60 | default EthType tpid() { |
| 61 | return EthType.EtherType.UNKNOWN.ethType(); |
| 62 | } |
| 63 | |
| 64 | /** |
Charles Chan | cd06c69 | 2017-04-27 20:46:06 -0700 | [diff] [blame] | 65 | * Returns the most recent location of the host on the network edge. |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 66 | * |
Charles Chan | cd06c69 | 2017-04-27 20:46:06 -0700 | [diff] [blame] | 67 | * @return the most recent host location |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 68 | */ |
| 69 | HostLocation location(); |
| 70 | |
| 71 | /** |
Charles Chan | cd06c69 | 2017-04-27 20:46:06 -0700 | [diff] [blame] | 72 | * Returns all locations of the host on the network edge. |
| 73 | * |
| 74 | * @return all host locations |
| 75 | */ |
| 76 | Set<HostLocation> locations(); |
| 77 | |
| 78 | /** |
tom | 093340b | 2014-10-10 00:15:36 -0700 | [diff] [blame] | 79 | * Returns the IP address associated with this host's MAC. |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 80 | * |
tom | 093340b | 2014-10-10 00:15:36 -0700 | [diff] [blame] | 81 | * @return host IP address |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 82 | */ |
Pavlin Radoslavov | 33f228a | 2014-10-27 19:33:16 -0700 | [diff] [blame] | 83 | Set<IpAddress> ipAddress(); |
sdn | 5e93545 | 2016-08-30 04:12:54 -0700 | [diff] [blame] | 84 | |
| 85 | /** |
| 86 | * Returns true if configured by NetworkConfiguration. |
| 87 | * @return configured/learnt dynamically |
| 88 | */ |
| 89 | default boolean configured() { |
| 90 | return false; |
| 91 | } |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 92 | } |