Skip to content

[Juniper] no values for indirect next-hops #135

Description

@syntax-terr0r

On Juniper devices, routes with indirect next-hops are not showing any values for the next-hop in the output.

Bug Description

example route:

5.35.225.7/32 (2 entries, 1 announced)
        *BGP    Preference: 170/-101
                Source: 62.138.130.149
                Next hop: 62.138.164.57 via ae0.0, selected
                Protocol next hop: 10.30.30.9
                Local AS: 64613 Peer AS: 64613
                Age: 5d 23:08:04 	Metric2: 0
                AS path: I
                Communities: 1234:101 no-advertise
                Accepted
                Localpref: 100
                Router ID: 62.138.130.149

Neither of the two next-hops is showing up in the output:

Routes For: 5.35.225.7
Timestamp: 2021-04-13 08:11:28 UTC
  - Prefix: 5.35.225.7/32
    - RPKI State: Not Verified
    - AS Path: 
    - Next Hop: 
    - Weight: 170
    - Local Preference: 100
    - MED: 0
    - Communities: 
      - 1234:101
      - no-advertise
    - Originator: 
    - Peer: 62.138.130.149
    - Age: 6 days (Wed, 07 Apr 2021 08:56:14 UTC)

Expected behavior

Expect to see the protocol next-hop 10.30.30.9 in the output.

Steps to Reproduce

Query route with indirect next-hop

Possible Solution

The relevant section in the code appears to be this

        # Extract the 'to:' value from the next-hop
        selected_next_hop = ""
        for hop in next_hops:
            if "selected-next-hop" in hop:
                selected_next_hop = hop.get("to", "")
                break

When parsing the "to:" value it's looking for the "selected-next-hop" flag in the output.
However, I don't think indirect next-hops (e.g. protocol next-hops) have that flag set at all.
At least I'm unable to find an example of this anywhere in my network.
Thus, since the route (or any other route for that matter) has "protocol-nh" set but not "selected-next-hop", the next-hop value is left blank.

Environment

Server

| Metric | Value |
| ------ | ----- |
| **hyperglass Version** | **1.0.0-beta.80** |
| **hyperglass Path** | `None` |
| **Python Version** | `3.6.8` |
| **Platform Info** | `Linux-3.10.0-1160.21.1.el7.x86_64-x86_64-with-centos-7.9.2009-Core` |
| **CPU Info** | Intel Core Processor (Haswell, no TSX, IBRS) |
| **Logical Cores** | `4` |
| **Physical Cores** | `4` |
| **Processor Speed** | 2.394454GHz |
| **Total Memory** | 8.2 GB |
| **Memory Utilization** | 31.0% |
| **Total Disk Space** | 128.84 GB |
| **Disk Utilization** | 7.4% |

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions