fdb1e72b3f4ce9c7c1ccc147872409dd5b399060
[controller.git] / opendaylight / hosttracker / api / src / main / java / org / opendaylight / controller / hosttracker / IfIptoHost.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.hosttracker;
11
12 import java.net.InetAddress;
13 import java.util.List;
14 import java.util.Set;
15 import java.util.concurrent.Future;
16 import org.opendaylight.controller.sal.core.NodeConnector;
17 import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
18 import org.opendaylight.controller.sal.utils.Status;
19
20 /**
21  * This interface defines the methods to retrieve information about
22  * learned Hosts. Also provides methods to statically add/remove
23  * Hosts from the local database.
24  *
25  */
26
27 public interface IfIptoHost {
28     /**
29      * Applications call this interface methods to determine IP address to MAC binding and its
30      * connectivity to an OpenFlow switch in term of Node, Port, and VLAN. These
31      * bindings are learned dynamically as well as can be added statically through
32      * Northbound APIs. If a binding is unknown, then an ARP request is initiated
33      * immediately to discover the host.
34      *
35      * @param networkAddress    IP Address of the Host encapsulated in class InetAddress
36      * @return                  {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector}
37      *                                                  Class that contains the Host info such as its MAC address,
38      *                                                  Switch ID, port, VLAN. If Host is not found, returns NULL
39      */
40     public HostNodeConnector hostFind(InetAddress networkAddress);
41
42     /**
43      * Checks the local Host Database to see if a Host has been learned for a
44      * given IP address.
45      *
46      * @param networkAddress    IP Address of the Host encapsulated in class InetAddress
47      * @return                  {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector}
48      *                                                  Class that contains the Host info such as its MAC address,
49      *                                                  Switch ID, port, VLAN. If Host is not found, returns NULL
50      *
51      */
52     public HostNodeConnector hostQuery(InetAddress networkAddress);
53
54     /**
55      * Initiates an immediate discovery of the Host for a given IP address. This
56      * provides for the calling applications to block on the host discovery.
57      *
58      * @param networkAddress            IP address encapsulated in InetAddress class
59      * @return                      Future {@link org.opendaylight.controller.hosttracker.HostTrackerCallable}
60      */
61     public Future<HostNodeConnector> discoverHost(InetAddress networkAddress);
62
63     /**
64      * Returns the Network Hierarchy for a given Host. This API is typically used by
65      * applications like Hadoop for Rack Awareness functionality.
66      *
67      * @param                                   IP address of the Host encapsulated in InetAddress class
68      * @return                  List of String ArrayList containing the Hierarchies.
69      */
70     public List<List<String>> getHostNetworkHierarchy(InetAddress hostAddress);
71
72     /**
73      * Returns all the the Hosts either learned dynamically or added statically via
74      * Northbound APIs.
75      *
76      * @return                  Set of {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector}.
77      *                                                  Class that contains the Host info such as its MAC address,
78      *                                                  Switch ID, port, VLAN.
79      */
80     public Set<HostNodeConnector> getAllHosts();
81
82     /**
83      * Returns all the "Active Hosts" learned "Statically" via Northbound APIs. These Hosts
84      * are categorized as "Active" because the Switch and Port they are connected to, are in
85      * up state.
86      *
87      * @return                  Set of {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector}.
88      *                                                  Class that contains the Host info such as MAC address,
89      *                                                  Switch ID, port, VLAN. If Host is not found, returns NULL
90      */
91     public Set<HostNodeConnector> getActiveStaticHosts();
92
93     /**
94      * Returns all the "Inactive Hosts" learned "Statically" via Northbound APIs. These Hosts
95      * are categorized as "Inactive" because either the Switch or the Port they are connected
96      * to, is in down state.
97      *
98      * @return                  Set of HostNodeConnector {@link org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector}.
99      *                                                  HostNodeConnector is Class that
100      *                                                  contains the Host info such as its MAC address, OpenFlowNode
101      *                                                  ID, port, VLAN.
102      */
103     public Set<HostNodeConnector> getInactiveStaticHosts();
104
105     /**
106      * Hosts can be learned dynamically or added statically. This method allows the addition
107      * of a Host to the local database statically.
108      *
109      * @param networkAddress        IP Address of the Host
110      * @param dataLayerAddress      MAC Address of the Host
111      * @param nc                                    NodeConnector to which the host is attached
112      * @param vlan                  VLAN the host belongs to
113      * @return                      The status object as described in {@code Status}
114      *                                                          indicating the result of this action.
115      */
116     public Status addStaticHost(String networkAddress, String dataLayerAddress,
117                                 NodeConnector nc, String vlan);
118
119     /**
120      * Allows the deletion of statically learned Host
121      *
122      * @param networkAddress
123      * @return                      The status object as described in {@code Status}
124      *                                                          indicating the result of this action.
125      */
126     public Status removeStaticHost(String networkAddress);
127 }