Cache system GUID in netipmid

GUID is used in the IPMI session setup steps RAKP12 and RAKP34.
The GUID is read from the DBUS property. It is observed that
when the host is booting, reading the GUID takes a significant
delay and the session setup fails with ipmitool. Since GUID doesn't
change for a machine, it is safe to cache GUID in the netipmid and
speed up the session setup.

Resolves openbmc/openbmc#1812
Resolves openbmc/openbmc#2245
Resolves openbmc/openbmc#2246

Change-Id: I78c993b3e5ef8b6764457c8fdb3ecb985b965c0c
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/main.cpp b/main.cpp
index 842f098..ef4a349 100644
--- a/main.cpp
+++ b/main.cpp
@@ -12,6 +12,7 @@
 #include <systemd/sd-event.h>
 
 #include <host-ipmid/ipmid-api.h>
+#include "command/guid.hpp"
 #include "comm_module.hpp"
 #include "command_table.hpp"
 #include "message.hpp"
@@ -66,6 +67,11 @@
         goto finish;
     }
 
+    // Register callback to update cache for a GUID change and cache the GUID
+    command::registerGUIDChangeCallback();
+    cache::guid = command::getSystemGUID();
+
+
     // Register all the IPMI provider libraries applicable for net-ipmid
     provider::registerCallbackHandlers(NET_IPMID_LIB_PATH);