Skip to content

Device info

Utility module that defines facts about different tiers of sites. Used by Netbox when creating a new device.

ModuleInfo

Bases: BaseModel

A collection of facts that define the tier of a site.

Source code in gso/utils/device_info.py
class ModuleInfo(BaseModel):
    """A collection of facts that define the tier of a site."""

    device_type: str
    module_bays_slots: list[int]
    module_type: str
    breakout_interfaces_per_slot: list[int]
    total_10g_interfaces: int

TierInfo

Information for different tiers of sites.

Source code in gso/utils/device_info.py
class TierInfo:
    """Information for different tiers of sites."""

    def __init__(self) -> None:
        """Initialise the different tiers of sites that exist."""
        self.tier1 = ModuleInfo(
            device_type="7750 SR-7s",
            module_bays_slots=[1, 2],
            module_type="XMA2-s-36p-400g",
            breakout_interfaces_per_slot=[36, 35, 34, 33],
            total_10g_interfaces=80,
        )
        self.tier2 = ModuleInfo(
            device_type="7750 SR-7s",
            module_bays_slots=[1, 2],
            module_type="XMA2-s-36p-400g",
            breakout_interfaces_per_slot=[36, 35, 34, 33],
            total_10g_interfaces=60,
        )
        self.tier3 = ModuleInfo(
            device_type="7750 SR2-se",
            module_bays_slots=[1, 2],
            module_type="XCMC-2SE-2",
            breakout_interfaces_per_slot=[36, 35, 34, 33],
            total_10g_interfaces=76,
        )

    def get_module_by_name(self, name: str) -> ModuleInfo:
        """Retrieve a module by name."""
        return getattr(self, name)

__init__()

Initialise the different tiers of sites that exist.

Source code in gso/utils/device_info.py
def __init__(self) -> None:
    """Initialise the different tiers of sites that exist."""
    self.tier1 = ModuleInfo(
        device_type="7750 SR-7s",
        module_bays_slots=[1, 2],
        module_type="XMA2-s-36p-400g",
        breakout_interfaces_per_slot=[36, 35, 34, 33],
        total_10g_interfaces=80,
    )
    self.tier2 = ModuleInfo(
        device_type="7750 SR-7s",
        module_bays_slots=[1, 2],
        module_type="XMA2-s-36p-400g",
        breakout_interfaces_per_slot=[36, 35, 34, 33],
        total_10g_interfaces=60,
    )
    self.tier3 = ModuleInfo(
        device_type="7750 SR2-se",
        module_bays_slots=[1, 2],
        module_type="XCMC-2SE-2",
        breakout_interfaces_per_slot=[36, 35, 34, 33],
        total_10g_interfaces=76,
    )

get_module_by_name(name)

Retrieve a module by name.

Source code in gso/utils/device_info.py
def get_module_by_name(self, name: str) -> ModuleInfo:
    """Retrieve a module by name."""
    return getattr(self, name)