Adding ability to delay before executing a step in STC.

Change-Id: I9822ac35d37e6735068ebdf39b952db913a10e14
diff --git a/utils/stc/src/main/java/org/onlab/stc/StepProcessor.java b/utils/stc/src/main/java/org/onlab/stc/StepProcessor.java
index 4994369..f88c4bf1 100644
--- a/utils/stc/src/main/java/org/onlab/stc/StepProcessor.java
+++ b/utils/stc/src/main/java/org/onlab/stc/StepProcessor.java
@@ -38,6 +38,7 @@
     private static final String NEGATE_CODE = "!";
 
     private static final int FAIL = -1;
+    private static final int SECONDS = 1_000;
 
     static String launcher = "stc-launcher ";
 
@@ -67,6 +68,7 @@
     @Override
     public void run() {
         delegate.onStart(step, command);
+        delayIfNeeded();
         int code = execute();
         boolean ignoreCode = step.env() != null && step.env.equals(IGNORE_CODE);
         boolean negateCode = step.env() != null && step.env.equals(NEGATE_CODE);
@@ -76,6 +78,19 @@
     }
 
     /**
+     * Pauses if the step requires it.
+     */
+    private void delayIfNeeded() {
+        if (step.delay() > 0) {
+            try {
+                Thread.sleep(step.delay() * SECONDS);
+            } catch (InterruptedException e) {
+                throw new RuntimeException("Interrupted", e);
+            }
+        }
+    }
+
+    /**
      * Executes the step process.
      *
      * @return exit code