A script to creare a report of vlans, ip prefixes and ip addresses assigned to a site in Netbox.
It uses rich to format output.
Provide site, url and token in command line. Redirect output to textfile or copy and paste.
Usage: netbox_rich_report.py [-h] site url token
PREFIXES
┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━┓
┃ PREFIX ┃ DESCRIPTION ┃ VLAN ID ┃ VLAN NAME ┃
┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━┩
│ 10.101.0.0/24 │ thi is prefix 101 │ 101 │ VLAN-101 │
│ 10.102.0.0/24 │ thi is prefix 102 │ 102 │ VLAN-102 │
│ 10.103.0.0/24 │ thi is prefix 103 │ 103 │ VLAN-103 │
│ 10.104.0.0/24 │ thi is prefix 104 │ 104 │ VLAN-104 │
│ 10.105.0.0/24 │ thi is prefix 105 │ 105 │ VLAN-105 │
└───────────────┴───────────────────┴─────────┴───────────┘
VLANS
┏━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃ VLAN ID ┃ NAME ┃ DESCRIPTION ┃
┡━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ 161 │ VLAN-101 │ this is VLAN 101 │
│ 162 │ VLAN-102 │ this is VLAN 102 │
│ 163 │ VLAN-103 │ this is VLAN 103 │
│ 164 │ VLAN-104 │ this is VLAN 104 │
│ 165 │ VLAN-105 │ this is VLAN 105 │
└─────────┴──────────┴──────────────────┘
IP ADDRESSES
┏━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃ PREFIX ┃ VLAN ┃ IP ┃ NAME ┃
┡━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ 10.101.0.0/24 │ 101 │ 10.101.0.1/24 │ this is IP 101.1 │
│ 10.101.0.0/24 │ 101 │ 10.101.0.2/24 │ this is IP 101.2 │
│ 10.101.0.0/24 │ 101 │ 10.101.0.3/24 │ this is IP 101.3 │
│ 10.101.0.0/24 │ 101 │ 10.101.0.4/24 │ this is IP 101.4 │
│ 10.101.0.0/24 │ 101 │ 10.101.0.5/24 │ this is IP 101.5 │
│ 10.102.0.0/24 │ 102 │ 10.102.0.1/24 │ this is IP 102.1 │
│ 10.102.0.0/24 │ 102 │ 10.102.0.2/24 │ this is IP 102.2 │
│ 10.102.0.0/24 │ 102 │ 10.102.0.3/24 │ this is IP 102.3 │
│ 10.102.0.0/24 │ 102 │ 10.102.0.4/24 │ this is IP 102.4 │
│ 10.102.0.0/24 │ 102 │ 10.102.0.5/24 │ this is IP 102.5 │
│ 10.103.0.0/24 │ 103 │ 10.103.0.1/24 │ this is IP 103.1 │
│ 10.103.0.0/24 │ 103 │ 10.103.0.2/24 │ this is IP 103.2 │
│ 10.103.0.0/24 │ 103 │ 10.103.0.3/24 │ this is IP 103.3 │
│ 10.103.0.0/24 │ 103 │ 10.103.0.4/24 │ this is IP 103.4 │
│ 10.103.0.0/24 │ 103 │ 10.103.0.5/24 │ this is IP 103.5 │
│ 10.104.0.0/24 │ 104 │ 10.104.0.1/24 │ this is IP 104.1 │
│ 10.104.0.0/24 │ 104 │ 10.104.0.2/24 │ this is IP 104.2 │
│ 10.104.0.0/24 │ 104 │ 10.104.0.3/24 │ this is IP 104.3 │
│ 10.104.0.0/24 │ 104 │ 10.104.0.4/24 │ this is IP 104.4 │
│ 10.104.0.0/24 │ 104 │ 10.104.0.5/24 │ this is IP 104.5 │
│ 10.105.0.0/24 │ 105 │ 10.105.0.1/24 │ this is IP 105.1 │
│ 10.105.0.0/24 │ 105 │ 10.105.0.2/24 │ this is IP 105.2 │
│ 10.105.0.0/24 │ 105 │ 10.105.0.3/24 │ this is IP 105.3 │
│ 10.105.0.0/24 │ 105 │ 10.105.0.4/24 │ this is IP 105.4 │
│ 10.105.0.0/24 │ 105 │ 10.105.0.5/24 │ this is IP 105.5 │
└───────────────┴──────┴───────────────┴──────────────────┘