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

device.py crashes for some NX-OS gear #127

Open
dcthor opened this issue Feb 10, 2023 · 0 comments
Open

device.py crashes for some NX-OS gear #127

dcthor opened this issue Feb 10, 2023 · 0 comments

Comments

@dcthor
Copy link
Contributor

dcthor commented Feb 10, 2023

device.py crashes for some NX-OS gear, for example Nexus 9k NX-OS 7.x

For some reason the ifindex within the ifStackStatus doesn't exist for this OS. I set up a try/except and it will prevent the code from crashing, but might not be the best choice. Before I PR I thought it best to discuss here first:

At row 250 -- Original code

                higherlayers = updated_device_data[
                    'system']['IF-MIB']['ifStackStatus'][ifindex]

Code suggestion

                try:
                    higherlayers = updated_device_data[
                        'system']['IF-MIB']['ifStackStatus'][ifindex]
                except:
                    log_message = (
                        'host {} missing ifindex {}'.format(self._devicename,ifindex))
                    log.log2debug(1029, log_message)
                    higherlayers = []

Note:
Note, I think it'd be best to remove the log_message from my test code before doing the PR... it does fill the logfile... here's a small subset:

2023-02-10 13:27:33,323 - switchmap_file - DEBUG - [dcthor] (1029S): host <host-removed> missing ifindex 526649728
2023-02-10 13:27:33,324 - switchmap_file - DEBUG - [dcthor] (1029S): host <host-removed> missing ifindex 526649792
2023-02-10 13:27:33,324 - switchmap_file - DEBUG - [dcthor] (1029S): host <host-removed> missing ifindex 526649856
2023-02-10 13:27:33,324 - switchmap_file - DEBUG - [dcthor] (1029S): host <host-removed> missing ifindex 526649920
2023-02-10 13:27:33,324 - switchmap_file - DEBUG - [dcthor] (1029S): host <host-removed> missing ifindex 526649984
2023-02-10 13:27:33,324 - switchmap_file - DEBUG - [dcthor] (1029S): host <host-removed> missing ifindex 526650048
2023-02-10 13:27:33,324 - switchmap_file - DEBUG - [dcthor] (1029S): host <host-removed> missing ifindex 526650112
2023-02-10 13:27:33,324 - switchmap_file - DEBUG - [dcthor] (1029S): host <host-removed> missing ifindex 526650176
2023-02-10 13:27:33,324 - switchmap_file - DEBUG - [dcthor] (1029S): host <host-removed> missing ifindex 526650240
2023-02-10 13:27:33,324 - switchmap_file - DEBUG - [dcthor] (1029S): host <host-removed> missing ifindex 526650304
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant