dell / iDRAC-Redfish-Scripting

Python and PowerShell scripting for Dell EMC PowerEdge iDRAC REST API with DMTF Redfish
GNU General Public License v2.0
609 stars 279 forks source link

Set-IdracLcSystemAttributesREDFISH IPv4.1.Gateway not applied #178

Closed oliverwolfat closed 3 years ago

oliverwolfat commented 3 years ago

Hardware: Dell PowerEdge R740 Dell PowerEdge R7515 (iDrac9-Version: 5.00.00.00)

PSVersionTable: Name Value


PSVersion 5.1.17763.1852
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1852
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Latest Commit Uppon Download: 0e30fe18e3dbdb05ffe6bacf26e9e93016ea8840

Script:

#Variables (actually feed via json, the three lines below just show which value they have before the actual command) 
$server.iDRAC_StaticHostIP = "10.130.1.143"
$server.iDRAC_Gateway = "10.130.1.254"
$server.iDRAC_Subnet = "255.255.255.0"

# Set Network Configuration (IPv4,Gateway,Subnet)
   $iDRAC_settings= "IPv4.1.DHCPEnable:Disabled|IPv4.1.Address:$($server.iDRAC_StaticHostIP)|IPv4.1.Gateway:$($server.iDRAC_Gateway)|IPv4.1.Netmask:$($server.iDRAC_Subnet)"
   Set-Content "$configPath\multiple_idrac_lc_system_attributes.txt" $iDRAC_settings
   Set-IdracLcSystemAttributesREDFISH -attribute_group idrac -idrac_ip $server.iDRAC_DhcpIP -idrac_password $server.iDRAC_DefaultPW -idrac_username root -file_path $configPath

Expected behavior: iDRac_IPv4

Actual behavior: iDRac_IPv4_actual

Description: Somehow the gateway has a static value anywhere in the API of iDRAC. I checked my script and also the module i used, none of them set it to this value, which raises the question, where the entry comes from. DISCLAIMER: I had to manually create the screenshot with the value i saw, because at the time i faced it i did not thought it might be a iDRAC or REDFISH issue but more a issue with my own script.

oliverwolfat commented 3 years ago

I just deployed a second Dell Server (PowerEdge R7515), i faced a similar issue. The selected value for the Default Gateway was once again ignored and set to 192.168.0.1 Additionally the iDrac Static IP i selected was ignored and instead set to 192.168.0.120

texroemer commented 3 years ago

Hi @lupuscon

For configuring iDRAC static IP address, gateway and subnet, you must use attributes:

IPv4Static.1.Address IPv4Static.1.Netmask IPv4Static.1.Gateway

See example below where i disabled DHCP and set static network for iDRAC, confirmed attributes were changed using RACADM.

PS C:\Users\administrator> Set-IdracLcSystemAttributesREDFISH -idrac_ip 100.65.84.160 -idrac_username root -idrac_password calvin -attribute_group idrac -file_path C:\Users\administrator\Documents\WindowsPowerShell\Modules\Set-IdracLcSystemAttributesREDFISH

- WARNING, attribute IPv4Static.1.Address current value is: 192.168.0.120, setting new value to: 100.65.84.30
- WARNING, attribute IPv4.1.DHCPEnable current value is: Enabled, setting new value to: Disabled
- WARNING, attribute IPv4Static.1.Netmask current value is: 255.255.255.0, setting new value to: 255.255.255.0
- WARNING, attribute IPv4Static.1.Gateway current value is: 192.168.0.254, setting new value to: 100.65.84.254

- PASS, statuscode 200 returned to successfully set "IDRAC" attributes

- PASS, statuscode 200 returned successfully to get "IDRAC" attributes

- PASS, attribute IPv4Static.1.Address current value is successfully set to: 100.65.84.30
- PASS, attribute IPv4.1.DHCPEnable current value is successfully set to: Disabled
- PASS, attribute IPv4Static.1.Netmask current value is successfully set to: 255.255.255.0
- PASS, attribute IPv4Static.1.Gateway current value is successfully set to: 100.65.84.254
PS C:\Users\administrator> racadm -r 100.65.84.30 -u root -p calvin get idrac.ipv4static --nocertwarn
[Key=idrac.Embedded.1#IPv4Static.1]
Address=100.65.84.30
DNS1=192.168.0.120
DNS2=192.168.0.130
DNSFromDHCP=Disabled
Gateway=100.65.84.254
Netmask=255.255.255.0
oliverwolfat commented 3 years ago

Hi @texroemer

Thank you for the hint, i did not notice these values exist.

KR Oliver