docs+tests: finalize migration to typed naming conventions
refs #5044
Change-Id: Ia6f52ae0a31db33ca0f9fa6c4553b8fbbc7809bc
diff --git a/docs/conf.py b/docs/conf.py
index 8ea25f5..92bf794 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -18,7 +18,7 @@
# -- Project information -----------------------------------------------------
project = u'Named Data Networking Forwarding Daemon (NFD)'
-copyright = u'Copyright © 2014-2020 Named Data Networking Project.'
+copyright = u'Copyright © 2014-2021 Named Data Networking Project.'
author = u'Named Data Networking Project'
# The short X.Y version.
diff --git a/docs/manpages/nfd-asf-strategy.rst b/docs/manpages/nfd-asf-strategy.rst
index 5a7d785..7d84607 100644
--- a/docs/manpages/nfd-asf-strategy.rst
+++ b/docs/manpages/nfd-asf-strategy.rst
@@ -3,7 +3,7 @@
SYNOPSIS
--------
-| nfdc strategy set prefix <PREFIX> strategy /localhost/nfd/strategy/asf/%FD%02[/probing-interval~<PROBING-INTERVAL>][/n-silent-timeouts~<N-SILENT-TIMEOUTS>]
+| nfdc strategy set prefix <PREFIX> strategy /localhost/nfd/strategy/asf[/v=4][/probing-interval~<PROBING-INTERVAL>][/n-silent-timeouts~<N-SILENT-TIMEOUTS>]
DESCRIPTION
-----------
@@ -24,7 +24,7 @@
This behavior may be too sensitive for application use and appropriate only for link
failures and not transient timeouts. So this parameter makes ASF switch paths
only after it has encountered the specified number of timeouts (non-negative integer).
- Default and minimum value is 0 i.e. switch immediately.
+ Default and minimum value is 0, i.e., switch immediately.
It is optional to specify n-silent-timeouts.
EXAMPLES
@@ -32,15 +32,15 @@
nfdc strategy set prefix /ndn strategy /localhost/nfd/strategy/asf
Use the default values.
-nfdc strategy set prefix /ndn strategy /localhost/nfd/strategy/asf/%FD%03/probing-interval~30000
+nfdc strategy set prefix /ndn strategy /localhost/nfd/strategy/asf/v=4/probing-interval~30000
Set probing interval as 30 seconds.
-nfdc strategy set prefix /ndn strategy /localhost/nfd/strategy/asf/%FD%03/n-silent-timeouts~5
+nfdc strategy set prefix /ndn strategy /localhost/nfd/strategy/asf/v=4/n-silent-timeouts~5
Set n-silent-timeouts as 5.
-nfdc strategy set prefix /ndn strategy /localhost/nfd/strategy/asf/%FD%03/probing-interval~30000/n-silent-timeouts~5
+nfdc strategy set prefix /ndn strategy /localhost/nfd/strategy/asf/v=4/probing-interval~30000/n-silent-timeouts~5
Set probing interval as 30 seconds and n-silent-timeouts as 5.
SEE ALSO
--------
-nfdc(1), nfdc-strategy(1)
\ No newline at end of file
+nfdc(1), nfdc-strategy(1)
diff --git a/docs/manpages/nfdc-strategy.rst b/docs/manpages/nfdc-strategy.rst
index 6084c05..f4a4041 100644
--- a/docs/manpages/nfdc-strategy.rst
+++ b/docs/manpages/nfdc-strategy.rst
@@ -63,8 +63,8 @@
nfdc strategy set prefix / strategy /localhost/nfd/strategy/best-route
Set the default strategy to best-route, latest version.
-nfdc strategy set prefix /ndn strategy /localhost/nfd/strategy/multicast/%FD%04
- Set the strategy of the "/ndn" prefix to multicast, version 4.
+nfdc strategy set prefix /ndn strategy /localhost/nfd/strategy/multicast/v=4
+ Set the strategy for the "/ndn" prefix to multicast, version 4.
nfdc strategy unset prefix /ndn
Clear the strategy choice for the "/ndn" prefix.
diff --git a/tests/daemon/mgmt/tables-config-section.t.cpp b/tests/daemon/mgmt/tables-config-section.t.cpp
index df9992f..4f07f78 100644
--- a/tests/daemon/mgmt/tables-config-section.t.cpp
+++ b/tests/daemon/mgmt/tables-config-section.t.cpp
@@ -24,6 +24,8 @@
*/
#include "mgmt/tables-config-section.hpp"
+
+#include "fw/best-route-strategy.hpp"
#include "fw/forwarder.hpp"
#include "table/cs-policy-lru.hpp"
#include "table/cs-policy-priority-fifo.hpp"
@@ -40,17 +42,10 @@
{
protected:
TablesConfigSectionFixture()
- : forwarder(faceTable)
- , cs(forwarder.getCs())
- , strategyChoice(forwarder.getStrategyChoice())
- , networkRegionTable(forwarder.getNetworkRegionTable())
- , tablesConfig(forwarder)
- , strategyP(Name("/tables-config-section-strategy-P").appendVersion(2))
- , strategyP1(Name("/tables-config-section-strategy-P").appendVersion(1))
- , strategyQ(Name("/tables-config-section-strategy-Q").appendVersion(2))
{
DummyStrategy::registerAs(strategyP);
DummyStrategy::registerAs(strategyP1);
+ // strategyP1Marker is NOT registered
DummyStrategy::registerAs(strategyQ);
}
@@ -64,16 +59,18 @@
protected:
FaceTable faceTable;
- Forwarder forwarder;
- Cs& cs;
- StrategyChoice& strategyChoice;
- NetworkRegionTable& networkRegionTable;
+ Forwarder forwarder{faceTable};
+ Cs& cs{forwarder.getCs()};
+ StrategyChoice& strategyChoice{forwarder.getStrategyChoice()};
+ NetworkRegionTable& networkRegionTable{forwarder.getNetworkRegionTable()};
- TablesConfigSection tablesConfig;
+ TablesConfigSection tablesConfig{forwarder};
- const Name strategyP;
- const Name strategyP1;
- const Name strategyQ;
+ const Name defaultStrategy = fw::BestRouteStrategy::getStrategyName();
+ const Name strategyP = Name("/tables-config-section-strategy-P").appendVersion(2);
+ const Name strategyP1 = "/tables-config-section-strategy-P/v=1";
+ const Name strategyP1Marker = "/tables-config-section-strategy-P/%FD%01";
+ const Name strategyQ = Name("/tables-config-section-strategy-Q").appendVersion(2);
};
BOOST_AUTO_TEST_SUITE(Mgmt)
@@ -290,21 +287,21 @@
BOOST_REQUIRE_NO_THROW(runConfig(CONFIG, true));
{
fw::Strategy& rootStrategy = strategyChoice.findEffectiveStrategy("/");
- BOOST_CHECK_NE(rootStrategy.getInstanceName(), strategyP.getPrefix(-1));
- BOOST_CHECK_NE(rootStrategy.getInstanceName(), strategyQ.getPrefix(-1));
+ BOOST_CHECK_EQUAL(rootStrategy.getInstanceName(), defaultStrategy);
fw::Strategy& aStrategy = strategyChoice.findEffectiveStrategy("/a");
- BOOST_CHECK_NE(aStrategy.getInstanceName(), strategyP.getPrefix(-1));
- BOOST_CHECK_NE(aStrategy.getInstanceName(), strategyQ.getPrefix(-1));
+ BOOST_CHECK_EQUAL(aStrategy.getInstanceName(), defaultStrategy);
}
BOOST_REQUIRE_NO_THROW(runConfig(CONFIG, false));
{
fw::Strategy& rootStrategy = strategyChoice.findEffectiveStrategy("/");
BOOST_CHECK_EQUAL(rootStrategy.getInstanceName(), strategyP.getPrefix(-1));
+ NFD_CHECK_TYPEID_EQUAL(rootStrategy, DummyStrategy);
fw::Strategy& aStrategy = strategyChoice.findEffectiveStrategy("/a");
BOOST_CHECK_EQUAL(aStrategy.getInstanceName(), strategyQ.getPrefix(-1));
+ NFD_CHECK_TYPEID_EQUAL(aStrategy, DummyStrategy);
}
}
@@ -316,7 +313,8 @@
strategy_choice
{
/test/latest /tables-config-section-strategy-P
- /test/old /tables-config-section-strategy-P/%FD%01
+ /test/old /tables-config-section-strategy-P/v=1
+ /test/marker /tables-config-section-strategy-P/%FD%01
}
}
)CONFIG";
@@ -324,21 +322,28 @@
BOOST_REQUIRE_NO_THROW(runConfig(CONFIG, true));
{
fw::Strategy& testLatestStrategy = strategyChoice.findEffectiveStrategy("/test/latest");
- BOOST_CHECK_NE(testLatestStrategy.getInstanceName(), strategyP.getPrefix(-1));
- BOOST_CHECK_NE(testLatestStrategy.getInstanceName(), strategyP1);
+ BOOST_CHECK_EQUAL(testLatestStrategy.getInstanceName(), defaultStrategy);
fw::Strategy& testOldStrategy = strategyChoice.findEffectiveStrategy("/test/old");
- BOOST_CHECK_NE(testOldStrategy.getInstanceName(), strategyP.getPrefix(-1));
- BOOST_CHECK_NE(testOldStrategy.getInstanceName(), strategyP1);
+ BOOST_CHECK_EQUAL(testOldStrategy.getInstanceName(), defaultStrategy);
+
+ fw::Strategy& testMarkerStrategy = strategyChoice.findEffectiveStrategy("/test/marker");
+ BOOST_CHECK_EQUAL(testMarkerStrategy.getInstanceName(), defaultStrategy);
}
BOOST_REQUIRE_NO_THROW(runConfig(CONFIG, false));
{
fw::Strategy& testLatestStrategy = strategyChoice.findEffectiveStrategy("/test/latest");
BOOST_CHECK_EQUAL(testLatestStrategy.getInstanceName(), strategyP.getPrefix(-1));
+ NFD_CHECK_TYPEID_EQUAL(testLatestStrategy, DummyStrategy);
fw::Strategy& testOldStrategy = strategyChoice.findEffectiveStrategy("/test/old");
BOOST_CHECK_EQUAL(testOldStrategy.getInstanceName(), strategyP1);
+ NFD_CHECK_TYPEID_EQUAL(testOldStrategy, DummyStrategy);
+
+ fw::Strategy& testMarkerStrategy = strategyChoice.findEffectiveStrategy("/test/marker");
+ BOOST_CHECK_EQUAL(testMarkerStrategy.getInstanceName(), strategyP1Marker);
+ NFD_CHECK_TYPEID_EQUAL(testMarkerStrategy, DummyStrategy);
}
}
@@ -399,7 +404,7 @@
{
strategy_choice
{
- / /localhost/nfd/strategy/best-route/%FD%05/param
+ / /localhost/nfd/strategy/best-route/v=5/param
}
}
)CONFIG";
diff --git a/tests/tools/nfdc/strategy-choice-module.t.cpp b/tests/tools/nfdc/strategy-choice-module.t.cpp
index 634682b..22f7d92 100644
--- a/tests/tools/nfdc/strategy-choice-module.t.cpp
+++ b/tests/tools/nfdc/strategy-choice-module.t.cpp
@@ -69,8 +69,8 @@
this->execute("strategy list");
BOOST_CHECK_EQUAL(exitCode, 0);
- BOOST_CHECK(out.is_equal("prefix=/ strategy=/strategyP/%FD%01\n"
- "prefix=/52VRvpL9/Yqfut4TNHv strategy=/strategyQ/%FD%02\n"));
+ BOOST_CHECK(out.is_equal("prefix=/ strategy=/strategyP/v=1\n"
+ "prefix=/52VRvpL9/Yqfut4TNHv strategy=/strategyQ/v=2\n"));
BOOST_CHECK(err.is_empty());
}
@@ -97,7 +97,7 @@
this->execute("strategy show /I1Ixgg0X");
BOOST_CHECK_EQUAL(exitCode, 0);
BOOST_CHECK(out.is_equal(" prefix=/\n"
- "strategy=/strategyP/%FD%01\n"));
+ "strategy=/strategyP/v=1\n"));
BOOST_CHECK(err.is_empty());
}
@@ -110,7 +110,7 @@
this->execute("strategy show /52VRvpL9/Yqfut4TNHv/Y5gY7gom");
BOOST_CHECK_EQUAL(exitCode, 0);
BOOST_CHECK(out.is_equal(" prefix=/52VRvpL9/Yqfut4TNHv\n"
- "strategy=/strategyQ/%FD%02\n"));
+ "strategy=/strategyQ/v=2\n"));
BOOST_CHECK(err.is_empty());
}
@@ -145,7 +145,7 @@
this->execute("strategy set /VBXSJg3m/XYs81ARNhx /strategyP");
BOOST_CHECK_EQUAL(exitCode, 0);
- BOOST_CHECK(out.is_equal("strategy-set prefix=/VBXSJg3m/XYs81ARNhx strategy=/strategyP/%FD%05\n"));
+ BOOST_CHECK(out.is_equal("strategy-set prefix=/VBXSJg3m/XYs81ARNhx strategy=/strategyP/v=5\n"));
BOOST_CHECK(err.is_empty());
}
@@ -225,13 +225,13 @@
<strategyChoice>
<namespace>/</namespace>
<strategy>
- <name>/localhost/nfd/strategy/best-route/%FD%04</name>
+ <name>/localhost/nfd/strategy/best-route/v=4</name>
</strategy>
</strategyChoice>
<strategyChoice>
<namespace>/localhost</namespace>
<strategy>
- <name>/localhost/nfd/strategy/multicast/%FD%04</name>
+ <name>/localhost/nfd/strategy/multicast/v=4</name>
</strategy>
</strategyChoice>
</strategyChoices>
@@ -239,8 +239,8 @@
const std::string STATUS_TEXT = std::string(R"TEXT(
Strategy choices:
- prefix=/ strategy=/localhost/nfd/strategy/best-route/%FD%04
- prefix=/localhost strategy=/localhost/nfd/strategy/multicast/%FD%04
+ prefix=/ strategy=/localhost/nfd/strategy/best-route/v=4
+ prefix=/localhost strategy=/localhost/nfd/strategy/multicast/v=4
)TEXT").substr(1);
BOOST_FIXTURE_TEST_CASE(Status, StatusFixture<StrategyChoiceModule>)