From 6dc21485d6507f04821d8b62900b0869d68f8ef1 Mon Sep 17 00:00:00 2001 From: alsigna Date: Fri, 15 Nov 2024 10:25:04 +0300 Subject: [PATCH 1/3] add plus --- scrapli/driver/core/arista_eos/base_driver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scrapli/driver/core/arista_eos/base_driver.py b/scrapli/driver/core/arista_eos/base_driver.py index 891173c4..0392c8b2 100644 --- a/scrapli/driver/core/arista_eos/base_driver.py +++ b/scrapli/driver/core/arista_eos/base_driver.py @@ -32,7 +32,7 @@ ), "configuration": ( PrivilegeLevel( - pattern=r"^[\w.\-@()/: ]{1,63}\(config[\w.\-@/:]{0,63}\)#\s?$", + pattern=r"^[\w.\-@()/: ]{1,63}\(config[\w.\-@/:+]{0,63}\)#\s?$", name="configuration", previous_priv="privilege_exec", deescalate="end", @@ -81,7 +81,7 @@ def _create_configuration_session(self, session_name: str) -> None: raise ScrapliValueError(msg) sess_prompt = re.escape(session_name[:6]) pattern = ( - rf"^[a-z0-9.\-@()/: ]{{1,63}}\(config\-s\-{sess_prompt}[a-z0-9_.\-@/:]{{0,64}}\)#\s?$" + rf"^[a-z0-9.\-@()/: ]{{1,63}}\(config\-s\-{sess_prompt}[a-z0-9_.\-@/:+]{{0,64}}\)#\s?$" ) name = session_name config_session = PrivilegeLevel( From f83e43f32f85aaad336419d0d90cd937d3b26680 Mon Sep 17 00:00:00 2001 From: alsigna Date: Fri, 15 Nov 2024 11:41:43 +0300 Subject: [PATCH 2/3] add arista_eos_base_driver tests --- .../driver/core/arista_eos/test_arista_eos_base_driver.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/unit/driver/core/arista_eos/test_arista_eos_base_driver.py b/tests/unit/driver/core/arista_eos/test_arista_eos_base_driver.py index 7a45d90f..624ae5f5 100644 --- a/tests/unit/driver/core/arista_eos/test_arista_eos_base_driver.py +++ b/tests/unit/driver/core/arista_eos/test_arista_eos_base_driver.py @@ -20,6 +20,8 @@ ("configuration", "localhost(some thing)(config)#"), ("configuration", "localhost(some thing)(config-s-tacocat)#"), ("configuration", "eos_switch(config-s-scrapl-qos-profile-CORE-EGRESS-QUEUING-txq-5)#"), + ("configuration", "eos_switch(config-sg-tacacs+-my_group)#"), + ("configuration", "eos_switch(config-s-sc-sg-tacacs+-my_group)#"), ], ids=[ "exec", @@ -33,6 +35,8 @@ "config_with_space", "config_session", "config_session_very_long_qos_profile", + "config_terminal_tacacs_plus", + "config_session_tacacs_plus", ], ) def test_prompt_patterns(priv_pattern, sync_eos_driver): From f81301b508729992ac6c0f4df38e09171e93ea49 Mon Sep 17 00:00:00 2001 From: alsigna Date: Fri, 15 Nov 2024 12:08:11 +0300 Subject: [PATCH 3/3] add arista_eos_base_driver tests --- .../unit/driver/core/arista_eos/test_arista_eos_base_driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/driver/core/arista_eos/test_arista_eos_base_driver.py b/tests/unit/driver/core/arista_eos/test_arista_eos_base_driver.py index 624ae5f5..4367f69d 100644 --- a/tests/unit/driver/core/arista_eos/test_arista_eos_base_driver.py +++ b/tests/unit/driver/core/arista_eos/test_arista_eos_base_driver.py @@ -47,7 +47,7 @@ def test_prompt_patterns(priv_pattern, sync_eos_driver): assert match - if "config-s" in prompt: + if "config-s-" in prompt: # we will match by the pattern but the `not_contains` will mean that we should end up # with 0 matches with pytest.raises(ScrapliPrivilegeError):