def parse(cls, lifecycle_attr_xml): """Parses XML and creates LCStringAttribute object""" lifecycle_attr = LCAttribute.parse(cls.namespace, lifecycle_attr_xml) min_length = int(utils.get_wsman_resource_attr( lifecycle_attr_xml, cls.namespace, 'MinLength')) max_length = int(utils.get_wsman_resource_attr( lifecycle_attr_xml, cls.namespace, 'MaxLength')) return cls(lifecycle_attr.name, lifecycle_attr.instance_id, lifecycle_attr.current_value, lifecycle_attr.pending_value, lifecycle_attr.read_only, min_length, max_length)
def parse(cls, idrac_attr_xml): """Parses XML and creates iDRACCardStringAttribute object""" idrac_attr = iDRACCardAttribute.parse(cls.namespace, idrac_attr_xml) min_length = int(utils.get_wsman_resource_attr( idrac_attr_xml, cls.namespace, 'MinLength')) max_length = int(utils.get_wsman_resource_attr( idrac_attr_xml, cls.namespace, 'MaxLength')) return cls(idrac_attr.name, idrac_attr.instance_id, idrac_attr.current_value, idrac_attr.pending_value, idrac_attr.read_only, idrac_attr.fqdd, idrac_attr.group_id, min_length, max_length)
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.instance_id, bios_attr.current_value, bios_attr.pending_value, bios_attr.read_only, min_length, max_length, pcre_regex)
def parse(cls, system_attr_xml): """Parses XML and creates SystemStringAttribute object""" system_attr = SystemAttribute.parse( cls.namespace, system_attr_xml) min_length = int(utils.get_wsman_resource_attr( system_attr_xml, cls.namespace, 'MinLength')) max_length = int(utils.get_wsman_resource_attr( system_attr_xml, cls.namespace, 'MaxLength')) return cls(system_attr.name, system_attr.instance_id, system_attr.current_value, system_attr.pending_value, system_attr.read_only, system_attr.fqdd, system_attr.group_id, min_length, max_length)
def parse(cls, namespace, lifecycle_attr_xml): """Parses XML and creates LCAttribute object""" name = utils.get_wsman_resource_attr( lifecycle_attr_xml, namespace, 'AttributeName') instance_id = utils.get_wsman_resource_attr( lifecycle_attr_xml, namespace, 'InstanceID') current_value = utils.get_wsman_resource_attr( lifecycle_attr_xml, namespace, 'CurrentValue', nullable=True) pending_value = utils.get_wsman_resource_attr( lifecycle_attr_xml, namespace, 'PendingValue', nullable=True) read_only = utils.get_wsman_resource_attr( lifecycle_attr_xml, namespace, 'IsReadOnly') return cls(name, instance_id, current_value, pending_value, (read_only == 'true'))
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.instance_id, bios_attr.current_value, bios_attr.pending_value, bios_attr.read_only, int(lower_bound), int(upper_bound))
def parse(cls, idrac_attr_xml): """Parses XML and creates iDRACCardIntegerAttribute object""" idrac_attr = iDRACCardAttribute.parse(cls.namespace, idrac_attr_xml) lower_bound = utils.get_wsman_resource_attr( idrac_attr_xml, cls.namespace, 'LowerBound') upper_bound = utils.get_wsman_resource_attr( idrac_attr_xml, cls.namespace, 'UpperBound') if idrac_attr.current_value: idrac_attr.current_value = int(idrac_attr.current_value) if idrac_attr.pending_value: idrac_attr.pending_value = int(idrac_attr.pending_value) return cls(idrac_attr.name, idrac_attr.instance_id, idrac_attr.current_value, idrac_attr.pending_value, idrac_attr.read_only, idrac_attr.fqdd, idrac_attr.group_id, int(lower_bound), int(upper_bound))
def parse(cls, nic_attr_xml): """Parse XML and create a 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.name, nic_attr.instance_id, nic_attr.current_value, nic_attr.pending_value, nic_attr.read_only, nic_attr.fqdd, min_length, max_length, pcre_regex)
def _get_physical_disk_attr(self, drac_disk, attr_name, uri, allow_missing=False): return utils.get_wsman_resource_attr(drac_disk, uri, attr_name, nullable=True, allow_missing=allow_missing)
def parse(cls, nic_attr_xml): """Parse XML and create a 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.name, nic_attr.instance_id, nic_attr.current_value, nic_attr.pending_value, nic_attr.read_only, nic_attr.fqdd, int(lower_bound), int(upper_bound))
def parse(cls, system_attr_xml): """Parses XML and creates SystemIntegerAttribute object""" system_attr = SystemAttribute.parse(cls.namespace, system_attr_xml) lower_bound = utils.get_wsman_resource_attr( system_attr_xml, cls.namespace, 'LowerBound', nullable=True) upper_bound = utils.get_wsman_resource_attr( system_attr_xml, cls.namespace, 'UpperBound', nullable=True) if system_attr.current_value: system_attr.current_value = int(system_attr.current_value) if system_attr.pending_value: system_attr.pending_value = int(system_attr.pending_value) if lower_bound: lower_bound = int(lower_bound) if upper_bound: upper_bound = int(upper_bound) return cls(system_attr.name, system_attr.instance_id, system_attr.current_value, system_attr.pending_value, system_attr.read_only, system_attr.fqdd, system_attr.group_id, lower_bound, upper_bound)
def parse(cls, namespace, system_attr_xml): """Parses XML and creates SystemAttribute object""" name = utils.get_wsman_resource_attr( system_attr_xml, namespace, 'AttributeName') instance_id = utils.get_wsman_resource_attr( system_attr_xml, namespace, 'InstanceID') current_value = utils.get_wsman_resource_attr( system_attr_xml, namespace, 'CurrentValue', nullable=True) pending_value = utils.get_wsman_resource_attr( system_attr_xml, namespace, 'PendingValue', nullable=True) read_only = utils.get_wsman_resource_attr( system_attr_xml, namespace, 'IsReadOnly') fqdd = utils.get_wsman_resource_attr( system_attr_xml, namespace, 'FQDD') group_id = utils.get_wsman_resource_attr( system_attr_xml, namespace, 'GroupID') return cls(name, instance_id, current_value, pending_value, (read_only == 'true'), fqdd, group_id)
def _get_job_attr(self, drac_job, attr_name): return utils.get_wsman_resource_attr(drac_job, uris.DCIM_LifecycleJob, attr_name)
def _get_cpu_attr(self, cpu, attr_name, allow_missing=False): return utils.get_wsman_resource_attr(cpu, uris.DCIM_CPUView, attr_name, allow_missing=allow_missing)
def _get_virtual_disk_attr(self, drac_disk, attr_name, nullable=False): return utils.get_wsman_resource_attr(drac_disk, uris.DCIM_VirtualDiskView, attr_name, nullable=nullable)
def _get_raid_controller_attr(self, drac_controller, attr_name): return utils.get_wsman_resource_attr(drac_controller, uris.DCIM_ControllerView, attr_name, nullable=True)
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_attr(self, drac_nic, attr_name): return utils.get_wsman_resource_attr(drac_nic, uris.DCIM_NICView, attr_name)
def _get_system_attr(self, drac_system, attr_name): return utils.get_wsman_resource_attr(drac_system, uris.DCIM_SystemView, 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)