Add ASF measurement lifetime as strategy parameter
Refs: #5332
Change-Id: Iff42ca0870d4263f0ad8757a67b87e52dbfff9f5
diff --git a/tests/daemon/fw/asf-measurements.t.cpp b/tests/daemon/fw/asf-measurements.t.cpp
index 4de0493..e44144b 100644
--- a/tests/daemon/fw/asf-measurements.t.cpp
+++ b/tests/daemon/fw/asf-measurements.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -75,14 +75,14 @@
BOOST_FIXTURE_TEST_CASE(NamespaceInfo, GlobalIoTimeFixture)
{
using fw::asf::NamespaceInfo;
- NamespaceInfo info(nullptr);
+ NamespaceInfo info(nullptr, fw::asf::AsfMeasurements::DEFAULT_MEASUREMENTS_LIFETIME);
BOOST_CHECK(info.getFaceInfo(1234) == nullptr);
auto& faceInfo = info.getOrCreateFaceInfo(1234);
BOOST_CHECK(info.getFaceInfo(1234) == &faceInfo);
- this->advanceClocks(fw::asf::AsfMeasurements::MEASUREMENTS_LIFETIME + 1_s);
+ this->advanceClocks(fw::asf::AsfMeasurements::DEFAULT_MEASUREMENTS_LIFETIME + 1_s);
BOOST_CHECK(info.getFaceInfo(1234) == nullptr); // expired
}
diff --git a/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp
index dce7118..17a19a7 100644
--- a/tests/daemon/fw/asf-strategy.t.cpp
+++ b/tests/daemon/fw/asf-strategy.t.cpp
@@ -561,18 +561,33 @@
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_measurements.getMeasurementsLifetime() == 5_min);
+ strategy = checkValidity("/probing-interval~30000/max-timeouts~5/measurements-lifetime~120000", true);
BOOST_TEST(strategy->m_probing.getProbingInterval() == 30_s);
BOOST_TEST(strategy->m_nMaxTimeouts == 5);
+ BOOST_TEST(strategy->m_measurements.getMeasurementsLifetime() == 2_min);
strategy = checkValidity("/max-timeouts~5/probing-interval~30000", true);
BOOST_TEST(strategy->m_probing.getProbingInterval() == 30_s);
BOOST_TEST(strategy->m_nMaxTimeouts == 5);
+ BOOST_TEST(strategy->m_measurements.getMeasurementsLifetime() == 5_min);
+ strategy = checkValidity("/max-timeouts~5/measurements-lifetime~120000", true);
+ BOOST_TEST(strategy->m_nMaxTimeouts == 5);
+ BOOST_TEST(strategy->m_measurements.getMeasurementsLifetime() == 2_min);
+ strategy = checkValidity("/probing-interval~30000/measurements-lifetime~120000", true);
+ BOOST_TEST(strategy->m_probing.getProbingInterval() == 30_s);
+ BOOST_TEST(strategy->m_measurements.getMeasurementsLifetime() == 2_min);
strategy = checkValidity("/probing-interval~1000", true);
BOOST_TEST(strategy->m_probing.getProbingInterval() == 1_s);
BOOST_TEST(strategy->m_nMaxTimeouts == 3);
+ BOOST_TEST(strategy->m_measurements.getMeasurementsLifetime() == 5_min);
strategy = checkValidity("/max-timeouts~0", true);
BOOST_TEST(strategy->m_probing.getProbingInterval() == 60_s);
BOOST_TEST(strategy->m_nMaxTimeouts == 0);
+ BOOST_TEST(strategy->m_measurements.getMeasurementsLifetime() == 5_min);
+ strategy = checkValidity("/measurements-lifetime~120000", true);
+ BOOST_TEST(strategy->m_probing.getProbingInterval() == 60_s);
+ BOOST_TEST(strategy->m_nMaxTimeouts == 3);
+ BOOST_TEST(strategy->m_measurements.getMeasurementsLifetime() == 2_min);
BOOST_TEST(strategy->m_retxSuppression->m_initialInterval == fw::RetxSuppressionExponential::DEFAULT_INITIAL_INTERVAL);
BOOST_TEST(strategy->m_retxSuppression->m_maxInterval == fw::RetxSuppressionExponential::DEFAULT_MAX_INTERVAL);
BOOST_TEST(strategy->m_retxSuppression->m_multiplier == fw::RetxSuppressionExponential::DEFAULT_MULTIPLIER);
@@ -585,6 +600,15 @@
checkValidity("/max-timeouts~1/probing-interval~-30000", false);
checkValidity("/probing-interval~foo", false);
checkValidity("/max-timeouts~1~2", false);
+ checkValidity("/measurements-lifetime~1000", false); //Minimum is 60s by default
+ //Measurement lifetime must be greater than probing interval
+ checkValidity("/measurements-lifetime~1000/probing-interval~30000", false);
+ checkValidity("/measurements-lifetime~-120000", false);
+ checkValidity("/measurements-lifetime~ -120000", false);
+ checkValidity("/measurements-lifetime~0-120000", false);
+ checkValidity("/max-timeouts~1/measurements-lifetime~-120000", false);
+ checkValidity("/probing-interval~30000/measurements-lifetime~-120000", false);
+ checkValidity("/max-timeouts~1/probing-interval~30000/measurements-lifetime~-120000", false);
}
BOOST_AUTO_TEST_CASE(FaceRankingForForwarding)