Add timer constants in olm 20/82420/3
authorGilles Thouenon <gilles.thouenon@orange.com>
Thu, 6 Jun 2019 10:42:45 +0000 (12:42 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Fri, 7 Jun 2019 13:29:03 +0000 (15:29 +0200)
to ease convergence times customization.
This can speed up functional tests run against the honeynode emulator
since there is no real signal to make converge

JIRA: TRNSPRTPCE-112
Change-Id: I3222a9cf2ebd2ee11bd7a005ca0ab9309bfb9a0a
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Co-authored-by: Christophe Betoule <christophe.betoule@orange.com>
olm/src/main/java/org/opendaylight/transportpce/olm/power/PowerMgmtImpl.java
olm/src/main/java/org/opendaylight/transportpce/olm/util/OlmUtils.java

index 5aa89fafb9dc1e0283c0c56b24d5c5e2b52746bc..d9e22d60908efdc9d8a8ddcc838fafaf173bdbe0 100644 (file)
@@ -129,7 +129,7 @@ public class PowerMgmtImpl implements PowerMgmt {
                                     LOG.info("Transponder OCH connection: {} power updated ", interfaceName);
                                     try {
                                         LOG.info("Now going in sleep mode");
-                                        Thread.sleep(120000);
+                                        Thread.sleep(OlmUtils.OLM_TIMER_1);
                                     } catch (InterruptedException e) {
                                         LOG.info("Transponder warmup failed for OCH connection: {}", interfaceName, e);
                                     }
@@ -146,7 +146,7 @@ public class PowerMgmtImpl implements PowerMgmt {
                             if (callSetTransponderPower(nodeId, interfaceName, new BigDecimal(-5),openroadmVersion)) {
                                 LOG.info("Transponder OCH connection: {} power updated ", interfaceName);
                                 try {
-                                    Thread.sleep(120000);
+                                    Thread.sleep(OlmUtils.OLM_TIMER_1);
                                 } catch (InterruptedException e) {
                                     // TODO Auto-generated catch block
                                     LOG.info("Transponder warmup failed for OCH connection: {}", interfaceName, e);
@@ -238,7 +238,7 @@ public class PowerMgmtImpl implements PowerMgmt {
                                 //The value recommended by the white paper is 20 seconds and not 60.
                                 //TODO - commented code because one vendor is not supporting
                                 //GainLoss with target-output-power
-                                Thread.sleep(120000);
+                                Thread.sleep(OlmUtils.OLM_TIMER_1);
                                 crossConnect.setPowerLevel(nodeId, OpticalControlMode.GainLoss, powerValue,
                                         connectionNumber);
                             } else {
@@ -300,7 +300,7 @@ public class PowerMgmtImpl implements PowerMgmt {
                         LOG.warn("Power down failed for Roadm-connection: {}", connectionNumber);
                         return false;
                     }
-                    Thread.sleep(20000);
+                    Thread.sleep(OlmUtils.OLM_TIMER_2);
                     if (! crossConnect.setPowerLevel(nodeId, OpticalControlMode.Off , null, connectionNumber)) {
                         LOG.warn("Setting power-control mode off failed for Roadm-connection: {}", connectionNumber);
                         return false;
@@ -412,7 +412,7 @@ public class PowerMgmtImpl implements PowerMgmt {
                         openroadmVersion)) {
                     LOG.info("Transponder OCH connection: {} power updated ", interfaceName);
                     try {
-                        Thread.sleep(120000);
+                        Thread.sleep(OlmUtils.OLM_TIMER_1);
                         return true;
                     } catch (InterruptedException e) {
                         // TODO Auto-generated catch block
@@ -523,7 +523,7 @@ public class PowerMgmtImpl implements PowerMgmt {
                         LOG.info("Roadm-connection: {} updated ");
                         //TODO - commented code because one vendor is not supporting
                         //GainLoss with target-output-power
-                        Thread.sleep(20000);
+                        Thread.sleep(OlmUtils.OLM_TIMER_2);
                         crossConnect.setPowerLevel(nodeId,
                                 OpticalControlMode.GainLoss, powerValue,connectionNumber);
                         return true;
@@ -554,7 +554,7 @@ public class PowerMgmtImpl implements PowerMgmt {
                         LOG.info("Roadm-connection: {} updated ");
                         //TODO - commented code because one vendor is not supporting
                         //GainLoss with target-output-power
-                        Thread.sleep(20000);
+                        Thread.sleep(OlmUtils.OLM_TIMER_2);
                         crossConnect.setPowerLevel(nodeId,
                                 OpticalControlMode.GainLoss, powerValue,connectionNumber);
                         return true;
index 75b1c489218acf0a1041b1a3c4530458958d3651..b2e04a8f82ade2ec2f53407f5655e4870c8320bb 100644 (file)
@@ -34,6 +34,8 @@ public final class OlmUtils {
 
     private static final Logger LOG = LoggerFactory.getLogger(OlmUtils.class);
     private static long DATABROKER_READ_TIMEOUT_SECONDS = 120;
+    public static long OLM_TIMER_1 = 120000; //nominal value is 120000 - functional test value may be 3000
+    public static long OLM_TIMER_2 = 20000; //nominal value is 20000 - functional test value may be 2000
     private static final InstanceIdentifier<Topology> NETCONF_TOPO_IID =
         InstanceIdentifier
             .create(NetworkTopology.class)