GetManagerNicInventory (#49961)
* Add GetManagerNicInventory command for Manager category, and tweak redfish_utils' get_nic_inventory to accommodate manager nic interfaces * Remove get_manager_nic_inventory, since it is unnecessary while using get_manager in get_nic_inventory * Rework get_nic_inventory() to take a resource_type as a string, which will be just the category parameter from redfish_facts, making it clearer * remove extraneous blank line to conform with pep8 * Add GetManagerNicInventory example task to EXAMPLES docstring
This commit is contained in:
parent
15d39f9108
commit
1e415899ad
2 changed files with 20 additions and 5 deletions
|
@ -833,7 +833,7 @@ class RedfishUtils(object):
|
|||
result["entries"] = cpu_results
|
||||
return result
|
||||
|
||||
def get_nic_inventory(self):
|
||||
def get_nic_inventory(self, resource_type):
|
||||
result = {}
|
||||
nic_list = []
|
||||
nic_results = []
|
||||
|
@ -843,8 +843,13 @@ class RedfishUtils(object):
|
|||
'NameServers', 'PermanentMACAddress', 'SpeedMbps', 'MTUSize',
|
||||
'AutoNeg', 'Status']
|
||||
|
||||
# Search for 'key' entry and extract URI from it
|
||||
response = self.get_request(self.root_uri + self.systems_uri)
|
||||
# Given resource_type, use the proper URI
|
||||
if resource_type == 'Systems':
|
||||
resource_uri = self.systems_uri
|
||||
elif resource_type == 'Manager':
|
||||
resource_uri = self.manager_uri
|
||||
|
||||
response = self.get_request(self.root_uri + resource_uri)
|
||||
if response['ret'] is False:
|
||||
return response
|
||||
result['ret'] = True
|
||||
|
|
|
@ -92,6 +92,14 @@ EXAMPLES = '''
|
|||
username: "{{ username }}"
|
||||
password: "{{ password }}"
|
||||
|
||||
- name: Get Manager NIC inventory information
|
||||
redfish_facts:
|
||||
category: Manager
|
||||
command: GetManagerNicInventory
|
||||
baseuri: "{{ baseuri }}"
|
||||
username: "{{ username }}"
|
||||
password: "{{ password }}"
|
||||
|
||||
- name: Get all information available in the Manager category
|
||||
redfish_facts:
|
||||
category: Manager
|
||||
|
@ -127,7 +135,7 @@ CATEGORY_COMMANDS_ALL = {
|
|||
"Chassis": ["GetFanInventory"],
|
||||
"Accounts": ["ListUsers"],
|
||||
"Update": ["GetFirmwareInventory"],
|
||||
"Manager": ["GetManagerAttributes", "GetLogs"],
|
||||
"Manager": ["GetManagerAttributes", "GetManagerNicInventory", "GetLogs"],
|
||||
}
|
||||
|
||||
CATEGORY_COMMANDS_DEFAULT = {
|
||||
|
@ -208,7 +216,7 @@ def main():
|
|||
elif command == "GetCpuInventory":
|
||||
result["cpu"] = rf_utils.get_cpu_inventory()
|
||||
elif command == "GetNicInventory":
|
||||
result["nic"] = rf_utils.get_nic_inventory()
|
||||
result["nic"] = rf_utils.get_nic_inventory(category)
|
||||
elif command == "GetStorageControllerInventory":
|
||||
result["storage_controller"] = rf_utils.get_storage_controller_inventory()
|
||||
elif command == "GetDiskInventory":
|
||||
|
@ -257,6 +265,8 @@ def main():
|
|||
for command in command_list:
|
||||
if command == "GetManagerAttributes":
|
||||
result["manager_attributes"] = rf_utils.get_manager_attributes()
|
||||
elif command == "GetManagerNicInventory":
|
||||
result["manager_nics"] = rf_utils.get_nic_inventory(resource_type=category)
|
||||
elif command == "GetLogs":
|
||||
result["log"] = rf_utils.get_logs()
|
||||
|
||||
|
|
Loading…
Reference in a new issue