Skip to content

Commit

Permalink
Merge pull request #360 from kido5217/main
Browse files Browse the repository at this point in the history
Fix regex for juniper_junos prompt detection on MX, PTX and SRX platforms.
  • Loading branch information
carlmontanari authored Nov 30, 2024
2 parents 400dbb0 + 031e5ac commit 60f041f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scrapli/driver/core/juniper_junos/base_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
PRIVS = {
"exec": (
PrivilegeLevel(
pattern=r"^({\w+:\d}\n){0,1}[\w\-@()/:\.]{1,63}>\s?$",
pattern=r"^({\w+(:(\w+){0,1}\d){0,1}}\n){0,1}[\w\-@()/:\.]{1,63}>\s?$",
name="exec",
previous_priv="",
deescalate="",
Expand All @@ -16,7 +16,7 @@
),
"configuration": (
PrivilegeLevel(
pattern=r"^({\w+:\d}\[edit\]\n){0,1}[\w\-@()/:\.]{1,63}#\s?$",
pattern=r"^({\w+(:(\w+){0,1}\d){0,1}}\[edit\]\n){0,1}[\w\-@()/:\.]{1,63}#\s?$",
name="configuration",
previous_priv="exec",
deescalate="exit configuration-mode",
Expand All @@ -27,7 +27,7 @@
),
"configuration_exclusive": (
PrivilegeLevel(
pattern=r"^({\w+:\d}\[edit\]\n){0,1}[\w\-@()/:\.]{1,63}#\s?$",
pattern=r"^({\w+(:(\w+){0,1}\d){0,1}}\[edit\]\n){0,1}[\w\-@()/:\.]{1,63}#\s?$",
name="configuration_exclusive",
previous_priv="exec",
deescalate="exit configuration-mode",
Expand All @@ -38,7 +38,7 @@
),
"configuration_private": (
PrivilegeLevel(
pattern=r"^({\w+:\d}\[edit\]\n){0,1}[\w\-@()/:\.]{1,63}#\s?$",
pattern=r"^({\w+(:(\w+){0,1}\d){0,1}}\[edit\]\n){0,1}[\w\-@()/:\.]{1,63}#\s?$",
name="configuration_private",
previous_priv="exec",
deescalate="exit configuration-mode",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
("configuration", "boxen# "),
("exec", "box_en> "),
("exec", "[email protected]> "),
("exec", "{master}\nusername@MX-960-PE1>"),
("exec", "{backup}\nusername@MX-480-PE2>"),
("exec", "{primary:node0}\nusername@SRX-4600-FW1>"),
("configuration", "[email protected]# "),
("configuration", "{master}[edit]\nusername@MX-960-PE1#"),
("configuration", "{backup}[edit]\nusername@MX-480-PE2#"),
("configuration", "{primary:node0}[edit]\nusername@SRX-4600-FW1#"),
("shell", "asdfklsdjlf\n%"),
("shell", "[vrf:foo] regress@EVOvFOOBAR_RE0-re0:~$"),
("root_shell", "root@%"),
Expand All @@ -24,7 +30,13 @@
"configuration",
"exec_underscore",
"exec_w_period",
"exec-mx-master-re",
"exec-mx-backup-re",
"exec-srx-primary-node",
"configuration_w_period",
"configuration-mx-master-re",
"configuration-mx-backup-re",
"configuration-srx-primary-node",
"shell",
"shell-re0",
"root",
Expand Down

0 comments on commit 60f041f

Please sign in to comment.