Enable Qemu test execution
This change addresses the following
- user input SSH and HTTPS port
- consolidate SSH connections in lib
- fix obsolete codes
- update README instructions
Resolves openbmc/openbmc-test-automation#41
Change-Id: I06dd132fb745ebbf035cb0fc583b46542448d126
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/connection_client.robot b/lib/connection_client.robot
new file mode 100755
index 0000000..1e74357
--- /dev/null
+++ b/lib/connection_client.robot
@@ -0,0 +1,26 @@
+*** Settings ***
+Documentation This module is for SSH connection override to QEMU
+... based openbmc systems.
+
+Library SSHLibrary
+Library OperatingSystem
+
+*** Variables ***
+
+*** Keywords ***
+Open Connection And Log In
+ Run Keyword If '${SSH_PORT}' != '${EMPTY}' and '${HTTPS_PORT}' != '${EMPTY}'
+ ... User input SSH and HTTPs Ports
+
+ Run Keyword If '${SSH_PORT}' == '${EMPTY}' Open connection ${OPENBMC_HOST}
+ ... ELSE Run Keyword Open connection ${OPENBMC_HOST} port=${SSH_PORT}
+
+ Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
+
+User input SSH and HTTPs Ports
+ [Documentation] Update the global SSH and HTTPs port variable for QEMU
+ ${port_num}= Convert To Integer ${SSH_PORT}
+ ${SSH_PORT}= Replace Variables ${port_num}
+
+ ${https_num}= Convert To Integer ${HTTPS_PORT}
+ ${AUTH_URI}= Replace Variables https://${OPENBMC_HOST}:${https_num}
diff --git a/lib/ipmi_client.robot b/lib/ipmi_client.robot
index e7d96b4..e043a9e 100755
--- a/lib/ipmi_client.robot
+++ b/lib/ipmi_client.robot
@@ -1,26 +1,21 @@
*** Settings ***
-Documentation This module is for IPMI client for copying ipmitool to
-... openbmc box and execute ipmitool commands.
+Documentation This module is for IPMI client for copying ipmitool to
+... openbmc box and execute ipmitool commands.
Resource ../lib/resource.txt
-
-Library SSHLibrary
-Library OperatingSystem
+Resource ../lib/connection_client.robot
*** Keywords ***
-Open Connection And Log In
- Open connection ${OPENBMC_HOST}
- Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
- Copy ipmitool
-
Run IPMI Command
[arguments] ${args}
+ Copy ipmitool
${output} ${stderr}= Execute Command /tmp/ipmitool -I dbus raw ${args} return_stderr=True
Should Be Empty ${stderr}
set test variable ${OUTPUT} "${output}"
Run IPMI Standard Command
[arguments] ${args}
+ Copy ipmitool
${stdout} ${stderr} ${output}= Execute Command /tmp/ipmitool -I dbus ${args} return_stdout=True return_stderr= True return_rc=True
Should Be Equal ${output} ${0} msg=${stderr}
[return] ${stdout}
diff --git a/lib/resource.txt b/lib/resource.txt
index 2800581..6940d22 100755
--- a/lib/resource.txt
+++ b/lib/resource.txt
@@ -23,6 +23,10 @@
${PDU_PASSWORD} ${EMPTY}
${PDU_SLOT_NO} ${EMPTY}
+# User define input SSH and HTTPS related parameters
+${SSH_PORT} ${EMPTY}
+${HTTPS_PORT} ${EMPTY}
+
*** Keywords ***
Get Inventory Schema
[Arguments] ${machine}