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; |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 17 | |
Jonghwan Hyun | 2c95acf | 2018-03-14 16:47:34 -0700 | [diff] [blame] | 18 | import org.onlab.packet.EthType; |
Pavlin Radoslavov | 33f228a | 2014-10-27 19:33:16 -0700 | [diff] [blame] | 19 | import org.onlab.packet.IpAddress; |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 20 | import org.onlab.packet.MacAddress; |
| 21 | import org.onlab.packet.VlanId; |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 22 | |
| 23 | import java.util.Set; |
| 24 | |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 25 | /** |
| 26 | * Abstraction of an end-station host on the network, essentially a NIC. |
| 27 | */ |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 28 | public interface Host extends Element { |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 29 | |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 30 | /** |
| 31 | * Host identification. |
| 32 | * |
| 33 | * @return host id |
| 34 | */ |
Ayaka Koshibe | 1c7b38e | 2014-09-11 13:09:51 -0700 | [diff] [blame] | 35 | @Override |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 36 | HostId id(); |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 37 | |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 38 | /** |
| 39 | * Returns the host MAC address. |
| 40 | * |
| 41 | * @return mac address |
| 42 | */ |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 43 | MacAddress mac(); |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 44 | |
| 45 | /** |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 46 | * Returns the VLAN ID tied to this host. |
| 47 | * |
| 48 | * @return VLAN ID value |
| 49 | */ |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 50 | VlanId vlan(); |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 51 | |
| 52 | /** |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 53 | * Returns set of IP addresses currently bound to the host MAC address. |
| 54 | * |
| 55 | * @return set of IP addresses; empty if no IP address is bound |
| 56 | */ |
Pavlin Radoslavov | 33f228a | 2014-10-27 19:33:16 -0700 | [diff] [blame] | 57 | Set<IpAddress> ipAddresses(); |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * Returns the most recent host location where the host attaches to the |
| 61 | * network edge. |
| 62 | * |
Charles Chan | cd06c69 | 2017-04-27 20:46:06 -0700 | [diff] [blame] | 63 | * @return the most recent host location |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 64 | */ |
| 65 | HostLocation location(); |
| 66 | |
sdn | 5e93545 | 2016-08-30 04:12:54 -0700 | [diff] [blame] | 67 | /** |
Charles Chan | 67a3855 | 2019-11-19 14:30:43 -0800 | [diff] [blame] | 68 | * Returns host locations where the host attaches to the network edge. |
Charles Chan | cd06c69 | 2017-04-27 20:46:06 -0700 | [diff] [blame] | 69 | * |
Charles Chan | 67a3855 | 2019-11-19 14:30:43 -0800 | [diff] [blame] | 70 | * @return host locations |
Charles Chan | cd06c69 | 2017-04-27 20:46:06 -0700 | [diff] [blame] | 71 | */ |
| 72 | Set<HostLocation> locations(); |
| 73 | |
| 74 | /** |
Charles Chan | 67a3855 | 2019-11-19 14:30:43 -0800 | [diff] [blame] | 75 | * Returns host auxiliary locations, which could be useful for app operations in addition to the attach points. |
| 76 | * |
| 77 | * @return auxiliary locations, or null if unspecified |
| 78 | */ |
| 79 | Set<HostLocation> auxLocations(); |
| 80 | |
| 81 | /** |
sdn | 5e93545 | 2016-08-30 04:12:54 -0700 | [diff] [blame] | 82 | * Returns true if configured by NetworkConfiguration. |
jobin | d19b714 | 2019-05-17 09:46:52 -0400 | [diff] [blame] | 83 | * |
sdn | 5e93545 | 2016-08-30 04:12:54 -0700 | [diff] [blame] | 84 | * @return configured/learnt dynamically |
| 85 | */ |
| 86 | default boolean configured() { |
| 87 | return false; |
| 88 | } |
Jonghwan Hyun | 2c95acf | 2018-03-14 16:47:34 -0700 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * Returns the inner VLAN ID tied to this host. |
| 92 | * |
| 93 | * @return VLAN ID value; VlanId.NONE if only one VLAN ID is tied to this host |
| 94 | */ |
| 95 | default VlanId innerVlan() { |
| 96 | return VlanId.NONE; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Returns the TPID of the outermost VLAN associated with this host. |
| 101 | * |
| 102 | * @return TPID of the outermost VLAN header |
| 103 | */ |
| 104 | default EthType tpid() { |
| 105 | return EthType.EtherType.UNKNOWN.ethType(); |
| 106 | } |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 107 | // TODO: explore capturing list of recent locations to aid in mobility |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 108 | |
jobin | d19b714 | 2019-05-17 09:46:52 -0400 | [diff] [blame] | 109 | /** |
| 110 | * Returns the state of host whether it is in suspended state(offending host due to frequent movement.). |
| 111 | * |
| 112 | * @return state true if suspended else false. |
| 113 | */ |
| 114 | boolean suspended(); |
| 115 | |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 116 | } |