Make services not required

The recent change to NetworkProtocols has now made particular services
"required" to exist in an image.  This corrects it to properly check for
the "process doesn't exist" error code, and bail out early without
setting an internal error.

As pointed out in one of the early reviews, this logic can also be
simplified and moved, so this code also moves the early property filling
code.

This allows deploying systems without IPMI, and have them function
correctly.

Tested:
Loaded in qemu without IPMI present, did not receive 500 on:
curl -vvvv --insecure --user root:0penBmc
"https://192.168.7.2/redfish/v1/Managers/bmc/NetworkProtocol"

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I0a8eb687826d055b4eb43ca53120f39c21934b36
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 0fd6eba..a9f5005 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -123,13 +123,6 @@
     asyncResp->res.jsonValue["HTTP"]["Port"] = 0;
     asyncResp->res.jsonValue["HTTP"]["ProtocolEnabled"] = false;
 
-    for (auto& protocol : protocolToDBus)
-    {
-        asyncResp->res.jsonValue[protocol.first]["Port"] =
-            nlohmann::detail::value_t::null;
-        asyncResp->res.jsonValue[protocol.first]["ProtocolEnabled"] = false;
-    }
-
     std::string hostName = getHostName();
 
     asyncResp->res.jsonValue["HostName"] = hostName;
@@ -184,6 +177,15 @@
             [asyncResp, protocolName](const boost::system::error_code ec,
                                       const std::string& socketPath,
                                       bool isProtocolEnabled) {
+                // If the service is not installed, that is not an error
+                if (ec == boost::system::errc::no_such_process)
+                {
+                    asyncResp->res.jsonValue[protocolName]["Port"] =
+                        nlohmann::detail::value_t::null;
+                    asyncResp->res.jsonValue[protocolName]["ProtocolEnabled"] =
+                        false;
+                    return;
+                }
                 if (ec)
                 {
                     messages::internalError(asyncResp->res);