Skip to content

Field Serviceable Units Models

nautobot_fsus.models

Object models for Nautobot FSUS.

CPU

Bases: FSUModel

Represents an individual CPU component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class CPU(FSUModel):
    """Represents an individual CPU component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="CPUType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="CPU Type",
    )

    parent_mainboard: ForeignKey = models.ForeignKey(
        to="Mainboard",
        on_delete=models.PROTECT,
        related_name="cpus",
        blank=True,
        null=True,
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "CPU"
        verbose_name_plural = "CPUs"

    def clean_fields(self, exclude=None) -> None:
        """Validate the parent Device against the parent Mainboard."""
        super().clean_fields(exclude=exclude)

        parent_mainboard: Mainboard
        if parent_mainboard := copy(self.parent_mainboard):
            errors = {}

            try:
                validate_parent_device([self], parent_mainboard.device)
            except ValidationError as error:
                errors["parent_mainboard"] = error.error_list

            if socket_count := parent_mainboard.fsu_type.cpu_socket_count:
                cpu_count = parent_mainboard.cpus.count()
                if self not in parent_mainboard.cpus.all() and cpu_count >= socket_count:
                    errors.setdefault("parent_mainboard", [])
                    errors["parent_mainboard"].extend(
                        ValidationError("Mainboard has no available CPU sockets.").error_list
                    )

            if errors:
                raise ValidationError(errors)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "CPU"
    verbose_name_plural = "CPUs"

clean_fields(exclude=None)

Validate the parent Device against the parent Mainboard.

Source code in nautobot_fsus/models/fsus.py
def clean_fields(self, exclude=None) -> None:
    """Validate the parent Device against the parent Mainboard."""
    super().clean_fields(exclude=exclude)

    parent_mainboard: Mainboard
    if parent_mainboard := copy(self.parent_mainboard):
        errors = {}

        try:
            validate_parent_device([self], parent_mainboard.device)
        except ValidationError as error:
            errors["parent_mainboard"] = error.error_list

        if socket_count := parent_mainboard.fsu_type.cpu_socket_count:
            cpu_count = parent_mainboard.cpus.count()
            if self not in parent_mainboard.cpus.all() and cpu_count >= socket_count:
                errors.setdefault("parent_mainboard", [])
                errors["parent_mainboard"].extend(
                    ValidationError("Mainboard has no available CPU sockets.").error_list
                )

        if errors:
            raise ValidationError(errors)

CPUTemplate

Bases: FSUTemplateModel

A template for a CPU to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class CPUTemplate(FSUTemplateModel):
    """A template for a CPU to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="CPUType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "CPU Template"
        verbose_name_plural = "CPU Templates"

    def instantiate(self, device: Device) -> CPU:
        """Instantiate a new CPU on a Device."""
        return self._instantiate_model(model=CPU, device=device)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "CPU Template"
    verbose_name_plural = "CPU Templates"

instantiate(device)

Instantiate a new CPU on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> CPU:
    """Instantiate a new CPU on a Device."""
    return self._instantiate_model(model=CPU, device=device)

CPUType

Bases: FSUTypeModel

Represents a CPU component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class CPUType(FSUTypeModel):
    """Represents a CPU component type."""

    architecture = models.CharField(
        max_length=4,
        choices=choices.CPUArchitectures,
        default=choices.CPUArchitectures.x86,
    )

    cpu_speed = models.FloatField(
        blank=True,
        null=True,
        validators=[MinValueValidator(0.0)],
        help_text="CPU speed in GHz",
    )

    cores = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
    )

    pcie_generation = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
        choices=choices.PCIeGenerations,
    )

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "CPU Type"
        verbose_name_plural = "CPU Types"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "CPU Type"
    verbose_name_plural = "CPU Types"

Disk

Bases: FSUModel

Represents an individual Disk component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class Disk(FSUModel):
    """Represents an individual Disk component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="DiskType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="Disk Type",
    )

    parent_hba: ForeignKey = models.ForeignKey(
        to="HBA",
        on_delete=models.PROTECT,
        related_name="disks",
        blank=True,
        null=True,
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Disk"
        verbose_name_plural = "Disks"

    def clean_fields(self, exclude=None) -> None:
        """Validate the parent Device against the parent HBA."""
        super().clean_fields(exclude=exclude)

        parent_hba: HBA
        if parent_hba := copy(self.parent_hba):
            try:
                validate_parent_device([self], parent_hba.device)
            except ValidationError as error:
                raise ValidationError({"parent_hba": error.error_list}) from error

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Disk"
    verbose_name_plural = "Disks"

clean_fields(exclude=None)

Validate the parent Device against the parent HBA.

Source code in nautobot_fsus/models/fsus.py
def clean_fields(self, exclude=None) -> None:
    """Validate the parent Device against the parent HBA."""
    super().clean_fields(exclude=exclude)

    parent_hba: HBA
    if parent_hba := copy(self.parent_hba):
        try:
            validate_parent_device([self], parent_hba.device)
        except ValidationError as error:
            raise ValidationError({"parent_hba": error.error_list}) from error

DiskTemplate

Bases: FSUTemplateModel

A template for a Disk to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class DiskTemplate(FSUTemplateModel):
    """A template for a Disk to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="DiskType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Disk Template"
        verbose_name_plural = "Disk Templates"

    def instantiate(self, device: Device) -> Disk:
        """Instantiate a new Disk on a Device."""
        return self._instantiate_model(model=Disk, device=device)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Disk Template"
    verbose_name_plural = "Disk Templates"

instantiate(device)

Instantiate a new Disk on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> Disk:
    """Instantiate a new Disk on a Device."""
    return self._instantiate_model(model=Disk, device=device)

DiskType

Bases: FSUTypeModel

Represents a Disk component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class DiskType(FSUTypeModel):
    """Represents a Disk component type."""

    disk_type = models.CharField(
        max_length=4,
        choices=choices.DiskTypes,
        default=choices.DiskTypes.disk_ssd,
    )

    size = models.PositiveIntegerField(
        blank=True,
        null=True,
        validators=[MinValueValidator(1)],
        help_text="Disk size, in GB",
    )

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Disk Type"
        verbose_name_plural = "Disk Types"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Disk Type"
    verbose_name_plural = "Disk Types"

Fan

Bases: FSUModel

Represents an individual Fan component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class Fan(FSUModel):
    """Represents an individual Fan component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="FanType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="Fan Type",
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Fan"
        verbose_name_plural = "Fans"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Fan"
    verbose_name_plural = "Fans"

FanTemplate

Bases: FSUTemplateModel

A template for a Fan to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class FanTemplate(FSUTemplateModel):
    """A template for a Fan to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="FanType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Fan Template"
        verbose_name_plural = "Fan Templates"

    def instantiate(self, device: Device) -> Fan:
        """Instantiate a new Fan on a Device."""
        return self._instantiate_model(model=Fan, device=device)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Fan Template"
    verbose_name_plural = "Fan Templates"

instantiate(device)

Instantiate a new Fan on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> Fan:
    """Instantiate a new Fan on a Device."""
    return self._instantiate_model(model=Fan, device=device)

FanType

Bases: FSUTypeModel

Represents a Fan component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class FanType(FSUTypeModel):
    """Represents a Fan component type."""

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Fan Type"
        verbose_name_plural = "Fan Types"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Fan Type"
    verbose_name_plural = "Fan Types"

GPU

Bases: PCIFSUModel

Represents an individual GPU component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class GPU(PCIFSUModel):
    """Represents an individual GPU component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="GPUType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="GPU Type",
    )

    parent_gpubaseboard: ForeignKey = models.ForeignKey(
        to="GPUBaseboard",
        on_delete=models.PROTECT,
        related_name="gpus",
        blank=True,
        null=True,
    )

    class Meta(PCIFSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "GPU"
        verbose_name_plural = "GPUs"

    def clean_fields(self, exclude=None) -> None:
        """Validate the parent Device against the parent GPU Baseboard."""
        super().clean_fields(exclude=exclude)

        # if self.parent_gpubaseboard is not None:
        parent_gpubaseboard: GPUBaseboard
        if parent_gpubaseboard := copy(self.parent_gpubaseboard):
            errors = {}

            try:
                validate_parent_device([self], parent_gpubaseboard.device)
            except ValidationError as error:
                errors["parent_gpubaseboard"] = error.error_list

            if slot_count := parent_gpubaseboard.fsu_type.slot_count:
                gpu_count = parent_gpubaseboard.gpus.count()
                if self not in parent_gpubaseboard.gpus.all() and gpu_count >= slot_count:
                    errors.setdefault("parent_gpubaseboard", [])
                    errors["parent_gpubaseboard"].extend(
                        ValidationError("GPU Baseboard has no available slots.").error_list
                    )

            if errors:
                raise ValidationError(errors)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(PCIFSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "GPU"
    verbose_name_plural = "GPUs"

clean_fields(exclude=None)

Validate the parent Device against the parent GPU Baseboard.

Source code in nautobot_fsus/models/fsus.py
def clean_fields(self, exclude=None) -> None:
    """Validate the parent Device against the parent GPU Baseboard."""
    super().clean_fields(exclude=exclude)

    # if self.parent_gpubaseboard is not None:
    parent_gpubaseboard: GPUBaseboard
    if parent_gpubaseboard := copy(self.parent_gpubaseboard):
        errors = {}

        try:
            validate_parent_device([self], parent_gpubaseboard.device)
        except ValidationError as error:
            errors["parent_gpubaseboard"] = error.error_list

        if slot_count := parent_gpubaseboard.fsu_type.slot_count:
            gpu_count = parent_gpubaseboard.gpus.count()
            if self not in parent_gpubaseboard.gpus.all() and gpu_count >= slot_count:
                errors.setdefault("parent_gpubaseboard", [])
                errors["parent_gpubaseboard"].extend(
                    ValidationError("GPU Baseboard has no available slots.").error_list
                )

        if errors:
            raise ValidationError(errors)

GPUBaseboard

Bases: FSUModel

Represents an individual GPU Baseboard component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class GPUBaseboard(FSUModel):
    """Represents an individual GPU Baseboard component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="GPUBaseboardType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="GPU Baseboard Type",
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "GPU Baseboard"
        verbose_name_plural = "GPU Baseboards"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "GPU Baseboard"
    verbose_name_plural = "GPU Baseboards"

GPUBaseboardTemplate

Bases: FSUTemplateModel

A template for a GPU Baseboard to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class GPUBaseboardTemplate(FSUTemplateModel):
    """A template for a GPU Baseboard to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="GPUBaseboardType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "GPU Baseboard Template"
        verbose_name_plural = "GPU Baseboard Templates"

    def instantiate(self, device: Device) -> GPUBaseboard:
        """Instantiate a new GPU Baseboard on a Device."""
        return self._instantiate_model(model=GPUBaseboard, device=device)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "GPU Baseboard Template"
    verbose_name_plural = "GPU Baseboard Templates"

instantiate(device)

Instantiate a new GPU Baseboard on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> GPUBaseboard:
    """Instantiate a new GPU Baseboard on a Device."""
    return self._instantiate_model(model=GPUBaseboard, device=device)

GPUBaseboardType

Bases: FSUTypeModel

Represents a GPU Baseboard type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class GPUBaseboardType(FSUTypeModel):
    """Represents a GPU Baseboard type."""

    slot_count = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
        help_text="The number of physical GPU slots provided by this GPU Baseboard.",
    )

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "GPU Baseboard Type"
        verbose_name_plural = "GPU Baseboard Types"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "GPU Baseboard Type"
    verbose_name_plural = "GPU Baseboard Types"

GPUTemplate

Bases: FSUTemplateModel

A template for a GPU to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class GPUTemplate(FSUTemplateModel):
    """A template for a GPU to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="GPUType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    pci_slot_id = models.CharField(max_length=100, blank=True, verbose_name="PCI slot ID")

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "GPU Template"
        verbose_name_plural = "GPU Templates"

    def instantiate(self, device: Device) -> GPU:
        """Instantiate a new GPU on a Device."""
        return self._instantiate_model(model=GPU, device=device, pci_slot_id=self.pci_slot_id)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "GPU Template"
    verbose_name_plural = "GPU Templates"

instantiate(device)

Instantiate a new GPU on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> GPU:
    """Instantiate a new GPU on a Device."""
    return self._instantiate_model(model=GPU, device=device, pci_slot_id=self.pci_slot_id)

GPUType

Bases: FSUTypeModel

Represents a GPU component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class GPUType(FSUTypeModel):
    """Represents a GPU component type."""

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "GPU Type"
        verbose_name_plural = "GPU Types"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "GPU Type"
    verbose_name_plural = "GPU Types"

HBA

Bases: PCIFSUModel

Represents an individual HBA component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class HBA(PCIFSUModel):
    """Represents an individual HBA component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="HBAType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="HBA Type",
    )

    class Meta(PCIFSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "HBA"
        verbose_name_plural = "HBAs"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(PCIFSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "HBA"
    verbose_name_plural = "HBAs"

HBATemplate

Bases: FSUTemplateModel

A template for a HBA to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class HBATemplate(FSUTemplateModel):
    """A template for a HBA to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="HBAType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    pci_slot_id = models.CharField(max_length=100, blank=True, verbose_name="PCI slot ID")

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "HBA Template"
        verbose_name_plural = "HBA Templates"

    def instantiate(self, device: Device) -> HBA:
        """Instantiate a new HBA on a Device."""
        return self._instantiate_model(model=HBA, device=device, pci_slot_id=self.pci_slot_id)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "HBA Template"
    verbose_name_plural = "HBA Templates"

instantiate(device)

Instantiate a new HBA on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> HBA:
    """Instantiate a new HBA on a Device."""
    return self._instantiate_model(model=HBA, device=device, pci_slot_id=self.pci_slot_id)

HBAType

Bases: FSUTypeModel

Represents an HBA component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class HBAType(FSUTypeModel):
    """Represents an HBA component type."""

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "HBA Type"
        verbose_name_plural = "HBA Types"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "HBA Type"
    verbose_name_plural = "HBA Types"

Mainboard

Bases: FSUModel

Represents an individual Mainboard component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class Mainboard(FSUModel):
    """Represents an individual Mainboard component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="MainboardType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="Mainboard Type",
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Mainboard"
        verbose_name_plural = "Mainboards"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Mainboard"
    verbose_name_plural = "Mainboards"

MainboardTemplate

Bases: FSUTemplateModel

A template for a Mainboard to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class MainboardTemplate(FSUTemplateModel):
    """A template for a Mainboard to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="MainboardType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Mainboard Template"
        verbose_name_plural = "Mainboard Templates"

    def instantiate(self, device: Device) -> Mainboard:
        """Instantiate a new Mainboard on a Device."""
        return self._instantiate_model(model=Mainboard, device=device)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Mainboard Template"
    verbose_name_plural = "Mainboard Templates"

instantiate(device)

Instantiate a new Mainboard on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> Mainboard:
    """Instantiate a new Mainboard on a Device."""
    return self._instantiate_model(model=Mainboard, device=device)

MainboardType

Bases: FSUTypeModel

Represents a Mainboard component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class MainboardType(FSUTypeModel):
    """Represents a Mainboard component type."""

    cpu_socket_count = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
        validators=[MinValueValidator(1)],
    )

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Mainboard Type"
        verbose_name_plural = "Mainboard Types"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Mainboard Type"
    verbose_name_plural = "Mainboard Types"

NIC

Bases: PCIFSUModel

Represents an individual NIC component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class NIC(PCIFSUModel):
    """Represents an individual NIC component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="NICType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="NIC Type",
    )

    interfaces: ManyToManyField = models.ManyToManyField(
        to="dcim.Interface",
        related_name="parent_nic",
        limit_choices_to={"type__n": ["bridge", "lag", "virtual"]},
        blank=True,
    )

    class Meta(PCIFSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "NIC"
        verbose_name_plural = "NICs"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(PCIFSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "NIC"
    verbose_name_plural = "NICs"

NICTemplate

Bases: FSUTemplateModel

A template for a NIC to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class NICTemplate(FSUTemplateModel):
    """A template for a NIC to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="NICType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    pci_slot_id = models.CharField(max_length=100, blank=True, verbose_name="PCI slot ID")

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "NIC Template"
        verbose_name_plural = "NIC Templates"

    def instantiate(self, device: Device) -> NIC:
        """Instantiate a new NIC on a Device."""
        return self._instantiate_model(model=NIC, device=device, pci_slot_id=self.pci_slot_id)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "NIC Template"
    verbose_name_plural = "NIC Templates"

instantiate(device)

Instantiate a new NIC on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> NIC:
    """Instantiate a new NIC on a Device."""
    return self._instantiate_model(model=NIC, device=device, pci_slot_id=self.pci_slot_id)

NICType

Bases: FSUTypeModel

Represents a NIC component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class NICType(FSUTypeModel):
    """Represents a NIC component type."""

    interface_count = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
        help_text="The number of physical interfaces provided by the NIC.",
    )

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "NIC Type"
        verbose_name_plural = "NIC Types"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "NIC Type"
    verbose_name_plural = "NIC Types"

OtherFSU

Bases: FSUModel

Represents an individual generic FSU component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class OtherFSU(FSUModel):
    """Represents an individual generic FSU component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="OtherFSUType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="Other FSU Type",
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "OtherFSU"
        verbose_name_plural = "OtherFSUs"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "OtherFSU"
    verbose_name_plural = "OtherFSUs"

OtherFSUTemplate

Bases: FSUTemplateModel

A template for a generic FSU to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class OtherFSUTemplate(FSUTemplateModel):
    """A template for a generic FSU to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="OtherFSUType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "OtherFSU Template"
        verbose_name_plural = "OtherFSU Templates"

    def instantiate(self, device: Device) -> OtherFSU:
        """Instantiate a new generic FSU on a Device."""
        return self._instantiate_model(model=OtherFSU, device=device)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "OtherFSU Template"
    verbose_name_plural = "OtherFSU Templates"

instantiate(device)

Instantiate a new generic FSU on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> OtherFSU:
    """Instantiate a new generic FSU on a Device."""
    return self._instantiate_model(model=OtherFSU, device=device)

OtherFSUType

Bases: FSUTypeModel

Represents a generic FSU component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class OtherFSUType(FSUTypeModel):
    """Represents a generic FSU component type."""

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Other FSU Type"
        verbose_name_plural = "Other FSU Types"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Other FSU Type"
    verbose_name_plural = "Other FSU Types"

PSU

Bases: FSUModel

Represents an individual PSU component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class PSU(FSUModel):
    """Represents an individual PSU component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="PSUType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="PSU Type",
    )

    redundant = models.BooleanField(default=False)

    power_ports: ManyToManyField = models.ManyToManyField(
        to="dcim.PowerPort",
        related_name="parent_psu",
        blank=True,
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "PSU"
        verbose_name_plural = "PSUs"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "PSU"
    verbose_name_plural = "PSUs"

PSUTemplate

Bases: FSUTemplateModel

A template for a PSU to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class PSUTemplate(FSUTemplateModel):
    """A template for a PSU to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="PSUType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    redundant = models.BooleanField(default=False)

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "PSU Template"
        verbose_name_plural = "PSU Templates"

    def instantiate(self, device: Device) -> PSU:
        """Instantiate a new PSU on a Device."""
        return self._instantiate_model(model=PSU, device=device, redundant=self.redundant)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "PSU Template"
    verbose_name_plural = "PSU Templates"

instantiate(device)

Instantiate a new PSU on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> PSU:
    """Instantiate a new PSU on a Device."""
    return self._instantiate_model(model=PSU, device=device, redundant=self.redundant)

PSUType

Bases: FSUTypeModel

Represents a Power Supply Unit type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class PSUType(FSUTypeModel):
    """Represents a Power Supply Unit type."""

    feed_type = models.CharField(
        max_length=16,
        choices=choices.PSUFeedType,
        default=choices.PSUFeedType.psu_dc,
    )

    power_provided = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
        validators=[MinValueValidator(1)],
        help_text="Power provided, in Watts",
    )

    required_voltage = models.CharField(
        max_length=32, blank=True, help_text="Example: `-40V - -72` (DC), `100-240V` (AC)"
    )

    hot_swappable = models.BooleanField(default=False)

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "PSU Type"
        verbose_name_plural = "PSU Types"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "PSU Type"
    verbose_name_plural = "PSU Types"

RAMModule

Bases: FSUModel

Represents an individual RAM module component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class RAMModule(FSUModel):
    """Represents an individual RAM module component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="RAMModuleType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="RAM Module Type",
    )

    slot_id = models.CharField(
        max_length=16,
        blank=True,
        verbose_name="RAM slot ID",
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "RAM Module"
        verbose_name_plural = "RAM Modules"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "RAM Module"
    verbose_name_plural = "RAM Modules"

RAMModuleTemplate

Bases: FSUTemplateModel

A template for a RAM Module to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class RAMModuleTemplate(FSUTemplateModel):
    """A template for a RAM Module to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="RAMModuleType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    slot_id = models.CharField(max_length=16, blank=True, verbose_name="RAM slot ID")

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "RAM Module Template"
        verbose_name_plural = "RAM Module Templates"

    def instantiate(self, device: Device) -> RAMModule:
        """Instantiate a new RAM Module on a Device."""
        return self._instantiate_model(model=RAMModule, device=device, slot_id=self.slot_id)

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "RAM Module Template"
    verbose_name_plural = "RAM Module Templates"

instantiate(device)

Instantiate a new RAM Module on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> RAMModule:
    """Instantiate a new RAM Module on a Device."""
    return self._instantiate_model(model=RAMModule, device=device, slot_id=self.slot_id)

RAMModuleType

Bases: FSUTypeModel

Represents a memory component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class RAMModuleType(FSUTypeModel):
    """Represents a memory component type."""

    module_type = models.CharField(
        max_length=4,
        choices=choices.MemoryModuleTypes,
        default=choices.MemoryModuleTypes.udimm,
    )

    technology = models.CharField(
        max_length=8,
        choices=choices.MemoryTechnologies,
        default=choices.MemoryTechnologies.ddr5,
    )

    speed = models.PositiveIntegerField(
        blank=True,
        null=True,
        validators=[MinValueValidator(1)],
        help_text="Memory speed in MHz",
    )

    capacity = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
        validators=[MinValueValidator(1)],
        help_text="Memory capacity, in GB",
    )

    quantity = models.PositiveSmallIntegerField(
        default=1,
        validators=[MinValueValidator(1)],
        help_text="Number of RAM Modules included in part number",
    )

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "RAM Module Type"
        verbose_name_plural = "RAM Module Types"

Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "RAM Module Type"
    verbose_name_plural = "RAM Module Types"

fsu_templates

Template versions of Field Serviceable Units, to be associated with DeviceTypes.

CPUTemplate

Bases: FSUTemplateModel

A template for a CPU to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class CPUTemplate(FSUTemplateModel):
    """A template for a CPU to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="CPUType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "CPU Template"
        verbose_name_plural = "CPU Templates"

    def instantiate(self, device: Device) -> CPU:
        """Instantiate a new CPU on a Device."""
        return self._instantiate_model(model=CPU, device=device)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "CPU Template"
    verbose_name_plural = "CPU Templates"
instantiate(device)

Instantiate a new CPU on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> CPU:
    """Instantiate a new CPU on a Device."""
    return self._instantiate_model(model=CPU, device=device)

DiskTemplate

Bases: FSUTemplateModel

A template for a Disk to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class DiskTemplate(FSUTemplateModel):
    """A template for a Disk to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="DiskType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Disk Template"
        verbose_name_plural = "Disk Templates"

    def instantiate(self, device: Device) -> Disk:
        """Instantiate a new Disk on a Device."""
        return self._instantiate_model(model=Disk, device=device)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Disk Template"
    verbose_name_plural = "Disk Templates"
instantiate(device)

Instantiate a new Disk on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> Disk:
    """Instantiate a new Disk on a Device."""
    return self._instantiate_model(model=Disk, device=device)

FanTemplate

Bases: FSUTemplateModel

A template for a Fan to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class FanTemplate(FSUTemplateModel):
    """A template for a Fan to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="FanType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Fan Template"
        verbose_name_plural = "Fan Templates"

    def instantiate(self, device: Device) -> Fan:
        """Instantiate a new Fan on a Device."""
        return self._instantiate_model(model=Fan, device=device)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Fan Template"
    verbose_name_plural = "Fan Templates"
instantiate(device)

Instantiate a new Fan on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> Fan:
    """Instantiate a new Fan on a Device."""
    return self._instantiate_model(model=Fan, device=device)

GPUBaseboardTemplate

Bases: FSUTemplateModel

A template for a GPU Baseboard to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class GPUBaseboardTemplate(FSUTemplateModel):
    """A template for a GPU Baseboard to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="GPUBaseboardType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "GPU Baseboard Template"
        verbose_name_plural = "GPU Baseboard Templates"

    def instantiate(self, device: Device) -> GPUBaseboard:
        """Instantiate a new GPU Baseboard on a Device."""
        return self._instantiate_model(model=GPUBaseboard, device=device)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "GPU Baseboard Template"
    verbose_name_plural = "GPU Baseboard Templates"
instantiate(device)

Instantiate a new GPU Baseboard on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> GPUBaseboard:
    """Instantiate a new GPU Baseboard on a Device."""
    return self._instantiate_model(model=GPUBaseboard, device=device)

GPUTemplate

Bases: FSUTemplateModel

A template for a GPU to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class GPUTemplate(FSUTemplateModel):
    """A template for a GPU to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="GPUType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    pci_slot_id = models.CharField(max_length=100, blank=True, verbose_name="PCI slot ID")

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "GPU Template"
        verbose_name_plural = "GPU Templates"

    def instantiate(self, device: Device) -> GPU:
        """Instantiate a new GPU on a Device."""
        return self._instantiate_model(model=GPU, device=device, pci_slot_id=self.pci_slot_id)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "GPU Template"
    verbose_name_plural = "GPU Templates"
instantiate(device)

Instantiate a new GPU on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> GPU:
    """Instantiate a new GPU on a Device."""
    return self._instantiate_model(model=GPU, device=device, pci_slot_id=self.pci_slot_id)

HBATemplate

Bases: FSUTemplateModel

A template for a HBA to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class HBATemplate(FSUTemplateModel):
    """A template for a HBA to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="HBAType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    pci_slot_id = models.CharField(max_length=100, blank=True, verbose_name="PCI slot ID")

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "HBA Template"
        verbose_name_plural = "HBA Templates"

    def instantiate(self, device: Device) -> HBA:
        """Instantiate a new HBA on a Device."""
        return self._instantiate_model(model=HBA, device=device, pci_slot_id=self.pci_slot_id)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "HBA Template"
    verbose_name_plural = "HBA Templates"
instantiate(device)

Instantiate a new HBA on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> HBA:
    """Instantiate a new HBA on a Device."""
    return self._instantiate_model(model=HBA, device=device, pci_slot_id=self.pci_slot_id)

MainboardTemplate

Bases: FSUTemplateModel

A template for a Mainboard to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class MainboardTemplate(FSUTemplateModel):
    """A template for a Mainboard to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="MainboardType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Mainboard Template"
        verbose_name_plural = "Mainboard Templates"

    def instantiate(self, device: Device) -> Mainboard:
        """Instantiate a new Mainboard on a Device."""
        return self._instantiate_model(model=Mainboard, device=device)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Mainboard Template"
    verbose_name_plural = "Mainboard Templates"
instantiate(device)

Instantiate a new Mainboard on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> Mainboard:
    """Instantiate a new Mainboard on a Device."""
    return self._instantiate_model(model=Mainboard, device=device)

NICTemplate

Bases: FSUTemplateModel

A template for a NIC to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class NICTemplate(FSUTemplateModel):
    """A template for a NIC to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="NICType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    pci_slot_id = models.CharField(max_length=100, blank=True, verbose_name="PCI slot ID")

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "NIC Template"
        verbose_name_plural = "NIC Templates"

    def instantiate(self, device: Device) -> NIC:
        """Instantiate a new NIC on a Device."""
        return self._instantiate_model(model=NIC, device=device, pci_slot_id=self.pci_slot_id)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "NIC Template"
    verbose_name_plural = "NIC Templates"
instantiate(device)

Instantiate a new NIC on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> NIC:
    """Instantiate a new NIC on a Device."""
    return self._instantiate_model(model=NIC, device=device, pci_slot_id=self.pci_slot_id)

OtherFSUTemplate

Bases: FSUTemplateModel

A template for a generic FSU to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class OtherFSUTemplate(FSUTemplateModel):
    """A template for a generic FSU to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="OtherFSUType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "OtherFSU Template"
        verbose_name_plural = "OtherFSU Templates"

    def instantiate(self, device: Device) -> OtherFSU:
        """Instantiate a new generic FSU on a Device."""
        return self._instantiate_model(model=OtherFSU, device=device)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "OtherFSU Template"
    verbose_name_plural = "OtherFSU Templates"
instantiate(device)

Instantiate a new generic FSU on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> OtherFSU:
    """Instantiate a new generic FSU on a Device."""
    return self._instantiate_model(model=OtherFSU, device=device)

PSUTemplate

Bases: FSUTemplateModel

A template for a PSU to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class PSUTemplate(FSUTemplateModel):
    """A template for a PSU to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="PSUType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    redundant = models.BooleanField(default=False)

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "PSU Template"
        verbose_name_plural = "PSU Templates"

    def instantiate(self, device: Device) -> PSU:
        """Instantiate a new PSU on a Device."""
        return self._instantiate_model(model=PSU, device=device, redundant=self.redundant)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "PSU Template"
    verbose_name_plural = "PSU Templates"
instantiate(device)

Instantiate a new PSU on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> PSU:
    """Instantiate a new PSU on a Device."""
    return self._instantiate_model(model=PSU, device=device, redundant=self.redundant)

RAMModuleTemplate

Bases: FSUTemplateModel

A template for a RAM Module to be created on a new device.

Source code in nautobot_fsus/models/fsu_templates.py
@extras_features("custom_fields", "custom_links", "custom_validators", "relationships")
class RAMModuleTemplate(FSUTemplateModel):
    """A template for a RAM Module to be created on a new device."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="RAMModuleType",
        on_delete=models.PROTECT,
        related_name="templates",
        verbose_name="FSU Type",
    )

    slot_id = models.CharField(max_length=16, blank=True, verbose_name="RAM slot ID")

    class Meta(FSUTemplateModel.Meta):
        """Metaclass attributes."""

        verbose_name = "RAM Module Template"
        verbose_name_plural = "RAM Module Templates"

    def instantiate(self, device: Device) -> RAMModule:
        """Instantiate a new RAM Module on a Device."""
        return self._instantiate_model(model=RAMModule, device=device, slot_id=self.slot_id)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_templates.py
class Meta(FSUTemplateModel.Meta):
    """Metaclass attributes."""

    verbose_name = "RAM Module Template"
    verbose_name_plural = "RAM Module Templates"
instantiate(device)

Instantiate a new RAM Module on a Device.

Source code in nautobot_fsus/models/fsu_templates.py
def instantiate(self, device: Device) -> RAMModule:
    """Instantiate a new RAM Module on a Device."""
    return self._instantiate_model(model=RAMModule, device=device, slot_id=self.slot_id)

fsu_types

Models for Field Serviceable Unit types.

An FSU type is an individual product, defined by manufacturer, model name, and part number.

CPUType

Bases: FSUTypeModel

Represents a CPU component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class CPUType(FSUTypeModel):
    """Represents a CPU component type."""

    architecture = models.CharField(
        max_length=4,
        choices=choices.CPUArchitectures,
        default=choices.CPUArchitectures.x86,
    )

    cpu_speed = models.FloatField(
        blank=True,
        null=True,
        validators=[MinValueValidator(0.0)],
        help_text="CPU speed in GHz",
    )

    cores = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
    )

    pcie_generation = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
        choices=choices.PCIeGenerations,
    )

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "CPU Type"
        verbose_name_plural = "CPU Types"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "CPU Type"
    verbose_name_plural = "CPU Types"

DiskType

Bases: FSUTypeModel

Represents a Disk component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class DiskType(FSUTypeModel):
    """Represents a Disk component type."""

    disk_type = models.CharField(
        max_length=4,
        choices=choices.DiskTypes,
        default=choices.DiskTypes.disk_ssd,
    )

    size = models.PositiveIntegerField(
        blank=True,
        null=True,
        validators=[MinValueValidator(1)],
        help_text="Disk size, in GB",
    )

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Disk Type"
        verbose_name_plural = "Disk Types"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Disk Type"
    verbose_name_plural = "Disk Types"

FanType

Bases: FSUTypeModel

Represents a Fan component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class FanType(FSUTypeModel):
    """Represents a Fan component type."""

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Fan Type"
        verbose_name_plural = "Fan Types"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Fan Type"
    verbose_name_plural = "Fan Types"

GPUBaseboardType

Bases: FSUTypeModel

Represents a GPU Baseboard type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class GPUBaseboardType(FSUTypeModel):
    """Represents a GPU Baseboard type."""

    slot_count = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
        help_text="The number of physical GPU slots provided by this GPU Baseboard.",
    )

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "GPU Baseboard Type"
        verbose_name_plural = "GPU Baseboard Types"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "GPU Baseboard Type"
    verbose_name_plural = "GPU Baseboard Types"

GPUType

Bases: FSUTypeModel

Represents a GPU component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class GPUType(FSUTypeModel):
    """Represents a GPU component type."""

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "GPU Type"
        verbose_name_plural = "GPU Types"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "GPU Type"
    verbose_name_plural = "GPU Types"

HBAType

Bases: FSUTypeModel

Represents an HBA component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class HBAType(FSUTypeModel):
    """Represents an HBA component type."""

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "HBA Type"
        verbose_name_plural = "HBA Types"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "HBA Type"
    verbose_name_plural = "HBA Types"

MainboardType

Bases: FSUTypeModel

Represents a Mainboard component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class MainboardType(FSUTypeModel):
    """Represents a Mainboard component type."""

    cpu_socket_count = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
        validators=[MinValueValidator(1)],
    )

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Mainboard Type"
        verbose_name_plural = "Mainboard Types"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Mainboard Type"
    verbose_name_plural = "Mainboard Types"

NICType

Bases: FSUTypeModel

Represents a NIC component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class NICType(FSUTypeModel):
    """Represents a NIC component type."""

    interface_count = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
        help_text="The number of physical interfaces provided by the NIC.",
    )

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "NIC Type"
        verbose_name_plural = "NIC Types"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "NIC Type"
    verbose_name_plural = "NIC Types"

OtherFSUType

Bases: FSUTypeModel

Represents a generic FSU component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class OtherFSUType(FSUTypeModel):
    """Represents a generic FSU component type."""

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Other FSU Type"
        verbose_name_plural = "Other FSU Types"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Other FSU Type"
    verbose_name_plural = "Other FSU Types"

PSUType

Bases: FSUTypeModel

Represents a Power Supply Unit type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class PSUType(FSUTypeModel):
    """Represents a Power Supply Unit type."""

    feed_type = models.CharField(
        max_length=16,
        choices=choices.PSUFeedType,
        default=choices.PSUFeedType.psu_dc,
    )

    power_provided = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
        validators=[MinValueValidator(1)],
        help_text="Power provided, in Watts",
    )

    required_voltage = models.CharField(
        max_length=32, blank=True, help_text="Example: `-40V - -72` (DC), `100-240V` (AC)"
    )

    hot_swappable = models.BooleanField(default=False)

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "PSU Type"
        verbose_name_plural = "PSU Types"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "PSU Type"
    verbose_name_plural = "PSU Types"

RAMModuleType

Bases: FSUTypeModel

Represents a memory component type.

Source code in nautobot_fsus/models/fsu_types.py
@extras_features(*EXTRAS_FEATURES)
class RAMModuleType(FSUTypeModel):
    """Represents a memory component type."""

    module_type = models.CharField(
        max_length=4,
        choices=choices.MemoryModuleTypes,
        default=choices.MemoryModuleTypes.udimm,
    )

    technology = models.CharField(
        max_length=8,
        choices=choices.MemoryTechnologies,
        default=choices.MemoryTechnologies.ddr5,
    )

    speed = models.PositiveIntegerField(
        blank=True,
        null=True,
        validators=[MinValueValidator(1)],
        help_text="Memory speed in MHz",
    )

    capacity = models.PositiveSmallIntegerField(
        blank=True,
        null=True,
        validators=[MinValueValidator(1)],
        help_text="Memory capacity, in GB",
    )

    quantity = models.PositiveSmallIntegerField(
        default=1,
        validators=[MinValueValidator(1)],
        help_text="Number of RAM Modules included in part number",
    )

    class Meta(FSUTypeModel.Meta):
        """Metaclass attributes."""

        verbose_name = "RAM Module Type"
        verbose_name_plural = "RAM Module Types"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsu_types.py
class Meta(FSUTypeModel.Meta):
    """Metaclass attributes."""

    verbose_name = "RAM Module Type"
    verbose_name_plural = "RAM Module Types"

fsus

Models for Field Serviceable Units (FSUs).

An FSU is a physical instance of its parent FSU type, and can be either installed in a Device, or available for use in a Location.

CPU

Bases: FSUModel

Represents an individual CPU component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class CPU(FSUModel):
    """Represents an individual CPU component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="CPUType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="CPU Type",
    )

    parent_mainboard: ForeignKey = models.ForeignKey(
        to="Mainboard",
        on_delete=models.PROTECT,
        related_name="cpus",
        blank=True,
        null=True,
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "CPU"
        verbose_name_plural = "CPUs"

    def clean_fields(self, exclude=None) -> None:
        """Validate the parent Device against the parent Mainboard."""
        super().clean_fields(exclude=exclude)

        parent_mainboard: Mainboard
        if parent_mainboard := copy(self.parent_mainboard):
            errors = {}

            try:
                validate_parent_device([self], parent_mainboard.device)
            except ValidationError as error:
                errors["parent_mainboard"] = error.error_list

            if socket_count := parent_mainboard.fsu_type.cpu_socket_count:
                cpu_count = parent_mainboard.cpus.count()
                if self not in parent_mainboard.cpus.all() and cpu_count >= socket_count:
                    errors.setdefault("parent_mainboard", [])
                    errors["parent_mainboard"].extend(
                        ValidationError("Mainboard has no available CPU sockets.").error_list
                    )

            if errors:
                raise ValidationError(errors)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "CPU"
    verbose_name_plural = "CPUs"
clean_fields(exclude=None)

Validate the parent Device against the parent Mainboard.

Source code in nautobot_fsus/models/fsus.py
def clean_fields(self, exclude=None) -> None:
    """Validate the parent Device against the parent Mainboard."""
    super().clean_fields(exclude=exclude)

    parent_mainboard: Mainboard
    if parent_mainboard := copy(self.parent_mainboard):
        errors = {}

        try:
            validate_parent_device([self], parent_mainboard.device)
        except ValidationError as error:
            errors["parent_mainboard"] = error.error_list

        if socket_count := parent_mainboard.fsu_type.cpu_socket_count:
            cpu_count = parent_mainboard.cpus.count()
            if self not in parent_mainboard.cpus.all() and cpu_count >= socket_count:
                errors.setdefault("parent_mainboard", [])
                errors["parent_mainboard"].extend(
                    ValidationError("Mainboard has no available CPU sockets.").error_list
                )

        if errors:
            raise ValidationError(errors)

Disk

Bases: FSUModel

Represents an individual Disk component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class Disk(FSUModel):
    """Represents an individual Disk component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="DiskType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="Disk Type",
    )

    parent_hba: ForeignKey = models.ForeignKey(
        to="HBA",
        on_delete=models.PROTECT,
        related_name="disks",
        blank=True,
        null=True,
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Disk"
        verbose_name_plural = "Disks"

    def clean_fields(self, exclude=None) -> None:
        """Validate the parent Device against the parent HBA."""
        super().clean_fields(exclude=exclude)

        parent_hba: HBA
        if parent_hba := copy(self.parent_hba):
            try:
                validate_parent_device([self], parent_hba.device)
            except ValidationError as error:
                raise ValidationError({"parent_hba": error.error_list}) from error
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Disk"
    verbose_name_plural = "Disks"
clean_fields(exclude=None)

Validate the parent Device against the parent HBA.

Source code in nautobot_fsus/models/fsus.py
def clean_fields(self, exclude=None) -> None:
    """Validate the parent Device against the parent HBA."""
    super().clean_fields(exclude=exclude)

    parent_hba: HBA
    if parent_hba := copy(self.parent_hba):
        try:
            validate_parent_device([self], parent_hba.device)
        except ValidationError as error:
            raise ValidationError({"parent_hba": error.error_list}) from error

Fan

Bases: FSUModel

Represents an individual Fan component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class Fan(FSUModel):
    """Represents an individual Fan component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="FanType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="Fan Type",
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Fan"
        verbose_name_plural = "Fans"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Fan"
    verbose_name_plural = "Fans"

GPU

Bases: PCIFSUModel

Represents an individual GPU component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class GPU(PCIFSUModel):
    """Represents an individual GPU component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="GPUType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="GPU Type",
    )

    parent_gpubaseboard: ForeignKey = models.ForeignKey(
        to="GPUBaseboard",
        on_delete=models.PROTECT,
        related_name="gpus",
        blank=True,
        null=True,
    )

    class Meta(PCIFSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "GPU"
        verbose_name_plural = "GPUs"

    def clean_fields(self, exclude=None) -> None:
        """Validate the parent Device against the parent GPU Baseboard."""
        super().clean_fields(exclude=exclude)

        # if self.parent_gpubaseboard is not None:
        parent_gpubaseboard: GPUBaseboard
        if parent_gpubaseboard := copy(self.parent_gpubaseboard):
            errors = {}

            try:
                validate_parent_device([self], parent_gpubaseboard.device)
            except ValidationError as error:
                errors["parent_gpubaseboard"] = error.error_list

            if slot_count := parent_gpubaseboard.fsu_type.slot_count:
                gpu_count = parent_gpubaseboard.gpus.count()
                if self not in parent_gpubaseboard.gpus.all() and gpu_count >= slot_count:
                    errors.setdefault("parent_gpubaseboard", [])
                    errors["parent_gpubaseboard"].extend(
                        ValidationError("GPU Baseboard has no available slots.").error_list
                    )

            if errors:
                raise ValidationError(errors)
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(PCIFSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "GPU"
    verbose_name_plural = "GPUs"
clean_fields(exclude=None)

Validate the parent Device against the parent GPU Baseboard.

Source code in nautobot_fsus/models/fsus.py
def clean_fields(self, exclude=None) -> None:
    """Validate the parent Device against the parent GPU Baseboard."""
    super().clean_fields(exclude=exclude)

    # if self.parent_gpubaseboard is not None:
    parent_gpubaseboard: GPUBaseboard
    if parent_gpubaseboard := copy(self.parent_gpubaseboard):
        errors = {}

        try:
            validate_parent_device([self], parent_gpubaseboard.device)
        except ValidationError as error:
            errors["parent_gpubaseboard"] = error.error_list

        if slot_count := parent_gpubaseboard.fsu_type.slot_count:
            gpu_count = parent_gpubaseboard.gpus.count()
            if self not in parent_gpubaseboard.gpus.all() and gpu_count >= slot_count:
                errors.setdefault("parent_gpubaseboard", [])
                errors["parent_gpubaseboard"].extend(
                    ValidationError("GPU Baseboard has no available slots.").error_list
                )

        if errors:
            raise ValidationError(errors)

GPUBaseboard

Bases: FSUModel

Represents an individual GPU Baseboard component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class GPUBaseboard(FSUModel):
    """Represents an individual GPU Baseboard component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="GPUBaseboardType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="GPU Baseboard Type",
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "GPU Baseboard"
        verbose_name_plural = "GPU Baseboards"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "GPU Baseboard"
    verbose_name_plural = "GPU Baseboards"

HBA

Bases: PCIFSUModel

Represents an individual HBA component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class HBA(PCIFSUModel):
    """Represents an individual HBA component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="HBAType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="HBA Type",
    )

    class Meta(PCIFSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "HBA"
        verbose_name_plural = "HBAs"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(PCIFSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "HBA"
    verbose_name_plural = "HBAs"

Mainboard

Bases: FSUModel

Represents an individual Mainboard component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class Mainboard(FSUModel):
    """Represents an individual Mainboard component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="MainboardType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="Mainboard Type",
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "Mainboard"
        verbose_name_plural = "Mainboards"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "Mainboard"
    verbose_name_plural = "Mainboards"

NIC

Bases: PCIFSUModel

Represents an individual NIC component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class NIC(PCIFSUModel):
    """Represents an individual NIC component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="NICType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="NIC Type",
    )

    interfaces: ManyToManyField = models.ManyToManyField(
        to="dcim.Interface",
        related_name="parent_nic",
        limit_choices_to={"type__n": ["bridge", "lag", "virtual"]},
        blank=True,
    )

    class Meta(PCIFSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "NIC"
        verbose_name_plural = "NICs"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(PCIFSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "NIC"
    verbose_name_plural = "NICs"

OtherFSU

Bases: FSUModel

Represents an individual generic FSU component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class OtherFSU(FSUModel):
    """Represents an individual generic FSU component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="OtherFSUType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="Other FSU Type",
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "OtherFSU"
        verbose_name_plural = "OtherFSUs"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "OtherFSU"
    verbose_name_plural = "OtherFSUs"

PSU

Bases: FSUModel

Represents an individual PSU component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class PSU(FSUModel):
    """Represents an individual PSU component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="PSUType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="PSU Type",
    )

    redundant = models.BooleanField(default=False)

    power_ports: ManyToManyField = models.ManyToManyField(
        to="dcim.PowerPort",
        related_name="parent_psu",
        blank=True,
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "PSU"
        verbose_name_plural = "PSUs"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "PSU"
    verbose_name_plural = "PSUs"

RAMModule

Bases: FSUModel

Represents an individual RAM module component in a device or storage location.

Source code in nautobot_fsus/models/fsus.py
@extras_features(*EXTRAS_FEATURES)
class RAMModule(FSUModel):
    """Represents an individual RAM module component in a device or storage location."""

    fsu_type: ForeignKey = models.ForeignKey(
        to="RAMModuleType",
        on_delete=models.PROTECT,
        related_name="instances",
        verbose_name="RAM Module Type",
    )

    slot_id = models.CharField(
        max_length=16,
        blank=True,
        verbose_name="RAM slot ID",
    )

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        verbose_name = "RAM Module"
        verbose_name_plural = "RAM Modules"
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/fsus.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    verbose_name = "RAM Module"
    verbose_name_plural = "RAM Modules"

mixins

Base classes for object models.

FSUModel

Bases: PrimaryModel

Abstract base class for Field Serviceable Units.

An FSU is a physical device component that is being tracked in inventory. All FSUs have an FSU type, relating them to their manufacturer, model name, and part number. FSUs are also related to either the Device where they are installed, or to a Location if they are in storage and not yet installed. In addition, this abstract class provides the common set of data fields all FSUs share - name, serial number, firmware version, etc.

Source code in nautobot_fsus/models/mixins.py
class FSUModel(PrimaryModel):
    """
    Abstract base class for Field Serviceable Units.

    An FSU is a physical device component that is being tracked in inventory. All FSUs have
    an FSU type, relating them to their manufacturer, model name, and part number. FSUs are also
    related to either the Device where they are installed, or to a Location if they are in
    storage and not yet installed. In addition, this abstract class provides the common set
    of data fields all FSUs share - name, serial number, firmware version, etc.
    """

    fsu_type: ForeignKey

    device: ForeignKey = models.ForeignKey(
        to="dcim.Device",
        on_delete=models.CASCADE,
        related_name="%(class)ss",
        blank=True,
        null=True,
        help_text="Device the FSU is installed in - an FSU requires either a parent Device "
        "or a parent Location.",
    )

    location: ForeignKey = models.ForeignKey(
        to="dcim.Location",
        on_delete=models.CASCADE,
        related_name="%(class)ss",
        blank=True,
        null=True,
        help_text="Location where the FSU is stored - an FSU requires either a parent Device "
        "or a parent Location.",
    )

    name = models.CharField(max_length=100, db_index=True)
    _name = NaturalOrderingField(target_field="name", max_length=255, blank=True, db_index=True)

    serial_number = models.CharField(
        max_length=255,
        blank=True,
        verbose_name="Serial number",
        db_index=True,
    )

    firmware_version = models.CharField(
        max_length=32,
        blank=True,
        verbose_name="Firmware version",
    )

    driver_version = models.CharField(
        max_length=32,
        blank=True,
        verbose_name="Driver version",
    )

    driver_name = models.CharField(
        max_length=100,
        blank=True,
        verbose_name="Driver name",
    )

    asset_tag = models.CharField(
        max_length=255,
        blank=True,
        verbose_name="Asset tag",
        help_text="A unique tag used to identify this FSU.",
    )

    status = StatusField(
        related_name="%(app_label)s_%(class)s_related",
        blank=False,
        null=False,
    )

    description = models.CharField(max_length=255, blank=True)
    comments = models.TextField(blank=True)

    clone_fields = [
        "fsu_type",
        "device",
        "location",
        "firmware_version",
        "driver_version",
        "driver_name",
    ]

    class Meta:
        """Metaclass attributes."""

        abstract = True
        ordering = ["device", "location", "_name"]
        unique_together = [["name", "device"], ["name", "location"]]

    def __str__(self) -> str:
        """Default string representation of the FSU."""
        return str(self.name)

    @property
    def parent(self) -> Device | Location | None:
        """Return the parent Device or Location, as appropriate."""
        if self.device and isinstance(self.device, Device):
            return self.device
        if self.location and isinstance(self.location, Location):
            return self.location

        return None

    def to_objectchange(self, action: str, **kwargs: Any) -> ObjectChange:
        """
        Return a new ObjectChange on updates.

        ObjectChange will have `related_object` set to either the parent `device`
        or `location` as appropriate.
        """
        related_object: Device | Location | None = self.parent

        return super().to_objectchange(action, related_object=related_object, **kwargs)

    def clean(self) -> None:
        """Perform model validation steps."""
        if not self.device and not self.location:
            raise ValidationError(
                "A Field Serviceable Unit must have either a device or a storage location set."
            )

        super().clean()

    def save(self, *args, **kwargs) -> None:
        """Save the FSU object to the database."""
        if self.device and self.location:
            self.location = None  # type: ignore

        super().save(*args, **kwargs)
parent: Device | Location | None property

Return the parent Device or Location, as appropriate.

Meta

Metaclass attributes.

Source code in nautobot_fsus/models/mixins.py
class Meta:
    """Metaclass attributes."""

    abstract = True
    ordering = ["device", "location", "_name"]
    unique_together = [["name", "device"], ["name", "location"]]
__str__()

Default string representation of the FSU.

Source code in nautobot_fsus/models/mixins.py
def __str__(self) -> str:
    """Default string representation of the FSU."""
    return str(self.name)
clean()

Perform model validation steps.

Source code in nautobot_fsus/models/mixins.py
def clean(self) -> None:
    """Perform model validation steps."""
    if not self.device and not self.location:
        raise ValidationError(
            "A Field Serviceable Unit must have either a device or a storage location set."
        )

    super().clean()
save(*args, **kwargs)

Save the FSU object to the database.

Source code in nautobot_fsus/models/mixins.py
def save(self, *args, **kwargs) -> None:
    """Save the FSU object to the database."""
    if self.device and self.location:
        self.location = None  # type: ignore

    super().save(*args, **kwargs)
to_objectchange(action, **kwargs)

Return a new ObjectChange on updates.

ObjectChange will have related_object set to either the parent device or location as appropriate.

Source code in nautobot_fsus/models/mixins.py
def to_objectchange(self, action: str, **kwargs: Any) -> ObjectChange:
    """
    Return a new ObjectChange on updates.

    ObjectChange will have `related_object` set to either the parent `device`
    or `location` as appropriate.
    """
    related_object: Device | Location | None = self.parent

    return super().to_objectchange(action, related_object=related_object, **kwargs)

FSUTemplateModel

Bases: BaseModel, ChangeLoggedModel, CustomFieldModel, RelationshipModel

Abstract base model for FSU templates.

FSU templates are similar to Nautobot device component templates - they are associated with a DeviceType, and when a Device is created from that DeviceType, the FSUs are instantiated automatically.

Source code in nautobot_fsus/models/mixins.py
class FSUTemplateModel(BaseModel, ChangeLoggedModel, CustomFieldModel, RelationshipModel):
    """
    Abstract base model for FSU templates.

    FSU templates are similar to Nautobot device component templates - they are associated
    with a DeviceType, and when a Device is created from that DeviceType, the FSUs are
    instantiated automatically.
    """

    fsu_type: ForeignKey

    device_type: ForeignKey = models.ForeignKey(
        to="dcim.DeviceType",
        on_delete=models.CASCADE,
        related_name="%(class)ss",
    )

    name = models.CharField(max_length=100, db_index=True)
    _name = NaturalOrderingField(target_field="name", max_length=255, blank=True, db_index=True)
    description = models.CharField(max_length=255, blank=True)

    class Meta:
        """Metaclass attributes."""

        abstract = True
        ordering = ["device_type", "_name"]
        unique_together = ["name", "device_type"]

    def __str__(self) -> str:
        """Default string representation for the FSU template."""
        return str(self.name)

    def _instantiate_model(self, model: type[FSUModel], device: Device, **kwargs: Any) -> FSUModel:
        """Helper method for `self.instantiate()`."""
        # Handle any custom fields assigned to the model first.
        custom_field_data: dict[str, Any] = {}
        content_type = ContentType.objects.get_for_model(model)
        cf_fields = CustomField.objects.filter(content_types=content_type)
        for field in cf_fields:
            custom_field_data[field.key] = field.default

        return model(  # pylint: disable=not-callable
            fsu_type=self.fsu_type,
            device=device,
            name=self.name,
            description=self.description,
            status=Status.objects.get(name="Active"),
            _custom_field_data=custom_field_data,
            **kwargs,
        )

    def instantiate(self, device: Device) -> FSUModel:
        """Instantiate a new FSU on a Device."""
        raise NotImplementedError

    def to_objectchange(self, action: str, **kwargs: Any) -> ObjectChange:
        """Return a new ObjectChange on updates."""
        return super().to_objectchange(action, related_object=self.device_type, **kwargs)
Meta

Metaclass attributes.

Source code in nautobot_fsus/models/mixins.py
class Meta:
    """Metaclass attributes."""

    abstract = True
    ordering = ["device_type", "_name"]
    unique_together = ["name", "device_type"]
__str__()

Default string representation for the FSU template.

Source code in nautobot_fsus/models/mixins.py
def __str__(self) -> str:
    """Default string representation for the FSU template."""
    return str(self.name)
instantiate(device)

Instantiate a new FSU on a Device.

Source code in nautobot_fsus/models/mixins.py
def instantiate(self, device: Device) -> FSUModel:
    """Instantiate a new FSU on a Device."""
    raise NotImplementedError
to_objectchange(action, **kwargs)

Return a new ObjectChange on updates.

Source code in nautobot_fsus/models/mixins.py
def to_objectchange(self, action: str, **kwargs: Any) -> ObjectChange:
    """Return a new ObjectChange on updates."""
    return super().to_objectchange(action, related_object=self.device_type, **kwargs)

FSUTypeModel

Bases: PrimaryModel

Abstract base class for FSU types.

An FSU type is a discrete component, with a manufacturer, model name, and part number. It is equivalent to a catalog entry for a product that can be purchased. Each FSU type has a unique part number for its manufacturer.

Source code in nautobot_fsus/models/mixins.py
class FSUTypeModel(PrimaryModel):
    """
    Abstract base class for FSU types.

    An FSU type is a discrete component, with a manufacturer, model name, and part number.
    It is equivalent to a catalog entry for a product that can be purchased. Each FSU type
    has a unique part number for its manufacturer.
    """

    manufacturer: ForeignKey = models.ForeignKey(
        to="dcim.Manufacturer",
        on_delete=models.PROTECT,
        related_name="%(class)ss",
    )

    name = models.CharField(max_length=100, verbose_name="Model Name")
    _name = NaturalOrderingField(target_field="name", max_length=255, blank=True, db_index=True)
    part_number = models.CharField(max_length=100, verbose_name="Part Number")
    description = models.CharField(max_length=255, blank=True)
    comments = models.TextField(blank=True)

    clone_fields = ["manufacturer", "name"]
    csv_headers = ["manufacturer", "name", "part_number", "description", "comments"]

    class Meta:
        """Metaclass attributes."""

        abstract = True
        ordering = ["manufacturer", "_name", "part_number"]
        unique_together = ["part_number", "manufacturer"]

    def __str__(self) -> str:
        """String representation of the FSU type."""
        return f"{self.name}"

    @property
    def display(self) -> str:
        """Display string for an FSU type - manufacturer, name, and part number."""
        return f"{self.manufacturer.name} {self.name} [{self.part_number}]"

    @property
    def instance_count(self) -> int:
        """Calculate the number of child FSU instances."""
        return int(self.instances.all().count())
display: str property

Display string for an FSU type - manufacturer, name, and part number.

instance_count: int property

Calculate the number of child FSU instances.

Meta

Metaclass attributes.

Source code in nautobot_fsus/models/mixins.py
class Meta:
    """Metaclass attributes."""

    abstract = True
    ordering = ["manufacturer", "_name", "part_number"]
    unique_together = ["part_number", "manufacturer"]
__str__()

String representation of the FSU type.

Source code in nautobot_fsus/models/mixins.py
def __str__(self) -> str:
    """String representation of the FSU type."""
    return f"{self.name}"

PCIFSUModel

Bases: FSUModel

Abstract base class for an FSU that occupies a PCI slot.

Source code in nautobot_fsus/models/mixins.py
class PCIFSUModel(FSUModel):
    """Abstract base class for an FSU that occupies a PCI slot."""

    pci_slot_id = models.CharField(max_length=100, blank=True, verbose_name="PCI slot ID")

    class Meta(FSUModel.Meta):
        """Metaclass attributes."""

        abstract = True
Meta

Bases: Meta

Metaclass attributes.

Source code in nautobot_fsus/models/mixins.py
class Meta(FSUModel.Meta):
    """Metaclass attributes."""

    abstract = True