feat: add various infrastructure check and automation scripts
This commit is contained in:
19
scripts/dump_network_conf.py
Normal file
19
scripts/dump_network_conf.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import requests
|
||||
import urllib3
|
||||
import json
|
||||
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
s = requests.Session()
|
||||
s.verify = False
|
||||
|
||||
r = s.post('https://14.44.4.1/api/auth/login', json={'username': 'snarf', 'password': 'Katzir476!!!'})
|
||||
csrf = r.headers.get('x-csrf-token') or r.cookies.get('csrf_token')
|
||||
headers = {'X-CSRF-Token': csrf} if csrf else {}
|
||||
|
||||
r_net = s.get('https://14.44.4.1/proxy/network/api/s/default/rest/networkconf', headers=headers)
|
||||
for n in r_net.json().get('data', []):
|
||||
if n.get('name') in ['Smart Home', 'Compute']:
|
||||
print(f"=== {n.get('name')} ===")
|
||||
print(json.dumps(n, indent=2))
|
||||
|
||||
Reference in New Issue
Block a user