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

Automate spec08 task03 contiki interop tests #292

Merged
merged 2 commits into from
Nov 3, 2023

Conversation

MrKevinWeiss
Copy link
Contributor

This is based off the work @jia200x did.

Still a WIP but here are the issues I have found so far.

  • There is no easy way to setup and get the contiki binary so I added a script that can be run and re-run to do so (for local testing... still needs some cleanup)
  • We can override FLASHFILE to use the existing riotctrl infrastructure but iotlabs actually uses BINFILE to speed things up... that took me a while
  • Some hacks were needed in order to use the flash-only step maybe that could be cleaned
  • Somehow the captured output seems to be a bit funny for the last ping6 command that is wrapped, maybe better to just do it manually.
NETOPT_TX_END_IRQ not implemented by driver
main(): This is RIOT! (Version: 2024.01-devel-11-g354e1-2023.10-branch)
RIOT network stack example application
All up, running the shell now
> NETOPT_TX_END_IRQ not implemented by driver
main(): This is RIOT! (Ve

> ifconfig
ifconfig
Iface  6  HWaddr: 2A:E9  Channel: 26  NID: 0x23  PHY: O-QPSK 
          Long HWaddr: DA:A0:4C:0F:6D:85:2A:E9 
           State: IDLE 
          ACK_REQ  L2-PDU:102  MTU:1280  HL:64  RTR  
          RTR_ADV  6LO  IPHC  
          Source address length: 8
          Link type: wireless
          inet6 addr: fe80::d8a0:4c0f:6d85:2ae9  scope: link  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ff85:2ae9
          inet6 group: ff02::1a
          
          Statistics for Layer 2
            RX packets 0  bytes 0
            TX packets 5 (Multicast: 5)  bytes 0
            TX succeeded 4 errors 0
          Statistics for IPv6
            RX packets 0  bytes 0
            TX packets 4 (Multicast: 4)  bytes 242
            TX succeeded 4 errors 0

> ssh -t weoss@saclay.iot-lab.info 'socat - tcp:nrf52840dk-6.saclay.iot-lab.info:20000' 
[INFO: Main      ] Starting Contiki-NG-develop/v4.9-407-g1707d485d-dirty
[INFO: Main      ] - Routing: RPL Lite
[INFO: Main      ] - Net: sicslowpan
[INFO: Main      ] - MAC: CSMA
[INFO: Main      ] - 802.15.4 PANID: 0xabcd
[INFO: Main      ] - 802.15.4 De
#f4ce.36c3.4db0.1d35> ip-addr
Node IPv6 addresses:
-- fe80::f6ce:36c3:4db0:1d35
#f4ce.36c3.4db0.1d35> ifconfig 6 set pan_id abcd
ifconfig 6 set pan_id abcd
success: set network identifier on interface 6 to 0xabcd
> ping fe80::d8a0:4c0f:6d85:2ae9
Pinging fe80::d8a0:4c0f:6d85:2ae9
Received ping reply from fe80::d8a0:4c0f:6d85:2ae9, len 4, ttl 64, delay 46 ms
#f4ce.36c3.4db0.1d35> PING START ================
ping fe80::f6ce:36c3:4db0:1d35
ping fe80::f6ce:36c3:4db0:1d35
12 bytes from fe80::f6ce:36c3:4db0:1d35%6: icmp_seq=0 ttl=64 rssi=56 dBm time=45.523 ms
12 bytes from fe80::f6ce:36c3:4db0:1d35%6: icmp_seq=1 ttl=64 rssi=56 dBm time=22.077 ms
12 bytes from fe80::f6ce:36c3:4db0:1d35%6: icmp_seq=2 ttl=64 rssi=56 dBm time=5.378 ms

--- fe80::f6ce:36c3:4db0:1d35 PING statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 5.378/24.326/45.523 ms
> #f4ce.36c3.4db0.1d35 -c 3 -i 1 -s 12 -W 1000
#f4ce.36c3.4db0.1d35 -c 3 -i 1 -s 12 -W 1000
shell: command not found: #f4ce.36c3.4db0.1d35

This is a quick (not really that quick) and dirty way and I would appreciate suggestions on how to clean it up.

@MrKevinWeiss MrKevinWeiss force-pushed the pr/automate0803 branch 4 times, most recently from 21071dd to 8063ca3 Compare October 24, 2023 16:02

# get the address of the contiki node, ie a substring after "-- "
res = contiki_node.cmd("ip-addr")
contiki_addr = res[res.find("-- ") + 3 :]
Copy link
Member

Choose a reason for hiding this comment

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

Let's make flake8 happy :-)

Suggested change
contiki_addr = res[res.find("-- ") + 3 :]
contiki_addr = res[(res.find("-- ") + 3):]

Copy link
Member

@miri64 miri64 Oct 24, 2023

Choose a reason for hiding this comment

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

Come to think of it: don't you rather want to do it as a regex? E.g.

Suggested change
contiki_addr = res[res.find("-- ") + 3 :]
match = re.search("-- ...(.+)", res)
assert match
contiki_addr = match[1]

@MrKevinWeiss
Copy link
Contributor Author

Ok, local tests worked and the static tests are happy. Anyone else have feedback?

)
def test_task03(riot_ctrl):
# run `./compile_contiki.sh` relative to this file
subprocess.check_call(["./compile_contiki.sh"], cwd=__file__[: __file__.rfind("/")])
Copy link
Member

@miri64 miri64 Oct 26, 2023

Choose a reason for hiding this comment

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

Let's make this more pythonic and portable

Suggested change
subprocess.check_call(["./compile_contiki.sh"], cwd=__file__[: __file__.rfind("/")])
subprocess.check_call(
["./compile_contiki.sh"],
cwd=os.path.dirname(os.path.realpath(__file__)),
)

Copy link
Member

Choose a reason for hiding this comment

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

Other than that, I think this is good to go

Copy link
Member

Choose a reason for hiding this comment

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

Ping?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops ya that makes sense

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@MrKevinWeiss
Copy link
Contributor Author

I just removed some unneeded copy pasta flags in the docker command in the contiki script

Copy link
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.

ACK

@miri64 miri64 merged commit 6a14ffc into RIOT-OS:master Nov 3, 2023
3 checks passed
@MrKevinWeiss MrKevinWeiss deleted the pr/automate0803 branch November 3, 2023 12:33
@MrKevinWeiss
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants