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.forwardingrulesmanager;
12 import java.util.List;
15 import org.opendaylight.controller.sal.core.Node;
16 import org.opendaylight.controller.sal.core.NodeConnector;
17 import org.opendaylight.controller.sal.utils.Status;
20 * Interface that describes methods for installing or removing forwarding rules
21 * and to access to the flows database.
24 public interface IForwardingRulesManager {
27 * It requests FRM to install the passed Flow Entry. FRM will request
28 * the SDN protocol plugin to install the flow on the network node.
29 * Based on the result of this operation FRM will update its database
30 * accordingly and will return the proper {@code Status} code.
32 * @param flow the flow entry to install
33 * @return the {@code Status} object indicating the result of this action.
35 public Status installFlowEntry(FlowEntry flow);
38 * It requests FRM to remove the passed Flow Entry. FRM will request
39 * the SDN protocol plugin to uninstall the flow from the network node.
40 * Based on the result of this operation FRM will update its database
41 * accordingly and will return the proper {@code Status} code.
43 * @param flow the flow entry to uninstall
44 * @return the {@code Status} object indicating the result of this action
46 public Status uninstallFlowEntry(FlowEntry flow);
49 * It requests FRM to replace the currently installed Flow Entry with the
50 * new one. It is up to the SDN protocol plugin to decide how to convey
51 * this message to the network node. It could be a delete + add or a single
52 * modify message depending on the SDN protocol specifications
53 * If the current flow is equal to the new one it will be a no op and
54 * success code is returned.
56 * @param current the current flow entry to modify
57 * @param newone the new flow entry which will replace the current one
58 * @return the {@code Status} object indicating the result of this action
60 public Status modifyFlowEntry(FlowEntry current, FlowEntry newone);
63 * It requests the FRM to replace the currently installed Flow Entry with
64 * the new one. The currently installed entry is derived by the Match
65 * portion of the passed Flow. FRM looks in its database for a previously
66 * installed FlowEntry which Match equals the Match of the passed Flow.
67 * If it finds it, it will request the SDN protocol plugin to replace the
68 * existing flow with the new one on the network node. If it does not
69 * find it, it will request plugin to add the new flow. If the passed entry
70 * is not valid an error code is returned.
71 * If the existing flow is equal to the passed one it will be a no op and
72 * success code is returned.
74 * @param newone the new flow entry to install
75 * @return the {@code Status} object indicating the result of this action
77 public Status modifyOrAddFlowEntry(FlowEntry newone);
80 * Check whether the passed flow entry conflicts with the Container flows
82 * @param flow the flow entry to test
83 * @return true if conflicts, false otherwise
85 public boolean checkFlowEntryConflict(FlowEntry flow);
88 * Returns the list of Flow entries across network nodes which are part of the
89 * same flow group, policy
91 * @param group the group name
92 * @return the list of flow entries belonging to the specified group
94 public List<FlowEntry> getFlowEntriesForGroup(String group);
97 * Add a list of output port to the flow with the specified name on the specified network node
99 * @param node the network node
100 * @param flowName the flow name
101 * @param dstPort the list of ports to be added to the flow output actions
103 public void addOutputPort(Node node, String flowName,
104 List<NodeConnector> dstPort);
107 * Remove a list of output port from the flow with the specified name on the specified network node
109 * @param node the network node
110 * @param flowName the flow name
111 * @param dstPortthe list of ports to be removed from the flow output actions
113 public void removeOutputPort(Node node, String flowName,
114 List<NodeConnector> dstPort);
117 * Replace the current output port in the specified flow with the specified one
119 * @param node the network node
120 * @param groupName the group name
121 * @param flowName the flow name
122 * @param dstPort the new output action port
124 public void replaceOutputPort(Node node, String flowName,
125 NodeConnector outPort);
128 * Returns the output port configured on the specified flow
130 * @param node the network node
131 * @param flowName the flow name
132 * @return the output action port for the specified flow
134 public NodeConnector getOutputPort(Node node, String flowName);
137 * Returns all the troubleshooting information that applications
138 * have set along with the policy they have configured through
139 * forwarding rules manger.
141 * @return the collection of troubleshooting objects
143 public Map<String, Object> getTSPolicyData();
146 * Set the troubleshooting information for the policy
148 * @param policyname the flow group name
149 * @param o the object containing the troubleshooting information
150 * @param add true for adding, false for removing
152 public void setTSPolicyData(String policyName, Object o, boolean add);
155 * Returns the troubleshooting information that was set for the specified policy
157 * @param groupName the flows group name
158 * @return the troubleshooting info object
160 public Object getTSPolicyData(String policyName);
163 * Returns the specifications of all the flows configured for all the
164 * switches on the current container
166 * @return the list of flow configurations present in the database
168 public List<FlowConfig> getStaticFlows();
171 * Returns the specifications of all the flows configured for
172 * the given switch on the current container
174 * @param node the network node identifier
175 * @return the list of {@code FlowConfig} objects
177 public List<FlowConfig> getStaticFlows(Node node);
180 * Returns the specification of the flow configured for the given
181 * network node on the current container
183 * @param name the flow name
184 * @param n the netwrok node identifier
185 * @return the {@code FlowConfig} object
187 public FlowConfig getStaticFlow(String name, Node n);
190 * Returns the list of names of flows configured for the given
191 * Network node on the current container
193 * @param node the network node identifier
194 * @return the list of flow names
196 public List<String> getStaticFlowNamesForNode(Node node);
199 * Returns the list of Node(s) for which a static flow has been configured
201 * @return the list of network nodes
203 public List<Node> getListNodeWithConfiguredFlows();
206 * Save the flow configured so far to file
208 * @return the {@code Status} object indicating the result of this action.
210 public Status saveConfig();
213 * Add a flow specified by the {@code FlowConfig} object on the current container
215 * @param config the {@code FlowConfig} object representing the static flow
216 * @param restore if set to true, the config object validation will be skipped.
217 * Used only internally, always set it to false.
218 * @return the {@code Status} object indicating the result of this action.
220 public Status addStaticFlow(FlowConfig config, boolean restore);
223 * Remove a flow specified by the {@code FlowConfig} object on the current container
225 * @param config the {@code FlowConfig} object representing the static flow
226 * @return the {@code Status} object indicating the result of this action
228 public Status removeStaticFlow(FlowConfig config);
231 * Replace the flow identified by the {@code FlowConfig.name} name for
232 * the {@code FlowConfig.node} network node with the new flow specified
233 * by {@code FlowConfig} object
235 * @param config the {@code FlowConfig} object
236 * @returnthe {@code Status} object indicating the result of this action
238 public Status modifyStaticFlow(FlowConfig config);
241 * Remove the flow specified by name on the passed network node
243 * @param name for the static flow
244 * @param node on which the flow is attached
245 * @return the {@code Status} object indicating the result of this action
247 public Status removeStaticFlow(String name, Node node);
250 * Toggle the installation status of the specified configured flow
251 * If the flow configuration status is active, this call will
252 * change the flow status to inactive and vice-versa
254 * @param configObject the {@code FlowConfig} object
255 * @return the {@code Status} object indicating the result of this action
257 public Status toggleStaticFlowStatus(FlowConfig configObject);
260 * Toggle the installation status of the specified configured flow
261 * If the flow configuration status is active, this call will
262 * change the flow status to inactive and vice-versa
264 * @param name for the static flow
265 * @param node on which the flow is attached
266 * @return the {@code Status} object indicating the result of this action
268 public Status toggleStaticFlowStatus(String name, Node node);
270 public Map<String, PortGroupConfig> getPortGroupConfigs();
272 public boolean addPortGroupConfig(String name, String regex, boolean load);
274 public boolean delPortGroupConfig(String name);
276 public PortGroupProvider getPortGroupProvider();