Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: add support for firmware uploads #138

Open
LRSFC-DanJ opened this issue Apr 5, 2024 · 4 comments
Open

Feature request: add support for firmware uploads #138

LRSFC-DanJ opened this issue Apr 5, 2024 · 4 comments

Comments

@LRSFC-DanJ
Copy link

PowerArubaSW currently doesn't provide a command that can do firmware uploads to HP/Aruba AOS-S switches.

The process for doing this using the REST API is described on the HPE website here:
https://support.hpe.com/hpesc/public/docDisplay?docId=sf000095706en_us&docLocale=en_US

It would be great if this could be added as this would be a step towards being able to script/schedule switch updates in bulk.

@alagoutte
Copy link
Collaborator

Hi @LRSFC-DanJ,

Yes...
You can try this : (work me)

$body = @{
    "url"        = "http://192.168.244.48/YA_16_11_0016.swi"
    "file_type"  = "FTT_FIRMWARE"
    "action"     = "FTA_DOWNLOAD"
    "boot_image" = "BI_PRIMARY_IMAGE"
}
Invoke-ArubaSWWebRequest -method POST -body $body -uri "file-transfer"

and for Check status

(Invoke-ArubaSWWebRequest -method GET -uri "file-transfer/status").content

For example :

$body = @{
    "url"        = "http://192.168.244.48/YA_16_11_0016.swi"
    "file_type"  = "FTT_FIRMWARE"
    "action"     = "FTA_DOWNLOAD"
    "boot_image" = "BI_PRIMARY_IMAGE"
}
Invoke-ArubaSWWebRequest -method POST -body $body -uri "file-transfer"
                                                                                                                        
StatusCode        : 202
StatusDescription : Accepted
Content           : {"message":"File transfer initiated"}
RawContent        : HTTP/1.1 202 Accepted
                    Server: eHTTP
                    Server: v2.0
                    Connection: close
                    Transfer-Encoding: chunked
                    RequestId: 
                    Content-Type: application/json
                    
                    {"message":"File transfer initiated"}
Headers           : {[Server, System.String[]], [Connection, System.String[]], [Transfer-Encoding, System.String[]], [RequestId, System.String[]]…}
Images            : {}
InputFields       : {}
Links             : {}
RawContentLength  : 37
RelationLink      : {}

(Invoke-ArubaSWWebRequest -method GET -uri "file-transfer/status").content
{"uri":"/file-transfer/status","status":"FTS_IN_PROGRESS","result":"File transfer still in progress"}   

#retry after some seconds/minutes...
(Invoke-ArubaSWWebRequest -method GET -uri "file-transfer/status").content
{"uri":"/file-transfer/status","status":"FTS_COMPLETED"}

I accept with pleasure patch for adding cmdlet for this :)

@LRSFC-DanJ
Copy link
Author

Thank you, this is actually really helpful as I didn't know there was an API function to check the file transfer status (finding documentation about this API seems really difficult for some reason).

@LRSFC-DanJ
Copy link
Author

Do you happen to know what software version is required for the file-transfer/status API endpoint to be available? As it doesn't seem to be present on the software version installed on our switches at the moment, sadly.

@alagoutte
Copy link
Collaborator

Do you happen to know what software version is required for the file-transfer/status API endpoint to be available? As it doesn't seem to be present on the software version installed on our switches at the moment, sadly.

What your switch model and firmware ?
(and max supported api version when you connect ?)

You can look this for doc about API :
https://networkingsupport.hpe.com/downloads/software/RmlsZTo3OTI3NTc5Mi00YzQ5LTExZWQtOTUxMy04Yjg1M2I4ZWYxMDk%3D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants