Skip to content

Commit

Permalink
daemon-grpc: update Capabilities RPC to return supported features p…
Browse files Browse the repository at this point in the history
…er module

It's important to know which features are enabled or disabled, as
this determines which parts of the YANG module are implemented.

gNMI's `Capabilities` RPC doesn't provide this information, since
OpenConfig modules typically don't use "feature" and "if-feature"
statements, unlike IETF models.

Signed-off-by: Renato Westphal <[email protected]>
  • Loading branch information
rwestphal committed Oct 14, 2024
1 parent 6465cbd commit 277809b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion holo-daemon/src/northbound/client/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::time::SystemTime;

use futures::Stream;
use holo_utils::Sender;
use holo_yang::YANG_CTX;
use holo_yang::{YANG_CTX, YANG_FEATURES};
use tokio::sync::oneshot;
use tonic::transport::{Server, ServerTlsConfig};
use tonic::{Request, Response, Status};
Expand Down Expand Up @@ -63,6 +63,15 @@ impl proto::Northbound for NorthboundService {
.unwrap_or_default()
.to_owned(),
revision: module.revision().unwrap_or_default().to_owned(),
supported_features: YANG_FEATURES
.get(&module.name())
.map(|features| {
features
.iter()
.map(|feature| (*feature).to_owned())
.collect()
})
.unwrap_or_default(),
})
.collect();

Expand Down
3 changes: 3 additions & 0 deletions proto/holo.proto
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ message ModuleData {

// Latest revision of the module;
string revision = 3;

// Supported features.
repeated string supported_features = 4;
}

// Supported encodings for YANG instance data.
Expand Down

0 comments on commit 277809b

Please sign in to comment.