Skip to content

pamosima/PnPAutoClaim

Repository files navigation

Cisco DNA Center PnP Onboarding Automation using Webhook Notification

published

This repository contains a Python Flask application that automate the process of onboarding devices using Plug and Play (PnP) in Cisco DNA Center. The scripts address use cases where devices are onboarded without knowing the serial number in advance, which is a common scenario when a site has a specific IP subnet allocated to it.

The scripts utilize the webhook notification option of Cisco DNA Center's "unclaimed" process. When a device contacts DNAC, information such as its IP address and serial number is sent via webhook to our Flask application. The application then maps the IP subnet to a configuration file that includes parameter mapping to variables, and claims the device based on its IP address.

Feel free to contribute to this repository and enhance the automation process further.

Installation

Python

Create a virtual environment and install the packages according to the requirements.txt

$ python -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt

Cisco DNA Center

Minimum version > 2.3.3.x

Choose Platform > Developer Toolkit > Event Notifications > Notifications

Click + to create a new notifaction

Step 1 - Select Site and Events

Search for Device waiting to be claimed, select the notification and click Next

Step 2 - Select Channels

Choose the Rest as a notification channels and click Next

Step 3 - REST Settings

Click here to create a new setting instance. This opens the page below:

image

System > Settings > External Services > Destinations

Click add and fill in the details based on the example:

image

Return to the Step 3 - REST Settings page, refresh the instance select the created instance:

image

Click on Next

Step 4 - Name and Description

Provide a name and short description for your notification and click on Next

image

On the Summary page click on Finish

Done! Your new notification is complete.

Usage

Python

Set credentials as environment variables:

$ cat mycredentials.sh
DNA_CENTER_USERNAME=your_username_here
DNA_CENTER_PASSWORD=your_password_here

Run application:

$ source venv/bin/activate
$ source mycredentials.sh
$ python flaskapp.py

Cisco DNA Center

1. Import Test Sites

Choose Design > Network Hierarchy and click Import Sites image Choose a file or drag and drop to upload: /test_files/Test_Sites.csv Click Upload and then Import

2. Import CLI Template in DNAC

Choose Tools > Template Editor and click Onboarding Configuration

Hover over the project Onboarding Configuration, click the gear icon, and click Import Template

import the template from /test_files/C9k_Onboarding-Template.json

3. Import Test Devices

Choose Provision > Network Devices > Plug and Play and click on Add Devices image

Select Bulk Devices and the devices using /test_files/Test_DeviceImportTemplate.csv

image

Select the Devices and click on add

4. Send notification to webhook

Choose Platform > Developer Toolkit > Event Notifications > Event Catalog

Search for Device waiting to be claimed

Webhook Switch test payload

{
    "ipAddress": "172.20.101.2",
    "deviceName": "JAE231609EK"
}

Webhook AP test payload

{
    "ipAddress": "172.20.201.10",
    "deviceName": "FCW2433P1L7"
}

Authors & Maintainers

Smart people responsible for the creation and maintenance of this project:

Credits

To streamline the onboarding process, we have leveraged multiple scripts available on the CiscoDevNet/DNAC-onboarding-tools GitHub repository. Our scripts provide an efficient and automated solution to onboard devices in Cisco DNA Center, improving network provisioning time and reducing manual effort.

License

This project is licensed to you under the terms of the Cisco Sample Code License.

Issues/Comments

Please post any issues or comments directly on GitHub.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published