Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Laboratory |
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 | |
Pavlin Radoslavov | 33f228a | 2014-10-27 19:33:16 -0700 | [diff] [blame] | 18 | import org.onlab.packet.IpAddress; |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 19 | import org.onlab.packet.MacAddress; |
| 20 | import org.onlab.packet.VlanId; |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 21 | |
| 22 | import java.util.Set; |
| 23 | |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 24 | /** |
| 25 | * Abstraction of an end-station host on the network, essentially a NIC. |
| 26 | */ |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 27 | public interface Host extends Element { |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 28 | |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 29 | /** |
| 30 | * Host identification. |
| 31 | * |
| 32 | * @return host id |
| 33 | */ |
Ayaka Koshibe | 1c7b38e | 2014-09-11 13:09:51 -0700 | [diff] [blame] | 34 | @Override |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 35 | HostId id(); |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 36 | |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 37 | /** |
| 38 | * Returns the host MAC address. |
| 39 | * |
| 40 | * @return mac address |
| 41 | */ |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 42 | MacAddress mac(); |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 43 | |
| 44 | /** |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 45 | * Returns the VLAN ID tied to this host. |
| 46 | * |
| 47 | * @return VLAN ID value |
| 48 | */ |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 49 | VlanId vlan(); |
Ayaka Koshibe | 74a2392 | 2014-09-09 16:45:39 -0700 | [diff] [blame] | 50 | |
| 51 | /** |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 52 | * Returns set of IP addresses currently bound to the host MAC address. |
| 53 | * |
| 54 | * @return set of IP addresses; empty if no IP address is bound |
| 55 | */ |
Pavlin Radoslavov | 33f228a | 2014-10-27 19:33:16 -0700 | [diff] [blame] | 56 | Set<IpAddress> ipAddresses(); |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 57 | |
| 58 | /** |
| 59 | * Returns the most recent host location where the host attaches to the |
| 60 | * network edge. |
| 61 | * |
| 62 | * @return host location |
| 63 | */ |
| 64 | HostLocation location(); |
| 65 | |
sdn | 5e93545 | 2016-08-30 04:12:54 -0700 | [diff] [blame] | 66 | /** |
| 67 | * Returns true if configured by NetworkConfiguration. |
| 68 | * @return configured/learnt dynamically |
| 69 | */ |
| 70 | default boolean configured() { |
| 71 | return false; |
| 72 | } |
tom | 7869ad9 | 2014-09-09 14:32:08 -0700 | [diff] [blame] | 73 | // TODO: explore capturing list of recent locations to aid in mobility |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 74 | |
| 75 | } |
sdn | 5e93545 | 2016-08-30 04:12:54 -0700 | [diff] [blame] | 76 | |