State validation
The way network devices model and store their state internally is often different from their configuration data model. Traditional CLI-first network devices display the state in a tabular format to the end user, making it easier for network operators to interpret and reason about it. In API-enabled network operating systems, they can present the state in a structured format, making the data friendlier for automation, but we still need to prepare the right data model for deserialization.
In this section, we will look at three different methods you could use to read the state from a network device through a code example that gathers operational data from the devices we just configured with crypto/ssh
, net/http
, and scrapligo
in the preceding sections of this chapter. For each network device, we will use one of these resources to get the data in the format we need:
- RESTful API calls: To retrieve and parse data from an HTTP interface
- Regular expressions...