Update modules/parse.py
This commit is contained in:
parent
acf3c96ad4
commit
ba94293ca6
1 changed files with 22 additions and 0 deletions
|
|
@ -55,4 +55,26 @@ def run_bgp_route_curl_command(ip_version, bgprouteprefix):
|
|||
"--form", f"key={VYOS_API_KEY}"
|
||||
]
|
||||
response = subprocess.check_output(curl_command, text=True)
|
||||
return json.loads(response)
|
||||
|
||||
def run_rpki_cache_connection_curl_command():
|
||||
curl_command = [
|
||||
"curl", "-k", "--location", "--request", "POST", f"{VYOS_API_URL}/show",
|
||||
"--form", "data={\"op\": \"show\", \"path\": [\"rpki\", \"cache-connection\"]}",
|
||||
"--form", f"key={VYOS_API_KEY}"
|
||||
]
|
||||
response = subprocess.check_output(curl_command, text=True)
|
||||
return json.loads(response)
|
||||
|
||||
def run_rpki_lookup_curl_command(lookup_type, query):
|
||||
data_json = {
|
||||
"op": "show",
|
||||
"path": ["rpki", lookup_type, query]
|
||||
}
|
||||
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