tests: Use show module to get bgp's pid - #22023
Conversation
The topotest is using `pidof bgpd` which is ok when you run a test by itself, but when you are running the topotests in parallel, this is a bit of a problem. Fix. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Greptile SummaryThis PR replaces
Confidence Score: 4/5Safe to merge β the change correctly scopes PID lookups to the individual router namespace, and the regex parsing matches the actual show modules output format in FRR. The fix is logically sound and addresses a real parallel-test isolation problem. The only minor concern is using the abbreviated command show module instead of the full show modules string, which works today via FRR abbreviation matching but is slightly less explicit. No files require special attention beyond the minor command-name abbreviation in _daemon_pid. Important Files Changed
Sequence DiagramsequenceDiagram
participant Test as test_bgp_bmp_mirror
participant Helper as _daemon_pid()
participant Router as router (vtysh)
participant bgpd
Note over Test: Before fix - host-wide
Test->>Router: net.cmd("pidof bgpd")
Router-->>Test: any bgpd PID on host
Note over Test: After fix - router-scoped
Test->>Helper: _daemon_pid(router, "bgpd")
Helper->>Router: vtysh_cmd("show module")
Router->>bgpd: show modules
bgpd-->>Router: Module information for bgpd, pid: 1234
Router-->>Helper: output text
Helper-->>Test: 1234 (bgpd PID in this namespace)
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
tests/topotests/bgp_bmp/test_bgp_bmp_mirror.py:100
The vtysh command registered in `lib/lib_vty.c` and `vtysh/vtysh.c` is `"show modules"` (with a trailing `s`). FRR's CLI supports unambiguous abbreviations, so `"show module"` works today, but using the full command name avoids any future ambiguity if another `show module*` command is ever added.
```suggestion
output = router.vtysh_cmd("show modules")
```
Reviews (1): Last reviewed commit: "tests: Use `show module` to get bgp's pi..." | Re-trigger Greptile |
| Return the pid (as a string) of ``daemon`` running on ``router``, | ||
| or an empty string if it is not running. | ||
| """ | ||
| output = router.vtysh_cmd("show module") |
There was a problem hiding this comment.
The vtysh command registered in
lib/lib_vty.c and vtysh/vtysh.c is "show modules" (with a trailing s). FRR's CLI supports unambiguous abbreviations, so "show module" works today, but using the full command name avoids any future ambiguity if another show module* command is ever added.
| output = router.vtysh_cmd("show module") | |
| output = router.vtysh_cmd("show modules") |
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/topotests/bgp_bmp/test_bgp_bmp_mirror.py
Line: 100
Comment:
The vtysh command registered in `lib/lib_vty.c` and `vtysh/vtysh.c` is `"show modules"` (with a trailing `s`). FRR's CLI supports unambiguous abbreviations, so `"show module"` works today, but using the full command name avoids any future ambiguity if another `show module*` command is ever added.
```suggestion
output = router.vtysh_cmd("show modules")
```
How can I resolve this? If you propose a fix, please make it concise.
The topotest is using
pidof bgpdwhich is okwhen you run a test by itself, but when you
are running the topotests in parallel, this
is a bit of a problem. Fix.