-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
There is a issue that send_config_set() of A10 driver is not available in netmiko 4.6.0.
Environment
- netmiko 4.6.0
- OS
- Windows 11
- Ubuntu 24.04.2 LTS
- Python 3.12.3
- A10 vThunder ACOS 7.0.1
Test Code
from netmiko import ConnectHandler
import logging
logging.basicConfig(filename="./netmiko_debug.log", level=logging.DEBUG)
logger = logging.getLogger("netmiko")
remote_device = {
"ip": "192.168.1.121",
"username": "admin",
"password": "admin",
"device_type": "a10_ssh",
"global_delay_factor": 3,
"session_log": "./test-code.log",
"fast_cli": False,
}
conn = ConnectHandler(**remote_device)
conn.enable()
showrun = conn.send_command("show running-config")
print(showrun)
input_config = conn.send_config_set(["interface ethernet 1", "enable"])
print(input_config)
showrun = conn.send_command("show running-config")
print(showrun)
conn.disconnect()
Error Output
Traceback (most recent call last):
File "d:xxxx\netmiko_a10\netmiko-test.py", line 23, in <module>
input_config = conn.send_config_set(["interface ethernet 1", "enable"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:xxxx\netmiko_a10\.venv\Lib\site-packages\netmiko\base_connection.py", line 111, in wrapper_decorator
return_val = func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:xxxx\netmiko_a10\.venv\Lib\site-packages\netmiko\base_connection.py", line 2305, in send_config_set
output += self.config_mode()
^^^^^^^^^^^^^^^^^^
File "D:xxxx\netmiko_a10\.venv\Lib\site-packages\netmiko\cisco_base_connection.py", line 53, in config_mode
return super().config_mode(
^^^^^^^^^^^^^^^^^^^^
File "D:xxxx\netmiko_a10\.venv\Lib\site-packages\netmiko\base_connection.py", line 2130, in config_mode
if not self.check_config_mode():
^^^^^^^^^^^^^^^^^^^^^^^^
File "D:xxxx\netmiko_a10\.venv\Lib\site-packages\netmiko\a10\a10_ssh.py", line 29, in check_config_mode
output = self.read_until_pattern(pattern=pattern)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:xxxx\netmiko_a10\.venv\Lib\site-packages\netmiko\base_connection.py", line 705, in read_until_pattern
if re.search(pattern, output, flags=re_flags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\python311\Lib\re\__init__.py", line 176, in search
return _compile(pattern, flags).search(string)
^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\python311\Lib\re\__init__.py", line 294, in _compile
p = _compiler.compile(pattern, flags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\python311\Lib\re\_compiler.py", line 745, in compile
p = _parser.parse(p, flags)
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\python311\Lib\re\_parser.py", line 994, in parse
raise source.error("unbalanced parenthesis")
re.error: unbalanced parenthesis at position 0
Issue Description
In base_connection.py
, line 2130, the config_mode()
method calls check_config_mode()
from a10_ssh.py
:
if not self.check_config_mode():
check_config_mode() is called with pattern: str = ")#" and read_until_pattern() is called with else,
but the output contains prompts before entering config mode, so it is unmatched and an error occurs.
if not pattern:
output = self.read_channel_timing(read_timeout=10.0)
else:
output = self.read_until_pattern(pattern=pattern)
Next Steps
I plan to create a pull request to fix this issue.
Additionally, I intend to implement support for the save_config()
method as well.
Metadata
Metadata
Assignees
Labels
No labels