fw: implement self-learning forwarding strategy
refs #4279
Change-Id: I3c80820f9e3382d204a75ea3248234581b4d97d2
diff --git a/tests/daemon/fw/strategy-instantiation.t.cpp b/tests/daemon/fw/strategy-instantiation.t.cpp
index c6fe471..f6ff4e2 100644
--- a/tests/daemon/fw/strategy-instantiation.t.cpp
+++ b/tests/daemon/fw/strategy-instantiation.t.cpp
@@ -34,6 +34,7 @@
#include "fw/best-route-strategy2.hpp"
#include "fw/multicast-strategy.hpp"
#include "fw/ncc-strategy.hpp"
+#include "fw/self-learning-strategy.hpp"
#include "tests/test-common.hpp"
#include <boost/mpl/vector.hpp>
@@ -78,7 +79,8 @@
Test<BestRouteStrategy, false, 1>,
Test<BestRouteStrategy2, false, 5>,
Test<MulticastStrategy, false, 3>,
- Test<NccStrategy, false, 1>
+ Test<NccStrategy, false, 1>,
+ Test<SelfLearningStrategy, false, 1>
>;
BOOST_AUTO_TEST_CASE_TEMPLATE(Registration, T, Tests)
diff --git a/tests/other/fw/self-learning.md b/tests/other/fw/self-learning.md
new file mode 100644
index 0000000..6dc75c1
--- /dev/null
+++ b/tests/other/fw/self-learning.md
@@ -0,0 +1,27 @@
+This file describes how self-learning forwarding strategy is tested.
+
+Installation/Configuration:
+
+ - Install two NFDs (A and B) with the self-learning forwarding strategy
+
+ - Configure two NFDs to be connected: either both NFDs have to be connected to the same multicast-capable network (they effectively will communicate over it) or faces between two nodes have to be configured and maintained for communication
+
+ - Enable `localhop_security` by editing nfd.conf file for both NFDs
+
+Execution:
+
+ - Run NFD, and choose self-learning forwarding strategy for name prefix /sl on both NFDs with this command:
+ `nfdc strategy set /sl /localhost/nfd/strategy/self-learning`
+
+ - Run ndnpingserver on node A to serve /sl: `ndnpingserver /sl` (Install ndn-tools first)
+
+ - Run ndnping on node B for /sl: `ndnping /sl`
+
+Results:
+
+ - ndnping works
+
+ - run command `nfdc route` to show the newly added route that follows the following format:
+ `prefix=/sl/ping nexthop=<faceID> origin=prefixann cost=2048 flags=child-inherit expires=<duration>`
+
+ - in NFD logs (with DEBUG level enabled), the first Interest is sent to all faces, while the subsequent Interests are sent to only one face
\ No newline at end of file
diff --git a/tests/other/wscript b/tests/other/wscript
index 3c6d1c0..b09be43 100644
--- a/tests/other/wscript
+++ b/tests/other/wscript
@@ -37,7 +37,7 @@
bld.program(name=module,
target='../../%s' % module,
source=bld.path.ant_glob('%s*.cpp' % module),
- use='daemon-objects unit-tests-base other-tests-%s-main' % module,
+ use='daemon-objects rib-objects unit-tests-base other-tests-%s-main' % module,
defines=['UNIT_TEST_CONFIG_PATH="%s"' % bld.bldnode.make_node('tmp-files')],
install_path=None)
@@ -45,5 +45,5 @@
bld.program(name='face-benchmark',
target='../../face-benchmark',
source=bld.path.ant_glob('face-benchmark*.cpp'),
- use='daemon-objects',
+ use='daemon-objects rib-objects',
install_path=None)
diff --git a/tests/wscript b/tests/wscript
index 7e9300f..2103753 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -63,12 +63,20 @@
src += node.ant_glob('face/websocket*.cpp')
# unit-tests-%module
- bld.program(name='unit-tests-%s' % module,
- target='../unit-tests-%s' % module,
- source=src,
- use='%s-objects unit-tests-base unit-tests-%s-main' % (module, module),
- defines=[config_path],
- install_path=None)
+ if module == "daemon":
+ bld.program(name='unit-tests-%s' % module,
+ target='../unit-tests-%s' % module,
+ source=src,
+ use='%s-objects rib-objects unit-tests-base unit-tests-%s-main' % (module, module),
+ defines=[config_path],
+ install_path=None)
+ else:
+ bld.program(name='unit-tests-%s' % module,
+ target='../unit-tests-%s' % module,
+ source=src,
+ use='%s-objects unit-tests-base unit-tests-%s-main' % (module, module),
+ defines=[config_path],
+ install_path=None)
# Other tests (e.g., stress tests and benchmarks that can be enabled even if unit tests are disabled)
if bld.env.WITH_TESTS or bld.env.WITH_OTHER_TESTS: