face: process face_system.ether config section in EthernetFactory

This commit also fixes a potential memory access error in EthernetTransport.

refs #3904

Change-Id: I08296e7c6f1039b59b2859d277fc95326af34f52
diff --git a/tests/daemon/face/face-system-fixture.hpp b/tests/daemon/face/face-system-fixture.hpp
index 6bdbb41..2198c7e 100644
--- a/tests/daemon/face/face-system-fixture.hpp
+++ b/tests/daemon/face/face-system-fixture.hpp
@@ -26,6 +26,7 @@
 #ifndef NFD_TESTS_DAEMON_FACE_FACE_SYSTEM_FIXTURE_HPP
 #define NFD_TESTS_DAEMON_FACE_FACE_SYSTEM_FIXTURE_HPP
 
+#include "face/face.hpp"
 #include "face/face-system.hpp"
 #include "fw/face-table.hpp"
 
@@ -37,7 +38,7 @@
 
 using namespace nfd::tests;
 
-class FaceSystemFixture : public BaseFixture
+class FaceSystemFixture : public virtual BaseFixture
 {
 public:
   FaceSystemFixture()
@@ -82,6 +83,26 @@
     return *factory;
   }
 
+  /** \brief list faces of specified scheme from FaceTable
+   *  \param scheme local or remote FaceUri scheme
+   *  \param linkType if not NONE, filter by specified LinkType
+   */
+  std::vector<const Face*>
+  listFacesByScheme(const std::string& scheme,
+                    ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_NONE) const
+  {
+    std::vector<const Face*> faces;
+    for (const Face& face : faceTable) {
+      if ((face.getLocalUri().getScheme() == scheme ||
+           face.getRemoteUri().getScheme() == scheme) &&
+          (linkType == ndn::nfd::LINK_TYPE_NONE ||
+           face.getLinkType() == linkType)) {
+        faces.push_back(&face);
+      }
+    }
+    return faces;
+  }
+
 protected:
   ConfigFile configFile;
   FaceTable faceTable;