Add TE metrics UT to SH DowngradeConstraints Junit 16/100416/2
authorguillaume.lambert <guillaume.lambert@orange.com>
Tue, 5 Apr 2022 13:00:35 +0000 (15:00 +0200)
committerGuillaume Lambert <guillaume.lambert@orange.com>
Tue, 5 Apr 2022 13:05:12 +0000 (13:05 +0000)
Junit was only testing WDM TE metrics but not OTN ones.

JIRA: TRNSPRTPCE-611
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I17004674be1ceface8dffae558dbea65c2e10d52

servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/DowngradeConstraintsTest.java

index 8895390dc9dc755fb1c3028734e3fb08735379fe..61596966ebe50196b155fbde00acfba310d5fac4 100644 (file)
@@ -317,7 +317,7 @@ public class DowngradeConstraintsTest {
     }
 
     @Test
-    public void testUpdateSoftConstraintsForHopCount() {
+    public void testUpdateSoftConstraintsForHopCountAndTEmetric() {
         HardConstraints initialHardConstraints =
             buildHardConstraint(null, false, null, null, null, null, false, false, null, null);
         SoftConstraints initialSoftConstraints =
@@ -327,7 +327,7 @@ public class DowngradeConstraintsTest {
         assertNull("updated soft constraints should contain no hop-count constraint",
             generatedSoftConstraints.getHopCount());
 
-        initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, true, false, null, null);
+        initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, true, true, null, null);
         generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
             initialHardConstraints, initialSoftConstraints);
         assertEquals("updated soft constraints should not be changed",
@@ -336,9 +336,13 @@ public class DowngradeConstraintsTest {
             3, generatedSoftConstraints.getHopCount().getMaxWdmHopCount().intValue());
         assertEquals("updated soft constraints max-otn-hop-count should be '5'",
             5, generatedSoftConstraints.getHopCount().getMaxOtnHopCount().intValue());
+        assertEquals("updated soft constraints max-wdm-TE-metric should be '8'",
+            8, generatedSoftConstraints.getTEMetric().getMaxWdmTEMetric().intValue());
+        assertEquals("updated soft constraints max-otn-TE-metric should be '11'",
+            11, generatedSoftConstraints.getTEMetric().getMaxOtnTEMetric().intValue());
 
         // test addition of hard hop-count when no soft hop-count
-        initialHardConstraints = buildHardConstraint(null, false, null, null, null, null, true, false, null, null);
+        initialHardConstraints = buildHardConstraint(null, false, null, null, null, null, true, true, null, null);
         initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
         generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
             initialHardConstraints, initialSoftConstraints);
@@ -348,15 +352,23 @@ public class DowngradeConstraintsTest {
             3, generatedSoftConstraints.getHopCount().getMaxWdmHopCount().intValue());
         assertEquals("updated soft constraints max-otn-hop-count should be '5'",
             5, generatedSoftConstraints.getHopCount().getMaxOtnHopCount().intValue());
+        assertEquals("updated soft constraints max-wdm-TE-metric should be '8'",
+            8, generatedSoftConstraints.getTEMetric().getMaxWdmTEMetric().intValue());
+        assertEquals("updated soft constraints max-otn-TE-metric should be '11'",
+            11, generatedSoftConstraints.getTEMetric().getMaxOtnTEMetric().intValue());
 
         // test addition of hard hop-count when existing soft hop-count
-        initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, true, false, null, null);
+        initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, true, true, null, null);
         generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
             initialHardConstraints, initialSoftConstraints);
         assertEquals("updated soft constraints max-wdm-hop-count should be '3'",
             3, generatedSoftConstraints.getHopCount().getMaxWdmHopCount().intValue());
         assertEquals("updated soft constraints max-otn-hop-count should be '5'",
             5, generatedSoftConstraints.getHopCount().getMaxOtnHopCount().intValue());
+        assertEquals("updated soft constraints max-wdm-TE-metric should be '8'",
+            8, generatedSoftConstraints.getTEMetric().getMaxWdmTEMetric().intValue());
+        assertEquals("updated soft constraints max-otn-TE-metric should be '11'",
+            11, generatedSoftConstraints.getTEMetric().getMaxOtnTEMetric().intValue());
     }
 
     @Test