When you run the application, the system determines if the node exists and, if not, adds it. If the node exists, the system registers it.
The application uses the
APIC-Challenge token
for a stronger API session security. To learn more about the challenge token, see Requiring a Challenge Token for an API Session.
The directory contains the following files:
│ main.py
│ apic.py
│ nodes.py
│ apic_cobra.py
│ Fabric-Nodes.xlsx
| requirements.txt
│ README.md
│ LICENSE
│ .gitignore
├───assets
│ apic_nodes.jpg
│ registered_nodes.jpg
└───
apic.py
module contains the APIC functions to connect and have access to the APIC Controller.nodes.py
module contains the functions to read nodes to be registered and register those nodes.main.py
module contains the main function to run the application.Fabric-Nodes.xlsx
is an MS Excel spreadsheet with four nodes to be registered (All Columns are validated using Excel data validation feature to restrict duplicate or invalid data and to show an error alert even before registering the nodes).apic_cobra.py
module, check Bonus section.After a switch/node is registered with the APIC, the switch is a part of the APIC-managed fabric inventory. With the
ACI fabric, the APIC is the single point of provisioning, management, and monitoring for switches in the infrastructure.
Switches in the Nodes Pending Registration
tab table can have the following conditions:
Undiscovered
until it is physically connected to the network. Once connected, the status changes to Discovered
.Note: After the node ID is assigned, it cannot be updated/edited.
Status | Description |
---|---|
Unknown | Node is discovered but no Node ID policy is configured. |
Undiscovered | Node ID configured but is not yet discovered. |
Discovering | Node is discovered but IP is not yet assigned. |
Unsupported | Node is not a supported model. |
Disabled | Node has been decommissioned. |
Inactive | No IP connectivity. |
Active | Node is active. |
Code
button.register-fabric-nodes-main> python -m venv .venv --upgrade-deps register-fabric-nodes-main> .\.venv\Scripts\Activate.ps1 register-fabric-nodes-main> python -m pip install wheel register-fabric-nodes-main> python -m pip install -r requirements.txt
$ git clone https://github.com/Tes3awy/register-fabric-nodes.git $ cd register-fabric-nodes $ python3 -m venv .venv --upgrade-deps $ source .venv/bin/activate $ python3 -m pip install wheel $ python3 -m pip install -r requirements.txt
An Excel file is already attached in the repo and is prepopulated with two leafs and two spines from Getting Started with Cisco ACI 5.2 v1 from Cisco dCloud.
For non Cisco partners, you can use the application with the ACI Simulator 5.2 from Cisco DevNet Sandbox. (Requires reservation)
Add your ACI fabric nodes to Fabric-Nodes.xlsx
.
In Node Type
column (Column A), you can select only one of the following four valid node types:
unspecified
tier-2-leaf
remote-wan-leaf
virtual
If you don't know which value to select from the
Node Type
column, chooseunspecified
.
In Node Role
column (Column B), you can select only one of the following three valid node roles:
spine
leaf
unspecified
After filling out all columns in Fabric-Nodes.xlsx
, double check your entries, save the Excel file, and exit MS Excel.
Finally, run the application.
Windows
> py main.py # or > py -m main
Nix or macOS
$ python3 main.py
# or
$ python3 -m main
You will be prompted to enter Excel file, APIC URL, username, and password.
Example:
Nodes Excel file: Fabric-Nodes.xlsx APIC IP Address: sandboxapicdc.cisco.com Username: admin Password:
Note: After a successful run, the node is removed from the
Nodes Pending Registration
tab table toRegistered Nodes
tab table and you cannot by any means update/edit neither thenode type
nor thenode id
.
If you have downloaded and installed the Cobra SDK (i.e., acicobra
and acimodel
wheel files), you can run the application using apic_cobra.py
. It's faster than the regular application (Around 1.8x faster).
$ python apic_cobra.py
# or
$ python -m apic_cobra
Owner
Contributors
Categories
Products
Application Centric Infrastructure (ACI)Programming Languages
PythonLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community