add oxi manager
This commit is contained in:
21
pynet.py
Normal file
21
pynet.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import pynetbox
|
||||
|
||||
from settings import settings
|
||||
|
||||
netbox = pynetbox.api(
|
||||
settings.url,
|
||||
token=settings.token)
|
||||
netbox.http_session.verify = False
|
||||
|
||||
filters = {
|
||||
"has_primary_ip": "true", # или True, зависит от API
|
||||
"tenant": "vimpelcom", # имя или ID арендатора
|
||||
"role": "Kommutator", # роль устройства
|
||||
}
|
||||
|
||||
# Передаём словарь в filter через **
|
||||
devices = netbox.dcim.devices.filter(**filters)
|
||||
|
||||
# Вывод результатов
|
||||
for device in devices:
|
||||
print(f"{device.name} (IP: {device.primary_ip})")
|
||||
Reference in New Issue
Block a user