hyperglass
hyperglass copied to clipboard
Cannot parse Arista EOS routes if MED is unset
Bug Description
When looking up routes on Arista EOS platforms, if any of the returned routes have the MED unset an error is thrown and the loookup fails. Lookups where all routes returned have an MED value (e.g. 0 or 2001 etc) it works as expected.
Expected behavior
Look up a BGP route normally and get a table of results.
Steps to Reproduce
Lookup a route on arista_eos platform that you know has no MED set. example below;
#sho ip bgp 1.1.1.1 BGP routing table entry for 1.1.1.0/24 Paths: 2 available 13335 (aggregated by 13335 141.101.71.254) 195.66.225.179 from 195.66.225.179 (141.101.71.1) Origin IGP, metric -, localpref 200, weight 0, received 09:29:35 ago, valid, external, best
Local Configurations
No specific configuration needed.
Logs
[INFO] 20211202 16:31:33 | hyperglass.api.routes:90 | query → Starting query execution for query Query(query_location=london_gb, query_type=bgp_route, query_vrf=Global, query_target=1.1.1.0/24)
[CRITICAL] 20211202 16:31:35 | hyperglass.parsing.arista:53 | parse_arista → 1 validation error for AristaRoute
bgpRouteEntries -> 1.1.1.0/24 -> bgpRoutePaths -> 0 -> med
field required (type=value_error.missing)
[CRITICAL] 20211202 16:31:35 | hyperglass.exceptions:40 | __init__ → [DANGER]
Field: bgpRouteEntries → 1.1.1.0/24 → bgpRoutePaths → 0 → med
Error: field required
Possible Solution
If MED is not set in the response, then set it as zero when parsing. It looks like something similar was done for iBGP routes!
Environment
Server
Metric | Value |
---|---|
hyperglass Version | 1.0.4 |
hyperglass Path | /home/hyperglass/hyperglass |
Python Version | 3.6.8 |
Node Version | 14.18.2 |
Platform Info | Linux-3.10.0-327.36.3.el7.centos.plus.x86_64-x86_64-with-centos-7.9.2009-Core |
CPU Info | Intel Core Processor (Haswell, no TSX, IBRS) |
Logical Cores | 2 |
Physical Cores | 2 |
Processor Speed | 2.599996GHz |
Total Memory | 4.14 GB |
Memory Utilization | 10.1% |
Total Disk Space | 31.57 GB |
Disk Utilization | 15.0% |
Client
- OS: Elementary OS 5
- Browser: Firefox