HewlettPackard / python-redfish-utility

Python-based utility for interacting with devices supporting a Redfish Service
Other
86 stars 41 forks source link

Syntax to set IPv4StaticAddresses array ? #32

Closed donzef closed 2 years ago

donzef commented 3 years ago

What is the syntax to set the first element of the IPv4StaticAddresses array ? I tried multiple variants of the following but failed with ilorest 3.1.1 against iLO 5 2.30:

ad='"Address": "16.31.87.100"'
nm='"SubnetMask": "255.255.252.0"'
gtw='"Gateway": "16.31.84.1"'

ilorest select EthernetInterface
ilorest set --filter  "Name"="Manager Dedicated Network Interface" IPv4StaticAddresses="[{${ad}, ${nm}, ${gtw}}]"

As a result, the array is wrongly filled up with 3 elements, like in the attached picture.

image

sahanaramavana commented 2 years ago

Hi @donzef ,

Kindly try the below IPv4StaticAddresses=f"[{{ {ad}, {nm}, {gtw} }}]" if pyhton 3 IPv4StaticAddresses="[{{ {}, {}, {} }}]".format(ad,nm,gtw) if python 2

here assumption is that IPv4StaticAddresses is sent in string format .

Thanks & Regards, iLORest Team

ralfgro commented 2 years ago

I'm also struggling with setting a static IP to an ILO. Can someone please show a working example? I failed to find one. There are some example but none that really goes to the end.

How should I use the example above with HPEs ilorest tool? Why is it so hard to set a static ILO IP with this tool? No working example anywhere.

IPv4StaticAddresses=f"[{{ {ad}, {nm}, {gtw} }}]" if pyhton 3

select EthernetInterface.v1_4_1
get IPv4Addresses --filter "@odata.id=/redfish/v1/Managers/1/EthernetInterfaces/1/"

IPv4StaticAddresses=
                     SubnetMask=255.255.255.0
                     Gateway=172.17.21.1
                     Address=172.17.21.34

 set IPv4StaticAddresses=172.17.21.34 --filter "@odata.id=/redfish/v1/Managers/1/EthernetInterfaces/1/"
'172.17.21.34' is not a valid setting for 'IPv4StaticAddresses', expecting an array

'172.17.21.34' is not a valid setting for 'IPv4StaticAddresses'

set IPv4StaticAddresses=f"[{{ {172.17.21.34}, {255.255.255.0}, {172.17.21.1} }}] --filter "@odata.id=/redfish/v1/Managers/1/EthernetInterfaces/1/"
'f"[{{' is not a valid setting for 'IPv4StaticAddresses', expecting an array

'f"[{{' is not a valid setting for 'IPv4StaticAddresses'