diff --git a/hyperglass/execution/drivers/_construct.py b/hyperglass/execution/drivers/_construct.py index c9961a23..ad3f41cc 100644 --- a/hyperglass/execution/drivers/_construct.py +++ b/hyperglass/execution/drivers/_construct.py @@ -41,7 +41,6 @@ def __init__(self, device, query_data): # Set AFIs for based on query type if self.query_data.query_type in ("bgp_route", "ping", "traceroute"): - # For IP queries, AFIs are enabled (not null/None) VRF -> AFI definitions # where the IP version matches the IP version of the target. self.afis = [ @@ -52,8 +51,7 @@ def __init__(self, device, query_data): ) if v is not None and self.query_data.query_target.version == v.version ] - - with Formatter(self.device.nos, self.query_data.query_type) as formatter: + elif self.query_data.query_type in ("bgp_aspath", "bgp_community"): # For AS Path/Community queries, AFIs are just enabled VRF -> AFI # definitions, no IP version checking is performed (since there is no IP). self.afis = [ @@ -64,6 +62,8 @@ def __init__(self, device, query_data): ) if v is not None ] + + with Formatter(self.device.nos, self.query_data.query_type) as formatter: self.target = formatter(self.query_data.query_target) def json(self, afi):