Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fault on attempting to pull results in json format from switches in virtual chassis. #1325

Open
baldgeek opened this issue Sep 27, 2024 · 4 comments

Comments

@baldgeek
Copy link

Error dump:

   phy_int=decom_switch.rpc.get_interface_information({'format':'json'},interface_name=decom_int['name'],terse=True)
  File "/usr/local/lib/python3.9/site-packages/jnpr/junos/rpcmeta.py", line 363, in _exec_rpc
    return self._junos.execute(rpc, **dec_args)
  File "/usr/local/lib/python3.9/site-packages/jnpr/junos/decorators.py", line 76, in wrapper
    return function(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/jnpr/junos/decorators.py", line 31, in wrapper
    return function(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/jnpr/junos/device.py", line 875, in execute
    or (ver_info.major[0] == 14 and ver_info.major[1] >= 2)

Code in question:

        if (
            ver_info
            and ver_info.major[0] >= 15
            or (ver_info.major[0] == 14 and ver_info.major[1] >= 2)
        ):

I believe that the fix is likely simply putting () around the two pieces of the "or", so something like this:

        if (
            ver_info
            and (ver_info.major[0] >= 15
            or (ver_info.major[0] == 14 and ver_info.major[1] >= 2))
        ):

However the bigger issue is that in my testing for any EX switch in a virtual chassis the version (as seen from .facts) gets set to None. This prevents the ability to do JSON output even though all the switches are running version 20 or better. I have not spent time figuring out why that is the case. I can open a separate issue for this if you prefer as well.

@baldgeek
Copy link
Author

Sorry I realized I forgot the last line of the error. it is:

AttributeError: 'NoneType' object has no attribute 'major'

Full report in one place:

   phy_int=decom_switch.rpc.get_interface_information({'format':'json'},interface_name=decom_int['name'],terse=True)
  File "/usr/local/lib/python3.9/site-packages/jnpr/junos/rpcmeta.py", line 363, in _exec_rpc
    return self._junos.execute(rpc, **dec_args)
  File "/usr/local/lib/python3.9/site-packages/jnpr/junos/decorators.py", line 76, in wrapper
    return function(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/jnpr/junos/decorators.py", line 31, in wrapper
    return function(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/jnpr/junos/device.py", line 875, in execute
    or (ver_info.major[0] == 14 and ver_info.major[1] >= 2)
  AttributeError: 'NoneType' object has no attribute 'major'

@dineshbaburam91
Copy link
Collaborator

@baldgeek
Could you share the specific EX model name and version where this issue occurs? Your input will be extremely valuable in helping us address this issue effectively.

@baldgeek
Copy link
Author

Virtual chassis that show this issue:
EX3400-48T and code version 21.4R3-S6
EX4400-48T and code version 22.2R3-S2
EX4100-48P and code version 22.4R3-S2

I also have two VC of ex3400-48T running 21.4R3-S1 that do NOT show this problem. I only checked these 5 virtual chassis.

@dineshbaburam91
Copy link
Collaborator

@baldgeek Merged the fix. Kindly test your setup and close the issue.

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

No branches or pull requests

2 participants