def test_embedded_check_firmware_compatibility_pass(self): """Verify embedded firmware compatibility.""" self._set_args({"firmware": "test.dlp", "nvsram": "test.dlp"}) firmware = NetAppESeriesFirmware() with patch(self.CREATE_MULTIPART_FORMDATA_FUNC, return_value=("", {})): with patch(self.REQUEST_FUNC, return_value=(200, { "signatureTestingPassed": True, "fileCompatible": True, "versionContents": [{ "module": "bundle", "bundledVersion": "08.42.50.00.000", "onboardVersion": "08.42.30.05" }, { "module": "bundleDisplay", "bundledVersion": "11.40.5", "onboardVersion": "11.40.3R2" }, { "module": "hypervisor", "bundledVersion": "08.42.50.00", "onboardVersion": "08.42.30.05" }, { "module": "raid", "bundledVersion": "08.42.50.00", "onboardVersion": "08.42.30.05" }, { "module": "management", "bundledVersion": "11.42.0000.0028", "onboardVersion": "11.42.0000.0026" }, { "module": "iom", "bundledVersion": "11.42.0G00.0003", "onboardVersion": "11.42.0G00.0001" }] })): firmware.embedded_check_bundle_compatibility()
def test_embedded_check_firmware_compatibility_fail(self): """Verify embedded firmware compatibility fails with expected exceptions.""" self._set_args({"firmware": "test.dlp", "nvsram": "test.dlp"}) firmware = NetAppESeriesFirmware() with self.assertRaisesRegexp( AnsibleFailJson, "Failed to retrieve bundle compatibility results."): with patch(self.CREATE_MULTIPART_FORMDATA_FUNC, return_value=("", {})): with patch(self.REQUEST_FUNC, return_value=Exception()): firmware.embedded_check_bundle_compatibility() with self.assertRaisesRegexp(AnsibleFailJson, "Invalid firmware bundle file."): with patch(self.CREATE_MULTIPART_FORMDATA_FUNC, return_value=("", {})): with patch(self.REQUEST_FUNC, return_value=(200, { "signatureTestingPassed": False, "fileCompatible": True, "versionContents": [{ "module": "bundle", "bundledVersion": "08.42.50.00.000", "onboardVersion": "08.42.30.05" }, { "module": "bundleDisplay", "bundledVersion": "11.40.5", "onboardVersion": "11.40.3R2" }, { "module": "hypervisor", "bundledVersion": "08.42.50.00", "onboardVersion": "08.42.30.05" }, { "module": "raid", "bundledVersion": "08.42.50.00", "onboardVersion": "08.42.30.05" }, { "module": "management", "bundledVersion": "11.42.0000.0028", "onboardVersion": "11.42.0000.0026" }, { "module": "iom", "bundledVersion": "11.42.0G00.0003", "onboardVersion": "11.42.0G00.0001" }] })): firmware.embedded_check_bundle_compatibility() with self.assertRaisesRegexp(AnsibleFailJson, "Incompatible firmware bundle file."): with patch(self.CREATE_MULTIPART_FORMDATA_FUNC, return_value=("", {})): with patch(self.REQUEST_FUNC, return_value=(200, { "signatureTestingPassed": True, "fileCompatible": False, "versionContents": [{ "module": "bundle", "bundledVersion": "08.42.50.00.000", "onboardVersion": "08.42.30.05" }, { "module": "bundleDisplay", "bundledVersion": "11.40.5", "onboardVersion": "11.40.3R2" }, { "module": "hypervisor", "bundledVersion": "08.42.50.00", "onboardVersion": "08.42.30.05" }, { "module": "raid", "bundledVersion": "08.42.50.00", "onboardVersion": "08.42.30.05" }, { "module": "management", "bundledVersion": "11.42.0000.0028", "onboardVersion": "11.42.0000.0026" }, { "module": "iom", "bundledVersion": "11.42.0G00.0003", "onboardVersion": "11.42.0G00.0001" }] })): firmware.embedded_check_bundle_compatibility() with self.assertRaisesRegexp(AnsibleFailJson, "Downgrades are not permitted."): with patch(self.CREATE_MULTIPART_FORMDATA_FUNC, return_value=("", {})): with patch(self.REQUEST_FUNC, return_value=(200, { "signatureTestingPassed": True, "fileCompatible": True, "versionContents": [{ "module": "bundle", "bundledVersion": "08.42.00.00.000", "onboardVersion": "08.50.30.05" }, { "module": "bundleDisplay", "bundledVersion": "11.40.5", "onboardVersion": "11.40.3R2" }, { "module": "hypervisor", "bundledVersion": "08.42.50.00", "onboardVersion": "08.42.30.05" }, { "module": "raid", "bundledVersion": "08.42.50.00", "onboardVersion": "08.42.30.05" }, { "module": "management", "bundledVersion": "11.42.0000.0028", "onboardVersion": "11.42.0000.0026" }, { "module": "iom", "bundledVersion": "11.42.0G00.0003", "onboardVersion": "11.42.0G00.0001" }] })): firmware.embedded_check_bundle_compatibility() with self.assertRaisesRegexp(AnsibleFailJson, "Downgrades are not permitted."): with patch(self.CREATE_MULTIPART_FORMDATA_FUNC, return_value=("", {})): with patch(self.REQUEST_FUNC, return_value=(200, { "signatureTestingPassed": True, "fileCompatible": True, "versionContents": [{ "module": "bundle", "bundledVersion": "08.42.00.00.000", "onboardVersion": "09.20.30.05" }, { "module": "bundleDisplay", "bundledVersion": "11.40.5", "onboardVersion": "11.40.3R2" }, { "module": "hypervisor", "bundledVersion": "08.42.50.00", "onboardVersion": "08.42.30.05" }, { "module": "raid", "bundledVersion": "08.42.50.00", "onboardVersion": "08.42.30.05" }, { "module": "management", "bundledVersion": "11.42.0000.0028", "onboardVersion": "11.42.0000.0026" }, { "module": "iom", "bundledVersion": "11.42.0G00.0003", "onboardVersion": "11.42.0G00.0001" }] })): firmware.embedded_check_bundle_compatibility()