Add "Stop and Clear QEMU" KW 73/673/3
authorMatus Fabian <matfabia@cisco.com>
Mon, 4 Apr 2016 10:07:51 +0000 (12:07 +0200)
committerGerrit Code Review <gerrit@fd.io>
Tue, 5 Apr 2016 14:13:57 +0000 (14:13 +0000)
Change-Id: Ib1b3907cd30c20c89283bd20e84ed8b829540ca4
Signed-off-by: Matus Fabian <matfabia@cisco.com>
resources/libraries/robot/qemu.robot

index e26f9aa..171a9be 100644 (file)
@@ -12,7 +12,7 @@
 # limitations under the License.
 *** Settings ***
 | Library | resources.libraries.python.QemuUtils
-| Library | Collections
+| Library | resources.libraries.python.ssh.SSH
 
 *** Keywords ***
 
 | | Return From Keyword If | ${ready} == ${TRUE}
 | | Build QEMU | ${node}
 | | Add Node to QEMU Build List | ${node}
+
+| Stop and Clear QEMU
+| | [Documentation] | Stop QEMU, clear used sockets and close SSH connection
+| | ...             | running on ${dut}, ${vm} is VM node info dictionary
+| | ...             | returned by qemu_start or None.
+| | [Arguments] | ${dut} | ${vm}
+| | Qemu Set Node | ${dut}
+| | ${status} | ${value}= | Run Keyword And Ignore Error | Qemu System Status
+| | Run Keyword If | "${status}" == "FAIL" | Qemu Kill
+| | ... | ELSE IF | "${value}" == "running" | Qemu System Powerdown
+| | ... | ELSE | Qemu Quit
+| | Qemu Clear Socks
+| | Run Keyword If | ${vm} is not None | Disconnect | ${vm}