1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

add sync api to external handler

This commit is contained in:
checktheroads
2020-04-19 00:22:01 -07:00
parent 21c636a273
commit ffbbfffe33
4 changed files with 173 additions and 35 deletions

View File

@@ -6,9 +6,9 @@ from ipaddress import ip_network
# Project
from hyperglass.log import log
from hyperglass.util import get_network_info
from hyperglass.exceptions import InputInvalid, InputNotAllowed
from hyperglass.configuration import params
from hyperglass.external.ripestat import RIPEStat
def _member_of(target, network):
@@ -138,7 +138,10 @@ def validate_ip(value, query_type, query_vrf): # noqa: C901
# query.
elif query_type in ("bgp_route",) and vrf_afi.force_cidr:
valid_ip = get_network_info(valid_ip.network_address).get("prefix")
with RIPEStat() as ripe:
valid_ip = ripe.network_info_sync(valid_ip.network_address).get(
"prefix"
)
# For a host query with bgp_route query type and force_cidr
# disabled, convert the host query to a single IP address.