Skip to content
Snippets Groups Projects

IP-TRUNK-CREATE-WORKFLOW-NETBOX-INTEGRATION

9 files
+ 377
71
Compare changes
  • Side-by-side
  • Inline
Files
9
+ 5
4
import typer
from pynetbox import RequestError
from gso.services.netbox_client import NetBoxClient
from gso.services.netbox_client import NetboxClient
from gso.utils.device_info import DEFAULT_SITE, ROUTER_ROLE
app: typer.Typer = typer.Typer()
@@ -17,18 +18,18 @@ def netbox_initial_setup() -> None:
typer.echo("Initial setup of NetBox ...")
typer.echo("Connecting to NetBox ...")
nbclient = NetBoxClient()
nbclient = NetboxClient()
typer.echo("Creating GÉANT site ...")
try:
nbclient.create_device_site("GEANT", "geant")
nbclient.create_device_site(DEFAULT_SITE["name"], DEFAULT_SITE["slug"])
typer.echo("Site created successfully.")
except RequestError as e:
typer.echo(f"Error creating site: {e}")
typer.echo("Creating Router device role ...")
try:
nbclient.create_device_role("router", "router")
nbclient.create_device_role(ROUTER_ROLE["name"], ROUTER_ROLE["slug"])
typer.echo("Device role created successfully.")
except RequestError as e:
typer.echo(f"Error creating device role: {e}")
Loading