Julian Noble
2 years ago
1 changed files with 38 additions and 0 deletions
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3 |
||||
import sys |
||||
import yaml |
||||
from pathlib import Path |
||||
|
||||
import networkscan |
||||
import requests |
||||
import pynetbox |
||||
|
||||
def get_settings(): |
||||
full_file_path = Path(__file__).parent.joinpath('local_settings.yaml') |
||||
with open(full_file_path) as settings: |
||||
settings_data = yaml.safe_load(settings) |
||||
return settings_data |
||||
|
||||
settings = get_settings() |
||||
nb_url = settings['netbox']['url'] |
||||
nb_token = settings['netbox']['auth_token'] |
||||
|
||||
print("Netbox server: " + nb_url) |
||||
print("Netbox token: " + nb_token) |
||||
|
||||
nb = pynetbox.api(nb_url,token=nb_token) |
||||
print("version: -" + nb.version + "-") |
||||
#print(nb.dcim.devices.all()) |
||||
devices = nb.dcim.devices.all() |
||||
for i in devices: |
||||
print(i) |
||||
|
||||
#for device in devices: |
||||
#print('test') |
||||
#print(device.name) |
||||
|
||||
sys.exit() |
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in new issue