Phaneendra Manda
Committed by Gerrit Code Review

[ONOS-4715] Port chain delete issue fix

Change-Id: I8330367710212be1432c13534f69be96f80637bd
......@@ -64,4 +64,15 @@ public interface SfcFlowRuleInstallerService {
*/
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);
}
......
......@@ -218,6 +218,20 @@ public class SfcFlowRuleInstallerImpl implements SfcFlowRuleInstallerService {
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);
......
......@@ -316,13 +316,15 @@ public class SfcManager implements SfcService {
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);
}
......