BMCWeb: Add SNMPinfo in redfish-NetworkProtocol
Add SNMP infomation in NetworkProtocol, contains version information, etc.
Teseted:
Tested on fp5280g2 (meta-inspur/meta-fp5280g2).
Currently only the SNMPv2 version is supported in the community,
so only v2 is set to true.
Ran Redfish validator successfully.
Signed-off-by: Xiaochao Ma <maxiaochao@inspur.com>
Change-Id: I983add2e24f16ea362d413a4fd3577ccfc2911d2
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 3d61274..d3d9580 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -190,7 +190,7 @@
void getData(const std::shared_ptr<AsyncResp>& asyncResp)
{
asyncResp->res.jsonValue["@odata.type"] =
- "#ManagerNetworkProtocol.v1_4_0.ManagerNetworkProtocol";
+ "#ManagerNetworkProtocol.v1_5_0.ManagerNetworkProtocol";
asyncResp->res.jsonValue["@odata.id"] =
"/redfish/v1/Managers/bmc/NetworkProtocol";
asyncResp->res.jsonValue["Id"] = "NetworkProtocol";
@@ -199,8 +199,29 @@
asyncResp->res.jsonValue["Status"]["Health"] = "OK";
asyncResp->res.jsonValue["Status"]["HealthRollup"] = "OK";
asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["SNMP"]["ProtocolEnabled"] = true;
+ asyncResp->res.jsonValue["SNMP"]["Port"] = 161;
+ asyncResp->res.jsonValue["SNMP"]["AuthenticationProtocol"] =
+ "CommunityString";
+ asyncResp->res.jsonValue["SNMP"]["CommunityAccessMode"] = "Full";
+ asyncResp->res.jsonValue["SNMP"]["HideCommunityStrings"] = true;
+ asyncResp->res
+ .jsonValue["SNMP"]["EngineId"]["EnterpriseSpecificMethod"] =
+ nullptr;
+ asyncResp->res.jsonValue["SNMP"]["EngineId"]["PrivateEnterpriseId"] =
+ nullptr;
+ asyncResp->res.jsonValue["SNMP"]["EnableSNMPv1"] = false;
+ asyncResp->res.jsonValue["SNMP"]["EnableSNMPv2c"] = true;
+ asyncResp->res.jsonValue["SNMP"]["EnableSNMPv3"] = false;
+ asyncResp->res.jsonValue["SNMP"]["EncryptionProtocol"] = "None";
+ nlohmann::json& memberArray =
+ asyncResp->res.jsonValue["SNMP"]["CommunityStrings"];
+ memberArray = nlohmann::json::array();
+ memberArray.push_back({{"AccessMode", "Full"}});
+ memberArray.push_back({{"CommunityString", ""}});
+ memberArray.push_back({{"Name", ""}});
- // HTTP is Mandatory attribute as per OCP Baseline Profile v1.0.0,
+ // HTTP is Mandatory attribute as per OCP Baseline Profile - v1.0.0,
// but from security perspective it is not recommended to use.
// Hence using protocolEnabled as false to make it OCP and security-wise
// compliant