Merge "Fixed validation bug of YANG import statement"
[controller.git] / opendaylight / forwardingrulesmanager / api / src / main / java / org / opendaylight / controller / forwardingrulesmanager / IForwardingRulesManager.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.forwardingrulesmanager;
10
11 import java.util.List;
12 import java.util.Map;
13
14 import org.opendaylight.controller.sal.core.Node;
15 import org.opendaylight.controller.sal.core.NodeConnector;
16 import org.opendaylight.controller.sal.utils.Status;
17
18 /**
19  * Interface that describes methods for installing or removing forwarding rules
20  * and to access to the flows database.
21  * 
22  */
23 public interface IForwardingRulesManager {
24
25     /**
26      * It requests FRM to install the passed Flow Entry. FRM will request the
27      * SDN protocol plugin to install the flow on the network node. Based on the
28      * result of this operation FRM will update its database accordingly and
29      * will return the proper {@code Status} code.
30      * 
31      * @param flow
32      *            the flow entry to install
33      * @return the {@code Status} object indicating the result of this action.
34      */
35     public Status installFlowEntry(FlowEntry flow);
36
37     /**
38      * It requests FRM to remove the passed Flow Entry. FRM will request the SDN
39      * protocol plugin to uninstall the flow from the network node. Based on the
40      * result of this operation FRM will update its database accordingly and
41      * will return the proper {@code Status} code.
42      * 
43      * @param flow
44      *            the flow entry to uninstall
45      * @return the {@code Status} object indicating the result of this action
46      */
47     public Status uninstallFlowEntry(FlowEntry flow);
48
49     /**
50      * It requests FRM to replace the currently installed Flow Entry with the
51      * new one. It is up to the SDN protocol plugin to decide how to convey this
52      * message to the network node. It could be a delete + add or a single
53      * modify message depending on the SDN protocol specifications If the
54      * current flow is equal to the new one it will be a no op and success code
55      * is returned.
56      * 
57      * @param current
58      *            the current flow entry to modify
59      * @param newone
60      *            the new flow entry which will replace the current one
61      * @return the {@code Status} object indicating the result of this action
62      */
63     public Status modifyFlowEntry(FlowEntry current, FlowEntry newone);
64
65     /**
66      * It requests the FRM to replace the currently installed Flow Entry with
67      * the new one. The currently installed entry is derived by the Match
68      * portion of the passed Flow. FRM looks in its database for a previously
69      * installed FlowEntry which Match equals the Match of the passed Flow. If
70      * it finds it, it will request the SDN protocol plugin to replace the
71      * existing flow with the new one on the network node. If it does not find
72      * it, it will request plugin to add the new flow. If the passed entry is
73      * not valid an error code is returned. If the existing flow is equal to the
74      * passed one it will be a no op and success code is returned.
75      * 
76      * @param newone
77      *            the new flow entry to install
78      * @return the {@code Status} object indicating the result of this action
79      */
80     public Status modifyOrAddFlowEntry(FlowEntry newone);
81
82     /**
83      * Check whether the passed flow entry conflicts with the Container flows
84      * 
85      * @param flow
86      *            the flow entry to test
87      * @return true if conflicts, false otherwise
88      */
89     public boolean checkFlowEntryConflict(FlowEntry flow);
90
91     /**
92      * Returns the list of Flow entries across network nodes which are part of
93      * the same flow group, policy
94      * 
95      * @param group
96      *            the group name
97      * @return the list of flow entries belonging to the specified group
98      */
99     public List<FlowEntry> getFlowEntriesForGroup(String group);
100
101     /**
102      * Add a list of output port to the flow with the specified name on the
103      * specified network node
104      * 
105      * @param node
106      *            the network node
107      * @param flowName
108      *            the flow name
109      * @param dstPort
110      *            the list of ports to be added to the flow output actions
111      */
112     public void addOutputPort(Node node, String flowName,
113             List<NodeConnector> dstPort);
114
115     /**
116      * Remove a list of output port from the flow with the specified name on the
117      * specified network node
118      * 
119      * @param node
120      *            the network node
121      * @param flowName
122      *            the flow name
123      * @param dstPortthe
124      *            list of ports to be removed from the flow output actions
125      */
126     public void removeOutputPort(Node node, String flowName,
127             List<NodeConnector> dstPort);
128
129     /**
130      * Replace the current output port in the specified flow with the specified
131      * one
132      * 
133      * @param node
134      *            the network node
135      * @param groupName
136      *            the group name
137      * @param flowName
138      *            the flow name
139      * @param dstPort
140      *            the new output action port
141      */
142     public void replaceOutputPort(Node node, String flowName,
143             NodeConnector outPort);
144
145     /**
146      * Returns the output port configured on the specified flow
147      * 
148      * @param node
149      *            the network node
150      * @param flowName
151      *            the flow name
152      * @return the output action port for the specified flow
153      */
154     public NodeConnector getOutputPort(Node node, String flowName);
155
156     /**
157      * Returns all the troubleshooting information that applications have set
158      * along with the policy they have configured through forwarding rules
159      * manger.
160      * 
161      * @return the collection of troubleshooting objects
162      */
163     public Map<String, Object> getTSPolicyData();
164
165     /**
166      * Set the troubleshooting information for the policy
167      * 
168      * @param policyname
169      *            the flow group name
170      * @param o
171      *            the object containing the troubleshooting information
172      * @param add
173      *            true for adding, false for removing
174      */
175     public void setTSPolicyData(String policyName, Object o, boolean add);
176
177     /**
178      * Returns the troubleshooting information that was set for the specified
179      * policy
180      * 
181      * @param groupName
182      *            the flows group name
183      * @return the troubleshooting info object
184      */
185     public Object getTSPolicyData(String policyName);
186
187     /**
188      * Returns the specifications of all the flows configured for all the
189      * switches on the current container
190      * 
191      * @return the list of flow configurations present in the database
192      */
193     public List<FlowConfig> getStaticFlows();
194
195     /**
196      * Returns the specifications of all the flows configured for the given
197      * switch on the current container
198      * 
199      * @param node
200      *            the network node identifier
201      * @return the list of {@code FlowConfig} objects
202      */
203     public List<FlowConfig> getStaticFlows(Node node);
204
205     /**
206      * Returns the specification of the flow configured for the given network
207      * node on the current container
208      * 
209      * @param name
210      *            the flow name
211      * @param n
212      *            the netwrok node identifier
213      * @return the {@code FlowConfig} object
214      */
215     public FlowConfig getStaticFlow(String name, Node n);
216
217     /**
218      * Returns the list of names of flows configured for the given Network node
219      * on the current container
220      * 
221      * @param node
222      *            the network node identifier
223      * @return the list of flow names
224      */
225     public List<String> getStaticFlowNamesForNode(Node node);
226
227     /**
228      * Returns the list of Node(s) for which a static flow has been configured
229      * 
230      * @return the list of network nodes
231      */
232     public List<Node> getListNodeWithConfiguredFlows();
233
234     /**
235      * Save the flow configured so far to file
236      * 
237      * @return the {@code Status} object indicating the result of this action.
238      */
239     public Status saveConfig();
240
241     /**
242      * Add a flow specified by the {@code FlowConfig} object on the current
243      * container
244      * 
245      * @param config
246      *            the {@code FlowConfig} object representing the static flow
247      * @param restore
248      *            if set to true, the config object validation will be skipped.
249      *            Used only internally, always set it to false.
250      * @return the {@code Status} object indicating the result of this action.
251      */
252     public Status addStaticFlow(FlowConfig config, boolean restore);
253
254     /**
255      * Remove a flow specified by the {@code FlowConfig} object on the current
256      * container
257      * 
258      * @param config
259      *            the {@code FlowConfig} object representing the static flow
260      * @return the {@code Status} object indicating the result of this action
261      */
262     public Status removeStaticFlow(FlowConfig config);
263
264     /**
265      * Replace the flow identified by the {@code FlowConfig.name} name for the
266      * {@code FlowConfig.node} network node with the new flow specified by
267      * {@code FlowConfig} object
268      * 
269      * @param config
270      *            the {@code FlowConfig} object
271      * @returnthe {@code Status} object indicating the result of this action
272      */
273     public Status modifyStaticFlow(FlowConfig config);
274
275     /**
276      * Remove the flow specified by name on the passed network node
277      * 
278      * @param name
279      *            for the static flow
280      * @param node
281      *            on which the flow is attached
282      * @return the {@code Status} object indicating the result of this action
283      */
284     public Status removeStaticFlow(String name, Node node);
285
286     /**
287      * Toggle the installation status of the specified configured flow If the
288      * flow configuration status is active, this call will change the flow
289      * status to inactive and vice-versa
290      * 
291      * @param configObject
292      *            the {@code FlowConfig} object
293      * @return the {@code Status} object indicating the result of this action
294      */
295     public Status toggleStaticFlowStatus(FlowConfig configObject);
296
297     /**
298      * Toggle the installation status of the specified configured flow If the
299      * flow configuration status is active, this call will change the flow
300      * status to inactive and vice-versa
301      * 
302      * @param name
303      *            for the static flow
304      * @param node
305      *            on which the flow is attached
306      * @return the {@code Status} object indicating the result of this action
307      */
308     public Status toggleStaticFlowStatus(String name, Node node);
309
310     public Map<String, PortGroupConfig> getPortGroupConfigs();
311
312     public boolean addPortGroupConfig(String name, String regex, boolean load);
313
314     public boolean delPortGroupConfig(String name);
315
316     public PortGroupProvider getPortGroupProvider();
317
318 }