Phaneendra Manda
Committed by Gerrit Code Review

[ONOS-4715] Port chain delete issue fix

Change-Id: I8330367710212be1432c13534f69be96f80637bd
...@@ -64,4 +64,15 @@ public interface SfcFlowRuleInstallerService { ...@@ -64,4 +64,15 @@ public interface SfcFlowRuleInstallerService {
64 */ 64 */
65 ConnectPoint unInstallLoadBalancedFlowRules(PortChain portChain, FiveTuple fiveTuple, 65 ConnectPoint unInstallLoadBalancedFlowRules(PortChain portChain, FiveTuple fiveTuple,
66 NshServicePathId nshSpiId); 66 NshServicePathId nshSpiId);
67 +
68 + /**
69 + * Uninstall load balanced classifier rules.
70 + *
71 + * @param portChain port-chain
72 + * @param fiveTuple five tuple packet information
73 + * @param nshSpiId service path index identifier
74 + * @return connectPoint the network identifier
75 + */
76 + ConnectPoint unInstallLoadBalancedClassifierRules(PortChain portChain, FiveTuple fiveTuple,
77 + NshServicePathId nshSpiId);
67 } 78 }
......
...@@ -218,6 +218,20 @@ public class SfcFlowRuleInstallerImpl implements SfcFlowRuleInstallerService { ...@@ -218,6 +218,20 @@ public class SfcFlowRuleInstallerImpl implements SfcFlowRuleInstallerService {
218 return installSfcFlowRules(portChain, fiveTuple, nshSpiId, Objective.Operation.REMOVE); 218 return installSfcFlowRules(portChain, fiveTuple, nshSpiId, Objective.Operation.REMOVE);
219 } 219 }
220 220
221 + @Override
222 + public ConnectPoint unInstallLoadBalancedClassifierRules(PortChain portChain, FiveTuple fiveTuple,
223 + NshServicePathId nshSpiId) {
224 + checkNotNull(portChain, PORT_CHAIN_NOT_NULL);
225 +
226 + List<PortPairId> portPairs = portChain.getLoadBalancePath(fiveTuple);
227 + // Get the first port pair
228 + ListIterator<PortPairId> portPairListIterator = portPairs.listIterator();
229 + PortPairId portPairId = portPairListIterator.next();
230 + PortPair portPair = portPairService.getPortPair(portPairId);
231 +
232 + return installSfcClassifierRules(portChain, portPair, nshSpiId, fiveTuple, Objective.Operation.REMOVE);
233 + }
234 +
221 public ConnectPoint installSfcFlowRules(PortChain portChain, FiveTuple fiveTuple, NshServicePathId nshSpiId, 235 public ConnectPoint installSfcFlowRules(PortChain portChain, FiveTuple fiveTuple, NshServicePathId nshSpiId,
222 Objective.Operation type) { 236 Objective.Operation type) {
223 checkNotNull(portChain, PORT_CHAIN_NOT_NULL); 237 checkNotNull(portChain, PORT_CHAIN_NOT_NULL);
......
...@@ -316,13 +316,15 @@ public class SfcManager implements SfcService { ...@@ -316,13 +316,15 @@ public class SfcManager implements SfcService {
316 Set<FiveTuple> fiveTupleSet = portChain.getLoadBalanceIdMapKeys(); 316 Set<FiveTuple> fiveTupleSet = portChain.getLoadBalanceIdMapKeys();
317 for (FiveTuple fiveTuple : fiveTupleSet) { 317 for (FiveTuple fiveTuple : fiveTupleSet) {
318 id = portChain.getLoadBalanceId(fiveTuple); 318 id = portChain.getLoadBalanceId(fiveTuple);
319 + nshSpi = NshServicePathId.of(getNshServicePathId(id, nshSpiId));
319 if (processedIdList.contains(id)) { 320 if (processedIdList.contains(id)) {
320 - // multiple five tuple can have single path. 321 + // Multiple five tuple can have single path. In this case only
322 + // the classifier rule need to delete
323 + flowRuleInstaller.unInstallLoadBalancedClassifierRules(portChain, fiveTuple, nshSpi);
321 continue; 324 continue;
322 } else { 325 } else {
323 processedIdList.add(id); 326 processedIdList.add(id);
324 } 327 }
325 - nshSpi = NshServicePathId.of(getNshServicePathId(id, nshSpiId));
326 flowRuleInstaller.unInstallLoadBalancedFlowRules(portChain, fiveTuple, nshSpi); 328 flowRuleInstaller.unInstallLoadBalancedFlowRules(portChain, fiveTuple, nshSpi);
327 } 329 }
328 330
......