[PATCH openbmc-test-automation 09/60] Added Inventory list testcase

OpenBMC Patches openbmc-patches at stwcx.xyz
Tue Jan 12 03:49:35 AEDT 2016


From: Manjunath A Kumatagi <mkumatag at in.ibm.com>

---
 data/variables.py          | 31 +++++++++++++++++++++++++++++++
 lib/resource.txt           | 18 +++++++++++++-----
 lib/rest_client.robot      |  7 +------
 tests/test_inventory.robot | 16 ++++++++++++++++
 4 files changed, 61 insertions(+), 11 deletions(-)
 create mode 100644 data/variables.py
 create mode 100644 tests/test_inventory.robot

diff --git a/data/variables.py b/data/variables.py
new file mode 100644
index 0000000..099a21e
--- /dev/null
+++ b/data/variables.py
@@ -0,0 +1,31 @@
+INVENTORY={
+    "palmetto": ["/org/openbmc/inventory/system/chassis/io_board/pcie_slot0", 
+                 "/org/openbmc/inventory/system/chassis/io_board/pcie_slot1", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0/core9", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0/core8", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0/core7", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0/core6", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0/core5", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0/core4", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0/core3", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0/core2", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0/core1", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0/core0", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/dimm3", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/dimm2", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/dimm1", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/dimm0", 
+                 "/org/openbmc/inventory/system/chassis/fan4", 
+                 "/org/openbmc/inventory/system/chassis/fan2", 
+                 "/org/openbmc/inventory/system", 
+                 "/org/openbmc/inventory/system/chassis/fan0", 
+                 "/org/openbmc/inventory/system/chassis/fan1", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0", 
+                 "/org/openbmc/inventory/system/chassis", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0/core11", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/cpu0/core10", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/centaur0", 
+                 "/org/openbmc/inventory/system/chassis/motherboard", 
+                 "/org/openbmc/inventory/system/chassis/motherboard/bmc", 
+                 "/org/openbmc/inventory/system/chassis/fan3"]
+}
\ No newline at end of file
diff --git a/lib/resource.txt b/lib/resource.txt
index c34e026..fd10050 100644
--- a/lib/resource.txt
+++ b/lib/resource.txt
@@ -3,10 +3,18 @@ Library           Collections
 Library           String
 Library           RequestsLibrary.RequestsKeywords
 Library           OperatingSystem
+Variables         ../data/variables.py
 
 *** Variables ***
-${OPENBMC_HOST}           192.168.122.100    # openbmc ip address
-${PORT}           3000
-${AUTH_URI}       http://${HOST}:${PORT}
-${OPENBMC_USERNAME}       root
-${OPENBMC_PASSWORD}       abc123
+${OPENBMC_HOST}    192.168.122.100    # openbmc ip address
+${DBUS_PREFIX}    ${EMPTY}
+${PORT}           ${EMPTY}
+${AUTH_URI}       http://${OPENBMC_HOST}:${PORT}
+${OPENBMC_USERNAME}    root
+${OPENBMC_PASSWORD}    0penBmc
+${MACHINE_TYPE}    palmetto
+
+*** Keywords ***
+Get Inventory Schema
+    [Arguments]    ${machine}
+    [Return]    &{INVENTORY}[${machine}]
diff --git a/lib/rest_client.robot b/lib/rest_client.robot
index 45c4226..b972195 100644
--- a/lib/rest_client.robot
+++ b/lib/rest_client.robot
@@ -3,14 +3,9 @@ Library           Collections
 Library           String
 Library           RequestsLibrary.RequestsKeywords
 Library           OperatingSystem
+Resource          ../lib/resource.txt
 
 *** Variables ***
-${OPENBMC_HOST}           192.168.122.100    # openbmc ip address
-${DBUS_PREFIX}    /bus/session
-${PORT}           3000
-${AUTH_URI}       http://${OPENBMC_HOST}:${PORT}
-${OPENBMC_USERNAME}       root
-${OPENBMC_PASSWORD}       abc123
 # Response codes
 ${HTTP_CONTINUE}    100
 ${HTTP_SWITCHING_PROTOCOLS}    101
diff --git a/tests/test_inventory.robot b/tests/test_inventory.robot
new file mode 100644
index 0000000..2e5bfaa
--- /dev/null
+++ b/tests/test_inventory.robot
@@ -0,0 +1,16 @@
+*** Settings ***
+Documentation     This testsuite is for testing inventory
+Suite Teardown    Delete All Sessions
+Resource          ../lib/rest_client.robot
+Resource          ../lib/resource.txt
+
+*** Test Cases ***
+List Inventory
+    [Documentation]     This testcase will get the inventory for the openbmc
+    ...                 machine and validates with the expected inventory
+    ${resp} =    OpenBMC Get Request    org/openbmc/inventory/list
+    Should Be Equal As Strings    ${resp.status_code}    ${HTTP_OK}
+    ${jsondata}=    To Json    ${resp.content}
+    ${ret}=    Get Inventory Schema    ${MACHINE_TYPE}
+    : FOR    ${ELEMENT}    IN    @{ret}
+    \    Should Contain    ${jsondata}    ${ELEMENT}
-- 
2.6.4




More information about the openbmc mailing list