Adding Channel checkstop through OS testcase
Inject Channel checkstop through OS and check if
the gard records are present after error injection.
Resolves openbmc/openbmc-test-automation#413
Change-Id: Idf223cce020a32836e0aa803cc5043a1dddd44c3
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/lib/ras/host_utils.robot b/lib/ras/host_utils.robot
index 769e185..1d332ee 100644
--- a/lib/ras/host_utils.robot
+++ b/lib/ras/host_utils.robot
@@ -7,10 +7,11 @@
*** Keywords ***
Getscom Operations On OS
- [Documentation] Executes getscom command on OS
- ... with the given input command.
+ [Documentation] Executes getscom command on OS with the given
+ ... input command.
[Arguments] ${input_cmd}
- #input_cmd -l|--list-chips
+ # Description of arguments:
+ # input_cmd -l|--list-chips
# -c|--chip <chip-id> <addr>
${output} ${stderr}= Execute Command getscom ${input_cmd}
@@ -19,10 +20,11 @@
[Return] ${output}
Gard Operations On OS
- [Documentation] Executes opal-gard command on OS
- ... with the given input command.
+ [Documentation] Executes opal-gard command on OS with the given
+ ... input command.
[Arguments] ${input_cmd}
- #input_cmd list/clear all/show <gard_record_id>
+ # Description of arguments:
+ # input_cmd list/clear all/show <gard_record_id>
${output} ${stderr}= Execute Command opal-gard ${input_cmd}
... return_stderr=True
@@ -30,12 +32,30 @@
[Return] ${output}
Putscom Through OS
- [Documentation] Executes putscom command on OS
- ... with the given input arguments.
- [Arguments] ${chip_id} ${fru} ${address}
- #chip_id processor ID
- #fru FRU value
- #address chip address
+ [Documentation] Executes putscom command on OS with the given
+ ... input arguments.
+ [Arguments] ${chip_id} ${fru} ${address}
+ # Description of arguments:
+ # chip_id processor ID (e.g 00000000).
+ # fru FRU value (e.g. 2011400).
+ # address chip address (e.g 4000000000000000).
${cmd}= Catenate putscom -c 0x${chip_id} 0x${fru} 0x${address}
Start Command ${cmd}
+
+Get Cores Values From OS
+ [Documentation] Check if cores present on HOST OS & return core values.
+ ${cmd}= Catenate cat /sys/firmware/opal/msglog|grep -i chip|grep -i core
+ ${output}= Execute Command ${cmd}
+ Should Not Be Empty ${output}
+ [Return] ${output}
+
+Get ChipID From OS
+ [Documentation] Get chip ID values based on the input.
+ [Arguments] ${chip_type}
+ # Description of arguments:
+ # chip_type The chip type (Processor/Centaur).
+
+ ${cmd}= Catenate -l | grep -i ${chip_type} | cut -c1-8
+ ${chip_id}= Getscom Operations On OS ${cmd}
+ [Return] ${chip_id}
diff --git a/lib/utils.robot b/lib/utils.robot
index 6cfb9d5..09f98f7 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -708,7 +708,7 @@
Get Auto Reboot
[Documentation] Returns auto reboot setting.
- ${setting}= Read Attribute ${HOST_SETTING} auto_reboot
+ ${setting}= Read Attribute ${HOST_SETTINGS} auto_reboot
[Return] ${setting}
@@ -719,7 +719,7 @@
${valueDict}= Set Variable ${setting}
${data}= Create Dictionary data=${valueDict}
- Write Attribute ${HOST_SETTING} auto_reboot data=${data}
+ Write Attribute ${HOST_SETTINGS} auto_reboot data=${data}
${current_setting}= Get Auto Reboot
Should Be Equal ${current_setting} ${setting}
@@ -754,6 +754,7 @@
Should Be Empty ${stderr}
[Return] ${stdout}
+
Enable Core Dump On BMC
[Documentation] Enable core dump collection.
Open Connection And Log In
@@ -810,7 +811,8 @@
... Wait for OS ${os_host} ${os_username} ${os_password}
Open Connection ${os_host}
- Login ${os_username} ${os_password}
+ ${resp}= Login ${os_username} ${os_password}
+ [Return] ${resp}
Configure Initial Settings
[Documentation] Restore old IP and route.
diff --git a/tests/test_ras.robot b/tests/test_ras.robot
new file mode 100644
index 0000000..e641517
--- /dev/null
+++ b/tests/test_ras.robot
@@ -0,0 +1,88 @@
+*** Settings ***
+Documentation This suite tests checkstop operations through OS.
+Resource ../lib/utils.robot
+Resource ../lib/openbmc_ffdc.robot
+Resource ../lib/ras/host_utils.robot
+Resource ../lib/resource.txt
+Resource ../lib/state_manager.robot
+Test Setup RAS Test Setup
+Test Teardown FFDC On Test Case Fail
+
+*** Variables ***
+${HOST_SETTINGS} ${SETTINGS_URI}host0
+
+*** Test Cases ***
+
+Verify Channel Checkstop Through OS With Auto Reboot
+
+ [Documentation] Verify Channel Checkstop (MBS FIR REG INT PROTOCOL ERROR)
+ ... through OS With Auto Reboot settings enabled.
+ [Tags] Verify_Channel_Checkstop_Through_OS_With_Auto_Reboot
+
+ Verify Checkstop Insertion With Auto Reboot
+ ... Centaur 2011400 4000000000000000
+
+*** Keywords ***
+Inject Checkstop Through OS
+ [Documentation] Inject checkstop on processor/centaur through OS.
+ ... Test sequence:
+ ... 1. Boot To OS
+ ... 2. Clear any existing gard records
+ ... 3. Inject Checkstop on processor/centaur
+ [Arguments] ${chip_type} ${fru} ${address}
+ # Description of arguments:
+ # chip_type The chip type (Processor/Centaur).
+ # fru FRU value (e.g. 2011400).
+ # address chip address (e.g 4000000000000000).
+
+
+ Login To OS Host ${OS_HOST} ${OS_USERNAME} ${OS_PASSWORD}
+ # Get core values are present through OS.
+ Get Cores Values From OS
+
+ Gard Operations On OS clear all
+
+ # Fetch Processor/Centaur chip value based on the input chip_type.
+ ${output}= Get ChipID From OS ${chip_type}
+ ${chip_values}= Split String ${output}
+ ${chip_value}= Get From List ${chip_values} 0
+
+ Putscom Through OS ${chip_value} ${fru} ${address}
+
+Verify And Clear Gard Records On OS
+ [Documentation] Verify And Clear gard records on OS.
+
+ Login To OS Host ${OS_HOST} ${OS_USERNAME} ${OS_PASSWORD}
+ ${output}= Gard Operations On OS list
+ Should Not Contain ${output} 'No GARD entries to display'
+ Gard Operations On OS clear all
+
+Verify Checkstop Insertion With Auto Reboot
+ [Documentation] Inject and verify checkstop on processor/centaur through
+ ... OS with auto reboot.
+ ... Test sequence:
+ ... 1. Enable Auto Reboot Setting
+ ... 2. Inject Checkstop on processor/centaur
+ ... 3. Check If HOST rebooted and OS is up
+ ... 4. Verify & clear gard records
+ [Arguments] ${chip_type} ${fru} ${address}
+ # Description of arguments:
+ # chip_type The chip type (Processor/Centaur).
+ # fru FRU value (e.g. 2011400).
+ # address chip address (e.g 4000000000000000).
+
+ Set Auto Reboot yes
+ Inject Checkstop Through OS ${chip_type} ${fru} ${address}
+ Wait Until Keyword Succeeds 120 sec 20 sec Is Host Rebooted
+ Wait for OS ${OS_HOST} ${OS_USERNAME} ${OS_PASSWORD}
+ Verify And Clear Gard Records On OS
+
+RAS Test SetUp
+ [Documentation] Validates input parameters.
+
+ Should Not Be Empty
+ ... ${OS_HOST} msg=You must provide DNS name/IP of the OS host.
+ Should Not Be Empty
+ ... ${OS_USERNAME} msg=You must provide OS host user name.
+ Should Not Be Empty
+ ... ${OS_PASSWORD} msg=You must provide OS host user password.