-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
12ca799
to
4c91a20
Compare
4c91a20
to
0bdc379
Compare
0bdc379
to
dafd9d1
Compare
cdb9991
to
78a9058
Compare
0e9381b
to
743dd3a
Compare
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 😉 |
There was a problem hiding this 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.
51bdb39
to
b575dbf
Compare
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 |
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. |
b575dbf
to
7f31b86
Compare
|
||
|
||
class RIOTCtrlAppFactory(RIOTCtrlBoardFactory): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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.
Contribution description
This adds an automated test for
gnrc_rpl
that spawns severalnative
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
intests/gnrc_rpl
.Issues/PRs references