-
Aleksandr Kurbatov authoredAleksandr Kurbatov authored
device_info.py 1.66 KiB
"""Utility module that defines facts about different tiers of sites. Used by Netbox when creating a new device."""
from pydantic import BaseModel
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
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)
# The range includes values from 1 to 10 (11 is not included)
FEASIBLE_IP_TRUNK_LAG_RANGE = range(1, 11)
# Define default values
ROUTER_ROLE = {"name": "router", "slug": "router"}
DEFAULT_SITE = {"name": "GEANT", "slug": "geant"}