def make_firmware_dict(settings, baseline): """ Create a firmware settings dictionary for use in defining either a server profile or server profile template. """ uri = '' if baseline: # The OneView appliance converts '.' in the filename to '_', except for # the final one baseline = baseline.replace('.', '_').replace('_iso', '.iso') spps = settings.get_spps() for spp in spps: if spp['isoFileName'] == baseline: uri = spp['uri'] if not uri: message = 'ERROR: Locating Firmware Baseline SPP\n Baseline: "%s" can not be located' % baseline raise HPOneViewInvalidResource(msg=message) if uri: fw_settings = make_FirmwareSettingsV3(uri, 'FirmwareOnly', True, False) else: fw_settings = None return fw_settings
def make_firmware_dict(settings, baseline): """ Create a firmware settings dictionary for use in defining either a server profile or server profile template. """ uri = '' if baseline: # The OneView appliance converts '.' in the filename to '_', except for # the final one baseline = baseline.replace('.', '_').replace('_iso', '.iso') spps = settings.get_spps() for spp in spps: if spp['isoFileName'] == baseline: uri = spp['uri'] if not uri: message = 'ERROR: Locating Firmware Baseline SPP\n Baseline: "%s" can not be located' % baseline raise HPOneViewInvalidResource(message) if uri: fw_settings = make_FirmwareSettingsV3(uri, 'FirmwareOnly', True, False) else: fw_settings = None return fw_settings
def test_create_server_profile_template_with_connections( self, mock_wait4task, mock_post): name = 'spt' description = 'description' sht = '/rest/server-hardware-types/1234' eg = '/rest/enclosure-groups/1' affinity = 'Bay' hide_flex = True fw_settings = make_FirmwareSettingsV3( '/rest/firmware-drivers/SPP2016020_2015', 'FirmwareOnly', True, False) connections = make_ProfileConnectionV4( 1, "eth1", '/rest/ethernet-networks/17f5e012', True, None, 'Ethernet', None, None, 'Auto', '1000', None, None, None) # build the V1 SPT spt = make_ServerProfileTemplateV1(name, description, None, sht, eg, affinity, hide_flex, connections, fw_settings) # build a OV task for the create SPT operation task = self.build_spt_add_task_resource() # return the task when waiting for completion mock_post.return_value = [task, None] self.servers.create_server_profile_template(name, description, None, sht, eg, affinity, hide_flex, connections, fw_settings) mock_post.assert_called_once_with(uri['profile-templates'], spt)
def test_create_server_profile_template(self, mock_wait4task, mock_post): name = 'spt' description = 'description' sht = '/rest/server-hardware-types/1234' eg = '/rest/enclosure-groups/1' affinity = 'Bay' hide_flex = False fw_settings = make_FirmwareSettingsV3('/rest/firmware-drivers/SPP2016020_2015', 'FirmwareOnly', True, False) # build the V1 SPT spt = make_ServerProfileTemplateV1(name, description, None, sht, eg, affinity, hide_flex, None, fw_settings) # build a OV task for the create SPT operation task = self.build_spt_add_task_resource() # return the task when waiting for completion mock_post.return_value = [task, None] self.servers.create_server_profile_template(name, description, None, sht, eg, affinity, hide_flex, None, fw_settings) mock_post.assert_called_once_with(uri['profile-templates'], spt)