napalm-automation / napalm-junos

Apache License 2.0
22 stars 42 forks source link

get_bgp_neighbors_detail gives encode type error #201

Closed wasabi222 closed 6 years ago

wasabi222 commented 7 years ago

Description of Issue/Question

When issuing device.get_bgp_neighbors_detail(), you get traceback saying the type must be str, not unicode. This issue is fixed with this PR: https://github.com/napalm-automation/napalm-junos/pull/200

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.12.0

JunOS version

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

vagrant@junos.test.env> show version and haiku
Hostname: junos.test.env
Model: firefly-perimeter
JUNOS Software Release [12.1X47-D20.7]

        Just like mosquitoes
        Bugs pepper all my source code
        Keeps me off the streets

Steps to Reproduce the Issue

device.get_bgp_neighbors_detail()

Error Traceback

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

In [46]: d.get_bgp_neighbors_detail()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-46-121ae3b152fc> in <module>()
----> 1 d.get_bgp_neighbors_detail()

/usr/local/lib/python2.7/dist-packages/napalm_junos/junos.pyc in get_bgp_neighbors_detail(self, neighbor_address)
   1136                 continue
   1137             neighbor_data = bgp_neighbors_table.get(instance=instance,
-> 1138                                                     neighbor_address=neighbor_address).items()
   1139             _bgp_iter_core(neighbor_data, instance=instance)
   1140         # else:

/usr/local/lib/python2.7/dist-packages/jnpr/junos/factory/optable.pyc in get(self, *vargs, **kvargs)
     62
     63         # execute the Junos RPC to retrieve the table
---> 64         self.xml = getattr(self.RPC, self.GET_RPC)(**rpc_args)
     65
     66         # returning self for call-chaining purposes, yo!

/usr/local/lib/python2.7/dist-packages/jnpr/junos/rpcmeta.pyc in _exec_rpc(*vargs, **kvargs)
    325                                             "boolean, or list/tuple of "
    326                                             "strings and booleans." %
--> 327                                             (a, arg_name, str(type(a))))
    328                         if a is not False:
    329                             arg = etree.SubElement(rpc, arg_name)

TypeError: The value  for argument neighbor-address is of <type 'unicode'>. Argument values must be a string, boolean, or list/tuple of strings and booleans.
mirceaulinic commented 6 years ago

Closed via https://github.com/napalm-automation/napalm-junos/commit/3a73f1b8519a846c960361784ce0295b1c354b3d