face: use IncomingFaceId, NextHopFaceId, CachePolicy tags
This commit replaces all LocalControlHeader usages with these tags,
and deletes LocalFace.
This commit also does minor improvements in RIB test suites.
refs #3339
Change-Id: I14cbfc296a6723a5860bf8bd95d9804d3bac3da5
diff --git a/tests/daemon/mgmt/face-manager.t.cpp b/tests/daemon/mgmt/face-manager.t.cpp
index 8e4da1f..02bcd78 100644
--- a/tests/daemon/mgmt/face-manager.t.cpp
+++ b/tests/daemon/mgmt/face-manager.t.cpp
@@ -149,86 +149,6 @@
BOOST_CHECK_EQUAL(addedFace->getId(), -1);
}
-BOOST_AUTO_TEST_CASE(EnableDisableLocalControl)
-{
- auto nonLocalFace = addFace<DummyFace>(true); // clear notification
- auto localFace = addFace<DummyLocalFace>(true); // clear notification
- BOOST_CHECK(localFace->isLocal());
- BOOST_CHECK(!nonLocalFace->isLocal());
-
- std::vector<Name> commandNames;
- auto testLocalControl = [&] (const Name& name, const ControlParameters& params, uint64_t faceId) {
- auto command = makeControlCommandRequest(name, params,
- [faceId] (shared_ptr<Interest> interest) {
- interest->setIncomingFaceId(faceId);
- });
- receiveInterest(command);
- commandNames.push_back(command->getName());
- };
-
- auto paramsF = ControlParameters().setLocalControlFeature(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID);
- auto paramsN = ControlParameters().setLocalControlFeature(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID);
-
- // non-existing face: 0~3
- testLocalControl("/localhost/nfd/faces/enable-local-control", paramsF, FACEID_NULL);
- testLocalControl("/localhost/nfd/faces/disable-local-control", paramsF, FACEID_NULL);
- testLocalControl("/localhost/nfd/faces/enable-local-control", paramsN, FACEID_NULL);
- testLocalControl("/localhost/nfd/faces/disable-local-control", paramsN, FACEID_NULL);
-
- // non-local face: 4~7
- testLocalControl("/localhost/nfd/faces/enable-local-control", paramsF, nonLocalFace->getId());
- testLocalControl("/localhost/nfd/faces/disable-local-control", paramsF, nonLocalFace->getId());
- testLocalControl("/localhost/nfd/faces/enable-local-control", paramsN, nonLocalFace->getId());
- testLocalControl("/localhost/nfd/faces/disable-local-control", paramsN, nonLocalFace->getId());
-
- // enableLocalControl for Incoming FaceId on existing local face:
- testLocalControl("/localhost/nfd/faces/enable-local-control", paramsF, localFace->getId()); // 8
- BOOST_CHECK(localFace->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
- BOOST_CHECK(!localFace->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
-
- // disableLocalControl for Incoming FaceId on existing local face
- testLocalControl("/localhost/nfd/faces/disable-local-control", paramsF, localFace->getId()); // 9
- BOOST_CHECK(!localFace->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
- BOOST_CHECK(!localFace->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
-
- // enableLocalControl for NextHop ID on existing local face
- testLocalControl("/localhost/nfd/faces/enable-local-control", paramsN, localFace->getId()); // 10
- BOOST_CHECK(!localFace->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
- BOOST_CHECK(localFace->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
-
- // disableLocalControl for NextHop ID on existing local face
- testLocalControl("/localhost/nfd/faces/disable-local-control", paramsN, localFace->getId()); // 11
- BOOST_CHECK(!localFace->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
- BOOST_CHECK(!localFace->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
-
- // check responses
- BOOST_REQUIRE_EQUAL(m_responses.size(), 12);
- BOOST_CHECK_EQUAL(checkResponse(0, commandNames[0], ControlResponse(410, "Face not found")),
- CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkResponse(1, commandNames[1], ControlResponse(410, "Face not found")),
- CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkResponse(2, commandNames[2], ControlResponse(410, "Face not found")),
- CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkResponse(3, commandNames[3], ControlResponse(410, "Face not found")),
- CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkResponse(4, commandNames[4], ControlResponse(412, "Face is non-local")),
- CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkResponse(5, commandNames[5], ControlResponse(412, "Face is non-local")),
- CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkResponse(6, commandNames[6], ControlResponse(412, "Face is non-local")),
- CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkResponse(7, commandNames[7], ControlResponse(412, "Face is non-local")),
- CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkResponse(8, commandNames[8], makeResponse(200, "OK", paramsF)),
- CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkResponse(9, commandNames[9], makeResponse(200, "OK", paramsF)),
- CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkResponse(10, commandNames[10], makeResponse(200, "OK", paramsN)),
- CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkResponse(11, commandNames[11], makeResponse(200, "OK", paramsN)),
- CheckResponseResult::OK);
-}
-
class TestFace : public DummyFace
{
public:
diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp
index 513536c..945a07e 100644
--- a/tests/daemon/mgmt/fib-manager.t.cpp
+++ b/tests/daemon/mgmt/fib-manager.t.cpp
@@ -180,9 +180,9 @@
ControlResponse expectedResponse;
auto testAddNextHop = [&] (ControlParameters parameters, const FaceId& faceId) {
auto command = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop", parameters,
- [&faceId] (shared_ptr<Interest> interest) {
- interest->setIncomingFaceId(faceId);
- });
+ [&faceId] (shared_ptr<Interest> interest) {
+ interest->setTag(make_shared<lp::IncomingFaceIdTag>(faceId));
+ });
m_responses.clear();
expectedName = command->getName();
expectedResponse = makeResponse(200, "Success", parameters.setFaceId(faceId));
@@ -328,9 +328,9 @@
auto testWithImplicitFaceId = [&] (ControlParameters parameters, FaceId face) {
m_responses.clear();
auto command = makeControlCommandRequest("/localhost/nfd/fib/remove-nexthop", parameters,
- [face] (shared_ptr<Interest> interest) {
- interest->setIncomingFaceId(face);
- });
+ [face] (shared_ptr<Interest> interest) {
+ interest->setTag(make_shared<lp::IncomingFaceIdTag>(face));
+ });
expectedName = command->getName();
expectedResponse = makeResponse(200, "Success", parameters.setFaceId(face));
receiveInterest(command);