-
- /**
- * Try to find in the database if a Flow with the same Match and priority of
- * the passed one already exists for the specified network node. Flow,
- * priority and network node are all specified in the FlowEntry If found,
- * the respective FlowEntryInstall Object is returned
- *
- * @param flowEntry
- * the FlowEntry to be tested against the ones installed
- * @param looseCheck
- * if true, the function will run the check against the original
- * flow entry portion of the installed entries
- * @return null if not found, otherwise the FlowEntryInstall which contains
- * the existing flow entry
- */
- private synchronized FlowEntryInstall findMatch(FlowEntry flowEntry, boolean looseCheck) {
- Flow flow = flowEntry.getFlow();
- Match match = flow.getMatch();
- short priority = flow.getPriority();
- Set<FlowEntryInstall> thisNodeList = nodeFlows.get(flowEntry.getNode());
-
- if (thisNodeList != null) {
- for (FlowEntryInstall flowEntries : thisNodeList) {
- flow = (looseCheck == false) ? flowEntries.getInstall()
- .getFlow() : flowEntries.getOriginal().getFlow();
- if (flow.getMatch().equals(match)
- && flow.getPriority() == priority) {
- return flowEntries;
+ @Override
+ public Status uninstallFlowEntryGroup(String groupName) {
+ if (groupName == null || groupName.isEmpty()) {
+ return new Status(StatusCode.BADREQUEST, "Invalid group name");
+ }
+ if (groupName.equals(FlowConfig.internalStaticFlowsGroup)) {
+ return new Status(StatusCode.BADREQUEST, "Static flows group cannot be deleted through this api");
+ }
+ if (inContainerMode) {
+ String msg = "Controller in container mode: Group Uninstall Refused";
+ String logMsg = msg + ": {}";
+ log.warn(logMsg, groupName);
+ return new Status(StatusCode.NOTACCEPTABLE, msg);
+ }
+ int toBeRemoved = groupFlows.get(groupName).size();
+ String error = "";
+ if (groupFlows.containsKey(groupName)) {
+ List<FlowEntryInstall> list = new ArrayList<FlowEntryInstall>(groupFlows.get(groupName));
+ for (FlowEntryInstall entry : list) {
+ Status status = this.removeEntry(entry.getOriginal(), false);
+ if (status.isSuccess()) {
+ toBeRemoved -= 1;
+ } else {
+ error = status.getDescription();