diff options
| author | l0crian1 <ryan.claridge13@gmail.com> | 2025-09-10 12:22:50 -0400 |
|---|---|---|
| committer | l0crian1 <ryan.claridge13@gmail.com> | 2025-09-10 12:22:50 -0400 |
| commit | ad6b626e1b5fe5957934fa0e86ec730594557544 (patch) | |
| tree | 8c66c5bda122723aff4e0697cfdb023232aabf5b /src | |
| parent | 1124d3f9aa0531489bc8f622143afcb6116e8f47 (diff) | |
| download | vyos-1x-ad6b626e1b5fe5957934fa0e86ec730594557544.tar.gz vyos-1x-ad6b626e1b5fe5957934fa0e86ec730594557544.zip | |
BGP: T7516: Expand 'reset bgp all' elements with in/out/soft options
- Added 'in', 'out', and 'soft' options to all 'reset bgp all' elements
- Replaced calls to vtysh_wrapper.sh with new bgp.py reset function
- Replaced direct 'vtysh -c' calls with new bgp.py reset function
Diffstat (limited to 'src')
| -rwxr-xr-x | src/op_mode/bgp.py | 23 |
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 |
