SP DCN Champions FY23 Bootcamp: Automation NDFC/NXOS

What's in this repo?

The files in this repo were either used, or referenced, during the SP DCN Champions bootcamp, specifically:

postman directory

  1. The Demo collection used to add a fabric to an NDFC instance using REST
  2. A minimal ND (Nexus Dashboard) collection (enough to login)
  3. A more complete NDFC (Nexus Dashboard Fabric Controller) collection.

ndfc_ansible directory

  1. playbook to add a switch to the fabric created in 1 above
  2. playbook to add a vrf and network to the fabric; attaching them to the switch.

nxos_ansible directory

  1. An example Ansible inventory, and a playbook which uses the cisco.nxos.nxos_interfaces module to add a description to a couple interfaces.

nxapi directory

  1. An example python script (sandbox.py) generated by the NX-OS Sandbox (present on all NX-OS switches).
  2. A more involved python script that manages cookies and can be modified to send configurations and retrieve command output.

Below is what this second script outputs:

(py311) % ./simple_request.py 
cookies refreshed by DUT
  old cookies {}
  new cookies <RequestsCookieJar[<Cookie nxapi_auth=dzqnf:Yo+Tt1AqYP8UIDukCy5pvIeBmn8= for 10.1.1.1/>]>
old cookies are fresh
hostname cvd-1311-leaf
old cookies are fresh
Interface Ethernet1/11
  state: up
  description: aaa
  eth_outrate1_bits: 280
(py311) %