Vadims06 / topolograph

Topolograph.com is an online project which can visualize OSPF/ISIS topology based on LSDB output from a single network device. Then you can not only see (and check) the shortest path from source to destination, but also see the outcome from link or node failure along the path to the destination.
https://topolograph.com
MIT License
177 stars 23 forks source link

API doesn't support Extremes #41

Closed alchemyx closed 1 year ago

alchemyx commented 1 year ago

I am trying to upload LSDB from Extreme but unfortunately API doesn't like it

{'detail': "'Extreme' is not one of ['Cisco', 'Juniper', 'Quagga', 'Bird', " "'Nokia', 'Mikrotik', 'Huawei', 'Paloalto', 'Ubiquiti', " "'AlliedTelesis', 'ZTE'] - '0.vendor_device'", 'status': 400, 'title': 'Bad Request', 'type': 'about:blank'}

Which seems a bit off as I can upload it without any issues over the web interface. I think similar issue might be with Ericsson (although I have no output from such device to test).

Vadims06 commented 1 year ago

Hi @alchemyx , Definitely, I will extend such allow list shortly. Thank you. Meanwhile I can suggest using api/graphs method as a workaround.

alchemyx commented 1 year ago

In fact, I am, it's based on example you kindly provided:

#!/usr/local/bin/python3
import requests
import os
TOPOLOGRAPH_HOST="127.0.0.1"
TOPOLOGRAPH_PORT=8080
TOPOLOGRAPH_WEB_API_USERNAME_EMAIL="ospf@topolograph.com"
TOPOLOGRAPH_WEB_API_PASSWORD="ospf"
from pprint import pprint as pp

lsdbs_attr_ll = []
lsdb_dir = os.path.join(os.getcwd(), 'dc_lsdb')
for vendor_name, protocol_name in [('Extreme', 'ospf'), ('Quagga', 'ospf'), ('Juniper', 'ospf')]:
  f_name = os.path.join(lsdb_dir, f"{vendor_name}_{protocol_name}.txt")
  with open(f_name) as f:
    lsdbs_attr_ll.append({'lsdb_output': f.read(), 'vendor_device': vendor_name, 'igp_protocol': protocol_name})
r_post = requests.post(f'http://{TOPOLOGRAPH_HOST}:{TOPOLOGRAPH_PORT}/api/graphs', auth=(TOPOLOGRAPH_WEB_API_USERNAME_EMAIL, TOPOLOGRAPH_WEB_API_PASSWORD),  json=lsdbs_attr_ll, timeout=(5, 30))
pp(r_post.json())

Unless you mean somethinbg else?

Vadims06 commented 1 year ago

Uh, I got it ;) yeah, I need to update the allow list. Will do it.

Vadims06 commented 1 year ago

@alchemyx Adjusted allow list appropriately, just released 2.34.1 and updated latest version. Please check

alchemyx commented 1 year ago

Confirmed working, thank you!