def get_pmdu_power_meter (patch = dict ()):
    if (not patch):
        view_helper.run_pre_check (pre_check.pre_check_function_call,
            command_name_enum.get_rm_state)
    
    query = [
        (controls.manage_powermeter.get_rack_power_limit_policy, {}),
        (controls.manage_powermeter.get_rack_power_throttle_status, {}),
        (controls.manage_powermeter.get_rack_power_reading, {}),
        (controls.manage_powermeter.get_rack_pru_fw_version, {})
    ]
    result = execute_get_request_queries (query)
    
    if ("Feed1PowerStatus" in result):
        if (result["Feed1PowerStatus"] == "Healthy"):
            result["Feed1PowerStatus"] = ""
    if ("Feed2PowerStatus" in result):
        if (result["Feed2PowerStatus"] == "Healthy"):
            result["Feed2PowerStatus"] = ""
    if ("IsDcThrottleEnabled" in result):
        result["IsDcThrottleEnabled"] = enums.Boolean (result["IsDcThrottleEnabled"],
            convert = True)
    if ("IsDcThrottleActive" in result):
        result["IsDcThrottleActive"] = enums.Boolean (result["IsDcThrottleActive"], convert = True)
    if ("IsAlertEnabled" in result):
        result["IsAlertEnabled"] = enums.Boolean (result["IsAlertEnabled"], convert = True)
    if ("IsAlertActive" in result):
        result["IsAlertActive"] = enums.Boolean (result["IsAlertActive"], convert = True)
    
    view_helper.update_and_replace_status_information (result, patch)
    return view_helper.return_redfish_resource ("pmdu_power_meter", values = result)
def get_system_bios_config (system, patch = dict ()):
    system = int (system)
    if (not patch):
        view_helper.run_pre_check (pre_check.pre_check_function_call,
            command_name_enum.get_blade_state, device_id = system)
    
    query = [
        (controls.bladebios_lib.get_server_bios_config, {"serverid" : system})
    ]
    
    result = execute_get_request_queries (query, {"ID" : system})
    
    configs = []
    if ("AvailableConfigName" in result):
        configs.append ({"Config_Name" : result["AvailableConfigName"]})
    else:
        config_list = result.get ("AvailableConfigurations", {})
        if (config_list):
            i = 1
            while i in config_list:
                configs.append (config_list[i])
                i += 1
    result["AvailableConfigs"] = configs
    
    view_helper.update_and_replace_status_information (result, patch)
    return view_helper.return_redfish_resource ("system_bios_cfg", values = result)
Esempio n. 3
0
def get_bmc_networkprotocol(slot_id, patch=dict()):
    pre_check_slot_id(slot_id)
    query = [(controls.manage_bmc.show_bmc_hostname, {}),
             (controls.manage_bmc.get_bmc_slot_id, {})]
    result = execute_get_request_queries(query)
    view_helper.update_and_replace_status_information(result, patch)
    return view_helper.return_redfish_resource("bmc_networkprotocol",
                                               values=result)
Esempio n. 4
0
def get_bmc(slot_id, patch=dict()):
    pre_check_slot_id(slot_id)
    query = [(controls.manage_fwversion.get_ocsfwversion, {}),
             (controls.manage_bmc.show_bmc_time, {
                 "edm": True
             }), (controls.manage_bmc.get_bmc_slot_id, {})]

    result = execute_get_request_queries(query)
    view_helper.update_and_replace_status_information(result, patch)
    return view_helper.return_redfish_resource("bmc", values=result)
Esempio n. 5
0
def get_chassis(slot_id, patch=dict()):
    pre_check_slot_id(slot_id)

    query = [(controls.manage_bmc.get_bmc_slot_id, {}),
             (controls.manage_bmc.get_bmc_attention_led_status, {}),
             (controls.chassis_system.get_chassis_power_state, {}),
             (controls.chassis_system.get_chassis_fru, {})]
    result = execute_get_request_queries(query)

    view_helper.update_and_replace_status_information(result, patch)

    return view_helper.return_redfish_resource("chassis", values=result)
Esempio n. 6
0
def get_account(account, patch=dict()):
    if (not patch):
        view_helper.verify_account_name(account)
        pre_check_function_call(command_name_enum.get_rm_state)

    query = [(controls.manage_user.get_groupname_from_username, {
        "username": account
    })]

    result = execute_get_request_queries(query, {"Account": account})

    view_helper.update_and_replace_status_information(result, patch)
    return view_helper.return_redfish_resource("account", values=result)
def get_system (system, patch = dict ()):
    system = int (system)
    if (not patch):
        view_helper.run_pre_check (pre_check.pre_check_function_call,
            command_name_enum.get_blade_state, device_id = system)
    
    query = [
        (controls.bladeinfo_lib.system_info_call, {"bladeId" : system}),
        (controls.bladepowerstate_lib.get_server_default_powerstate, {"serverid" : system}),
        (controls.bladetpmphypresence_lib.get_tpm_physical_presence, {"serverid" : system}),
        (controls.bladenextboot_lib.get_nextboot, {"serverid" : system})
    ]
    
    result = view_helper.flatten_nested_objects (
        execute_get_request_queries (query, {"ID" : system}))
    
    for health in ["Server_Status_HealthRollUp", "Server_Status_Health",
        "Server_ProcessorSummary_Status_HealthRollUp", "Server_ProcessorSummary_Status_Health",
        "Server_MemorySummary_Status_HealthRollUp", "Server_MemorySummary_Status_Health"]:
        if (health in result):
            result[health] = enums.Health (result[health], convert = True)
            
    for state in ["Server_Status_State", "Server_ProcessorSummary_Status_State",
        "Server_MemorySummary_Status_State"]:
        if (state in result):
            result[state] = enums.State (result[state], convert = True)
            
    for state in ["Sever_PowerState", "Default_Power_State"]:
        if (state in result):
            result[state] = enums.PowerState (result[state], convert = True)
    
    if ("BootSourceOverrideTarget" in result):
        result["BootSourceOverrideTarget"] = enums.BootSourceOverrideTarget (
            result["BootSourceOverrideTarget"], convert = True)
    if ("BootSourceOverrideMode" in result):
        result["bootSourceOverrideMode"] = enums.BootSourceOverrideMode (
            result["BootSourceOverrideMode"], convert = True)
    if ("PhysicalPresence" in result):
        result["PhysicalPresence"] = enums.Boolean (result["PhysicalPresence"], convert = True)
        
    if (result.get ("BootSourceOverrideTarget", "") == enums.BootSourceOverrideTarget.NONE):
        result["BootSourceOverrideEnabled"] = enums.BootSourceOverrideEnabled (
            enums.BootSourceOverrideEnabled.DISABLED)
    else:
        if ("BootSourceOverrideEnabled" in result):
            result["BootSourceOverrideEnabled"] = enums.BootSourceOverrideEnabled (
                result["BootSourceOverrideEnabled"], convert = True)
    
    view_helper.update_and_replace_status_information (result, patch)
    return view_helper.return_redfish_resource ("system", values = result)
def get_system_power (system, patch = dict ()):
    system = int (system)
    if (not patch):
        view_helper.run_pre_check (pre_check.pre_check_function_call,
            command_name_enum.get_blade_state, device_id = system)
    
    query = [
        (controls.manage_ocspower.get_server_power_limit, {"serverid" : system}),
        (controls.manage_ocspower.get_server_power_reading, {"serverid" : system}),
        (controls.manage_ocspower.get_server_default_power_limit, {"serverid" : system}),
        (controls.manage_ocspower.get_server_psu_alert, {"serverid" : system}),
        (controls.manage_ocspower.get_server_psu_status, {"serverid" : system}),
        (controls.manage_ocspower.get_server_psu_fw_version, {"serverid" : system}),
        (controls.manage_ocspower.get_server_psu_bootloader_version, {"serverid" : system})
    ]
    
    result = execute_get_request_queries (query, {"ID" : system})
    
    for key in ["StaticLimit", "PowerReadingWatts", "MinPowerReadingWatts", "MaxPowerReadingWatts",
        "AvgPowerReadingWatts", "SamplingPeriodSeconds", "PowerLimit", "ThrottleDuration", "LimitDelay"]:
        if (key in result):
            result[key] = parameters.remove_non_numeric (str(result[key]))
    
    for key in ["Alert_Enabled", "AutoProchot", "BladeProchot", "Balancing", "External_Power",
        "Pre_charge_Circuit", "Discharge", "Charge", "Charging", "Discharging", "Initialized"]:
        if (key in result):
            result[key] = enums.Boolean (result[key], convert = True)
            
    for key in ["Pin", "Vin", "Pout"]:
        if (key in result):
            result[key] = result[key][:-1]
    
    if ("StaticState" in result):
        result["StaticState"] = enums.State (result["StaticState"], convert = True)
    if ("SamplingPeriodSeconds" in result):
        result["SamplingPeriodSeconds"] = int (result["SamplingPeriodSeconds"]) / 60
    if ("AlertAction" in result):
        result["AlertAction"] = enums.AlertAction (result["AlertAction"], convert = True)
    if ("Faults" in result):
        if (not result["Faults"]):
            result["Health"] = "OK"
        else:
            result["Health"] = "Warning"

    view_helper.update_and_replace_status_information (result, patch)
    return view_helper.return_redfish_resource ("system_power", values = result)
def get_account (account, patch = dict()):
    if (not patch):
        parameters.verify_account_name (account)
        view_helper.run_pre_check (pre_check.pre_check_function_call,
            command_name_enum.get_rm_state)
    
    query = [
        (controls.manage_user.get_groupname_from_username, {"username": account})
    ]
    
    result = execute_get_request_queries (query, {"Account" : account})
    
    if (result.get ("groupname", "") == "unknown user"):
        raise HTTPError (status = 404)
    
    view_helper.update_and_replace_status_information (result, patch)
    return view_helper.return_redfish_resource ("account", values = result)
Esempio n. 10
0
def get_relay_control (relay, patch = dict ()):
    if (not patch):
        view_helper.run_pre_check (pre_check.pre_check_function_call,
            command_name_enum.get_rm_state)
    
    relay = int (relay)
    query = [
        (controls.manage_powerport.powerport_get_port_status, {"port_type" : "relay",
            "port_id" : relay})
    ]
    result = execute_get_request_queries (query, init_values = {"ID" : relay})
    
    if ("Relay" in result):
        result["Relay"] = enums.PowerState (result["Relay"], convert = True)
    
    view_helper.update_and_replace_status_information (result, patch)
    return view_helper.return_redfish_resource ("power_control_relay", values = result)
Esempio n. 11
0
def get_rack_manager_chassis (patch = dict ()):
    if (not patch):
        view_helper.run_pre_check (pre_check.pre_check_function_call,
            command_name_enum.get_rm_state)
    
    query = [
        (controls.manage_rack_manager.get_rack_manager_attention_led_status, {}),
        (controls.manage_rack_manager.read_fru, {"boardtype" : "rm_mb"})
    ]
    
    result = execute_get_request_queries (query)
        
    if ("Manager_LED_Status" in result):
        result["Manager_LED_Status"] = str (enums.IndicatorLED (
            result["Manager_LED_Status"], convert = True))
    
    view_helper.update_and_replace_status_information (result, patch)
    return view_helper.return_redfish_resource ("rack_manager_chassis", values = result)
Esempio n. 12
0
def get_system_chassis (system, patch = dict ()):
    system = int (system)
    if (not patch):
        view_helper.run_pre_check (pre_check.pre_check_function_call,
            command_name_enum.get_blade_state, device_id = system)
    
    query = [
        (controls.bladeinfo_lib.system_info_call, {"bladeId" : system})
    ]
    
    result = view_helper.flatten_nested_objects (
        execute_get_request_queries (query, {"ID" : system}))
    
    if ("Server_IndicatorLED" in result):
        result["Server_IndicatorLED"] = str (
            enums.IndicatorLED (result["Server_IndicatorLED"], convert = True))
    
    view_helper.update_and_replace_status_information (result, patch)
    return view_helper.return_redfish_resource ("system_chassis", values = result)
Esempio n. 13
0
def get_pdu_control (port, patch = dict ()):
    if (not patch):
        view_helper.run_pre_check (pre_check.pre_check_function_call,
            command_name_enum.get_rm_state)
    
    port = int (port)
    query = [
        (controls.manage_powerport.powerport_get_port_presence, {"port_type" : "pdu",
            "port_id" : port}),
        (controls.manage_powerport.powerport_get_port_status, {"port_type" : "pdu",
            "port_id" : port})
    ]
    result = execute_get_request_queries (query, init_values = {"ID" : port})
    
    if ("Port_Presence" in result):
        result["Port_Presence"] = enums.Boolean (result["Port_Presence"], convert = True)
    if ("Port_State" in result):
        result["Port_State"] = enums.PowerState (result["Port_State"], convert = True)
    
    view_helper.update_and_replace_status_information (result, patch)
    return view_helper.return_redfish_resource ("power_control_pdu", values = result)
Esempio n. 14
0
def get_rack_manager_ethernet (eth, patch = dict ()):
    if (not patch):
        view_helper.run_pre_check (pre_check.pre_check_function_call,
            command_name_enum.get_rm_state)
    
    query = [
        (controls.manage_network.get_network_mac_address, {"if_name" : eth}),
        (controls.manage_network.get_network_ip_address, {"if_name" : eth}),
        (controls.manage_network.get_network_subnetmask, {"if_name" : eth}),
        (controls.manage_network.get_network_ip_address_origin, {"if_name" : eth}),
        (controls.manage_network.get_network_status, {"if_name" : eth})
    ]
    if (eth == "eth0"):
        query.append ((controls.manage_network.get_network_gateway, {}))
    else:
        query.append ((controls.manage_network.get_management_network, {}))
    
    result = execute_get_request_queries (query)
        
    if ("InterfaceStatus" in result):
        result["InterfaceState"] = enums.State (result["InterfaceStatus"], convert = True)
        result["InterfaceStatus"] = enums.Boolean (result["InterfaceStatus"], convert = True)
        
    if ("AddressOrigin" in result):
        result["AddressOrigin"] = enums.AddressOrigin (result["AddressOrigin"], convert = True)
        
    if ("Management_Network" in result):
        result["Management_Network"] = result["Management_Network"].netmask
        
    for key in ["IPAddress", "SubnetMask", "Gateway"]:
        if ((key in result) and (not result[key])):
            del result[key]
    
    result["Intf"] = eth
    result["Description"] = ("Datacenter" if (eth == "eth0") else "Management") + " Network Connection"
    result["InterfaceHealth"] = enums.Health ("OK")

    view_helper.update_and_replace_status_information (result, patch)
    return view_helper.return_redfish_resource ("rack_manager_ethernet", values = result)
Esempio n. 15
0
def get_system_fpga (system, patch = dict ()):
    system = int (system)
    if (not patch):
        view_helper.run_pre_check (pre_check.pre_check_function_call,
            command_name_enum.get_blade_state, device_id = system)
    
    result = controls.manage_fpga.get_fpga_i2c_version (system)
    if ((not patch) and
        (result.get (completion_code.cc_key, completion_code.failure) != completion_code.success)):
        view_helper.raise_status_response (500, view_helper.create_response_with_status (result))
        
    query = [
        (controls.manage_fpga.get_fpga_bypass_mode, {"serverid" : system}),
        (controls.manage_fpga.get_fpga_health, {"serverid" : system}),
        (controls.manage_fpga.get_fpga_assetinfo, {"serverid" : system}),
        (controls.manage_fpga.get_fpga_temp, {"serverid" : system})
    ]
    
    result["ID"] = system
    result = view_helper.remove_key_leading_number(execute_get_request_queries (query, result))
    
    for link in ["PCIe_HIP_0_Up", "PCIe_HIP_1_Up", "_40G_Link_0_Up", "_40G_Link_1_Up"]:
        if (link in result):
            result[link] = enums.LinkState (result[link], convert = True)
            
    for act in ["_40G_Link_0_Tx_Activity", "_40G_Link_1_Tx_Activity", "_40G_Link_0_Rx_Activity",
        "_40G_Link_1_Rx_Activity"]:
        if (act in result):
            result[act] = enums.Boolean (result[act], convert = True)
            
    if ("Bypass_Mode" in result):
        result["Bypass_Mode"] = enums.BypassMode (result["Bypass_Mode"], convert = True)
    if ("User_Logic_Network" in result):
        result["User_Logic_Network"] = enums.UserLogic (result["User_Logic_Network"],
            convert = True)

    view_helper.update_and_replace_status_information (result, patch)
    return view_helper.return_redfish_resource ("system_fpga", values = result)
Esempio n. 16
0
def get_bmc_ethernet(slot_id, eth, patch=dict()):
    pre_check_slot_id(slot_id)
    query = [(controls.manage_network.get_network_mac_address, {
        "if_name": eth
    }), (controls.manage_network.get_network_ip_address, {
        "if_name": eth
    }), (controls.manage_network.get_network_subnetmask, {
        "if_name": eth
    }), (controls.manage_network.get_network_gateway, {}),
             (controls.manage_network.get_network_status, {
                 "if_name": eth
             }), (controls.manage_bmc.get_bmc_slot_id, {})]
    result = execute_get_request_queries(query)
    if ("InterfaceStatus" in result):
        result["InterfaceStatus"] = str(
            enums.State(str(result["InterfaceStatus"]), convert=True))

    result["Intf"] = eth
    result["Description"] = ("Datacenter" if (eth == "eth0") else
                             "Management") + " Network Connection"

    view_helper.update_and_replace_status_information(result, patch)
    return view_helper.return_redfish_resource("bmc_ethernet", values=result)
Esempio n. 17
0
def get_rack_manager (patch = dict ()):
    if (not patch):
        view_helper.run_pre_check (pre_check.pre_check_function_call,
            command_name_enum.get_rm_state)
    
    query = [
        (controls.manage_rack_manager.show_rack_manager_hostname, {}),
        (controls.manage_fwversion.get_ocsfwversion, {}),
        (controls.manage_rack_manager.manager_tftp_server_status, {}),
        (controls.manage_rack_manager.manager_nfs_server_status, {}),
        (controls.manage_rack_manager.get_rack_manager_ntp_status, {}),
        (controls.manage_rack_manager.get_rack_manager_itp_status, {}),
        (controls.manage_rack_manager.get_rack_manager_ntp_server, {}),
        (controls.manage_rack_manager.get_manager_throttle_local_bypass, {}),
        (controls.manage_rack_manager.get_manager_throttle_output_enable, {}),
        (controls.manage_rack_manager.show_rack_manager_time, {"edm" : True}),
        (controls.manage_rack_manager.get_rm_uptime, {})
    ]
    if (pre_check.get_mode () == rm_mode_enum.rowmanager):
        query.append ((controls.manage_rack_manager.get_row_throttle_bypass, {}))
        query.append ((controls.manage_rack_manager.get_row_throttle_output_enable, {}))
    
    result = execute_get_request_queries (query)
    
    for key in ["TFTPStatus", "NFSStatus", "NTPState", "ITPState"]:
        if (key in result):
            result[key] = enums.ServiceStatus (result[key], convert = True)
        
    for key in ["TFTPService", "NFSService", "NTPService", "ITPService", "Local_Bypass",
        "Row_Bypass", "Local_Enable", "Row_Enable"]:
        if (key in result):
            result[key] = enums.Boolean (result[key], convert = True)
            
    view_helper.update_and_replace_status_information (result, patch)
        
    return view_helper.return_redfish_resource ("rack_manager", values = result)