Lessons 207 and 208 configured the branch by hand. I typed the gateway, the bundle, and the QoS policy into one console window at a time, and it worked, and it was slow, and one typo cost a morning. This lesson stops typing. The config becomes a file. A model says what the file is allowed to say. NETCONF and RESTCONF carry the same change two ways. One script pushes it to all three gateway devices, and one set of getters reads the state back to prove it landed. The lab is EVE-NG, because this lesson needs real device images, not a simulation. The last part is a map, not a promise: CCNA, CCNP, CompTIA Network+, CompTIA Security+, and the cloud certs, what each one proves, what shape its exam is, and which lessons in this course map to which domains. By the end you will have run a push script against a stub device, read a YANG model, matched a NETCONF payload against a RESTCONF payload field by field, and written down the gaps between this course and the one cert you pick next.
Difficulty: Advanced · Know this first: Lesson 207 - Routing Beyond OSPF; Lesson 208 - High Availability, QoS, and Data-Centre Design; Lesson 184 - Network Switching and Routing; bash-scripting - Bash Scripting; python - Python
Every hop charges rent in milliseconds. The bar below is a worked example for this lesson's scenario, not a measurement from a live system, but the shape is honest: one script configures three devices in about the time it takes to type one change by hand, and a bad model dies in the candidate before it touches a live device. Step through the lesson or switch the scenario and watch the bar change.
Extra diagram · from scratch to master
Start with a change in a file. Add one stop at a time until three devices carry it, or the bad leaf kills it in the candidate.
The budget bar above shows three fixed stories. This simulator lets you write your own. Move a slider and watch the model hop, the push hop, and the verify hop change in the budget bar, in the hop timings, and in the total. The numbers are a teaching example, not live measurements. The shape is the lesson: the devices in the run, the share of config typed by hand, and the getter checks per device decide how slow the trip feels.
How many devices the script configures in one run. Each device adds about 2 ms to the push, because the script logs in, sends the commands, and reads the answer back.
Share of the config typed by hand instead of written once in the file. Every 10 percent of hand typing adds about 1.5 ms at the model hop and about 2.5 ms at the push hop, because the typing has to be read back and checked.
How many getter checks run on each device after the push. Each check costs about 4 ms: one getter call, one read back, one comparison against the plan.
Try this: (1) Set devices to 8, hand-typed to 100, checks to 6. The model is about 19 ms, the push about 45 ms, the verify about 24 ms, and the total is about 119 ms. (2) Set devices to 1, hand-typed to 0, checks to 1. The model is about 4 ms, the push about 6 ms, the verify about 4 ms, and the total is about 45 ms. Same trip. Only the devices, the hand typing, and the checks changed.
Three questions. No score is saved anywhere — this is just you against the material.
Here is the NETCONF edit from this lesson, with the values blanked out. Fill in the blanks, then run the check. The check looks for the five values that define the edit: the interface, the description, the address, the netmask, and the operation. The checker verified the same five values in the NETCONF XML and the RESTCONF JSON, and they match line by line.
Try breaking it on purpose: write 10.20.4.11 as the address, or write replace as the operation. Run the check and watch it fail. Then press Reset and fill in the right values. The Go deeper section has the full NETCONF payload and the RESTCONF payload to check against.
Expected output when it passes: The edit sets GigabitEthernet0/0 on BR-1 to description branch-voice-gateway, address 10.20.4.1, netmask 255.255.255.128, merged into the candidate config. The checker verified the same four fields in the NETCONF XML and the RESTCONF JSON, and they match line by line.
I take the same trip four times here. First I read the model that says what the config may be. Then I make the same change two ways, and learn the candidate. Then I push it to three devices at once and read the state back. Last I run the whole thing as code, and map the course to the certs.
Definition: A YANG model is a file that describes config as data. It has containers, lists, and leaves. A container is a box that holds the config. A list is one entry per thing, keyed by name: one entry per interface. A leaf is one value with one type: a name is a string, an address is a string. The model in this lesson says an interface has a name, a description, and an IPv4 address with a netmask, and nothing else. I checked that model with pyang on this machine, and it passed clean. EVE-NG is the lab this lesson runs on. It runs real device images in a browser window, on a server or a virtual machine you control. Packet Tracer from Lesson 184 simulates the devices. EVE-NG runs the real images, so the NETCONF replies and the NAPALM getters are the real ones. GNS3 is the other lab platform this course names, in Lesson 184. EVE-NG is the one this lesson uses, because the images run unchanged and the browser is the console.
Types:
Uses: I use this whenever a change is worth writing down before it is worth typing, which is every change. Try it now: run pyang branch-gateway.yang on your lab machine, then run pyang -f tree branch-gateway.yang and read the tree out loud. Then build the Lesson 207 topology in EVE-NG and start all four routers. Practice reading the model and starting the lab.
Dimensions: At low scale one model is enough, because the lab has one kind of device. What breaks is a model that describes the lab and not the real device: the leaf names differ, and the change that passed in the lab fails on the real box. It costs one model per device family, checked against the real image.
Definition: NETCONF edits device config as structured data over SSH. The edit goes to the candidate config first, the device validates it against the YANG model, and the commit moves it to the running config. If validation fails, the candidate is discarded and the running config never changes. Rollback is discard-changes on the candidate, or copying the running config back over the candidate. RESTCONF is the same model over HTTPS and JSON: a PUT to the URL that names the model and the interface, with the same four fields in the body, and a 204 reply with no body when it works. A 400 reply carries an error body that names the same leaf the NETCONF error would name. The device validates both against the same model, so a change that passes one passes both. I checked the match with Python on this machine: name, description, address, netmask, the same four values in the XML and in the JSON.
Types:
Uses: I use this whenever a change must not touch the live config until it is proven, which is every change to a device that carries traffic. Try it now: send the edit-config from this lesson to the candidate on BR-1, commit it, then send the same change over RESTCONF and compare the two payloads field by field. Then break it on purpose: send an edit with a leaf the model does not have, and watch the candidate get discarded. Practice the candidate, the commit, and the discard.
Dimensions: At ten times the devices, the candidate is the thing that breaks first: two engineers editing the same candidate overwrite each other, because the candidate is one copy, not one per person. What breaks is the shared scratch copy. It costs locking, or one candidate per change, and the habit of discarding what you did not commit.
Definition: Netmiko is a Python library that logs into devices over SSH and runs config commands. One script, one inventory file, three devices. The inventory is the source of truth: it names every device, its address, its role, and its planned HSRP priority. The script loops over the inventory, sends the same description to each interface, and prints what each device answered. NAPALM is a Python library that reads device state through getters: get_facts, get_interfaces, get_config. The point is the shape: get_interfaces returns the same fields on every vendor's driver, so one audit script reads every device the same way. The script reads the description back from each interface and checks it against the plan, and it computes the before and after diff with difflib and writes it down. The GW-2 drift is the catch this lesson is built on: before the run it read priority 100, after the run it reads 90, and the diff shows the fix. Ansible is the playbook-level tool for the same job, and it is taught in ansible.html. This lesson does not reteach it. Netmiko is the script-level tool: you write the loop yourself, and you see every step. Use Netmiko when the job is a script you own. Use Ansible when the job is a playbook the team shares.
Types:
Uses: I use this whenever the same change goes to more than one device, which is every change worth automating. Try it now: run python3 push_branch.py on your lab machine against the stub first, read the diff, then run it with --live against the EVE-NG lab and read the getters. Then run the rollback and confirm every device is back to the before state. Practice the push, the getters, and the rollback.
Dimensions: At ten times the devices, the password is the thing that breaks first: one shared password in the script is a breach waiting for a repo leak. What breaks is the credential, not the code. It costs a vault, or key-based login, and no secret ever written in the file.
Definition: At this level the network is code, not a set of consoles. The inventory is the source of truth, and the devices are checked against it, not the other way round. The diff runs before the apply, the getters run after it, and the rollback is rehearsed before either. Changes are files, and files get reviewed. The certification map is the second half of this level, and it is orientation only. CCNA proves you can build and run a small to medium network: one exam, about 120 minutes, six domains from network fundamentals to automation and programmability. CCNP Enterprise proves you can design and run a large one: a core exam plus one concentration exam, and the concentration is where the depth lives. CompTIA Network+ proves you can install, configure, and troubleshoot networks: one exam, about 90 questions, about 90 minutes, five domains. CompTIA Security+ proves you can secure them: one exam, about 90 questions, about 90 minutes, five domains. The cloud certs prove you can build on one cloud: AWS Certified Solutions Architect Associate, Azure AZ-104 Administrator, Google Associate Cloud Engineer, one exam each at associate level. The map in Go deeper ties each of those domains to the lessons in this course. The map shows what the course covers and what it does not. It is not exam prep. It promises no pass. The exam shapes change, so check the vendor page before you book, and the vendor outline is the source of truth for what is left.
Types:
Uses: I use this when a new site joins, or when I review an automation setup I did not build. Try it now: take the design exercise below, run the push against the stub, then pick one cert from the map and write the gap list. The gap list is the study plan.
Dimensions: At a hundred times the devices, the review is the thing that breaks first: a thousand-line push with no review is a thousand-line outage. What breaks is the change nobody read. It costs review on every file, and a lab run before every live run.
EVE-NG, the lab platform. EVE-NG runs real device images in a browser window, on a server or a virtual machine you control. You upload an image, you draw the topology, you click a node and its console opens in the browser. Packet Tracer from Lesson 184 simulates the devices: it is lighter, it runs on your laptop, and it is the right tool for learning a protocol. EVE-NG runs the real images, so the NETCONF replies, the RESTCONF replies, and the NAPALM getters are the real ones, and the mistakes are real mistakes. GNS3 is the other lab platform this course names, in Lesson 184: it also runs real images, on your own machine instead of a server. Pick EVE-NG when the lab lives on a server the team shares. Pick GNS3 when the lab lives on your laptop. Do this: on your lab machine, build the Lesson 207 topology in EVE-NG, start all four routers, and ping 10.20.2.20 from the branch laptop at 10.20.4.10. What you should see in EVE-NG: all four nodes green, and four replies from the HQ server. There is no EVE-NG in this VM, and this lesson does not pretend otherwise: the lab runs on your machine, and the outputs in this lesson are marked as what you should see there.
The YANG model, in full. This is the model the NETCONF and RESTCONF payloads in this lesson are written against. Read it top to bottom: the module name, the namespace, one container, one list keyed by name, and four leaves. The description leaf and the address leaf are the ones the change touches.
module branch-gateway {
yang-version 1.1;
namespace "urn:example:branch-gateway";
prefix bg;
organization "Branch lab";
description
"Gateway interface model for the Lesson 207 branch topology.
One interface, one description, one IPv4 address. This is the
model the NETCONF and RESTCONF payloads in this lesson are
written against. It is a teaching model, not a vendor model.";
container interfaces {
description "The interfaces on the branch gateway.";
list interface {
key "name";
description "One physical interface.";
leaf name {
type string;
description "Interface name, for example GigabitEthernet0/0.";
}
leaf description {
type string;
description "Interface description, set by the automation run.";
}
container ipv4 {
description "The IPv4 address on the interface.";
leaf address {
type string;
description "IPv4 address, for example 10.20.4.1.";
}
leaf netmask {
type string;
description "Subnet mask, for example 255.255.255.128.";
}
}
}
}
}
The pyang check, worked and checked in code. I ran pyang on this machine. Expected output, exactly as it ran: pyang branch-gateway.yang prints nothing and exits 0, and pyang -f tree branch-gateway.yang prints the tree: module: branch-gateway, +--rw interfaces, +--rw interface* [name], +--rw name string, +--rw description? string, +--rw ipv4, +--rw address? string, +--rw netmask? string. No output from pyang is the pass. The question mark after description and address means the leaf is optional: the model allows an interface with no description, which is the state the lab starts in.
The NETCONF payload, in full. The RPC is edit-config, the target is the candidate, and the config carries the branch-gateway model. The four values are the same four the RESTCONF payload carries. Do this on your lab machine: send this edit-config to BR-1, then send a commit, then run show running-config interface GigabitEthernet0/0. What you should see on the device: an ok reply to the edit, an ok reply to the commit, and description branch-voice-gateway on the interface. To roll back, send discard-changes on the candidate before the commit, or copy the running config over the candidate after it.
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<candidate/>
</target>
<config>
<interfaces xmlns="urn:example:branch-gateway">
<interface>
<name>GigabitEthernet0/0</name>
<description>branch-voice-gateway</description>
<ipv4>
<address>10.20.4.1</address>
<netmask>255.255.255.128</netmask>
</ipv4>
</interface>
</interfaces>
</config>
</edit-config>
</rpc>
The RESTCONF payload, in full. The URL names the model and the interface, and the body is the same four fields as JSON. Do this on your lab machine: send a PUT to the RESTCONF URL for the branch-gateway interfaces on BR-1 with this body. What you should see: a 204 reply, no body, and the same description on the interface. The field-by-field match, checked with Python on this machine: name GigabitEthernet0/0 in both, description branch-voice-gateway in both, address 10.20.4.1 in both, netmask 255.255.255.128 in both. Every field matched. A change that passes NETCONF passes RESTCONF, because the device validates both against the same model.
PUT /restconf/data/branch-gateway:interfaces
Content-Type: application/yang-data+json
{
"branch-gateway:interfaces": {
"interface": [
{
"name": "GigabitEthernet0/0",
"description": "branch-voice-gateway",
"ipv4": {
"address": "10.20.4.1",
"netmask": "255.255.255.128"
}
}
]
}
}
The push script, the part that matters. The inventory names the three devices. The command builder writes the description on every device and the priority fix on GW-2 only. The live path logs in with Netmiko, pushes the commands, and reads the state back with NAPALM getters. The full script, with the stub device, lives in the lesson work directory as push_branch.py. Do this on your lab machine: run python3 push_branch.py against the stub first, read the diff, then run it with --live against the EVE-NG lab.
INVENTORY = [
{"hostname": "BR-1", "host": "10.20.4.1", "role": "branch router",
"priority": None},
{"hostname": "GW-1", "host": "10.20.4.2", "role": "HSRP active",
"priority": 110},
{"hostname": "GW-2", "host": "10.20.4.3", "role": "HSRP standby",
"priority": 90},
]
def build_commands(device, rollback=False):
cmds = ["interface GigabitEthernet0/0"]
if rollback:
cmds.append(" no description")
if device["hostname"] == "GW-2":
cmds.append(" standby 1 priority 100")
else:
cmds.append(" description branch-voice-gateway")
if device["hostname"] == "GW-2":
cmds.append(" standby 1 priority 90")
return cmds
The stub run, worked and checked in code. I ran this script on this machine against the local stub device. Expected output, exactly as it ran, for the GW-2 device: STUB GW-2: config applied, interface GigabitEthernet0/0, description branch-voice-gateway, standby 1 priority 90, and the diff showing + description branch-voice-gateway, - standby 1 priority 100, + standby 1 priority 90. The getters read back STUB get_interfaces GigabitEthernet0/0: up=True description='branch-voice-gateway', and the priority check reads want 'standby 1 priority 90' in running-config: True. The final line of the run is VERIFIED: 3 of 3 devices. The stub output is canned and labelled STUB: it shows the shape of a real run, not a real device.
The rollback run, worked and checked in code. I ran the rollback on this machine. Expected output, exactly as it ran, for the GW-2 device: the rollback diff showing - description branch-voice-gateway, - standby 1 priority 90, + standby 1 priority 100, and the getters reading description='' after the rollback. The final line of the run is VERIFIED: 3 of 3 devices. The rollback restores the before state: no description anywhere, and GW-2 back to the drifted priority 100 it started with. A rollback that lands anywhere else is a third state, and a third state is a new incident.
The NETCONF against RESTCONF match, worked and checked in code. I ran this Python on this machine. Expected output, exactly as it ran:
$ python3 -c "
import xml.etree.ElementTree as ET, json
root = ET.parse('lab/netconf-edit.xml').getroot()
ns = {'bg': 'urn:example:branch-gateway'}
iface = root.find('.//bg:interface', ns)
ipv4 = iface.find('bg:ipv4', ns)
xml_fields = (iface.find('bg:name', ns).text, iface.find('bg:description', ns).text, ipv4.find('bg:address', ns).text, ipv4.find('bg:netmask', ns).text)
data = json.load(open('lab/restconf-edit.json'))
j = data['branch-gateway:interfaces']['interface'][0]
json_fields = (j['name'], j['description'], j['ipv4']['address'], j['ipv4']['netmask'])
print('NETCONF fields:', xml_fields)
print('RESTCONF fields:', json_fields)
print('match:', xml_fields == json_fields)"
NETCONF fields: ('GigabitEthernet0/0', 'branch-voice-gateway', '10.20.4.1', '255.255.255.128')
RESTCONF fields: ('GigabitEthernet0/0', 'branch-voice-gateway', '10.20.4.1', '255.255.255.128')
match: True
The certification map. Read it as orientation, not exam prep. Each row ties one lesson in this course to the cert domains it covers. The last column names the next step: the cert the lesson feeds, or the gap the course leaves open. The exam shapes change, so check the vendor page before you book.
| Course lesson | What it teaches | CCNA | Network+ | Security+ | CCNP / cloud |
|---|---|---|---|---|---|
| F12 - Networks: Two Computers Talking | Frames, switches, LANs | 1.0 Network Fundamentals | 1.0 Networking Fundamentals | - | - |
| F13 - What Is an IP Address | IPv4 addressing | 1.0 Network Fundamentals | 1.0 Networking Fundamentals | - | - |
| F14 - Private and Public IP Addresses | NAT, private ranges | 1.0 Network Fundamentals | 1.0 Networking Fundamentals | - | - |
| F15 - Subnets | Subnetting | 1.0 Network Fundamentals | 1.0 Networking Fundamentals | - | - |
| F16 - CIDR Notation | CIDR, VLSM intro | 1.0 Network Fundamentals | 1.0 Networking Fundamentals | - | - |
| F17 - IPv6 | IPv6 addressing | 1.0 Network Fundamentals | 1.0 Networking Fundamentals | - | - |
| F18 - The OSI Model | Seven layers | 1.0 Network Fundamentals | 1.0 Networking Fundamentals | 3.0 Security Architecture | - |
| F19 - TCP and UDP | Transport, ports | 1.0 Network Fundamentals | 1.0 Networking Fundamentals | - | - |
| Lesson 184 - Switching and Routing | Switching, STP, VLANs, OSPF | 2.0 Network Access, 3.0 IP Connectivity | 2.0 Network Implementations | - | CCNP ENCOR infrastructure |
| Lesson 185 - Wireless Networking | WiFi, WPA2, WPA3 | 2.0 Network Access | 2.0 Network Implementations | 3.0 Security Architecture | - |
| Lesson 186 - VPNs, Tunnels and Firewalls | VPNs, firewalls | 5.0 Security Fundamentals | 4.0 Network Security | 3.0 Security Architecture, 4.0 Security Operations | - |
| Lesson 207 - Routing Beyond OSPF | RIP, EIGRP, MPLS, SD-WAN, VRFs | 3.0 IP Connectivity | 2.0 Network Implementations, 3.0 Network Operations | - | CCNP ENARSI |
| Lesson 208 - High Availability, QoS, Design | HSRP, VRRP, GLBP, QoS, design | 4.0 IP Services | 3.0 Network Operations | - | CCNP ENCOR |
| Lesson 209 - This lesson | YANG, NETCONF, Netmiko, NAPALM | 6.0 Automation and Programmability | 3.0 Network Operations | - | CCNP ENCOR automation; cloud certs use the same API habits |
What each cert proves, and the shape of its exam. CCNA proves you can build and run a small to medium network: one exam, about 120 minutes, six domains from network fundamentals to automation and programmability. CCNP Enterprise proves you can design and run a large one: a core exam plus one concentration exam, and the concentration is where the depth lives. CompTIA Network+ proves you can install, configure, and troubleshoot networks: one exam, about 90 questions, about 90 minutes, five domains. CompTIA Security+ proves you can secure them: one exam, about 90 questions, about 90 minutes, five domains. The cloud certs prove you can build on one cloud: AWS Certified Solutions Architect Associate, Azure AZ-104 Administrator, and Google Associate Cloud Engineer, one exam each at associate level. The cloud exams test the same habits this lesson teaches: APIs, config as data, and automation over hand typing. None of these shapes are fixed forever: the vendors change the question counts and the time limits, so check the vendor page before you book. This lesson is orientation. It is not exam prep, and it promises no pass.
The automation time math, worked and checked in code. A hand-typed change costs about 40 ms of the story per device in this lesson, so three devices cost about 120 ms. The script costs about 10 ms for the same three devices, because the typing happens once, in the file. The saving is not the typing. The saving is the review: the file is read before the run, and the diff is read after it. I ran this Python on this machine. Expected output, exactly as it ran:
$ python3 -c "
print('hand-typed 3 devices x 40 ms each (ms):', 3 * 40)
print('script push 3 devices, one run (ms):', 10)
print('clean total (ms):', 0 + 2 + 4 + 8 + 6 + 10 + 12 + 15)
print('slow total (ms):', 0 + 12 + 25 + 20 + 18 + 40 + 25 + 35)
print('fail total (ms):', 0 + 2 + 4 + 8 + 0 + 0 + 0 + 0)"
hand-typed 3 devices x 40 ms each (ms): 120
script push 3 devices, one run (ms): 10
clean total (ms): 57
slow total (ms): 175
fail total (ms): 14
At 10x the size, the shape holds and the numbers grow: more devices in the inventory, more getters per device, more models, one per device family. At 100x, the discipline changes: the inventory becomes a database the team shares, the push becomes a pipeline with a review step, the getters become an audit that runs on a schedule, and the rollback becomes a rehearsed runbook with a name on it. The change never stops being a file. It just rides a bigger system, and the diff is what keeps the system honest.
A change typed by hand on three devices, one typo, three different results, and a rollback that was also typed by hand. The description went on BR-1 and GW-1 fine. On GW-2 the priority was typed as 100 instead of 90, because 100 is the default and the fingers typed the default. The gateway pair still worked, so nobody noticed. The standby was just a little slower to take over than the plan said, and slow takeovers only show up when the active router dies.
Three things. First, the inventory is the source of truth, and the devices are checked against it, not the other way round. Second, every change gets a diff before the apply and a getter check after it, because eyes skip what they expect to see. Third, the rollback is written before the push, not after the failure. A change without a rehearsed rollback is a change you cannot undo. Try it now: run the getter check from this lesson against your own lab and read the priorities back. If any number disagrees with the plan, that is drift, and drift is the finding.
Automate the Lesson 207 topology. Write the inventory file for BR-1, GW-1, and GW-2, write the push script that sets the description on all three and corrects GW-2's priority, verify with NAPALM getters, roll back, and then map your own path to one cert from the table and list the domains the course does not cover. It passes when the script runs against the stub with 3 of 3 verified, the diff shows the change on all three devices, the rollback restores the before state, and the cert gap list is written down.
Success looks like this: the stub run prints VERIFIED: 3 of 3 devices, the GW-2 diff shows the priority corrected from 100 to 90, the rollback diff shows the description removed and GW-2 back to 100, and the cert gap list names the domains the course does not teach. The change is one file, the review is the diff, and the rollback is rehearsed.
If the stub run fails on one device and passes on the other two, the inventory is wrong for that device: check the hostname and the address before you touch the script. If the getters disagree with the plan, trust the getters: the file says what should be there, and the getter says what is there. If your cert gap list is empty, you mapped the wrong cert: the course covers part of every cert on the map, and the whole of none of them.