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

Switchname not detected in ouput #3

Open
hmaier-dev opened this issue Aug 15, 2023 · 2 comments
Open

Switchname not detected in ouput #3

hmaier-dev opened this issue Aug 15, 2023 · 2 comments

Comments

@hmaier-dev
Copy link

I'm using get_mac_address_table() on several comware-switches running version 7.1.070. Since two days, I'm not able to pull the mac-addresses from a single switch called SW01_A-Sued due to the netmiko error Pattern not detected: '\\[SW01_A\\-Sued\\]' in output..

The error suggest to explicitly set the pattern, which I have no influence over, or increase the read_timeout which has no effect on error.

My code is the following:

driver = get_network_driver("h3c_comware")
driver = driver(ip, USERNAME, PASSWORD, timeout=10)
driver.open()
mac = []
try:
    mac = driver.get_mac_address_table()
except Exception as e:
    print(f"Problems access switch: {e}")
print(mac)    

Because all switches are on the same firmware version I am a little clueless. I also already tried querying the command manually, but this either didn't work.

Is there anything I can adjust about my approach?

@Wythetells
Copy link

Sorry for the late reply, but it may help others with the same problem.
The reason for this problem is that napalm is waiting for "[SW01_A-Sued]" to be echoed, but it does not wait after 10 seconds.
Therefore, the recommended approach is

  1. Check the echo settings to see if the device echoes "[SW01_A-Sued]" after executing the command.
  2. Increase the timeout period

You can also log in to the switch manually, and after executing display mac-address, observe whether the echo contains "[SW01_A-Sued]" and how long it takes for the command to be executed until "[SW01_A-Sued]" is displayed. If the time is greater than 10s, change the timeout to include the execution time of the device.

Note, remember to execute first "screen-length disable" command to turn off split screen display

@hmaier-dev
Copy link
Author

hmaier-dev commented Jul 17, 2024

Thanks for the reply! I cannot test your suggestion, but I remember that I ditched the approach via python and wrote some Go to pull the MAC-addresses:
https://github.com/hmaier-dev/topo-tool/blob/main/data/scraper.go#L177

You can close this issue :)

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

2 participants