Skip to content

BGP Route fails with latest hyperglass on Junos 19.4R1-S2.2 #83

Closed

Description

@bastelfreak

Bug Description

Hi! I'm running the latest hyperglass server and it connects to a VMX with Junos 19.4R1-S2.2. It fails to parse the XML response

Expected behavior

I expect to see route information

Steps to Reproduce

I'm not a network engineer so I cannot really tell you how to setup our MX to get the same routing information 😢

Local Configurations

my devices.yaml

---
routers:
  - name: vmx-1
    address: rfc1918ip
    network:
      name: primary
      display_name: lab
    credential:
      username: hyperglass
      password: foobar
    display_name: vmx-1
    port: 22
    nos: juniper
    proxy: null
    vrfs:
      - name: default
        display_name: default
        ipv4:
          source_address: rfc1918ip
          force_cidr: false

based on the docs it's not really clear what's the difference between juniper and juniper_junos for the nos attribute. I assume juniper is correct here because the created command works in the CLI. If I specify juniper_junos I get an error about missing commands.

Logs

all the logs \o/

juniper version:

> show version | match Junos:  
Junos: 19.4R1-S2.2

command send from hyperglass to VMX:

Sep 18 18:18:21 hyperglass python3[20985]: [DEBUG] 20200918 18:18:21 | hyperglass.execution.drivers.ssh_scrapli:97 | collect → Raw response for command "show route protocol bgp table inet.0 *hiddenip* detail | display xml": 

output if I execute this on the VMX:

<rpc-reply xmlns:junos="http://xml.juniper.net/junos/19.4R0/junos">
    <route-information xmlns="http://xml.juniper.net/junos/19.4R0/junos-routing">
        <route-table>
            <table-name>inet.0</table-name>
            <destination-count>32086</destination-count>
            <total-route-count>32147</total-route-count>
            <active-route-count>32086</active-route-count>
            <holddown-route-count>0</holddown-route-count>
            <hidden-route-count>0</hidden-route-count>
            <rt junos:style="detail">
                <rt-destination>*hidden*</rt-destination>
                <rt-prefix-length>32</rt-prefix-length>
                <rt-entry-count junos:format="1 entry">1</rt-entry-count>
                <rt-announced-count>1</rt-announced-count>
                <rt-entry>
                    <active-tag>*</active-tag>
                    <current-active/>
                    <last-active/>
                    <protocol-name>BGP</protocol-name>
                    <preference>170</preference>
                    <preference2>-101</preference2>
                    <nh-type>Indirect</nh-type>
                    <nh-index>0</nh-index>
                    <nh-address>0x104b4d88</nh-address>
                    <nh-reference-count>9</nh-reference-count>
                    <nh-kernel-id>0</nh-kernel-id>
                    <gateway>*hidden*</gateway>
                    <protocol-nh junos:indent="16">
                        <to>*hidden*</to>
                        <indirect-nh>0x2 no-forward INH Session ID: 0x0
                        </indirect-nh>
                    </protocol-nh>
                    <rt-entry-state>Active NotInstall Ext</rt-entry-state>
                    <local-as>*hidden*</local-as>
                    <peer-as>*hidden*</peer-as>
                    <age junos:seconds="980918">1w4d 8:28:38</age>
                    <metric2>0</metric2>
                    <validation-state>unverified</validation-state>
                    <task-name>BGP_*hidden*+49306</task-name>
                    <announce-bits>1</announce-bits>
                    <announce-tasks>4-BGP_RT_Background </announce-tasks>
                    <as-path>AS path: *hidden* I
                    </as-path>
                    <bgp-path-attributes>
                        <attr-as-path-effective>
                            <aspath-effective-string>AS path: </aspath-effective-string>
                            <attr-value>*hidden* I</attr-value>
                        </attr-as-path-effective>
                    </bgp-path-attributes>
                    <bgp-rt-flag>Accepted</bgp-rt-flag>
                    <local-preference>100</local-preference>
                    <peer-id>*hidden*</peer-id>
                </rt-entry>
            </rt>
        </route-table>
    </route-information>                
    <cli>
        <banner></banner>
    </cli>
</rpc-reply>

error from the hyperglass log:

Sep 18 18:18:21 hyperglass python3[20985]: [CRITICAL] 20200918 18:18:21 | hyperglass.parsing.juniper:54 | parse_juniper → ''nh'' was not found in the response 
Sep 18 18:18:21 hyperglass python3[20985]: [CRITICAL] 20200918 18:18:21 | hyperglass.exceptions:30 | __init__ → [DANGER] Error parsing response data 

Possible Solution

Environment

Server

Metric Value
hyperglass Version 1.0.0-beta.57
hyperglass Path /opt/hyperglass/hyperglass
Python Version 3.6.8
Platform Info Linux-5.8.9-1.el7.elrepo.x86_64-x86_64-with-centos-7.8.2003-Core
CPU Info Intel Xeon Processor (Skylake, IBRS)
Logical Cores 4
Physical Cores 1
Processor Speed 2.095076GHz
Total Memory 4.13 GB
Memory Utilization 32.9%
Total Disk Space 51.65 GB
Disk Utilization 13.6%

Activity

  1. fischa commented on Oct 5, 2020

    @fischa

    @checktheroads have you considered using napalm for getting a standardized output for the "major" networking vendors? Parsing output even though it is XML can be painful if it changes over time. It looks like the readthedocs compatibility matrix (of napalm) is out of date as I can see the junos version of get_route_to() in the code.

  2. thatmattlove commented on Oct 5, 2020

    @thatmattlove
    Collaborator

    I've considered it, but every time I look at it I'm unhappy with the options and consistency. For example, it doesn't appear you can do a BGP lookup based on community or AS_PATH, meaning I'd have to fall back to scraping & parsing for specific commands, for specific NOS. Why? I'm relatively happy with the Juniper parsing as it stands now (after pushing 9b87e5d). Now, for Cisco IOS/IOS-XR/NX-OS, I'm planning on looking at TTP for "reverse-template" style parsing.

    @bastelfreak - can you confirm if 1.0.0-beta.58 fixes this issue?

  3. bastelfreak commented on Oct 5, 2020

    @bastelfreak
    ContributorAuthor

    thanks for the update, I will test it tomorrow morning.

  4. bastelfreak commented on Oct 9, 2020

    @bastelfreak
    ContributorAuthor

    hey. Sorry for the late response. I can confirm that the error is now fixed and bgp route option works now fine

  5. forkwhilefork commented on Oct 29, 2020

    @forkwhilefork

    hey I'm having a similar problem (Junos parsing). Here's my log data:

    [DEBUG] 20201029 12:03:41 | hyperglass.execution.drivers._common:34 | parsed_response ? Pre-parsed responses:
    ('<rpc-reply xmlns:junos="http://xml.juniper.net/junos/15.1R6/junos">\n    <route-information xmlns="http://xml.juniper.net/junos/15.1R6/junos-routing">\n        <!-- keepalive -->\n        <route-table>\n            <table-name>inet.0</table-name>\n            <destination-count>817212</destination-count>\n            <total-route-count>1398617</total-route-count>\n            <active-route-count>817198</active-route-count>\n            <holddown-route-count>1</holddown-route-count>\n            <hidden-route-count>28430</hidden-route-count>\n            <rt junos:style="detail">\n                <rt-destination>23.147.64.0</rt-destination>\n                <rt-prefix-length>24</rt-prefix-length>\n                <rt-entry-count junos:format="3 entries">3</rt-entry-count>\n                <rt-announced-count>1</rt-announced-count>\n                <rt-entry>\n                    <active-tag>*</active-tag>\n                    <current-active/>\n                    <last-active/>\n                    <protocol-name>BGP</protocol-name>\n                    <preference>170</preference>\n                    <preference2>-501</preference2>\n                    <nh-type>Indirect</nh-type>\n                    <nh-index>0</nh-index>\n                    <nh-address>0x5538136c</nh-address>\n                    <nh-reference-count>100</nh-reference-count>\n                    <nh-kernel-id>0</nh-kernel-id>\n                    <gateway>69.169.88.1</gateway>\n                    <nh-type>Router</nh-type>\n                    <nh-index>674</nh-index>\n                    <nh junos:indent="16">\n                        <nh-string>Next hop</nh-string>\n                        <to>66.231.176.9</to>\n                        <via>ae0.4</via>\n                        <selected-next-hop/>\n                        <session>40ce</session>\n                    </nh>\n                    <protocol-nh junos:indent="16">\n                        <to>69.169.37.42</to>\n                        <indirect-nh>0x59482d58 1049023 INH Session ID: 0x302b16</indirect-nh>\n                    </protocol-nh>\n                    <rt-entry-state>Active Int Ext</rt-entry-state>\n                    <local-as>33597</local-as>\n                    <peer-as>33597</peer-as>\n                    <age junos:seconds="212231">2d 10:57:11</age>\n                    <metric2>100</metric2>\n                    <validation-state>unverified</validation-state>\n                    <task-name>BGP_33597.69.169.88.1</task-name>\n                    <announce-bits>5</announce-bits>\n                    <announce-tasks>0-KRT 5-BGP_RT_Background 6-Resolve tree 3 8-Aggregate 11-RT </announce-tasks>\n                    <as-path>AS path: 25682 I\n                        Unrecognized Attributes: 15 bytes\n                        Attr flags e0 code 20: 00 00 64 52 00 00 00 0a 00 00 01 f4\n                        AS path: Recorded\n                    </as-path>\n                    <communities>\n                        <community>33597:13</community>\n                        <community>33597:200</community>\n                        <community>33597:1004</community>\n                    </communities>\n                    <bgp-rt-flag>Accepted</bgp-rt-flag>\n                    <local-preference>500</local-preference>\n                    <peer-id>x.x.x.x</peer-id>\n                </rt-entry>\n            </rt>\n        </route-table>\n    </route-information>\n    <cli>\n        <banner>{master}</banner>\n    </cli>\n</rpc-reply>\n\n{master}',)
    [CRITICAL] 20201029 12:03:41 | hyperglass.parsing.juniper:51 | parse_juniper ? not well-formed (invalid token): line 73, column 0
    

    It looks like it's choking on the {master} line at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions