face: unicast support in EthernetFactory
Change-Id: I1886a87d79a7194b3320a5417404b17a7290fa5d
Refs: #4012
diff --git a/tests/daemon/face/ethernet-factory.t.cpp b/tests/daemon/face/ethernet-factory.t.cpp
index 5e7c6d2..953a35f 100644
--- a/tests/daemon/face/ethernet-factory.t.cpp
+++ b/tests/daemon/face/ethernet-factory.t.cpp
@@ -326,25 +326,44 @@
EthernetFactory factory;
createFace(factory,
- FaceUri("ether://[08:00:27:01:01:01]"),
- {},
- ndn::nfd::FACE_PERSISTENCY_PERMANENT,
- false,
- {CreateFaceExpectedResult::FAILURE, 406, "Unsupported protocol"});
-
- createFace(factory,
- FaceUri("ether://[08:00:27:01:01:01]"),
- {},
- ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
- false,
- {CreateFaceExpectedResult::FAILURE, 406, "Unsupported protocol"});
-
- createFace(factory,
- FaceUri("ether://[08:00:27:01:01:01]"),
+ FaceUri("ether://[00:00:5e:00:53:5e]"),
{},
ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
false,
- {CreateFaceExpectedResult::FAILURE, 406, "Unsupported protocol"});
+ {CreateFaceExpectedResult::FAILURE, 406,
+ "Creation of unicast Ethernet faces requires a LocalUri with dev:// scheme"});
+
+ createFace(factory,
+ FaceUri("ether://[00:00:5e:00:53:5e]"),
+ FaceUri("udp4://127.0.0.1:20071"),
+ ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+ false,
+ {CreateFaceExpectedResult::FAILURE, 406,
+ "Creation of unicast Ethernet faces requires a LocalUri with dev:// scheme"});
+
+ createFace(factory,
+ FaceUri("ether://[00:00:5e:00:53:5e]"),
+ FaceUri("dev://eth0"),
+ ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
+ false,
+ {CreateFaceExpectedResult::FAILURE, 406,
+ "Outgoing Ethernet faces do not support on-demand persistency"});
+
+ createFace(factory,
+ FaceUri("ether://[01:00:5e:90:10:5e]"),
+ FaceUri("dev://eth0"),
+ ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+ false,
+ {CreateFaceExpectedResult::FAILURE, 406,
+ "Cannot create multicast Ethernet faces"});
+
+ createFace(factory,
+ FaceUri("ether://[00:00:5e:00:53:5e]"),
+ FaceUri("dev://eth0"),
+ ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+ true,
+ {CreateFaceExpectedResult::FAILURE, 406,
+ "Local fields can only be enabled on faces with local scope"});
}
BOOST_AUTO_TEST_SUITE_END() // TestEthernetFactory
diff --git a/tests/daemon/face/tcp-factory.t.cpp b/tests/daemon/face/tcp-factory.t.cpp
index d3f5fc9..7f93d78 100644
--- a/tests/daemon/face/tcp-factory.t.cpp
+++ b/tests/daemon/face/tcp-factory.t.cpp
@@ -204,25 +204,39 @@
BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate)
{
TcpFactory factory;
-
factory.createChannel("127.0.0.1", "20071");
- factory.createChannel("127.0.0.1", "20072");
createFace(factory,
+ FaceUri("tcp4://127.0.0.1:20072"),
FaceUri("tcp4://127.0.0.1:20071"),
+ ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+ false,
+ {CreateFaceExpectedResult::FAILURE, 406,
+ "Unicast TCP faces cannot be created with a LocalUri"});
+
+ createFace(factory,
+ FaceUri("tcp4://127.0.0.1:20072"),
{},
ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
false,
{CreateFaceExpectedResult::FAILURE, 406,
- "Outgoing TCP faces do not support on-demand persistency"});
+ "Outgoing TCP faces do not support on-demand persistency"});
createFace(factory,
- FaceUri("tcp4://127.0.0.1:20072"),
- FaceUri("tcp4://127.0.0.1:20073"),
+ FaceUri("tcp4://127.0.0.1:20071"),
+ {},
ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
false,
{CreateFaceExpectedResult::FAILURE, 406,
- "Unicast TCP faces cannot be created with a LocalUri"});
+ "Requested endpoint is prohibited"});
+
+ createFace(factory,
+ FaceUri("tcp4://198.51.100.100:6363"),
+ {},
+ ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+ true,
+ {CreateFaceExpectedResult::FAILURE, 406,
+ "Local fields can only be enabled on faces with local scope"});
}
class FaceCreateTimeoutFixture : public BaseFixture
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
index 3270ad6..9677abe 100644
--- a/tests/daemon/face/udp-factory.t.cpp
+++ b/tests/daemon/face/udp-factory.t.cpp
@@ -635,25 +635,47 @@
BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate)
{
UdpFactory factory;
-
factory.createChannel("127.0.0.1", "20071");
- factory.createChannel("127.0.0.1", "20072");
createFace(factory,
+ FaceUri("udp4://127.0.0.1:20072"),
FaceUri("udp4://127.0.0.1:20071"),
+ ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+ false,
+ {CreateFaceExpectedResult::FAILURE, 406,
+ "Unicast UDP faces cannot be created with a LocalUri"});
+
+ createFace(factory,
+ FaceUri("udp4://127.0.0.1:20072"),
{},
ndn::nfd::FACE_PERSISTENCY_ON_DEMAND,
false,
{CreateFaceExpectedResult::FAILURE, 406,
- "Outgoing unicast UDP faces do not support on-demand persistency"});
+ "Outgoing UDP faces do not support on-demand persistency"});
createFace(factory,
- FaceUri("udp4://127.0.0.1:20072"),
- FaceUri("udp4://127.0.0.1:20073"),
+ FaceUri("udp4://233.252.0.1:23252"),
+ {},
ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
false,
{CreateFaceExpectedResult::FAILURE, 406,
- "Unicast UDP faces cannot be created with a LocalUri"});
+ "Cannot create multicast UDP faces"});
+
+ createFace(factory,
+ FaceUri("udp4://127.0.0.1:20071"),
+ {},
+ ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+ false,
+ {CreateFaceExpectedResult::FAILURE, 406,
+ "Requested endpoint is prohibited"});
+
+ createFace(factory,
+ FaceUri("udp4://127.0.0.1:20072"),
+ {},
+ ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+ true,
+ {CreateFaceExpectedResult::FAILURE, 406,
+ "Local fields can only be enabled on faces with local scope"});
}
class FakeNetworkInterfaceFixture : public BaseFixture