From bf288da64ae8183272858a5c981607482a4773cf Mon Sep 17 00:00:00 2001 From: Kalyan Pullela Date: Thu, 29 Jan 2026 00:56:52 +0000 Subject: [PATCH] feat: Add streaming notification stubs for standalone mode Add stub implementations for 9 streaming notification methods: - SwitchStateChangeNotification - SwitchShutdownRequestNotification - FdbEventNotification - PortStateChangeNotification - PacketEventNotification - QueuePfcDeadlockNotification - BfdSessionStateChangeNotification - TamEventNotification - IpsecSaStatusChangeNotification All return UNIMPLEMENTED as streaming is not supported in standalone mode. --- dataplane/standalone/saiserver/switch.cc | 72 ++++++++++++++++++++++++ dataplane/standalone/saiserver/switch.h | 45 +++++++++++++++ 2 files changed, 117 insertions(+) diff --git a/dataplane/standalone/saiserver/switch.cc b/dataplane/standalone/saiserver/switch.cc index 769af2e91..1f82998a6 100644 --- a/dataplane/standalone/saiserver/switch.cc +++ b/dataplane/standalone/saiserver/switch.cc @@ -117,3 +117,75 @@ grpc::Status Switch::GetSwitchTunnelAttribute( return grpc::Status::OK; } + +grpc::Status Switch::SwitchStateChangeNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::SwitchStateChangeNotificationRequest* req, + grpc::ServerWriter* writer) { + LOG(INFO) << "Func: " << __PRETTY_FUNCTION__; + return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "Streaming notifications not supported in standalone mode"); +} + +grpc::Status Switch::SwitchShutdownRequestNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::SwitchShutdownRequestNotificationRequest* req, + grpc::ServerWriter* writer) { + LOG(INFO) << "Func: " << __PRETTY_FUNCTION__; + return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "Streaming notifications not supported in standalone mode"); +} + +grpc::Status Switch::FdbEventNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::FdbEventNotificationRequest* req, + grpc::ServerWriter* writer) { + LOG(INFO) << "Func: " << __PRETTY_FUNCTION__; + return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "Streaming notifications not supported in standalone mode"); +} + +grpc::Status Switch::PortStateChangeNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::PortStateChangeNotificationRequest* req, + grpc::ServerWriter* writer) { + LOG(INFO) << "Func: " << __PRETTY_FUNCTION__; + return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "Streaming notifications not supported in standalone mode"); +} + +grpc::Status Switch::PacketEventNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::PacketEventNotificationRequest* req, + grpc::ServerWriter* writer) { + LOG(INFO) << "Func: " << __PRETTY_FUNCTION__; + return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "Streaming notifications not supported in standalone mode"); +} + +grpc::Status Switch::QueuePfcDeadlockNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::QueuePfcDeadlockNotificationRequest* req, + grpc::ServerWriter* writer) { + LOG(INFO) << "Func: " << __PRETTY_FUNCTION__; + return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "Streaming notifications not supported in standalone mode"); +} + +grpc::Status Switch::BfdSessionStateChangeNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::BfdSessionStateChangeNotificationRequest* req, + grpc::ServerWriter* writer) { + LOG(INFO) << "Func: " << __PRETTY_FUNCTION__; + return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "Streaming notifications not supported in standalone mode"); +} + +grpc::Status Switch::TamEventNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::TamEventNotificationRequest* req, + grpc::ServerWriter* writer) { + LOG(INFO) << "Func: " << __PRETTY_FUNCTION__; + return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "Streaming notifications not supported in standalone mode"); +} + +grpc::Status Switch::IpsecSaStatusChangeNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::IpsecSaStatusChangeNotificationRequest* req, + grpc::ServerWriter* writer) { + LOG(INFO) << "Func: " << __PRETTY_FUNCTION__; + return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "Streaming notifications not supported in standalone mode"); +} diff --git a/dataplane/standalone/saiserver/switch.h b/dataplane/standalone/saiserver/switch.h index da9850e6f..025955cd2 100644 --- a/dataplane/standalone/saiserver/switch.h +++ b/dataplane/standalone/saiserver/switch.h @@ -74,6 +74,51 @@ class Switch final : public lemming::dataplane::sai::Switch::Service { const lemming::dataplane::sai::GetSwitchTunnelAttributeRequest* req, lemming::dataplane::sai::GetSwitchTunnelAttributeResponse* resp); + grpc::Status SwitchStateChangeNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::SwitchStateChangeNotificationRequest* req, + grpc::ServerWriter* writer); + + grpc::Status SwitchShutdownRequestNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::SwitchShutdownRequestNotificationRequest* req, + grpc::ServerWriter* writer); + + grpc::Status FdbEventNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::FdbEventNotificationRequest* req, + grpc::ServerWriter* writer); + + grpc::Status PortStateChangeNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::PortStateChangeNotificationRequest* req, + grpc::ServerWriter* writer); + + grpc::Status PacketEventNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::PacketEventNotificationRequest* req, + grpc::ServerWriter* writer); + + grpc::Status QueuePfcDeadlockNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::QueuePfcDeadlockNotificationRequest* req, + grpc::ServerWriter* writer); + + grpc::Status BfdSessionStateChangeNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::BfdSessionStateChangeNotificationRequest* req, + grpc::ServerWriter* writer); + + grpc::Status TamEventNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::TamEventNotificationRequest* req, + grpc::ServerWriter* writer); + + grpc::Status IpsecSaStatusChangeNotification( + grpc::ServerContext* context, + const lemming::dataplane::sai::IpsecSaStatusChangeNotificationRequest* req, + grpc::ServerWriter* writer); + sai_switch_api_t* api; };