Merge "Changes to NIC info retrieving logic"
This commit is contained in:
commit
fee73044e7
|
@ -357,9 +357,14 @@ class IloClient(operations.IloOperations):
|
||||||
data = self.ribcl.get_host_health_data()
|
data = self.ribcl.get_host_health_data()
|
||||||
gpu = self.ribcl._get_number_of_gpu_devices_connected(data)
|
gpu = self.ribcl._get_number_of_gpu_devices_connected(data)
|
||||||
capabilities.update(gpu)
|
capabilities.update(gpu)
|
||||||
|
major_minor = self.ris.get_ilo_firmware_version_as_major_minor()
|
||||||
else:
|
else:
|
||||||
capabilities = self.ribcl.get_server_capabilities()
|
capabilities = self.ribcl.get_server_capabilities()
|
||||||
nic_capacity = ipmi.get_nic_capacity(self.info)
|
major_minor = self.ribcl.get_ilo_firmware_version_as_major_minor()
|
||||||
|
if any(major_minor):
|
||||||
|
nic_capacity = ipmi.get_nic_capacity(self.info, major_minor)
|
||||||
|
else:
|
||||||
|
nic_capacity = None
|
||||||
if nic_capacity:
|
if nic_capacity:
|
||||||
capabilities.update({'nic_capacity': nic_capacity})
|
capabilities.update({'nic_capacity': nic_capacity})
|
||||||
if capabilities:
|
if capabilities:
|
||||||
|
|
|
@ -25,6 +25,9 @@ DRIVER.
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
MIN_SUGGESTED_FW_REV = 2.3
|
||||||
|
DEFAULT_FW_REV = 2.1
|
||||||
|
|
||||||
|
|
||||||
def _exec_ipmitool(driver_info, command):
|
def _exec_ipmitool(driver_info, command):
|
||||||
"""Execute the ipmitool command.
|
"""Execute the ipmitool command.
|
||||||
|
@ -50,7 +53,33 @@ def _exec_ipmitool(driver_info, command):
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
def get_nic_capacity(driver_info):
|
def get_ilo_version(ilo_fw_tup):
|
||||||
|
"""Gets the float value of the firmware version
|
||||||
|
|
||||||
|
Converts a tuple with major and minor numbers to a float value.
|
||||||
|
|
||||||
|
:param ilo_fw_tup: Tuple containing the major and minor versions
|
||||||
|
:returns: float value constructed from major and minor numbers.
|
||||||
|
"""
|
||||||
|
|
||||||
|
fw_rev = None
|
||||||
|
if not any(ilo_fw_tup):
|
||||||
|
return None
|
||||||
|
|
||||||
|
try:
|
||||||
|
(major, minor) = ilo_fw_tup
|
||||||
|
if all(ilo_fw_tup):
|
||||||
|
fw_rev = float('.'.join(str(m) for m in ilo_fw_tup))
|
||||||
|
elif minor:
|
||||||
|
fw_rev = float('.'.join(["0", str(minor)]))
|
||||||
|
else:
|
||||||
|
fw_rev = float('.'.join([str(major), "0"]))
|
||||||
|
except Exception:
|
||||||
|
return None
|
||||||
|
return fw_rev
|
||||||
|
|
||||||
|
|
||||||
|
def get_nic_capacity(driver_info, ilo_fw):
|
||||||
"""Gets the FRU data to see if it is NIC data
|
"""Gets the FRU data to see if it is NIC data
|
||||||
|
|
||||||
Gets the FRU data in loop from 0-255 FRU Ids
|
Gets the FRU data in loop from 0-255 FRU Ids
|
||||||
|
@ -60,18 +89,35 @@ def get_nic_capacity(driver_info):
|
||||||
|
|
||||||
:param driver_info: Contains the access credentials to access
|
:param driver_info: Contains the access credentials to access
|
||||||
the BMC.
|
the BMC.
|
||||||
|
:param ilo_fw: a tuple containing major and minor versions of firmware
|
||||||
:returns: the max capacity supported by the NIC adapter.
|
:returns: the max capacity supported by the NIC adapter.
|
||||||
"""
|
"""
|
||||||
i = 0
|
i = 0x0
|
||||||
value = None
|
value = None
|
||||||
while i < 255:
|
ilo_fw_rev = get_ilo_version(ilo_fw) or DEFAULT_FW_REV
|
||||||
cmd = "fru print %s" % hex(i)
|
|
||||||
|
if ilo_fw_rev < MIN_SUGGESTED_FW_REV:
|
||||||
|
for i in range(0xff):
|
||||||
|
# Note(vmud213): We can discard FRU ID's between 0x6e and 0xee
|
||||||
|
# as they don't contain any NIC related information
|
||||||
|
if (i < 0x6e) or (i > 0xee):
|
||||||
|
cmd = "fru print %s" % hex(i)
|
||||||
|
out = _exec_ipmitool(driver_info, cmd)
|
||||||
|
if out and 'port' in out and 'Adapter' in out:
|
||||||
|
value = _parse_ipmi_nic_capacity(out)
|
||||||
|
if value is not None:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
cmd = "fru print"
|
||||||
out = _exec_ipmitool(driver_info, cmd)
|
out = _exec_ipmitool(driver_info, cmd)
|
||||||
if out and 'port' in out and 'Adapter' in out:
|
if out:
|
||||||
value = _parse_ipmi_nic_capacity(out)
|
for line in out.split('\n'):
|
||||||
if value is not None:
|
if line and 'port' in line and 'Adapter' in line:
|
||||||
break
|
value = _parse_ipmi_nic_capacity(line)
|
||||||
i = i + 1
|
if value is not None:
|
||||||
|
break
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1011,6 +1011,36 @@ class RIBCLOperations(operations.IloOperations):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def get_ilo_firmware_version_as_major_minor(self):
|
||||||
|
"""Gets the ilo firmware version for server capabilities
|
||||||
|
|
||||||
|
Parse the get_host_health_data() to retreive the firmware
|
||||||
|
details.
|
||||||
|
|
||||||
|
:param data: the output returned by get_host_health_data()
|
||||||
|
:returns: a tuple of major and minor versions of iLO firmware.
|
||||||
|
|
||||||
|
"""
|
||||||
|
data = self.get_host_health_data()
|
||||||
|
firmware_details = self._get_firmware_embedded_health(data)
|
||||||
|
if firmware_details:
|
||||||
|
try:
|
||||||
|
# Note(vmud213):This logic works only for released
|
||||||
|
# versions. For debug iLO firmware versions this logic
|
||||||
|
# may not work as the format of the string differs.
|
||||||
|
# Formats of the strings:
|
||||||
|
# Release version -> "2.50 Feb 18 2016"
|
||||||
|
# Debug version -> "iLO 4 v2.50"
|
||||||
|
# TODO(vmud213) Make changes to account for debug version.
|
||||||
|
ilo_version_str = firmware_details['iLO']
|
||||||
|
version_str = ilo_version_str.split()[0]
|
||||||
|
major, minor = version_str.split('.')
|
||||||
|
return (major, minor)
|
||||||
|
except Exception:
|
||||||
|
return (None, None)
|
||||||
|
else:
|
||||||
|
return (None, None)
|
||||||
|
|
||||||
def _get_number_of_gpu_devices_connected(self, data):
|
def _get_number_of_gpu_devices_connected(self, data):
|
||||||
"""Gets the number of GPU devices connected to the server
|
"""Gets the number of GPU devices connected to the server
|
||||||
|
|
||||||
|
|
|
@ -947,6 +947,24 @@ class RISOperations(operations.IloOperations):
|
||||||
ilo_firmware_version = manager['Firmware']['Current']['VersionString']
|
ilo_firmware_version = manager['Firmware']['Current']['VersionString']
|
||||||
return {'ilo_firmware_version': ilo_firmware_version}
|
return {'ilo_firmware_version': ilo_firmware_version}
|
||||||
|
|
||||||
|
def get_ilo_firmware_version_as_major_minor(self):
|
||||||
|
"""Gets the ilo firmware version for server capabilities
|
||||||
|
|
||||||
|
:returns: a tuple of major and minor versions of iLO firmware.
|
||||||
|
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
manager, reset_uri = self._get_ilo_details()
|
||||||
|
ilo_fw_maj = (
|
||||||
|
manager['Oem']['Hp']['Firmware']['Current']['MajorVersion']
|
||||||
|
)
|
||||||
|
ilo_fw_min = (
|
||||||
|
manager['Oem']['Hp']['Firmware']['Current']['MinorVersion']
|
||||||
|
)
|
||||||
|
return (ilo_fw_maj, ilo_fw_min)
|
||||||
|
except Exception:
|
||||||
|
return (None, None)
|
||||||
|
|
||||||
def get_server_capabilities(self):
|
def get_server_capabilities(self):
|
||||||
"""Gets server properties which can be used for scheduling
|
"""Gets server properties which can be used for scheduling
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
"""Test Utils for iLO test modules."""
|
"""Test Utils for iLO test modules."""
|
||||||
|
|
||||||
NIC_FRU_OUT = (
|
NIC_FRU_OUT = (
|
||||||
|
@ -53,3 +54,54 @@ NIC_FRU_OUT_NO_PRODUCT_NAME = (
|
||||||
"Product Part Number : 629135-B21\n"
|
"Product Part Number : 629135-B21\n"
|
||||||
"Product Version : 00\n"
|
"Product Version : 00\n"
|
||||||
"Product Serial : CN84170RX5")
|
"Product Serial : CN84170RX5")
|
||||||
|
|
||||||
|
NIC_FRU_OUT_ALL = (
|
||||||
|
"FRU Device Description : Builtin FRU Device (ID 0)"
|
||||||
|
"Chassis Type : Rack Mount Chassis"
|
||||||
|
"Chassis Serial : 2M24500B4F"
|
||||||
|
"Board Mfg Date : Sat Mar 26 00:00:00 2005"
|
||||||
|
"Board Mfg : HP"
|
||||||
|
"Board Product : ProLiant DL180 Gen9"
|
||||||
|
"Board Serial : 2M24500B4F"
|
||||||
|
"Board Part Number : 754524-B21"
|
||||||
|
"Product Manufacturer : HP"
|
||||||
|
"Product Name : ProLiant DL180 Gen9"
|
||||||
|
"Product Part Number : 754524-B21"
|
||||||
|
"Product Serial : 2M24500B4F"
|
||||||
|
|
||||||
|
"FRU Device Description : BMC CONTROLLER (ID 238)"
|
||||||
|
"Product Manufacturer : HP"
|
||||||
|
"Product Name : BMC CONTROLLER"
|
||||||
|
"Product Part Number : iLO 4"
|
||||||
|
|
||||||
|
"FRU Device Description : MB BIOS (ID 239)"
|
||||||
|
"Product Manufacturer : HP"
|
||||||
|
"Product Name : SYSTEM BIOS"
|
||||||
|
"Product Part Number : U20"
|
||||||
|
"Product Version : 11/03/2014"
|
||||||
|
"Board Mfg Date : Mon Apr 28 23:16:00 2014\n"
|
||||||
|
"Board Mfg : HP\n"
|
||||||
|
"Board Product : HP Ethernet 1Gb 4-port 331FLR Adapter\n"
|
||||||
|
"Board Serial : CN84170RX5\n"
|
||||||
|
"Board Part Number : 634025-001\n"
|
||||||
|
"Board Extra : d23041\n"
|
||||||
|
"Board Extra : d5629133b001\n"
|
||||||
|
"Product Manufacturer : HP\n"
|
||||||
|
"Product Part Number : 629135-B21\n"
|
||||||
|
"Product Version : 00\n"
|
||||||
|
"Product Serial : CN84170RX5"
|
||||||
|
|
||||||
|
"FRU Device Description : CPU 1 (ID 16)"
|
||||||
|
"Product Manufacturer : Intel(R) Corporation"
|
||||||
|
"Product Name : Intel(R) Xeon(R) CPU E5-2603 v3 @ 1.60GHz"
|
||||||
|
|
||||||
|
"FRU Device Description : CPU 1 DIMM 6 (ID 110)"
|
||||||
|
"Device not present (Command response could not be provided)"
|
||||||
|
|
||||||
|
"FRU Device Description : CPU 1 DIMM 8 (ID 111)"
|
||||||
|
"Device not present (Command response could not be provided)")
|
||||||
|
|
||||||
|
|
||||||
|
LESSER_THAN_MIN_SUGGESTED_FW_TUP = (2, 25)
|
||||||
|
MIN_SUGGESTED_FW_TUP = (2, 30)
|
||||||
|
GREATER_THAN_MIN_SUGGESTED_FW_TUP = (2, 35)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -537,6 +537,224 @@ GET_MANAGER_DETAILS = """
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
GET_MANAGER_DETAILS_NO_FIRMWARE = """
|
||||||
|
{
|
||||||
|
"AvailableActions":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"Action": "Reset"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"CommandShell":
|
||||||
|
{
|
||||||
|
"ConnectTypesSupported":
|
||||||
|
[
|
||||||
|
"SSH",
|
||||||
|
"Oem"
|
||||||
|
],
|
||||||
|
"Enabled": true,
|
||||||
|
"MaxConcurrentSessions": 9
|
||||||
|
},
|
||||||
|
"Description": "Manager View",
|
||||||
|
"Firmware":
|
||||||
|
{
|
||||||
|
"Current":
|
||||||
|
{
|
||||||
|
"VersionString": "iLO 4 v2.20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"GraphicalConsole":
|
||||||
|
{
|
||||||
|
"ConnectTypesSupported":
|
||||||
|
[
|
||||||
|
"KVMIP"
|
||||||
|
],
|
||||||
|
"Enabled": true,
|
||||||
|
"MaxConcurrentSessions": 10
|
||||||
|
},
|
||||||
|
"ManagerType": "BMC",
|
||||||
|
"Model": "iLO 4",
|
||||||
|
"Name": "Manager",
|
||||||
|
"Oem":
|
||||||
|
{
|
||||||
|
"Hp":
|
||||||
|
{
|
||||||
|
"AvailableActions":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"Action": "ResetRestApiState",
|
||||||
|
"Capabilities":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"AllowableValues":
|
||||||
|
[
|
||||||
|
"/Oem/Hp"
|
||||||
|
],
|
||||||
|
"PropertyName": "Target"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"FederationConfig":
|
||||||
|
{
|
||||||
|
"IPv6MulticastScope": "Site",
|
||||||
|
"MulticastAnnouncementInterval": 600,
|
||||||
|
"MulticastDiscovery": "Enabled",
|
||||||
|
"MulticastTimeToLive": 5,
|
||||||
|
"iLOFederationManagement": "Enabled"
|
||||||
|
},
|
||||||
|
"Firmware":
|
||||||
|
{
|
||||||
|
"Current":
|
||||||
|
{
|
||||||
|
"Date": "Feb 09 2015",
|
||||||
|
"DebugBuild": false,
|
||||||
|
"MinorVersion": 20,
|
||||||
|
"Time": "",
|
||||||
|
"VersionString": "iLO 4 v2.20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"License":
|
||||||
|
{
|
||||||
|
"LicenseKey": "32Q6W-PQWTB-H7XYL-39968-RR53R",
|
||||||
|
"LicenseString": "iLO 4 Advanced",
|
||||||
|
"LicenseType": "Perpetual"
|
||||||
|
},
|
||||||
|
"RequiredLoginForiLORBSU": false,
|
||||||
|
"SerialCLISpeed": 9600,
|
||||||
|
"SerialCLIStatus": "EnabledAuthReq",
|
||||||
|
"Type": "HpiLO.0.13.0",
|
||||||
|
"VSPLogDownloadEnabled": false,
|
||||||
|
"iLOSelfTestResults":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"Notes": "",
|
||||||
|
"SelfTestName": "NVRAMData",
|
||||||
|
"Status": "OK"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Notes": "Controller firmware revision 2.09.00 ",
|
||||||
|
"SelfTestName": "EmbeddedFlash/SDCard",
|
||||||
|
"Status": "OK"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Notes": "",
|
||||||
|
"SelfTestName": "EEPROM",
|
||||||
|
"Status": "OK"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Notes": "",
|
||||||
|
"SelfTestName": "HostRom",
|
||||||
|
"Status": "OK"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Notes": "",
|
||||||
|
"SelfTestName": "SupportedHost",
|
||||||
|
"Status": "OK"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Notes": "ProLiant BL460c Gen9 System Programmable \
|
||||||
|
Logic Device version 0x13",
|
||||||
|
"SelfTestName": "CPLDPAL0",
|
||||||
|
"Status": "Informational"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Notes": "ProLiant BL460c Gen9 SAS Programmable \
|
||||||
|
Logic Device version 0x01",
|
||||||
|
"SelfTestName": "CPLDPAL1",
|
||||||
|
"Status": "Informational"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"links":
|
||||||
|
{
|
||||||
|
"ActiveHealthSystem":
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Managers/1/ActiveHealthSystem"
|
||||||
|
},
|
||||||
|
"DateTimeService":
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Managers/1/DateTime"
|
||||||
|
},
|
||||||
|
"EmbeddedMediaService":
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Managers/1/EmbeddedMedia"
|
||||||
|
},
|
||||||
|
"FederationDispatch":
|
||||||
|
{
|
||||||
|
"extref": "/dispatch"
|
||||||
|
},
|
||||||
|
"FederationGroups":
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Managers/1/FederationGroups"
|
||||||
|
},
|
||||||
|
"FederationPeers":
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Managers/1/FederationPeers"
|
||||||
|
},
|
||||||
|
"LicenseService":
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Managers/1/LicenseService"
|
||||||
|
},
|
||||||
|
"UpdateService":
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Managers/1/UpdateService"
|
||||||
|
},
|
||||||
|
"VSPLogLocation":
|
||||||
|
{
|
||||||
|
"extref": "/sol.log.gz"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"SerialConsole":
|
||||||
|
{
|
||||||
|
"ConnectTypesSupported":
|
||||||
|
[
|
||||||
|
"SSH",
|
||||||
|
"IPMI",
|
||||||
|
"Oem"
|
||||||
|
],
|
||||||
|
"Enabled": true,
|
||||||
|
"MaxConcurrentSessions": 13
|
||||||
|
},
|
||||||
|
"Status":
|
||||||
|
{
|
||||||
|
"State": "Enabled"
|
||||||
|
},
|
||||||
|
"Type": "Manager.0.10.0",
|
||||||
|
"UUID": "83590768-e977-575a-927a-b3de8f692d4f",
|
||||||
|
"links":
|
||||||
|
{
|
||||||
|
"EthernetNICs":
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Managers/1/NICs"
|
||||||
|
},
|
||||||
|
"Logs":
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Managers/1/Logs"
|
||||||
|
},
|
||||||
|
"ManagerForServers":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Systems/1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"NetworkService":
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Managers/1/NetworkService"
|
||||||
|
},
|
||||||
|
"VirtualMedia":
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Managers/1/VirtualMedia"
|
||||||
|
},
|
||||||
|
"self":
|
||||||
|
{
|
||||||
|
"href": "/rest/v1/Managers/1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
GET_BIOS_SETTINGS = """
|
GET_BIOS_SETTINGS = """
|
||||||
{
|
{
|
||||||
|
|
|
@ -265,55 +265,83 @@ class IloClientTestCase(testtools.TestCase):
|
||||||
'fake-data')
|
'fake-data')
|
||||||
|
|
||||||
@mock.patch.object(ipmi, 'get_nic_capacity')
|
@mock.patch.object(ipmi, 'get_nic_capacity')
|
||||||
|
@mock.patch.object(ribcl.RIBCLOperations,
|
||||||
|
'get_ilo_firmware_version_as_major_minor')
|
||||||
@mock.patch.object(ribcl.RIBCLOperations, 'get_server_capabilities')
|
@mock.patch.object(ribcl.RIBCLOperations, 'get_server_capabilities')
|
||||||
def test_get_server_capabilities(self, cap_mock, nic_mock):
|
def test_get_server_capabilities(self, cap_mock, maj_min_mock, nic_mock):
|
||||||
info = {'address': "1.2.3.4", 'username': "admin", 'password': "Admin"}
|
info = {'address': "1.2.3.4", 'username': "admin", 'password': "Admin"}
|
||||||
|
tup_val = maj_min_mock.return_value = (u'2', u'10',)
|
||||||
nic_mock.return_value = '10Gb'
|
nic_mock.return_value = '10Gb'
|
||||||
cap_mock.return_value = {'ilo_firmware_version': '2.10',
|
cap_mock.return_value = {'ilo_firmware_version': '2.10',
|
||||||
'rom_firmware_version': 'x',
|
'rom_firmware_version': 'x',
|
||||||
'server_model': 'Gen8',
|
'server_model': 'Gen8',
|
||||||
'pci_gpu_devices': '2'}
|
'pci_gpu_devices': '2'}
|
||||||
capabilities = self.client.get_server_capabilities()
|
capabilities = self.client.get_server_capabilities()
|
||||||
cap_mock.assert_called_once_with()
|
|
||||||
nic_mock.assert_called_once_with(self.client.info)
|
|
||||||
expected_capabilities = {'ilo_firmware_version': '2.10',
|
expected_capabilities = {'ilo_firmware_version': '2.10',
|
||||||
'rom_firmware_version': 'x',
|
'rom_firmware_version': 'x',
|
||||||
'server_model': 'Gen8',
|
'server_model': 'Gen8',
|
||||||
'pci_gpu_devices': '2',
|
'pci_gpu_devices': '2',
|
||||||
'nic_capacity': '10Gb'}
|
'nic_capacity': '10Gb'}
|
||||||
|
cap_mock.assert_called_once_with()
|
||||||
|
nic_mock.assert_called_once_with(self.client.info, tup_val)
|
||||||
self.assertEqual(expected_capabilities, capabilities)
|
self.assertEqual(expected_capabilities, capabilities)
|
||||||
self.assertEqual(info, self.client.info)
|
self.assertEqual(info, self.client.info)
|
||||||
|
|
||||||
@mock.patch.object(ipmi, 'get_nic_capacity')
|
@mock.patch.object(ipmi, 'get_nic_capacity')
|
||||||
|
@mock.patch.object(ribcl.RIBCLOperations,
|
||||||
|
'get_ilo_firmware_version_as_major_minor')
|
||||||
@mock.patch.object(ribcl.RIBCLOperations, 'get_server_capabilities')
|
@mock.patch.object(ribcl.RIBCLOperations, 'get_server_capabilities')
|
||||||
def test_get_server_capabilities_no_nic(self, cap_mock, nic_mock):
|
def test_get_server_capabilities_no_nic(self, cap_mock, maj_min_mock,
|
||||||
|
nic_mock):
|
||||||
info = {'address': "1.2.3.4", 'username': "admin", 'password': "Admin"}
|
info = {'address': "1.2.3.4", 'username': "admin", 'password': "Admin"}
|
||||||
|
tup_val = maj_min_mock.return_value = (u'2', u'10',)
|
||||||
nic_mock.return_value = None
|
nic_mock.return_value = None
|
||||||
cap_mock.return_value = {'ilo_firmware_version': '2.10',
|
cap_mock.return_value = {'ilo_firmware_version': '2.10',
|
||||||
'rom_firmware_version': 'x',
|
'rom_firmware_version': 'x',
|
||||||
'server_model': 'Gen8',
|
'server_model': 'Gen8',
|
||||||
'pci_gpu_devices': '2'}
|
'pci_gpu_devices': '2'}
|
||||||
capabilities = self.client.get_server_capabilities()
|
capabilities = self.client.get_server_capabilities()
|
||||||
cap_mock.assert_called_once_with()
|
|
||||||
nic_mock.assert_called_once_with(self.client.info)
|
|
||||||
expected_capabilities = {'ilo_firmware_version': '2.10',
|
expected_capabilities = {'ilo_firmware_version': '2.10',
|
||||||
'rom_firmware_version': 'x',
|
'rom_firmware_version': 'x',
|
||||||
'server_model': 'Gen8',
|
'server_model': 'Gen8',
|
||||||
'pci_gpu_devices': '2'}
|
'pci_gpu_devices': '2'}
|
||||||
|
cap_mock.assert_called_once_with()
|
||||||
|
nic_mock.assert_called_once_with(self.client.info, tup_val)
|
||||||
self.assertEqual(expected_capabilities, capabilities)
|
self.assertEqual(expected_capabilities, capabilities)
|
||||||
self.assertEqual(info, self.client.info)
|
self.assertEqual(info, self.client.info)
|
||||||
|
|
||||||
|
@mock.patch.object(ipmi, 'get_nic_capacity')
|
||||||
|
@mock.patch.object(ribcl.RIBCLOperations,
|
||||||
|
'get_ilo_firmware_version_as_major_minor')
|
||||||
|
@mock.patch.object(ribcl.RIBCLOperations, 'get_server_capabilities')
|
||||||
|
def test_get_server_capabilities_no_firmware(self, cap_mock,
|
||||||
|
maj_min_mock, nic_mock):
|
||||||
|
maj_min_mock.return_value = (None, None,)
|
||||||
|
nic_mock.return_value = None
|
||||||
|
cap_mock.return_value = {'rom_firmware_version': 'x',
|
||||||
|
'server_model': 'Gen8',
|
||||||
|
'pci_gpu_devices': '2'}
|
||||||
|
expected_capabilities = {'rom_firmware_version': 'x',
|
||||||
|
'server_model': 'Gen8',
|
||||||
|
'pci_gpu_devices': '2'}
|
||||||
|
capabilities = self.client.get_server_capabilities()
|
||||||
|
self.assertEqual(expected_capabilities, capabilities)
|
||||||
|
nic_mock.assert_not_called()
|
||||||
|
|
||||||
|
@mock.patch.object(ris.RISOperations,
|
||||||
|
'get_ilo_firmware_version_as_major_minor')
|
||||||
@mock.patch.object(ribcl.RIBCLOperations, 'get_host_health_data')
|
@mock.patch.object(ribcl.RIBCLOperations, 'get_host_health_data')
|
||||||
@mock.patch.object(ribcl.RIBCLOperations,
|
@mock.patch.object(ribcl.RIBCLOperations,
|
||||||
'_get_number_of_gpu_devices_connected')
|
'_get_number_of_gpu_devices_connected')
|
||||||
@mock.patch.object(ipmi, 'get_nic_capacity')
|
@mock.patch.object(ipmi, 'get_nic_capacity')
|
||||||
@mock.patch.object(ris.RISOperations, 'get_server_capabilities')
|
@mock.patch.object(ris.RISOperations, 'get_server_capabilities')
|
||||||
def test_get_server_capabilities_no_nic_Gen9(self, cap_mock, nic_mock,
|
def test_get_server_capabilities_no_nic_Gen9(self, cap_mock, nic_mock,
|
||||||
gpu_mock, host_mock):
|
gpu_mock, host_mock, mm_mock):
|
||||||
info = {'address': "1.2.3.4", 'username': "admin", 'password': "Admin"}
|
info = {'address': "1.2.3.4", 'username': "admin", 'password': "Admin"}
|
||||||
data = constants.GET_EMBEDDED_HEALTH_OUTPUT
|
data = constants.GET_EMBEDDED_HEALTH_OUTPUT
|
||||||
json_data = json.loads(data)
|
json_data = json.loads(data)
|
||||||
host_mock.return_value = json_data
|
host_mock.return_value = json_data
|
||||||
|
tup_val = mm_mock.return_value = (u'2', u'10',)
|
||||||
self.client.model = 'Gen9'
|
self.client.model = 'Gen9'
|
||||||
nic_mock.return_value = None
|
nic_mock.return_value = None
|
||||||
gpu_mock.return_value = {'pci_gpu_devices': 2}
|
gpu_mock.return_value = {'pci_gpu_devices': 2}
|
||||||
|
@ -323,7 +351,7 @@ class IloClientTestCase(testtools.TestCase):
|
||||||
'secure_boot': 'true'}
|
'secure_boot': 'true'}
|
||||||
capabilities = self.client.get_server_capabilities()
|
capabilities = self.client.get_server_capabilities()
|
||||||
cap_mock.assert_called_once_with()
|
cap_mock.assert_called_once_with()
|
||||||
nic_mock.assert_called_once_with(self.client.info)
|
nic_mock.assert_called_once_with(self.client.info, tup_val)
|
||||||
expected_capabilities = {'ilo_firmware_version': '2.10',
|
expected_capabilities = {'ilo_firmware_version': '2.10',
|
||||||
'rom_firmware_version': 'x',
|
'rom_firmware_version': 'x',
|
||||||
'server_model': 'Gen9',
|
'server_model': 'Gen9',
|
||||||
|
@ -332,17 +360,20 @@ class IloClientTestCase(testtools.TestCase):
|
||||||
self.assertEqual(expected_capabilities, capabilities)
|
self.assertEqual(expected_capabilities, capabilities)
|
||||||
self.assertEqual(info, self.client.info)
|
self.assertEqual(info, self.client.info)
|
||||||
|
|
||||||
|
@mock.patch.object(ris.RISOperations,
|
||||||
|
'get_ilo_firmware_version_as_major_minor')
|
||||||
@mock.patch.object(ribcl.RIBCLOperations, 'get_host_health_data')
|
@mock.patch.object(ribcl.RIBCLOperations, 'get_host_health_data')
|
||||||
@mock.patch.object(ribcl.RIBCLOperations,
|
@mock.patch.object(ribcl.RIBCLOperations,
|
||||||
'_get_number_of_gpu_devices_connected')
|
'_get_number_of_gpu_devices_connected')
|
||||||
@mock.patch.object(ipmi, 'get_nic_capacity')
|
@mock.patch.object(ipmi, 'get_nic_capacity')
|
||||||
@mock.patch.object(ris.RISOperations, 'get_server_capabilities')
|
@mock.patch.object(ris.RISOperations, 'get_server_capabilities')
|
||||||
def test_get_server_capabilities_Gen9(self, cap_mock, nic_mock,
|
def test_get_server_capabilities_Gen9(self, cap_mock, nic_mock,
|
||||||
gpu_mock, host_mock):
|
gpu_mock, host_mock, mm_mock):
|
||||||
info = {'address': "1.2.3.4", 'username': "admin", 'password': "Admin"}
|
info = {'address': "1.2.3.4", 'username': "admin", 'password': "Admin"}
|
||||||
data = constants.GET_EMBEDDED_HEALTH_OUTPUT
|
data = constants.GET_EMBEDDED_HEALTH_OUTPUT
|
||||||
json_data = json.loads(data)
|
json_data = json.loads(data)
|
||||||
host_mock.return_value = json_data
|
host_mock.return_value = json_data
|
||||||
|
tup_val = mm_mock.return_value = (u'2', u'10',)
|
||||||
self.client.model = 'Gen9'
|
self.client.model = 'Gen9'
|
||||||
gpu_mock.return_value = {'pci_gpu_devices': 2}
|
gpu_mock.return_value = {'pci_gpu_devices': 2}
|
||||||
nic_mock.return_value = '10Gb'
|
nic_mock.return_value = '10Gb'
|
||||||
|
@ -352,7 +383,7 @@ class IloClientTestCase(testtools.TestCase):
|
||||||
'secure_boot': 'true'}
|
'secure_boot': 'true'}
|
||||||
capabilities = self.client.get_server_capabilities()
|
capabilities = self.client.get_server_capabilities()
|
||||||
cap_mock.assert_called_once_with()
|
cap_mock.assert_called_once_with()
|
||||||
nic_mock.assert_called_once_with(self.client.info)
|
nic_mock.assert_called_once_with(self.client.info, tup_val)
|
||||||
expected_capabilities = {'ilo_firmware_version': '2.10',
|
expected_capabilities = {'ilo_firmware_version': '2.10',
|
||||||
'rom_firmware_version': 'x',
|
'rom_firmware_version': 'x',
|
||||||
'server_model': 'Gen9',
|
'server_model': 'Gen9',
|
||||||
|
|
|
@ -32,18 +32,120 @@ class IloIpmiTestCase(unittest.TestCase):
|
||||||
'username': "admin",
|
'username': "admin",
|
||||||
'password': "Admin"}
|
'password': "Admin"}
|
||||||
|
|
||||||
@mock.patch.object(ipmi, '_parse_ipmi_nic_capacity')
|
def test_get_ilo_version_valid(self):
|
||||||
@mock.patch.object(ipmi, '_exec_ipmitool')
|
in_vals = (u'2', u'30',)
|
||||||
def test_get_nic_capacity(self, ipmi_mock, parse_mock):
|
expected = 2.30
|
||||||
ipmi_mock.return_value = constants.NIC_FRU_OUT
|
actual = ipmi.get_ilo_version(in_vals)
|
||||||
parse_mock.return_value = "1Gb"
|
self.assertEqual(actual, expected)
|
||||||
expected_out = "1Gb"
|
|
||||||
actual_out = ipmi.get_nic_capacity(self.info)
|
def test_get_ilo_version_no_minor(self):
|
||||||
self.assertEqual(expected_out, actual_out)
|
in_vals = (u'2', None,)
|
||||||
|
expected = 2.0
|
||||||
|
actual = ipmi.get_ilo_version(in_vals)
|
||||||
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
|
def test_get_ilo_version_no_major(self):
|
||||||
|
in_vals = (None, u'2',)
|
||||||
|
expected = 0.2
|
||||||
|
actual = ipmi.get_ilo_version(in_vals)
|
||||||
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
|
def test_get_ilo_version_no_major_no_minor(self):
|
||||||
|
in_vals = (None, None,)
|
||||||
|
expected = None
|
||||||
|
actual = ipmi.get_ilo_version(in_vals)
|
||||||
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
|
def test_get_ilo_version_exception(self):
|
||||||
|
in_vals = ("text", 2,)
|
||||||
|
expected = None
|
||||||
|
actual = ipmi.get_ilo_version(in_vals)
|
||||||
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
@mock.patch.object(ipmi, '_parse_ipmi_nic_capacity')
|
@mock.patch.object(ipmi, '_parse_ipmi_nic_capacity')
|
||||||
@mock.patch.object(ipmi, '_exec_ipmitool')
|
@mock.patch.object(ipmi, '_exec_ipmitool')
|
||||||
def test_get_nic_capacity_loop_N_times(self, ipmi_mock, parse_mock):
|
def test_get_nic_capacity_fw_lt_suggested(self, ipmi_mock, parse_mock):
|
||||||
|
fw_rev = constants.LESSER_THAN_MIN_SUGGESTED_FW_TUP
|
||||||
|
ipmi_mock.return_value = constants.NIC_FRU_OUT
|
||||||
|
parse_mock.return_value = "1Gb"
|
||||||
|
expected_out = "1Gb"
|
||||||
|
actual_out = ipmi.get_nic_capacity(self.info, fw_rev)
|
||||||
|
self.assertEqual(expected_out, actual_out)
|
||||||
|
ipmi_mock.assert_called_once_with(mock.ANY, "fru print 0x0")
|
||||||
|
|
||||||
|
@mock.patch.object(ipmi, '_parse_ipmi_nic_capacity')
|
||||||
|
@mock.patch.object(ipmi, '_exec_ipmitool')
|
||||||
|
def test_get_nic_capacity_fw_lt_suggested_none(self,
|
||||||
|
ipmi_mock,
|
||||||
|
parse_mock):
|
||||||
|
fw_rev = constants.LESSER_THAN_MIN_SUGGESTED_FW_TUP
|
||||||
|
ipmi_mock.return_value = constants.NIC_FRU_OUT
|
||||||
|
parse_mock.return_value = None
|
||||||
|
actual_out = ipmi.get_nic_capacity(self.info, fw_rev)
|
||||||
|
self.assertIsNone(actual_out)
|
||||||
|
self.assertEqual(ipmi_mock.call_count, 126)
|
||||||
|
|
||||||
|
@mock.patch.object(ipmi, '_parse_ipmi_nic_capacity')
|
||||||
|
@mock.patch.object(ipmi, '_exec_ipmitool')
|
||||||
|
def test_get_nic_capacity_fw_lt_suggested_out_of_range_check(
|
||||||
|
self, ipmi_mock, parse_mock):
|
||||||
|
fw_rev = constants.LESSER_THAN_MIN_SUGGESTED_FW_TUP
|
||||||
|
actual_out = ipmi.get_nic_capacity(self.info, fw_rev)
|
||||||
|
format_call_args = map(lambda x: x[0][1],
|
||||||
|
ipmi_mock.call_args_list)
|
||||||
|
self.assertNotIn("fru print 0x7d", format_call_args)
|
||||||
|
self.assertEqual(actual_out, None)
|
||||||
|
|
||||||
|
@mock.patch.object(ipmi, '_parse_ipmi_nic_capacity')
|
||||||
|
@mock.patch.object(ipmi, '_exec_ipmitool')
|
||||||
|
def test_get_nic_capacity_fw_lt_suggested_in_range_check(
|
||||||
|
self, ipmi_mock, parse_mock):
|
||||||
|
fw_rev = constants.LESSER_THAN_MIN_SUGGESTED_FW_TUP
|
||||||
|
actual_out = ipmi.get_nic_capacity(self.info, fw_rev)
|
||||||
|
format_call_args = map(lambda x: x[0][1],
|
||||||
|
ipmi_mock.call_args_list)
|
||||||
|
self.assertIn("fru print 0xef", format_call_args)
|
||||||
|
self.assertEqual(actual_out, None)
|
||||||
|
|
||||||
|
@mock.patch.object(ipmi, '_parse_ipmi_nic_capacity')
|
||||||
|
@mock.patch.object(ipmi, '_exec_ipmitool')
|
||||||
|
def test_get_nic_capacity_fw_suggested(self, ipmi_mock, parse_mock):
|
||||||
|
fw_rev = constants.MIN_SUGGESTED_FW_TUP
|
||||||
|
ipmi_mock.return_value = constants.NIC_FRU_OUT_ALL
|
||||||
|
parse_mock.return_value = "1Gb"
|
||||||
|
expected_out = "1Gb"
|
||||||
|
actual_out = ipmi.get_nic_capacity(self.info, fw_rev)
|
||||||
|
self.assertEqual(expected_out, actual_out)
|
||||||
|
ipmi_mock.assert_called_once_with(mock.ANY, "fru print")
|
||||||
|
self.assertEqual(ipmi_mock.call_count, 1)
|
||||||
|
|
||||||
|
@mock.patch.object(ipmi, '_parse_ipmi_nic_capacity')
|
||||||
|
@mock.patch.object(ipmi, '_exec_ipmitool')
|
||||||
|
def test_get_nic_capacity_fw_suggested_none(self, ipmi_mock, parse_mock):
|
||||||
|
fw_rev = constants.MIN_SUGGESTED_FW_TUP
|
||||||
|
ipmi_mock.return_value = constants.NIC_FRU_OUT_ALL
|
||||||
|
parse_mock.return_value = None
|
||||||
|
actual_out = ipmi.get_nic_capacity(self.info, fw_rev)
|
||||||
|
self.assertIsNone(actual_out)
|
||||||
|
self.assertEqual(ipmi_mock.call_count, 1)
|
||||||
|
|
||||||
|
@mock.patch.object(ipmi, '_parse_ipmi_nic_capacity')
|
||||||
|
@mock.patch.object(ipmi, '_exec_ipmitool')
|
||||||
|
def test_get_nic_capacity_fw_gt_suggested(self, ipmi_mock, parse_mock):
|
||||||
|
fw_rev = constants.GREATER_THAN_MIN_SUGGESTED_FW_TUP
|
||||||
|
ipmi_mock.return_value = constants.NIC_FRU_OUT_ALL
|
||||||
|
parse_mock.return_value = "1Gb"
|
||||||
|
expected_out = "1Gb"
|
||||||
|
actual_out = ipmi.get_nic_capacity(self.info, fw_rev)
|
||||||
|
self.assertEqual(expected_out, actual_out)
|
||||||
|
ipmi_mock.assert_called_once_with(mock.ANY, "fru print")
|
||||||
|
|
||||||
|
@mock.patch.object(ipmi, '_parse_ipmi_nic_capacity')
|
||||||
|
@mock.patch.object(ipmi, '_exec_ipmitool')
|
||||||
|
def test_get_nic_capacity_fw_lt_suggested_loop_N_times(self,
|
||||||
|
ipmi_mock,
|
||||||
|
parse_mock):
|
||||||
|
fw_rev = constants.LESSER_THAN_MIN_SUGGESTED_FW_TUP
|
||||||
ipmi_mock.side_effect = ["Device not present", "Device not present",
|
ipmi_mock.side_effect = ["Device not present", "Device not present",
|
||||||
"Device not present", "Device not present",
|
"Device not present", "Device not present",
|
||||||
"Device not present", "Device not present",
|
"Device not present", "Device not present",
|
||||||
|
@ -51,19 +153,10 @@ class IloIpmiTestCase(unittest.TestCase):
|
||||||
constants.NIC_FRU_OUT]
|
constants.NIC_FRU_OUT]
|
||||||
parse_mock.return_value = "1Gb"
|
parse_mock.return_value = "1Gb"
|
||||||
expected_out = "1Gb"
|
expected_out = "1Gb"
|
||||||
actual_out = ipmi.get_nic_capacity(self.info)
|
actual_out = ipmi.get_nic_capacity(self.info, fw_rev)
|
||||||
self.assertEqual(ipmi_mock.call_count, 9)
|
self.assertEqual(ipmi_mock.call_count, 9)
|
||||||
self.assertEqual(expected_out, actual_out)
|
self.assertEqual(expected_out, actual_out)
|
||||||
|
|
||||||
@mock.patch.object(ipmi, '_parse_ipmi_nic_capacity')
|
|
||||||
@mock.patch.object(ipmi, '_exec_ipmitool')
|
|
||||||
def test_get_nic_capacity_none(self, ipmi_mock, parse_mock):
|
|
||||||
ipmi_mock.return_value = constants.NIC_FRU_OUT
|
|
||||||
parse_mock.return_value = None
|
|
||||||
actual_out = ipmi.get_nic_capacity(self.info)
|
|
||||||
self.assertIsNone(actual_out)
|
|
||||||
self.assertEqual(ipmi_mock.call_count, 255)
|
|
||||||
|
|
||||||
@mock.patch.object(subprocess, 'check_output')
|
@mock.patch.object(subprocess, 'check_output')
|
||||||
def test__exec_ipmitool(self, check_mock):
|
def test__exec_ipmitool(self, check_mock):
|
||||||
check_mock.return_value = constants.NIC_FRU_OUT
|
check_mock.return_value = constants.NIC_FRU_OUT
|
||||||
|
|
|
@ -597,6 +597,35 @@ class IloRibclTestCase(unittest.TestCase):
|
||||||
self.assertIsInstance(ilo_firmware, dict)
|
self.assertIsInstance(ilo_firmware, dict)
|
||||||
self.assertEqual(expected_ilo, ilo_firmware)
|
self.assertEqual(expected_ilo, ilo_firmware)
|
||||||
|
|
||||||
|
@mock.patch.object(ribcl.RIBCLOperations, 'get_host_health_data')
|
||||||
|
def test_get_ilo_firmware_version_as_major_minor(self, mock_health_data):
|
||||||
|
data = constants.GET_EMBEDDED_HEALTH_OUTPUT
|
||||||
|
mock_health_data.return_value = json.loads(data)
|
||||||
|
expected_ilo = (u'2', u'02',)
|
||||||
|
ilo_firmware = self.ilo.get_ilo_firmware_version_as_major_minor()
|
||||||
|
self.assertIsInstance(ilo_firmware, tuple)
|
||||||
|
self.assertEqual(expected_ilo, ilo_firmware)
|
||||||
|
|
||||||
|
@mock.patch.object(ribcl.RIBCLOperations, 'get_host_health_data')
|
||||||
|
def test_get_ilo_firmware_version_as_major_minor_unexpected(
|
||||||
|
self, mock_health_data):
|
||||||
|
data = constants.GET_EMBEDDED_HEALTH_OUTPUT_UNEXPECTED_FORMAT
|
||||||
|
mock_health_data.return_value = json.loads(data)
|
||||||
|
expected_ilo = (None, None,)
|
||||||
|
ilo_firmware = self.ilo.get_ilo_firmware_version_as_major_minor()
|
||||||
|
self.assertIsInstance(ilo_firmware, tuple)
|
||||||
|
self.assertEqual(expected_ilo, ilo_firmware)
|
||||||
|
|
||||||
|
@mock.patch.object(ribcl.RIBCLOperations, 'get_host_health_data')
|
||||||
|
def test_get_ilo_firmware_version_as_major_minor_no_firmware(
|
||||||
|
self, mock_health_data):
|
||||||
|
data = constants.GET_EMBEDDED_HEALTH_OUTPUT_UNEXPECTED_FORMAT
|
||||||
|
mock_health_data.return_value = json.loads(data)
|
||||||
|
expected_ilo = (None, None,)
|
||||||
|
ilo_firmware = self.ilo.get_ilo_firmware_version_as_major_minor()
|
||||||
|
self.assertIsInstance(ilo_firmware, tuple)
|
||||||
|
self.assertEqual(expected_ilo, ilo_firmware)
|
||||||
|
|
||||||
def test__get_number_of_gpu_devices_connected(self):
|
def test__get_number_of_gpu_devices_connected(self):
|
||||||
data = constants.GET_EMBEDDED_HEALTH_OUTPUT
|
data = constants.GET_EMBEDDED_HEALTH_OUTPUT
|
||||||
json_data = json.loads(data)
|
json_data = json.loads(data)
|
||||||
|
|
|
@ -402,6 +402,28 @@ class IloRisTestCase(testtools.TestCase):
|
||||||
capabilities = self.client.get_server_capabilities()
|
capabilities = self.client.get_server_capabilities()
|
||||||
self.assertEqual(expected_caps, capabilities)
|
self.assertEqual(expected_caps, capabilities)
|
||||||
|
|
||||||
|
@mock.patch.object(ris.RISOperations, '_get_ilo_details')
|
||||||
|
def test_get_ilo_firmware_version_as_major_minor(
|
||||||
|
self, get_ilo_details_mock):
|
||||||
|
ilo_details = json.loads(ris_outputs.GET_MANAGER_DETAILS)
|
||||||
|
uri = '/rest/v1/Managers/1'
|
||||||
|
get_ilo_details_mock.return_value = (ilo_details, uri)
|
||||||
|
ilo_firm = self.client.get_ilo_firmware_version_as_major_minor()
|
||||||
|
expected_ilo_firm = (2, 20)
|
||||||
|
self.assertIsInstance(ilo_firm, tuple)
|
||||||
|
self.assertEqual(expected_ilo_firm, ilo_firm)
|
||||||
|
|
||||||
|
@mock.patch.object(ris.RISOperations, '_get_ilo_details')
|
||||||
|
def test_get_ilo_firmware_version_as_major_minor_no_data(
|
||||||
|
self, get_ilo_details_mock):
|
||||||
|
ilo_details = json.loads(ris_outputs.GET_MANAGER_DETAILS_NO_FIRMWARE)
|
||||||
|
uri = '/rest/v1/Managers/1'
|
||||||
|
get_ilo_details_mock.return_value = (ilo_details, uri)
|
||||||
|
ilo_firm = self.client.get_ilo_firmware_version_as_major_minor()
|
||||||
|
expected_ilo_firm = (None, None)
|
||||||
|
self.assertIsInstance(ilo_firm, tuple)
|
||||||
|
self.assertEqual(expected_ilo_firm, ilo_firm)
|
||||||
|
|
||||||
@mock.patch.object(ris.RISOperations, '_get_ilo_details')
|
@mock.patch.object(ris.RISOperations, '_get_ilo_details')
|
||||||
def test__get_ilo_firmware_version(self, get_ilo_details_mock):
|
def test__get_ilo_firmware_version(self, get_ilo_details_mock):
|
||||||
ilo_details = json.loads(ris_outputs.GET_MANAGER_DETAILS)
|
ilo_details = json.loads(ris_outputs.GET_MANAGER_DETAILS)
|
||||||
|
|
Loading…
Reference in New Issue