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

Improvement Huawei SmartAX #3559

Open
evilmonkey19 opened this issue Jan 21, 2025 · 4 comments
Open

Improvement Huawei SmartAX #3559

evilmonkey19 opened this issue Jan 21, 2025 · 4 comments

Comments

@evilmonkey19
Copy link
Contributor

evilmonkey19 commented Jan 21, 2025

Hi,

I had an issue while working on a Huawei SmartAX device. These devices they have alarms similar to the following ones:

OLT(config-if-gpon-0/0)#display ont port state 0 0 eth  # This command is not sent
  ! 1 [01/01/2000 00:00:00-00:00]:

  ALARM 11111 FAULT WARNING 0x2e112007 SERVICE QUALITY 17/01/2025 
00:00:00-00:00
  ALARM NAME  : The distribute fiber is broken or the OLT cannot receive 
                expected optical signals from the ONT(LOSi/LOBi)
  SRVEFF      : SA
  PARAMETERS  : FrameID: 0, SlotID: 0, PortID: 1, ONT ID: 1, Equipment ID: 
                1H
  DESCRIPTION : The OLT cannot receive expected optical signals from the ONT 
                in four consecutive frames
  CAUSE       : (1) The fiber is broken
                (2) The quality of the optical path is poor
                (3) The ONT hardware fails
  ADVICE      : (1) Check tributary optical fiber connection and backbone 
                optical fiber orderly, clean the fiber connector and replace 
                the fiber if necessary
                (2) Ensure that the optical attenuation of the optical path is                  normal
                (3) Reset the ONT or replace the ONT
  --- END-
****
OLT(config-if-gpon-0/0)#display ont port state 0 0 ethport all  # it should be display ont port state 0 0 eth-port all

This output breaks the flow of netmiko. This is an error example:

2000-01-01 00:00:00,000 - nornir.core.task -    ERROR -      start() - Host 'olt': task 'get_ont_port_usage' failed with traceback:
Traceback (most recent call last):
  File "/root/.pyenv/versions/scripts-3.12/lib/python3.12/site-packages/nornir/core/task.py", line 99, in start
    r = self.task(self, **self.params)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/nornir_tasks/nornir_tasks/platforms/huawei_smartax/get_info.py", line 178, in get_ont_port_usage
    res = conn.send_command(
          ^^^^^^^^^^^^^^^^^^
  File "/root/netmiko/netmiko/base_connection.py", line 111, in wrapper_decorator
    return_val = func(self, *args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/netmiko/netmiko/utilities.py", line 666, in wrapper_decorator
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/netmiko/netmiko/base_connection.py", line 1786, in send_command
    new_data = self.command_echo_read(cmd=cmd, read_timeout=10)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/netmiko/netmiko/base_connection.py", line 1489, in command_echo_read
    new_data = self.read_until_pattern(
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/netmiko/netmiko/base_connection.py", line 751, in read_until_pattern
    raise ReadTimeout(msg)
netmiko.exceptions.ReadTimeout: 

Pattern not detected: 'display\\ ont\\ port\\ state\\ 0\\ 24\\ eth\\-port\\ all' in output.

Things you might try to fix this:
1. Adjust the regex pattern to better identify the terminating string. Note, in
many situations the pattern is automatically based on the network device's prompt.
2. Increase the read_timeout to a larger value.

You can also look at the Netmiko session_log or debug log for more information.

I have seen a possible solution, but implies scalating permissions from initial to enable. There is a command called infoswitch cli OFF which disables the alarms on the session. After I send this command I can return to the initial state just in case to leave as the original state.

Is there any drawback to this solution? Can I develop it?

@ktbyers
Copy link
Owner

ktbyers commented Jan 21, 2025

So you sent the command:

display ont port state 0 0 eth-port all

And it gets echoed by the device as:

display ont port state 0 0 ethport all

Is that correct?

@evilmonkey19
Copy link
Contributor Author

Kind of yes! If this message doesn't appear I send the command "display ont port state 0 0 eth-port all" as expected.

When using netmiko usually i expect not to have to deal with such async messages, which can break the flow as in this case.

@ktbyers
Copy link
Owner

ktbyers commented Jan 22, 2025

So you are getting an alarm message to your SSH terminal? I would just turn that off (i.e. your SSH terminal should not get any alarms or logging messages sent to it. Typically is this is configurable on the device or for the device's terminal settings.

Can you turn off / disable these messages so they don't get sent to your automation SSH session?

@evilmonkey19
Copy link
Contributor Author

Yeees! I can turn out the alarms while on the session using the command infoswitch cli OFF. It works only in the enable mode, not before the enable.

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