From 9c13028cf9b29da86e5b12c5d3b8c4d6bd858545 Mon Sep 17 00:00:00 2001
From: Martin Klozik <martinx.klozik@intel.com>
Date: Tue, 11 Oct 2016 12:41:57 +0100
Subject: teststeps: Generic support of step driven tests

In the past, step driven testcases were supported
only by integration testcases. This patch adds generic
support of TestSteps for both integration and performance
testcases. Step driven test were improved to support
modification of existing deployment. As part of
the patch a refactoring of traffic controllers
were performed. Traffic controllers were modified
to support trafficgen-off and trafficgen-pause
modes in all possible ways of trafficgen invocation.

JIRA: VSPERF-362

Change-Id: Ic8b7a9b0e7165f0a15a52279ed0f0952da9fedb8
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Christian Trautman <ctrautma@redhat.com>
Reviewed-by: Bill Michalowski <bmichalo@redhat.com>
Reviewed-by: Antonio Fischetti <antonio.fischetti@intel.com>
Reviewed-by: Sridhar K. N. Rao <sridhar.rao@spirent.com>
---
 vnfs/qemu/qemu.py | 43 ++++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 21 deletions(-)

(limited to 'vnfs')

diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py
index 87126da8..51553277 100644
--- a/vnfs/qemu/qemu.py
+++ b/vnfs/qemu/qemu.py
@@ -151,27 +151,28 @@ class IVnfQemu(IVnf):
         """
         Stops VNF instance gracefully first.
         """
-        try:
-            # exit testpmd if needed
-            if self._guest_loopback == 'testpmd':
-                self.execute_and_wait('stop', 120, "Done")
-                self.execute_and_wait('quit', 120, "[bB]ye")
-
-            # turn off VM
-            self.execute_and_wait('poweroff', 120, "Power down")
-
-        except pexpect.TIMEOUT:
-            self.kill()
-
-        # wait until qemu shutdowns
-        self._logger.debug('Wait for QEMU to terminate')
-        for dummy in range(30):
-            time.sleep(1)
-            if not self.is_running():
-                break
-
-        # just for case that graceful shutdown failed
-        super(IVnfQemu, self).stop()
+        if self.is_running():
+            try:
+                # exit testpmd if needed
+                if self._guest_loopback == 'testpmd':
+                    self.execute_and_wait('stop', 120, "Done")
+                    self.execute_and_wait('quit', 120, "[bB]ye")
+
+                # turn off VM
+                self.execute_and_wait('poweroff', 120, "Power down")
+
+            except pexpect.TIMEOUT:
+                self.kill()
+
+            # wait until qemu shutdowns
+            self._logger.debug('Wait for QEMU to terminate')
+            for dummy in range(30):
+                time.sleep(1)
+                if not self.is_running():
+                    break
+
+            # just for case that graceful shutdown failed
+            super(IVnfQemu, self).stop()
 
     # helper functions
 
-- 
cgit