Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetHealthReport commands #57494

Open
wants to merge 4 commits into
base: devel
from

Conversation

Projects
None yet
4 participants
@billdodd
Copy link
Contributor

commented Jun 6, 2019

SUMMARY

Per feature issue #54200, this PR adds GetHealthReport commands to the Systems, Chassis, and Manager categories.

The health information is retrieved from the Status property in each of the target resources. The target resources for each category are:

Systems: System, Processors, Memory, SimpleStorage, Storage, EthernetInterfaces, NetworkInterfaces (NetworkPorts and NetworkDeviceFunctions)
Chassis: Chassis, PowerSupplies, Fans, PCIeDevices
Manager: Manager

Fixes #54200

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

redfish_facts.py
redfish_utils.py

ADDITIONAL INFORMATION

Example playbook snippets showing how to invoke the new commands:

  - name: Get system health report
    redfish_facts:
      category: Systems
      command: GetHealthReport
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"

  - name: Get chassis health report
    redfish_facts:
      category: Chassis
      command: GetHealthReport
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"

  - name: Get manager health report
    redfish_facts:
      category: Manager
      command: GetHealthReport
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"

Example output for the Systems category:

{
    "ansible_facts": {
        "redfish_facts": {
            "health_report": {
                "entries": [
                    [
                        {   
                            "system_uri": "/redfish/v1/Systems/437XR1138R2"
                        },
                        {
                            "System": {
                                "Status": {
                                    "Health": "OK",
                                    "HealthRollup": "OK",
                                    "State": "Enabled"
                                }       
                            } 
                            "EthernetInterfaces": [
                                {   
                                    "Status": {
                                        "Health": "OK",
                                        "State": "Enabled"
                                    },
                                    "ethernetinterface_uri": "/redfish/v1/Systems/437XR1138R2/EthernetInterfaces/12446A3B0411"
                                },
                                {   
                                    "Status": {
                                        "Health": "OK",
                                        "State": "Enabled"
                                    },
                                    "ethernetinterface_uri": "/redfish/v1/Systems/437XR1138R2/EthernetInterfaces/12446A3B8890"
                                }
                            ],
                            "Memory": [
                                {   
                                    "Status": {
                                        "Health": "OK",
                                        "State": "Enabled"
                                    },
                                    "memory_uri": "/redfish/v1/Systems/437XR1138R2/Memory/DIMM1"
                                },
                                {   
                                    "Status": {
                                        "Health": "OK",
                                        "State": "Enabled"
                                    },
                                    "memory_uri": "/redfish/v1/Systems/437XR1138R2/Memory/DIMM2"
                                },
                                {
                                    "Status": {
                                        "Health": "OK",
                                        "State": "Enabled"
                                    },
                                    "memory_uri": "/redfish/v1/Systems/437XR1138R2/Memory/DIMM3"
                                },
                                {
                                    "Status": {
                                        "State": "Absent"
                                    },
                                    "memory_uri": "/redfish/v1/Systems/437XR1138R2/Memory/DIMM4"
                                }
                            ],
                            "Processors": [
                                {
                                    "Status": {
                                        "Health": "OK",
                                        "State": "Enabled"
                                    },
                                    "processor_uri": "/redfish/v1/Systems/437XR1138R2/Processors/CPU1"
                                },
                                {
                                    "Status": {
                                        "State": "Absent"
                                    },
                                    "processor_uri": "/redfish/v1/Systems/437XR1138R2/Processors/CPU2"
                                }
                            ],
                            "Storage": [
                                {
                                    "Status": {
                                        "Health": "OK",
                                        "HealthRollup": "OK",
                                        "State": "Enabled"
                                    },
                                    "storage_uri": "/redfish/v1/Systems/437XR1138R2/Storage/1"
                                }
                            ],
                        }           
                    ]           
                ],              
                "ret": true         
            }                           
        }                               
    },                              
    "changed": false,               
    "failed": false             
}

Example output for the Chassis category:

{               
    "ansible_facts": { 
        "redfish_facts": {
            "health_report": {
                "entries": [
                    [
                        {
                            "chassis_uri": "/redfish/v1/Chassis/1U"
                        },
                        {
                            "Chassis": {
                                "Status": {
                                    "Health": "OK",
                                    "State": "Enabled"
                                }   
                            },  
                            "Fans": [
                                {
                                    "Status": {
                                        "Health": "OK",
                                        "State": "Enabled"
                                    },  
                                    "fan_uri": "/redfish/v1/Chassis/1U/Thermal#/Fans/0"
                                },  
                                {
                                    "Status": {
                                        "Health": "OK",
                                        "State": "Enabled"
                                    },  
                                    "fan_uri": "/redfish/v1/Chassis/1U/Thermal#/Fans/1"
                                }   
                            ],  
                            "PCIeDevices": [
                                {
                                    "Status": {
                                        "Health": "OK",
                                        "HealthRollup": "OK",
                                        "State": "Enabled"
                                    },
                                    "pciedevice_uri": "/redfish/v1/Systems/1/PCIeDevices/NIC"
                                }
                            ],
                            "PowerSupplies": [
                                {   
                                    "Status": {
                                        "Health": "Warning",
                                        "State": "Enabled"
                                    },
                                    "powersupply_uri": "/redfish/v1/Chassis/1U/Power#/PowerSupplies/0"
                                }
                            ]       
                        }               
                    ]                   
                ],                  
                "ret": true         
            }                   
        }                       
    },                              
    "changed": false,                   
    "failed": false                     
}

Example output for the Manager category:

{
    "ansible_facts": {
        "redfish_facts": {
            "health_report": {
                "entries": [
                    [
                        {
                            "manager_uri": "/redfish/v1/Managers/Switch1"
                        },
                        {
                            "Manager": {
                                "Status": {
                                    "Health": "OK",
                                    "State": "Enabled"
                                }
                            }
                        }
                    ],
                    [
                        {
                            "manager_uri": "/redfish/v1/Managers/Switch2"
                        },
                        {
                            "Manager": {
                                "Status": {
                                    "Health": "OK",
                                    "State": "Enabled"
                                }
                            }
                        }
                    ]
                ],
                "ret": true
            }
        }
    },
    "changed": false,
    "failed": false
}
@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2019

@billdodd billdodd changed the title add GetHealthReport commands Add GetHealthReport commands Jun 6, 2019

@billdodd

This comment has been minimized.

Copy link
Contributor Author

commented Jun 6, 2019

@ansibot ansibot removed the needs_triage label Jun 6, 2019

@samerhaj

This comment has been minimized.

Copy link

commented Jun 11, 2019

Looks good. One nit: Why some of the instance properties are singular (like manager_uri) and the rest are plural (like fans_uri, pciedevices_uri, systems_uri, etc..).

Shouldn't they all be singular (referencing a specific instance, not a collection)?

@billdodd

This comment has been minimized.

Copy link
Contributor Author

commented Jun 11, 2019

Looks good. One nit: Why some of the instance properties are singular (like manager_uri) and the rest are plural (like fans_uri, pciedevices_uri, systems_uri, etc..).

Shouldn't they all be singular (referencing a specific instance, not a collection)?

Good catch. I updated to make those URI keys singular.

@ansibot ansibot added the stale_ci label Jun 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.