<commit_before>*** Settings ***

Documentation    Module to test IPMI Get BIOS POST Code Command.
Resource         ../lib/ipmi_client.robot
Resource         ../lib/boot_utils.robot
Library          ../lib/ipmi_utils.py
Variables        ../data/ipmi_raw_cmd_table.py

*** Variables ***
${power_state_change}  10
${host_reboot_time}  240

*** Test Cases ***

IPMI Chassis Status On
    [Documentation]  This test case verfies system power on status
    ...               using IPMI Get Chassis status command.
    [Tags]  IPMI_Chassis_Status_On

    # Check the chassis status.
    Verify Host PowerOn Via IPMI
    ${resp}=  Run IPMI Standard Command  chassis power status
    Should Be Equal As Strings  '${resp}'  'Chassis Power is on'

Test Get BIOS POST Code via IPMI Raw Command
    [Documentation]  Get BIOS POST Code via IPMI raw command.
    [Tags]  Test_Get_BIOS_POST_Code_via_IPMI_Raw_Command

    ${resp}=  Run IPMI Standard Command  raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]}
    Sleep  10

    Verify POST Code Response Length  ${resp}

Test Get BIOS POST Code via IPMI Raw Command After Power Cycle
    [Documentation]  Get BIOS POST Code via IPMI raw command after power cycle.
    [Tags]  Test_Get_BIOS_POST_Code_via_IPMI_Raw_Command_After_Power_Cycle

    ${resp}=  Run IPMI Standard Command  raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]}
    Sleep  ${host_reboot_time}

    Verify POST Code Response Length  ${resp}

Test Get BIOS POST Code via IPMI Raw Command With Host Powered Off
    [Documentation]  Get BIOS POST Code via IPMI raw command after power off.
    [Tags]  Test_Get_BIOS_POST_Code_via_IPMI_Raw_Command_With_Host_Powered_Off

    ${resp}=  Run IPMI Standard Command  chassis power off
    Sleep  ${power_state_change}
    Should Contain  ${resp}  Chassis Power Control: Down/Off

    ${resp}=  Run IPMI Standard Command  raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]}
    Should Contain  ${resp}  ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][3]}

*** Keywords ***

Verify Host PowerOn Via IPMI
    [Documentation]   Verify host power on operation using external IPMI command.<commit_msg>Add Power Cycle for IPMI Get BIOS POST Code command<commit_after>*** Settings ***

Documentation    Module to test IPMI Get BIOS POST Code Command.
Resource         ../lib/ipmi_client.robot
Resource         ../lib/boot_utils.robot
Library          ../lib/ipmi_utils.py
Variables        ../data/ipmi_raw_cmd_table.py

*** Variables ***
${power_state_change}  10
${host_reboot_time}  360

*** Test Cases ***

IPMI Chassis Status On
    [Documentation]  This test case verfies system power on status
    ...               using IPMI Get Chassis status command.
    [Tags]  IPMI_Chassis_Status_On

    # Check the chassis status.
    Verify Host PowerOn Via IPMI
    ${resp}=  Run IPMI Standard Command  chassis power status
    Should Be Equal As Strings  '${resp}'  'Chassis Power is on'

Test Get BIOS POST Code via IPMI Raw Command
    [Documentation]  Get BIOS POST Code via IPMI raw command.
    [Tags]  Test_Get_BIOS_POST_Code_via_IPMI_Raw_Command

    ${resp}=  Run IPMI Standard Command  raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]}
    Sleep  10

    Verify POST Code Response Length  ${resp}

Test Get BIOS POST Code via IPMI Raw Command After Power Cycle
    [Documentation]  Get BIOS POST Code via IPMI raw command after power cycle.
    [Tags]  Test_Get_BIOS_POST_Code_via_IPMI_Raw_Command_After_Power_Cycle

    ${resp}=  Run IPMI Standard Command  chassis power cycle
    Sleep  ${power_state_change}
    Should Contain  ${resp}  Chassis Power Control: Cycle
    sleep  ${host_reboot_time}
    ${ipmi_state}=  Get Host State Via External IPMI
    Valid Value  ipmi_state  ['on']

    ${resp}=  Run IPMI Standard Command  raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]}
    Sleep  ${host_reboot_time}

    Verify POST Code Response Length  ${resp}

Test Get BIOS POST Code via IPMI Raw Command With Host Powered Off
    [Documentation]  Get BIOS POST Code via IPMI raw command after power off.
    [Tags]  Test_Get_BIOS_POST_Code_via_IPMI_Raw_Command_With_Host_Powered_Off

    ${resp}=  Run IPMI Standard Command  chassis power off
    Sleep  ${power_state_change}
    Should Contain  ${resp}  Chassis Power Control: Down/Off

    ${resp}=  Run IPMI Standard Command  raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]}
    Should Contain  ${resp}  ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][3]}

    # Turn host back on.
    IPMI Power On  stack_mode=skip  quiet=1
    Verify Host PowerOn Via IPMI
    ${resp}=  Run IPMI Standard Command  chassis power status
    Should Be Equal As Strings  '${resp}'  'Chassis Power is on'

*** Keywords ***

Verify Host PowerOn Via IPMI
    [Documentation]   Verify host power on operation using external IPMI command.
{'fraction_non_alphanumeric': 0.08338557993730407, 'fraction_numerical': 0.004806687565308255, 'mean_word_length': 3.5451092117758782, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7538140', 'n_tokens_mistral': 1591, 'n_tokens_neox': 1503, 'n_words': 514}