SONAR suggestions - boolean expressions that are known to be 'true' or 'false'
Change-Id: I4e089cb606ecf43444b4d567ad63d622f37506ce
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompiler.java
index b53143b..0c47196 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PointToPointIntentCompiler.java
@@ -589,36 +589,34 @@
PointToPointIntent pointIntent) {
List<Intent> intentList = new ArrayList<>();
intentList.addAll(oldInstallables);
- erasePrimary = false;
- eraseBackup = false;
- if (intentList != null) {
- Iterator<Intent> iterator = intentList.iterator();
- while (iterator.hasNext() && !(erasePrimary && eraseBackup)) {
- Intent intent = iterator.next();
- intent.resources().forEach(resource -> {
- if (resource instanceof Link) {
- Link link = (Link) resource;
- if (link.state() == Link.State.INACTIVE) {
+
+ Iterator<Intent> iterator = intentList.iterator();
+ while (iterator.hasNext()) {
+ Intent intent = iterator.next();
+ intent.resources().forEach(resource -> {
+ if (resource instanceof Link) {
+ Link link = (Link) resource;
+ if (link.state() == Link.State.INACTIVE) {
+ setPathsToRemove(intent);
+ } else if (link instanceof EdgeLink) {
+ ConnectPoint connectPoint = (link.src().elementId() instanceof DeviceId)
+ ? link.src() : link.dst();
+ Port port = deviceService.getPort(connectPoint.deviceId(), connectPoint.port());
+ if (port == null || !port.isEnabled()) {
setPathsToRemove(intent);
- } else if (link instanceof EdgeLink) {
- ConnectPoint connectPoint = (link.src().elementId() instanceof DeviceId)
- ? link.src() : link.dst();
- Port port = deviceService.getPort(connectPoint.deviceId(), connectPoint.port());
- if (port == null || !port.isEnabled()) {
- setPathsToRemove(intent);
- }
- } else {
- Port port1 = deviceService.getPort(link.src().deviceId(), link.src().port());
- Port port2 = deviceService.getPort(link.dst().deviceId(), link.dst().port());
- if (port1 == null || !port1.isEnabled() || port2 == null || !port2.isEnabled()) {
- setPathsToRemove(intent);
- }
+ }
+ } else {
+ Port port1 = deviceService.getPort(link.src().deviceId(), link.src().port());
+ Port port2 = deviceService.getPort(link.dst().deviceId(), link.dst().port());
+ if (port1 == null || !port1.isEnabled() || port2 == null || !port2.isEnabled()) {
+ setPathsToRemove(intent);
}
}
- });
- }
- removeAndUpdateIntents(intentList, pointIntent);
+ }
+ });
}
+ removeAndUpdateIntents(intentList, pointIntent);
+
return intentList;
}