3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
10 package org.opendaylight.controller.switchmanager;
12 import java.net.InetAddress;
13 import java.util.List;
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;
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;
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
35 public interface ISwitchManager {
37 * Add a subnet configuration
39 * @param configObject refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SubnetConfig}
40 * @return "Success" or failure reason
42 public Status addSubnet(SubnetConfig configObject);
45 * Remove a subnet configuration
47 * @param configObject refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SubnetConfig}
48 * @return "Success" or failure reason
50 public Status removeSubnet(SubnetConfig configObject);
53 * Remove a subnet configuration given the name
55 * @param name subnet name
56 * @return "Success" or failure reason
58 public Status removeSubnet(String name);
61 * Return a list of all known devices in the system
63 * @return returns a list of {@link org.opendaylight.controller.switchmanager.Switch}
65 public List<Switch> getNetworkDevices();
68 * Return a list of subnet that were previously configured
70 * @return list of L3 interface {@link org.opendaylight.controller.switchmanager.SubnetConfig} configurations
72 public List<SubnetConfig> getSubnetsConfigList();
75 * Return the subnet configuration
77 * @param subnet subnet
78 * @return a L3 interface {@link org.opendaylight.controller.switchmanager.SubnetConfig} configuration
80 public SubnetConfig getSubnetConfig(String subnet);
83 * Return a subnet configuration given the network address
85 * @param networkAddress the ip address in long format
86 * @return the {@link org.opendaylight.controller.switchmanager.Subnet}
88 public Subnet getSubnetByNetworkAddress(InetAddress networkAddress);
91 * Save the current switch configurations
93 * @return the status code
95 public Status saveSwitchConfig();
98 * Add a span port configuration
100 * @param SpanConfig refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SpanConfig}
101 * @return status code
103 public Status addSpanConfig(SpanConfig configObject);
106 * Remove a span port configuration
108 * @param SpanConfig refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SpanConfig}
109 * @return status code
111 public Status removeSpanConfig(SpanConfig cfgObject);
114 * Return a list of span configurations that were configured previously
116 * @return list of {@link org.opendaylight.controller.switchmanager.SpanConfig} resources
118 public List<SpanConfig> getSpanConfigList();
121 * Return the list of span ports of a given node
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
126 public List<NodeConnector> getSpanPorts(Node node);
129 * Update Switch specific configuration such as Switch Name and Tier
131 * @param cfgConfig refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SwitchConfig}
133 public void updateSwitchConfig(SwitchConfig cfgObject);
136 * Return the previously configured Switch Configuration given the node id
138 * @param nodeId Node Identifier as specified by {@link org.opendaylight.controller.sal.core.Node}
139 * @return {@link org.opendaylight.controller.switchmanager.SwitchConfig} resources
141 public SwitchConfig getSwitchConfig(String nodeId);
144 * Add node connectors to a subnet
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
150 public Status addPortsToSubnet(String name, String nodeConnectors);
153 * Remove node connectors from a subnet
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
159 public Status removePortsFromSubnet(String name, String nodeConnectors);
162 * Return the set of all the nodes
164 * @return set of {@link org.opendaylight.controller.sal.core.Node}
166 public Set<Node> getNodes();
169 * Return all the properties of a node
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.
176 public Map<String, Property> getNodeProps(Node node);
179 * Return a specific property of a node given the property name
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}
185 public Property getNodeProp(Node node, String propName);
188 * Set a specific property of a node
190 * @param node {@link org.opendaylight.controller.sal.core.Node}
191 * @param prop {@link org.opendaylight.controller.sal.core.Property}
193 public void setNodeProp(Node node, Property prop);
196 * Remove a property of a node
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
202 public Status removeNodeProp(Node node, String propName);
205 * Remove all the properties of a node
207 * @param node {@link org.opendaylight.controller.sal.core.Node}
208 * @return success or failed reason
210 public Status removeNodeAllProps(Node node);
213 * Return all the node connectors in up state for a given node
215 * @param node {@link org.opendaylight.controller.sal.core.Node}
216 * @return set of {@link org.opendaylight.controller.sal.core.NodeConnector}
218 public Set<NodeConnector> getUpNodeConnectors(Node node);
221 * Return all the node connectors including those special ones. Status of each node connector varies.
223 * @param node {@link org.opendaylight.controller.sal.core.Node}
224 * @return all listed {@link org.opendaylight.controller.sal.core.NodeConnector}
226 public Set<NodeConnector> getNodeConnectors(Node node);
229 * Return all the physical node connectors of a node. Status of each node connector varies.
231 * @param node {@link org.opendaylight.controller.sal.core.Node}
232 * @return all physical {@link org.opendaylight.controller.sal.core.NodeConnector}
234 public Set<NodeConnector> getPhysicalNodeConnectors(Node node);
237 * Return all the properties of a node connector
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.
244 public Map<String, Property> getNodeConnectorProps(
245 NodeConnector nodeConnector);
248 * Return a specific property of a node connector given the property name
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}
254 public Property getNodeConnectorProp(NodeConnector nodeConnector,
258 * Add a node connector and its property
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
264 public Status addNodeConnectorProp(NodeConnector nodeConnector,
268 * Remove a property of a node connector
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
274 public Status removeNodeConnectorProp(NodeConnector nc, String propName);
277 * Remove all the properties of a node connector
279 * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector}
280 * @return success or failed reason
282 public Status removeNodeConnectorAllProps(NodeConnector nodeConnector);
285 * Return the node connector given its name
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}
291 public NodeConnector getNodeConnector(Node node, String nodeConnectorName);
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...
297 * @param p {@link org.opendaylight.controller.sal.core.NodeConnector}
298 * @return true or false
300 public boolean isSpecial(NodeConnector p);
303 * Check if the node connector is up running
305 * @param nodeConnector {@link org.opendaylight.controller.sal.core.NodeConnector}
306 * @return true or false
308 public Boolean isNodeConnectorEnabled(NodeConnector nodeConnector);
311 * Return controller MAC address
313 * @return MAC address in byte array
315 public byte[] getControllerMAC();
318 * Return MAC address for a given node
320 * @param node {@link org.opendaylight.controller.sal.core.Node}
321 * @return MAC address in byte array
323 public byte[] getNodeMAC(Node node);
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".
330 * @return true if it is enabled; false if it's disabled.
332 public boolean isHostRefreshEnabled();
335 * Return host refresh retry count
337 * @return host refresh retry count
339 public int getHostRetryCount();
342 * Create a Name/Tier/Bandwidth Property object based on given property
343 * name and value. Other property types are not supported yet.
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}
349 public Property createProperty(String propName, String propValue);
352 * Returns the description for the specified node. It is either the one
353 * configured by user or the description advertised by the node.
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.
360 public String getNodeDescription(Node node);