Skip to content

net: add full CoRE Resource Directory endpoint implementation#7428

Merged
miri64 merged 6 commits intoRIOT-OS:masterfrom
haukepetersen:add_rdcli
Oct 12, 2018
Merged

net: add full CoRE Resource Directory endpoint implementation#7428
miri64 merged 6 commits intoRIOT-OS:masterfrom
haukepetersen:add_rdcli

Conversation

@haukepetersen
Copy link
Copy Markdown
Contributor

@haukepetersen haukepetersen commented Jul 28, 2017

Waiting on and rebased on a couple of PRs, e.g. #7402, #7406, #7407, #7408

This PR adds complete CoRE Resource Directory (RD) functionality for RIOT. The code should be fully functional and is basically done, though it needs some more documentation and some cleanups (and proper squashing of course). Will take that on once all the dependencies are merged...

@haukepetersen haukepetersen added Area: network Area: Networking Type: new feature The issue requests / The PR implemements a new feature for RIOT State: waiting for other PR State: The PR requires another PR to be merged first State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet labels Jul 28, 2017
Copy link
Copy Markdown
Member

@PeterKietzmann PeterKietzmann left a comment

Choose a reason for hiding this comment

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

I do not intend to provide a full review but rather focus on testing. In a first step I analyzed sent packets via rdcli reg command on native an on a samr21-xpro which looks "good" at first sight, comparing to the RD draft. This applies for both provided applications. With examples/coap_rdcli it appeared that ping6 raises a failed assertion. Not quite sure I got the correct assertion but most likely it is one of these. Is there a GNRC relevant thread without a message queue?
Could you add a description about how to set up an RD server for easier testing of the actual protocol?

redefine `RDCLI_SERVER_ADDR` and `RDCLI_SERVER_PORT`, e.g.:
```
CFLAGS="-DRDCLI_SERVER_ADDR=IPV6_ADDR_ALL_ROUTERS_LINK_LOCAL" make all
```
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Currently this README equals that of the other application. Would be great to have a short introduction what the difference is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is because I have not written an readme for this example, yet :-)

rdcli_dump_status();
}
else {
printf("usage: %s <reg [addr [port]]|up|rem|info>\n", argv[0]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would prefer update as command. up reminds me of initiating something.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will do

sock_udp_ep_t remote;
} rd_entry_t;

static rd_entry_t active_rd = { 0 };
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm using a rather old compiler. arm-none-eabi-gcc 4.9.3 complains error: missing braces around initializer

/* build CoAP request packet */
int res = gcoap_req_init(&pkt, buf, sizeof(buf), COAP_METHOD_POST, "/rd");
if (res < 0) {
goto rdcli_register;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Didn't we decide against "goto" some time ago?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

AFAIK not in general, and though I am still not a huge fan of this, I think for certain error handling cases it can make the code more readable, if used with caution...

@haukepetersen
Copy link
Copy Markdown
Contributor Author

With examples/coap_rdcli it appeared that ping6 raises a failed assertion

Yepp, thats the missing message queue (once more)... Will fix.

Could you add a description about how to set up an RD server for easier testing of the actual protocol?

quick version: compile nanocoap and run the coap-rd command, then watch with wireshark. But I have not really played with the lookup API (if it is even implenented in libcoap) to see if entries are made correctly.

Alternative: You could also use the javscript RD Pekka wrote in Dagstuhl (https://github.com/Ell-i/coap-rd):

  • install node 8.x on your host
  • run it using node coap-rd
  • watch the debug output...

@haukepetersen
Copy link
Copy Markdown
Contributor Author

just as update: currently waiting on #8920

@bergzand bergzand added the Area: CoAP Area: Constrained Application Protocol implementations label May 25, 2018
@haukepetersen haukepetersen added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet State: waiting for other PR State: The PR requires another PR to be merged first labels Sep 12, 2018
@haukepetersen
Copy link
Copy Markdown
Contributor Author

finally, no more dependencies to wait for. Heavily rebased, and partly reworked this PR, now it is ready for (final) review and testing.

I tested this mainly by registering it with the RD provided by aiocoap (https://github.com/chrysn/aiocoap). For this I always used the latest master of aiocoap-rd, as the latest release does not include many features of the latest draft version...

@haukepetersen
Copy link
Copy Markdown
Contributor Author

rebased and fixed some issues that Murdock pointed out.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

@bergzand @PeterKietzmann anyone available to test and review this PR?!

@PeterKietzmann
Copy link
Copy Markdown
Member

Unfortunately I won't find time for this soon. @pokgak are you familiar with the idea of "Resource Directory"? Isn't this somewhat interesting for you?

@pokgak
Copy link
Copy Markdown
Contributor

pokgak commented Sep 27, 2018

Perfect timing. Currently reading on this topic to use it in my project. Will test it next week and provide feedback.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

@pokgak awesome to hear, looking forward to your feedback!

@bergzand
Copy link
Copy Markdown
Member

@haukepetersen I hope to have some time for a review next week somewhere.

@pokgak
Copy link
Copy Markdown
Contributor

pokgak commented Oct 2, 2018

Tested this using native with PORT=tap0, aiocoap-rd bind to global address of tapbr0 and Wireshark listens on tap0.

Here is what I've tested:

  • Running discover, reg, update, info, rem directly after each other work as expected OK
  • rdcli update and rdcli rem when not registered does not do anything. OK
  • Client updates automatically once before the lifetime is over, but not anymore after that.
    Steps to reproduce:
    • rdcli reg [rd_ip], then wait and see wireshark log
    • will auto update once, after that no more
  • Even when the lifetime is over, rdcli info still says that it is registered
    Step to reproduce:
    • rdcli reg [rd_ip] and wait until lifetime over
    • rdcli info still says registered to RD
  • Calling update after lifetime is over make program hang
    Step to reproduce:
    • rdcli reg [rd_ip] and wait until lifetime over. Note: the client auto updates once, so wait at least 2 * lifetime
    • rdcli update and program hangs
  • Registering to new RD, while already registered to another, the old registration will be deleted even though the new registration failed. I could not find about this in the draft.

Feedback:

  • When using discover/reg with random ip, it takes too long until the shell command returns. Maybe more verbose output like ping6 helps, so that the user does not think that the program hangs somewhere
  • Output of rdcli rem when not registered can be misleading. It says node successfully removed from RD when there are actually no nodes removed.

@pokgak
Copy link
Copy Markdown
Contributor

pokgak commented Oct 11, 2018

ACK from my side =)

@haukepetersen
Copy link
Copy Markdown
Contributor Author

@pokgak very nice, thanks for the testing!

@bergzand I will squash now, hope thats ok with you...

@bergzand
Copy link
Copy Markdown
Member

@bergzand I will squash now, hope thats ok with you...

Go ahead, I didn't have time to look at this yet unfortunately :(

@haukepetersen
Copy link
Copy Markdown
Contributor Author

rebased and squased.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

@bergzand no problem. But maybe you want to give a proxy-ACK for @pokgak? :-)

@haukepetersen
Copy link
Copy Markdown
Contributor Author

blacklisted boards with insufficient memory

@haukepetersen
Copy link
Copy Markdown
Contributor Author

fixed a parenthesis issues that clang did not like...

@haukepetersen
Copy link
Copy Markdown
Contributor Author

more blacklisting...

@jia200x
Copy link
Copy Markdown
Member

jia200x commented Oct 12, 2018

as far as I see this PR has chances to be merged for the Release, right?

Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

I scanned through the code and didn't find anything obviously wrong with it and moreover @pokgak gave this a review as well. Regarding testing I know (and @chrysn probably can confirm) that this implementation already went through 2 plugtests against other implementations (also @haukepetersen gave me a little demo offline as well).

Let's get this into the release!

ACK.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Oct 12, 2018

Codacy has a problem, but I don't see what it is (it just tells "1 warning" but not showing the actual warning). To my knowledge however, Murdock is still the canonical check (and also the only required one).

@miri64
Copy link
Copy Markdown
Member

miri64 commented Oct 12, 2018

So go!

@miri64 miri64 merged commit 1095ac2 into RIOT-OS:master Oct 12, 2018
@miri64 miri64 deleted the add_rdcli branch October 12, 2018 15:56
@haukepetersen
Copy link
Copy Markdown
Contributor Author

Finally :-) Thanks everyone!

@kb2ma
Copy link
Copy Markdown
Member

kb2ma commented Oct 12, 2018

Nice, Hauke! I just updated the Standards Based Application Development wiki page so hopefully the implementation and apps will be easy to find.

@waehlisch
Copy link
Copy Markdown
Member

But we still should work on aligning naming with the RFC.

@jia200x
Copy link
Copy Markdown
Member

jia200x commented Oct 15, 2018

awesome! Thanks to everyone involved! 🎉

@haukepetersen
Copy link
Copy Markdown
Contributor Author

But we still should work on aligning naming with the RFC.

done: #10163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: CoAP Area: Constrained Application Protocol implementations Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.