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