Hi Rustaceans,
I’m writing my engineering thesis in Rust — it’s a network visualizer that retrieves data from routers via protocols like SNMP, NETCONF, and RESTCONF, and uses routing protocol data (like the OSPF LSDB) to reconstruct and visualize the network topology.
I want the app to be extensible, so adding another data acquisition client or routing protocol parser would be easy.
Here’s a high-level overview of the architecture (see image):
Data Acquisition — handles how data is retrieved (SNMP, NETCONF, RESTCONF) and returns RawRouterData.
Routing Protocol Parsers — convert raw data into protocol-specific structures (e.g., OSPF LSAs), then into a protocol-agnostic NetworkGraph.
Network Graph — defines NetworkGraph, Node, and Edge structures.
**G…
Hi Rustaceans,
I’m writing my engineering thesis in Rust — it’s a network visualizer that retrieves data from routers via protocols like SNMP, NETCONF, and RESTCONF, and uses routing protocol data (like the OSPF LSDB) to reconstruct and visualize the network topology.
I want the app to be extensible, so adding another data acquisition client or routing protocol parser would be easy.
Here’s a high-level overview of the architecture (see image):
Data Acquisition — handles how data is retrieved (SNMP, NETCONF, RESTCONF) and returns RawRouterData.
Routing Protocol Parsers — convert raw data into protocol-specific structures (e.g., OSPF LSAs), then into a protocol-agnostic NetworkGraph.
Network Graph — defines NetworkGraph, Node, and Edge structures.
GUI — displays the NetworkGraph using eframe.
Repository link (Some things are hardcoded for now since I needed a working demo recently.)
The problem
For the Data Acquisition layer, I’d like to define a trait so parsers can use any client interchangeably. However, I’m struggling to design a function signature that’s both useful and generic enough for all clients.
Each client type needs different parameters:
SNMP - OIDs and operation type
RESTCONF - HTTP method and endpoint
NETCONF - XML RPC call
I’m thinking the trait could return Vec<RawRouterData>, but I’m unsure what the argument(s) should be. I briefly considered an enum with variants for each client type, but it feels wrong and not very scalable.
So my questions are:
How would you design a trait for this kind of multi-protocol data acquisition layer? 1.
Do you see any broader architectural issues or improvements in this design?
Any feedback is greatly appreciated - I’m still learning how to structure larger Rust projects and would love to hear your thoughts.