3#include <grpcpp/grpcpp.h>
6#include <condition_variable>
14#include "cnc.grpc.pb.h"
89 grpc::Status
GetNetworkState(grpc::ServerContext* context,
const cnc::rpc::EmptyRequest* request,
90 cnc::rpc::Topology* response)
override;
99 grpc::Status
GetAllPtpData(grpc::ServerContext* context,
const cnc::rpc::EmptyRequest* request,
100 cnc::rpc::AllPtpDataResponse* response)
override;
110 grpc::Status
GetAllLldpData(grpc::ServerContext* context,
const cnc::rpc::EmptyRequest* request,
111 cnc::rpc::AllLldpDataResponse* response)
override;
122 grpc::Status
GetNodePtpData(grpc::ServerContext* context,
const cnc::rpc::NodeRequest* request,
123 cnc::rpc::PtpNode* response)
override;
135 grpc::Status
GetNodeLldpData(grpc::ServerContext* context,
const cnc::rpc::NodeRequest* request,
136 cnc::rpc::LldpNode* response)
override;
148 grpc::Status
GetInterfacePtpData(grpc::ServerContext* context,
const cnc::rpc::InterfaceRequest* request,
149 cnc::rpc::PtpPort* response)
override;
161 grpc::Status
GetInterfaceLldpData(grpc::ServerContext* context,
const cnc::rpc::InterfaceRequest* request,
162 cnc::rpc::LldpPort* response)
override;
174 grpc::Status
GetInterfaceGcl(grpc::ServerContext* context,
const cnc::rpc::InterfaceRequest* request,
175 cnc::rpc::GclConfig* response)
override;
187 grpc::Status
GetInterfaceAdminGcl(grpc::ServerContext* context,
const cnc::rpc::InterfaceRequest* request,
188 cnc::rpc::AdminGclResponse* response)
override;
200 grpc::Status
GetInterfaceOperGcl(grpc::ServerContext* context,
const cnc::rpc::InterfaceRequest* request,
201 cnc::rpc::OperGclResponse* response)
override;
213 grpc::Status
SetNodeSchedule(grpc::ServerContext* context,
const cnc::rpc::SetNodeScheduleRequest* request,
214 cnc::rpc::SetNodeScheduleResponse* response);
227 const cnc::rpc::SetInterfaceScheduleRequest* request,
228 cnc::rpc::IetfInterface* response);
239 grpc::Status
GetTopologyGraph(grpc::ServerContext* context,
const cnc::rpc::EmptyRequest* request,
240 cnc::rpc::TopologyGraph* response);
Definition CncServiceImpl.h:16
grpc::Status GetInterfaceLldpData(grpc::ServerContext *context, const cnc::rpc::InterfaceRequest *request, cnc::rpc::LldpPort *response) override
gRPC method implementation to retrieve interface-specific LLDP data for a given interface identified ...
Definition CncServiceImpl.cpp:345
void MapLldpPort(const LldpPort_t &internalPort, cnc::rpc::LldpPort *protoPort)
Maps an internal LldpPort_t structure to a cnc::rpc::LldpPort protobuf message.
Definition CncServiceImpl.cpp:90
grpc::Status GetTopologyGraph(grpc::ServerContext *context, const cnc::rpc::EmptyRequest *request, cnc::rpc::TopologyGraph *response)
gRPC method implementation to retrieve the topology graph of the network, which includes the nodes an...
Definition CncServiceImpl.cpp:663
grpc::Status GetAllPtpData(grpc::ServerContext *context, const cnc::rpc::EmptyRequest *request, cnc::rpc::AllPtpDataResponse *response) override
gRPC method implementation to retrieve all PTP data across all nodes and interfaces in the network.
Definition CncServiceImpl.cpp:274
std::thread ptpTimerThread
Definition CncServiceImpl.h:23
grpc::Status GetInterfaceAdminGcl(grpc::ServerContext *context, const cnc::rpc::InterfaceRequest *request, cnc::rpc::AdminGclResponse *response) override
gRPC method implementation to retrieve administrative GCL (Gate Control List) data for a specific int...
Definition CncServiceImpl.cpp:405
grpc::Status GetInterfaceOperGcl(grpc::ServerContext *context, const cnc::rpc::InterfaceRequest *request, cnc::rpc::OperGclResponse *response) override
gRPC method implementation to retrieve operational GCL (Gate Control List) data for a specific interf...
Definition CncServiceImpl.cpp:443
std::atomic< bool > stopTimer
Definition CncServiceImpl.h:24
std::condition_variable timerCV
Definition CncServiceImpl.h:25
grpc::Status GetInterfacePtpData(grpc::ServerContext *context, const cnc::rpc::InterfaceRequest *request, cnc::rpc::PtpPort *response) override
gRPC method implementation to retrieve interface-specific PTP data for a given interface identified b...
Definition CncServiceImpl.cpp:328
void MapPtpNode(const PtpNode_t &internalPtp, cnc::rpc::PtpNode *protoPtp)
Maps an internal PtpNode_t structure to a cnc::rpc::PtpNode protobuf message.
Definition CncServiceImpl.cpp:207
CncNode_t * FindNode(const std::string &hostName)
Definition CncServiceImpl.cpp:76
grpc::Status SetInterfaceSchedule(grpc::ServerContext *context, const cnc::rpc::SetInterfaceScheduleRequest *request, cnc::rpc::IetfInterface *response)
gRPC method implementation to set the schedule for a specific interface identified by node hostname a...
Definition CncServiceImpl.cpp:593
~CncServiceImpl()
Definition CncServiceImpl.cpp:44
void ptpBackgroundTask()
Background task that periodically fetches PTP data for all nodes. This function runs in a separate th...
Definition CncServiceImpl.cpp:57
grpc::Status GetAllLldpData(grpc::ServerContext *context, const cnc::rpc::EmptyRequest *request, cnc::rpc::AllLldpDataResponse *response) override
gRPC method implementation to retrieve all LLDP data across all nodes and interfaces in the network.
Definition CncServiceImpl.cpp:288
grpc::Status GetNodeLldpData(grpc::ServerContext *context, const cnc::rpc::NodeRequest *request, cnc::rpc::LldpNode *response) override
gRPC method implementation to retrieve node-specific LLDP data for a given node identified by its hos...
Definition CncServiceImpl.cpp:315
grpc::Status GetNodePtpData(grpc::ServerContext *context, const cnc::rpc::NodeRequest *request, cnc::rpc::PtpNode *response) override
gRPC method implementation to retrieve node-specific PTP data for a given node identified by its host...
Definition CncServiceImpl.cpp:303
std::shared_mutex topologyMutex
Definition CncServiceImpl.h:22
std::unique_ptr< cnc::NetworkManager > networkManager
Definition CncServiceImpl.h:19
std::mutex timerMutex
Definition CncServiceImpl.h:26
void MapInterface(const ietfInterface_t &internalIface, cnc::rpc::IetfInterface *protoIface)
Maps an internal CncNode_t structure to a cnc::rpc::Node protobuf message.
Definition CncServiceImpl.cpp:104
void MapLldpNode(const LldpNode_t &internalLldp, cnc::rpc::LldpNode *protoLldp)
Maps an internal LldpNode_t structure to a cnc::rpc::LldpNode protobuf message.
Definition CncServiceImpl.cpp:230
grpc::Status SetNodeSchedule(grpc::ServerContext *context, const cnc::rpc::SetNodeScheduleRequest *request, cnc::rpc::SetNodeScheduleResponse *response)
gRPC method implementation to set schedules for all interfaces on a specific node identified by its h...
Definition CncServiceImpl.cpp:480
grpc::Status GetInterfaceGcl(grpc::ServerContext *context, const cnc::rpc::InterfaceRequest *request, cnc::rpc::GclConfig *response) override
gRPC method implementation to retrieve GCL (Gate Control List) data for a specific interface identifi...
Definition CncServiceImpl.cpp:364
grpc::Status GetNetworkState(grpc::ServerContext *context, const cnc::rpc::EmptyRequest *request, cnc::rpc::Topology *response) override
gRPC method implementation to retrieve the entire network topology, including nodes,...
Definition CncServiceImpl.cpp:245
Topology topology
Definition CncServiceImpl.h:18
void MapPtpPort(const PtpPort_t &internalPort, cnc::rpc::PtpPort *protoPort)
Maps an internal PtpPort_t structure to a cnc::rpc::PtpPort protobuf message.
Definition CncServiceImpl.cpp:82
Stores and provides lookup access to the controller's in-memory network topology.
Definition Topology.h:18
This struct is used on the CNC side to represent one host with all its interfaces as well as its PTP ...
Definition CncTypes.h:512
Represents all LLDP information of a host. Includes the local configuration and system-data and a lis...
Definition CncTypes.h:500
Struct that represents one "LLDP-port", aka one interface participating in LLDP. Contains a list of L...
Definition CncTypes.h:489
Struct that represents all the PTP information on one host we use, corresponds to one /ptp/instances/...
Definition CncTypes.h:464
Struct that represents the fields we use from the port element of the ieee1588-ptp-tt YANG model.
Definition CncTypes.h:452
Struct to hold information about an interface, inspired by the ietf-interfaces yang model.
Definition CncTypes.h:256