We continue to rely almost exclusively on Forward Networks for our lifecycle management and planning (purchasing). One of the big gaps, however, was I couldn’t get the Wireless Access Points on the network, and had to go to other devices and export it into excel. Not terrible, but time consuming.
You can also check out my related post:
I threw together simple script to collect the Cisco AP’s “Name/Location/AP-Model/IP-Address/Country-Code.
Pre-requisites:
- Add Custom Command to IOS-XE for collection “show ap sum”
- Add Tag of “WLC” on your Wireless Controllers
- WLC’s are on c9800 running IOS-XE
- IOS-XE version is 17.9.6
It appears older versions of OS (<17.9.6) don’t align nicely, but i’m sure you can adjust for it using the core of this script. I’m adding one more table to this, to pull the LDoS date from the model that is pulled from the custom command… which I will update when I get it to work ;-)
/**
* @intent - pull Name & Model & IP address
* @description Log into Cisco WLC's "C9800" and pull AP information from the controllers with "show ap summary"
Note - OS's older than "17.09.06" might require reformatting the pattern to pull what you want.
**/
// Pattern of output//
AP_INFO =
```
{APName:string} {Slots:number} {Model:string} {EthMAC:string} {RadioMac:string} {CC:string} {RD:string} {IP:string} {State:string} {Location:string}
```;
foreach Device in network.devices
foreach Tag in Device.tagNames
where Tag == "WLC"
foreach Command in Device.outputs.commands
where Command.commandText == "show ap sum"
let parsed = parseConfigBlocks(OS.IOS_XE, Command.response) //parses text into lines
let matchData = blockMatches(parsed, AP_INFO) //applies pattern to lines
foreach x in matchData
select {
name: Device.name,
Location: Device.locationName,
Model: Device.platform.model,
OS: Device.platform.os,
AP_NAME: x.data.APName,
AP_Model: x.data.Model,
"IP Address": x.data.IP,
"Country Code": x.data.CC,
RD: x.data.RD
}