napalm-automation / napalm-junos

Apache License 2.0
22 stars 42 forks source link

get_lldp_neighbors_detail() fails on JunOS EX switches #194

Closed bkeifer closed 6 years ago

bkeifer commented 7 years ago

Description of Issue/Question

Calling get_lldp_neighbors_detail() fails on all varieties of Juniper EX-series switches that I have to test with. Other getters (including get_lldp_neighbors(), get_interfaces(), get_config(), and get_facts()) work without a problem.

Tested switch models are:

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

[X] Yes [ ] No

Setup

napalm-junos version

(Paste verbatim output from pip freeze | grep napalm-junos between quotes below)

napalm-junos==0.11.0

JunOS version

(Paste verbatim output from show version and haiku between quotes below)

Hostname: dist02.dlg
Model: ex4300-32f
JUNOS EX  Software Suite [13.2X51-D35.3]
JUNOS FIPS mode utilities [13.2X51-D35.3]
JUNOS Online Documentation [13.2X51-D35.3]
JUNOS EX 4300 Software Suite [13.2X51-D35.3]
JUNOS Web Management [13.2X51-D35.3]
JUNOS py-base-powerpc [13.2X51-D35.3]

        Amazing photons
        Carry our data worldwide
        Never seem to stop

Steps to Reproduce the Issue

from napalm import get_network_driver
driver = get_network_driver('junos')
with driver('<hostname>', '<username>', '<password>') as dev:
    lldp = dev.get_lldp_neighbors_detail()

Error Traceback

(Paste the complete traceback of the exception between quotes below)

NAPALM didn't catch this exception. Please, fill a bugfix on https://github.com/napalm-automation/napalm/issues
Don't forget to include this traceback.
Traceback (most recent call last):
  File "./probe.py", line 42, in <module>
    main()
  File "./probe.py", line 17, in main
    lldp = dev.get_lldp_neighbors_detail()
  File "/Users/brian/Env/napalm/lib/python2.7/site-packages/napalm_junos/junos.py", line 633, in get_lldp_neighbors_detail
    lldp_table.get(interface_name=interface)
  File "/Users/brian/Env/napalm/lib/python2.7/site-packages/jnpr/junos/factory/optable.py", line 64, in get
    self.xml = getattr(self.RPC, self.GET_RPC)(**rpc_args)
  File "/Users/brian/Env/napalm/lib/python2.7/site-packages/jnpr/junos/rpcmeta.py", line 336, in _exec_rpc
    return self._junos.execute(rpc, **dec_args)
  File "/Users/brian/Env/napalm/lib/python2.7/site-packages/jnpr/junos/decorators.py", line 63, in wrapper
    result = function(*args, **kwargs)
  File "/Users/brian/Env/napalm/lib/python2.7/site-packages/jnpr/junos/decorators.py", line 31, in wrapper
    return function(*args, **kwargs)
  File "/Users/brian/Env/napalm/lib/python2.7/site-packages/jnpr/junos/device.py", line 736, in execute
    errs=ex)
jnpr.junos.exception.RpcError: RpcError(severity: error, bad_element: get-lldp-interface-neighbors-information, message: error: syntax error
error: syntax error)
bkeifer commented 7 years ago

This is similar to #166, but my OS version does appear to support it:

> show lldp neighbors interface ge-0/0/32 |display xml rpc
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/13.2X51/junos">
    <rpc>
        <get-lldp-interface-neighbors>
                <interface-device>ge-0/0/32</interface-device>
        </get-lldp-interface-neighbors>
    </rpc>
    <cli>
        <banner>{master:0}</banner>
    </cli>
</rpc-reply>
mirceaulinic commented 7 years ago

Very interesting @bkeifer - as per https://github.com/napalm-automation/napalm-junos/issues/166#issuecomment-307275948 and https://github.com/napalm-automation/napalm-junos/issues/166#issuecomment-307998096, on EX series running 13.2, the XML RPC should be get-lldp-interface-neighbors-information, while yours is get-lldp-interface-neighbors, like on MX series... but the interface name is under interface-device instead of interface-name.

I can see two solutions:

I let you decide what's the most comfortable for you - I'm fine with any. Cheers!

mirceaulinic commented 6 years ago

@bkeifer checking in here - are you working on a fix?

mirceaulinic commented 6 years ago

Moved to https://github.com/napalm-automation/napalm/issues/430