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
pull/46528/head
Xander Madsen 6 years ago committed by Adam Miller
parent 15d39f9108
commit 1e415899ad

@ -833,7 +833,7 @@ class RedfishUtils(object):
result["entries"] = cpu_results result["entries"] = cpu_results
return result return result
def get_nic_inventory(self): def get_nic_inventory(self, resource_type):
result = {} result = {}
nic_list = [] nic_list = []
nic_results = [] nic_results = []
@ -843,8 +843,13 @@ class RedfishUtils(object):
'NameServers', 'PermanentMACAddress', 'SpeedMbps', 'MTUSize', 'NameServers', 'PermanentMACAddress', 'SpeedMbps', 'MTUSize',
'AutoNeg', 'Status'] 'AutoNeg', 'Status']
# Search for 'key' entry and extract URI from it # Given resource_type, use the proper URI
response = self.get_request(self.root_uri + self.systems_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: if response['ret'] is False:
return response return response
result['ret'] = True result['ret'] = True

@ -92,6 +92,14 @@ EXAMPLES = '''
username: "{{ username }}" username: "{{ username }}"
password: "{{ password }}" 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 - name: Get all information available in the Manager category
redfish_facts: redfish_facts:
category: Manager category: Manager
@ -127,7 +135,7 @@ CATEGORY_COMMANDS_ALL = {
"Chassis": ["GetFanInventory"], "Chassis": ["GetFanInventory"],
"Accounts": ["ListUsers"], "Accounts": ["ListUsers"],
"Update": ["GetFirmwareInventory"], "Update": ["GetFirmwareInventory"],
"Manager": ["GetManagerAttributes", "GetLogs"], "Manager": ["GetManagerAttributes", "GetManagerNicInventory", "GetLogs"],
} }
CATEGORY_COMMANDS_DEFAULT = { CATEGORY_COMMANDS_DEFAULT = {
@ -208,7 +216,7 @@ def main():
elif command == "GetCpuInventory": elif command == "GetCpuInventory":
result["cpu"] = rf_utils.get_cpu_inventory() result["cpu"] = rf_utils.get_cpu_inventory()
elif command == "GetNicInventory": elif command == "GetNicInventory":
result["nic"] = rf_utils.get_nic_inventory() result["nic"] = rf_utils.get_nic_inventory(category)
elif command == "GetStorageControllerInventory": elif command == "GetStorageControllerInventory":
result["storage_controller"] = rf_utils.get_storage_controller_inventory() result["storage_controller"] = rf_utils.get_storage_controller_inventory()
elif command == "GetDiskInventory": elif command == "GetDiskInventory":
@ -257,6 +265,8 @@ def main():
for command in command_list: for command in command_list:
if command == "GetManagerAttributes": if command == "GetManagerAttributes":
result["manager_attributes"] = rf_utils.get_manager_attributes() 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": elif command == "GetLogs":
result["log"] = rf_utils.get_logs() result["log"] = rf_utils.get_logs()

Loading…
Cancel
Save