Closed yucai100 closed 1 year ago
Your code and your exception don't match?
File "D:\Program Files\Python38\Lib\site-packages\netmiko\huawei\huawei.py", line 44, in config_mode
return super().config_mode(
The exception message indicates you are using the Huawei driver--your code and your description state that you are using the hp_comware
driver?
But it does look broken in either case (i.e. the RBM mode is changing the prompt) which is then breaking the underlying driver (either hp_comware or huawei).
sorry, I paste wrong exception. I've tried huawei
driver, the exception is similar.
Traceback (most recent call last):
File "d:/code/nornir/src/test/netmiko_test.py", line 18, in <module>
output = ssh_client.send_config_set(cmds)
File "D:\Program Files\Python38\Lib\site-packages\netmiko\hp\hp_comware.py", line 61, in send_config_set
return super().send_config_set(
File "D:\Program Files\Python38\Lib\site-packages\netmiko\base_connection.py", line 2252, in send_config_set
output += self.config_mode()
File "D:\Program Files\Python38\Lib\site-packages\netmiko\hp\hp_comware.py", line 31, in config_mode
return super().config_mode(
File "D:\Program Files\Python38\Lib\site-packages\netmiko\cisco_base_connection.py", line 52, in config_mode
return super().config_mode(
File "D:\Program Files\Python38\Lib\site-packages\netmiko\base_connection.py", line 2088, in config_mode
output += self.read_until_prompt(read_entire_line=True)
File "D:\Program Files\Python38\Lib\site-packages\netmiko\base_connection.py", line 812, in read_until_prompt
return self.read_until_pattern(
File "D:\Program Files\Python38\Lib\site-packages\netmiko\base_connection.py", line 721, in read_until_pattern
raise ReadTimeout(msg)
netmiko.exceptions.ReadTimeout:
Pattern not detected: 'BM_P<JWR_JLB_FWA.*' 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.
But it does look broken in either case (i.e. the RBM mode is changing the prompt) which is then breaking the underlying driver (either hp_comware or huawei).
Yes, I suppose that the underlying driver get the pattern between the first letter and >
.
Maybe we can add one line of code hp_comware.py
set_base_prompt
method like the code in huawei.py
set_base_prompt
method.
https://github.com/ktbyers/netmiko/blob/679be2be58a975e874fd97616c7014f0726460c1/netmiko/huawei/huawei.py#L84
replace HRP with RBM
Is HRP Huawei only? Does the HP Comware driver need HRP
as well.
Do both the Huawei and Comware drivers need the RPM_
stripped out?
Sorry, I typed the wrong word before. It should be RBM
, not RPM
.
HRP should be Huawei only. HRP
is short for Huawei Redundancy Protocol
.
HP Comware uses RBM
instead. RBM
is a private protocol belong H3C.
I add the code in hp_comware.py
of my virtual environment. It worked well.
prompt = re.sub(r"^RBM_.", "", prompt, flags=re.M)
Sounds good. Do you want to submit a pull-request on that (or do you want me to do it)?
Sounds good. Do you want to submit a pull-request on that (or do you want me to do it)?
Yeah, I pulled the request.
Fixed in above PR.
I used nornir to set H3C devices with some configuration. The devices in RBM mode got exception, others were nornal.Then I wrote a test.py try to find out where the code got wrong.
netmiko version: 4.2.0
test.py code:
Then I got exception
session_log