Software TSN Switch
A software switch to connect VMs and Containers to a TSN network
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
cnc::NetworkManager Class Reference

Coordinates NETCONF-based communication and TSN configuration workflows across topology nodes. More...

#include <NetworkManager.h>

Collaboration diagram for cnc::NetworkManager:
Collaboration graph

Public Member Functions

 NetworkManager (Topology &topology)
 Constructs a NetworkManager with the given topology reference.
 
 ~NetworkManager ()
 Destructor for NetworkManager. Disconnects all active sessions.
 
bool connectAllNodes (const InventoryMap &inventory)
 Connects to all nodes in the topology using the provided credentials.
 
void fetchLldpData ()
 Fetches LLDP data from all connected nodes and updates the topology. Reads LLDP data via /ietf-lldp:lldp-entries via Netconf <get>.
 
void fetchOperationGcl ()
 Fetches operational GCL data from all connected nodes and updates their configurations. Reads GCL data via /interfaces/interface/bridge-port/gate-parameter-table via Netconf <get>.
 
void fetchInterfaces ()
 Fetches interface data from all connected nodes and updates the topology. Reads interface data via /ietf-interfaces:interfaces/interface via Netconf <get>.
 
void fetchPtpData ()
 Fetches PTP data from all connected nodes and updates the topology. Reads PTP data via /ieee1588-ptp:ptp-data via Netconf <get>.
 
void discoverNetwork ()
 Discovers the network topology and populating the Topology structure.
 
bool fetchLldpDataForNode (const std::string &nodeName)
 Fetches LLDP data for a specific node and updates the topology.
 
bool fetchOperationGclForNode (const std::string &nodeName)
 Fetches operational GCL data for a specific node and updates the topology.
 
bool fetchPtpDataForNode (const std::string &nodeName)
 Fetches PTP data for a specific node and updates the topology.
 
bool deployConfigToNode (const std::string &nodeName)
 Configures specific nodes with TSN parameters.
 
bool deployInterfaceConfig (const std::string &nodeName, const std::string &ifaceName)
 Configures a specific interface on a node with its TSN parameters.
 
void deployConfigToAll ()
 Configures all nodes in the topology with their respective TSN parameters.
 
std::shared_ptr< common::NetconfSession > getSession (const std::string &nodeName)
 Retrieves the Netconf session for a given node by its hostname.
 

Private Member Functions

bool executeOnNodeWorker (const std::string &nodeName, std::function< void(std::shared_ptr< common::NetconfSession >)> task)
 
std::string buildInterfaceGclXml (const ietfInterface_t &iface)
 

Static Private Member Functions

static std::string buildGclXml (const CncNode_t &node)
 Builds the XML configuration for GCL based on the node's TSN parameters.
 

Private Attributes

Topology & topology_
 
std::map< std::string, std::shared_ptr< NodeWorker > > nodeWorkers_
 

Detailed Description

Coordinates NETCONF-based communication and TSN configuration workflows across topology nodes.

This class manages per-node NETCONF sessions, retrieves operational LLDP and GCL data, and applies generated TSN/GCL configuration back to devices. It serves as the orchestration layer between topology state, inventory credentials, XML builders/parsers, and device-facing NETCONF operations.

Constructor & Destructor Documentation

◆ NetworkManager()

cnc::NetworkManager::NetworkManager ( Topology &  topology)

Constructs a NetworkManager with the given topology reference.

Parameters
topologyReference to the Topology object managing network nodes.

◆ ~NetworkManager()

cnc::NetworkManager::~NetworkManager ( )

Destructor for NetworkManager. Disconnects all active sessions.

Member Function Documentation

◆ buildGclXml()

std::string cnc::NetworkManager::buildGclXml ( const CncNode_t &  node)
staticprivate

Builds the XML configuration for GCL based on the node's TSN parameters.

Parameters
nodeThe CncNode_t containing TSN parameters.
Returns
The XML string representing the GCL configuration.

◆ buildInterfaceGclXml()

std::string cnc::NetworkManager::buildInterfaceGclXml ( const ietfInterface_t &  iface)
private

◆ connectAllNodes()

bool cnc::NetworkManager::connectAllNodes ( const InventoryMap &  inventory)

Connects to all nodes in the topology using the provided credentials.

Parameters
inventoryThe inventory map containing device credentials (hostname to DeviceCredentials_t).
Returns
true if all nodes were connected successfully, false otherwise.

◆ deployConfigToAll()

void cnc::NetworkManager::deployConfigToAll ( )

Configures all nodes in the topology with their respective TSN parameters.

◆ deployConfigToNode()

bool cnc::NetworkManager::deployConfigToNode ( const std::string &  nodeName)

Configures specific nodes with TSN parameters.

  1. Transforms CncNode_t data into appropriate XML configuration.
  2. Sends configuration via Netconf <edit-config> to the target nodes (candidate datastore).
  3. Commits the configuration to the running datastore.
    Parameters
    nodeNameThe hostname of the node to configure.
    Returns
    true if the configuration was successfully deployed, false otherwise.

◆ deployInterfaceConfig()

bool cnc::NetworkManager::deployInterfaceConfig ( const std::string &  nodeName,
const std::string &  ifaceName 
)

Configures a specific interface on a node with its TSN parameters.

  1. Transforms the interface's TSN parameters into appropriate XML configuration.
  2. Sends configuration via Netconf <edit-config> to the target node (candidate datastore).
  3. Commits the configuration to the running datastore.
    Parameters
    nodeNameThe hostname of the node containing the interface to configure.
    ifaceNameThe name of the interface to configure.
    Returns
    true if the configuration was successfully deployed, false otherwise.

◆ discoverNetwork()

void cnc::NetworkManager::discoverNetwork ( )

Discovers the network topology and populating the Topology structure.

◆ executeOnNodeWorker()

bool cnc::NetworkManager::executeOnNodeWorker ( const std::string &  nodeName,
std::function< void(std::shared_ptr< common::NetconfSession >)>  task 
)
private

◆ fetchInterfaces()

void cnc::NetworkManager::fetchInterfaces ( )

Fetches interface data from all connected nodes and updates the topology. Reads interface data via /ietf-interfaces:interfaces/interface via Netconf <get>.

◆ fetchLldpData()

void cnc::NetworkManager::fetchLldpData ( )

Fetches LLDP data from all connected nodes and updates the topology. Reads LLDP data via /ietf-lldp:lldp-entries via Netconf <get>.

◆ fetchLldpDataForNode()

bool cnc::NetworkManager::fetchLldpDataForNode ( const std::string &  nodeName)

Fetches LLDP data for a specific node and updates the topology.

Parameters
nodeNameThe hostname of the node to fetch LLDP data from.
Returns
true if the LLDP data was successfully fetched and parsed, false otherwise.

◆ fetchOperationGcl()

void cnc::NetworkManager::fetchOperationGcl ( )

Fetches operational GCL data from all connected nodes and updates their configurations. Reads GCL data via /interfaces/interface/bridge-port/gate-parameter-table via Netconf <get>.

◆ fetchOperationGclForNode()

bool cnc::NetworkManager::fetchOperationGclForNode ( const std::string &  nodeName)

Fetches operational GCL data for a specific node and updates the topology.

Parameters
nodeNameThe hostname of the node to fetch GCL data from.
Returns
true if the GCL data was successfully fetched and parsed, false otherwise.

◆ fetchPtpData()

void cnc::NetworkManager::fetchPtpData ( )

Fetches PTP data from all connected nodes and updates the topology. Reads PTP data via /ieee1588-ptp:ptp-data via Netconf <get>.

◆ fetchPtpDataForNode()

bool cnc::NetworkManager::fetchPtpDataForNode ( const std::string &  nodeName)

Fetches PTP data for a specific node and updates the topology.

Parameters
nodeNameThe hostname of the node to fetch PTP data from.
Returns
true if the PTP data was successfully fetched and parsed, false otherwise.

◆ getSession()

std::shared_ptr< common::NetconfSession > cnc::NetworkManager::getSession ( const std::string &  nodeName)

Retrieves the Netconf session for a given node by its hostname.

Parameters
nodeNameThe hostname of the node.
Returns
Shared pointer to the NetconfSession if found, nullptr otherwise.

Member Data Documentation

◆ nodeWorkers_

std::map<std::string, std::shared_ptr<NodeWorker> > cnc::NetworkManager::nodeWorkers_
private

◆ topology_

Topology& cnc::NetworkManager::topology_
private

The documentation for this class was generated from the following files: