Skip to content
Permalink
Browse files

Merge pull request #2778 from telstra/remove_warn_pce

Change logic of verification duplicate isl in PCE
  • Loading branch information...
timofei-durakov committed Sep 10, 2019
2 parents f57d808 + 9265359 commit a41fad77b0dd9b7343b42bbb30916069350ffecc
Showing with 13 additions and 2 deletions.
  1. +13 −2 services/src/kilda-pce/src/main/java/org/openkilda/pce/impl/AvailableNetwork.java
@@ -52,6 +52,16 @@ public Node getSwitch(SwitchId dpid) {
* Creates switches (if they are not created yet) and ISL between them.
*/
public void addLink(Isl isl) {
addLink(isl, false);
}

/**
* Creates switches (if they are not created yet) and ISL between them.
* @param isl new isl
* @param errorOnDuplicates how to handle duplicate links, if true will throw exception on duplicate
* @throws IllegalArgumentException in case of duplicate isl
*/
public void addLink(Isl isl, boolean errorOnDuplicates) {
Node srcSwitch = getOrInitSwitch(isl.getSrcSwitch());
Node dstSwitch = getOrInitSwitch(isl.getDestSwitch());

@@ -61,8 +71,9 @@ public void addLink(Isl isl) {
.build();
boolean srcAdded = srcSwitch.getOutgoingLinks().add(edge);
boolean dstAdded = dstSwitch.getIncomingLinks().add(edge);
if (!(srcAdded && dstAdded)) {
log.warn("Duplicate ISL has been passed to AvailableNetwork: {}", isl);
if (errorOnDuplicates && !(srcAdded && dstAdded)) {
String message = String.format("Duplicate ISL has been passed to AvailableNetwork: {}", isl);
throw new IllegalArgumentException(message);
}
}

0 comments on commit a41fad7

Please sign in to comment.
You can’t perform that action at this time.