Closed svoropaev closed 2 years ago
Hi @svoropaev, new variables has been implemented
TOPOLOGRAPH_WEB_API_USERNAME_EMAIL: 'ospf@topolograph.com'
TOPOLOGRAPH_WEB_API_PASSWORD: 'ospf'
TOPOLOGRAPH_WEB_API_AUTHORISED_NETWORKS: '127.0.0.1/32,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16'
SWAGGER_HOST: 'localhost:8088'
After booting docker-compose up - it's possible to create default credentials using variables from yaml file via single POST request
import requests
res = requests.post('http://localhost:8088/create-default-credentials')
res.json()
{'errors': '', 'status': 'ok'}
...right after this you can use them in other requests:
res = requests.get('http://localhost:8088/api/graph/', auth=('ospf@topolograph.com', 'ospf'))
res.json()
[{'graph_time': '14Jan2022_12h10m30s_13_hosts_demo', 'hosts': {'count': 13}, 'networks': {'backuped': 18, 'count': 40, 'notbackuped': 22, 'url_link': 'http://localhost:8088/api/network/14Jan2022_12h10m30s_13_hosts_demo'}, 'timestamp': '2022-01-14T12:10:30.815000'}]
Full docker-compose.override.yml looks like this:
version: '3'
services:
flask:
environment:
NAPALM_USERNAME: cisco
NAPALM_PASSWORD: cisco
NAPALM_PORT: 22
DNS: ''
NETBOX_URL: '' # http://localhost:8000
NETBOX_RO_TOKEN : ''
TOPOLOGRAPH_WEB_API_USERNAME_EMAIL: 'ospf@topolograph.com'
TOPOLOGRAPH_WEB_API_PASSWORD: 'ospf'
TOPOLOGRAPH_WEB_API_AUTHORISED_NETWORKS: '127.0.0.1/32,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16'
SWAGGER_HOST: 'localhost:8088'
SWAGGER_HOST
allows to send "try now" requests from swagger dashboard
Off topic, have you tried to integrate Topolograph with OSPF Watcher to get historical topology changes dashboard?
Tagged v2.25.1
Off topic, have you tried to integrate Topolograph with OSPF Watcher to get historical topology changes dashboard? Hi Vadim. No I did not use this feature.
Hi!
API needs the credential and there is no way to create a user/password at the moment of Docker image deployment. Now we need to create username/password via WEB interface and use the API then. It makes automatic deployment almost impossible. It would be fine to have a default username/password for local Docker image or it would be fine to be able to configure it in docker-compose.yml. The same is for ip address range for authorised API users. Would be fine to have it enabled by default for 0.0.0.0/0 or to hve an ability to configure it in docker-compose.yml during the deployment.
Also Swagger ReST links (click "try it out") have a "topolograph" http://topolograph.com/api/ in the URL instead of localhost/127.0.0.1/or any other hostname which is used to reach the page.