<commit_before>*** Settings ***
Documentation     Utilities for power management tests.

Resource          ../lib/rest_client.robot
Resource          ../lib/openbmc_ffdc.robot
Resource          ../lib/boot_utils.robot
Resource          ../lib/ipmi_client.robot
Library           ../lib/var_funcs.py


*** Keywords ***

DCMI Power Get Limits
    [Documentation]  Run dcmi power get_limit and return values as a
    ...  dictionary.
<commit_msg>Add lib keyword to get system power limit<commit_after>*** Settings ***
Documentation     Utilities for power management tests.

Resource          ../lib/rest_client.robot
Resource          ../lib/openbmc_ffdc.robot
Resource          ../lib/boot_utils.robot
Resource          ../lib/ipmi_client.robot
Library           ../lib/var_funcs.py

*** Variables ***

${power_cap_uri}    /redfish/v1/Chassis/${CHASSIS_ID}/EnvironmentMetrics

*** Keywords ***

Get System Power Cap Limit
    [Documentation]  Get the allowed MAX and MIN power limit of the chassis.

    # GET request of /redfish/v1/Chassis/chassis/EnvironmentMetrics  | grep -A5 Power
    #   "PowerLimitWatts": {
    #       "AllowableMax": 2488,
    #       "AllowableMin": 1778,
    #       "ControlMode": "Disabled",
    #       "SetPoint": 2488
    # }

    ${power_limit_watts}=  Redfish.Get Attribute  ${power_cap_uri}   PowerLimitWatts

    [return]  ${power_limit_watts}


DCMI Power Get Limits
    [Documentation]  Run dcmi power get_limit and return values as a
    ...  dictionary.

{'fraction_non_alphanumeric': 0.10910307898259705, 'fraction_numerical': 0.010040160642570281, 'mean_word_length': 2.542654028436019, 'pattern_counts': {'":': 5, '<': 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': '2857640', 'n_tokens_mistral': 474, 'n_tokens_neox': 456, 'n_words': 118}