openbmc / bmcweb

A do everything Redfish, KVM, GUI, and DBus webserver for OpenBMC
Apache License 2.0
162 stars 134 forks source link

Unable to configure hostname using redfish #44

Closed prkatti1 closed 5 years ago

prkatti1 commented 5 years ago

PATCH is giving 405 method not allowed. PUT is giving 200OK but hostname is not getting changed. bash-4.1$ curl -k -H "X-Auth-Token: $bmc_token" -X PATCH -D patch.txt -d '{"HostName": "bmcbmc"}' https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol Method Not Allowedbash-4.1$ cat patch.txt HTTP/1.1 405 Method Not Allowed Strict-Transport-Security: max-age=31536000; includeSubdomains; preload X-Frame-Options: DENY Pragma: no-cache Cache-Control: no-Store,no-Cache Content-Security-Policy: default-src 'self' X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff X-UA-Compatible: IE=11 Server: iBMC Date: Fri, 15 Feb 2019 11:05:15 GMT Content-Length: 18

bash-4.1$ curl -k -H "X-Auth-Token: $bmc_token" -X PUT -D put.txt -d '{"HostName": "bmcbmc"}' https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol

bash-4.1$ cat put.txt HTTP/1.1 200 OK Strict-Transport-Security: max-age=31536000; includeSubdomains; preload X-Frame-Options: DENY Pragma: no-cache Cache-Control: no-Store,no-Cache Content-Security-Policy: default-src 'self' X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff X-UA-Compatible: IE=11 Server: iBMC Date: Fri, 15 Feb 2019 11:05:47 GMT Content-Length: 0

bash-4.1$ curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol { "@odata.context": "/redfish/v1/$metadata#ManagerNetworkProtocol.ManagerNetworkProtocol", "@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol", "@odata.type": "#ManagerNetworkProtocol.v1_1_0.ManagerNetworkProtocol", "Description": "Manager Network Service", "HTTPS": { "ProtocolEnabled": false }, "HostName": "witherspoon", "IPMI": { "Port": 623, "ProtocolEnabled": false }, "Id": "NetworkProtocol", "Name": "Manager Network Protocol", "SSH": { "Port": 22, "ProtocolEnabled": false }, "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled"

prkatti1 commented 5 years ago

@edtanous could you Pls take a look at it.

edtanous commented 5 years ago

Are you having trouble understanding the code for this functionality? I don’t see any specific requests on what you need help with, so I’m at a bit of a loss on how I can help you triage this without just debugging it for you. I don’t know any specifics of how this code works beyond just looking at the code.

ratagupt commented 5 years ago

@edtanous https://github.com/openbmc/bmcweb/blob/master/redfish-core/lib/network_protocol.hpp Seems we need to mark it as an enhancement as we don't have PATCH support here.

I would we working with somebody from IBM to work on it.

maximyep commented 5 years ago

Hostname update could be done using:

curl -X PATCH -k -H 'Authorization: Basic cm9vdDowcGVuQm1j' -i 'https://192.168.122.52/redfish/v1/Managers/bmc/EthernetInterfaces/eth0' --data '{"HostName": "HelloBMC"}'

2019-03-12 16_31_38-myepanes-bmc  Running  - Oracle VM VirtualBox

prkatti1 commented 5 years ago

It is working on latest master build. So closing this issue.