Wired Intelligent Edge

 View Only
last person joined: yesterday 

Bring performance and reliability to your network with the Aruba Core, Aggregation, and Access layer switches. Discuss the latest features and functionality of the ArubaOS-Switch and ArubaOS-CX devices, and find ways to improve security across your network to bring together a mobile first solution.
Expand all | Collapse all

PowerArubaSW : a powershell module for use ArubaOS Switch REST API

This thread has been viewed 62 times
  • 1.  PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP GURU
    Posted Sep 11, 2018 05:32 AM

    Hi,

     

    I have been working for several months on a Powershell module that uses the ArubaOS Switch REST API.

     

    This module is available on psgallery(.com) : https://www.powershellgallery.com/packages/PowerArubaSW/

    Actually, we support to connect to HTTPS or HTTP

    and configure the following feature :

    •  Vlans
    •  Vlans-Ports (affect a vlan tagged/untagged/forbidden to a port/interface)
    • Rest info (get api-version, timeout...)
    • LLDP
    • LACP
    • Led Locator
    • ...

    it is very easy to use (and install)

     

    Launch powershell command line and launch following command for install

     

    Install-Module PowerArubaSW

    for load the module

    Import-Module PowerArubaSW

    Connect to your switch

    Connect-ArubaSW 192.0.2.1

    You get a prompt to ask credential

     

    Need to have enable web-managemnt ssl and a user/password

     

    for example to get all vlan use

    Get-ArubaSWVlan

     

    You can get the list of command available via

    Get-Command -Module PowerArubaSW

     

     and for get help (and example about a command for example Get-ArubaSWVlans)

    Get-Help Get-ArubaSWVlans -Full

    More documentation, example is available on https://github.com/PowerAruba/PowerArubaSW and you can also report issue/enhance !

     

     



  • 2.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    EMPLOYEE
    Posted Sep 20, 2018 12:19 PM

    Hi Alagoutte,

    This is excellent work!  It would be fantastic if you would share this in our Aruba Programmability and Automation group. 

    Could you please repost this information in our Airheads Developer Community, located here: https://community.arubanetworks.com/t5/Developer-Community/gp-p/NetworkAbstraction

     

    Thanks!



  • 3.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP GURU
    Posted Dec 03, 2018 03:02 PM

    a new release available ! (0.6)

     

    What new :

     

    3 new cmdlets

    • Enhance speed (Don't wait 5sec between each request...) (#32)
    • Enhance security (Enable TLS 1.2 when HTTPS is used...) (#60)
    • Better "error" message when fail to connect or use a API (#55)
    • Add -usebasicparsing for use without connnected session (like task) (#56)
    • Add integration test (using Pester) for check code (Known issue about VSF Switch) (#36)
    • Add Get|Set-ArubaSWPort(-statistics) to get and configure a port (name, status, mode...) and Port statistics (name, packets/bytes/throughtput/error TX or RX...) (#40)
    • Add Extract-Port-ArubaSW.ps1 tools script for generate a Excel file with the list of Port and configuration (vlan, status, lldp neighbor...) (#34)
    • 4 removed cmdlets (Get-ArubaSWSystemStatus[Cpu|Memory|Storage|Time] (#43)

    For update

     

     

    Update-Module PowerArubaSW

    See also https://github.com/PowerAruba/PowerArubaSW/releases/tag/v0.6

     



  • 4.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    Posted Dec 10, 2018 04:59 PM

    Hi Alexis, is it possible to use in on Powershell Core for Mac? I have pwsh in both my windows and mac machines and it works well on windows but I'm getting an "unable to connect" error on mac. I'm trying to connect to the same device on both. 



  • 5.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP GURU
    Posted Dec 11, 2018 01:33 AM

    @danieltudares wrote:

    Hi Alexis, is it possible to use in on Powershell Core for Mac? I have pwsh in both my windows and mac machines and it works well on windows but I'm getting an "unable to connect" error on mac. I'm trying to connect to the same device on both. 


    Hi Daniel,

     

    What release do you have using ? (get-module -name PowerArubaSW)

     

    There is some "known issue" with PowerShell Core and the module...

    Actually it is not possible to connect to secure way (HTTPS) (https://github.com/PowerAruba/PowerArubaSW/issues/38)

     

    if you enable http on switch and use -httpOnly to Connect-ArubaSW, can you connect ?

     

    We can continue on https://github.com/PowerAruba/PowerArubaSW/issues



  • 6.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    Posted Dec 11, 2018 06:54 AM

    Hi Alexis, I'm running `0.6`

     

     

    PS /Users/danieltudares> Get-Module -name PowerArubaSW
    
    ModuleType Version    Name                                ExportedCommands
    ---------- -------    ----                                ----------------
    Script     0.6        PowerArubaSW                        {Add-ArubaSWLACP, Add-ArubaSWVlans, Add-ArubaSWVlansPorts,...

    and also my switch is an 2930f running the latest version 

    l3-core(config)# show flash | include Image
    Image             Size (bytes) Date     Version
    Primary Image    :    29616419 11/21/18 WC.16.08.0001
    Secondary Image  :    29616419 11/21/18 WC.16.08.0001
    Default Boot Image   : Primary

    and yes, I tried with the httpOnly flag and it worked, seems to be only over https. 

    I'll be following the ticket for the resolution, thanks a lot! 

     



  • 7.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP GURU
    Posted Dec 11, 2018 08:38 AM

    @danieltudares wrote:

    Hi Alexis, I'm running `0.6`

     

     

    PS /Users/danieltudares> Get-Module -name PowerArubaSW
    
    ModuleType Version    Name                                ExportedCommands
    ---------- -------    ----                                ----------------
    Script     0.6        PowerArubaSW                        {Add-ArubaSWLACP, Add-ArubaSWVlans, Add-ArubaSWVlansPorts,...

    and also my switch is an 2930f running the latest version 

    l3-core(config)# show flash | include Image
    Image             Size (bytes) Date     Version
    Primary Image    :    29616419 11/21/18 WC.16.08.0001
    Secondary Image  :    29616419 11/21/18 WC.16.08.0001
    Default Boot Image   : Primary

    and yes, I tried with the httpOnly flag and it worked, seems to be only over https. 

    I'll be following the ticket for the resolution, thanks a lot! 

     


    Thanks Daniel for feedback,

    the support of Powershell Core is planned for next release but i don't when ;-)

    I have already look but it will be easy to fix for Core (need to add -SkipCertificate to Invoke-WebRequest)



  • 8.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP GURU
    Posted Feb 22, 2019 04:07 AM

    @danieltudares wrote:

    Hi Alexis, is it possible to use in on Powershell Core for Mac? I have pwsh in both my windows and mac machines and it works well on windows but I'm getting an "unable to connect" error on mac. I'm trying to connect to the same device on both. 


    Hi Daniel,

     

    You can now use with your macOS !



  • 9.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP GURU
    Posted Feb 22, 2019 04:06 AM

    a new release of PowerArubaSW is available (0.7)

     

    What New ?

    4 new cmdlets

    • Add support of PowerShell 6(/Core)
    • Now run (and validated) under Linux and macOS
    • Add fix some issue with Stacked/VSF switch
    • Adding DNS support (Get/Set/Remove DNS server and domain names)

    more info https://github.com/PowerAruba/PowerArubaSW/releases/tag/v0.7

     

    Like always for update

     

    Update-Module PowerArubaSW


  • 10.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    Posted Apr 03, 2019 12:08 PM

    I apologize if this should be a separate thread vs a question on your PS module:

     

    I'm trying to determine if the REST API for ArubaOS allows toggling the PoE state on a given port?  Aka: Port E6: turn off PoE.

     

    If it's possible, can someone give a syntax example for the request?

     

     



  • 11.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP GURU
    Posted Apr 03, 2019 12:14 PM

    @tbig wrote:

    I apologize if this should be a separate thread vs a question on your PS module:

     

    I'm trying to determine if the REST API for ArubaOS allows toggling the PoE state on a given port?  Aka: Port E6: turn off PoE.

     

    If it's possible, can someone give a syntax example for the request?

     

     


    Hi tbig,

     

    There is already a "issue" on GitHub about PoE function

    https://github.com/PowerAruba/PowerArubaSW/issues/71

     

    There is already the command for get PoE Status...

    and it will no be complicated to change status (need to look API docs)

     

    I think include PoE for 0.8 or 0.9...

     



  • 12.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    Posted Apr 03, 2019 12:33 PM
    Just to confirm, does the REST API support a change to the PoE state?
    Documentation I saw referenced a post command to the PoE end point, but it
    wasn't clear how it works, if at all.

    I'd be grateful to see a curl command or anything if it's currently possible


  • 13.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP GURU
    Posted Apr 03, 2019 01:26 PM

    from the doc, yes it is possible

     

    You need to use uri : .../poe/ports/{PortPoe.port_id}/reset with HTTP method "POST"

     



  • 14.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    Posted Apr 03, 2019 02:18 PM

    Hmm... the only version of the API where I see that endpoint referenced in is from "Aruba REST API Guide for ArubaOSSwitch 16.05"

    https://support.hpe.com/hpsc/doc/public/display?docId=a00040422en_us

     

    Also, when you get to the end of the section it says:

    Note: Applicable only for ArubaOS-Switch 5400R.

     

    Are you looking at any other version of the OS or a different API doc?

    (Sorry this is my last question!) :D



  • 15.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP GURU
    Posted Apr 03, 2019 02:54 PM

    @tbig wrote:

    Hmm... the only version of the API where I see that endpoint referenced in is from "Aruba REST API Guide for ArubaOSSwitch 16.05"

    https://support.hpe.com/hpsc/doc/public/display?docId=a00040422en_us

     

    Also, when you get to the end of the section it says:

    Note: Applicable only for ArubaOS-Switch 5400R.

     

    Are you looking at any other version of the OS or a different API doc?

    (Sorry this is my last question!) :D


    There is some typo on this doc...

     

    You need to look : 16.08 REST API and JSON Schema (for example : https://h10145.www1.hpe.com/downloads/DownloadSoftware.aspx?SoftwareReleaseUId=24618&ProductNumber=JL557A&lang=&cc=&prodSeriesId=&SaidNumber= )



  • 16.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    Posted Apr 03, 2019 04:28 PM

    Just to close the loop - thanks, the link you provided was a huge help.

    We're on 16.03, and I don't see that reset method available (and I get a 404 error when trying it).  I do see it in the 16.08 schema, and we're likely to be upgrading soon to that, at which point I can test further.

     

    At any rate, thanks for clearing some of the fog. :D

     

     



  • 17.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP GURU
    Posted Apr 04, 2019 05:32 AM

    @tbig wrote:

    Just to close the loop - thanks, the link you provided was a huge help.

    We're on 16.03, and I don't see that reset method available (and I get a 404 error when trying it).  I do see it in the 16.08 schema, and we're likely to be upgrading soon to that, at which point I can test further.

     

    At any rate, thanks for clearing some of the fog. :D

     

     


    I need to check because i get same strange issue when try PoE reset API...



  • 18.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP GURU
    Posted May 11, 2019 02:02 AM

    a new release is available (0.8.0)

     

    What new ?

    14 new cmdlets !

    For Trunk, STP, PoE, IP Address (Get only)...

     

    There is also the support of AnyCli and cliBatch

    For example

     

     

    Get-ArubaSWCli -cmd "show running"

    and one of major feature of this release it is the support of multi-connection. it is possible to connect to multiple switch on same time using -connection parameter

     

     

    for example

     

    $sw1 = Connect-ArubaSW 192.168.0.1
    
    $sw2 = Connect-ArubaSW 192.168.0.2

    After for get vlans

     

     

     

    Get-ArubaSWVlans -connection $sw1
    
    Get-ArubaSWVlans -connection $sw2

    More info => https://github.com/PowerAruba/PowerArubaSW/releases/tag/v0.8.0

     



  • 19.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP
    Posted Aug 12, 2021 02:18 PM

    Hi alagoutte,

    thx for your work!

    I´m searching for a soltution, how I could disable all ports which have a vlan id untagged assigned, but I can´t figure out how to implement this...

    Any ideas? What I have is:

    $IP = 10.20.252.10
    Import-Module PowerArubaSW
    Connect-ArubaSW $IP
    $ports = Get-ArubaSWVlansPorts -vlan_id 300
    foreach ($port in $ports) {
    if ($port.port_mode -eq "POM_UNTAGGED") {
    Send-ArubaSWCliBatch -command "port $port.port_id", "disable"
    #Set-ArubaSWPort -port_id $port.port_id -is_port_enabled
    }
    }



    ------------------------------
    Matthias Pohl
    ------------------------------



  • 20.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    MVP GURU
    Posted Aug 18, 2021 03:22 PM
    Hi Matthias,

    look good... what don't work ?

    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCL: Powershell Module to use Aruba Central

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------



  • 21.  RE: PowerArubaSW : a powershell module for use ArubaOS Switch REST API

    0