• In the previous lesson, you used EEM to automate tasks directly on a router.
    EEM is powerful, but the applet runs inside a single device.

    When you need to manage a fleet of devices from a central place, you write external scripts.
    The standard language for that is Python.

    What Python Talks To

    Your Python script does not type CLI commands like a human.
    It sends structured requests to a device that exposes an API.

    The device replies with structured data, almost always in JSON.

    Take a look at the diagram below.

    Diagram showing the four layers of network automation: Python script, libraries like requests, protocols like RESTCONF, and the Cisco IOS-XE device.

    Figure 1 – Python is the language. The protocol is the road.

    To make things easier, I split the picture into four layers.
    You do not need to memorize them.

    They are just a mental map I use to walk you through the topic, one piece at a time.

    • Layer 1 – What you write: the Python script itself.

    • Layer 2 – What you import: the Python library that does the heavy lifting (requests or ncclient).

    • Layer 3 – What travels: the network protocol on the wire (RESTCONF or NETCONF).

    • Layer 4 – The device: the Cisco IOS-XE router that receives the request, applies it, and replies.

    In the next four sections, you will study each layer one by one.

    Then in the last section, you will see exam-style scripts that put all four layers together.

    Answer the question below

    What does the Python script send to a device that exposes an API? (one word, plural)

    Answer the question below

    In what format does the device reply to a Python script?