face: use NetworkMonitor in EthernetFactory

EthernetFactory now creates unicast channels and multicast faces
on eligible netifs found by NetworkMonitor. However,
EthernetFactory does not yet react to fine-grained signals from
NetworkMonitor.

refs #4021

Change-Id: I58aac67d5a1b00d3cda76e78627b887f93ffa541
diff --git a/tests/daemon/face/face-system-fixture.hpp b/tests/daemon/face/face-system-fixture.hpp
index b6143d4..530b8e1 100644
--- a/tests/daemon/face/face-system-fixture.hpp
+++ b/tests/daemon/face/face-system-fixture.hpp
@@ -32,6 +32,7 @@
 #include "fw/face-table.hpp"
 
 #include "tests/test-common.hpp"
+#include "test-netif-ip.hpp"
 #include <ndn-cxx/net/network-monitor-stub.hpp>
 
 namespace nfd {
@@ -50,6 +51,31 @@
     faceSystem.setConfigFile(configFile);
   }
 
+  /** \brief Copy a snapshot of NetworkInterface information to \p netmon
+   *  \pre netmon contains no NetworkInterface
+   */
+  void
+  copyRealNetifsToNetmon()
+  {
+    BOOST_ASSERT(netmon->listNetworkInterfaces().empty());
+    for (const auto& netif : collectNetworkInterfaces()) {
+      auto copy = netmon->makeNetworkInterface();
+      copy->setIndex(netif->getIndex());
+      copy->setName(netif->getName());
+      copy->setType(netif->getType());
+      copy->setFlags(netif->getFlags());
+      copy->setState(netif->getState());
+      copy->setMtu(netif->getMtu());
+      copy->setEthernetAddress(netif->getEthernetAddress());
+      copy->setEthernetBroadcastAddress(netif->getEthernetBroadcastAddress());
+      for (const auto& na : netif->getNetworkAddresses()) {
+        copy->addNetworkAddress(na);
+      }
+      netmon->addInterface(copy);
+    }
+    netmon->emitEnumerationCompleted();
+  }
+
   void
   parseConfig(const std::string& text, bool isDryRun)
   {