docs+tests: finalize migration to typed naming conventions

refs #5044

Change-Id: Ia6f52ae0a31db33ca0f9fa6c4553b8fbbc7809bc
This commit is contained in:
Eric Newberry authored and Davide Pesavento committed 2021-04-05 18:16:44 -04:00
1 parent 86644d36ff
commit 7249fb4d52
5 files changed
+49 -44

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ import sys
# -- 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.
+6 -6
View File
@@ -3,7 +3,7 @@ nfd-asf-strategy
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 @@ OPTIONS
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 @@ EXAMPLES
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)
nfdc(1), nfdc-strategy(1)
+2 -2
View File
@@ -63,8 +63,8 @@ nfdc strategy show prefix /localhost/ping/1
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.
+31 -26
View File
@@ -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 @@ class TablesConfigSectionFixture : public GlobalIoFixture
{
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:
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_AUTO_TEST_CASE(Unversioned)
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 @@ BOOST_AUTO_TEST_CASE(Versioned)
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_AUTO_TEST_CASE(Versioned)
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 @@ BOOST_AUTO_TEST_CASE(UnacceptableParameters)
{
strategy_choice
{
/ /localhost/nfd/strategy/best-route/%FD%05/param
/ /localhost/nfd/strategy/best-route/v=5/param
}
}
)CONFIG";
@@ -69,8 +69,8 @@ BOOST_AUTO_TEST_CASE(Normal)
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 @@ BOOST_AUTO_TEST_CASE(NormalDefaultStrategy)
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 @@ BOOST_AUTO_TEST_CASE(NormalNonDefaultStrategy)
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 @@ BOOST_AUTO_TEST_CASE(Normal)
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 @@ const std::string STATUS_XML = stripXmlSpaces(R"XML(
<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_XML = stripXmlSpaces(R"XML(
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>)