Update modules/parse.py
This commit is contained in:
parent
0c473e034d
commit
d4e480d49c
1 changed files with 36 additions and 0 deletions
|
|
@ -78,3 +78,39 @@ def run_rpki_lookup_curl_command(lookup_type, query):
|
||||||
]
|
]
|
||||||
response = subprocess.check_output(curl_command, text=True)
|
response = subprocess.check_output(curl_command, text=True)
|
||||||
return json.loads(response)
|
return json.loads(response)
|
||||||
|
|
||||||
|
def run_bgp_neighbor_detail_curl_command(ip_version, neighbor_ip):
|
||||||
|
path_ip_version = "ipv4" if ip_version == "ipv4" else "ipv6"
|
||||||
|
data_json = {
|
||||||
|
"op": "show",
|
||||||
|
"path": ["bgp", "vrf", "bgp", path_ip_version, "neighbors", neighbor_ip]
|
||||||
|
}
|
||||||
|
curl_command = [
|
||||||
|
"curl", "-k", "--location", "--request", "POST", f"{VYOS_API_URL}/show",
|
||||||
|
"--form", f"data={json.dumps(data_json)}",
|
||||||
|
"--form", f"key={VYOS_API_KEY}"
|
||||||
|
]
|
||||||
|
response = subprocess.check_output(curl_command, text=True)
|
||||||
|
return json.loads(response)
|
||||||
|
|
||||||
|
def run_bfd_peers_curl_command():
|
||||||
|
curl_command = [
|
||||||
|
"curl", "-k", "--location", "--request", "POST", f"{VYOS_API_URL}/show",
|
||||||
|
"--form", "data={\"op\": \"show\", \"path\": [\"bfd\", \"peers\"]}",
|
||||||
|
"--form", f"key={VYOS_API_KEY}"
|
||||||
|
]
|
||||||
|
response = subprocess.check_output(curl_command, text=True)
|
||||||
|
return json.loads(response)
|
||||||
|
|
||||||
|
def run_bfd_peer_detail_curl_command(peer_ip):
|
||||||
|
data_json = {
|
||||||
|
"op": "show",
|
||||||
|
"path": ["bfd", "peer", peer_ip]
|
||||||
|
}
|
||||||
|
curl_command = [
|
||||||
|
"curl", "-k", "--location", "--request", "POST", f"{VYOS_API_URL}/show",
|
||||||
|
"--form", f"data={json.dumps(data_json)}",
|
||||||
|
"--form", f"key={VYOS_API_KEY}"
|
||||||
|
]
|
||||||
|
response = subprocess.check_output(curl_command, text=True)
|
||||||
|
return json.loads(response)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue