Testing OpenThread COAP Server and COAP Client

Hi.

I'm playing with an scenario based on two nrf52840dk and a dongle.

I have deployed a OTBR on a Linux Ubuntu22.04 and flashed the dk with OT COAP Server and Client respectively. (https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/openthread/coap_server/README.html)

Examples from the nRF v2.7.0 SDK and zephur 3.6.99.

I'm able to:

- ping the COAP Server and Client from the BR

- ping the COAP Server and Client from the host system (Ubuntu22.04).

- ping the COAP Server form the COAP Client (uart:$ ot ping)

- create a resource on the COAP Server using the CLI (ot coap resource test)

- to access the resource from both the COAP Client (cli) and the host (coap-client-gnutl (libcoap).

- run the test based on (https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/openthread/coap_client/README.html#testing) and the client is able to on and off leds by clicking buttons.

I'm not able to:

- access the /light and /provisioning resources neither from the COAP Client (cli) nor the host (coap-client-gnutl)

I get the following output from the host:

$ coap-client-gnutls -v 7 -m get coap://[fd11:22:0:0:0:0:0:100]/light
Nov 28 15:48:44.608 DEBG ***[fd11:db8:1::1]:34698 <-> [fd11:22::100]:5683 UDP : session 0x55b06e0d7950: created outg
oing session
Nov 28 15:48:44.608 DEBG ***[fd11:db8:1::1]:34698 <-> [fd11:22::100]:5683 UDP : session connected
Nov 28 15:48:44.608 DEBG timeout is set to 90 seconds
Nov 28 15:48:44.608 DEBG sending CoAP request:
Nov 28 15:48:44.608 DEBG *  [fd11:db8:1::1]:34698 <-> [fd11:22::100]:5683 UDP : netif: sent   41 bytes
v:1 t:CON c:GET i:2407 {01} [ Uri-Host:fd11:22:0:0:0:0:0:100, Uri-Path:light, Request-Tag:0x45fc4a06 ]
Nov 28 15:48:44.608 DEBG ** [fd11:db8:1::1]:34698 <-> [fd11:22::100]:5683 UDP : mid=0x2407: added to retransmit queu
e (2875ms)
^CNov 28 15:48:47.133 DEBG ***[fd11:db8:1::1]:34698 <-> [fd11:22::100]:5683 UDP : session 0x55b06e0d7950:

How, if possible, can I access the /light and /provisioning resources from the command line?

Thanks in advance.

Best regards, Gabi.

Parents
  • Hi Gabriel,

    You can send GET only to "provisioning" resource when server is in provisioning state (button4). You can also send PUT to "light" resource to trigger LED.
    For example after attaching with coap server and other OT CLI device, get IP addres from coap server and press button 4.
    when LED3 is blinking, on other device send:

    uart:~$ ot coap get fdde:ad00:beef:0:4632:8245:46a9:8af8 provisioning
    Done
    coap response from fdde:ad00:beef:0:4632:8245:46a9:8af8 with payload:
    fddead00beef00004632824546a98af8

    And to toggle LED4, from the other device, send:

    ot coap put fdde:ad00:beef:0:28cd:59c5:d0a3:66bd light non-con 2

    where "2" is toggle command. see: https://github.com/nrfconnect/sdk-nrf/blob/main/samples/openthread/coap_server/interface/coap_server_client_interface.h

    Regards,

    Swathy

  • Hi.

    I have tested it form the coap client (another nrf52840dk node) and it works (note that the OpenThread COAP Client example doesn't include the CONFIG_OPENTHREAD_COAP directive in order to allow ot coap in the node, you have to enable it and to run "ot coap start" on the node before the test).

    However, I still can not connect from the host. I have ping from the host, but trying the examples:

    coap-client-gnutls coap://[fd11:22:0:0:0:0:0:100]/provisioning

    coap-client-gnutils -m put -N -e "2" coap://[fd11:22:0:0:0:0:0:100]/light

    I get a timeout.

    Any idea?

    Thanks in advance.

Reply
  • Hi.

    I have tested it form the coap client (another nrf52840dk node) and it works (note that the OpenThread COAP Client example doesn't include the CONFIG_OPENTHREAD_COAP directive in order to allow ot coap in the node, you have to enable it and to run "ot coap start" on the node before the test).

    However, I still can not connect from the host. I have ping from the host, but trying the examples:

    coap-client-gnutls coap://[fd11:22:0:0:0:0:0:100]/provisioning

    coap-client-gnutils -m put -N -e "2" coap://[fd11:22:0:0:0:0:0:100]/light

    I get a timeout.

    Any idea?

    Thanks in advance.

Children
Related