blob: f3dc7ab9067c000f4c4e145cccceda1dacf6ae3a [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2014-present Open Networking Foundation
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
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'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.host;
tom0eb04ca2014-08-25 14:34:51 -070017
Charles Chanff79dd92018-06-01 16:33:48 -070018import org.apache.commons.lang3.NotImplementedException;
samanwita palc40e5ed2015-09-24 11:01:51 -070019import org.onlab.packet.IpAddress;
Charles Chan35a32322017-08-14 11:42:11 -070020import org.onlab.packet.MacAddress;
Charles Chan47933752017-11-30 15:37:50 -080021import org.onosproject.net.ConnectPoint;
Brian O'Connorabafb502014-12-02 22:26:20 -080022import org.onosproject.net.HostId;
Charles Chan888e20a2017-05-01 15:44:23 -070023import org.onosproject.net.HostLocation;
Brian O'Connorabafb502014-12-02 22:26:20 -080024import org.onosproject.net.provider.ProviderService;
tom0eb04ca2014-08-25 14:34:51 -070025
26/**
27 * Means of conveying host information to the core.
28 */
tomd7356722014-08-26 01:07:39 -070029public interface HostProviderService extends ProviderService<HostProvider> {
tom0eb04ca2014-08-25 14:34:51 -070030
tome33cc1a2014-08-25 21:59:41 -070031 /**
32 * Notifies the core when a host has been detected on a network along with
Kedar Gupta47bd4802015-07-15 09:43:26 -070033 * information that identifies the host location.
tome33cc1a2014-08-25 21:59:41 -070034 *
tom7869ad92014-09-09 14:32:08 -070035 * @param hostId id of the host that been detected
tome33cc1a2014-08-25 21:59:41 -070036 * @param hostDescription description of host and its location
Brian O'Connorf107bd72015-09-21 15:31:03 -070037 * @param replaceIps replace IP set if true, merge IP set otherwise
38 */
39 void hostDetected(HostId hostId, HostDescription hostDescription, boolean replaceIps);
tom0eb04ca2014-08-25 14:34:51 -070040
tome33cc1a2014-08-25 21:59:41 -070041 /**
42 * Notifies the core when a host is no longer detected on a network.
43 *
tom7869ad92014-09-09 14:32:08 -070044 * @param hostId id of the host that vanished
tome33cc1a2014-08-25 21:59:41 -070045 */
tom7869ad92014-09-09 14:32:08 -070046 void hostVanished(HostId hostId);
tome33cc1a2014-08-25 21:59:41 -070047
samanwita palc40e5ed2015-09-24 11:01:51 -070048 /**
Brian O'Connor52515622015-10-09 17:03:44 -070049 * Notifies the core when an IP is no longer associated with a host.
samanwita palc40e5ed2015-09-24 11:01:51 -070050 *
Brian O'Connor52515622015-10-09 17:03:44 -070051 * @param hostId id of the host
52 * @param ipAddress ip address of host that vanished
samanwita palc40e5ed2015-09-24 11:01:51 -070053 */
54 void removeIpFromHost(HostId hostId, IpAddress ipAddress);
55
Charles Chan888e20a2017-05-01 15:44:23 -070056 /**
Charles Chanff79dd92018-06-01 16:33:48 -070057 * Notifies the core when a location is associated with a host.
58 *
59 * @param hostId id of the host
60 * @param location location of host that gets discovered
61 */
62 default void addLocationToHost(HostId hostId, HostLocation location) {
63 throw new NotImplementedException("addLocationToHost is not implemented");
64 }
65
66 /**
Charles Chan888e20a2017-05-01 15:44:23 -070067 * Notifies the core when a location is no longer associated with a host.
68 *
69 * @param hostId id of the host
70 * @param location location of host that vanished
71 */
72 void removeLocationFromHost(HostId hostId, HostLocation location);
Charles Chan35a32322017-08-14 11:42:11 -070073
74 /**
75 * Notifies HostProviderService the beginning of pending host location verification and
76 * retrieves the unique MAC address for the probe.
77 *
78 * @param hostId ID of the host
Charles Chan47933752017-11-30 15:37:50 -080079 * @param connectPoint the connect point that is under verification
80 * @param probeMode probe mode
Charles Chan35a32322017-08-14 11:42:11 -070081 * @return probeMac, the source MAC address ONOS uses to probe the host
Charles Chanff79dd92018-06-01 16:33:48 -070082 * @deprecated in ONOS 1.12, replaced by {@link HostProbingProviderService}
Charles Chan35a32322017-08-14 11:42:11 -070083 */
Charles Chanff79dd92018-06-01 16:33:48 -070084 @Deprecated
Charles Chan47933752017-11-30 15:37:50 -080085 default MacAddress addPendingHostLocation(HostId hostId, ConnectPoint connectPoint, ProbeMode probeMode) {
Charles Chan35a32322017-08-14 11:42:11 -070086 return MacAddress.NONE;
87 }
88
89 /**
90 * Notifies HostProviderService the end of pending host location verification.
91 *
92 * @param probeMac the source MAC address ONOS uses to probe the host
Charles Chanff79dd92018-06-01 16:33:48 -070093 * @deprecated in ONOS 1.12, replaced by {@link HostProbingProviderService}
Charles Chan35a32322017-08-14 11:42:11 -070094 */
Charles Chanff79dd92018-06-01 16:33:48 -070095 @Deprecated
Charles Chan35a32322017-08-14 11:42:11 -070096 default void removePendingHostLocation(MacAddress probeMac) {}
tom0eb04ca2014-08-25 14:34:51 -070097}