Enable Fist Boot Set MAC Feature for Network Service
- This commit enables the Network Service to listen for
the Added inventory objects & set the MAC address respectively
on the ethernet interfaces on the first boot.
- An Early start to Inventory Manager service can also drop the
Objects Added Signal, in those cases the Network Serice would
read the Inventory Objects and sets the MAC during First Boot
and does not register for Signal matchers to Wait for the Objects
to be Added.
- Through this commit, Network Service can now also set the MAC
addresses at Runtime(if the Inventory Objects are Added at Runtime).
This would help in case of MultiNode systems with Concurrent
maintainence.
- The Mapping of the ethernet Interfaces on Network Service and
the Inventory objects are configured by the administator via a
machine specific config.json file.
Tested By :
- Clear the VPD and Boot the System and observed that Network
service registers a Signal which listens on the Object Added
on the Inventory Manager.
- Force Collect the VPD , and that should trigger a MATCH on the
Network service there by setting the MAC Addresses based in the
Signals received on various interfaces.
- Once the MAC is read from the VPD and set on the repective Interface,
a restart of Network Service should not set the MAC Address again.
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: If06e79e6381933e58ad552bbd7dbb61fe852384b
diff --git a/network_manager.hpp b/network_manager.hpp
index 80d017e..c9f95b3 100644
--- a/network_manager.hpp
+++ b/network_manager.hpp
@@ -112,6 +112,20 @@
/** @brief restart the network timers. */
void restartTimers();
+ /** @brief This function gets the MAC address from the VPD and
+ * sets it on the corresponding ethernet interface during first
+ * Boot, once it sets the MAC from VPD, it creates a file named
+ * firstBoot under /var/lib to make sure we dont run this function
+ * again.
+ *
+ * @param[in] ethPair - Its a pair of ethernet interface name & the
+ * corresponding MAC Address from the VPD
+ *
+ * return - NULL
+ */
+ void setFistBootMACOnInterface(
+ const std::pair<std::string, std::string>& ethPair);
+
/** @brief Restart the systemd unit
* @param[in] unit - systemd unit name which needs to be
* restarted.