Make sure invokeOperation is set once
[controller.git] / opendaylight / adsal / 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 the Status object representing the result of the request
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 the Status object representing the result of the request
43      */
44     public Status removeSubnet(SubnetConfig configObject);
45
46     /**
47      * Modify a subnet configuration
48      *
49      * @param  configObject refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SubnetConfig}
50      * @return the Status object representing the result of the request
51      */
52     public Status modifySubnet(SubnetConfig configObject);
53
54     /**
55      * Remove a subnet configuration given the name
56      *
57      * @param   name      subnet name
58      * @return  "Success" or failure reason
59      */
60     public Status removeSubnet(String name);
61
62     /**
63      * Return a list of all known devices in the system
64      *
65      * @return  returns a list of {@link org.opendaylight.controller.switchmanager.Switch}
66      */
67     public List<Switch> getNetworkDevices();
68
69     /**
70      * Return a Set of all configured devices that are not connected to the controller
71      *
72      * @return Set of {@link org.opendaylight.controller.switchmanager.Switch}
73      */
74     public Set<Switch> getConfiguredNotConnectedSwitches();
75
76     /**
77      * Return a list of subnet that were previously configured
78      *
79      * @return list of L3 interface {@link org.opendaylight.controller.switchmanager.SubnetConfig} configurations
80      */
81     public List<SubnetConfig> getSubnetsConfigList();
82
83     /**
84      * Return the subnet configuration
85      *
86      * @param   subnet      subnet
87      * @return a L3 interface {@link org.opendaylight.controller.switchmanager.SubnetConfig} configuration
88      */
89     public SubnetConfig getSubnetConfig(String subnet);
90
91     /**
92      * Return a subnet configuration given the network address
93      *
94      * @param networkAddress    the ip address in long format
95      * @return                                  the {@link org.opendaylight.controller.switchmanager.Subnet}
96      */
97     public Subnet getSubnetByNetworkAddress(InetAddress networkAddress);
98
99     /**
100      * Save the current switch configurations
101      *
102      * @return the status code
103      */
104     public Status saveSwitchConfig();
105
106     /**
107      * Add a span port configuration
108      *
109      * @param SpanConfig refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SpanConfig}
110      * @return              status code
111      */
112     public Status addSpanConfig(SpanConfig configObject);
113
114     /**
115      * Remove a span port configuration
116      *
117      * @param SpanConfig refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SpanConfig}
118      * @return              status code
119      */
120     public Status removeSpanConfig(SpanConfig cfgObject);
121
122     /**
123      * Return a list of span configurations that were configured previously
124      *
125      * @return list of {@link org.opendaylight.controller.switchmanager.SpanConfig} resources
126      */
127     public List<SpanConfig> getSpanConfigList();
128
129     /**
130      * Return the list of span ports of a given node
131      *
132      * @param node {@link org.opendaylight.controller.sal.core.Node}
133      * @return the list of span {@link org.opendaylight.controller.sal.core.NodeConnector} of the node
134      */
135     public List<NodeConnector> getSpanPorts(Node node);
136
137     /**
138      * Update Switch specific configuration such as Switch Name and Tier
139      *
140      * @param cfgConfig refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SwitchConfig}
141      *
142      * @deprecated replaced by updateNodeConfig(switchConfig)
143      */
144     @Deprecated
145     public void updateSwitchConfig(SwitchConfig cfgObject);
146
147     /**
148      * Update Node specific configuration such as Node Name and Tier
149      *
150      * @param cfgConfig
151      *            refer to {@link Open Declaration
152      *            org.opendaylight.controller.switchmanager.SwitchConfig}
153      * @return "Success" or failure reason
154      */
155     public Status updateNodeConfig(SwitchConfig switchConfig);
156
157     /**
158      * Removes node properties configured by the user
159      *
160      * @param nodeId
161      *            Node Identifier as specified by
162      *            {@link org.opendaylight.controller.sal.core.Node}
163      * @return "Success" or failure reason
164      */
165     public Status removeNodeConfig(String nodeId);
166
167     /**
168      * Return the previously configured Switch Configuration given the node id
169      *
170      * @param nodeId
171      *            Node Identifier as specified by
172      *            {@link org.opendaylight.controller.sal.core.Node}
173      * @return {@link org.opendaylight.controller.switchmanager.SwitchConfig}
174      *         resources
175      */
176     public SwitchConfig getSwitchConfig(String nodeId);
177
178     /**
179      * Add node connectors to a subnet
180      *
181      * @param name The configured subnet name
182      * @param nodeConnectors list of string each representing a node connector as specified by {@link Open Declaration org.opendaylight.controller.sal.core.NodeConnector}
183      * @return The Status object indicating the result of this request
184      */
185     public Status addPortsToSubnet(String name, List<String> nodeConnectors);
186
187     /**
188      * Remove node connectors from a subnet
189      *
190      * @param name              the configured subnet name
191      * @param nodeConnectors    list of string each representing a node connector as specified by {@link Open Declaration org.opendaylight.controller.sal.core.NodeConnector}
192      * @return The Status object indicating the result of this request
193      */
194     public Status removePortsFromSubnet(String name, List<String> nodeConnectors);
195
196     /**
197      * Return the set of all the nodes
198      *
199      * @return set of {@link org.opendaylight.controller.sal.core.Node}
200      */
201     public Set<Node> getNodes();
202
203     /**
204      * Return all the properties of a node
205      *
206      * @param node {@link org.opendaylight.controller.sal.core.Node}
207      * @return map of {@link org.opendaylight.controller.sal.core.Property} such as
208      *             {@link org.opendaylight.controller.sal.core.Description} and/or
209      *             {@link org.opendaylight.controller.sal.core.Tier} etc.
210      */
211     public Map<String, Property> getNodeProps(Node node);
212
213     /**
214      * Return a specific property of a node given the property name
215      *
216      * @param node              {@link org.opendaylight.controller.sal.core.Node}
217      * @param propName  the property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes
218      * @return {@link org.opendaylight.controller.sal.core.Property}
219      */
220     public Property getNodeProp(Node node, String propName);
221
222     /**
223      * Set a specific property of a node
224      *
225      * @param node              {@link org.opendaylight.controller.sal.core.Node}
226      * @param prop              {@link org.opendaylight.controller.sal.core.Property}
227      */
228     public void setNodeProp(Node node, Property prop);
229
230     /**
231      * Remove a property of a node
232      *
233      * @param nc                {@link org.opendaylight.controller.sal.core.Node}
234      * @param propName  the property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes
235      * @return success or failed reason
236      */
237     public Status removeNodeProp(Node node, String propName);
238
239     /**
240      * Remove all the properties of a node
241      *
242      * @param node {@link org.opendaylight.controller.sal.core.Node}
243      * @return success or failed reason
244      */
245     public Status removeNodeAllProps(Node node);
246
247     /**
248      * Return all the node connectors in up state for a given node
249      *
250      * @param node {@link org.opendaylight.controller.sal.core.Node}
251      * @return set of {@link org.opendaylight.controller.sal.core.NodeConnector}
252      */
253     public Set<NodeConnector> getUpNodeConnectors(Node node);
254
255     /**
256      * Return all the node connectors including those special ones. Status of each node connector varies.
257      *
258      * @param node {@link org.opendaylight.controller.sal.core.Node}
259      * @return all listed {@link org.opendaylight.controller.sal.core.NodeConnector}
260      */
261     public Set<NodeConnector> getNodeConnectors(Node node);
262
263     /**
264      * Return all the physical node connectors of a node. Status of each node connector varies.
265      *
266      * @param node {@link org.opendaylight.controller.sal.core.Node}
267      * @return all physical {@link org.opendaylight.controller.sal.core.NodeConnector}
268      */
269     public Set<NodeConnector> getPhysicalNodeConnectors(Node node);
270
271     /**
272      * Return all the properties of a node connector
273      *
274      * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector}
275      * @return map of {@link org.opendaylight.controller.sal.core.Property} such as
276      *             {@link org.opendaylight.controller.sal.core.Description} and/or
277      *             {@link org.opendaylight.controller.sal.core.State} etc.
278      */
279     public Map<String, Property> getNodeConnectorProps(
280             NodeConnector nodeConnector);
281
282     /**
283      * Return a specific property of a node connector given the property name
284      *
285      * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector}
286      * @param propName property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes
287      * @return {@link org.opendaylight.controller.sal.core.Property}
288      */
289     public Property getNodeConnectorProp(NodeConnector nodeConnector,
290             String propName);
291
292     /**
293      * Add a node connector and its property
294      *
295      * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector}
296      * @param prop {@link org.opendaylight.controller.sal.core.Property}
297      * @return success or failed reason
298      */
299     public Status addNodeConnectorProp(NodeConnector nodeConnector,
300             Property prop);
301
302     /**
303      * Remove a property of a node connector
304      *
305      * @param nc {@link org.opendaylight.controller.sal.core.NodeConnector}
306      * @param propName property name specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes
307      * @return success or failed reason
308      */
309     public Status removeNodeConnectorProp(NodeConnector nc, String propName);
310
311     /**
312      * Remove all the properties of a node connector
313      *
314      * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector}
315      * @return success or failed reason
316      */
317     public Status removeNodeConnectorAllProps(NodeConnector nodeConnector);
318
319     /**
320      * Return the node connector given its name
321      *
322      * @param node                              {@link org.opendaylight.controller.sal.core.Node}
323      * @param nodeConnectorName node connector identifier specified by {@link org.opendaylight.controller.sal.core.NodeConnector}
324      * @return {@link org.opendaylight.controller.sal.core.NodeConnector}
325      */
326     public NodeConnector getNodeConnector(Node node, String nodeConnectorName);
327
328     /**
329      * Return whether the specified node connector is a special node port
330      * Example of node's special node connector are software stack, hardware path, controller...
331      *
332      * @param p {@link org.opendaylight.controller.sal.core.NodeConnector}
333      * @return true or false
334      */
335     public boolean isSpecial(NodeConnector p);
336
337     /**
338      * Check if the node connector is up running
339      *
340      * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector}
341      * @return true or false
342      */
343     public Boolean isNodeConnectorEnabled(NodeConnector nodeConnector);
344
345     /**
346      * Test whether the given node connector exists.
347      *
348      * @param nc  {@link org.opendaylight.controller.sal.core.NodeConnector}
349      * @return    True if exists, false otherwise.
350      */
351     public boolean doesNodeConnectorExist(NodeConnector nc);
352
353     /**
354      * Return controller MAC address
355          *
356      * @return MAC address in byte array
357      */
358     public byte[] getControllerMAC();
359
360     /**
361      * Return MAC address for a given node
362      *
363      * @param node  {@link org.opendaylight.controller.sal.core.Node}
364      * @return MAC address in byte array
365      */
366     public byte[] getNodeMAC(Node node);
367
368     /**
369      * Create a Name/Tier/Bandwidth Property object based on given property name
370      * and value. Other property types are not supported yet.
371      *
372      * @param propName
373      *            Name of the Property specified by
374      *            {@link org.opendaylight.controller.sal.core.Property} and its
375      *            extended classes
376      * @param propValue
377      *            Value of the Property specified by
378      *            {@link org.opendaylight.controller.sal.core.Property} and its
379      *            extended classes
380      * @return {@link org.opendaylight.controller.sal.core.Property}
381      */
382     public Property createProperty(String propName, String propValue);
383
384     /**
385      * Returns the description for the specified node. It is either the one
386      * configured by user or the description advertised by the node.
387      *
388      * @param node the network node identifier
389      * @return the description of the specified node. If no description is
390      * configured and the network node does not provide its description,
391      * an empty string is returned.
392      */
393     @Deprecated
394     public String getNodeDescription(Node node);
395
396     /**
397      * Return all the properties of the controller
398      *
399      * @return map of {@link org.opendaylight.controller.sal.core.Property} such
400      *         as {@link org.opendaylight.controller.sal.core.Description}
401      *         and/or {@link org.opendaylight.controller.sal.core.Tier} etc.
402      */
403     public Map<String, Property> getControllerProperties();
404
405     /**
406      * Return a specific property of the controller given the property name
407      *
408      * @param propName
409      *            the property name specified by
410      *            {@link org.opendaylight.controller.sal.core.Property} and its
411      *            extended classes
412      * @return {@link org.opendaylight.controller.sal.core.Property}
413      */
414     public Property getControllerProperty(String propertyName);
415
416     /**
417      * Set a specific property of the controller
418      *
419      * @param property
420      *            {@link org.opendaylight.controller.sal.core.Property}
421      * @return
422      */
423     public Status setControllerProperty(Property property);
424
425     /**
426      * Remove a property of a node
427      *
428      * @param propertyName
429      *            the property name specified by
430      *            {@link org.opendaylight.controller.sal.core.Property} and its
431      *            extended classes
432      * @return success or failed reason
433      */
434     public Status removeControllerProperty(String propertyName);
435 }