Fixed inventory related issues in test_inventory and test_sensors test files

This change includes:
      - Inventory path cpu, dimm and other componenet are now taken using enumerate
      - Updated test_inventory TCs to get component count using enumerate.
      - Palmetto.py file updated with recent changes in skeleton.
      - This changes will not have any impact on other system run like Berreleye

What this check in does not include
      - Remove complete dependency on skeleton file. This
        will be taken care in our automation one by one.

resolves : openbmc/openbmc-test-automation#119

Change-Id: I3266d48c2484d0a8f0b91b47e06a805def1a8486
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/tests/test_inventory.robot b/tests/test_inventory.robot
index 91dc35c..d007638 100644
--- a/tests/test_inventory.robot
+++ b/tests/test_inventory.robot
@@ -13,91 +13,90 @@
 Variables         ../data/variables.py
 
 
-Suite setup		setup the suite
+Suite setup        setup the suite
 
 Force Tags  chassisboot
 
 *** Test Cases ***
 
 minimal cpu inventory
-	${count} = 	Get Total Present 	CPU
-	Should Be True 	${count}>${0}
+    ${count} =     Get Total Present     cpu
+    Should Be True     ${count}>${0}
 
 minimal dimm inventory
-	${count} = 	Get Total Present 	DIMM
-	Should Be True 	${count}>=${2}
+    ${count} =     Get Total Present     dimm
+    Should Be True     ${count}>=${2}
 
 minimal core inventory
-	${count} = 	Get Total Present 	CORE
-	Should Be True 	${count}>${0}
+    ${count} =     Get Total Present     core
+    Should Be True     ${count}>${0}
 
 minimal memory buffer inventory
-	${count} = 	Get Total Present 	MEMORY_BUFFER
-	Should Be True 	${count}>${0}
+    ${count} =     Get Total Present     membuf
+    Should Be True     ${count}>${0}
 
 minimal fan inventory
     [Tags]  minimal_fan_inventory
-	${count} = 	Get Total Present 	FAN
-	Should Be True 	${count}>${2}
+    ${count} =     Get Total Present     fan
+    Should Be True     ${count}>${2}
 
 minimal main planar inventory
-	${count} = 	Get Total Present 	MAIN_PLANAR
-	Should Be True 	${count}>${0}
+    ${count} =     Get Total Present     motherboard
+    Should Be True     ${count}>${0}
 
 minimal system inventory
-	${count} = 	Get Total Present 	SYSTEM
-	Should Be True 	${count}>${0}
+    ${count} =     Get Total Present     system
+    Should Be True     ${count}>${0}
 
 Verify CPU VPD Properties
-	Verify Properties 	CPU
+    Verify Properties     CPU
 
 Verify DIMM VPD Properties
-	Verify Properties 	DIMM
+    Verify Properties     DIMM
 
 Verify Memory Buffer VPD Properties
-	Verify Properties 	MEMORY_BUFFER
+    Verify Properties     MEMORY_BUFFER
 
 Verify Fan VPD Properties
-	Verify Properties 	FAN
+    Verify Properties     FAN
 
 Verify System VPD Properties
     [Tags]  Verify_System_VPD_Properties
-	Verify Properties 	SYSTEM
+    Verify Properties     SYSTEM
 
 
 *** Keywords ***
 
-Setup The Suite
-	BMC Power On
 
-	@{ret} = 	Get Inventory List 	${OPENBMC_MODEL}
-	Set Suite Variable 	@{sys_inv} 	@{ret}
-	${resp} = 	Read Properties 	/org/openbmc/inventory/enumerate
-	Set Suite Variable 	${SYSTEM_INFO}  	${resp}
-	log Dictionary  	${resp}
+Setup The Suite
+    BMC Power On
+
+    ${resp} =     Read Properties     /org/openbmc/inventory/enumerate
+    Set Suite Variable     ${SYSTEM_INFO}      ${resp}
+    log Dictionary      ${resp}
 
 Get Total Present
-	[arguments] 	${type}
+    [arguments]     ${type}
+    ${l} =          Create List     []
+    ${resp} =    Get Dictionary Keys    ${SYSTEM_INFO}
+    ${list} =    Get Matches    ${resp}    regexp=^.*[0-9a-z_].${type}[0-9]*$
+    : FOR   ${element}      IN      @{list}
+    \       Append To List   ${l}   ${SYSTEM_INFO['${element}']['present']}
 
-	${l} =    	Create List  	[]
-	${list} = 	Get Inventory Fru Type List 	${OPENBMC_MODEL} 	${type}
-	: FOR 	${element} 	IN  	@{list}
-	\ 	Append To List 	 ${l}  	${SYSTEM_INFO['${element}']['present']}
-
-	${sum} = 	Get Count 	${l} 	True
-	[return] 	${sum}
+    ${sum} =        Get Count       ${l}    True
+    [return]        ${sum}
 
 Verify Properties
-	[arguments] 	${type}
+    [arguments]     ${type}
 
-	${list} = 	Get VPD Inventory List 	${OPENBMC_MODEL} 	${type}
-	: FOR 	${element} 	IN  	@{list}
-	\ 	${d} = 	Get From Dictionary 	${SYSTEM_INFO} 	${element}
-	\ 	Run Keyword If 	${d['present']} == True		Verify Present Properties 	${d} 	${type}
+    ${list} =     Get VPD Inventory List     ${OPENBMC_MODEL}     ${type}
+    : FOR     ${element}     IN      @{list}
+    \     ${d} =     Get From Dictionary     ${SYSTEM_INFO}     ${element}
+    \     Run Keyword If     ${d['present']} == True        Verify Present Properties     ${d}     ${type}
 
 Verify Present Properties
-	[arguments]	 ${d} 	${type}
-	${keys} = 	Get Dictionary Keys 	${d}
-	Log List 	${keys}
-	Log List 	${INVENTORY_ITEMS['${type}']}
-	Lists Should Be Equal  ${INVENTORY_ITEMS['${type}']} 	${keys}
+    [arguments]     ${d}     ${type}
+    ${keys} =     Get Dictionary Keys     ${d}
+    Log List     ${keys}
+    Log List     ${INVENTORY_ITEMS['${type}']}
+    Lists Should Be Equal  ${INVENTORY_ITEMS['${type}']}     ${keys}
diff --git a/tests/test_sensors.robot b/tests/test_sensors.robot
index 32c88fd..48bf97d 100644
--- a/tests/test_sensors.robot
+++ b/tests/test_sensors.robot
@@ -10,7 +10,7 @@
 Resource        ../lib/openbmc_ffdc.robot
 Library         ../data/model.py
 
-Suite Setup            Open Connection And Log In
+Suite setup            Setup The Suite
 Suite Teardown         Close All Connections
 Test Teardown          Log FFDC
 
@@ -29,7 +29,7 @@
     response Should Be Equal    " 01 40 40 0a 01"
 
 Execute Set Sensor boot count
-    ${uri} =    Set Variable    /org/openbmc/sensors/host/BootCount
+    ${uri} =    Get System component    BootCount
     ${x} =      Get Sensor Number   ${uri}
 
     Run IPMI command   0x04 0x30 ${x} 0x01 0x00 0x35 0x00 0x00 0x00 0x00 0x00 0x00
@@ -38,7 +38,7 @@
     Response Should Be Equal   ${val}
 
 Set Sensor Boot progress
-    ${uri} =    Set Variable    /org/openbmc/sensors/host/BootProgress
+    ${uri} =    Get System component    BootProgress
     ${x} =      Get Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0x00 0x04 0x00 0x00 0x00 0x00 0x14 0x00
@@ -46,7 +46,7 @@
     Response Should Be Equal    FW Progress, Baseboard Init
 
 Set Sensor Boot progress Longest string
-    ${uri} =    Set Variable    /org/openbmc/sensors/host/BootProgress
+    ${uri} =    Get System component    BootProgress
     ${x} =      Get Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0x00 0x04 0x00 0x00 0x00 0x00 0x0e 0x00
@@ -54,7 +54,7 @@
     Response Should Be Equal    FW Progress, Docking station attachment
 
 BootProgress sensor FW Hang unspecified Error
-    ${uri} =    Set Variable    /org/openbmc/sensors/host/BootProgress
+    ${uri} =    Get System component    BootProgress
     ${x} =      Get Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00
@@ -62,7 +62,7 @@
     Response Should Be Equal    FW Hang, Unspecified
 
 BootProgress fw hang state
-    ${uri} =    Set Variable    /org/openbmc/sensors/host/BootProgress
+    ${uri} =    Get System component    BootProgress
     ${x} =      Get Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00
@@ -70,7 +70,7 @@
     Response Should Be Equal    POST Error, unknown
 
 OperatingSystemStatus Sensor boot completed progress
-    ${uri} =    Set Variable    /org/openbmc/sensors/host/OperatingSystemStatus
+    ${uri} =    Get System component    OperatingSystemStatus
     ${x} =      Get Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00
@@ -78,7 +78,7 @@
     Response Should Be Equal    Boot completed (00)
 
 OperatingSystemStatus Sensor progress
-    ${uri} =    Set Variable    /org/openbmc/sensors/host/OperatingSystemStatus
+    ${uri} =    Get System component    OperatingSystemStatus
     ${x} =      Get Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0x00 0x00 0x04 0x00 0x00 0x00 0x00 0x20 0x00
@@ -86,7 +86,7 @@
     Response Should Be Equal    PXE boot completed
 
 OCC Active sensor on enabled
-    ${uri} =    Set Variable    /org/openbmc/sensors/host/cpu0/OccStatus
+    ${uri} =    Get System component    OccStatus
     ${x} =      Get Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x20 0x00
@@ -94,7 +94,7 @@
     Response Should Be Equal    Enabled
 
 OCC Active sensor on disabled
-    ${uri} =    Set Variable    /org/openbmc/sensors/host/cpu0/OccStatus
+    ${uri} =    Get System component    OccStatus
     ${x} =      Get Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00
@@ -102,71 +102,72 @@
     Response Should Be Equal    Disabled
 
 CPU Present
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/cpu0
+
+    ${uri} =    Get System component    cpu
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0x00 0x80 0x00 0x00 0x00 0x00 0x20 0x00
-    Read The Attribute   ${uri}    present
+    Read The Attribute  ${uri}    present
     Response Should Be Equal    True
 
 CPU not Present
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/cpu0
+    ${uri} =    Get System component    cpu
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0x00 0x00 0x00 0x80 0x00 0x00 0x20 0x00
-    Read The Attribute   ${uri}    present
+    Read The Attribute  ${uri}    present
     Response Should Be Equal    False
 
 CPU fault
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/cpu0
+    ${uri} =    Get System component    cpu
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0xff 0x00 0x01 0x00 0x00 0x00 0x20 0x00
-    Read The Attribute   ${uri}    fault
+    Read The Attribute  ${uri}    fault
     Response Should Be Equal    True
 
 CPU no fault
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/cpu0
+    ${uri} =    Get System component    cpu
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x20 0x00
-    Read The Attribute   ${uri}    fault
+    Read The Attribute  ${uri}    fault
     Response Should Be Equal    False
 
 core Present
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/cpu0/core11
+    ${uri} =    Get System component    core11
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0x00 0x80 0x00 0x00 0x00 0x00 0x20 0x00
-    Read The Attribute   ${uri}   present
+    Read The Attribute  ${uri}   present
     Response Should Be Equal    True
 
 core not Present
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/cpu0/core11
+    ${uri} =    Get System component    core11
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0x00 0x00 0x00 0x80 0x00 0x00 0x20 0x00
-    Read The Attribute   ${uri}   present
+    Read The Attribute  ${uri}   present
     Response Should Be Equal    False
 
 core fault
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/cpu0/core11
+    ${uri} =    Get System component    core11
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0xff 0x00 0x01 0x00 0x00 0x00 0x20 0x00
-    Read The Attribute   ${uri}    fault
+    Read The Attribute  ${uri}    fault
     Response Should Be Equal    True
 
 core no fault
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/cpu0/core11
+    ${uri} =    Get System component    core11
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x20 0x00
-    Read The Attribute   ${uri}    fault
+    Read The Attribute  ${uri}    fault
     Response Should Be Equal    False
 
 DIMM3 Present
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/dimm3
+    ${uri} =    Get System component    dimm3
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0x00 0x40 0x00 0x00 0x00 0x00 0x20 0x00
@@ -174,7 +175,7 @@
     Response Should Be Equal    True
 
 DIMM3 not Present
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/dimm3
+    ${uri} =    Get System component    dimm3
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0xff 0x00 0x00 0x40 0x00 0x00 0x20 0x00
@@ -182,7 +183,7 @@
     Response Should Be Equal    False
 
 DIMM0 fault
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/dimm0
+    ${uri} =    Get System component    dimm0
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0x00 0x00 0x10 0x00 0x00 0x00 0x00 0x20 0x00
@@ -190,7 +191,7 @@
     Response Should Be Equal    True
 
 DIMM0 no fault
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/dimm0
+    ${uri} =    Get System component    dimm0
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0x00 0x00 0x00 0x00 0x10 0x00 0x00 0x20 0x00
@@ -198,7 +199,7 @@
     Response Should Be Equal    False
 
 Centaur0 Present
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/membuf0
+    ${uri} =    Get System component    membuf
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0xa9 0x00 0x40 0x00 0x00 0x00 0x00 0x20 0x00
@@ -206,7 +207,7 @@
     Response Should Be Equal    True
 
 Centaur0 not Present
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/membuf0
+    ${uri} =    Get System component    membuf
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0x00 0x00 0x00 0x00 0x40 0x00 0x00 0x20 0x00
@@ -214,7 +215,7 @@
     Response Should Be Equal    False
 
 Centaur0 fault
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/membuf0
+    ${uri} =    Get System component    membuf
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0x00 0x00 0x10 0x00 0x00 0x00 0x00 0x20 0x00
@@ -222,7 +223,7 @@
     Response Should Be Equal    True
 
 Centaur0 no fault
-    ${uri} =    Set Variable    /org/openbmc/inventory/system/chassis/motherboard/membuf0
+    ${uri} =    Get System component    membuf
     ${x} =      Get Inventory Sensor Number   ${uri}
 
     Run IPMI command  0x04 0x30 ${x} 0x00 0x00 0x00 0x00 0x10 0x00 0x00 0x20 0x00
@@ -230,32 +231,51 @@
     Response Should Be Equal    False
 
 System Present
-    Read The Attribute   /org/openbmc/inventory/system    present
+    ${uri} =    Get System component    system
+    Read The Attribute   ${uri}    present
     Response Should Be Equal    True
-    
+ 
 System Fault
-    Read The Attribute   /org/openbmc/inventory/system    fault
+    ${uri} =    Get System component    system
+    Read The Attribute   ${uri}    fault
     Response Should Be Equal    False
-    
+
 Chassis Present
+    ${uri} =    Get System component    chassis
     Read The Attribute   /org/openbmc/inventory/system/chassis    present
     Response Should Be Equal    True
-    
+
 Chassis Fault
+    ${uri} =    Get System component    chassis
     Read The Attribute   /org/openbmc/inventory/system/chassis    fault
     Response Should Be Equal    False
-    
-io_board Present
-    Read The Attribute   /org/openbmc/inventory/system/chassis/io_board    present
-    Response Should Be Equal    True
-    
-io_board Fault
-    Read The Attribute   /org/openbmc/inventory/system/chassis/io_board    fault
-    Response Should Be Equal    False
-    
 
+io_board Present
+    ${uri} =    Get System component    io_board
+    Read The Attribute   ${uri}    present
+    Response Should Be Equal    True
+
+io_board Fault
+    ${uri} =    Get System component    io_board
+    Read The Attribute   ${uri}    fault
+    Response Should Be Equal    False
 
 *** Keywords ***
+
+Setup The Suite
+
+    Open Connection And Log In
+    ${resp} =       Read Properties         /org/openbmc/enumerate
+    Set Suite Variable      ${SYSTEM_INFO}          ${resp}
+    log Dictionary          ${resp}
+
+Get System component
+    [Arguments]    ${type}
+    ${list} =    Get Dictionary Keys    ${SYSTEM_INFO}
+    ${resp} =    Get Matches    ${list}    regexp=^.*[0-9a-z_].${type}[0-9]*$
+    ${url} =    Get From List    ${resp}    0
+    [return]    ${url}
+
 Execute new Command
     [arguments]    ${args}
     ${output}=  Execute Command    ${args}