[ONOS-6488] Fix failure when reinstall a VPLS
When removes and reinstalls a VPLS the VPLS operation manager doesn't
update intents because it didn't check if the intent from store is
installed or withdrawn.
Purge intents every time when removes interface or VPLS to clean the
intent store is a possible solution.
Change-Id: Ie06fb11e915b8f82f6753c8e47177ac4dc53dd17
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/VplsOperationManager.java b/apps/vpls/src/main/java/org/onosproject/vpls/VplsOperationManager.java
index 4c0262d..8d4d1db 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/VplsOperationManager.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/VplsOperationManager.java
@@ -304,13 +304,12 @@
// Error consumer
VplsOperation vplsOperation =
vplsOperationException.vplsOperation();
- log.debug("VPLS operation failed: {}", vplsOperation);
+ log.warn(OP_EXEC_ERR,
+ vplsOperation.toString(),
+ vplsOperationException.getMessage());
VplsData vplsData = vplsOperation.vpls();
vplsData.state(VplsData.VplsState.FAILED);
vplsStore.updateVpls(vplsData);
- log.error(OP_EXEC_ERR,
- vplsOperation.toString(),
- vplsOperationException.getMessage());
runningOperations.remove(vplsName);
});
log.debug("Applying operation: {}", operation);
@@ -544,6 +543,7 @@
private void removeVplsIntents() {
Set<Intent> intentsToWithdraw = getCurrentIntents();
applyIntentsSync(intentsToWithdraw, Direction.REMOVE);
+ intentsToWithdraw.forEach(intentService::purge);
}
/**
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/store/DistributedVplsStore.java b/apps/vpls/src/main/java/org/onosproject/vpls/store/DistributedVplsStore.java
index 6d58457..6b50508 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/store/DistributedVplsStore.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/store/DistributedVplsStore.java
@@ -100,6 +100,7 @@
@Deactivate
protected void deactive() {
vplsDataStore.removeListener(vplsDataListener);
+ networkConfigService.removeConfig(appId);
log.info("Stopped");
}