# Test the IPv6 mesh boundary below Matter

Use real RPL border-router firmware to test two end devices before and after router loss, then separate mesh evidence from Matter claims.

## Run on Linux x86-64 with Docker and X11

The image, Java, compiler and simulator ran on this host under Apptainer.
Docker is unavailable here: the laptop Docker invocation is syntax-reviewed,
not claimed as laptop-tested. Windows, macOS and ARM display setup is outside
this recipe. No paid service or account is required.

Download `lab-files.tar.gz` from this lab page. In a terminal:

```bash
mkdir cooja-lab
cd cooja-lab
tar -xzf ~/Downloads/lab-files.tar.gz
git clone --depth 1 --branch release/v4.9 https://github.com/contiki-ng/contiki-ng.git contiki-ng
test "$(git -C contiki-ng rev-parse HEAD)" = c20b12cd2db707d6c07918f8b26cfeb52cf298ca
git -C contiki-ng submodule update --init --depth 1 tools/cooja
test "$(git -C contiki-ng/tools/cooja rev-parse HEAD)" = 33d41ae9f8acd6075fb903b0bcd5b4122bad8d8f
mkdir -p jdk17 home/contiki-ng
curl -fL 'https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.20.1%2B1/OpenJDK17U-jdk_x64_linux_hotspot_17.0.20.1_1.tar.gz' -o jdk17.tar.gz
echo '3808d1d15e3ec6bd5b84057fb5d84c33d8a1536a258146bcea2e603fc726e08e  jdk17.tar.gz' | sha256sum -c -
tar -xzf jdk17.tar.gz --strip-components=1 -C jdk17
xhost +si:localuser:$(id -un)
bash cooja-thread-mesh-for-matter/docker-launch.sh
# After closing Cooja:
xhost -si:localuser:$(id -un)
```

The launcher binds the packet at `/lab`. Cooja loads `/lab/cooja-thread-mesh-for-matter.csc`
and compiles the included upstream example files (any small scenario edits are listed in UPSTREAM.md). The project header enables
logging and any explicitly documented parameter changes. The supplied Makefiles
expect the recipe's `/home/user/contiki-ng` mount. The first Gradle build requires
Internet. To use your own native Java 17 installation, set CONTIKI in the supplied
Makefiles to your checkout and open the CSC with that release's Cooja.

The script starts automatically and stops at `TEST OK` or `TEST FAILED`. The GUI
stays open. Use **Mote output → Filter** to show the rows named in the steps;
clear the filter to inspect other messages. **File → Open simulation → Browse...**
loads another CSC. Reopen the original CSC for a fresh seed-1 run.
Times are simulated times, not wall-clock times. `expected-output.txt` is the
unaltered headless serial/test log, including actual measurements and the test result.

For headless Docker execution, replace `--gui --autostart` in the launcher with
`--no-gui --logdir=/lab/run-output` and remove the display requirement/mount.
Cooja writes `COOJA.testlog` under that writable output directory.

## What actually runs

Root 1 compiles the unchanged examples/rpl-border-router/border-router.c and the
upstream rpl-border-router service. Its web server is disabled. The service
waits with radio off until its serial SLIP interface receives a prefix; the
ScriptRunner sends the real `!P` SLIP configuration for fd00::/64 at 2.065 s.
It then becomes the DAG root and turns the radio on. The script supplies only
the prefix: it does not create a TUN device, attach an external host or test
external IP forwarding. No network configuration is changed on the laptop.

Routers 2/3 and leaf-only end devices 4/5 run unchanged examples/rpl-udp clients.
The root is **not** the udp-server example. There is no UDP echo service, so
background hello traffic gets an ICMPv6 destination error. Stock clients log
Unknown ICMPv6 message type/code 1 rather than application replies. These lines
are retained. The acceptance test uses ICMP echo, not claimed UDP delivery.
`root_received=0` is expected and is not evidence of a working application.

This runs real Contiki-NG IPv6/6LoWPAN/RPL over simulated IEEE 802.15.4. It is
an educational analogue for an IPv6 mesh below a Matter deployment. It does
**not** run Thread's routing/commissioning stack or a Matter implementation.
Do not call it an OpenThread border router, Matter bridge or certified device.

Seed 1; 210 s; UDGM transmit 50 m/interference 100 m, success 1. Root=(0,0),
routers 2=(-30,25), 3=(30,25), leaves 4=(-5,55), 5=(5,55).
GUI pauses at 89.065 s; click Start/Pause once to complete the same fault test.
Reopen the CSC to reset the removed router and all state before repeating.

| Observation | End device 4 | End device 5 |
|---|---|---|
| Pre-fault ping | 112 ms, TTL 63 | 104 ms, TTL 63 |
| Pre-fault parent | 3 (unaffected control) | 2 (removed at 90.065 s) |
| Post-fault selected router | 3 | 3 |
| Post-fault ping | 61 ms, TTL 63 | 88 ms, TTL 63 |

Source 4 already used router 3 and is the unaffected comparison.
Source 5's parent change is logged at 101.046728 s. The post-fault probes are
scheduled at 180 and 190 seconds; they prove reachability then, not the exact
first instant each end device could deliver application data. All four pings,
the prefix event and the new source-5 parent are ScriptRunner assertions.

## Matter scenario and scope worksheet (not simulated)

Preserve the original lab's evidence discipline: state scenario, model boundary,
traces, findings, failure, limits, decision and next implementation evidence.
Choose a contact sensor reporting to a controller, and fill this table before
claiming an end-to-end Matter result:

| Layer / question | This Cooja packet | Evidence still required |
|---|---|---|
| IPv6 mesh path after router loss | Pre/post ICMP replies from two devices | OpenThread and physical RF tests for the intended product |
| Border routing to a controller | Prefix initialization only | External interface and bidirectional controller path |
| Data model | No Matter endpoints or clusters | Descriptor read, device types, cluster/attribute/command inventory |
| Commissioning | Not executed | Setup state, PASE/attestation boundary, fabric and operational CASE session |
| Interactions | Not executed | Read, write, invoke, status, event and subscribe traces with identities |
| Reset / subscription recovery | Not executed | Fresh reports after reset or path recovery, with failures retained |
| Multi-admin and access control | Not executed | Per-fabric authority, denied actions and fabric-removal retest |
| Physical behavior / provisioning | Not executed | Real device state, credential custody, manufacturing and power evidence |
| Certification | Not established | Settled product scope/PICS, conformance and interoperability evidence |

Worked decisions retained from the original lab:

* A setup-to-first-contact report with explicit excluded attestation details may
  support a bounded SDK learning result, but not credential-storage readiness.
* If a removed fabric still invokes a light, hold the multi-admin claim. Repeat
  authority, ACL, command, subscription and reset tests after fixing it.
* A bridge translating a Zigbee light to a Matter endpoint proves only the
  mapped behavior. Record delayed/offline diagnostics and native status feedback;
  do not label a translation result native Matter compatibility.

A real Matter SDK simulation can exercise PASE/CASE and interaction-model code
on host networking, while excluding physical BLE, radio and hardware limits.
This packet is the opposite boundary: it exercises an IPv6 mesh analogue but
none of that Matter application logic. Keep the two evidence records separate.

Failure worksheet: define bad setup material, denied fabric action, unsupported
command, stale attribute, dropped subscription and reset behavior. Mark every
one untested here. One passing happy-path command in a separate SDK run would
not cancel a subscription-recovery failure. Preserve that failure and retest.

Final decision: accept this seed/topology's two mesh reachability paths after
router loss. Hold end-to-end Matter, external border forwarding and certification
claims. Name owner, next implementation test and retest after firmware, routing,
placement, traffic, fabric, controller or device-type changes. No credentials
are included or needed in the supplied simulation.


## Tested version

Contiki-NG release/v4.9 c20b12cd, Cooja 4.8 (2022071901), Temurin 17.0.20.1, image sha256:b14d5afb0a2a852d9e72bbed607ead03f6ccc5f4d4dee44f0799110be2f4b609
