|
Post by ginugeorge on Sept 5, 2023 9:16:59 GMT
We have certain queries wrt the Patch Request Body used for changing IPv4 from DHCP Mode to Static Mode for a Particular ethernet Interface and the expected outcome of the Patch Request.
Test Scenario 1 : Change IPv4 from DHCP to Static Mode by passing DHCPv4 -> DHCPEnabled attribute alone without specifying IPv4StaticAddresses attribute
PATCH https://{{ip}}/redfish/v1/Managers/bmc/EthernetInterfaces/eth0
{
"DHCPv4": {
"DHCPEnabled": false
}
}
Query: In this test scenario, whether we need to change IPv4 from DHCP Mode to Static Mode ? If so, since no IPv4 Static Addresses are configured, can we take the DHCP IPv4 Address and apply it as the IPv4 Static Address ? or else, we need to ask the user to pass the values for the IPv4StaticAddresses attribute also ?
Test Scenario 2 : Change IPv4 from DHCP to Static Mode by passing IPv4StaticAddresses attribute alone without specifying DHCPv4 -> DHCPEnabled attribute
PATCH https://{{ip}}/redfish/v1/Managers/bmc/EthernetInterfaces/eth0
{
"IPv4StaticAddresses": [ { "Address": "172.31.3.151", "Gateway": "172.31.0.1", "SubnetMask": "255.255.240.0" } ]
}
Query: In this test scenario, since user has already passed the values for the IPv4StaticAddresses attribute, whether we need to change IPv4 from DHCP Mode to Static Mode ? or else, we need to ask the user to pass the values for the DHCPv4 -> DHCPEnabled attribute also to change the interface to Static Mode ?
|
|
|
Post by mraineri on Sept 5, 2023 13:16:40 GMT
In "Test Scenario 1", when you disable DHCP and there are no static addresses defined, "IPv4Addresses" would be an empty array since there's nothing configured on the interface. I wouldn't expect the DHCP addresses to be used since DHCP is no longer enabled. Some people I know do this intentionally as a way to not have any addresses assigned on the interface.
In "Test Scenario 2", since you're not disabling DHCP, the DHCP addresses will still be active. However, the interface has static addresses stored so that when DHCP is eventually disabled, it will have static addresses to assign to the interface.
|
|
|
Post by ginugeorge on Sept 5, 2023 17:27:06 GMT
Suppose the BMC has only one interface, say eth0 and the user passes only DHCPv4" -> "DHCPEnabled" attribute as false,
in that case, you mean to say that since there are no static addresses defined by the user, "IPv4Addresses" will be an empty array and the interface eth0 will not be reachable after that ? In other words, BMC will no longer be accessible ?
|
|
|
Post by mraineri on Sept 5, 2023 17:52:32 GMT
That's right. A good manager would either reject the request with the knowledge that it'll be forever stuck in that configuration, or there might be another method for configuration of the interface (such as some sort of in-band path between the host and BMC). However, I've certainly seen cases where a BMC isn't proactive about these things and does allow its configuration to become wedged like that. Ultimately this aspect is going to be dictated based on the design of the system and what is/isn't allowed.
It's also worth keeping in mind the interface could still have IPv6 addresses assigned to it, so wiping out IPv4 addresses may not necessarily make it inaccessible.
|
|
|
Post by ginugeorge on Sept 5, 2023 18:47:51 GMT
So for Test Scenario 1, can we conclude that when the user passes only DHCPv4" -> "DHCPEnabled" attribute as false and does not pass any values for IPv4StaticAddresses attribute,
We can throw 400 Bad Request with an error response that indicates that "IPv4StaticAddresses is a required property and must be included in the request body"
Also, for Test Scenario 2, when the user passes IPv4StaticAddresses attribute alone without specifying DHCPv4 -> DHCPEnabled attribute, and the IPv4StaticAddresses array is limited internally to have only one object within it(i.e. We can configure only one Static v4 IP for an interface),
can we internally change IPv4 from DHCP to Static Mode and apply the IPv4StaticAddresses on the interface ? In that way, the user can avoid an additional PATCH request of sending "DHCPv4" -> "DHCPEnabled" attribute as false. Or the flow should be like, since we're not disabling DHCP, the DHCP addresses will still be active. In other words, whether it can be implementation specific ?
|
|
|
Post by mraineri on Sept 5, 2023 20:05:11 GMT
So for Test Scenario 1, can we conclude that when the user passes only DHCPv4" -> "DHCPEnabled" attribute as false and does not pass any values for IPv4StaticAddresses attribute, We can throw 400 Bad Request with an error response that indicates that "IPv4StaticAddresses is a required property and must be included in the request body" That's an option, especially if you only have one interface to configure this info, and only support IPv4. Just remember some users might want to really clear out all addressing on the interface, especially if their desire is to only have IPv6 addresses. Also, for Test Scenario 2, when the user passes IPv4StaticAddresses attribute alone without specifying DHCPv4 -> DHCPEnabled attribute, and the IPv4StaticAddresses array is limited internally to have only one object within it(i.e. We can configure only one Static v4 IP for an interface), can we internally change IPv4 from DHCP to Static Mode and apply the IPv4StaticAddresses on the interface ? In that way, the user can avoid an additional PATCH request of sending "DHCPv4" -> "DHCPEnabled" attribute as false. Or the flow should be like, since we're not disabling DHCP, the DHCP addresses will still be active. In other words, whether it can be implementation specific ? No, I'd advise against that; disabling DHCP when the user did not request this would likely cause confusion. A user could always send both the static addresses and disable DHCP in a single request, but I've also seen users do this as a two-step sequence to ensure the interface is queued up with the desired addresses before disabling DHCP.
|
|