Merge "Fix minor bug in FRM proactive flow code path"
[controller.git] / opendaylight / switchmanager / api / src / main / java / org / opendaylight / controller / switchmanager / ISwitchManager.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.switchmanager;
11
12 import java.net.InetAddress;
13 import java.util.List;
14 import java.util.Map;
15 import java.util.Set;
16
17 import org.opendaylight.controller.sal.core.Node;
18 import org.opendaylight.controller.sal.core.NodeConnector;
19 import org.opendaylight.controller.sal.core.Property;
20 import org.opendaylight.controller.sal.utils.Status;
21
22 /**
23  * Primary purpose of this interface is to provide methods for application to
24  * access various system resources and inventory data including nodes, node
25  * connectors and their properties, Layer3 configurations, Span configurations,
26  * node configurations, network device representations viewed by Controller Web
27  * applications.
28  */
29 public interface ISwitchManager {
30     /**
31      * Add a subnet configuration
32      *
33      * @param  configObject refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SubnetConfig}
34      * @return "Success" or failure reason
35      */
36     public Status addSubnet(SubnetConfig configObject);
37
38     /**
39      * Remove a subnet configuration
40      *
41      * @param  configObject refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SubnetConfig}
42      * @return "Success" or failure reason
43      */
44     public Status removeSubnet(SubnetConfig configObject);
45
46     /**
47      * Remove a subnet configuration given the name
48      *
49      * @param   name      subnet name
50      * @return  "Success" or failure reason
51      */
52     public Status removeSubnet(String name);
53
54     /**
55      * Return a list of all known devices in the system
56      *
57      * @return  returns a list of {@link org.opendaylight.controller.switchmanager.Switch}
58      */
59     public List<Switch> getNetworkDevices();
60
61     /**
62      * Return a list of subnet that were previously configured
63      *
64      * @return list of L3 interface {@link org.opendaylight.controller.switchmanager.SubnetConfig} configurations
65      */
66     public List<SubnetConfig> getSubnetsConfigList();
67
68     /**
69      * Return the subnet configuration
70      *
71      * @param   subnet      subnet
72      * @return a L3 interface {@link org.opendaylight.controller.switchmanager.SubnetConfig} configuration
73      */
74     public SubnetConfig getSubnetConfig(String subnet);
75
76     /**
77      * Return a subnet configuration given the network address
78      *
79      * @param networkAddress    the ip address in long format
80      * @return                                  the {@link org.opendaylight.controller.switchmanager.Subnet}
81      */
82     public Subnet getSubnetByNetworkAddress(InetAddress networkAddress);
83
84     /**
85      * Save the current switch configurations
86      *
87      * @return the status code
88      */
89     public Status saveSwitchConfig();
90
91     /**
92      * Add a span port configuration
93      *
94      * @param SpanConfig refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SpanConfig}
95      * @return              status code
96      */
97     public Status addSpanConfig(SpanConfig configObject);
98
99     /**
100      * Remove a span port configuration
101      *
102      * @param SpanConfig refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SpanConfig}
103      * @return              status code
104      */
105     public Status removeSpanConfig(SpanConfig cfgObject);
106
107     /**
108      * Return a list of span configurations that were configured previously
109      *
110      * @return list of {@link org.opendaylight.controller.switchmanager.SpanConfig} resources
111      */
112     public List<SpanConfig> getSpanConfigList();
113
114     /**
115      * Return the list of span ports of a given node
116      *
117      * @param node {@link org.opendaylight.controller.sal.core.Node}
118      * @return the list of span {@link org.opendaylight.controller.sal.core.NodeConnector} of the node
119      */
120     public List<NodeConnector> getSpanPorts(Node node);
121
122     /**
123      * Update Switch specific configuration such as Switch Name and Tier
124      *
125      * @param cfgConfig refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SwitchConfig}
126      *
127      * @deprecated replaced by updateNodeConfig(switchConfig)
128      */
129     @Deprecated
130     public void updateSwitchConfig(SwitchConfig cfgObject);
131
132     /**
133      * Update Node specific configuration such as Node Name and Tier
134      *
135      * @param cfgConfig
136      *            refer to {@link Open Declaration
137      *            org.opendaylight.controller.switchmanager.SwitchConfig}
138      * @return "Success" or failure reason
139      */
140     public Status updateNodeConfig(SwitchConfig switchConfig);
141
142     /**
143      * Removes node properties configured by the user
144      *
145      * @param nodeId
146      *            Node Identifier as specified by
147      *            {@link org.opendaylight.controller.sal.core.Node}
148      * @return "Success" or failure reason
149      */
150     public Status removeNodeConfig(String nodeId);
151
152     /**
153      * Return the previously configured Switch Configuration given the node id
154      *
155      * @param nodeId
156      *            Node Identifier as specified by
157      *            {@link org.opendaylight.controller.sal.core.Node}
158      * @return {@link org.opendaylight.controller.switchmanager.SwitchConfig}
159      *         resources
160      */
161     public SwitchConfig getSwitchConfig(String nodeId);
162
163     /**
164      * Add node connectors to a subnet
165      *
166      * @param name The subnet config name
167      * @param nodeConnectors nodePorts string specified by {@link Open Declaration org.opendaylight.controller.switchmanager.SubnetConfig}
168      * @return "Success" or failure reason
169      */
170     public Status addPortsToSubnet(String name, String nodeConnectors);
171
172     /**
173      * Remove node connectors from a subnet
174      *
175      * @param name              the subnet config name
176      * @param nodeConnectors    nodePorts string specified by {@link Open Declaration org.opendaylight.controller.switchmanager.SubnetConfig}
177      * @return "Success" or failure reason
178      */
179     public Status removePortsFromSubnet(String name, String nodeConnectors);
180
181     /**
182      * Return the set of all the nodes
183      *
184      * @return set of {@link org.opendaylight.controller.sal.core.Node}
185      */
186     public Set<Node> getNodes();
187
188     /**
189      * Return all the properties of a node
190      *
191      * @param node {@link org.opendaylight.controller.sal.core.Node}
192      * @return map of {@link org.opendaylight.controller.sal.core.Property} such as
193      *             {@link org.opendaylight.controller.sal.core.Description} and/or
194      *             {@link org.opendaylight.controller.sal.core.Tier} etc.
195      */
196     public Map<String, Property> getNodeProps(Node node);
197
198     /**
199      * Return a specific property of a node given the property name
200      *
201      * @param node              {@link org.opendaylight.controller.sal.core.Node}
202      * @param propName  the property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes
203      * @return {@link org.opendaylight.controller.sal.core.Property}
204      */
205     public Property getNodeProp(Node node, String propName);
206
207     /**
208      * Set a specific property of a node
209      *
210      * @param node              {@link org.opendaylight.controller.sal.core.Node}
211      * @param prop              {@link org.opendaylight.controller.sal.core.Property}
212      */
213     public void setNodeProp(Node node, Property prop);
214
215     /**
216      * Remove a property of a node
217      *
218      * @param nc                {@link org.opendaylight.controller.sal.core.Node}
219      * @param propName  the property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes
220      * @return success or failed reason
221      */
222     public Status removeNodeProp(Node node, String propName);
223
224     /**
225      * Remove all the properties of a node
226      *
227      * @param node {@link org.opendaylight.controller.sal.core.Node}
228      * @return success or failed reason
229      */
230     public Status removeNodeAllProps(Node node);
231
232     /**
233      * Return all the node connectors in up state for a given node
234      *
235      * @param node {@link org.opendaylight.controller.sal.core.Node}
236      * @return set of {@link org.opendaylight.controller.sal.core.NodeConnector}
237      */
238     public Set<NodeConnector> getUpNodeConnectors(Node node);
239
240     /**
241      * Return all the node connectors including those special ones. Status of each node connector varies.
242      *
243      * @param node {@link org.opendaylight.controller.sal.core.Node}
244      * @return all listed {@link org.opendaylight.controller.sal.core.NodeConnector}
245      */
246     public Set<NodeConnector> getNodeConnectors(Node node);
247
248     /**
249      * Return all the physical node connectors of a node. Status of each node connector varies.
250      *
251      * @param node {@link org.opendaylight.controller.sal.core.Node}
252      * @return all physical {@link org.opendaylight.controller.sal.core.NodeConnector}
253      */
254     public Set<NodeConnector> getPhysicalNodeConnectors(Node node);
255
256     /**
257      * Return all the properties of a node connector
258      *
259      * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector}
260      * @return map of {@link org.opendaylight.controller.sal.core.Property} such as
261      *             {@link org.opendaylight.controller.sal.core.Description} and/or
262      *             {@link org.opendaylight.controller.sal.core.State} etc.
263      */
264     public Map<String, Property> getNodeConnectorProps(
265             NodeConnector nodeConnector);
266
267     /**
268      * Return a specific property of a node connector given the property name
269      *
270      * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector}
271      * @param propName property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes
272      * @return {@link org.opendaylight.controller.sal.core.Property}
273      */
274     public Property getNodeConnectorProp(NodeConnector nodeConnector,
275             String propName);
276
277     /**
278      * Add a node connector and its property
279      *
280      * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector}
281      * @param prop {@link org.opendaylight.controller.sal.core.Property}
282      * @return success or failed reason
283      */
284     public Status addNodeConnectorProp(NodeConnector nodeConnector,
285             Property prop);
286
287     /**
288      * Remove a property of a node connector
289      *
290      * @param nc {@link org.opendaylight.controller.sal.core.NodeConnector}
291      * @param propName property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes
292      * @return success or failed reason
293      */
294     public Status removeNodeConnectorProp(NodeConnector nc, String propName);
295
296     /**
297      * Remove all the properties of a node connector
298      *
299      * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector}
300      * @return success or failed reason
301      */
302     public Status removeNodeConnectorAllProps(NodeConnector nodeConnector);
303
304     /**
305      * Return the node connector given its name
306      *
307      * @param node                              {@link org.opendaylight.controller.sal.core.Node}
308      * @param nodeConnectorName node connector identifier specified by {@link org.opendaylight.controller.sal.core.NodeConnector}
309      * @return {@link org.opendaylight.controller.sal.core.NodeConnector}
310      */
311     public NodeConnector getNodeConnector(Node node, String nodeConnectorName);
312
313     /**
314      * Return whether the specified node connector is a special node port
315      * Example of node's special node connector are software stack, hardware path, controller...
316      *
317      * @param p {@link org.opendaylight.controller.sal.core.NodeConnector}
318      * @return true or false
319      */
320     public boolean isSpecial(NodeConnector p);
321
322     /**
323      * Check if the node connector is up running
324      *
325      * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector}
326      * @return true or false
327      */
328     public Boolean isNodeConnectorEnabled(NodeConnector nodeConnector);
329
330     /**
331      * Return controller MAC address
332          *
333      * @return MAC address in byte array
334      */
335     public byte[] getControllerMAC();
336
337     /**
338      * Return MAC address for a given node
339      *
340      * @param node  {@link org.opendaylight.controller.sal.core.Node}
341      * @return MAC address in byte array
342      */
343     public byte[] getNodeMAC(Node node);
344
345     /**
346      * Return true if the host Refresh procedure (by sending ARP request probes
347      * to known hosts) is enabled. By default, the procedure is enabled. This can
348      * be overwritten by OSFI CLI "hostRefresh off".
349      *
350      * @return true if it is enabled; false if it's disabled.
351      */
352     public boolean isHostRefreshEnabled();
353
354     /**
355      * Return host refresh retry count
356      *
357      * @return host refresh retry count
358      */
359     public int getHostRetryCount();
360
361         /**
362          * Create a Name/Tier/Bandwidth Property object based on given property
363          * name and value. Other property types are not supported yet.
364          *
365      * @param propName Name of the Property specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes
366      * @param propValue Value of the Property specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes
367          * @return {@link org.opendaylight.controller.sal.core.Property}
368          */
369     public Property createProperty(String propName, String propValue);
370
371     /**
372      * Returns the description for the specified node. It is either the one
373      * configured by user or the description advertised by the node.
374      *
375      * @param node the network node identifier
376      * @return the description of the specified node. If no description is
377      * configured and the network node does not provide its description,
378      * an empty string is returned.
379      */
380     @Deprecated
381     public String getNodeDescription(Node node);
382 }