Replace old power on with new interface

This change includes:
   - Replaced old power on interface with new xyz
   - Fixes inundation of spaces
   - Added tags to test cases

Resolves openbmc/openbmc-test-automation#355

Change-Id: I9608fbe3e063bed5cff70f9ebe5637aa38642915
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/test_lists/skip_test b/test_lists/skip_test
index 86fa3f1..34562bb 100644
--- a/test_lists/skip_test
+++ b/test_lists/skip_test
@@ -21,7 +21,7 @@
 #https://github.com/openbmc/openbmc-test-automation/issues/90
 -e Verify_System_VPD_Properties
 #https://github.com/openbmc/openbmc/issues/93
--e minimal_fan_inventory
+-e Minimal_Fan_Inventory
 #https://github.com/openbmc/openbmc-test-automation/issues/139
 -e Empty_Fan_Test
 #https://github.com/openbmc/openbmc/issues/612
diff --git a/test_lists/skip_test_palmetto b/test_lists/skip_test_palmetto
index 12eaaeb..b02a5a9 100644
--- a/test_lists/skip_test_palmetto
+++ b/test_lists/skip_test_palmetto
@@ -6,10 +6,10 @@
 #https://github.com/openbmc/openbmc/issues/539
 -e Test_Correct_Reservation_ID
 #https://github.com/openbmc/openbmc/issues/604
--e minimal_main_planar_inventory
+-e Minimal_Main_Planar_Inventory
 #https://github.com/openbmc/openbmc/issues/93
--e minimal_fan_inventory
--e minimal_system_inventory
+-e Minimal_Fan_Inventory
+-e Minimal_System_Inventory
 -e System_Present
 -e Chassis_Present
 #https://github.com/openbmc/openbmc/issues/612
@@ -23,7 +23,7 @@
 #https://github.com/openbmc/openbmc/issues/700
 -e DIMM0_fault
 -e DIMM0_no_fault
--e minimal_dimm_inventory
+-e Minimal_DIMM_Inventory
 -e Verify_DIMM_VPD_Properties
 #https://github.com/openbmc/openbmc/issues/740
 -e Test_BIOS_Version
diff --git a/test_lists/skip_test_witherspoon b/test_lists/skip_test_witherspoon
index 0f20579..cfb6a21 100644
--- a/test_lists/skip_test_witherspoon
+++ b/test_lists/skip_test_witherspoon
@@ -21,7 +21,7 @@
 #https://github.com/openbmc/openbmc-test-automation/issues/90
 -e Verify_System_VPD_Properties
 #https://github.com/openbmc/openbmc/issues/93
--e minimal_fan_inventory
+-e Minimal_Fan_Inventory
 #https://github.com/openbmc/openbmc-test-automation/issues/139
 -e Empty_Fan_Test
 #https://github.com/openbmc/openbmc/issues/612
diff --git a/tests/test_inventory.robot b/tests/test_inventory.robot
index 1907ceb..acee981 100644
--- a/tests/test_inventory.robot
+++ b/tests/test_inventory.robot
@@ -3,110 +3,121 @@
 Suite Teardown    Delete All Sessions
 Resource          ../lib/rest_client.robot
 Resource          ../lib/utils.robot
+Resource          ../lib/state_manager.robot
 Resource          ../lib/openbmc_ffdc.robot
-Resource          ../lib/boot/boot_resource_master.robot
 Library           ../lib/utilities.py
 Library           String
 Library           Collections
-Test Teardown     FFDC On Test Case Fail
 
 Variables         ../data/variables.py
 
-
-Suite setup        setup the suite
+Suite setup       Setup The Suite
+Test Teardown     FFDC On Test Case Fail
 
 Force Tags  chassisboot  inventory
 
 *** Test Cases ***
 
-minimal cpu inventory
-    ${count}=     Get Total Present     cpu
-    Should Be True     ${count}>${0}
+Minimal CPU Inventory
+    [Tags]  Minimal_CPU_Inventory
 
-minimal dimm inventory
-    [Tags]  minimal_dimm_inventory
+    ${count}=  Get Total Present  cpu
+    Should Be True  ${count}>${0}
 
-    ${count}=     Get Total Present     dimm
-    Should Be True     ${count}>=${2}
+Minimal DIMM Inventory
+    [Tags]  Minimal DIMM Inventory
 
-minimal core inventory
-    ${count}=     Get Total Present     core
-    Should Be True     ${count}>${0}
+    ${count}=  Get Total Present  dimm
+    Should Be True  ${count}>=${2}
 
-minimal memory buffer inventory
-    [Tags]    minimal_memory_buffer_inventory
+Minimal Core Inventory
+    [Tags]  Minimal_Core_Inventory
 
-    ${count}=     Get Total Present     membuf
-    Should Be True     ${count}>${0}
+    ${count}=  Get Total Present  core
+    Should Be True  ${count}>${0}
 
-minimal fan inventory
-    [Tags]  minimal_fan_inventory
-    ${count}=     Get Total Present     fan
-    Should Be True     ${count}>${2}
+Minimal Memory Buffer Inventory
+    [Tags]  Minimal_Memory_Buffer_Inventory
 
-minimal main planar inventory
-    [Tags]    minimal_main_planar_inventory
+    ${count}=  Get Total Present  membuf
+    Should Be True  ${count}>${0}
 
-    ${count}=     Get Total Present     motherboard
-    Should Be True     ${count}>${0}
+Minimal Fan Inventory
+    [Tags]  Minimal_Fan_Inventory
 
-minimal system inventory
-    [Tags]    minimal_system_inventory
+    ${count}=  Get Total Present  fan
+    Should Be True  ${count}>${2}
 
-    ${count}=     Get Total Present     system
-    Should Be True     ${count}>${0}
+Minimal Main Planar Inventory
+    [Tags]  Minimal_Main_Planar_Inventory
+
+    ${count}=  Get Total Present  motherboard
+    Should Be True  ${count}>${0}
+
+Minimal System Inventory
+    [Tags]  Minimal_System_Inventory
+
+    ${count}=  Get Total Present  system
+    Should Be True  ${count}>${0}
 
 Verify CPU VPD Properties
-    Verify Properties     CPU
+    [Tags]  Verify_CPU_VPD_Properties
+
+    Verify Properties  CPU
 
 Verify DIMM VPD Properties
-    [Tags]    Verify_DIMM_VPD_Properties
+    [Tags]  Verify_DIMM_VPD_Properties
 
-    Verify Properties     DIMM
+    Verify Properties  DIMM
 
 Verify Memory Buffer VPD Properties
-    Verify Properties     MEMORY_BUFFER
+    [Tags]  Verify_Memory_Buffer_VPD_Properties
+
+    Verify Properties  MEMORY_BUFFER
 
 Verify Fan VPD Properties
-    Verify Properties     FAN
+    [Tags]  Verify_Fan_VPD_Properties
+
+    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
+    ${host_state}=  Get Host State
+    Run Keyword If  '${host_state}' == 'Off'  Initiate Host Boot
 
-    ${resp}=     Read Properties   ${INVENTORY_URI}enumerate
-    Set Suite Variable     ${SYSTEM_INFO}      ${resp}
-    log Dictionary      ${resp}
+    ${resp}=  Read Properties  ${INVENTORY_URI}enumerate
+    Set Suite Variable  ${SYSTEM_INFO}  ${resp}
+    Log Dictionary  ${resp}
 
 Get Total Present
-    [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']}
+    [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']}
 
-    ${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}