|
Software TSN Switch
A software switch to connect VMs and Containers to a TSN network
|
#include <CncServiceImpl.h>


Public Member Functions | |
| CncServiceImpl (const std::string &inventoryFilePath) | |
| ~CncServiceImpl () | |
| 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, interfaces, and their associated LLDP/PTP data. | |
| 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. | |
| 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. | |
| 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 hostname. | |
| 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 hostname. | |
| 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 by node hostname and interface name. | |
| 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 by node hostname and interface name. | |
| 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 identified by node hostname and interface name. | |
| 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 interface identified by node hostname and interface name. | |
| 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 interface identified by node hostname and interface name. | |
| 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 hostname. | |
| 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 and interface name. | |
| 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 and their interconnections based on LLDP data. | |
Private Member Functions | |
| CncNode_t * | FindNode (const std::string &hostName) |
| void | MapInterface (const ietfInterface_t &internalIface, cnc::rpc::IetfInterface *protoIface) |
| Maps an internal CncNode_t structure to a cnc::rpc::Node protobuf message. | |
| void | MapPtpNode (const PtpNode_t &internalPtp, cnc::rpc::PtpNode *protoPtp) |
| Maps an internal PtpNode_t structure to a cnc::rpc::PtpNode protobuf message. | |
| void | MapLldpNode (const LldpNode_t &internalLldp, cnc::rpc::LldpNode *protoLldp) |
| Maps an internal LldpNode_t structure to a cnc::rpc::LldpNode protobuf message. | |
| void | MapPtpPort (const PtpPort_t &internalPort, cnc::rpc::PtpPort *protoPort) |
| Maps an internal PtpPort_t structure to a cnc::rpc::PtpPort protobuf message. | |
| void | MapLldpPort (const LldpPort_t &internalPort, cnc::rpc::LldpPort *protoPort) |
| Maps an internal LldpPort_t structure to a cnc::rpc::LldpPort protobuf message. | |
| void | ptpBackgroundTask () |
| Background task that periodically fetches PTP data for all nodes. This function runs in a separate thread and updates the topology with the latest PTP data at regular intervals (every 15 minutes). It uses a condition variable to wait for the next fetch interval or to be notified when the service is shutting down. | |
Private Attributes | |
| Topology | topology |
| std::unique_ptr< cnc::NetworkManager > | networkManager |
| std::shared_mutex | topologyMutex |
| std::thread | ptpTimerThread |
| std::atomic< bool > | stopTimer {false} |
| std::condition_variable | timerCV |
| std::mutex | timerMutex |
| CncServiceImpl::CncServiceImpl | ( | const std::string & | inventoryFilePath | ) |
| CncServiceImpl::~CncServiceImpl | ( | ) |
|
private |
|
override |
gRPC method implementation to retrieve all LLDP data across all nodes and interfaces in the network.
| context | the gRPC server context for the request |
| request | an empty request message (no parameters needed) |
| response | the protobuf message to be filled with all LLDP data from the network to be returned to the client |
|
override |
gRPC method implementation to retrieve all PTP data across all nodes and interfaces in the network.
| context | the gRPC server context for the request |
| request | an empty request message (no parameters needed) |
| response | the protobuf message to be filled with all PTP data from the network to be returned to the client |
|
override |
gRPC method implementation to retrieve administrative GCL (Gate Control List) data for a specific interface identified by node hostname and interface name.
| context | the gRPC server context for the request |
| request | the protobuf message InterfaceRequest containing the hostname of the node and the name of the interface for which administrative GCL data is requested |
| response | the protobuf message to be filled with the administrative GCL data of the specified interface to be returned to the client |
|
override |
gRPC method implementation to retrieve GCL (Gate Control List) data for a specific interface identified by node hostname and interface name.
| context | the gRPC server context for the request |
| request | the protobuf message InterfaceRequest containing the hostname of the node and the name of the interface for which GCL data is requested |
| response | the protobuf message to be filled with the GCL data of the specified interface to be returned to the client |
|
override |
gRPC method implementation to retrieve interface-specific LLDP data for a given interface identified by node hostname and interface name.
| context | the gRPC server context for the request |
| request | the protobuf message InterfaceRequest containing the hostname of the node and the name of the interface for which LLDP data is requested |
| response | the protobuf message to be filled with the LLDP data of the specified interface to be returned to the client |
|
override |
gRPC method implementation to retrieve operational GCL (Gate Control List) data for a specific interface identified by node hostname and interface name.
| context | the gRPC server context for the request |
| request | the protobuf message InterfaceRequest containing the hostname of the node and the name of the interface for which operational GCL data is requested |
| response | the protobuf message to be filled with the operational GCL data of the specified interface to be returned to the client |
|
override |
gRPC method implementation to retrieve interface-specific PTP data for a given interface identified by node hostname and interface name.
| context | the gRPC server context for the request |
| request | the protobuf message InterfaceRequest containing the hostname of the node and the name of the interface for which PTP data is requested |
| response | the protobuf message to be filled with the PTP data of the specified interface to be returned to the client |
|
override |
gRPC method implementation to retrieve the entire network topology, including nodes, interfaces, and their associated LLDP/PTP data.
| context | the gRPC server context for the request |
| request | an empty request message (no parameters needed) |
| response | the protobuf message to be filled with the complete network topology data to be returned to the client |
|
override |
gRPC method implementation to retrieve node-specific LLDP data for a given node identified by its hostname.
| context | the gRPC server context for the request |
| request | the protobuf message NodeRequest containing the hostname of the node for which LLDP data is requested |
| response | the protobuf message to be filled with the LLDP data of the specified node to be returned to the client |
|
override |
gRPC method implementation to retrieve node-specific PTP data for a given node identified by its hostname.
| context | the gRPC server context for the request |
| request | the protobuf message NodeRequest containing the hostname of the node for which PTP data is requested |
| response | the protobuf message to be filled with the PTP data of the specified node to be returned to the client |
| grpc::Status CncServiceImpl::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 and their interconnections based on LLDP data.
| context | the gRPC server context for the request |
| request | an empty request message (no parameters needed) |
| response | the protobuf message to be filled with the topology graph data (nodes and their connections) to be returned to the client |
|
private |
Maps an internal CncNode_t structure to a cnc::rpc::Node protobuf message.
| internalIface | the internal ietfInterface_t structure containing the interface data to be mapped |
| protoIface | the protobuf message to be filled with the mapped data from internalIface |
|
private |
Maps an internal LldpNode_t structure to a cnc::rpc::LldpNode protobuf message.
| internalLldp | the internal LldpNode_t structure containing the LLDP data to be mapped |
| protoLldp | the protobuf message to be filled with the mapped data from internalLldp |
|
private |
Maps an internal LldpPort_t structure to a cnc::rpc::LldpPort protobuf message.
| internalPort | the internal LldpPort_t structure containing the LLDP port data to be mapped |
| protoPort | the protobuf message to be filled with the mapped data from internalPort |
|
private |
|
private |
|
private |
Background task that periodically fetches PTP data for all nodes. This function runs in a separate thread and updates the topology with the latest PTP data at regular intervals (every 15 minutes). It uses a condition variable to wait for the next fetch interval or to be notified when the service is shutting down.
| grpc::Status CncServiceImpl::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 and interface name.
| context | the gRPC server context for the request |
| request | the protobuf message SetInterfaceScheduleRequest containing the hostname of the node, the name of the interface, and the schedule data to be set for that specific interface |
| response | the protobuf message to be filled with the result of the schedule setting operation (e.g., success status, error messages) to be returned to the client |
| grpc::Status CncServiceImpl::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 hostname.
| context | the gRPC server context for the request |
| request | the protobuf message SetNodeScheduleRequest containing the hostname of the node and the schedule data to be set for all interfaces on that node |
| response | the protobuf message to be filled with the result of the schedule setting operation (e.g., success status, error messages) to be returned to the client |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |