mirror of
https://github.com/opennetworkinglab/onos.git
synced 2026-05-04 11:51:43 +02:00
[ONOS-7382] Ensure flow tables are removed when last entry is removed
Change-Id: I967af049022faaf448ff474d88b9a707a6feb538
This commit is contained in:
parent
0e44012994
commit
ce336f727d
@ -827,15 +827,16 @@ public class ECFlowRuleStore
|
||||
|
||||
public FlowEntry remove(DeviceId deviceId, FlowEntry rule) {
|
||||
final AtomicReference<FlowEntry> removedRule = new AtomicReference<>();
|
||||
getFlowEntriesInternal(rule.deviceId(), rule.id())
|
||||
.computeIfPresent((StoredFlowEntry) rule, (k, stored) -> {
|
||||
final Map<FlowId, Map<StoredFlowEntry, StoredFlowEntry>> flowTable = getFlowTable(deviceId);
|
||||
flowTable.computeIfPresent(rule.id(), (flowId, flowEntries) -> {
|
||||
flowEntries.computeIfPresent((StoredFlowEntry) rule, (k, stored) -> {
|
||||
if (rule instanceof DefaultFlowEntry) {
|
||||
DefaultFlowEntry toRemove = (DefaultFlowEntry) rule;
|
||||
if (stored instanceof DefaultFlowEntry) {
|
||||
DefaultFlowEntry storedEntry = (DefaultFlowEntry) stored;
|
||||
if (toRemove.created() < storedEntry.created()) {
|
||||
log.debug("Trying to remove more recent flow entry {} (stored: {})",
|
||||
toRemove, stored);
|
||||
toRemove, stored);
|
||||
// the key is not updated, removedRule remains null
|
||||
return stored;
|
||||
}
|
||||
@ -844,6 +845,8 @@ public class ECFlowRuleStore
|
||||
removedRule.set(stored);
|
||||
return null;
|
||||
});
|
||||
return flowEntries.isEmpty() ? null : flowEntries;
|
||||
});
|
||||
|
||||
if (removedRule.get() != null) {
|
||||
lastUpdateTimes.put(deviceId, System.currentTimeMillis());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user