OpenDaylight Controller functional modules.
[controller.git] / opendaylight / forwardingrulesmanager / src / main / java / org / opendaylight / controller / forwardingrulesmanager / IForwardingRulesManager.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.forwardingrulesmanager;
11
12 import java.util.List;
13 import java.util.Map;
14
15 import org.opendaylight.controller.sal.core.Node;
16 import org.opendaylight.controller.sal.core.NodeConnector;
17 import org.opendaylight.controller.sal.utils.Status;
18
19 /**
20  * Interface that describes methods for installing or removing forwarding rules
21  * and to access to the flows database.
22  *
23  */
24 public interface IForwardingRulesManager {
25
26     /**
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.
31      * 
32          * @param flow 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
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.
42      * 
43      * @param flow the flow entry to uninstall
44      * @return the {@code Status} object indicating the result of this action
45      */
46     public Status uninstallFlowEntry(FlowEntry flow);
47
48     /**
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.
55      * 
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
59      */
60     public Status modifyFlowEntry(FlowEntry current, FlowEntry newone);
61
62     /**
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.
73      * 
74      * @param newone the new flow entry to install
75      * @return the {@code Status} object indicating the result of this action
76      */
77     public Status modifyOrAddFlowEntry(FlowEntry newone);
78
79     /**
80      * Check whether the passed flow entry conflicts with the Container flows
81      * 
82      * @param flow the flow entry to test
83      * @return true if conflicts, false otherwise
84      */
85     public boolean checkFlowEntryConflict(FlowEntry flow);
86
87     /**
88      * Returns the list of Flow entries across network nodes which are part of the
89      * same flow group, policy
90      *
91      * @param group the group name
92      * @return the list of flow entries belonging to the specified group
93      */
94     public List<FlowEntry> getFlowEntriesForGroup(String group);
95
96     /**
97      * Add a list of output port to the flow with the specified name on the specified network node
98      *
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
102      */
103     public void addOutputPort(Node node, String flowName,
104             List<NodeConnector> dstPort);
105
106     /**
107      * Remove a list of output port from the flow with the specified name on the specified network node
108      *
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
112      */
113     public void removeOutputPort(Node node, String flowName,
114             List<NodeConnector> dstPort);
115
116     /**
117      * Replace the current output port in the specified flow with the specified one
118      *
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
123      */
124     public void replaceOutputPort(Node node, String flowName,
125             NodeConnector outPort);
126
127     /**
128      * Returns the output port configured on the specified flow
129      *
130      * @param node      the network node
131      * @param flowName  the flow name
132      * @return the output action port for the specified flow
133      */
134     public NodeConnector getOutputPort(Node node, String flowName);
135
136     /**
137      * Returns all the troubleshooting information that applications
138      * have set along with the policy they have configured through
139      * forwarding rules manger.
140      * 
141      * @return the collection of troubleshooting objects
142      */
143     public Map<String, Object> getTSPolicyData();
144
145     /**
146      * Set the troubleshooting information for the policy
147      *
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
151      */
152     public void setTSPolicyData(String policyName, Object o, boolean add);
153
154     /**
155      * Returns the troubleshooting information that was set for the specified policy
156      * 
157      * @param groupName the flows group name
158      * @return the troubleshooting info object
159      */
160     public Object getTSPolicyData(String policyName);
161
162     /**
163      * Returns the specifications of all the flows configured for all the 
164      * switches on the current container
165      *
166      * @return the list of flow configurations present in the database
167      */
168     public List<FlowConfig> getStaticFlows();
169
170     /**
171      * Returns the specifications of all the flows configured for 
172      * the given switch on the current container
173      *
174      * @param node      the network node identifier
175      * @return  the list of {@code FlowConfig} objects
176      */
177     public List<FlowConfig> getStaticFlows(Node node);
178
179     /**
180      * Returns the specification of the flow configured for the given
181      * network node on the current container
182      *
183      * @param name the flow name
184      * @param n the netwrok node identifier
185      * @return the {@code FlowConfig} object
186      */
187     public FlowConfig getStaticFlow(String name, Node n);
188
189     /**
190      * Returns the list of names of flows configured for the given 
191      * Network node on the current container
192      *
193      * @param node the network node identifier
194      * @return the list of flow names
195      */
196     public List<String> getStaticFlowNamesForNode(Node node);
197
198     /**
199      * Returns the list of Node(s) for which a static flow has been configured
200      *
201      * @return the list of network nodes
202      */
203     public List<Node> getListNodeWithConfiguredFlows();
204
205     /**
206      * Save the flow configured so far to file
207      * 
208      * @return the {@code Status} object indicating the result of this action.
209      */
210     public Status saveConfig();
211
212     /**
213      * Add a flow specified by the {@code FlowConfig} object on the current container
214      * 
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.
219      */
220     public Status addStaticFlow(FlowConfig config, boolean restore);
221
222     /**
223      * Remove a flow specified by the {@code FlowConfig} object on the current container
224      * 
225      * @param config the {@code FlowConfig} object representing the static flow
226      * @return the {@code Status} object indicating the result of this action
227      */
228     public Status removeStaticFlow(FlowConfig config);
229
230     /**
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
234      *
235      * @param config the {@code FlowConfig} object
236      * @returnthe {@code Status} object indicating the result of this action
237      */
238     public Status modifyStaticFlow(FlowConfig config);
239
240     /**
241      * Remove the flow specified by name on the passed network node
242      *
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
246      */
247     public Status removeStaticFlow(String name, Node node);
248
249     /**
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
253      *
254      * @param configObject the {@code FlowConfig} object
255      * @return the {@code Status} object indicating the result of this action
256      */
257     public Status toggleStaticFlowStatus(FlowConfig configObject);
258
259     public Map<String, PortGroupConfig> getPortGroupConfigs();
260
261     public boolean addPortGroupConfig(String name, String regex, boolean load);
262
263     public boolean delPortGroupConfig(String name);
264
265     public PortGroupProvider getPortGroupProvider();
266
267 }