Developer

last person joined: 2 days ago 

Expand all | Collapse all

AOS8 API getting AP details

This thread has been viewed 33 times
  • 1.  AOS8 API getting AP details

    Posted Nov 17, 2020 02:11 PM
    Hello,

    AOS8.6.0.6 MM and cluster

    I'm starting to have a play around with the AOS API.

    I was hoping it would be a much better way to write some of the little Python scripts we occasionally throw together. For example we recently had a situation where some APs had got stuck in "Configuring ACLs" State, they were Up but not serving clients. I wanted to check to see how many were in this state. But to do that the non-API way using Python I had to login to the MM, find out each AP's LMS IP (AAC) using "show ap details..." and then log into the LMS to be able to get the AP State which showed whether it was running or stuck in a weird state.

    As far as I can see from looking at the API docs there isn't a dedicated API command to get AP information, so it looks like I have to use the "showcommand" API - login to the MM, get the AP details, parse the LMS address, then login to the LMS and do a similar process. It's nicer than using pexpect and pxssh, but I just want to check I'm not missing something that's a bit more direct?

    Thanks,

    Guy

    ------------------------------
    Guy Goodrick
    ------------------------------


  • 2.  RE: AOS8 API getting AP details

    Posted Nov 18, 2020 05:29 PM

    Hi Guy,

    The one you mentioned is the correct approach to execute this operation. You need to use the respective CLI based show command while using the Showcommand API and parse its output to build your workflow further. At this moment we do not have a direct API endpoint to perform this operation. However, I hope the Showcommand API helps in building this workflow.

    Thanks,

    Jay



    ------------------------------
    Jay Pathak
    ------------------------------



  • 3.  RE: AOS8 API getting AP details

    Posted Nov 18, 2020 06:06 PM
    Thanks Jay,

    That works for me, like I say it's a lot cleaner than fudging around trying to read command line output via SSH!

    These are really probably two Python questions but I'll ask just in case you have any advice:

    The JSON I get back converts into something Python understands using .json(), but it's slightly awkward because what I actually get back is a bunch of dictionaries like <snip>{"Item" : "AP State", "Value" : "Running"}<snip> so I can't directly get at "Running" using the Key "AP State", I have to decant what comes back into a dictionary so it is like {"AP State" : "Running"}, then it's much easier to use. I just wondered if this is common with JSON and whether there is some something that can do that final conversion for me (I can do it, it's just a little extra step which I'm wondering if I need to do myself).

    And the other question was - I see there is an API method for SCPing an AOS image into flash, that would be something I'd love to automate. But with something like this I'm a bit concerned about how do I know when the file transfer has taken place? And if it has been successful?

    Like I say, I know these aren't specifically about the API, but any help appreciated!

    Thanks again,

    Guy

    ------------------------------
    Guy Goodrick
    ------------------------------