diff options
author | Tony Lee <tony.lee@quantatw.com> | 2020-05-22 08:46:51 +0300 |
---|---|---|
committer | Tony Lee <tony.lee@quantatw.com> | 2020-06-03 04:08:38 +0300 |
commit | dc3fbbd0b0021ae888a97bf48a62f30129fc3f4d (patch) | |
tree | 5eacddbdf3425cc2e93f6757264833e1a014d42f /redfish-core/lib/network_protocol.hpp | |
parent | 2a5c4407937e8e7bcfb6fc6b874baac835e4e813 (diff) | |
download | bmcweb-dc3fbbd0b0021ae888a97bf48a62f30129fc3f4d.tar.xz |
Fix duplicate NTP servers patch
Duplicate NTP servers value should not be patch.
Tested:
1. Patch duplicate NTP servers
curl -k -H "X-Auth-Token: $bmc_token" -XPATCH https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol -d '{"NTP":{"NTPServers":["9.9.9.9","9.9.9.9","1.1.1.1","9.9.9.9"]}}'
2. GET NTP servers information
curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol
{
"@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol",
"@odata.type": "#ManagerNetworkProtocol.v1_5_0.ManagerNetworkProtocol",
"Description": "Manager Network Service",
"FQDN": "",
"HTTP": {
"Port": 0,
"ProtocolEnabled": false
},
"HTTPS": {
"Certificates": {
"@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates"
},
"Port": 443,
"ProtocolEnabled": true
},
"HostName": "",
"IPMI": {
"Port": 623,
"ProtocolEnabled": true
},
"Id": "NetworkProtocol",
"NTP": {
"NTPServers": [
"1.1.1.1",
"9.9.9.9"
],
"ProtocolEnabled": false
},
Signed-off-by: Tony Lee <tony.lee@quantatw.com>
Change-Id: Idb63cf5e28d36a5df1aae9b0a7d53a1b7a9c8d91
Diffstat (limited to 'redfish-core/lib/network_protocol.hpp')
-rw-r--r-- | redfish-core/lib/network_protocol.hpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp index a2ae1ea0f5..2ce952d83c 100644 --- a/redfish-core/lib/network_protocol.hpp +++ b/redfish-core/lib/network_protocol.hpp @@ -460,6 +460,11 @@ class NetworkProtocol : public Node if (ntpServers) { + std::sort((*ntpServers).begin(), (*ntpServers).end()); + (*ntpServers) + .erase( + std::unique((*ntpServers).begin(), (*ntpServers).end()), + (*ntpServers).end()); handleNTPServersPatch(*ntpServers, asyncResp); } } |