summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2025-09-12 10:25:20 +0300
committerGitHub <noreply@github.com>2025-09-12 10:25:20 +0300
commit6a47b699577904eb3e5866c27ab2813058cc9ed9 (patch)
tree16fe9362c7dd2ef8062ee22e2cd7b0b5da93014c /src
parent7d75763655b641c291d58ecc27be8173d0260411 (diff)
parentad6b626e1b5fe5957934fa0e86ec730594557544 (diff)
downloadvyos-1x-6a47b699577904eb3e5866c27ab2813058cc9ed9.tar.gz
vyos-1x-6a47b699577904eb3e5866c27ab2813058cc9ed9.zip
Merge pull request #4709 from l0crian1/reset-bgp-all-in-out-soft
op-mode: T7516: expand 'reset bgp all' elements with in/out/soft options
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/bgp.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/op_mode/bgp.py b/src/op_mode/bgp.py
index 011f39c1b..7f0815433 100755
--- a/src/op_mode/bgp.py
+++ b/src/op_mode/bgp.py
@@ -80,6 +80,29 @@ show bgp
ArgFamily = typing.Literal['inet', 'inet6', 'l2vpn']
ArgFamilyModifier = typing.Literal['unicast', 'labeled_unicast', 'multicast', 'vpn', 'flowspec']
+def reset(command: str):
+ from vyos.utils.process import cmd
+
+ tokens = command.split()
+
+ # reset -> clear (only if it's the first token)
+ if tokens and tokens[0] == "reset":
+ tokens[0] = "clear"
+
+ # peer-group and vrf may have 'all' in their names; don't replace 'all' with '*'
+ skip_indexes = []
+ for index, word in enumerate(tokens[:-1]):
+ if word in ("peer-group", "vrf"):
+ skip_indexes.append(index + 1)
+
+ # replace standalone "all" with "*" unless it's in the skip list
+ for index, word in enumerate(tokens):
+ if word == "all" and index not in skip_indexes:
+ tokens[index] = "*"
+
+ command = " ".join(tokens)
+ cmd(f'vtysh -c "{command}"')
+
def show_summary(raw: bool):
from vyos.utils.process import cmd