• 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 using Python.

    Your Python script does not type CLI commands like a human. It sends structured requests to an API on the device, and the device replies with structured data in JSON.

    Diagram showing the four pieces of network automation: the Python script, the library, the protocol on the wire, and the Cisco IOS-XE device.

    Figure 1 – The four pieces behind every script that talks to a router

    The Four Architecture Pieces

    Four pieces work together every time a script talks to a router:

    • The script you write: variables, lists, dictionaries, and loops that hold your logic.

    • The library you import: the Python package doing the heavy lifting, such as requests or ncclient.

    • The protocol on the wire: RESTCONF or NETCONF travelling between your script and the device.

    • The device that answers: the Cisco IOS-XE router receiving the request, applying it, and replying.

    This lesson covers the first piece: the plain Python logic you write to handle network data structures.

    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?