Allow Link.Type transition to types other than DIRECT
Change-Id: Ib7accc4d055c269afc28308bdda31768e05199c2
diff --git a/core/store/dist/src/main/java/org/onosproject/store/link/impl/ECLinkStore.java b/core/store/dist/src/main/java/org/onosproject/store/link/impl/ECLinkStore.java
index d93672e..2240eb4 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/link/impl/ECLinkStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/link/impl/ECLinkStore.java
@@ -293,11 +293,17 @@
private LinkDescription createOrUpdateLinkInternal(LinkDescription current, LinkDescription updated) {
if (current != null) {
- // we only allow transition from INDIRECT -> DIRECT
+ Type type;
+ if (current.type() == DIRECT && updated.type() == Type.INDIRECT) {
+ // mask transition from DIRECT -> INDIRECT, likely to be triggered by BDDP
+ type = Type.DIRECT;
+ } else {
+ type = updated.type();
+ }
return new DefaultLinkDescription(
current.src(),
current.dst(),
- current.type() == DIRECT ? DIRECT : updated.type(),
+ type,
current.isExpected(),
union(current.annotations(), updated.annotations()));
}
@@ -324,7 +330,7 @@
return newLink;
} else if (existingLink.state() != newLink.state() ||
existingLink.isExpected() != newLink.isExpected() ||
- (existingLink.type() == INDIRECT && newLink.type() == DIRECT) ||
+ (existingLink.type() != newLink.type()) ||
!AnnotationsUtil.isEqual(existingLink.annotations(), newLink.annotations())) {
eventType.set(LINK_UPDATED);
return newLink;