unicon.plugins icon indicating copy to clipboard operation
unicon.plugins copied to clipboard

unicon HVRP self.config_prompt wrong regex

Open jibo78 opened this issue 2 years ago • 3 comments

There is a regex mistake for hvrp's unicon patterns.py file

Path: myvenv/lib/python3.8/site-packages/unicon/plugins/hvrp/patterns.py $ character is missing at the end of the regex self.config_prompt

        self.config_prompt = r'^\[.*\]'

We have an error when we try to configure a Huawei N8000 device with pyATS

In [3]: device.configure(['interface GigabitEthernet0/7/2','shutdown'])

2022-09-29 14:46:16,117: %UNICON-INFO: +++  with via 'cli': config +++
system-view
Enter system view, return user view with return command.
[~N1-NE8000-PEAG-1]
---------------------------------------------------------------------------
TimeoutError                              Traceback (most recent call last)

TimeoutError: timeout occurred:
              timeout value: 30
              last_command: 'system-view\r'
             pattern: ['^\\[.*\\]']
             buffer:'system-view\r\nEnter system view, return user view with return command.\r\n[~N1-NE8000-PEAG-1]'

If we add $, it works

        self.config_prompt = r'^\[.*\]$'
In [6]: device.configure(['interface GigabitEthernet0/7/2','shutdown'])

2022-09-29 14:29:03,854: %UNICON-INFO: +++  with via 'cli': config +++
system-view
Enter system view, return user view with return command.
[~N1-NE8000-PEAG-1]interface GigabitEthernet0/7/2
[~N1-NE8000-PEAG-1-GigabitEthernet0/7/2]shutdown
[*N1-NE8000-PEAG-1-GigabitEthernet0/7/2]commit
[~N1-NE8000-PEAG-1-GigabitEthernet0/7/2]return
<N1-NE8000-PEAG-1>

jibo78 avatar Sep 30 '22 07:09 jibo78

Please create a pull request.

Taarini avatar Oct 02 '22 17:10 Taarini

Hi Taarini,

I did a PR. Tell me if anything is missing.

jibo78 avatar Oct 03 '22 08:10 jibo78

I get you why you have created a new issue under the respective repo.

But please don't forget to link the issue in PR description

Taarini avatar Oct 03 '22 13:10 Taarini