Skip to content

Commit

Permalink
Introduuce new ZInfoNTPSource message in proto/info/ntpsource.proto
Browse files Browse the repository at this point in the history
This will be published from EVE.

Signed-off-by: Roman Penyaev <[email protected]>
  • Loading branch information
rouming committed Jun 6, 2024
1 parent 77df971 commit c1be81b
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
3 changes: 3 additions & 0 deletions proto/info/info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import "google/protobuf/timestamp.proto";
import "evecommon/devmodelcommon.proto";
import "evecommon/evecommon.proto";
import "info/patch_envelope.proto";
import "info/ntpsources.proto";

// Deprecated: see deprecatedMetricItem below
enum DepMetricItemType {
Expand Down Expand Up @@ -67,6 +68,7 @@ enum ZInfoTypes {
ZiEdgeview = 12;
ZiLocation = 13;
ZiPatchEnvelope = 14;
ZiNTPSources = 16;
}

// Information about assignable I/O adapter bundles
Expand Down Expand Up @@ -1181,6 +1183,7 @@ message ZInfoMsg {
ZInfoPatchEnvelope patchInfo = 20;
// 21 reserved
ZInfoClusterNode cluster_node = 22;
ZInfoNTPSources ntp_sources = 23;
}
google.protobuf.Timestamp atTimeStamp = 6;
}
Expand Down
66 changes: 66 additions & 0 deletions proto/info/ntpsources.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright(c) 2024 Zededa, Inc.
// SPDX-License-Identifier: Apache-2.0

syntax = "proto3";

import "google/protobuf/timestamp.proto";

package org.lfedge.eve.info;
option go_package = "github.com/lf-edge/eve-api/go/info";

option java_package = "org.lfedge.eve.info";

// Enum for describing the NTP peer state
enum NTPPeerState {
NTP_PEER_STATE_SYNC = 0;
NTP_PEER_STATE_UNREACH = 1;
NTP_PEER_STATE_FALSETICKER = 2;
NTP_PEER_STATE_JITTERY = 3;
NTP_PEER_STATE_CANDIDATE = 4;
NTP_PEER_STATE_OUTLIER = 5;
}

// Flags from RFC 5905 + defined by chrony
enum NTPPeerBitmap {
NTP_PEER_BITMAP_UNSPECIFIED = 0x0000;
NTP_PEER_BITMAP_PKT_DUP = 0x0001;
NTP_PEER_BITMAP_PKT_BOGUS = 0x0002;
NTP_PEER_BITMAP_PKT_INVALID = 0x0004;
NTP_PEER_BITMAP_PKT_AUTH = 0x0008;
NTP_PEER_BITMAP_PKT_STRATUM = 0x0010;
NTP_PEER_BITMAP_PKT_HEADER = 0x0020;
NTP_PEER_BITMAP_TST_MAX_DELAY = 0x0040;
NTP_PEER_BITMAP_TST_DELAY_RATIO = 0x0080;
NTP_PEER_BITMAP_TST_DELAY_DEV_RATION = 0x0100;
NTP_PEER_BITMAP_TST_SYNC_LOOP = 0x0200;
}

// As described in http://doc.ntp.org/current-stable/ntpq.html
message NTPPeer {
bool authenticated = 1;
bool reachable = 2; // (reachability == 0xff), i.e. 8 attempts
uint32 reachability = 3;
NTPPeerState state = 4;
string hostname = 5;
string src_addr = 6;
uint32 src_port = 7;
string dst_addr = 8;
uint32 dst_port = 9;
uint32 leap = 10;
uint32 stratum = 11;
uint32 precision = 12;
string ref_id = 13;
google.protobuf.Timestamp ref_time = 14;
sint32 poll = 15;
uint32 flags = 16; // bitmap from NTPPeerBitmap
double offset = 17;
double delay = 18;
double dispersion = 19;
double jitter = 20;
double root_delay = 21;
double root_disp = 22;
}

message ZInfoNTPSources {
repeated NTPPeer peers = 1;
}

0 comments on commit c1be81b

Please sign in to comment.