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