[ONOS-4715] Port chain delete issue fix
Change-Id: I8330367710212be1432c13534f69be96f80637bd
diff --git a/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/SfcFlowRuleInstallerService.java b/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/SfcFlowRuleInstallerService.java
index caff305..e76a578 100644
--- a/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/SfcFlowRuleInstallerService.java
+++ b/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/SfcFlowRuleInstallerService.java
@@ -64,4 +64,15 @@
*/
ConnectPoint unInstallLoadBalancedFlowRules(PortChain portChain, FiveTuple fiveTuple,
NshServicePathId nshSpiId);
+
+ /**
+ * Uninstall load balanced classifier rules.
+ *
+ * @param portChain port-chain
+ * @param fiveTuple five tuple packet information
+ * @param nshSpiId service path index identifier
+ * @return connectPoint the network identifier
+ */
+ ConnectPoint unInstallLoadBalancedClassifierRules(PortChain portChain, FiveTuple fiveTuple,
+ NshServicePathId nshSpiId);
}
diff --git a/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/SfcFlowRuleInstallerImpl.java b/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/SfcFlowRuleInstallerImpl.java
index 73fa751..5959ccd 100644
--- a/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/SfcFlowRuleInstallerImpl.java
+++ b/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/SfcFlowRuleInstallerImpl.java
@@ -218,6 +218,20 @@
return installSfcFlowRules(portChain, fiveTuple, nshSpiId, Objective.Operation.REMOVE);
}
+ @Override
+ public ConnectPoint unInstallLoadBalancedClassifierRules(PortChain portChain, FiveTuple fiveTuple,
+ NshServicePathId nshSpiId) {
+ checkNotNull(portChain, PORT_CHAIN_NOT_NULL);
+
+ List<PortPairId> portPairs = portChain.getLoadBalancePath(fiveTuple);
+ // Get the first port pair
+ ListIterator<PortPairId> portPairListIterator = portPairs.listIterator();
+ PortPairId portPairId = portPairListIterator.next();
+ PortPair portPair = portPairService.getPortPair(portPairId);
+
+ return installSfcClassifierRules(portChain, portPair, nshSpiId, fiveTuple, Objective.Operation.REMOVE);
+ }
+
public ConnectPoint installSfcFlowRules(PortChain portChain, FiveTuple fiveTuple, NshServicePathId nshSpiId,
Objective.Operation type) {
checkNotNull(portChain, PORT_CHAIN_NOT_NULL);
diff --git a/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java b/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java
index 17ca257..171195e 100644
--- a/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java
+++ b/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java
@@ -316,13 +316,15 @@
Set<FiveTuple> fiveTupleSet = portChain.getLoadBalanceIdMapKeys();
for (FiveTuple fiveTuple : fiveTupleSet) {
id = portChain.getLoadBalanceId(fiveTuple);
+ nshSpi = NshServicePathId.of(getNshServicePathId(id, nshSpiId));
if (processedIdList.contains(id)) {
- // multiple five tuple can have single path.
+ // Multiple five tuple can have single path. In this case only
+ // the classifier rule need to delete
+ flowRuleInstaller.unInstallLoadBalancedClassifierRules(portChain, fiveTuple, nshSpi);
continue;
} else {
processedIdList.add(id);
}
- nshSpi = NshServicePathId.of(getNshServicePathId(id, nshSpiId));
flowRuleInstaller.unInstallLoadBalancedFlowRules(portChain, fiveTuple, nshSpi);
}