xaviervalette / cisco-c9800-netconf-shut-ap-radios

A python script using NETCONF on C9800 to disable APs radios via RF tags

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cisco Catalyst 9800 NETCONF shut radios

A python script using NETCONF shutdown radios of C9800 managed APs:

image

Targeted changes

To do so, the script updates RF Profiles of 2.4GHz, 5GHz and 6GHz bands for given RF Tags.

CLI configuration changes

Before After
wireless tag rf FR42_STE07ALD
 24ghz-rf-policy 15dbm_24ghz
 5ghz-rf-policy 15dbm_5ghz
 6ghz-rf-policy 15dbm_6ghz
wireless tag rf FR42_STE07ALD
-24ghz-rf-policy 15dbm_24ghz
+24ghz-rf-policy No_24ghz
-5ghz-rf-policy 15dbm_5ghz
+5ghz-rf-policy No_5ghz
6ghz-rf-policy No_6ghz

GUI configuration changes

Go to Configuration > Tags & Profiles > Tags > RF section:

Before After
image image

Get started

  1. Clone or download this repo
git clone https://github.com/xaviervalette/cisco-c9800-netconf-disable-ap-radios
  1. Install required packages
pip3 install -r requirements.txt
  1. Add a file called config.yml as follow:
└── cisco-c9800-netconf-disable-ap-radios/
+   ├── config.yml
    ├── src/
    │    └── main.py
    ├── netconf/
    │    ├── config/
    │    │     ├── rfTag.xml
    │    │     └── rfTagsContainer.xml
    │    └── filter/
    │          └── getRfTags.xml
    └── conf/
         └── <wlc_ip>_rf-tags.xml  
  1. In the config.yml file, add the following variables:
#config.yml
---

controllers:
  - name: "<wlc name>"
    username: "<wlc NETCONF username>"
    password: "<wlc NETCONF password>"
    port: "<wlc NETCONF port>"
    host: "<wlc NETCONF @IP>"
rfTags:
  - name: FR42_STE07ALD
    rfProfiles:
      radiosDown:
        24ghz: "No_24ghz"
        5ghz: "No_5ghz"
        6ghz: "No_6ghz"
      radiosUp:
        24ghz: "15dbm_24ghz"
        5ghz: "15dbm_5ghz"
        6ghz: "No_6ghz"
      
...

⚠ RF Tags and RF Profiles have to be created before using the script

  1. Now you can run the code by using the following command:

Disable the radio of access points:

python3 src/main.py 0

Enable the radio of access points:

python3 src/main.py 1

Output

python3 src/main.py 1
python3 src/main.py 0
image image

About

A python script using NETCONF on C9800 to disable APs radios via RF tags

License:Apache License 2.0


Languages

Language:Python 100.0%