Hi Guy,
if you display response and not raise_for_status ?
I write this small code using PowerShell (and PowerArubaMC) and work for me :
$body = @{
"partition_num" = "partition0"
}
Invoke-ArubaMCRestMethod -method POST -uri v1/configuration/object/config_boot_partition -body $body
i get the following output
config_boot_partition _global_result
--------------------- --------------
@{partition_num=partition0; _result=} @{status=0; status_str=Success; _pending=False}
and after launch reboot/reload without body
Invoke-ArubaMCRestMethod -method POST -uri v1/configuration/object/reload
there is no output... only need to wait 2/3 minutes and the controller is reload
------------------------------
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
------------------------------
Original Message:
Sent: Dec 21, 2023 05:27 AM
From: cauliflower
Subject: Set boot partition using AOS Rest API
Hello,
I'd like to set the boot partition on our controllers using the API (we have quite a lot of controllers so it's easiier than doing it by hand, and I'd prefer to use the API than script SSH CLI commands), but I'm not sure I can see a way of doing it. There's /object/config_boot_partition but the wording sounds a bit odd:
"Create a new instance or update existing instance or delete parts of the instance or full object of type config_boot_partition"
Will this do what I want? I tried it out and nothing happened but it's more than possible I'm doing something wrong (my Python scripting skills are pretty basic)?:
def set_ctlr_boot_partition(host,uid,part):
hostname = host
uidaruba = uid
part_num = str("partition"+part)
url = f"https://{hostname}:4343/v1/object/config_boot_partition"
payload = {
"verbose": True,
"test_type": "fast",
"partition_num": part_num
}
headers = {"Content-Type": "application/json",
"Accept" : "application/json",
"Cookie" : f"SESSION={uid}",
}
response = requests.request("POST", url, json=payload, headers=headers, verify=False)
print(response.raise_for_status())
return response
The API reference on the developer site doesn't seem to include this particular call so I can't verify my function is correct. response.raise_for_status() returns 'None'.
I'd also like to be able to reload controllers via the API, there's an /object/reload call but again the language is a bit ambiguous:
"Create a new instance or update existing instance or delete parts of the instance or full object of type reload"
Any advice appreciated.
Guy