Add GoVPP integration and GetVPPInfo gRPC call
VPP client (internal/vpp/) - New package managing connections to both VPP API and stats sockets, treated as a unit: if either drops, both are torn down and re-established together. - Run() loop: connect, fetch version via vpe.ShowVersion, read /sys/boottime from the stats segment, log vpp-connect, then monitor with control_ping every 10s. On failure, disconnect both, retry after 5s. - Registers as client name "vpp-maglev" (visible in VPP's "show api clients"). - Flags: --vpp-api-addr (default /run/vpp/api.sock) and --vpp-stats-addr (default /run/vpp/stats.sock). Empty api addr disables VPP integration entirely. gRPC / proto - Add GetVPPInfo RPC returning VPPInfo: version, build_date, build_directory, pid, boottime_ns, connecttime_ns. Both times are unix timestamps in nanoseconds — the client computes durations locally for display. - Returns codes.Unavailable if VPP is disabled or not connected. maglevc - Add 'show vpp info' command displaying version, build-date, build-dir, vpp-pid, vpp-boottime (with duration), and connected time (with duration).
This commit is contained in:
@@ -28,6 +28,7 @@ func TestExpandPathsRoot(t *testing.T) {
|
||||
"watch events",
|
||||
"watch events <opt>",
|
||||
"config check",
|
||||
"show vpp info",
|
||||
"config reload",
|
||||
"quit",
|
||||
"exit",
|
||||
@@ -59,9 +60,9 @@ func TestExpandPathsShow(t *testing.T) {
|
||||
}
|
||||
}
|
||||
// version, frontends, frontends <name>, backends, backends <name>,
|
||||
// healthchecks, healthchecks <name> = 7 lines
|
||||
if len(lines) != 7 {
|
||||
t.Errorf("expected exactly 7 show subcommands, got %d", len(lines))
|
||||
// healthchecks, healthchecks <name>, vpp info = 8 lines
|
||||
if len(lines) != 8 {
|
||||
t.Errorf("expected exactly 8 show subcommands, got %d", len(lines))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user