[ONOS-7703] FabricPipeliner does not remove NextGroup from store when remove NextObjective
Change-Id: Id945443606bd26e87f9e5236e97820bdbbe5b195
diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipeliner.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipeliner.java
index 61d3824..7cd154b 100644
--- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipeliner.java
+++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipeliner.java
@@ -169,20 +169,29 @@
return;
}
- // Success, put next group to objective store
- List<PortNumber> portNumbers = Lists.newArrayList();
- nextObjective.next().forEach(treatment ->
- treatment.allInstructions()
- .stream()
- .filter(inst -> inst.type() == Instruction.Type.OUTPUT)
- .map(inst -> (Instructions.OutputInstruction) inst)
- .findFirst()
- .map(Instructions.OutputInstruction::port)
- .ifPresent(portNumbers::add)
- );
- FabricNextGroup nextGroup = new FabricNextGroup(nextObjective.type(),
- portNumbers);
- flowObjectiveStore.putNextGroup(nextObjective.id(), nextGroup);
+ if (nextObjective.op() == Objective.Operation.REMOVE) {
+ if (flowObjectiveStore.getNextGroup(nextObjective.id()) == null) {
+ log.warn("Can not find next obj {} from store", nextObjective.id());
+ return;
+ }
+ flowObjectiveStore.removeNextGroup(nextObjective.id());
+ } else {
+ // Success, put next group to objective store
+ List<PortNumber> portNumbers = Lists.newArrayList();
+ nextObjective.next().forEach(treatment ->
+ treatment.allInstructions()
+ .stream()
+ .filter(inst -> inst.type() == Instruction.Type.OUTPUT)
+ .map(inst -> (Instructions.OutputInstruction) inst)
+ .findFirst()
+ .map(Instructions.OutputInstruction::port)
+ .ifPresent(portNumbers::add)
+ );
+ FabricNextGroup nextGroup = new FabricNextGroup(nextObjective.type(),
+ portNumbers);
+ flowObjectiveStore.putNextGroup(nextObjective.id(), nextGroup);
+ }
+
success(nextObjective);
});
}