Options

Powershell Commandlets for A10

IS there any plan for A10 to create powershell commands/commandlets? I'm in a Microsoft shop with the VSTS devl platform and Python is not a good fit. I'd like to automate the deployment process to include the A10.
Tagged:

Comments

  • Options
    diederikdiederik Member
    edited September 2017
    The AXAPI is not strictly linked to Python.
    Although there are some Python examples, they are not as such really A10 sanctioned/created packages, they merely function as examples.

    The great thing is that the API calls are all basically (REST) WebRequests that return JSON structured data.

    our documentation shows "curl" as a method. But Invoking powershell webRequests will of course also work.

    Here is an example of an upgrade script using powershell:
    https://www.powershellgallery.com/packages/upgrade-file/1.0.0/Content/upgrade-file.ps1

    Building powershell scripts using the same structure (authentication, header, request, body etc) should work perfectly well.

    The above powershell script has exmaples of reading and setting parameters.
  • Options
    scott herrickscott herrick Member
    edited September 2017
    diederik, thanks for the link.

    I'm making progress but I am having difficulty finding the "Current Connections" on any of the Servers inside the AXAPI. Any examples or recommendations?

    Thanks
    Scott
  • Options
    diederikdiederik Member
    edited September 2017
    I haven't worked with this myself.
    But I believe you need to query the:

    server-list.sampling-enable

    This should return a JSON list with all the servers and their statistics like "current connections"

    You can also query:

    server-list.port-list.sampling-enable

    Which gives you a similar list, but per port.
  • Options
    scott herrickscott herrick Member
    edited September 2017
    Diedrick,
    Again, thanks for the direction. I have the Stats and the Status of the servers working with the two statements:
    $ServerStats = Invoke-RestMethod -Method GET -Headers $headers -Uri $prefix//$device/$axapi/slb/server/$server/stats
    $ServerInfo = Invoke-RestMethod -Method GET -Headers $headers -Uri $prefix//$device/$axapi/slb/server/$server
    The Status/Action (Enabled or Disabled) is in the variable $ServerInfo.server.action
    The Connections is in the variable $ServerStats.server.stats.'curr-conn'

    So far so good... But the format for a POST method is my current road block. What is the powershell format for a POST that will enable/Disable a server?
Sign In or Register to comment.