def parse(cls, namespace, bios_attr_xml): """Parses XML and creates BIOSAttribute object""" name = utils.get_wsman_resource_attr( bios_attr_xml, namespace, 'AttributeName') current_value = utils.get_wsman_resource_attr( bios_attr_xml, namespace, 'CurrentValue', nullable=True) pending_value = utils.get_wsman_resource_attr( bios_attr_xml, namespace, 'PendingValue', nullable=True) read_only = utils.get_wsman_resource_attr( bios_attr_xml, namespace, 'IsReadOnly') return cls(name, current_value, pending_value, (read_only == 'true'))
def parse(cls, nic_attr_xml): """Parses XML and creates NICStringAttribute object""" nic_attr = NICAttribute.parse(cls.namespace, nic_attr_xml) min_length = int(utils.get_wsman_resource_attr( nic_attr_xml, cls.namespace, 'MinLength')) max_length = int(utils.get_wsman_resource_attr( nic_attr_xml, cls.namespace, 'MaxLength')) pcre_regex = utils.get_wsman_resource_attr( nic_attr_xml, cls.namespace, 'ValueExpression', nullable=True) return cls(nic_attr.fqdd, nic_attr.name, nic_attr.current_value, nic_attr.pending_value, nic_attr.read_only, min_length, max_length, pcre_regex)
def parse(cls, bios_attr_xml): """Parses XML and creates BIOSIntegerAttribute object""" bios_attr = BIOSAttribute.parse(cls.namespace, bios_attr_xml) lower_bound = utils.get_wsman_resource_attr( bios_attr_xml, cls.namespace, 'LowerBound') upper_bound = utils.get_wsman_resource_attr( bios_attr_xml, cls.namespace, 'UpperBound') if bios_attr.current_value: bios_attr.current_value = int(bios_attr.current_value) if bios_attr.pending_value: bios_attr.pending_value = int(bios_attr.pending_value) return cls(bios_attr.name, bios_attr.current_value, bios_attr.pending_value, bios_attr.read_only, int(lower_bound), int(upper_bound))
def parse(cls, nic_attr_xml): """Parses XML and creates NICIntegerAttribute object""" nic_attr = NICAttribute.parse(cls.namespace, nic_attr_xml) lower_bound = utils.get_wsman_resource_attr( nic_attr_xml, cls.namespace, 'LowerBound') upper_bound = utils.get_wsman_resource_attr( nic_attr_xml, cls.namespace, 'UpperBound') if nic_attr.current_value: nic_attr.current_value = int(nic_attr.current_value) if nic_attr.pending_value: nic_attr.pending_value = int(nic_attr.pending_value) return cls(nic_attr.fqdd, nic_attr.name, nic_attr.current_value, nic_attr.pending_value, nic_attr.read_only, int(lower_bound), int(upper_bound))
def parse(cls, namespace, bios_attr_xml): """Parses XML and creates BIOSAttribute object""" name = utils.get_wsman_resource_attr(bios_attr_xml, namespace, 'AttributeName') current_value = utils.get_wsman_resource_attr(bios_attr_xml, namespace, 'CurrentValue', nullable=True) pending_value = utils.get_wsman_resource_attr(bios_attr_xml, namespace, 'PendingValue', nullable=True) read_only = utils.get_wsman_resource_attr(bios_attr_xml, namespace, 'IsReadOnly') return cls(name, current_value, pending_value, (read_only == 'true'))
def parse(cls, bios_attr_xml): """Parses XML and creates BIOSStringAttribute object""" bios_attr = BIOSAttribute.parse(cls.namespace, bios_attr_xml) min_length = int( utils.get_wsman_resource_attr(bios_attr_xml, cls.namespace, 'MinLength')) max_length = int( utils.get_wsman_resource_attr(bios_attr_xml, cls.namespace, 'MaxLength')) pcre_regex = utils.get_wsman_resource_attr(bios_attr_xml, cls.namespace, 'ValueExpression', nullable=True) return cls(bios_attr.name, bios_attr.current_value, bios_attr.pending_value, bios_attr.read_only, min_length, max_length, pcre_regex)
def parse(cls, nic_attr_xml): """Parses XML and creates NICIntegerAttribute object""" nic_attr = NICAttribute.parse(cls.namespace, nic_attr_xml) lower_bound = utils.get_wsman_resource_attr(nic_attr_xml, cls.namespace, 'LowerBound') upper_bound = utils.get_wsman_resource_attr(nic_attr_xml, cls.namespace, 'UpperBound') if nic_attr.current_value: nic_attr.current_value = int(nic_attr.current_value) if nic_attr.pending_value: nic_attr.pending_value = int(nic_attr.pending_value) return cls(nic_attr.fqdd, nic_attr.name, nic_attr.current_value, nic_attr.pending_value, nic_attr.read_only, int(lower_bound), int(upper_bound))
def parse(cls, bios_attr_xml): """Parses XML and creates BIOSIntegerAttribute object""" bios_attr = BIOSAttribute.parse(cls.namespace, bios_attr_xml) lower_bound = utils.get_wsman_resource_attr(bios_attr_xml, cls.namespace, 'LowerBound') upper_bound = utils.get_wsman_resource_attr(bios_attr_xml, cls.namespace, 'UpperBound') if bios_attr.current_value: bios_attr.current_value = int(bios_attr.current_value) if bios_attr.pending_value: bios_attr.pending_value = int(bios_attr.pending_value) return cls(bios_attr.name, bios_attr.current_value, bios_attr.pending_value, bios_attr.read_only, int(lower_bound), int(upper_bound))
def _get_raid_controller_attr(self, drac_controller, attr_name): return utils.get_wsman_resource_attr( drac_controller, uris.DCIM_ControllerView, attr_name)
def _get_cpu_attr(self, cpu, attr_name): return utils.get_wsman_resource_attr( cpu, uris.DCIM_CPUView, attr_name)
def _get_memory_attr(self, memory, attr_name): return utils.get_wsman_resource_attr(memory, uris.DCIM_MemoryView, attr_name)
def _get_boot_mode_attr(self, drac_boot_mode, attr_name): return utils.get_wsman_resource_attr(drac_boot_mode, uris.DCIM_BootConfigSetting, attr_name)
def _get_boot_device_attr(self, drac_boot_device, attr_name): return utils.get_wsman_resource_attr(drac_boot_device, uris.DCIM_BootSourceSetting, attr_name)
def _get_nic_interface_attr(self, drac_nic_interface, attr_name): return utils.get_wsman_resource_attr( drac_nic_interface, uris.DCIM_NICView, attr_name)
def _get_psu_attr(self, psu, attr_name): return utils.get_wsman_resource_attr(psu, uris.DCIM_PowerSupplyView, attr_name)
def _get_psu_attr(self, psu, attr_name): return utils.get_wsman_resource_attr( psu, uris.DCIM_PowerSupplyView, attr_name)
def _get_nic_interface_attr(self, drac_nic_interface, attr_name): return utils.get_wsman_resource_attr(drac_nic_interface, uris.DCIM_NICView, attr_name)
def _get_job_attr(self, drac_job, attr_name): return utils.get_wsman_resource_attr(drac_job, uris.DCIM_LifecycleJob, attr_name)
def _get_physical_disk_attr(self, drac_disk, attr_name): return utils.get_wsman_resource_attr( drac_disk, uris.DCIM_PhysicalDiskView, attr_name)
def _get_physical_disk_attr(self, drac_disk, attr_name): return utils.get_wsman_resource_attr(drac_disk, uris.DCIM_PhysicalDiskView, attr_name)
def _get_raid_controller_attr(self, drac_controller, attr_name): return utils.get_wsman_resource_attr(drac_controller, uris.DCIM_ControllerView, attr_name)