The AOS-CX Developer Hub

Welcome to the AOS-CX developer hub. You'll find comprehensive guides and documentation to help you start working with AOS-CX as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Example Workflows

Short examples of creating workflows

Now that we've broken down the details of creating a workflow, here are a couple succinct examples of how to do so:

  1. Getting LLDP Neighbors
  2. Configuring simple BGP

"Read the Docs"

Again, the pyaoscx modules are documented on the our "Read the Docs" page here. This resource helps us figure out what functions within what modules we need to use in our workflows to configure features.

1. Creating a workflow to get a list of LLDP Neighbors

In the same manner that we created the VLAN scripts, we'll create a script to retrieve a list of the LLDP Neighbors. Again, we can borrow elements that are common to all the scripts--the setup, the login, and the logout. The first change we have to make is that when we're importing our aos_cx modules, we have to import the lldp module:
from pyaoscx import lldp

As for the core steps portion of the workflow, we have to add our call to retrieve the list of LLDP Neighbors:
lldp_neighbors_list = lldp.get_all_lldp_neighbors(**session_dict)

2. Creating a workflow to configure simple BGP

Now let's perform a basic BGP configuration. In this example workflow, we will set up the BGP instance, create an ASN, and set the router ID. Then we'll add a BGP peer with whom we want our device to exchange IPv4 address routes. We will use an example configuration shown by the following CLI commands:

router bgp 65001
    bgp router-id
    neighbor remote-as 65002
    address-family ipv4 unicast
        neighbor activate

Again, near the top where we have our pyaoscx module imports, we must first import the appropriate module(s), in this case bgp:
from pyaoscx import bgp

Next, in our core steps, we'll add our necessary function calls. The first thing we have to do is set up the BGP instance, and create the ASN, and set the router ID. We do that with this function call:
bgp.create_bgp_asn("default", 65001, "", **session_dict)

Then, we add our BGP peer:
bgp.create_bgp_neighbors("default", 65002, "", "ipv4-unicast", **session_dict)

Updated 9 days ago

Example Workflows

Short examples of creating workflows

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.