Fix latency constraint
1. Consider that the type "Duration" in the String is composed by
characters and numbers, it's not easy to convert it to double for
comparison, I modified the latency's annotation to
cfg.latency().toNanos().
2. Exclude two EdgeLinks for the calculation of the whole path's latency
3. The unit of latency in ONOS is not the same, so I set all the latency units to
nanoseconds.
4. Add the latency constraint option for ConnectivityIntentCommand.
Change-Id: Iddf5634880e43ed563db9978659db5eb9ee6c7f8
diff --git a/core/net/src/test/java/org/onosproject/net/link/impl/BasicLinkOperatorTest.java b/core/net/src/test/java/org/onosproject/net/link/impl/BasicLinkOperatorTest.java
index d540aeb..6450052 100644
--- a/core/net/src/test/java/org/onosproject/net/link/impl/BasicLinkOperatorTest.java
+++ b/core/net/src/test/java/org/onosproject/net/link/impl/BasicLinkOperatorTest.java
@@ -47,7 +47,7 @@
private static final ConnectPoint SRC = new ConnectPoint(DID1, P1);
private static final ConnectPoint DST = new ConnectPoint(DID2, P1);
private static final LinkKey LK = LinkKey.linkKey(SRC, DST);
- private static final Duration NTIME = Duration.ofNanos(200);
+ private static final long NTIME = 200;
private static final SparseAnnotations SA = DefaultAnnotations.builder()
.set(AnnotationKeys.DURABLE, "true").build();
@@ -60,13 +60,13 @@
@Before
public void setUp() {
BLC.init(LK, "optest", JsonNodeFactory.instance.objectNode(), mapper, delegate);
- BLC.latency(NTIME);
+ BLC.latency(Duration.ofNanos(NTIME));
}
@Test
public void testDescOps() {
LinkDescription desc = BasicLinkOperator.combine(BLC, LD);
- assertEquals(NTIME.toString(), desc.annotations().value(AnnotationKeys.LATENCY));
+ assertEquals(String.valueOf(NTIME), desc.annotations().value(AnnotationKeys.LATENCY));
assertEquals("true", desc.annotations().value(AnnotationKeys.DURABLE));
}
}