fw: add strategy parameters to configure exponential retx suppression
Supported by ASF, BestRoute, and Multicast strategies
Refs: #4924
Change-Id: I215d9212d90b93fa622cc65278703dc5198d0c9d
diff --git a/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp
index 1336b3e..f07e72a 100644
--- a/tests/daemon/fw/asf-strategy.t.cpp
+++ b/tests/daemon/fw/asf-strategy.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -541,39 +541,53 @@
BOOST_CHECK_EQUAL(linkAC->getFace(nodeA).getCounters().nOutInterests, 1);
}
-BOOST_AUTO_TEST_CASE(InstantiationWithParameters)
+BOOST_AUTO_TEST_CASE(Parameters)
{
FaceTable faceTable;
Forwarder forwarder{faceTable};
- auto checkValidity = [&] (std::string parameters, bool isCorrect) {
- Name strategyName(Name(AsfStrategy::getStrategyName()).append(std::move(parameters)));
- if (isCorrect) {
- BOOST_CHECK_NO_THROW(make_unique<AsfStrategy>(forwarder, strategyName));
+ auto checkValidity = [&] (const std::string& parameters, bool isCorrect) {
+ Name strategyName(Name(AsfStrategy::getStrategyName()).append(parameters));
+ std::unique_ptr<AsfStrategy> strategy;
+ BOOST_TEST_CONTEXT(parameters) {
+ if (isCorrect) {
+ strategy = make_unique<AsfStrategy>(forwarder, strategyName);
+ BOOST_CHECK(strategy->m_retxSuppression != nullptr);
+ }
+ else {
+ BOOST_CHECK_THROW(make_unique<AsfStrategy>(forwarder, strategyName), std::invalid_argument);
+ }
}
- else {
- BOOST_CHECK_THROW(make_unique<AsfStrategy>(forwarder, strategyName), std::invalid_argument);
- }
+ return strategy;
};
- checkValidity("/probing-interval~30000/max-timeouts~5", true);
- checkValidity("/max-timeouts~5/probing-interval~30000", true);
- checkValidity("/probing-interval~30000", true);
- checkValidity("/max-timeouts~5", true);
- checkValidity("", true);
+ auto strategy = checkValidity("", true);
+ BOOST_TEST(strategy->m_probing.getProbingInterval() == 60_s);
+ BOOST_TEST(strategy->m_nMaxTimeouts == 3);
+ strategy = checkValidity("/probing-interval~30000/max-timeouts~5", true);
+ BOOST_TEST(strategy->m_probing.getProbingInterval() == 30_s);
+ BOOST_TEST(strategy->m_nMaxTimeouts == 5);
+ strategy = checkValidity("/max-timeouts~5/probing-interval~30000", true);
+ BOOST_TEST(strategy->m_probing.getProbingInterval() == 30_s);
+ BOOST_TEST(strategy->m_nMaxTimeouts == 5);
+ strategy = checkValidity("/probing-interval~1000", true);
+ BOOST_TEST(strategy->m_probing.getProbingInterval() == 1_s);
+ BOOST_TEST(strategy->m_nMaxTimeouts == 3);
+ strategy = checkValidity("/max-timeouts~0", true);
+ BOOST_TEST(strategy->m_probing.getProbingInterval() == 60_s);
+ BOOST_TEST(strategy->m_nMaxTimeouts == 0);
+ BOOST_TEST(strategy->m_retxSuppression->m_initialInterval == RetxSuppressionExponential::DEFAULT_INITIAL_INTERVAL);
+ BOOST_TEST(strategy->m_retxSuppression->m_maxInterval == RetxSuppressionExponential::DEFAULT_MAX_INTERVAL);
+ BOOST_TEST(strategy->m_retxSuppression->m_multiplier == RetxSuppressionExponential::DEFAULT_MULTIPLIER);
- checkValidity("/probing-interval~500", false); // At least 1 seconds
+ checkValidity("/probing-interval~500", false); // minimum is 1 second
checkValidity("/probing-interval~-5000", false);
- checkValidity("/max-timeouts~0", false);
- checkValidity("/max-timeouts~-5", false);
- checkValidity("/max-timeouts~-5/probing-interval~-30000", false);
- checkValidity("/max-timeouts", false);
- checkValidity("/probing-interval~", false);
- checkValidity("/~1000", false);
+ checkValidity("/max-timeouts~-1", false);
+ checkValidity("/max-timeouts~ -1", false);
+ checkValidity("/max-timeouts~1-0", false);
+ checkValidity("/max-timeouts~1/probing-interval~-30000", false);
checkValidity("/probing-interval~foo", false);
checkValidity("/max-timeouts~1~2", false);
- checkValidity("/foo", false);
- checkValidity("/foo~42", false);
}
BOOST_AUTO_TEST_SUITE_END() // TestAsfStrategy