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:
@@ -20,6 +20,7 @@ service Maglev {
|
||||
rpc WatchEvents(WatchRequest) returns (stream Event);
|
||||
rpc CheckConfig(CheckConfigRequest) returns (CheckConfigResponse);
|
||||
rpc ReloadConfig(ReloadConfigRequest) returns (ReloadConfigResponse);
|
||||
rpc GetVPPInfo(GetVPPInfoRequest) returns (VPPInfo);
|
||||
}
|
||||
|
||||
// ---- requests ---------------------------------------------------------------
|
||||
@@ -63,6 +64,17 @@ message ReloadConfigResponse {
|
||||
string reload_error = 4; // set when config is valid but the reload itself failed
|
||||
}
|
||||
|
||||
message GetVPPInfoRequest {}
|
||||
|
||||
message VPPInfo {
|
||||
string version = 1;
|
||||
string build_date = 2;
|
||||
string build_directory = 3;
|
||||
uint32 pid = 4;
|
||||
int64 boottime_ns = 5; // unix timestamp (ns) when VPP started (from /sys/boottime)
|
||||
int64 connecttime_ns = 6; // unix timestamp (ns) when maglevd connected to VPP
|
||||
}
|
||||
|
||||
message SetWeightRequest {
|
||||
string frontend = 1;
|
||||
string pool = 2;
|
||||
|
||||
Reference in New Issue
Block a user