add oxiApi
This commit is contained in:
13
pynet.py
13
pynet.py
@@ -3,19 +3,16 @@ import pynetbox
|
||||
from settings import settings
|
||||
|
||||
netbox = pynetbox.api(
|
||||
settings.url,
|
||||
token=settings.token)
|
||||
settings.nb_url,
|
||||
token=settings.nb_token)
|
||||
netbox.http_session.verify = False
|
||||
|
||||
filters = {
|
||||
"has_primary_ip": "true", # или True, зависит от API
|
||||
"tenant": "vimpelcom", # имя или ID арендатора
|
||||
"role": "Kommutator", # роль устройства
|
||||
"has_primary_ip": "true",
|
||||
"tenant": "vimpelcom",
|
||||
"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