The idea
Programs change the network through a REST API: JSON sent over HTTP to URLs. Here the laptop uses
curl to ask the controller, which logs in to the routers edgeRouter and
branchRouter over SSH, for the route that lets it reach webServer.
Steps
-
No way to the servers yet
The laptop sends to its gateway, edgeRouter, which knows only its own two networks. Nothing will be typed on the routers in this lab: the fix comes through the API, so you see one request change the network.
laptop:~# ping -c 2 -W 1 10.0.2.10
-
401 first, then a password in every request
An API that changes routers must know who is asking. Ask it for its devices, a GET (the method that reads) to
/api/devices, first without saying who you are, then with a user name and password.laptop:~# curl -si http://10.0.1.10:8080/api/devices laptop:~# curl -sv -u admin:netlab http://10.0.1.10:8080/api/devices
Pro
5 more steps in the app
- Read the JSON with jq
- A token or an API key instead of the password
- POST a route, and the network changes
- PATCH changes a field, PUT replaces the whole
- DELETE: 204, and the path is gone