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