示例#1
0
    def __init__(self, parent=None, graphics_card=None):
        UcsGpu.__init__(self, parent=parent, graphics_card=graphics_card)

        self.pci_slot = self.get_attribute(ucs_sdk_object=graphics_card,
                                           attribute_name="pci_slot")
        self.revision = self.get_attribute(ucs_sdk_object=graphics_card,
                                           attribute_name="revision")
        self.serial = self.get_attribute(ucs_sdk_object=graphics_card,
                                         attribute_name="serial")

        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=graphics_card)

        # Small fix for when GPU SKU is not present in UCS catalog
        if hasattr(self, "sku"):
            if not self.sku:
                if any(x in self.model for x in ["UCSB-", "UCSC-"]):
                    self.sku = self.model
                if self.model == "Nvidia GRID K1 P2401-502":
                    self.sku = "UCSC-GPU-VGXK1"
                if self.model == "Nvidia GRID K2 P2055-552":
                    self.sku = "UCSC-GPU-VGXK2"
                if self.model == "Nvidia M60":
                    self.sku = "UCSC-GPU-M60"
示例#2
0
    def __init__(self, parent=None, equipment_system_io_controller=None):
        UcsSioc.__init__(
            self,
            parent=parent,
            equipment_system_io_controller=equipment_system_io_controller)

        self.chassis_id = self.get_attribute(
            ucs_sdk_object=equipment_system_io_controller,
            attribute_name="chassis_id")
        self.model = self.get_attribute(
            ucs_sdk_object=equipment_system_io_controller,
            attribute_name="model")
        self.revision = self.get_attribute(
            ucs_sdk_object=equipment_system_io_controller,
            attribute_name="revision")
        self.serial = self.get_attribute(
            ucs_sdk_object=equipment_system_io_controller,
            attribute_name="serial")
        self.vendor = self.get_attribute(
            ucs_sdk_object=equipment_system_io_controller,
            attribute_name="vendor")

        UcsSystemInventoryObject.__init__(
            self, parent=parent, ucs_sdk_object=equipment_system_io_controller)

        # Fix unknown SKU for UCS-S3260-PCISIOC
        if not self.sku and self.model:
            self.sku = self.model
示例#3
0
    def __init__(self, parent=None, mgmt_if=None):
        UcsMgmtInterface.__init__(self, parent=parent, mgmt_if=mgmt_if)

        self.internal_ip = self.get_attribute(
            ucs_sdk_object=mgmt_if,
            attribute_name="ip",
            attribute_secondary_name="internal_ip")
        self.internal_mask = self.get_attribute(
            ucs_sdk_object=mgmt_if,
            attribute_name="mask",
            attribute_secondary_name="internal_mask")
        self.switch_id = self.get_attribute(ucs_sdk_object=mgmt_if,
                                            attribute_name="switch_id")

        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=mgmt_if)

        self.peer = None
        if self._inventory.load_from == "live":
            self._peer_dn = self.get_attribute(ucs_sdk_object=mgmt_if,
                                               attribute_name="peer_dn")
            self.peer = self._get_peer_port()
        elif self._inventory.load_from == "file":
            if "peer" in mgmt_if:
                self.peer = mgmt_if["peer"]
示例#4
0
    def __init__(self, parent=None, memory_unit=None):
        UcsMemoryUnit.__init__(self, parent=parent, memory_unit=memory_unit)

        self.latency = self.get_attribute(ucs_sdk_object=memory_unit, attribute_name="latency", attribute_type="float")
        self.revision = self.get_attribute(ucs_sdk_object=memory_unit, attribute_name="revision")

        UcsSystemInventoryObject.__init__(self, parent=parent, ucs_sdk_object=memory_unit)

        if self._inventory.load_from == "live":
            # Manually fixing type "Other" for memory units in some servers
            if self.type in ["Other"]:
                if hasattr(self._parent._parent, "model"):
                    if self._parent._parent.model is not None:
                        if self._parent._parent.model in ["N20-B6625-1"]:
                            self.type = "DDR3"

            self.errors_address_parity = None
            self.errors_ecc_multibit = None
            self.errors_ecc_singlebit = None
            self.errors_mismatch = None
            error_stats = self._find_corresponding_memory_error_stats()
            if error_stats:
                self.errors_address_parity = int(error_stats.address_parity_errors)
                self.errors_ecc_multibit = int(error_stats.ecc_multibit_errors)
                self.errors_ecc_singlebit = int(error_stats.ecc_singlebit_errors)
                self.errors_mismatch = int(error_stats.mismatch_errors)

        elif self._inventory.load_from == "file":
            for attribute in ["errors_address_parity", "errors_ecc_multibit", "errors_ecc_singlebit",
                              "errors_mismatch"]:
                setattr(self, attribute, None)
                if attribute in memory_unit:
                    setattr(self, attribute, self.get_attribute(ucs_sdk_object=memory_unit, attribute_name=attribute))
示例#5
0
    def __init__(self, parent=None, ether_switch_int_f_io=None):
        UcsPort.__init__(self, parent=parent, port=ether_switch_int_f_io)

        self.chassis_id = self.get_attribute(
            ucs_sdk_object=ether_switch_int_f_io, attribute_name="chassis_id")
        self.port_id = self.get_attribute(ucs_sdk_object=ether_switch_int_f_io,
                                          attribute_name="port_id")
        self.oper_state = self.get_attribute(
            ucs_sdk_object=ether_switch_int_f_io, attribute_name="oper_state")
        self.role = self.get_attribute(ucs_sdk_object=ether_switch_int_f_io,
                                       attribute_name="if_role",
                                       attribute_secondary_name="role")
        self.slot_id = self.get_attribute(ucs_sdk_object=ether_switch_int_f_io,
                                          attribute_name="slot_id")
        self.switch_id = self.get_attribute(
            ucs_sdk_object=ether_switch_int_f_io, attribute_name="switch_id")
        self.transport = self.get_attribute(
            ucs_sdk_object=ether_switch_int_f_io, attribute_name="transport")
        self.type = self.get_attribute(ucs_sdk_object=ether_switch_int_f_io,
                                       attribute_name="type")
        self.xcvr_type = self.get_attribute(
            ucs_sdk_object=ether_switch_int_f_io, attribute_name="xcvr_type")

        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=ether_switch_int_f_io)

        self.aggr_port_id = None
        self.is_breakout = False
        self.is_port_channel_member = False
        self.pc_id = None
        self.peer = None
        if self._inventory.load_from == "live":
            self._peer_dn = self.get_attribute(
                ucs_sdk_object=ether_switch_int_f_io, attribute_name="peer_dn")
            self.peer = self._get_peer_port()

            if ether_switch_int_f_io.aggr_port_id is not None:
                if ether_switch_int_f_io.aggr_port_id != '0':
                    self.aggr_port_id = ether_switch_int_f_io.aggr_port_id
                    self.is_breakout = True

            if ether_switch_int_f_io.ep_dn != "":
                self.is_port_channel_member = True
                self.pc_id = ether_switch_int_f_io.ep_dn.split("/")[4].split(
                    "-")[1]

        elif self._inventory.load_from == "file":
            for attribute in [
                    "aggr_port_id", "is_breakout", "is_port_channel_member",
                    "pc_id", "peer"
            ]:
                setattr(self, attribute, None)
                if attribute in ether_switch_int_f_io:
                    setattr(
                        self, attribute,
                        self.get_attribute(
                            ucs_sdk_object=ether_switch_int_f_io,
                            attribute_name=attribute))
示例#6
0
    def __init__(self, parent=None, memory_array=None):
        UcsMemoryArray.__init__(self, parent=parent, memory_array=memory_array)

        self.capacity_max = self.get_attribute(ucs_sdk_object=memory_array, attribute_name="max_capacity",
                                               attribute_secondary_name="capacity_max", attribute_type="int")
        self.revision = self.get_attribute(ucs_sdk_object=memory_array, attribute_name="revision")

        UcsSystemInventoryObject.__init__(self, parent=parent, ucs_sdk_object=memory_array)
示例#7
0
    def __init__(self, parent=None, fc_pio=None):
        UcsSystemFiPort.__init__(self, parent=parent, port=fc_pio)

        self.max_speed = self.get_attribute(ucs_sdk_object=fc_pio,
                                            attribute_name="max_speed")
        self.wwn = self.get_attribute(ucs_sdk_object=fc_pio,
                                      attribute_name="wwn")

        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=fc_pio)
示例#8
0
    def __init__(self, parent=None, adaptor_ext_eth_if=None):
        UcsAdaptorPort.__init__(self,
                                parent=parent,
                                adaptor_ext_eth_if=adaptor_ext_eth_if)

        self.role = self.get_attribute(ucs_sdk_object=adaptor_ext_eth_if,
                                       attribute_name="if_role",
                                       attribute_secondary_name="role")
        self.slot_id = self.get_attribute(ucs_sdk_object=adaptor_ext_eth_if,
                                          attribute_name="slot_id")
        self.switch_id = self.get_attribute(ucs_sdk_object=adaptor_ext_eth_if,
                                            attribute_name="switch_id")
        self.transport = self.get_attribute(ucs_sdk_object=adaptor_ext_eth_if,
                                            attribute_name="transport")
        self.type = self.get_attribute(ucs_sdk_object=adaptor_ext_eth_if,
                                       attribute_name="type")

        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=adaptor_ext_eth_if)

        self.aggr_port_id = None
        self.is_breakout = False
        self.is_port_channel_member = False
        self.pc_id = None
        self.peer = None
        if self._inventory.load_from == "live":
            self._peer_dn = self.get_attribute(
                ucs_sdk_object=adaptor_ext_eth_if, attribute_name="peer_dn")
            self.peer = self._get_peer_port()

            if hasattr(adaptor_ext_eth_if, "aggr_port_id"):
                if adaptor_ext_eth_if.aggr_port_id is not None:
                    if adaptor_ext_eth_if.aggr_port_id != '0':
                        self.aggr_port_id = adaptor_ext_eth_if.aggr_port_id
                        self.is_breakout = True

            if adaptor_ext_eth_if.ep_dn != "":
                self.is_port_channel_member = True
                self.pc_id = adaptor_ext_eth_if.ep_dn.split("/")[4].split(
                    "-")[1]

        elif self._inventory.load_from == "file":
            for attribute in [
                    "aggr_port_id", "is_breakout", "is_port_channel_member",
                    "pc_id", "peer"
            ]:
                setattr(self, attribute, None)
                if attribute in adaptor_ext_eth_if:
                    setattr(
                        self, attribute,
                        self.get_attribute(ucs_sdk_object=adaptor_ext_eth_if,
                                           attribute_name=attribute))
示例#9
0
    def __init__(self,
                 parent=None,
                 ucs_system_san_neighbor_entry=None,
                 ucs_system_fi_fc_port=None):
        UcsSystemInventoryObject.__init__(
            self, parent=parent, ucs_sdk_object=ucs_system_san_neighbor_entry)

        self.fabric_mgmt_addr = ucs_system_san_neighbor_entry.fabric_mgmt_addr
        self.fabric_nwwn = ucs_system_san_neighbor_entry.fabric_nwwn

        self.device_type = "fc_switch"

        self.peer_ports = [ucs_system_fi_fc_port]
示例#10
0
    def __init__(self, parent=None, processor_unit=None):
        UcsCpu.__init__(self, parent=parent, processor_unit=processor_unit)

        self.revision = self.get_attribute(ucs_sdk_object=processor_unit,
                                           attribute_name="revision")

        if self._inventory.load_from == "live":
            # We convert the speed from GHz to MHz and change it to integer in order to have a consistent value with IMC
            if self.speed != 'unspecified':
                self.speed = int(float(self.speed) * 1000)

        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=processor_unit)
示例#11
0
    def __init__(self,
                 parent=None,
                 ucs_system_lan_neighbor_entry=None,
                 ucs_system_fi_eth_port=None,
                 group_number=None):
        UcsSystemInventoryObject.__init__(
            self, parent=parent, ucs_sdk_object=ucs_system_lan_neighbor_entry)

        self.device_type = ucs_system_lan_neighbor_entry.device_type
        self.group_number = group_number
        self.ip_v4_mgmt_address = ucs_system_lan_neighbor_entry.ip_v4_mgmt_address
        self.model = ucs_system_lan_neighbor_entry.model
        self.system_name = ucs_system_lan_neighbor_entry.system_name

        self.peer_ports = [ucs_system_fi_eth_port]
示例#12
0
    def __init__(self, parent=None, equipment_rack_enclosure=None):
        UcsRackEnclosure.__init__(
            self,
            parent=parent,
            equipment_rack_enclosure=equipment_rack_enclosure)

        self.id = self.get_attribute(ucs_sdk_object=equipment_rack_enclosure,
                                     attribute_name="id")
        self.revision = self.get_attribute(
            ucs_sdk_object=equipment_rack_enclosure, attribute_name="revision")
        self.vendor = self.get_attribute(
            ucs_sdk_object=equipment_rack_enclosure, attribute_name="vendor")

        UcsSystemInventoryObject.__init__(
            self, parent=parent, ucs_sdk_object=equipment_rack_enclosure)
示例#13
0
    def __init__(self, parent=None, equipment_tpm=None):
        UcsTpm.__init__(self, parent=parent, equipment_tpm=equipment_tpm)

        self.id = self.get_attribute(ucs_sdk_object=equipment_tpm,
                                     attribute_name="id")
        self.password_state = self.get_attribute(
            ucs_sdk_object=equipment_tpm, attribute_name="password_state")
        self.revision = self.get_attribute(ucs_sdk_object=equipment_tpm,
                                           attribute_name="revision")
        self.type = self.get_attribute(ucs_sdk_object=equipment_tpm,
                                       attribute_name="type")

        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=equipment_tpm)
示例#14
0
    def __init__(self, parent=None, ether_pio=None):
        UcsSystemFiPort.__init__(self, parent=parent, port=ether_pio)

        self.mac = self.get_attribute(ucs_sdk_object=ether_pio,
                                      attribute_name="mac")

        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=ether_pio)

        self.peer = None
        if self._inventory.load_from == "live":
            self._peer_dn = self.get_attribute(ucs_sdk_object=ether_pio,
                                               attribute_name="peer_dn")
            self.peer = self._get_peer_port()
        elif self._inventory.load_from == "file":
            if "peer" in ether_pio:
                self.peer = ether_pio["peer"]
示例#15
0
    def __init__(self, parent=None, equipment_psu=None):
        UcsPsu.__init__(self, parent=parent, equipment_psu=equipment_psu)

        self.revision = self.get_attribute(ucs_sdk_object=equipment_psu, attribute_name="revision")

        UcsSystemInventoryObject.__init__(self, parent=parent, ucs_sdk_object=equipment_psu)

        # Small fix for SKU typos in UCS catalog
        if hasattr(self, "sku"):
            if self.sku == "NXK-PAC-400W ":
                self.sku = "NXK-PAC-400W"
            if self.sku == " UCSC-PSUF-1050W ":
                self.sku = "UCSC-PSUF-1050W"

        # Small fix for when PSU is not present in UCS catalog
        if hasattr(self, "sku"):
            if not self.sku:
                if self.model in ["N2200-PAC-400W", "N2200-PAC-400W-B", "NXA-PAC-1200W-PE"]:
                    self.sku = self.model
示例#16
0
    def __init__(self, parent=None, equipment_chassis=None):
        UcsChassis.__init__(self,
                            parent=parent,
                            equipment_chassis=equipment_chassis)

        self.id = self.get_attribute(ucs_sdk_object=equipment_chassis,
                                     attribute_name="id")
        self.revision = self.get_attribute(ucs_sdk_object=equipment_chassis,
                                           attribute_name="revision")
        self.vendor = self.get_attribute(ucs_sdk_object=equipment_chassis,
                                         attribute_name="vendor")

        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=equipment_chassis)

        self.blades = self._get_blades()
        self.fabric_interconnects = self._get_fabric_interconnects()
        self.io_modules = self._get_io_modules()
        self.storage_enclosures = self._get_storage_enclosures()
        self.slots_max = self._get_chassis_slots_max()
        self.slots_populated = self._calculate_chassis_slots_populated()
        self.slots_free_half = self._calculate_chassis_slots_free_half()
        self.slots_free_full = self._calculate_chassis_slots_free_full()
        self.imm_compatible = None
        self.locator_led_status = None
        self.short_name = None

        if self._inventory.load_from == "live":
            self.locator_led_status = self._determine_locator_led_status()
            self.short_name = self._get_model_short_name()
            self.imm_compatible = self._get_imm_compatibility()
        elif self._inventory.load_from == "file":
            for attribute in [
                    "imm_compatible", "locator_led_status", "short_name"
            ]:
                setattr(self, attribute, None)
                if attribute in equipment_chassis:
                    setattr(
                        self, attribute,
                        self.get_attribute(ucs_sdk_object=equipment_chassis,
                                           attribute_name=attribute))
示例#17
0
    def __init__(self, parent=None, adaptor_unit=None):
        UcsAdaptor.__init__(self, parent=parent, adaptor_unit=adaptor_unit)

        self.blade_id = self.get_attribute(ucs_sdk_object=adaptor_unit,
                                           attribute_name="blade_id")
        self.id = self.get_attribute(ucs_sdk_object=adaptor_unit,
                                     attribute_name="id")
        self.pci_slot = self.get_attribute(ucs_sdk_object=adaptor_unit,
                                           attribute_name="pci_slot")
        self.revision = self.get_attribute(ucs_sdk_object=adaptor_unit,
                                           attribute_name="revision")
        self.serial = self.get_attribute(ucs_sdk_object=adaptor_unit,
                                         attribute_name="serial")
        self.vendor = self.get_attribute(ucs_sdk_object=adaptor_unit,
                                         attribute_name="vendor")

        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=adaptor_unit)

        self.imm_compatible = None
        self.short_name = None
        if self._inventory.load_from == "live":
            self.driver_name_ethernet = None
            self.driver_name_fibre_channel = None
            self.driver_version_ethernet = None
            self.driver_version_fibre_channel = None
            self.short_name = self._get_model_short_name()
            self.imm_compatible = self._get_imm_compatibility()
        elif self._inventory.load_from == "file":
            for attribute in [
                    "driver_name_ethernet", "driver_name_fibre_channel",
                    "driver_version_ethernet", "driver_version_fibre_channel",
                    "imm_compatible", "short_name"
            ]:
                setattr(self, attribute, None)
                if attribute in adaptor_unit:
                    setattr(
                        self, attribute,
                        self.get_attribute(ucs_sdk_object=adaptor_unit,
                                           attribute_name=attribute))
示例#18
0
    def __init__(self, parent=None, equipment_io_card=None):
        UcsIom.__init__(self,
                        parent=parent,
                        equipment_io_card=equipment_io_card)
        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=equipment_io_card)

        self.imm_compatible = None
        self.short_name = None

        if self._inventory.load_from == "live":
            self.short_name = self._get_model_short_name()
            self.imm_compatible = self._get_imm_compatibility()

        elif self._inventory.load_from == "file":
            for attribute in ["imm_compatible", "short_name"]:
                setattr(self, attribute, None)
                if attribute in equipment_io_card:
                    setattr(
                        self, attribute,
                        self.get_attribute(ucs_sdk_object=equipment_io_card,
                                           attribute_name=attribute))
示例#19
0
    def __init__(self, parent=None, compute_rack_unit=None):
        UcsRack.__init__(self,
                         parent=parent,
                         compute_rack_unit=compute_rack_unit)

        self.assigned_to_dn = self.get_attribute(
            ucs_sdk_object=compute_rack_unit, attribute_name="assigned_to_dn")
        self.association = self.get_attribute(ucs_sdk_object=compute_rack_unit,
                                              attribute_name="association")
        self.enclosure_id = self.get_attribute(
            ucs_sdk_object=compute_rack_unit, attribute_name="enclosure_id")
        self.revision = self.get_attribute(ucs_sdk_object=compute_rack_unit,
                                           attribute_name="revision")

        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=compute_rack_unit)

        self.imm_compatible = None
        self.locator_led_status = None
        self.mgmt_connection_type = None
        self.os_arch = None
        self.os_kernel_version = None
        self.os_patch_version = None
        self.os_release_version = None
        self.os_type = None
        self.os_ucs_tool_version = None
        self.os_update_version = None
        self.os_vendor = None
        self.pcie_risers = None
        self.service_profile_org = None
        self.service_profile_name = None
        self.service_profile_template = None
        self.service_profile_template_org = None
        self.service_profile_template_name = None
        self.short_name = None
        if self._inventory.load_from == "live":
            self.short_name = self._get_model_short_name()
            self.imm_compatible = self._get_imm_compatibility()
            self.mgmt_connection_type = self._get_mgmt_connection_type()
            self.locator_led_status = self._determine_locator_led_status()
            self._find_pcie_risers()
            self._get_os_details()
            if self.assigned_to_dn is not None and self.assigned_to_dn != "":
                self.service_profile_org = self.assigned_to_dn.split("/ls-")[0]
                self.service_profile_name = self.assigned_to_dn.split(
                    "/")[-1].split("ls-")[-1]
                self.service_profile_template = self._get_service_profile_template(
                )
                if self.service_profile_template is not None and self.service_profile_template != "" and \
                        "org" in self.service_profile_template:
                    self.service_profile_template_org = self.service_profile_template.split(
                        "/ls-")[0]
                    self.service_profile_template_name = self.service_profile_template.split(
                        "/")[-1].split("ls-")[-1]
                elif self.service_profile_template is not None and self.service_profile_template != "":
                    self.service_profile_template_org = "UCS Central"
                    self.service_profile_template_name = self.service_profile_template
                else:
                    self.service_profile_template = None
            else:
                self.assigned_to_dn = None

        elif self._inventory.load_from == "file":
            for attribute in [
                    "imm_compatible", "locator_led_status",
                    "mgmt_connection_type", "os_arch", "os_kernel_version",
                    "os_patch_version", "os_release_version", "os_type",
                    "os_ucs_tool_version", "os_update_version", "os_vendor",
                    "pcie_risers", "service_profile_org",
                    "service_profile_name", "service_profile_template",
                    "service_profile_template_org",
                    "service_profile_template_name", "short_name"
            ]:
                setattr(self, attribute, None)
                if attribute in compute_rack_unit:
                    setattr(
                        self, attribute,
                        self.get_attribute(ucs_sdk_object=compute_rack_unit,
                                           attribute_name=attribute))
示例#20
0
 def __init__(self, parent=None, neighbor_entry=None):
     UcsSystemInventoryObject.__init__(self,
                                       parent=parent,
                                       ucs_sdk_object=neighbor_entry)
示例#21
0
    def __init__(self, parent=None, compute_blade=None):
        UcsBlade.__init__(self, parent=parent, compute_blade=compute_blade)

        self.assigned_to_dn = self.get_attribute(ucs_sdk_object=compute_blade, attribute_name="assigned_to_dn")
        self.association = self.get_attribute(ucs_sdk_object=compute_blade, attribute_name="association")
        self.chassis_id = self.get_attribute(ucs_sdk_object=compute_blade, attribute_name="chassis_id")
        self.id = self.get_attribute(ucs_sdk_object=compute_blade, attribute_name="server_id",
                                     attribute_secondary_name="id")
        self.memory_available = self.get_attribute(ucs_sdk_object=compute_blade, attribute_name="available_memory",
                                                   attribute_secondary_name="memory_available", attribute_type="int")
        self.memory_total = self.get_attribute(ucs_sdk_object=compute_blade, attribute_name="total_memory",
                                               attribute_secondary_name="memory_total", attribute_type="int")
        self.scaled_mode = self.get_attribute(ucs_sdk_object=compute_blade, attribute_name="scaled_mode")

        UcsSystemInventoryObject.__init__(self, parent=parent, ucs_sdk_object=compute_blade)

        # Adding a human-readable attribute for memory capacity
        self.memory_total_marketing = None
        if self.memory_total:
            if self.memory_total / 1024 < 1024:
                memory_total_gb = str(self.memory_total / 1024)
                memory_total_gb = memory_total_gb.rstrip('0').rstrip('.') if '.' in memory_total_gb else memory_total_gb
                self.memory_total_marketing = memory_total_gb + " GB"
            else:
                memory_total_tb = str(self.memory_total / 1048576)
                memory_total_tb = memory_total_tb.rstrip('0').rstrip('.') if '.' in memory_total_tb else memory_total_tb
                self.memory_total_marketing = memory_total_tb + " TB"

        self.imm_compatible = None
        self.locator_led_status = None
        self.os_arch = None
        self.os_kernel_version = None
        self.os_patch_version = None
        self.os_release_version = None
        self.os_type = None
        self.os_ucs_tool_version = None
        self.os_update_version = None
        self.os_vendor = None
        self.service_profile_org = None
        self.service_profile_name = None
        self.service_profile_template = None
        self.service_profile_template_org = None
        self.service_profile_template_name = None
        self.short_name = None
        self.sku_scaled = None
        if self._inventory.load_from == "live":
            # Handle specific case of SKU for B260 M4 / B460 M4
            if self.scaled_mode is not None:
                if self.scaled_mode == "single":
                    self.sku_scaled = self.sku + "C"
                elif self.scaled_mode == "scaled":
                    self.sku_scaled = self.sku + "A"

            self.short_name = self._get_model_short_name()
            self.imm_compatible = self._get_imm_compatibility()
            self.locator_led_status = self._determine_locator_led_status()
            self._get_os_details()
            if self.assigned_to_dn is not None and self.assigned_to_dn != "":
                self.service_profile_org = self.assigned_to_dn.split("/ls-")[0]
                self.service_profile_name = self.assigned_to_dn.split("/")[-1].split("ls-")[-1]
                self.service_profile_template = self._get_service_profile_template()
                if self.service_profile_template is not None and self.service_profile_template != "" and \
                        "org" in self.service_profile_template:
                    self.service_profile_template_org = self.service_profile_template.split("/ls-")[0]
                    self.service_profile_template_name = self.service_profile_template.split("/")[-1].split("ls-")[-1]
                elif self.service_profile_template is not None and self.service_profile_template != "":
                    self.service_profile_template_org = "UCS Central"
                    self.service_profile_template_name = self.service_profile_template
                else:
                    self.service_profile_template = None
            else:
                self.assigned_to_dn = None

        elif self._inventory.load_from == "file":
            for attribute in ["imm_compatible", "locator_led_status", "os_arch", "os_kernel_version",
                              "os_patch_version", "os_release_version", "os_type", "os_ucs_tool_version",
                              "os_update_version", "os_vendor", "service_profile_org", "service_profile_name",
                              "service_profile_template", "service_profile_template_org",
                              "service_profile_template_name", "short_name", "sku_scaled"]:
                setattr(self, attribute, None)
                if attribute in compute_blade:
                    setattr(self, attribute, self.get_attribute(ucs_sdk_object=compute_blade,
                                                                attribute_name=attribute))
示例#22
0
    def __init__(self, parent=None, equipment_xcvr=None):
        UcsTransceiver.__init__(self,
                                parent=parent,
                                transceiver=equipment_xcvr)

        self.model = self.get_attribute(ucs_sdk_object=equipment_xcvr,
                                        attribute_name="model")
        self.revision = self.get_attribute(ucs_sdk_object=equipment_xcvr,
                                           attribute_name="revision")
        self.serial = self.get_attribute(ucs_sdk_object=equipment_xcvr,
                                         attribute_name="serial")

        UcsSystemInventoryObject.__init__(self,
                                          parent=parent,
                                          ucs_sdk_object=equipment_xcvr)

        self.sku = None
        self.length = None
        transceiver_types_matrix = {
            # SFP+ 10Gbps Twinax & AOC
            "h10gcu1m": {
                "sku": "SFP-H10GB-CU1M",
                "length": "1m"
            },
            "h10gcu1-5m": {
                "sku": "SFP-H10GB-CU1-5M",
                "length": "1.5m"
            },
            "h10gcu2m": {
                "sku": "SFP-H10GB-CU2M",
                "length": "2m"
            },
            "h10gcu2-5m": {
                "sku": "SFP-H10GB-CU2-5M",
                "length": "2.5m"
            },
            "h10gcu3m": {
                "sku": "SFP-H10GB-CU3M",
                "length": "3m"
            },
            "h10gcu5m": {
                "sku": "SFP-H10GB-CU5M",
                "length": "5m"
            },
            "h10gacu7m": {
                "sku": "SFP-H10GB-ACU7M",
                "length": "7m"
            },
            "h10gacu10m": {
                "sku": "SFP-H10GB-ACU10M",
                "length": "10m"
            },
            "h10gaoc1m": {
                "sku": "SFP-10G-AOC1M",
                "length": "1m"
            },
            "h10gaoc2m": {
                "sku": "SFP-10G-AOC2M",
                "length": "2m"
            },
            "h10gaoc3m": {
                "sku": "SFP-10G-AOC3M",
                "length": "3m"
            },
            "h10gaoc5m": {
                "sku": "SFP-10G-AOC5M",
                "length": "5m"
            },
            "h10gaoc7m": {
                "sku": "SFP-10G-AOC7M",
                "length": "7m"
            },
            "h10gaoc10m": {
                "sku": "SFP-10G-AOC10M",
                "length": "10m"
            },
            # SFP+ 10Gbps Twinax & AOC Indeterminate models
            "h10gacuaoc1m": {
                "sku": "SFP-H10GB-ACU/AOC1M",
                "length": "1m"
            },
            "h10gacuaoc2m": {
                "sku": "SFP-H10GB-ACU/AOC2M",
                "length": "2m"
            },
            "h10gacuaoc3m": {
                "sku": "SFP-H10GB-ACU/AOC3M",
                "length": "3m"
            },
            "h10gacuaoc5m": {
                "sku": "SFP-H10GB-ACU/AOC5M",
                "length": "5m"
            },
            "h10gacuaoc7m": {
                "sku": "SFP-H10GB-ACU/AOC7M",
                "length": "7m"
            },
            "h10gacuaoc10m": {
                "sku": "SFP-H10GB-ACU/AOC10M",
                "length": "10m"
            },
            "h10gacuaoc15m": {
                "sku": "SFP-H10GB-ACU/AOC15M",
                "length": "15m"
            },

            # SFP28 25Gbps Twinax & AOC
            "h25gcu1m": {
                "sku": "SFP-H25G-CU1M",
                "length": "1m"
            },
            "h25gcu2m": {
                "sku": "SFP-H25G-CU2M",
                "length": "2m"
            },
            "h25gcu3m": {
                "sku": "SFP-H25G-CU3M",
                "length": "3m"
            },
            "h25gcu4m": {
                "sku": "SFP-H25G-CU4M",
                "length": "4m"
            },
            "h25gcu5m": {
                "sku": "SFP-H25G-CU5M",
                "length": "5m"
            },
            "h25gaoc1m": {
                "sku": "SFP-25G-AOC1M",
                "length": "1m"
            },
            "h25gaoc2m": {
                "sku": "SFP-25G-AOC2M",
                "length": "2m"
            },
            "h25gaoc3m": {
                "sku": "SFP-25G-AOC3M",
                "length": "3m"
            },
            "h25gaoc5m": {
                "sku": "SFP-25G-AOC5M",
                "length": "5m"
            },
            "h25gaoc7m": {
                "sku": "SFP-25G-AOC7M",
                "length": "7m"
            },
            "h25gaoc10m": {
                "sku": "SFP-25G-AOC10M",
                "length": "10m"
            },

            # QSFP+ 40Gbps Twinax & AOC
            "qsfph40gcu1m": {
                "sku": "QSFP-H40G-CU1M",
                "length": "1m"
            },
            "qsfph40gcu2m": {
                "sku": "QSFP-H40G-CU2M",
                "length": "2m"
            },
            "qsfph40gcu3m": {
                "sku": "QSFP-H40G-CU3M",
                "length": "3m"
            },
            "qsfph40gcu5m": {
                "sku": "QSFP-H40G-CU5M",
                "length": "5m"
            },
            "qsfph40gacu7m": {
                "sku": "QSFP-H40G-ACU7M",
                "length": "7m"
            },
            "qsfph40gacu10m": {
                "sku": "QSFP-H40G-ACU10M",
                "length": "10m"
            },
            "qsfph40gaoc1m": {
                "sku": "QSFP-H40G-AOC1M",
                "length": "1m"
            },
            "qsfph40gaoc2m": {
                "sku": "QSFP-H40G-AOC2M",
                "length": "2m"
            },
            "qsfph40gaoc3m": {
                "sku": "QSFP-H40G-AOC3M",
                "length": "3m"
            },
            "qsfph40gaoc5m": {
                "sku": "QSFP-H40G-AOC5M",
                "length": "5m"
            },
            "qsfph40gaoc7m": {
                "sku": "QSFP-H40G-AOC7M",
                "length": "7m"
            },
            "qsfph40gaoc10m": {
                "sku": "QSFP-H40G-AOC10M",
                "length": "10m"
            },
            "qsfph40gaoc15m": {
                "sku": "QSFP-H40G-AOC15M",
                "length": "15m"
            },

            # QSFP+ 4x10Gbps Twinax & AOC
            "qsfp4sfp10gcu1m": {
                "sku": "QSFP-4SFP10G-CU1M",
                "length": "1m"
            },
            "qsfp4sfp10gcu2m": {
                "sku": "QSFP-4SFP10G-CU2M",
                "length": "2m"
            },
            "qsfp4sfp10gcu3m": {
                "sku": "QSFP-4SFP10G-CU3M",
                "length": "3m"
            },
            "qsfp4sfp10gcu5m": {
                "sku": "QSFP-4SFP10G-CU5M",
                "length": "5m"
            },
            "qsfp4x10gac7m": {
                "sku": "QSFP-4X10G-AC7M",
                "length": "7m"
            },
            "qsfp4x10gac10m": {
                "sku": "QSFP-4X10G-AC10M",
                "length": "10m"
            },
            "qsfp4x10ga0c1m": {
                "sku": "QSFP-4X10G-AOC1M",
                "length": "1m"
            },
            "qsfp4x10ga0c2m": {
                "sku": "QSFP-4X10G-AOC2M",
                "length": "2m"
            },
            "qsfp4x10ga0c3m": {
                "sku": "QSFP-4X10G-AOC3M",
                "length": "3m"
            },
            "qsfp4x10ga0c5m": {
                "sku": "QSFP-4X10G-AOC5M",
                "length": "5m"
            },
            "qsfp4x10ga0c7m": {
                "sku": "QSFP-4X10G-AOC7M",
                "length": "7m"
            },
            "qsfp4x10ga0c10m": {
                "sku": "QSFP-4X10G-AOC10M",
                "length": "10m"
            },

            # QSFP28 100Gbps Twinax & AOC
            "qsfp100gcu1m": {
                "sku": "QSFP-100G-CU1M",
                "length": "1m"
            },
            "qsfp100gcu2m": {
                "sku": "QSFP-100G-CU2M",
                "length": "2m"
            },
            "qsfp100gcu3m": {
                "sku": "QSFP-100G-CU3M",
                "length": "3m"
            },
            "qsfp100gaoc1m": {
                "sku": "QSFP-100G-AOC1M",
                "length": "1m"
            },
            "qsfp100gaoc2m": {
                "sku": "QSFP-100G-AOC2M",
                "length": "2m"
            },
            "qsfp100gaoc3m": {
                "sku": "QSFP-100G-AOC3M",
                "length": "3m"
            },
            "qsfp100gaoc5m": {
                "sku": "QSFP-100G-AOC5M",
                "length": "5m"
            },
            "qsfp100gaoc7m": {
                "sku": "QSFP-100G-AOC7M",
                "length": "7m"
            },
            "qsfp100gaoc10m": {
                "sku": "QSFP-100G-AOC10M",
                "length": "10m"
            },
            "qsfp100gaoc15m": {
                "sku": "QSFP-100G-AOC15M",
                "length": "15m"
            },
            "qsfp100gaoc20m": {
                "sku": "QSFP-100G-AOC20M",
                "length": "20m"
            },
            "qsfp100gaoc25m": {
                "sku": "QSFP-100G-AOC25M",
                "length": "25m"
            },
            "qsfp100gaoc30m": {
                "sku": "QSFP-100G-AOC30M",
                "length": "30m"
            },

            # QSFP28 4x25Gbps Twinax & AOC
            "qsfp4sfp25gcu1m": {
                "sku": "QSFP-4SFP25G-CU1M",
                "length": "1m"
            },
            "qsfp4sfp25gcu2m": {
                "sku": "QSFP-4SFP25G-CU2M",
                "length": "2m"
            },
            "qsfp4sfp25gcu3m": {
                "sku": "QSFP-4SFP25G-CU3M",
                "length": "3m"
            },
            "qsfp4sfp25gcu5m": {
                "sku": "QSFP-4SFP25G-CU5M",
                "length": "5m"
            },

            # SFP 1Gbps transceivers
            # SFP 1Gbps transceivers Indeterminate models
            "1000baset": {
                "sku": "GLC-T/TE|SFP-GE-T",
                "length": "<=100m"
            },
            "1000basesx": {
                "sku": "GLC-SX-MM/MMD",
                "length": "<=1km"
            },
            "1000baselh": {
                "sku": "GLC-LH-SM/SMD",
                "length": "<=10km"
            },

            # SFP+ 10Gbps transceivers
            "fet": {
                "sku": "FET-10G",
                "length": "<=100m"
            },
            "10gbasesrs": {
                "sku": "SFP-10G-SR-S",
                "length": "<=400m"
            },
            "10gbaselrs": {
                "sku": "SFP-10G-LR-S",
                "length": "<=10km"
            },
            # SFP+ 10Gbps transceivers Indeterminate models
            "10gbasesr": {
                "sku": "SFP-10G-SR/SR-S",
                "length": "<=400m"
            },
            "10gbaselr": {
                "sku": "SFP-10G-LR/LR-S",
                "length": "<=10km"
            },

            # SFP28 25Gbps transceivers
            "h25gsrs": {
                "sku": "SFP-25G-SR-S",
                "length": "<=100m"
            },
            "h25glrs": {
                "sku": "SFP-10/25G-LR-S",
                "length": "<=10km"
            },

            # QSFP+ 40Gbps transceivers
            "qsfpqsa": {
                "sku": "CVR-QSFP-SFP10G",
                "length": "n/a"
            },
            "qsfp40gfet": {
                "sku": "FET-40G",
                "length": "<=150m"
            },
            "qsfp40gsrbd": {
                "sku": "QSFP-40G-SR-BD",
                "length": "<=150m"
            },
            "qsfp40gcsr4": {
                "sku": "QSFP-40G-CSR4",
                "length": "<=400m"
            },
            "qsfp40ger4": {
                "sku": "QSFP-40G-ER4",
                "length": "<=40km"
            },
            # QSFP+ 40Gbps transceivers Indeterminate models
            "qsfp40gsr4": {
                "sku": "QSFP-40G-SR4/SR4-S",
                "length": "<=150m"
            },
            "qsfp40glr4": {
                "sku": "QSFP-40G-LR4/LR4-S",
                "length": "<=10km"
            },

            # QSFP28 100Gbps transceivers
            "qsfp100g40gbidi": {
                "sku": "QSFP-40/100-SRBD",
                "length": "<=100m"
            },
            "qsfp100gsmsr": {
                "sku": "QSFP-100G-SM-SR",
                "length": "<=2km"
            },
            "qsfp100gcr4": {
                "sku": "QSFP-100G-SR4-S",
                "length": "<=100m"
            },
            "qsfp100gsr4": {
                "sku": "QSFP-100G-SR4-S",
                "length": "<=100m"
            },
            "qsfp100gsr4s": {
                "sku": "QSFP-100G-SR4-S",
                "length": "<=100m"
            },
            "qsfp100glr4s": {
                "sku": "QSFP-100G-LR4-S",
                "length": "<=10km"
            }
        }
        for transceiver_type in transceiver_types_matrix.keys():
            if self.type == transceiver_type:
                self.sku = transceiver_types_matrix[transceiver_type]["sku"]
                self.length = transceiver_types_matrix[transceiver_type][
                    "length"]

        # Manual entries for FC transceivers
        if self._parent.__class__.__name__ == "UcsSystemFiFcPort":
            if self.type in ["sfp", "unknown"]:
                if self.model in ["FTLF8524P2BNL-C2"]:
                    self.sku = "DS-SFP-FC4G-SW"
                    self.length = "<=380m"
                if self.model in [
                        "FTLF8528P2BCV-CS", "FTLF8528P3BCV-C1",
                        "SFBR-5780AMZ-CS2", "SFBR-5780APZ-CS2"
                ]:
                    self.sku = "DS-SFP-FC8G-SW"
                    self.length = "<=190m"
                if self.model in [
                        "FTLF8528P3BCV-CS", "FTLF8529P3BCV-CS",
                        "AFBR-57F5PZ-CS1"
                ]:
                    self.sku = "DS-SFP-FC16G-SW"
                    self.length = "<=125m"
                if self.model in ["FTLF8532P4BCV-C1", "SFBR-57G5MZ-CS1"]:
                    self.sku = "DS-SFP-FC32G-SW"
                    self.length = "<=100m"

        # Manual entries for unknown Ethernet transceivers
        if self._parent.__class__.__name__ == "UcsSystemFiEthPort":
            if self.type in ["unknown"]:
                if self.model in ["74752-9026"]:
                    self.sku = "SFP-H10GB-CU3M"
                    self.length = "3m"