What is the network topology datastore?
OpenDaylight stores network topology in its MD-SAL datastore under the YANG model network-topology. Once lighty.io starts with the RESTCONF northbound plugin, this topology tree is immediately accessible via standard HTTP requests - no additional setup needed.
The base RESTCONF path for topology is:
GET /restconf/data/network-topology:network-topology
Reading topology data
To retrieve all discovered nodes and links:
GET /restconf/data/network-topology:network-topology HTTP/1.1 Host: localhost:8888 Accept: application/json
Returns a JSON tree of all topologies, nodes, and termination points currently in the datastore.
To read a specific topology by ID:
GET /restconf/data/network-topology:network-topology/topology=topology-netconf
Adding a node to topology
To mount a NETCONF device (which registers it in the topology):
PUT /restconf/data/network-topology:network-topology/topology=topology-netconf/node=device-01
Content-Type: application/json
{
"node": [{
"node-id": "device-01",
"netconf-node-topology:host": "192.168.1.10",
"netconf-node-topology:port": 830,
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:tcp-only": false
}]
}
Checking connection status
After mounting, poll connection state:
GET /restconf/data/network-topology:network-topology/topology=topology-netconf/node=device-01/netconf-node-topology:connection-status
Response will show connected, connecting, or unable-to-connect.
Removing a node
DELETE /restconf/data/network-topology:network-topology/topology=topology-netconf/node=device-01