INSIGHTS
DevOps & Automation

Cisco 350-401: Enterprise Automation with NETCONF and RESTCONF

In this article
  1. Start with YANG models instead of reverse-engineering CLI text
  2. Use NETCONF when transactional configuration behavior matters
  3. Use RESTCONF when HTTP semantics fit the automation ecosystem
  4. Secure the management API as carefully as the CLI
  5. Design idempotent workflows rather than one-shot command sequences
  6. Use prechecks, validation, and postchecks as part of every transaction
  7. Handle partial failure and concurrency explicitly
  8. Pair configuration APIs with model-driven telemetry
  9. Choose protocol boundaries that keep the automation maintainable

NETCONF and RESTCONF give enterprise network automation a model-driven alternative to scraping CLI output and pushing lines of configuration without understanding structure. Both protocols work with YANG-modeled data, which means an automation system can address configuration and operational objects as defined data rather than as text that depends on prompt format, indentation, or a particular show command. This makes validation, error handling, and repeatable changes easier to engineer.

The current 350-401 ENCOR v1.2 blueprint includes model-driven programmability, and the 300-435 ENAUTO concentration goes deeper into enterprise automation. Cisco IOS XE 26.x documentation continues to support NETCONF, RESTCONF, YANG models, service-level ACLs, AAA, and model-driven telemetry. The practical decision is not which protocol has the most modern name; it is which interface best fits the transaction, tooling, and operational control required for a given workflow.

Start with YANG models instead of reverse-engineering CLI text

YANG defines the structure, data types, relationships, and constraints of configuration and operational data exposed by a network platform. A client can discover or use a model to understand which containers, lists, leaves, and keys exist. That is fundamentally different from assuming that the third column of a show command always means the same thing. The model becomes a contract between the automation client and the network operating system.

Use native Cisco models or standards-based models according to the feature and interoperability requirement. The YANG model families differ in coverage and naming, so do not mix paths casually. Pin automation to models that are present on the target software release, validate schema changes during upgrades, and keep test devices that represent the versions deployed in production.

Namespaces and list keys are part of that contract. Two leaves can have similar names in different modules but represent different configuration domains. Clients should build paths from the schema rather than from hand-edited strings scattered through code. Generate or centralize path definitions when possible, and include model revision information in tests so an upgrade that changes a namespace or leaf type is detected before production.

Use NETCONF when transactional configuration behavior matters

NETCONF uses an RPC-based model over a secure transport, commonly SSH. It can retrieve modeled state and edit supported configuration datastores using structured XML. Operations such as get, get-config, edit-config, lock, validate, commit, or confirmed commit depend on device and datastore capabilities, so an automation client should discover what the server advertises rather than assume every capability is universal.

The protocol is particularly useful when a workflow needs explicit configuration operations and detailed RPC error responses. A change can be built as structured data, validated against the model, applied to a specific target datastore where supported, and checked before the workflow proceeds. That is safer than sending a sequence of CLI commands that may partially succeed before one line fails. The benefit is not that XML is elegant; it is that transaction semantics and schema awareness are available to the client.

NETCONF filters can reduce the amount of state returned by a device, which matters when an automation job needs one interface or one routing subtree rather than the entire configuration. Use targeted retrieval to reduce parsing cost and avoid accidentally storing sensitive data unrelated to the task. The same principle applies to RESTCONF resource paths: request the smallest object that provides the evidence the workflow needs.

Use RESTCONF when HTTP semantics fit the automation ecosystem

RESTCONF exposes YANG-modeled resources through HTTPS and uses familiar HTTP methods such as GET, POST, PUT, PATCH, and DELETE according to the resource and operation. Data can be represented in JSON or XML depending on the request and platform behavior. For teams already building web services and API integrations, RESTCONF can be easier to incorporate into existing libraries, authentication handling, logging, and observability.

HTTP status codes help distinguish authentication failures, missing resources, malformed requests, conflicts, and successful updates, but automation should still parse the returned error body. A 4xx response is not enough information for a support ticket. Record the resource path, method, payload version, response code, and model-specific error details while protecting credentials and secrets. The useful comparison in NETCONF and RESTCONF is about operational fit, not declaring one protocol universally superior.

Payload strategy also matters. A PUT-style operation that replaces a resource can have very different consequences from a PATCH that changes selected leaves. Understand how the target platform handles merge, replace, create, and delete semantics before using a method in bulk. An apparently small JSON payload can remove values the client omitted if the operation is defined as replacement rather than merge.

Secure the management API as carefully as the CLI

Model-driven interfaces can change the same devices and services as an administrator at the console, so they belong in the privileged management plane. Cisco IOS XE requires authenticated access for NETCONF and RESTCONF, and AAA can integrate those sessions with local, RADIUS, or TACACS+ identity according to the design. Use least privilege, dedicated automation identities, encrypted transport, trusted certificates where applicable, and management-plane filtering.

Separate human and machine credentials so that activity can be attributed correctly. Rotate secrets and API credentials through a managed process rather than embedding them in source code. Limit source networks allowed to reach the services. If the platform supports service-level ACLs for NETCONF or RESTCONF, treat those as an additional control rather than a substitute for firewalling and AAA. A programmable interface should not become an unmonitored side door into the network.

Discover capabilities and model paths before making changes. Automation should begin with discovery. NETCONF servers advertise capabilities during session establishment, and YANG libraries or RESTCONF roots can reveal available modules and resources. A script written against one lab image may fail on another release because a path moved, a feature uses a different model, or an operation is not supported. Discovering capabilities allows the workflow to fail early with a meaningful compatibility message.

Keep a compatibility matrix for the device families and software trains the organization supports. Unit tests can validate payload structure, but integration tests should run against representative devices or virtual platforms. Treat software upgrades as API changes even when Cisco intends backward compatibility; the safest process tests the exact automation paths used in production before the new release enters a broad maintenance window.

Audit logs should identify the automation identity and source system that performed each transaction. Feed successful and failed management-plane authentication into security monitoring, and alert on unusual source addresses or bursts of denied API calls. The same credentials that make automation efficient can make compromise efficient, so management APIs deserve monitoring comparable to privileged SSH access.

Design idempotent workflows rather than one-shot command sequences

An idempotent workflow moves a device toward the desired state and produces no unnecessary change when that state is already present. This is easier with modeled data because the client can read current values, compare them with intent, and update only what differs. Idempotency reduces churn, makes reruns safer, and produces more meaningful change logs because repeated execution does not continually rewrite equivalent configuration.

Think in terms of objects and invariants. If an interface description should equal a source-of-truth value, compare before writing. If a list of NTP servers should match an approved set, calculate additions and removals explicitly. Avoid workflows that “reset everything then reapply,” because they increase outage risk and can erase local state not represented in the automation model. The discipline behind network automation is repeatability, not simply doing CLI work faster.

Idempotency does not guarantee safety. A workflow can consistently converge to the wrong desired state if the source data is incorrect. Validate input ranges, peer addresses, interface mappings, and policy references before comparing them with the device. The automation engine should reject impossible or high-risk values early instead of faithfully applying them to every matching router.

Use prechecks, validation, and postchecks as part of every transaction

A safe change workflow captures enough state to prove that the network was healthy before the modification. Verify reachability, redundancy, routing neighbors, interface state, and any application-specific dependency that could make the maintenance unsafe. Then validate the intended payload and scope. A syntactically valid YANG payload can still be operationally wrong if it targets the wrong interface, VRF, site, or policy object.

After the change, query the modeled configuration and operational state again. Do not assume a successful API response means the desired service is functioning. Check the resulting route, neighbor, interface, telemetry, or client state. Store prechange and postchange evidence with the change record so rollback decisions are based on observed behavior rather than memory. This turns automation into an auditable engineering process.

Rollback design should account for the protocol and capability set. Confirmed commits can protect some NETCONF workflows where supported, while other changes may require an explicit inverse transaction or a saved configuration snapshot. Never assume rollback is automatic because the API is structured. Test failure in the middle of a workflow and verify that the service returns to a known state without leaving orphaned objects.

Handle partial failure and concurrency explicitly

Large workflows touch multiple devices, and not all of them will fail in the same way. One device may reject a model path, another may be unreachable, and a third may accept configuration but fail the postcheck. Decide whether the job should stop at the first failure, continue with independent devices, or roll back a completed group. The answer depends on whether the change is atomic at the service level.

Concurrency can shorten maintenance windows, but parallel changes can also remove redundancy if both members of a pair are modified simultaneously. Group devices by failure domain and enforce sequencing. Use locks where supported and useful, and prevent two automation jobs from managing the same object at the same time. A fast automation pipeline that causes overlapping writes is less reliable than a slower pipeline with clear ownership.

Batch size is another design decision. Reading and writing hundreds of devices simultaneously can overload AAA, controllers, or network devices even when each individual API call is valid. Use rate limits, retry logic with backoff, and bounded concurrency. Distinguish retryable transport errors from deterministic schema or authorization errors so the system does not hammer a device with the same invalid request.

NETCONF can expose candidate, running, and startup configuration datastores depending on platform capabilities, and that distinction affects how an automation system should stage change. A workflow that can edit a candidate datastore, validate it, and commit the result has different rollback characteristics from a workflow that writes directly to running configuration. RESTCONF commonly maps operations to individual resources, so the automation client must understand whether a PUT replaces a resource, a PATCH changes selected fields, and a DELETE removes configuration. Treat those semantics as part of the change design rather than as details hidden inside a software library.

At scale, error handling must be machine-readable and deterministic. Record request identifiers, target devices, model paths, payload hashes, response codes, and the exact stage at which a transaction failed. If a batch partially succeeds, the controller should know whether retrying is safe or whether a compensating rollback is required. Idempotent operations are especially valuable because they allow the same desired state to be applied repeatedly without accumulating duplicate configuration. Build retries around explicit failure classes such as timeout, transport loss, lock contention, validation error, or authorization failure; a generic retry loop can turn a small problem into widespread configuration churn.

Pair configuration APIs with model-driven telemetry

NETCONF and RESTCONF are not only about writing configuration. IOS XE also supports model-driven telemetry in which YANG-modeled operational data can be streamed to collectors at a cadence or on change. That lets automation observe the same structured objects it manages. Instead of polling dozens of show commands after a change, a system can subscribe to the state that proves the service remains healthy.

Choose telemetry subscriptions based on decisions the team can act on. Streaming every available leaf creates cost without insight. Monitor the interfaces, routing sessions, counters, and system resources that form the acceptance criteria for important changes. The Python automation layer can combine API transactions and telemetry checks, but the architecture should keep collection, decision logic, and write permissions separated enough to troubleshoot them independently.

Keep read permissions broader than write permissions when possible. Many monitoring systems need operational YANG data but should never be able to change configuration. Separate service accounts and network access controls reduce the blast radius of a collector compromise. Model-driven management is safest when observation and modification are distinct roles even though they use related schemas and protocols.

Choose protocol boundaries that keep the automation maintainable

Some tasks are best handled directly on IOS XE with NETCONF or RESTCONF; others are better performed through a controller such as Catalyst Center that already owns higher-level intent. Avoid automating the same object through multiple independent systems unless the ownership rules are explicit. Direct device APIs, controller APIs, Ansible, and Terraform can coexist, but each should have a defined scope so that one system does not continually undo another.

Document which platform is authoritative for each class of configuration, keep models and payloads in source control, and expose useful errors to operations rather than hiding them inside pipeline logs. Model-driven automation succeeds when engineers can answer three questions quickly: what state was intended, what interface changed it, and what evidence confirms the network now matches that intent. NETCONF and RESTCONF provide the structured mechanisms; operational discipline makes them dependable.

CLI automation will still exist for features that lack a suitable model or during emergency operations. Treat it as a controlled exception rather than pretending model-driven APIs cover everything. Wrap CLI tasks with the same prechecks, parsing discipline, logging, and postchecks used for NETCONF and RESTCONF. A mixed automation estate can be reliable when ownership is explicit and each interface is chosen for a technical reason.

Filed under DevOps & Automation