Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/gnrc_rpl: add automated test for gnrc_rpl #17353

Merged
merged 2 commits into from
Mar 22, 2022

Conversation

benpicco
Copy link
Contributor

@benpicco benpicco commented Dec 7, 2021

Contribution description

This adds an automated test for gnrc_rpl that spawns several native instances connected by ZEP dispatcher to simulate a mesh network.
The idea is that this can be run automatically by CI.

Testing procedure

Run make test in tests/gnrc_rpl.

Issues/PRs references

@benpicco benpicco added the Community: help wanted The contributors require help from other members of the community label Dec 7, 2021
@github-actions github-actions bot added Area: network Area: Networking Area: sys Area: System Area: tests Area: tests and testing framework labels Dec 7, 2021
@benpicco benpicco changed the title Tests/gnrc rpl tests/gnrc_rpl: add automated test for gnrc_rpl Dec 7, 2021
@github-actions github-actions bot removed the Area: network Area: Networking label Dec 7, 2021
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Dec 8, 2021
@github-actions github-actions bot added the Area: CI Area: Continuous Integration of RIOT components label Dec 8, 2021
@benpicco benpicco removed the Area: CI Area: Continuous Integration of RIOT components label Dec 8, 2021
@github-actions github-actions bot added the Area: CI Area: Continuous Integration of RIOT components label Dec 8, 2021
@benpicco
Copy link
Contributor Author

benpicco commented Dec 8, 2021

I also tried to see if RPL recovers from a lost node, but apparently it doesn't

--- a/tests/gnrc_rpl/tests/01-run.py
+++ b/tests/gnrc_rpl/tests/01-run.py
@@ -147,6 +147,7 @@ def test_alternative_route(factory):
     # create native instances
     nodes = factory.get_shells(5)
     A = nodes[0]
+    B = nodes[1]
     D = nodes[3]
 
     # add prefix to root node
@@ -167,6 +168,25 @@ def test_alternative_route(factory):
     # 1 intermediate hop, 64 - 1
     assert result['replies'][0]['ttl'] == 63
 
+    # remove a node from the DOGAD
+    B.stop_term()
+    nodes.remove(B)
+
+    # wait for the the DODAG to recover, dummy ping the root
+    D.ping6(root_addr)
+    time.sleep(10)
+
+    # try to reach the root node again
+    result = parser.parse(D.ping6(root_addr))
+
+    print(result)
+    # assert packetloss is under 10%"))
+    assert result['stats']['packet_loss'] < 10
+    # assert at least one responder
+    assert result['stats']['rx'] > 0
+    # 2 intermediate hops, 64 - 2
+    assert result['replies'][0]['ttl'] == 62
+
     # terminate nodes
     for n in nodes:
         n.stop_term()

This is likely related to #17327

Also any suggestions to make this more pythonic are of course welcome 😉

@github-actions github-actions bot added the Area: tools Area: Supplementary tools label Dec 8, 2021
Copy link
Member

@chrysn chrysn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just having looked at the Python parts (without particular knowledge of riotctrl), no show stoppers there.

The automated checks already complained about the whitespace (Python likes spaces around = at assignments, but not in named arguments).

My inline comments are all minor.

The "get shells" code might make sense to refactor up into riotctrl.

tests/gnrc_rpl/tests/01-run.py Outdated Show resolved Hide resolved
tests/gnrc_rpl/tests/01-run.py Outdated Show resolved Hide resolved
@benpicco benpicco force-pushed the tests/gnrc_rpl branch 2 times, most recently from 51bdb39 to b575dbf Compare January 3, 2022 15:44
@benpicco benpicco removed the Community: help wanted The contributors require help from other members of the community label Jan 3, 2022
@aabadie
Copy link
Contributor

aabadie commented Jan 6, 2022

The Python code seems good to me but I don't feel confident enough on the network part. I was also wondering if this test could fall under the test-with-config case but apparently, on native, no preliminary configuration is required. On hardware, I guess that's another story (which is skipped by the use of TEST_ON_CI_WHITELIST, not sure that's a good thing).

@benpicco
Copy link
Contributor Author

benpicco commented Jan 6, 2022

On hardware, I guess that's another story (which is skipped by the use of TEST_ON_CI_WHITELIST, not sure that's a good thing).

I don't think it's currently possible to have an automatic test that uses several hardware nodes on Murdock 😉
The network part is really just adding dual-stack support to ZEP dispatcher because Murdock does not support IPv6.

@aabadie
Copy link
Contributor

aabadie commented Jan 6, 2022

I don't think it's currently possible to have an automatic test that uses several hardware nodes on Murdock

On Murdock, that would be difficult indeed. But in theory, with riot_ctrl, it's possible to run a test script with several hw nodes. Some of the release test do that already. But that would need some setup and thus fall under the test-with-config case.

@benpicco benpicco removed the State: waiting for other PR State: The PR requires another PR to be merged first label Feb 25, 2022
@github-actions github-actions bot removed Area: sys Area: System Area: CI Area: Continuous Integration of RIOT components labels Feb 25, 2022


class RIOTCtrlAppFactory(RIOTCtrlBoardFactory):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Contributor

@kaspar030 kaspar030 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK.

Python looks fine.

@benpicco benpicco merged commit dd8b3fc into RIOT-OS:master Mar 22, 2022
@benpicco benpicco deleted the tests/gnrc_rpl branch March 22, 2022 11:10
@OlegHahm OlegHahm added this to the Release 2022.04 milestone Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tests Area: tests and testing framework Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants