From 0f1db2bd98551eb9161e63a72692a7e1bf738da5 Mon Sep 17 00:00:00 2001 From: Martin Lenders Date: Sun, 15 Dec 2013 15:46:01 +0100 Subject: [PATCH] Implement 6LoWPAN plugtests --- 6lpplugtest/.gitignore | 2 + 6lpplugtest/Makefile | 203 ++ 6lpplugtest/README.md | 6645 ++++++++++++++++++++++++++++++++++ 6lpplugtest/build_all.sh | 87 + 6lpplugtest/flash_pair.sh | 38 + 6lpplugtest/main.c | 553 +++ 6lpplugtest/td1.html | 5140 ++++++++++++++++++++++++++ 6lpplugtest/test_coap_ping.c | 112 + 6lpplugtest/test_coap_ping.h | 7 + 6lpplugtest/test_format.c | 1150 ++++++ 6lpplugtest/test_format.h | 359 ++ 6lpplugtest/test_hc.c | 827 +++++ 6lpplugtest/test_hc.h | 366 ++ 6lpplugtest/test_nd.c | 201 + 6lpplugtest/test_nd.h | 252 ++ 6lpplugtest/test_nd_hc.c | 82 + 6lpplugtest/test_nd_hc.h | 270 ++ 6lpplugtest/test_shell.c | 782 ++++ 6lpplugtest/test_shell.h | 6 + 6lpplugtest/test_utils.c | 268 ++ 6lpplugtest/test_utils.h | 45 + 21 files changed, 17395 insertions(+) create mode 100644 6lpplugtest/.gitignore create mode 100644 6lpplugtest/Makefile create mode 100644 6lpplugtest/README.md create mode 100755 6lpplugtest/build_all.sh create mode 100755 6lpplugtest/flash_pair.sh create mode 100644 6lpplugtest/main.c create mode 100644 6lpplugtest/td1.html create mode 100644 6lpplugtest/test_coap_ping.c create mode 100644 6lpplugtest/test_coap_ping.h create mode 100644 6lpplugtest/test_format.c create mode 100644 6lpplugtest/test_format.h create mode 100644 6lpplugtest/test_hc.c create mode 100644 6lpplugtest/test_hc.h create mode 100644 6lpplugtest/test_nd.c create mode 100644 6lpplugtest/test_nd.h create mode 100644 6lpplugtest/test_nd_hc.c create mode 100644 6lpplugtest/test_nd_hc.h create mode 100644 6lpplugtest/test_shell.c create mode 100644 6lpplugtest/test_shell.h create mode 100644 6lpplugtest/test_utils.c create mode 100644 6lpplugtest/test_utils.h diff --git a/6lpplugtest/.gitignore b/6lpplugtest/.gitignore new file mode 100644 index 0000000..43f0aa8 --- /dev/null +++ b/6lpplugtest/.gitignore @@ -0,0 +1,2 @@ +*.bin +*.elf diff --git a/6lpplugtest/Makefile b/6lpplugtest/Makefile new file mode 100644 index 0000000..2643cbf --- /dev/null +++ b/6lpplugtest/Makefile @@ -0,0 +1,203 @@ +#### +#### Sample Makefile for building apps with the RIOT OS +#### +#### The Sample Filesystem Layout is: +#### /this makefile +#### ../RIOT +#### ../../boards for board definitions (if you have one or more) +#### + +QUIET ?= 1 +USE_SHELL ?= 1 +PAN_ID ?= 0xabcd +CHANNEL ?= 11 +EUI64 ?= "20:14:02:20:AA:BB:CC:DD" +DATA ?= "$(shell for i in $$(seq 1280); do printf "\\%03o" $$(( (i % 255) + 1 )); done; echo "" )" + +# name of your project +export PROJECT=6lpplugtest + +# for easy switching of boards +ifeq ($(strip $(BOARD)),) + export BOARD=native +endif + +ifneq (,$(findstring msb-430,$(BOARD))) +include $(CURDIR)/../Makefile.unsupported +else + +# this has to be the absolute path of the RIOT-base dir +export RIOTBASE =$(CURDIR)/../../RIOT + +ifeq ($(BOARD),stm32f4discovery) + include Makefile.$(BOARD) +endif + +ifeq ($(FORMAT),1) + CFLAGS += -DFORMAT -DTEST1 +else ifeq ($(FORMAT),2) + CFLAGS += -DFORMAT -DTEST2 +else ifeq ($(FORMAT),3) + CFLAGS += -DFORMAT -DTEST3 +else ifeq ($(FORMAT),4) + CFLAGS += -DFORMAT -DTEST4 +else ifeq ($(FORMAT),5) + CFLAGS += -DFORMAT -DTEST5 +else ifeq ($(FORMAT),6) + CFLAGS += -DFORMAT -DTEST6 +else ifeq ($(FORMAT),7) + CFLAGS += -DFORMAT -DTEST7 +else ifeq ($(FORMAT),8) + CFLAGS += -DFORMAT -DTEST8 +endif + +ifeq ($(HC),1) + CFLAGS += -DHC -DTEST1 +else ifeq ($(HC),2) + CFLAGS += -DHC -DTEST2 +else ifeq ($(HC),3) + CFLAGS += -DHC -DTEST3 +else ifeq ($(HC),4) + CFLAGS += -DHC -DTEST4 +else ifeq ($(HC),5) + CFLAGS += -DHC -DTEST5 +else ifeq ($(HC),6) + CFLAGS += -DHC -DTEST6 +else ifeq ($(HC),7) + CFLAGS += -DHC -DTEST7 +else ifeq ($(HC),8) + CFLAGS += -DHC -DTEST8 +else ifeq ($(HC),9) + CFLAGS += -DHC -DTEST9 +else ifeq ($(HC),10) + CFLAGS += -DHC -DTEST10 +endif + +ifeq ($(ND),1) + IPPREFIX ?= "abcd:ef01::/64" + CFLAGS += -DND -DTEST1 +else ifeq ($(ND),2) + IPPREFIX ?= "abcd:ef01::/64" + CFLAGS += -DND -DTEST2 +else ifeq ($(ND),3) + IPPREFIX ?= "abcd:ef01::/64" + CFLAGS += -DND -DTEST3 +else ifeq ($(ND),4) + IPPREFIX ?= "abcd:ef01::/64" + CFLAGS += -DND -DTEST4 +else ifeq ($(ND),5) + IPPREFIX ?= "abcd:ef01::/64" + CFLAGS += -DND -DTEST5 +else ifeq ($(ND),6) + IPPREFIX ?= "abcd:ef01::/64 1234:6789::/64 1337::/64" + CFLAGS += -DND -DTEST6 -DIPPREFIX_LEN=3 +else ifeq ($(ND),7) + IPPREFIX ?= "abcd:ef01::/64 1234:6789::/64 1337::/64" + CFLAGS += -DND -DTEST7 -DIPPREFIX_LEN=3 +endif + +ifeq ($(ND_HC),1) + CFLAGS += -DND_HC -DTEST1 +else ifeq ($(ND_HC),2) + CFLAGS += -DND_HC -DTEST2 +else ifeq ($(ND_HC),3) + CFLAGS += -DND_HC -DTEST3 +else ifeq ($(ND_HC),4) + CFLAGS += -DND_HC -DTEST4 +endif + +ifeq ($(EUT),1) + CFLAGS += -DEUT1 + DEST ?= "fe80::ff:fe00:2" +else ifeq ($(EUT),2) + CFLAGS += -DEUT2 -DCONF_RADIO_ADDR=2 + DEST ?= "fe80::ff:fe00:1" +endif + +ifneq ($(DEST),) + CFLAGS += -DDEST=\"$(DEST)\" +endif + +ifneq ($(DATA),) + CFLAGS += -DDATA=\"$(DATA)\" +endif + +ifneq ($(CHANNEL),) + CFLAGS += -DCHANNEL=$(CHANNEL) +endif + +ifneq ($(EUI64),) + CFLAGS += -DEUI64=\"$(EUI64)\" +endif + +ifneq ($(PAN_ID),) + CFLAGS += -DPAN_ID=$(PAN_ID) +endif + +## Modules to include. +ifneq (,$(filter -DHC,$(CFLAGS))) + ifneq (,$(filter -DTEST5 -DTEST6 -DTEST7 -DTEST8,$(CFLAGS))) + IPPREFIX ?= "abcd:ef01::/64" + USEPKG += libcoap + endif +endif + +ifneq ($(IPPREFIX),) + CFLAGS += -DIPPREFIX=\"$(IPPREFIX)\" +endif + +ifeq ($(USE_SHELL),1) + IPPREFIX ?= "abcd:ef01::/64" + USEPKG += libcoap + USEMODULE += shell + USEMODULE += shell_commands + USEMODULE += posix +endif + +USEMODULE += auto_init +USEMODULE += sixlowpan +USEMODULE += vtimer + +ifeq ($(BOARD),msba2) + USEMODULE += cc110x_ng +else ifeq ($(BOARD),iot-lab_M3) + USEMODULE += at86rf231 +else ifeq ($(BOARD),native) + USEMODULE += nativenet +endif + +export INCLUDES = -I$(RIOTBASE)/sys/net/include \ + -I$(RIOTBASE)/sys/posix/pnet/include + +include $(RIOTBASE)/Makefile.include + +clean-app: clean-shell clean + rm -rf format*.elf + rm -rf hc*.elf + rm -rf nd*.elf + rm -rf nd-hc*.elf + make -C $(RIOTBASE)/pkg/libcoap distclean + +clean-shell: clean-format clean-hc clean-nd clean-nd-hc + rm -rf bin/$(BOARD)/$(PROJECT)/test_shell.o + +clean-format: clean-autoinit + rm -rf bin/$(BOARD)/$(PROJECT)/test_format.o \ + bin/$(BOARD)/$(PROJECT)/main.o + +clean-hc: clean-autoinit + rm -rf bin/$(BOARD)/$(PROJECT)/test_hc.o \ + bin/$(BOARD)/$(PROJECT)/main.o + +clean-nd: clean-autoinit + rm -rf bin/$(BOARD)/$(PROJECT)/test_nd.o \ + bin/$(BOARD)/$(PROJECT)/main.o + +clean-nd-hc: clean-autoinit + rm -rf bin/$(BOARD)/$(PROJECT)/test_nd_hc.o \ + bin/$(BOARD)/$(PROJECT)/main.o + +clean-autoinit: + rm -rf bin/$(BOARD)/auto_init.[ao] + +endif diff --git a/6lpplugtest/README.md b/6lpplugtest/README.md new file mode 100644 index 0000000..e7cb374 --- /dev/null +++ b/6lpplugtest/README.md @@ -0,0 +1,6645 @@ +# 6LoWPAN plugtests +## Usage +The plugtests are compilable in two configurations: as a shell application and +as single test binaries. The shell application is the default but if you need +the parameter, its + +```bash +USE_SHELL=1 make +``` + +To compile a single test as binary you need to specify which test you want to +run and which test unit (EUT) you want to use. FORMAT tests are selected with +the variable ``FORMAT``, HC tests are selected with the variable ``HC``, +ND tests are selected with the variable ``ND``, and ND_HC tests are selected +with the variable ``ND_HC`` (see Test descriptions). + +```bash +USE_SHELL=0 FORMAT=1 EUT=1 make +``` + +There is a script, that generates all tests as binaries in the form ``_eut.elf``. + +```bash +./build_all.sh +``` + +## Test descriptions (by ETSI) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Interoperability Test Description +
+Identifier: + +TD_6LoWPAN_FORMAT_01 +
+Objective: + +Check that EUTs correctly handle uncompressed 6LoWPAN packets (EUI-64 +link-local) +
+Configuration: + +Node-Node +
+References: + +RFC 4944 5.1, 8 +
+Pre-test conditions: + +
  • +Header compression is disabled on both EUT1 and EUT2 +
  • +
  • +EUT1 and EUT2 are configured to use EUI-64 +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's link-local address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
    + +1 + +Check + +
  • +EUT1 sends an uncompressed 6LoWPAN packet containing the Echo Request +message to EUT2's link-local address +
  • +
  • +Dispatch value in 6LowPAN packet is “01000001” +
  • +
  • +Both source and destination addresses are EUI-64 link-local +
  • +
    + +2 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +3 + +Check + +
  • +EUT2 sends an uncompressed 6LoWPAN packet containing the Echo Reply +message to EUT1's link-local address +
  • +
  • +Dispatch value in 6LowPAN packet is “01000001” +
  • +
  • +Both source and destination addresses are EUI-64 link-local +
  • +
    + +4 + +Verify + +EUT1 receives the Echo Reply message from EUT2 +
    + +5 + +Check + +The data received in the echo reply message is identical to that sent in +EUT1's echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_FORMAT_02 +
    +Objective: + +Check that EUTs correctly handle uncompressed 6LoWPAN packets (16-bit +link-local) +
    +Configuration: + +Node-Node +
    +References: + +RFC 4944 5.1, 8 +
    +Pre-test conditions: + +
  • +Header compression is disabled on both EUT1 and EUT2 +
  • +
  • +EUT1 and EUT2 are configured to use 16-bit short address +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's link-local address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
    + +1 + +Check + +
  • +EUT1 sends an uncompressed 6LoWPAN packet containing the Echo Request +message to EUT2's link-local address +
  • +
  • +Dispatch value in 6LowPAN packet is “01000001” +
  • +
  • +Both source and destination addresses are 16 bit short link-local +
  • +
    + +2 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +3 + +Check + +
  • +EUT2 sends an uncompressed 6LoWPAN packet containing the Echo Reply +message to EUT1's link-local address +
  • +
  • +Dispatch value in 6LowPAN packet is “01000001” +
  • +
  • +Both source and destination addresses are 16 bit short link-local +
  • +
    + +4 + +Verify + +EUT1 receives the Echo Reply message from EUT2 +
    + +5 + +Check + +The data received in the echo reply message is identical to that sent in +EUT1's echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_FORMAT_03 +
    +Objective: + +Check that EUTs correctly handle uncompressed 6LoWPAN fragmented packets +
    +Configuration: + +Node-Node +
    +References: + +RFC 4944 5.1, 5.3 +
    +Pre-test conditions: + +Header compression is disabled on both EUT1 and EUT2 +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's link-local address +
  • +
  • +ICMP payload = 253 bytes, total IPv6 size 301 bytes +
  • +
    + +1 + +Check + +
  • +EUT1 sends a sequence of uncompressed 6LoWPAN packets containing the +Echo Request fragments to EUT2 +
  • +
  • +EUT1 correctly fragments the Echo Request: +
  • +
  • +a 6LoWPAN FRAG1 header (dispatch 11000xxx) is included in the first +packet +
  • +
  • +a 6LoWPAN FRAGN header (dispatch 11100xxx) is included in all following +packets +
  • +
  • +the offsets form a contiguous sequence +
  • +
  • +all fragments except the last one must be multiples of 8 bytes +
  • +
    + +2 + +Verify + +EUT2 reassembles correctly the fragments and receives the Echo Request +message from EUT1 +
    + +3 + +Check + +
  • +EUT2 sends a sequence of uncompressed 6LoWPAN packets containing the +Echo Reply message to EUT1 +
  • +
  • +EUT1 correctly fragments the Echo Reply: +
  • +
  • +a 6LoWPAN FRAG1 header (dispatch 11000xxx) is included in the first +packet +
  • +
  • +a 6LoWPAN FRAGN header (dispatch 11100xxx) is included in all following +packets +
  • +
  • +the offsets form a contiguous sequence +
  • +
  • +all fragments except the last one must be multiples of 8 bytes +
  • +
  • +The data in the echo reply message packets is identical to that sent in +the echo request message packets +
  • +
    + +4 + +Verify + +EUT1 correctly reassembles the fragments and receives the Echo Reply +message from EUT2 +
    + +5 + +Verify + +The data in the received echo reply message is identical to that sent in +the echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_FORMAT_04 +
    +Objective: + +Check that EUTs correctly handle maximum size uncompressed 6LoWPAN +fragmented packets +
    +Configuration: + +Node-Node +
    +References: + +RFC 4944 5.1, 5.3 +
    +Pre-test conditions: + +Header compression is disabled on both EUT1 and EUT2 +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's link-local address +
  • +
  • +ICMP payload = 1232 bytes, total IPv6 size 1280 bytes +
  • +
    + +1 + +Check + +
  • +EUT1 sends a sequence of uncompressed 6LoWPAN packets containing the +Echo Request fragments to EUT2 +
  • +
  • +EUT1 correctly fragments the Echo Request: +
  • +
  • +a 6LoWPAN FRAG1 header (dispatch 11000xxx) is included in the first +packet +
  • +
  • +a 6LoWPAN FRAGN header (dispatch 11100xxx) is included in all following +packets +
  • +
  • +the offsets form a contiguous sequence +
  • +
  • +all fragments except the last one must be multiples of 8 bytes +
  • +
    + +2 + +Verify + +EUT2 reassembles correctly the fragments and receives the Echo Request +message from EUT1 +
    + +3 + +Check + +
  • +EUT2 sends a sequence of uncompressed 6LoWPAN packets containing the +Echo Reply message to EUT1 +
  • +
  • +EUT1 correctly fragments the Echo Reply: +
  • +
  • +a 6LoWPAN FRAG1 header (dispatch 11000xxx) is included in the first +packet +
  • +
  • +a 6LoWPAN FRAGN header (dispatch 11100xxx) is included in all following +packets +
  • +
  • +the offsets form a contiguous sequence +
  • +
  • +all fragments except the last one must be multiples of 8 bytes +
  • +
  • +The data in the echo reply message packets is identical to that sent in +the echo request message packets +
  • +
    + +4 + +Verify + +EUT1 correctly reassembles the fragments and receives the Echo Reply +message from EUT2 +
    + +5 + +Verify + +The data in the received echo reply message is identical to that sent in +the echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_FORMAT_05 +
    +Objective: + +Check that EUTs correctly handle uncompressed 6LoWPAN multicast to +all-nodes (16-bit link-local) +
    +Configuration: + +Node-Node +
    +References: + +RFC 4944 5.1, 8 +
    +Pre-test conditions: + +
  • +Header compression is disabled on both EUT1 and EUT2 +
  • +
  • +EUT1 and EUT2 are configured to use 16-bit short address +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +EUT1 initiates an echo request to the link-local all-nodes multicast +address (FF02::1) (ICMP payload = 4 bytes, total IPv6 size 52 bytes) +
    + +1 + +Check + +EUT1 sends an uncompressed 6LoWPAN packet containing the Echo Request +message to EUT2 +
    + +2 + +Check + +Dispatch value in 6LowPAN packet is “01000001” +
    + +3 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +4 + +Check + +EUT2 sends an uncompressed 6LoWPAN packet containing the Echo Reply +message to EUT1 +
    + +5 + +Check + +Dispatch value in 6LowPAN packet is “01000001” +
    + +6 + +Verify + +EUT1 receives the Echo Reply message from EUT2 +
    + +7 + +Check + +The data in the echo reply message is identical to that in the echo +request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_FORMAT_06 +
    +Objective: + +Check that EUTs correctly handle uncompressed 6LoWPAN multicast to +all-nodes (EUI-64 link-local) +
    +Configuration: + +Node-Node +
    +References: + +RFC 4944 5.1, 8 +
    +Pre-test conditions: + +
  • +Header compression is disabled on both EUT1 and EUT2 +
  • +
  • +EUT1 and EUT2 are configured to use EUI-64 +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +EUT1 initiates an echo request to the link-local all-nodes multicast +address (FF02::1) (ICMP payload = 4 bytes, total IPv6 size 52 bytes) +
    + +1 + +Check + +EUT1 sends an uncompressed 6LoWPAN packet containing the Echo Request +message to EUT2 +
    + +2 + +Check + +Dispatch value in 6LowPAN packet is “01000001” +
    + +3 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +4 + +Check + +EUT2 sends an uncompressed 6LoWPAN packet containing the Echo Reply +message to EUT1 +
    + +5 + +Check + +Dispatch value in 6LowPAN packet is “01000001” +
    + +6 + +Verify + +EUT1 receives the Echo Reply message from EUT2 +
    + +7 + +Check + +The data in the echo reply message is identical to that in the echo +request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_FORMAT_07 +
    +Objective: + +Check that EUTs correctly handle uncompressed 6LoWPAN packets (EUI-64 to +16-bit link-local) +
    +Configuration: + +Node-Node +
    +References: + +RFC 4944 5.1, 8 +
    +Pre-test conditions: + +
  • +Header compression is disabled on both EUT1 and EUT2 +
  • +
  • +EUT1 is configured to use EUI-64 and EUT2 is configured to use 16-bit +short address +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's link-local address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
    + +1 + +Check + +
  • +EUT1 sends an uncompressed 6LoWPAN packet containing the Echo Request +message to EUT2's link-local address +
  • +
  • +Dispatch value in 6LowPAN packet is “01000001” +
  • +
  • +Source address is EUI-64 link-local +
  • +
  • +Destination address is 16 bit short link-local +
  • +
    + +2 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +3 + +Check + +
  • +EUT2 sends an uncompressed 6LoWPAN packet containing the Echo Reply +message to EUT1's link-local address +
  • +
  • +Dispatch value in 6LowPAN packet is “01000001” +
  • +
  • +Source address is 16 bit short link-local +
  • +
  • +Destination address is EUI-64 link-local +
  • +
    + +4 + +Verify + +EUT1 receives the Echo Reply message from EUT2 +
    + +5 + +Check + +The data received in the echo reply message is identical to that sent in +EUT1's echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_FORMAT_08 +
    +Objective: + +Check that EUTs correctly handle uncompressed 6LoWPAN packets (16-bit to +EUI-64 link-local) +
    +Configuration: + +Node-Node +
    +References: + +RFC 4944 5.1, 8 +
    +Pre-test conditions: + +
  • +Header compression is disabled on both EUT1 and EUT2 +
  • +
  • +EUT1 is configured to use 16-bit short address and EUT2 is configured to +use EUI-64 +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's link-local address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
    + +1 + +Check + +
  • +EUT1 sends an uncompressed 6LoWPAN packet containing the Echo Request +message to EUT2's link-local address +
  • +
  • +Dispatch value in 6LowPAN packet is “01000001” +
  • +
  • +Source address is 16 bit short link-local +
  • +
  • +Destination address is EUI-64 link-local +
  • +
    + +2 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +3 + +Check + +
  • +EUT2 sends an uncompressed 6LoWPAN packet containing the Echo Reply +message to EUT1's link-local address +
  • +
  • +Dispatch value in 6LowPAN packet is “01000001” +
  • +
  • +Source address is EUI-64 link-local +
  • +
  • +Destination address is 16 bit short link-local +
  • +
    + +4 + +Verify + +EUT1 receives the Echo Reply message from EUT2 +
    + +5 + +Check + +The data received in the echo reply message is identical to that sent in +EUT1's echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_HC_01 +
    +Objective: + +Check that EUTs correctly handle compressed 6LoWPAN packets (EUI-64 +link-local, hop limit=64) +
    +Configuration: + +Node-Node +
    +References: + +RFC 6282 section 3 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both EUT1 and EUT2 +
  • +
  • +EUT1 and EUT2 are configured to use EUI-64 +
  • +
  • +EUT1 and EUT2 are configured with a default hop limit of 64 +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's link-local address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 64, no traffic class or flow label is being used +
  • +
    + +1 + +Check + +EUT1 sends a compressed 6LoWPAN packet containing the Echo Request +message to EUT2 +
    + +2 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +3 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +4 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +5 + +Feature + +In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + +6 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +7 + +Check + +EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message +to EUT1 +
    + +8 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +9 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +10 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +11 + +Feature + +In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + +12 + +Verify + +EUT1 receives the Echo Reply message from EUT2 +
    +Notes: + +
  • +The feature tests check that best compression is used (but this is not a +requirement for interoperability) +
  • +
  • +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_HC_02 +
    +Objective: + +Check that EUTs correctly handle compressed 6LoWPAN packets (16-bit +link-local, hop limit=64) +
    +Configuration: + +Node-Node +
    +References: + +RFC 6282 section 3 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both EUT1 and EUT2 +
  • +
  • +EUT1 and EUT2 are configured to use 16-bit short address +
  • +
  • +EUT1 and EUT2 are configured with a default hop limit of 64 +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's link-local address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 64, no traffic class or flow label is being used +
  • +
    + +1 + +Check + +EUT1 sends a compressed 6LoWPAN packet containing the Echo Request +message to EUT2 +
    + +2 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +3 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +4 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +5 + +Feature + +In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + +6 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +7 + +Check + +EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message +to EUT1 +
    + +8 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +9 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +10 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +11 + +Feature + +In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + +12 + +Verify + +EUT1 receives the Echo Reply message from EUT2 +
    +Notes: + +
  • +The feature tests check that best compression is used (but this is not a +requirement for interoperability) +
  • +
  • +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_HC_03 +
    +Objective: + +Check that EUTs correctly handle compressed 6LoWPAN packets (EUI-64 +link-local, hop limit=63) +
    +Configuration: + +Node-Node +
    +References: + +RFC 6282 section 3 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both EUT1 and EUT2 +
  • +
  • +EUT1 and EUT2 are configured to use EUI-64 +
  • +
  • +EUT1 and EUT2 are configured with a default hop limit of 63 +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's link-local address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 63, no traffic class or flow label is being used +
  • +
    + +1 + +Check + +EUT1 sends a compressed 6LoWPAN packet containing the Echo Request +message to EUT2 +
    + +2 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +3 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +4 + +Feature + +In IP_HC, HLIM (HL) is 00 and the hop limit field is carried in-line +
    + +5 + +Feature + +In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + +6 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +7 + +Check + +EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message +to EUT1 +
    + +8 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +9 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +10 + +Feature + +In IP_HC, HLIM (HL) is 00 and the hop limit field is carried in-line +
    + +11 + +Feature + +In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + +12 + +Verify + +EUT1 receives the Echo Reply message from EUT2 +
    +Notes: + +
  • +The feature tests check that best compression is used (but this is not a +requirement for interoperability) +
  • +
  • +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_HC_04 +
    +Objective: + +Check that EUTs correctly handle compressed 6LoWPAN packets (16-bit +link-local, hop limit=63) +
    +Configuration: + +Node-Node +
    +References: + +RFC 6282 section 3 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both EUT1 and EUT2 +
  • +
  • +EUT1 and EUT2 are configured to use 16-bit short address +
  • +
  • +EUT1 and EUT2 are configured with a default hop limit of 63 +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's link-local address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 63, no traffic class or flow label is being used +
  • +
    + +1 + +Check + +EUT1 sends a compressed 6LoWPAN packet containing the Echo Request +message to EUT2 +
    + +2 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +3 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +4 + +Feature + +In IP_HC, HLIM (HL) is 00 and the hop limit field is carried in-line +
    + +5 + +Feature + +In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + +6 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +7 + +Check + +EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message +to EUT1 +
    + +8 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +9 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +10 + +Feature + +In IP_HC, HLIM (HL) is 00 and the hop limit field is carried in-line +
    + +11 + +Feature + +In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + +12 + +Verify + +EUT1 receives the Echo Reply message from EUT2 +
    +Notes: + +
  • +The feature tests check that best compression is used (but this is not a +requirement for interoperability) +
  • +
  • +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_HC_05 +
    +Objective: + +Check that EUTs correctly handle compressed UDP packets (EUI-64, server +port 5683) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6282, 4.3 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both Host and Router +
  • +
  • +Host is configured to use EUI-64 address +
  • +
  • +A CoAP ping server is installed on port 5683 of the host +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +6LR initiates a CoAP Ping request to Host's CoAP Ping server +
    + +1 + +Check + +6LR sends a 6LoWPAN packet containing the CoAP Ping message to Host +
    + +2 + +Feature + +NH is set, NHC is 111100x0, the source port is compressed to 8 bits +(x=1) or uncompressed (x=0), the destination port is uncompressed 5683 +
    + +3 + +Verify + +Host receives the CoAP Ping message from 6LR +
    + +4 + +Check + +Host sends a 6LoWPAN packet containing the CoAP Reset message to 6LR +
    + +5 + +Feature + +NH is set, NHC is 1111000x, the source port is uncompressed 5683, the +destination port is compressed to 8 bits (x=1) or uncompressed (x=0) +
    + +6 + +Verify + +6LR receives the CoAP Reset message from Host +
    +Notes: + +The feature tests check that best compression is used (but this is not a +requirement for interoperability) +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_HC_06 +
    +Objective: + +Check that EUTs correctly handle compressed UDP packets (16-bit, server +port 5683) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6282, 4.3 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both Host and Router +
  • +
  • +Host is configured to use 16-bit address +
  • +
  • +A CoAP ping server is installed on port 5683 of the host +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +6LR initiates a CoAP Ping request to Host's CoAP Ping server +
    + +1 + +Check + +6LR sends a 6LoWPAN packet containing the CoAP Ping message to Host +
    + +2 + +Feature + +NH is set, NHC is 111100x0, the source port is compressed to 8 bits +(x=1) or uncompressed (x=0), the destination port is uncompressed 5683 +
    + +3 + +Verify + +Host receives the CoAP Ping message from 6LR +
    + +4 + +Check + +Host sends a 6LoWPAN packet containing the CoAP Reset message to 6LR +
    + +5 + +Feature + +NH is set, NHC is 1111000x, the source port is uncompressed 5683, the +destination port is compressed to 8 bits (x=1) or uncompressed (x=0) +
    + +6 + +Verify + +6LR receives the CoAP Reset message from Host +
    +Notes: + +The feature tests check that best compression is used (but this is not a +requirement for interoperability) +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_HC_07 +
    +Objective: + +Check that EUTs correctly handle compressed UDP packets (EUI-64, server +port 61616) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6282, 4.3 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both Host and Router +
  • +
  • +Host is configured to use EUI-64 address +
  • +
  • +A CoAP ping server is installed on port 61616 of the host +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +6LR initiates a CoAP Ping request to Host's CoAP Ping server +
    + +1 + +Check + +6LR sends a 6LoWPAN packet containing the CoAP Ping message to Host +
    + +2 + +Feature + +NH is set, NHC is 111100x1, the destination port is compressed to 4 bits +of 0000 (x=1) or 8 bits of 0xb0 (x=0) +
    + +3 + +Verify + +Host receives the CoAP Ping message from 6LR +
    + +4 + +Check + +Host sends a 6LoWPAN packet containing the CoAP Reset message to 6LR +
    + +5 + +Feature + +NH is set, NHC is 1111001x, the source port is compressed to 4 bits of +0000 (x=1) or 8 bits of 0xb0 (x=0) +
    + +6 + +Verify + +6LR receives the CoAP Reset message from Host +
    +Notes: + +The feature tests check that best compression is used (but this is not a +requirement for interoperability) +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_HC_08 +
    +Objective: + +Check that EUTs correctly handle compressed UDP packets (16-bit, server +port 61616) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6282, 4.3 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both Host and Router +
  • +
  • +Host is configured to use 16-bit address +
  • +
  • +A CoAP ping server is installed on port 61616 of the host +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +6LR initiates a CoAP Ping request to Host's CoAP Ping server +
    + +1 + +Check + +6LR sends a 6LoWPAN packet containing the CoAP Ping message to Host +
    + +2 + +Feature + +NH is set, NHC is 111100x1, the destination port is compressed to 4 bits +of 0000 (x=1) or 8 bits of 0xb0 (x=0) +
    + +3 + +Verify + +Host receives the CoAP Ping message from 6LR +
    + +4 + +Check + +Host sends a 6LoWPAN packet containing the CoAP Reset message to 6LR +
    + +5 + +Feature + +NH is set, NHC is 1111001x, the source port is compressed to 4 bits of +0000 (x=1) or 8 bits of 0xb0 (x=0) +
    + +6 + +Verify + +6LR receives the CoAP Reset message from Host +
    +Notes: + +The feature tests check that best compression is used (but this is not a +requirement for interoperability) +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_HC_09 +
    +Objective: + +Check that EUTs correctly handle compressed 6LoWPAN packets (EUI-64 to +16-bit link-local, hop limit=64) +
    +Configuration: + +Node-Node +
    +References: + +RFC 6282 section 3 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both EUT1 and EUT2 +
  • +
  • +EUT1 is configured to use EUI-64 and EUT2 is configured to use 16-bit +short address +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's link-local address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 64, no traffic class or flow label is being used +
  • +
    + +1 + +Check + +EUT1 sends a compressed 6LoWPAN packet containing the Echo Request +message to EUT2 +
    + +2 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +3 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +4 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +5 + +Feature + +In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + +6 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +7 + +Check + +EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message +to EUT1 +
    + +8 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +9 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +10 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +11 + +Feature + +In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + +12 + +Verify + +EUT1 receives the Echo Reply message from EUT2 +
    +Notes: + +
  • +The feature tests check that best compression is used (but this is not a +requirement for interoperability) +
  • +
  • +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_HC_10 +
    +Objective: + +Check that EUTs correctly handle compressed 6LoWPAN packets (16-bit to +EUI-64 link-local, hop limit=64) +
    +Configuration: + +Node-Node +
    +References: + +RFC 6282 section 3 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both EUT1 and EUT2 +
  • +
  • +EUT1 is configured to use 16-bit short address and EUT2 is configured to +use EUI-64 +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's link-local address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 64, no traffic class or flow label is being used +
  • +
    + +1 + +Check + +EUT1 sends a compressed 6LoWPAN packet containing the Echo Request +message to EUT2 +
    + +2 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +3 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +4 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +5 + +Feature + +In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + +6 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +7 + +Check + +EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message +to EUT1 +
    + +8 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +9 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +10 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +11 + +Feature + +In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + +12 + +Verify + +EUT1 receives the Echo Reply message from EUT2 +
    +Notes: + +
  • +The feature tests check that best compression is used (but this is not a +requirement for interoperability) +
  • +
  • +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_ND_01 +
    +Objective: + +Check that a host is able to register its global IPv6 address (EUI-64) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6775 10.2 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both Host and Router +
  • +
  • +Host is configured to use EUI-64 address +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +Initialize the network interface of the Host +
    + +1 + +Check + +The Host sends a Router Solicitation to all-routers multicast address +with SLLAO (EUI-64). Source = link local based on EUI-64 +
    + +2 + +Verify + +The Router receives the Router Solicitation from the host. +
    + +3 + +Check + +
  • +The Router sends a unicast Router Advertisement containing PIO and +optionally 6COs to the host. +
  • +
  • +Link local addresses are used. +
  • +
  • +The L bit is not set. +
  • +
    + +4 + +Verify + +The host receives the Router Advertisement from the router +
    + +5 + +Check + +The host configures its tentative global IPv6 address based on the PIO +information in RA from the Router (EUI-64) +
    + +6 + +Check + +The host registers its tentative address by sending a unicast Neighbor +Solicitation containing ARO and SLLAO. Source = GP64 +
    + +7 + +Verify + +The Router receives the Neighbor Solicitation from the host. +
    + +8 + +Check + +The Router sends a Neighbor Advertisement with Status set to 0 (Dest = +GP64) +
    + +9 + +Verify + +The host updates the status of the tentative address +
    + +10 + +Stimulus + +
  • +The Router initiates an echo request to the Host's new global address, +using its own global address as the source +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 64, no traffic class or flow label is being used +
  • +
    + +11 + +Check + +The Router sends a 6LoWPAN packet containing the Echo Request message to +the Host +
    + +12 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +13 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +14 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +15 + +Verify + +The Host receives the Echo Request message from the Router +
    + +16 + +Check + +The Host sends a 6LoWPAN packet containing the Echo Reply message to the +Router +
    + +17 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +18 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +19 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +20 + +Verify + +The Router receives the Echo Reply message from the Host +
    +Notes: + +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_ND_02 +
    +Objective: + +Check that a host is able to register its global IPv6 address (16-bit) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6775 10.2 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both Host and Router +
  • +
  • +Host is configured to use 16 bit short address +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +Initialize the network interface of the Host +
    + +1 + +Check + +The Host sends a Router Solicitation to all-routers multicast address +with SLLAO (EUI-64). Source = link local based on EUI-64 +
    + +2 + +Verify + +The Router receives the Router Solicitation from the host. +
    + +3 + +Check + +
  • +The Router sends a unicast Router Advertisement containing PIO and +optionally 6COs to the host. +
  • +
  • +Link local addresses are used. +
  • +
  • +The L bit is not set. +
  • +
    + +4 + +Verify + +The host receives the Router Advertisement from the router +
    + +5 + +Check + +The host configures its tentative global IPv6 address based on the PIO +information in RA from the Router (16-bit) +
    + +6 + +Check + +The host registers its tentative address by sending a unicast Neighbor +Solicitation containing ARO and SLLAO. Source = GP16 +
    + +7 + +Verify + +The Router receives the Neighbor Solicitation from the host. +
    + +8 + +Check + +The Router sends a Neighbor Advertisement with Status set to 0 (Dest = +GP16) +
    + +9 + +Verify + +The host updates the status of the tentative address +
    + +10 + +Stimulus + +
  • +The Router initiates an echo request to the Host's new global address, +using its own global address as the source +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 64, no traffic class or flow label is being used +
  • +
    + +11 + +Check + +The Router sends a 6LoWPAN packet containing the Echo Request message to +the Host +
    + +12 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +13 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +14 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +15 + +Verify + +The Host receives the Echo Request message from the Router +
    + +16 + +Check + +The Host sends a 6LoWPAN packet containing the Echo Reply message to the +Router +
    + +17 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +18 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +19 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +20 + +Verify + +The Router receives the Echo Reply message from the Host +
    +Notes: + +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_ND_03 +
    +Objective: + +Check Host NUD behavior +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6775 5.5 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both Host and Router +
  • +
  • +Host is configured to use EUI-64 address +
  • +
  • +Host is up and registered its global address with the Router +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +Host sends a sequence of echo requests to 2001:db8::1 +
    + +1 + +Verify + +Host sends a unicast NS message to the 6LR to perform NUD +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_ND_04 +
    +Objective: + +Check 6LR NUD behavior (ICMP version) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6775 5.5 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both Host and Router +
  • +
  • +Host is configured to use EUI-64 address +
  • +
  • +Host is up and registered its global address with the Router +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +6LR sends a sequence of echo requests to Host +
    + +1 + +Stimulus + +After 10 seconds, echo reply function is disabled on host +
    + +2 + +Verify + +6LR sends a unicast NS message to the host to perform NUD +
    +Notes: + +Optional, as not all hosts allow disabling echo reply function +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_ND_05 +
    +Objective: + +Check 6LR NUD behavior (UDP version) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6775 5.5 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both Host and Router +
  • +
  • +Host is configured to use EUI-64 address +
  • +
  • +A CoAP ping server is installed on port 5683 of the host +
  • +
  • +Host is up and registered its global address with the Router +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +6LR sends a sequence of CoAP pings to Host +
    + +1 + +Stimulus + +After 10 seconds, CoAP server function is disabled on host +
    + +2 + +Verify + +6LR sends a unicast NS message to the host to perform NUD +
    +Notes: + +Optional, as not all hosts allow disabling CoAP server function +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_ND_06 +
    +Objective: + +Check host behavior under multiple prefixes (EUI-64) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 4861 3.1 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both Host and Router +
  • +
  • +Host is configured to use EUI-64 address +
  • +
  • +Router is configured with multiple prefixes +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +Initialize the network interface of the Host +
    + +1 + +Check + +The Host sends a Router Solicitation to all-routers multicast address +with SLLAO (EUI-64). Source = link local based on EUI-64 +
    + +2 + +Verify + +The Router receives the Router Solicitation from the host. +
    + +3 + +Check + +
  • +The Router sends a unicast Router Advertisement containing PIO with +multiple prefixes and optionally 6COs to the host. +
  • +
  • +Link local addresses are used. +
  • +
  • +The L bit is not set. +
  • +
    + +4 + +Verify + +The host receives the Router Advertisement from the router +
    + +5 + +Check + +The host configures a number of tentative global IPv6 address based on +the PIO information in RA from the Router (EUI-64) +
    + +6 + +Check + +The host registers its tentative addresses by sending unicast Neighbor +Solicitations containing ARO and SLLAO. Source = GP64 +
    + +7 + +Verify + +The Router receives the Neighbor Solicitations from the host. +
    + +8 + +Check + +The Router sends Neighbor Advertisements with Status set to 0 (Dest = +GP64) +
    + +9 + +Verify + +The host updates the status of the tentative addresses +
    + +10 + +Stimulus + +
  • +The Router initiates an echo request to one of the Host's new global +addresses, using the appropriate own global address as the source +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 64, no traffic class or flow label is being used +
  • +
    + +11 + +Check + +The Router sends a 6LoWPAN packet containing the Echo Request message to +the Host +
    + +12 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +13 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +14 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +15 + +Verify + +The Host receives the Echo Request message from the Router +
    + +16 + +Check + +The Host sends a 6LoWPAN packet containing the Echo Reply message to the +Router +
    + +17 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +18 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +19 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +20 + +Verify + +The Router receives the Echo Reply message from the Host +
    +Notes: + +
  • +Optional, as not all 6lrs and hosts allow multiple prefixes +
  • +
  • +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_ND_07 +
    +Objective: + +Check host behavior under multiple prefixes (16-bit) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 4861 3.1 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both Host and Router +
  • +
  • +Host is configured to use 16 bit short address +
  • +
  • +Router is configured with multiple prefixes +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +Initialize the network interface of the Host +
    + +1 + +Check + +The Host sends a Router Solicitation to all-routers multicast address +with SLLAO (EUI-64). Source = link local based on EUI-64 +
    + +2 + +Verify + +The Router receives the Router Solicitation from the host. +
    + +3 + +Check + +
  • +The Router sends a unicast Router Advertisement containing PIO with +multiple prefixes and optionally 6COs to the host. +
  • +
  • +Link local addresses are used. +
  • +
  • +The L bit is not set. +
  • +
    + +4 + +Verify + +The host receives the Router Advertisement from the router +
    + +5 + +Check + +The host configures a number of tentative global IPv6 address based on +the PIO information in RA from the Router (16-bit) +
    + +6 + +Check + +The host registers its tentative addresses by sending unicast Neighbor +Solicitations containing ARO and SLLAO. Source = GP16 +
    + +7 + +Verify + +The Router receives the Neighbor Solicitations from the host. +
    + +8 + +Check + +The Router sends Neighbor Advertisements with Status set to 0 (Dest = +GP16) +
    + +9 + +Verify + +The host updates the status of the tentative addresses +
    + +10 + +Stimulus + +
  • +The Router initiates an echo request to one of the Host's new global +addresses, using the appropriate own global address as the source +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 64, no traffic class or flow label is being used +
  • +
    + +11 + +Check + +The Router sends a 6LoWPAN packet containing the Echo Request message to +the Host +
    + +12 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +13 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +14 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +15 + +Verify + +The Host receives the Echo Request message from the Router +
    + +16 + +Check + +The Host sends a 6LoWPAN packet containing the Echo Reply message to the +Router +
    + +17 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +18 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +19 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +20 + +Verify + +The Router receives the Echo Reply message from the Host +
    +Notes: + +
  • +Optional, as not all 6lrs and hosts allow multiple prefixes +
  • +
  • +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_ND_HC_01 +
    +Objective: + +Check that EUTs make use of context 0 (EUI-64) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6775 5.4, RFC 6282 3.1.1 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both EUT1 and EUT2 +
  • +
  • +EUT1 and EUT2 are configured to use EUI-64 +
  • +
  • +EUT1 and EUT2 are configured with a default hop limit of 64 +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +Host is set up with 6LR and receives context 0 for the global prefix +
    + +1 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's GP64 address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 64, no traffic class or flow label is being used +
  • +
    + +2 + +Check + +EUT1 sends a 6LoWPAN packet containing the Echo Request message to EUT2 +
    + +3 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +4 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +5 + +Feature + +The compression makes use of the global prefix (SAC/DAC = 1, +SAM/DAM=01/11) +
    + +6 + +Feature + +The context identifier extension is not present (CID = 0) +
    + +7 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +8 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +9 + +Check + +EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message +to EUT1 +
    + +10 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +11 + +Feature + +The compression makes use of the global prefix (SAC/DAC = 1, +SAM/DAM=01/11) +
    + +12 + +Feature + +The context identifier extension is not present (CID = 0) +
    + +13 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    +Notes: + +
  • +The feature tests check that good compression is used (but this is not a +requirement for interoperability) +
  • +
  • +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_ND_HC_02 +
    +Objective: + +Check that EUTs make use of context 0 (16-bit) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6775 5.4, RFC 6282 3.1.1 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both EUT1 and EUT2 +
  • +
  • +EUT1 and EUT2 are configured to use 16-bit short address +
  • +
  • +EUT1 and EUT2 are configured with a default hop limit of 64 +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +Host is set up with 6LR and receives context 0 for the global prefix +
    + +1 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's GP16 address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 64, no traffic class or flow label is being used +
  • +
    + +2 + +Check + +EUT1 sends a 6LoWPAN packet containing the Echo Request message to EUT2 +
    + +3 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +4 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +5 + +Feature + +The compression makes use of the global prefix (SAC/DAC = 1, +SAM/DAM=10/11) +
    + +6 + +Feature + +The context identifier extension is not present (CID = 0) +
    + +7 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +8 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +9 + +Check + +EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message +to EUT1 +
    + +10 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +11 + +Feature + +The compression makes use of the global prefix (SAC/DAC = 1, +SAM/DAM=10/11) +
    + +12 + +Feature + +The context identifier extension is not present (CID = 0) +
    + +13 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    +Notes: + +
  • +The feature tests check that good compression is used (but this is not a +requirement for interoperability) +
  • +
  • +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_ND_HC_03 +
    +Objective: + +Check that EUTs make use of context ≠ 0 (EUI-64) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6775 5.4, RFC 6282 3.1.2 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both EUT1 and EUT2 +
  • +
  • +EUT1 and EUT2 are configured to use EUI-64 +
  • +
  • +EUT1 and EUT2 are configured with a default hop limit of 64 +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +Host is set up with 6LR and receives context ≠ 0 for the global prefix +
    + +1 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's GP64 address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 64, no traffic class or flow label is being used +
  • +
    + +2 + +Check + +EUT1 sends a 6LoWPAN packet containing the Echo Request message to EUT2 +
    + +3 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +4 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +5 + +Feature + +The compression makes use of the global prefix (SAC/DAC = 1, +SAM/DAM=01/11) +
    + +6 + +Check + +A Context Identifier Extension (CID) is used for this +
    + +7 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +8 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +9 + +Check + +EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message +to EUT1 +
    + +10 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +11 + +Feature + +The compression makes use of the global prefix (SAC/DAC = 1, +SAM/DAM=01/11) +
    + +12 + +Check + +A Context Identifier Extension (CID) is used for this +
    + +13 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    +Notes: + +
  • +The feature tests check that good compression is used (but this is not a +requirement for interoperability) +
  • +
  • +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Interoperability Test Description +
    +Identifier: + +TD_6LoWPAN_ND_HC_04 +
    +Objective: + +Check that EUTs make use of context ≠ 0 (16-bit) +
    +Configuration: + +Host-6LR +
    +References: + +RFC 6775 5.4, RFC 6282 3.1.2 +
    +Pre-test conditions: + +
  • +Header compression is enabled on both EUT1 and EUT2 +
  • +
  • +EUT1 and EUT2 are configured to use 16-bit short address +
  • +
  • +EUT1 and EUT2 are configured with a default hop limit of 64 +
  • +
    +Test Sequence: + +Step + +Type + +Description +
    + +0 + +Stimulus + +Host is set up with 6LR and receives context ≠ 0 for the global prefix +
    + +1 + +Stimulus + +
  • +EUT1 initiates an echo request to EUT2's GP16 address +
  • +
  • +ICMP payload = 4 bytes, total IPv6 size 52 bytes +
  • +
  • +Hop Limit is 64, no traffic class or flow label is being used +
  • +
    + +2 + +Check + +EUT1 sends a 6LoWPAN packet containing the Echo Request message to EUT2 +
    + +3 + +Feature + +In IP_HC, TF is 11 and the ecn, dscp and flow label fields are +compressed away +
    + +4 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +5 + +Feature + +The compression makes use of the global prefix (SAC/DAC = 1, +SAM/DAM=10/11) +
    + +6 + +Check + +A Context Identifier Extension (CID) is used for this +
    + +7 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    + +8 + +Verify + +EUT2 receives the Echo Request message from EUT1 +
    + +9 + +Check + +EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message +to EUT1 +
    + +10 + +Feature + +In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + +11 + +Feature + +The compression makes use of the global prefix (SAC/DAC = 1, +SAM/DAM=10/11) +
    + +12 + +Check + +A Context Identifier Extension (CID) is used for this +
    + +13 + +Check + +Dispatch value in 6LowPAN packet is “011TFxHL” +
    +Notes: + +
  • +The feature tests check that good compression is used (but this is not a +requirement for interoperability) +
  • +
  • +The Echo Reply message might use a different hop limit in some +implementations, then the HLIM value might also be different. +
  • +
    + diff --git a/6lpplugtest/build_all.sh b/6lpplugtest/build_all.sh new file mode 100755 index 0000000..edb2c9b --- /dev/null +++ b/6lpplugtest/build_all.sh @@ -0,0 +1,87 @@ +#!/bin/sh + +if [ -z "$BOARD" ]; then + BOARD=native +fi + +if [ $# -lt 1 ]; then + TARGET=all +else + TARGET=$1 +fi + +make clean-shell + +for t in 1 2 3 4 5 6 7 8; do + for e in 1 2; do + build_result=bin/$BOARD/6lpplugtest.elf + filename=format$(printf "%02d" $t)-eut${e}.elf + if ! [ -e ${filename} ]; then + echo "Building with USE_SHELL=0 FORMAT=$t EUT=$e" + USE_SHELL=0 FORMAT=$t EUT=$e make clean-format $TARGET || exit 1 + echo "cp ${build_result} ${filename}" + cp "${build_result}" "${filename}" || exit 1 + fi + if ! [ -e ${filename%.elf}.bin ]; then + echo "cp ${build_result} ${filename%.elf}.bin" + cp "${build_result}" "${filename%.elf}.bin" || exit 1 + fi + done +done + +make clean-format + +for t in 1 2 3 4 5 6 7 8 9 10; do + for e in 1 2; do + build_result=bin/$BOARD/6lpplugtest.elf + filename=hc$(printf "%02d" $t)-eut${e}.elf + if ! [ -e ${filename} ]; then + echo "Building with USE_SHELL=0 HC=$t EUT=$e" + USE_SHELL=0 HC=$t EUT=$e make clean-hc $TARGET || exit 1 + echo "cp ${build_result} ${filename}" + cp "${build_result}" "${filename}" || exit 1 + fi + if ! [ -e ${filename%.elf}.bin ]; then + echo "cp ${build_result} ${filename%.elf}.bin" + cp "${build_result}" "${filename%.elf}.bin" || exit 1 + fi + done +done + +make clean-hc + +for t in 1 2 3 4 5 6 7; do + for e in 1 2; do + build_result=bin/$BOARD/6lpplugtest.elf + filename=nd$(printf "%02d" $t)-eut${e}.elf + if ! [ -e ${filename} ]; then + echo "Building with USE_SHELL=0 ND=$t EUT=$e" + USE_SHELL=0 ND=$t EUT=$e make clean-nd $TARGET || exit 1 + echo "cp ${build_result} ${filename}" + cp "${build_result}" "${filename}" || exit 1 + fi + if ! [ -e ${filename%.elf}.bin ]; then + echo "cp ${build_result} ${filename%.elf}.bin" + cp "${build_result}" "${filename%.elf}.bin" || exit 1 + fi + done +done + +make clean-nd + +# for t in 1 2 3 4; do +# for e in 1 2; do +# build_result=bin/$BOARD/6lpplugtest.elf +# filename=nd_hc$(printf "%02d" $t)-eut${e}.elf +# if ! [ -e ${filename} ]; then +# echo "Building with USE_SHELL=0 ND_HC=$t EUT=$e" +# USE_SHELL=0 ND_HC=$t EUT=$e make clean-nd $TARGET || exit 1 +# echo "cp ${build_result} ${filename}" +# cp "${build_result}" "${filename}" || exit 1 +# fi +# if ! [ -e ${filename%.elf}.bin ]; then +# echo "cp ${build_result} ${filename%.elf}.bin" +# cp "${build_result}" "${filename%.elf}.bin" || exit 1 +# fi +# done +# done diff --git a/6lpplugtest/flash_pair.sh b/6lpplugtest/flash_pair.sh new file mode 100755 index 0000000..2302966 --- /dev/null +++ b/6lpplugtest/flash_pair.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +if [ ${#} -lt 2 ]; then + echo "Usage: ${0} {format|hc|nd|nd_hc} " >&2 + exit 1 +fi + +GROUP=$(echo ${1} | tr '[:lower:]' '[:upper:]') +NUMBER=${2} + +if ! echo ${NUMBER} | grep '^[0-9]\+$' 2>&1 > /dev/null; then + echo "Usage: ${0} {format|hc|nd|nd_hc} " >&2 + exit 1 +fi + +make clean-shell + +case "${GROUP}" in + FORMAT) USE_SHELL=0 FORMAT=${NUMBER} EUT=1 make clean-format flash + read -p "Change device and press [Enter] to continue..." + USE_SHELL=0 FORMAT=${NUMBER} EUT=2 make clean-format flash + ;; + HC) USE_SHELL=0 HC=${NUMBER} EUT=1 make clean-hc flash + read -p "Change device and press [Enter] to continue..." + USE_SHELL=0 HC=${NUMBER} EUT=2 make clean-hc flash + ;; + ND) USE_SHELL=0 ND=${NUMBER} EUT=1 make clean-nd flash + read -p "Change device and press [Enter] to continue..." + USE_SHELL=0 ND=${NUMBER} EUT=2 make clean-nd flash + ;; + ND_HC) USE_SHELL=0 ND_HC=${NUMBER} EUT=1 make clean-nd_hc flash + read -p "Change device and press [Enter] to continue..." + USE_SHELL=0 ND_HC=${NUMBER} EUT=2 make clean-nd_hc flash + ;; + *) echo "Usage: ${0} {format|hc|nd|nd_hc} " >&2 + exit 1 + ;; +esac diff --git a/6lpplugtest/main.c b/6lpplugtest/main.c new file mode 100644 index 0000000..dac90e0 --- /dev/null +++ b/6lpplugtest/main.c @@ -0,0 +1,553 @@ +/* + * Copyright (C) 2013-14 Martin Lenders + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file LICENSE in the top level directory for more + * details. + */ +#include + +#include "sixlowpan.h" + +#ifdef MODULE_SHELL +#include "test_shell.h" +#elif defined(FORMAT) +#include "test_format.h" +#elif defined(HC) +#include "test_hc.h" +#elif defined(ND) +#include "test_nd.h" +#elif defined(ND_HC) +#include "test_nd_hc.h" +#else +#error "Define one of these sections: FORMAT, HC, ND, ND_HC or use shell module.\n" +#endif + +#include "test_utils.h" + +int main(void) +{ + printf("6LoWPAN Plugtest\n"); + + if (!slplugtest_utils_initialize_queue()) { + ERROR("Could not initialize queue.\n"); + return 1; + } + + if (!slplugtest_utils_register_to_lowpan()) { + ERROR("Could not register to 6LoWPAN thread.\n"); + return 1; + } + + if (!slplugtest_utils_register_to_ipv6()) { + ERROR("Could not register to IPv6 thread.\n"); + return 1; + } + +#ifdef MODULE_SHELL + sixlpplugtest_shell_init(); + +/* ifdef for format tests */ +#elif defined(FORMAT) && defined(TEST1) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format01_eut1(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST1) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format01_eut2(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST2) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format02_eut1(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST2) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format02_eut2(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST3) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format03_eut1(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST3) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format03_eut2(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST4) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format04_eut1(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST4) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format04_eut2(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST5) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format05_eut1(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST5) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format05_eut2(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST6) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format06_eut1(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST6) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format06_eut2(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST7) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format07_eut1(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST7) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format07_eut2(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST8) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format08_eut1(DEST, DATA)) { + return 1; + } +#elif defined(FORMAT) && defined(TEST8) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_format08_eut2(DEST, DATA)) { + return 1; + } + +/* ifdef for header compression tests */ +#elif defined(HC) && defined(TEST1) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_hc01_eut1(DEST, DATA)) { + return 1; + } +#elif defined(HC) && defined(TEST1) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif + if (!sixlowpan_hc01_eut2(DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST2) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_hc02_eut1(DEST, DATA)) { + return 1; + } +#elif defined(HC) && defined(TEST2) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif + if (!sixlowpan_hc02_eut2(DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST3) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_hc03_eut1(DEST, DATA)) { + return 1; + } +#elif defined(HC) && defined(TEST3) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif + if (!sixlowpan_hc03_eut2(DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST4) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_hc04_eut1(DEST, DATA)) { + return 1; + } +#elif defined(HC) && defined(TEST4) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif + if (!sixlowpan_hc04_eut2(DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST5) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef IPPREFIX +#error "Please define a subnet prefix of length 64 with the IPPREFIX macro" +#endif + if (!sixlowpan_hc05_6lr(IPPREFIX, DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST5) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif + if (!sixlowpan_hc05_host(DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST6) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef IPPREFIX +#error "Please define a subnet prefix of length 64 with the IPPREFIX macro" +#endif + if (!sixlowpan_hc06_6lr(IPPREFIX, DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST6) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif + if (!sixlowpan_hc06_host(DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST7) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef IPPREFIX +#error "Please define a subnet prefix of length 64 with the IPPREFIX macro" +#endif + if (!sixlowpan_hc07_6lr(IPPREFIX, DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST7) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif + if (!sixlowpan_hc07_host(DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST8) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef IPPREFIX +#error "Please define a subnet prefix of length 64 with the IPPREFIX macro" +#endif + if (!sixlowpan_hc08_6lr(IPPREFIX, DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST8) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif + if (!sixlowpan_hc08_host(DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST9) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_hc09_eut1(DEST, DATA)) { + return 1; + } +#elif defined(HC) && defined(TEST9) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif + if (!sixlowpan_hc09_eut2(DEST)) { + return 1; + } +#elif defined(HC) && defined(TEST10) && defined(EUT1) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_hc10_eut1(DEST, DATA)) { + return 1; + } +#elif defined(HC) && defined(TEST10) && defined(EUT2) +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif + if (!sixlowpan_hc10_eut2(DEST)) { + return 1; + } + +/* ifdef for neighbor discovery tests */ +#elif defined(ND) && defined(TEST1) && defined(EUT1) +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_nd01_host()) { + return 1; + } +#elif defined(ND) && defined(TEST1) && defined(EUT2) +#ifndef IPPREFIX +#error "Please define a test prefix via the IPPREFIX macro" +#endif +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_nd01_6lr(IPPREFIX, DEST, DATA)) { + return 1; + } +#elif defined(ND) && defined(TEST2) && defined(EUT1) +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_nd02_host()) { + return 1; + } +#elif defined(ND) && defined(TEST2) && defined(EUT2) +#ifndef IPPREFIX +#error "Please define a test prefix via the IPPREFIX macro" +#endif +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_nd02_6lr(IPPREFIX, DEST, DATA)) { + return 1; + } +#elif defined(ND) && defined(TEST3) && defined(EUT1) + if (!sixlowpan_nd03_host()) { + return 1; + } +#elif defined(ND) && defined(TEST3) && defined(EUT2) + if (!sixlowpan_nd03_6lr()) { + return 1; + } +#elif defined(ND) && defined(TEST4) && defined(EUT1) +#ifndef IPPREFIX +#error "Please define a test prefix via the IPPREFIX macro" +#endif +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_nd04_6lr(IPPREFIX, DEST, DATA)) { + return 1; + } +#elif defined(ND) && defined(TEST4) && defined(EUT2) +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_nd04_host()) { + return 1; + } +#elif defined(ND) && defined(TEST5) && defined(EUT1) +#ifndef IPPREFIX +#error "Please define a test prefix via the IPPREFIX macro" +#endif + if (!sixlowpan_nd05_6lr(IPPREFIX)) { + return 1; + } +#elif defined(ND) && defined(TEST5) && defined(EUT2) + if (!sixlowpan_nd05_host()) { + return 1; + } +#elif defined(ND) && defined(TEST6) && defined(EUT1) +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_nd06_host()) { + return 1; + } +#elif defined(ND) && defined(TEST6) && defined(EUT2) +#ifndef IPPREFIX +#error "Please define a test prefix via the IPPREFIX macro" +#endif +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif +#ifndef IPPREFIX_LEN +#error "Please define the length of the prefix list via the IPPREFIX_LEN macro" +#endif +#if IPPREFIX_LEN < 2 +#error "You need more than one prefix" +#endif + char ipprefixes[strlen(IPPREFIX)]; + char *ipprefixes_list[IPPREFIX_LEN]; + int j = 0; + + memcpy(ipprefixes, IPPREFIX, strlen(IPPREFIX)); + ipprefixes_list[j++] = &ipprefixes[0]; + for (unsigned int i = 0; i < strlen(IPPREFIX) || j < IPPREFIX_LEN + 1; i++) { + if (ipprefixes[i] == ' ') { + ipprefixes[i] = '\0'; + ipprefixes_list[j++] = &ipprefixes[i+1]; + } + } + + if (!sixlowpan_nd06_6lr(IPPREFIX_LEN, ipprefixes_list, DEST, DATA)) { + return 1; + } +#elif defined(ND) && defined(TEST7) && defined(EUT1) +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif + if (!sixlowpan_nd07_host()) { + return 1; + } +#elif defined(ND) && defined(TEST7) && defined(EUT2) +#ifndef IPPREFIX +#error "Please define a test prefix via the IPPREFIX macro" +#endif +#ifndef DEST +#error "Please define a test destination via the DEST macro" +#endif +#ifndef DATA +#error "Please define test data with the DATA macro" +#endif +#ifndef IPPREFIX_LEN +#error "Please define the length of the prefix list via the IPPREFIX_LEN macro" +#endif +#if IPPREFIX_LEN < 2 +#error "You need more than one prefix" +#endif + char ipprefixes[strlen(IPPREFIX)]; + char *ipprefixes_list[IPPREFIX_LEN]; + int j = 0; + + memcpy(ipprefixes, IPPREFIX, strlen(IPPREFIX)); + ipprefixes_list[j++] = &ipprefixes[0]; + for (unsigned int i = 0; i < strlen(IPPREFIX) || j < IPPREFIX_LEN + 1; i++) { + if (ipprefixes[i] == ' ') { + ipprefixes[i] = '\0'; + ipprefixes_list[j++] = &ipprefixes[i+1]; + } + } + + if (!sixlowpan_nd07_6lr(IPPREFIX_LEN, ipprefixes_list, DEST, DATA)) { + return 1; + } +#elif (defined(FORMAT) || defined(HC) || defined(ND) || defined(ND_HC)) && \ + (defined(EUT1) || defined(EUT2)) +#error "Please define a valid test TEST\n" +#elif (defined(FORMAT) || defined(HC) || defined(ND) || defined(ND_HC)) && \ + !(defined(EUT1) || defined(EUT2)) +#error "Please define which EUT you want to use: valid values are EUT1 or EUT2\n" +#endif + while(1); + return 0; +} + + diff --git a/6lpplugtest/td1.html b/6lpplugtest/td1.html new file mode 100644 index 0000000..99d3514 --- /dev/null +++ b/6lpplugtest/td1.html @@ -0,0 +1,5140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_FORMAT_01 +
    Objective: + Check that EUTs correctly handle uncompressed 6LoWPAN packets (EUI-64 link-local) +
    Configuration: + Node-Node +
    References: + RFC 4944 5.1, 8 +
    Pre-test conditions: +
  • Header compression is disabled on both EUT1 and EUT2
  • +
  • EUT1 and EUT2 are configured to use EUI-64
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's link-local address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
    + 1 + + Check + +
  • EUT1 sends an uncompressed 6LoWPAN packet containing the Echo Request message to EUT2's link-local address
  • +
  • Dispatch value in 6LowPAN packet is “01000001”
  • +
  • Both source and destination addresses are EUI-64 link-local
  • +
    + 2 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 3 + + Check + +
  • EUT2 sends an uncompressed 6LoWPAN packet containing the Echo Reply message to EUT1's link-local address
  • +
  • Dispatch value in 6LowPAN packet is “01000001”
  • +
  • Both source and destination addresses are EUI-64 link-local
  • +
    + 4 + + Verify + + EUT1 receives the Echo Reply message from EUT2 +
    + 5 + + Check + + The data received in the echo reply message is identical to that sent in EUT1's echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_FORMAT_02 +
    Objective: + Check that EUTs correctly handle uncompressed 6LoWPAN packets (16-bit link-local) +
    Configuration: + Node-Node +
    References: + RFC 4944 5.1, 8 +
    Pre-test conditions: +
  • Header compression is disabled on both EUT1 and EUT2
  • +
  • EUT1 and EUT2 are configured to use 16-bit short address
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's link-local address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
    + 1 + + Check + +
  • EUT1 sends an uncompressed 6LoWPAN packet containing the Echo Request message to EUT2's link-local address
  • +
  • Dispatch value in 6LowPAN packet is “01000001”
  • +
  • Both source and destination addresses are 16 bit short link-local
  • +
    + 2 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 3 + + Check + +
  • EUT2 sends an uncompressed 6LoWPAN packet containing the Echo Reply message to EUT1's link-local address
  • +
  • Dispatch value in 6LowPAN packet is “01000001”
  • +
  • Both source and destination addresses are 16 bit short link-local
  • +
    + 4 + + Verify + + EUT1 receives the Echo Reply message from EUT2 +
    + 5 + + Check + + The data received in the echo reply message is identical to that sent in EUT1's echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_FORMAT_03 +
    Objective: + Check that EUTs correctly handle uncompressed 6LoWPAN fragmented packets +
    Configuration: + Node-Node +
    References: + RFC 4944 5.1, 5.3 +
    Pre-test conditions: + Header compression is disabled on both EUT1 and EUT2 +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's link-local address
  • +
  • ICMP payload = 253 bytes, total IPv6 size 301 bytes
  • +
    + 1 + + Check + +
  • EUT1 sends a sequence of uncompressed 6LoWPAN packets containing the Echo Request fragments to EUT2
  • +
  • EUT1 correctly fragments the Echo Request:
  • +
  • a 6LoWPAN FRAG1 header (dispatch 11000xxx) is included in the first packet
  • +
  • a 6LoWPAN FRAGN header (dispatch 11100xxx) is included in all following packets
  • +
  • the offsets form a contiguous sequence
  • +
  • all fragments except the last one must be multiples of 8 bytes
  • +
    + 2 + + Verify + + EUT2 reassembles correctly the fragments and receives the Echo Request message from EUT1 +
    + 3 + + Check + +
  • EUT2 sends a sequence of uncompressed 6LoWPAN packets containing the Echo Reply message to EUT1
  • +
  • EUT1 correctly fragments the Echo Reply:
  • +
  • a 6LoWPAN FRAG1 header (dispatch 11000xxx) is included in the first packet
  • +
  • a 6LoWPAN FRAGN header (dispatch 11100xxx) is included in all following packets
  • +
  • the offsets form a contiguous sequence
  • +
  • all fragments except the last one must be multiples of 8 bytes
  • +
  • The data in the echo reply message packets is identical to that sent in the echo request message packets
  • +
    + 4 + + Verify + + EUT1 correctly reassembles the fragments and receives the Echo Reply message from EUT2 +
    + 5 + + Verify + + The data in the received echo reply message is identical to that sent in the echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_FORMAT_04 +
    Objective: + Check that EUTs correctly handle maximum size uncompressed 6LoWPAN fragmented packets +
    Configuration: + Node-Node +
    References: + RFC 4944 5.1, 5.3 +
    Pre-test conditions: + Header compression is disabled on both EUT1 and EUT2 +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's link-local address
  • +
  • ICMP payload = 1232 bytes, total IPv6 size 1280 bytes
  • +
    + 1 + + Check + +
  • EUT1 sends a sequence of uncompressed 6LoWPAN packets containing the Echo Request fragments to EUT2
  • +
  • EUT1 correctly fragments the Echo Request:
  • +
  • a 6LoWPAN FRAG1 header (dispatch 11000xxx) is included in the first packet
  • +
  • a 6LoWPAN FRAGN header (dispatch 11100xxx) is included in all following packets
  • +
  • the offsets form a contiguous sequence
  • +
  • all fragments except the last one must be multiples of 8 bytes
  • +
    + 2 + + Verify + + EUT2 reassembles correctly the fragments and receives the Echo Request message from EUT1 +
    + 3 + + Check + +
  • EUT2 sends a sequence of uncompressed 6LoWPAN packets containing the Echo Reply message to EUT1
  • +
  • EUT1 correctly fragments the Echo Reply:
  • +
  • a 6LoWPAN FRAG1 header (dispatch 11000xxx) is included in the first packet
  • +
  • a 6LoWPAN FRAGN header (dispatch 11100xxx) is included in all following packets
  • +
  • the offsets form a contiguous sequence
  • +
  • all fragments except the last one must be multiples of 8 bytes
  • +
  • The data in the echo reply message packets is identical to that sent in the echo request message packets
  • +
    + 4 + + Verify + + EUT1 correctly reassembles the fragments and receives the Echo Reply message from EUT2 +
    + 5 + + Verify + + The data in the received echo reply message is identical to that sent in the echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_FORMAT_05 +
    Objective: + Check that EUTs correctly handle uncompressed 6LoWPAN multicast to all-nodes (16-bit link-local) +
    Configuration: + Node-Node +
    References: + RFC 4944 5.1, 8 +
    Pre-test conditions: +
  • Header compression is disabled on both EUT1 and EUT2
  • +
  • EUT1 and EUT2 are configured to use 16-bit short address
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + EUT1 initiates an echo request to the link-local all-nodes multicast address (FF02::1) (ICMP payload = 4 bytes, total IPv6 size 52 bytes) +
    + 1 + + Check + + EUT1 sends an uncompressed 6LoWPAN packet containing the Echo Request message to EUT2 +
    + 2 + + Check + + Dispatch value in 6LowPAN packet is “01000001” +
    + 3 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 4 + + Check + + EUT2 sends an uncompressed 6LoWPAN packet containing the Echo Reply message to EUT1 +
    + 5 + + Check + + Dispatch value in 6LowPAN packet is “01000001” +
    + 6 + + Verify + + EUT1 receives the Echo Reply message from EUT2 +
    + 7 + + Check + + The data in the echo reply message is identical to that in the echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_FORMAT_06 +
    Objective: + Check that EUTs correctly handle uncompressed 6LoWPAN multicast to all-nodes (EUI-64 link-local) +
    Configuration: + Node-Node +
    References: + RFC 4944 5.1, 8 +
    Pre-test conditions: +
  • Header compression is disabled on both EUT1 and EUT2
  • +
  • EUT1 and EUT2 are configured to use EUI-64
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + EUT1 initiates an echo request to the link-local all-nodes multicast address (FF02::1) (ICMP payload = 4 bytes, total IPv6 size 52 bytes) +
    + 1 + + Check + + EUT1 sends an uncompressed 6LoWPAN packet containing the Echo Request message to EUT2 +
    + 2 + + Check + + Dispatch value in 6LowPAN packet is “01000001” +
    + 3 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 4 + + Check + + EUT2 sends an uncompressed 6LoWPAN packet containing the Echo Reply message to EUT1 +
    + 5 + + Check + + Dispatch value in 6LowPAN packet is “01000001” +
    + 6 + + Verify + + EUT1 receives the Echo Reply message from EUT2 +
    + 7 + + Check + + The data in the echo reply message is identical to that in the echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_FORMAT_07 +
    Objective: + Check that EUTs correctly handle uncompressed 6LoWPAN packets (EUI-64 to 16-bit link-local) +
    Configuration: + Node-Node +
    References: + RFC 4944 5.1, 8 +
    Pre-test conditions: +
  • Header compression is disabled on both EUT1 and EUT2
  • +
  • EUT1 is configured to use EUI-64 and EUT2 is configured to use 16-bit short address
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's link-local address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
    + 1 + + Check + +
  • EUT1 sends an uncompressed 6LoWPAN packet containing the Echo Request message to EUT2's link-local address
  • +
  • Dispatch value in 6LowPAN packet is “01000001”
  • +
  • Source address is EUI-64 link-local
  • +
  • Destination address is 16 bit short link-local
  • +
    + 2 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 3 + + Check + +
  • EUT2 sends an uncompressed 6LoWPAN packet containing the Echo Reply message to EUT1's link-local address
  • +
  • Dispatch value in 6LowPAN packet is “01000001”
  • +
  • Source address is 16 bit short link-local
  • +
  • Destination address is EUI-64 link-local
  • +
    + 4 + + Verify + + EUT1 receives the Echo Reply message from EUT2 +
    + 5 + + Check + + The data received in the echo reply message is identical to that sent in EUT1's echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_FORMAT_08 +
    Objective: + Check that EUTs correctly handle uncompressed 6LoWPAN packets (16-bit to EUI-64 link-local) +
    Configuration: + Node-Node +
    References: + RFC 4944 5.1, 8 +
    Pre-test conditions: +
  • Header compression is disabled on both EUT1 and EUT2
  • +
  • EUT1 is configured to use 16-bit short address and EUT2 is configured to use EUI-64
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's link-local address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
    + 1 + + Check + +
  • EUT1 sends an uncompressed 6LoWPAN packet containing the Echo Request message to EUT2's link-local address
  • +
  • Dispatch value in 6LowPAN packet is “01000001”
  • +
  • Source address is 16 bit short link-local
  • +
  • Destination address is EUI-64 link-local
  • +
    + 2 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 3 + + Check + +
  • EUT2 sends an uncompressed 6LoWPAN packet containing the Echo Reply message to EUT1's link-local address
  • +
  • Dispatch value in 6LowPAN packet is “01000001”
  • +
  • Source address is EUI-64 link-local
  • +
  • Destination address is 16 bit short link-local
  • +
    + 4 + + Verify + + EUT1 receives the Echo Reply message from EUT2 +
    + 5 + + Check + + The data received in the echo reply message is identical to that sent in EUT1's echo request message +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_HC_01 +
    Objective: + Check that EUTs correctly handle compressed 6LoWPAN packets (EUI-64 link-local, hop limit=64) +
    Configuration: + Node-Node +
    References: + RFC 6282 section 3 +
    Pre-test conditions: +
  • Header compression is enabled on both EUT1 and EUT2
  • +
  • EUT1 and EUT2 are configured to use EUI-64
  • +
  • EUT1 and EUT2 are configured with a default hop limit of 64
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's link-local address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 64, no traffic class or flow label is being used
  • +
    + 1 + + Check + + EUT1 sends a compressed 6LoWPAN packet containing the Echo Request message to EUT2 +
    + 2 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 3 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 4 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 5 + + Feature + + In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + 6 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 7 + + Check + + EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message to EUT1 +
    + 8 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 9 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 10 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 11 + + Feature + + In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + 12 + + Verify + + EUT1 receives the Echo Reply message from EUT2 +
    + Notes: + +
  • The feature tests check that best compression is used (but this is not a requirement for interoperability)
  • +
  • The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different.
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_HC_02 +
    Objective: + Check that EUTs correctly handle compressed 6LoWPAN packets (16-bit link-local, hop limit=64) +
    Configuration: + Node-Node +
    References: + RFC 6282 section 3 +
    Pre-test conditions: +
  • Header compression is enabled on both EUT1 and EUT2
  • +
  • EUT1 and EUT2 are configured to use 16-bit short address
  • +
  • EUT1 and EUT2 are configured with a default hop limit of 64
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's link-local address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 64, no traffic class or flow label is being used
  • +
    + 1 + + Check + + EUT1 sends a compressed 6LoWPAN packet containing the Echo Request message to EUT2 +
    + 2 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 3 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 4 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 5 + + Feature + + In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + 6 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 7 + + Check + + EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message to EUT1 +
    + 8 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 9 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 10 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 11 + + Feature + + In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + 12 + + Verify + + EUT1 receives the Echo Reply message from EUT2 +
    + Notes: + +
  • The feature tests check that best compression is used (but this is not a requirement for interoperability)
  • +
  • The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different.
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_HC_03 +
    Objective: + Check that EUTs correctly handle compressed 6LoWPAN packets (EUI-64 link-local, hop limit=63) +
    Configuration: + Node-Node +
    References: + RFC 6282 section 3 +
    Pre-test conditions: +
  • Header compression is enabled on both EUT1 and EUT2
  • +
  • EUT1 and EUT2 are configured to use EUI-64
  • +
  • EUT1 and EUT2 are configured with a default hop limit of 63
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's link-local address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 63, no traffic class or flow label is being used
  • +
    + 1 + + Check + + EUT1 sends a compressed 6LoWPAN packet containing the Echo Request message to EUT2 +
    + 2 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 3 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 4 + + Feature + + In IP_HC, HLIM (HL) is 00 and the hop limit field is carried in-line +
    + 5 + + Feature + + In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + 6 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 7 + + Check + + EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message to EUT1 +
    + 8 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 9 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 10 + + Feature + + In IP_HC, HLIM (HL) is 00 and the hop limit field is carried in-line +
    + 11 + + Feature + + In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + 12 + + Verify + + EUT1 receives the Echo Reply message from EUT2 +
    + Notes: + +
  • The feature tests check that best compression is used (but this is not a requirement for interoperability)
  • +
  • The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different.
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_HC_04 +
    Objective: + Check that EUTs correctly handle compressed 6LoWPAN packets (16-bit link-local, hop limit=63) +
    Configuration: + Node-Node +
    References: + RFC 6282 section 3 +
    Pre-test conditions: +
  • Header compression is enabled on both EUT1 and EUT2
  • +
  • EUT1 and EUT2 are configured to use 16-bit short address
  • +
  • EUT1 and EUT2 are configured with a default hop limit of 63
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's link-local address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 63, no traffic class or flow label is being used
  • +
    + 1 + + Check + + EUT1 sends a compressed 6LoWPAN packet containing the Echo Request message to EUT2 +
    + 2 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 3 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 4 + + Feature + + In IP_HC, HLIM (HL) is 00 and the hop limit field is carried in-line +
    + 5 + + Feature + + In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + 6 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 7 + + Check + + EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message to EUT1 +
    + 8 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 9 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 10 + + Feature + + In IP_HC, HLIM (HL) is 00 and the hop limit field is carried in-line +
    + 11 + + Feature + + In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + 12 + + Verify + + EUT1 receives the Echo Reply message from EUT2 +
    + Notes: + +
  • The feature tests check that best compression is used (but this is not a requirement for interoperability)
  • +
  • The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different.
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_HC_05 +
    Objective: + Check that EUTs correctly handle compressed UDP packets (EUI-64, server port 5683) +
    Configuration: + Host-6LR +
    References: + RFC 6282, 4.3 +
    Pre-test conditions: +
  • Header compression is enabled on both Host and Router
  • +
  • Host is configured to use EUI-64 address
  • +
  • A CoAP ping server is installed on port 5683 of the host
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + 6LR initiates a CoAP Ping request to Host's CoAP Ping server +
    + 1 + + Check + + 6LR sends a 6LoWPAN packet containing the CoAP Ping message to Host +
    + 2 + + Feature + + NH is set, NHC is 111100x0, the source port is compressed to 8 bits (x=1) or uncompressed (x=0), the destination port is uncompressed 5683 +
    + 3 + + Verify + + Host receives the CoAP Ping message from 6LR +
    + 4 + + Check + + Host sends a 6LoWPAN packet containing the CoAP Reset message to 6LR +
    + 5 + + Feature + + NH is set, NHC is 1111000x, the source port is uncompressed 5683, the destination port is compressed to 8 bits (x=1) or uncompressed (x=0) +
    + 6 + + Verify + + 6LR receives the CoAP Reset message from Host +
    + Notes: + + The feature tests check that best compression is used (but this is not a requirement for interoperability) +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_HC_06 +
    Objective: + Check that EUTs correctly handle compressed UDP packets (16-bit, server port 5683) +
    Configuration: + Host-6LR +
    References: + RFC 6282, 4.3 +
    Pre-test conditions: +
  • Header compression is enabled on both Host and Router
  • +
  • Host is configured to use 16-bit address
  • +
  • A CoAP ping server is installed on port 5683 of the host
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + 6LR initiates a CoAP Ping request to Host's CoAP Ping server +
    + 1 + + Check + + 6LR sends a 6LoWPAN packet containing the CoAP Ping message to Host +
    + 2 + + Feature + + NH is set, NHC is 111100x0, the source port is compressed to 8 bits (x=1) or uncompressed (x=0), the destination port is uncompressed 5683 +
    + 3 + + Verify + + Host receives the CoAP Ping message from 6LR +
    + 4 + + Check + + Host sends a 6LoWPAN packet containing the CoAP Reset message to 6LR +
    + 5 + + Feature + + NH is set, NHC is 1111000x, the source port is uncompressed 5683, the destination port is compressed to 8 bits (x=1) or uncompressed (x=0) +
    + 6 + + Verify + + 6LR receives the CoAP Reset message from Host +
    + Notes: + + The feature tests check that best compression is used (but this is not a requirement for interoperability) +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_HC_07 +
    Objective: + Check that EUTs correctly handle compressed UDP packets (EUI-64, server port 61616) +
    Configuration: + Host-6LR +
    References: + RFC 6282, 4.3 +
    Pre-test conditions: +
  • Header compression is enabled on both Host and Router
  • +
  • Host is configured to use EUI-64 address
  • +
  • A CoAP ping server is installed on port 61616 of the host
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + 6LR initiates a CoAP Ping request to Host's CoAP Ping server +
    + 1 + + Check + + 6LR sends a 6LoWPAN packet containing the CoAP Ping message to Host +
    + 2 + + Feature + + NH is set, NHC is 111100x1, the destination port is compressed to 4 bits of 0000 (x=1) or 8 bits of 0xb0 (x=0) +
    + 3 + + Verify + + Host receives the CoAP Ping message from 6LR +
    + 4 + + Check + + Host sends a 6LoWPAN packet containing the CoAP Reset message to 6LR +
    + 5 + + Feature + + NH is set, NHC is 1111001x, the source port is compressed to 4 bits of 0000 (x=1) or 8 bits of 0xb0 (x=0) +
    + 6 + + Verify + + 6LR receives the CoAP Reset message from Host +
    + Notes: + + The feature tests check that best compression is used (but this is not a requirement for interoperability) +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_HC_08 +
    Objective: + Check that EUTs correctly handle compressed UDP packets (16-bit, server port 61616) +
    Configuration: + Host-6LR +
    References: + RFC 6282, 4.3 +
    Pre-test conditions: +
  • Header compression is enabled on both Host and Router
  • +
  • Host is configured to use 16-bit address
  • +
  • A CoAP ping server is installed on port 61616 of the host
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + 6LR initiates a CoAP Ping request to Host's CoAP Ping server +
    + 1 + + Check + + 6LR sends a 6LoWPAN packet containing the CoAP Ping message to Host +
    + 2 + + Feature + + NH is set, NHC is 111100x1, the destination port is compressed to 4 bits of 0000 (x=1) or 8 bits of 0xb0 (x=0) +
    + 3 + + Verify + + Host receives the CoAP Ping message from 6LR +
    + 4 + + Check + + Host sends a 6LoWPAN packet containing the CoAP Reset message to 6LR +
    + 5 + + Feature + + NH is set, NHC is 1111001x, the source port is compressed to 4 bits of 0000 (x=1) or 8 bits of 0xb0 (x=0) +
    + 6 + + Verify + + 6LR receives the CoAP Reset message from Host +
    + Notes: + + The feature tests check that best compression is used (but this is not a requirement for interoperability) +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_HC_09 +
    Objective: + Check that EUTs correctly handle compressed 6LoWPAN packets (EUI-64 to 16-bit link-local, hop limit=64) +
    Configuration: + Node-Node +
    References: + RFC 6282 section 3 +
    Pre-test conditions: +
  • Header compression is enabled on both EUT1 and EUT2
  • +
  • EUT1 is configured to use EUI-64 and EUT2 is configured to use 16-bit short address
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's link-local address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 64, no traffic class or flow label is being used
  • +
    + 1 + + Check + + EUT1 sends a compressed 6LoWPAN packet containing the Echo Request message to EUT2 +
    + 2 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 3 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 4 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 5 + + Feature + + In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + 6 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 7 + + Check + + EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message to EUT1 +
    + 8 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 9 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 10 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 11 + + Feature + + In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + 12 + + Verify + + EUT1 receives the Echo Reply message from EUT2 +
    + Notes: + +
  • The feature tests check that best compression is used (but this is not a requirement for interoperability)
  • +
  • The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different.
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_HC_10 +
    Objective: + Check that EUTs correctly handle compressed 6LoWPAN packets (16-bit to EUI-64 link-local, hop limit=64) +
    Configuration: + Node-Node +
    References: + RFC 6282 section 3 +
    Pre-test conditions: +
  • Header compression is enabled on both EUT1 and EUT2
  • +
  • EUT1 is configured to use 16-bit short address and EUT2 is configured to use EUI-64
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's link-local address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 64, no traffic class or flow label is being used
  • +
    + 1 + + Check + + EUT1 sends a compressed 6LoWPAN packet containing the Echo Request message to EUT2 +
    + 2 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 3 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 4 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 5 + + Feature + + In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + 6 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 7 + + Check + + EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message to EUT1 +
    + 8 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 9 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 10 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 11 + + Feature + + In IP_HC, SAC=0, SAM=11; DAC=0; DAM=11 +
    + 12 + + Verify + + EUT1 receives the Echo Reply message from EUT2 +
    + Notes: + +
  • The feature tests check that best compression is used (but this is not a requirement for interoperability)
  • +
  • The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different.
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_ND_01 +
    Objective: + Check that a host is able to register its global IPv6 address (EUI-64) +
    Configuration: + Host-6LR +
    References: + RFC 6775 10.2 +
    Pre-test conditions: +
  • Header compression is enabled on both Host and Router
  • +
  • Host is configured to use EUI-64 address
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + Initialize the network interface of the Host +
    + 1 + + Check + + The Host sends a Router Solicitation to all-routers multicast address with SLLAO (EUI-64). Source = link local based on EUI-64 +
    + 2 + + Verify + + The Router receives the Router Solicitation from the host. +
    + 3 + + Check + +
  • The Router sends a unicast Router Advertisement containing PIO and optionally 6COs to the host.
  • +
  • Link local addresses are used.
  • +
  • The L bit is not set.
  • +
    + 4 + + Verify + + The host receives the Router Advertisement from the router +
    + 5 + + Check + + The host configures its tentative global IPv6 address based on the PIO information in RA from the Router (EUI-64) +
    + 6 + + Check + + The host registers its tentative address by sending a unicast Neighbor Solicitation containing ARO and SLLAO. Source = GP64 +
    + 7 + + Verify + + The Router receives the Neighbor Solicitation from the host. +
    + 8 + + Check + + The Router sends a Neighbor Advertisement with Status set to 0 (Dest = GP64) +
    + 9 + + Verify + + The host updates the status of the tentative address +
    + 10 + + Stimulus + +
  • The Router initiates an echo request to the Host's new global address, using its own global address as the source
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 64, no traffic class or flow label is being used
  • +
    + 11 + + Check + + The Router sends a 6LoWPAN packet containing the Echo Request message to the Host +
    + 12 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 13 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 14 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 15 + + Verify + + The Host receives the Echo Request message from the Router +
    + 16 + + Check + + The Host sends a 6LoWPAN packet containing the Echo Reply message to the Router +
    + 17 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 18 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 19 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 20 + + Verify + + The Router receives the Echo Reply message from the Host +
    + Notes: + + The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different. +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_ND_02 +
    Objective: + Check that a host is able to register its global IPv6 address (16-bit) +
    Configuration: + Host-6LR +
    References: + RFC 6775 10.2 +
    Pre-test conditions: +
  • Header compression is enabled on both Host and Router
  • +
  • Host is configured to use 16 bit short address
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + Initialize the network interface of the Host +
    + 1 + + Check + + The Host sends a Router Solicitation to all-routers multicast address with SLLAO (EUI-64). Source = link local based on EUI-64 +
    + 2 + + Verify + + The Router receives the Router Solicitation from the host. +
    + 3 + + Check + +
  • The Router sends a unicast Router Advertisement containing PIO and optionally 6COs to the host.
  • +
  • Link local addresses are used.
  • +
  • The L bit is not set.
  • +
    + 4 + + Verify + + The host receives the Router Advertisement from the router +
    + 5 + + Check + + The host configures its tentative global IPv6 address based on the PIO information in RA from the Router (16-bit) +
    + 6 + + Check + + The host registers its tentative address by sending a unicast Neighbor Solicitation containing ARO and SLLAO. Source = GP16 +
    + 7 + + Verify + + The Router receives the Neighbor Solicitation from the host. +
    + 8 + + Check + + The Router sends a Neighbor Advertisement with Status set to 0 (Dest = GP16) +
    + 9 + + Verify + + The host updates the status of the tentative address +
    + 10 + + Stimulus + +
  • The Router initiates an echo request to the Host's new global address, using its own global address as the source
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 64, no traffic class or flow label is being used
  • +
    + 11 + + Check + + The Router sends a 6LoWPAN packet containing the Echo Request message to the Host +
    + 12 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 13 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 14 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 15 + + Verify + + The Host receives the Echo Request message from the Router +
    + 16 + + Check + + The Host sends a 6LoWPAN packet containing the Echo Reply message to the Router +
    + 17 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 18 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 19 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 20 + + Verify + + The Router receives the Echo Reply message from the Host +
    + Notes: + + The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different. +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_ND_03 +
    Objective: + Check Host NUD behavior +
    Configuration: + Host-6LR +
    References: + RFC 6775 5.5 +
    Pre-test conditions: +
  • Header compression is enabled on both Host and Router
  • +
  • Host is configured to use EUI-64 address
  • +
  • Host is up and registered its global address with the Router
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + Host sends a sequence of echo requests to 2001:db8::1 +
    + 1 + + Verify + + Host sends a unicast NS message to the 6LR to perform NUD +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_ND_04 +
    Objective: + Check 6LR NUD behavior (ICMP version) +
    Configuration: + Host-6LR +
    References: + RFC 6775 5.5 +
    Pre-test conditions: +
  • Header compression is enabled on both Host and Router
  • +
  • Host is configured to use EUI-64 address
  • +
  • Host is up and registered its global address with the Router
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + 6LR sends a sequence of echo requests to Host +
    + 1 + + Stimulus + + After 10 seconds, echo reply function is disabled on host +
    + 2 + + Verify + + 6LR sends a unicast NS message to the host to perform NUD +
    + Notes: + + Optional, as not all hosts allow disabling echo reply function +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_ND_05 +
    Objective: + Check 6LR NUD behavior (UDP version) +
    Configuration: + Host-6LR +
    References: + RFC 6775 5.5 +
    Pre-test conditions: +
  • Header compression is enabled on both Host and Router
  • +
  • Host is configured to use EUI-64 address
  • +
  • A CoAP ping server is installed on port 5683 of the host
  • +
  • Host is up and registered its global address with the Router
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + 6LR sends a sequence of CoAP pings to Host +
    + 1 + + Stimulus + + After 10 seconds, CoAP server function is disabled on host +
    + 2 + + Verify + + 6LR sends a unicast NS message to the host to perform NUD +
    + Notes: + + Optional, as not all hosts allow disabling CoAP server function +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_ND_06 +
    Objective: + Check host behavior under multiple prefixes (EUI-64) +
    Configuration: + Host-6LR +
    References: + RFC 4861 3.1 +
    Pre-test conditions: +
  • Header compression is enabled on both Host and Router
  • +
  • Host is configured to use EUI-64 address
  • +
  • Router is configured with multiple prefixes
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + Initialize the network interface of the Host +
    + 1 + + Check + + The Host sends a Router Solicitation to all-routers multicast address with SLLAO (EUI-64). Source = link local based on EUI-64 +
    + 2 + + Verify + + The Router receives the Router Solicitation from the host. +
    + 3 + + Check + +
  • The Router sends a unicast Router Advertisement containing PIO with multiple prefixes and optionally 6COs to the host.
  • +
  • Link local addresses are used.
  • +
  • The L bit is not set.
  • +
    + 4 + + Verify + + The host receives the Router Advertisement from the router +
    + 5 + + Check + + The host configures a number of tentative global IPv6 address based on the PIO information in RA from the Router (EUI-64) +
    + 6 + + Check + + The host registers its tentative addresses by sending unicast Neighbor Solicitations containing ARO and SLLAO. Source = GP64 +
    + 7 + + Verify + + The Router receives the Neighbor Solicitations from the host. +
    + 8 + + Check + + The Router sends Neighbor Advertisements with Status set to 0 (Dest = GP64) +
    + 9 + + Verify + + The host updates the status of the tentative addresses +
    + 10 + + Stimulus + +
  • The Router initiates an echo request to one of the Host's new global addresses, using the appropriate own global address as the source
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 64, no traffic class or flow label is being used
  • +
    + 11 + + Check + + The Router sends a 6LoWPAN packet containing the Echo Request message to the Host +
    + 12 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 13 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 14 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 15 + + Verify + + The Host receives the Echo Request message from the Router +
    + 16 + + Check + + The Host sends a 6LoWPAN packet containing the Echo Reply message to the Router +
    + 17 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 18 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 19 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 20 + + Verify + + The Router receives the Echo Reply message from the Host +
    + Notes: + +
  • Optional, as not all 6lrs and hosts allow multiple prefixes
  • +
  • The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different.
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_ND_07 +
    Objective: + Check host behavior under multiple prefixes (16-bit) +
    Configuration: + Host-6LR +
    References: + RFC 4861 3.1 +
    Pre-test conditions: +
  • Header compression is enabled on both Host and Router
  • +
  • Host is configured to use 16 bit short address
  • +
  • Router is configured with multiple prefixes
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + Initialize the network interface of the Host +
    + 1 + + Check + + The Host sends a Router Solicitation to all-routers multicast address with SLLAO (EUI-64). Source = link local based on EUI-64 +
    + 2 + + Verify + + The Router receives the Router Solicitation from the host. +
    + 3 + + Check + +
  • The Router sends a unicast Router Advertisement containing PIO with multiple prefixes and optionally 6COs to the host.
  • +
  • Link local addresses are used.
  • +
  • The L bit is not set.
  • +
    + 4 + + Verify + + The host receives the Router Advertisement from the router +
    + 5 + + Check + + The host configures a number of tentative global IPv6 address based on the PIO information in RA from the Router (16-bit) +
    + 6 + + Check + + The host registers its tentative addresses by sending unicast Neighbor Solicitations containing ARO and SLLAO. Source = GP16 +
    + 7 + + Verify + + The Router receives the Neighbor Solicitations from the host. +
    + 8 + + Check + + The Router sends Neighbor Advertisements with Status set to 0 (Dest = GP16) +
    + 9 + + Verify + + The host updates the status of the tentative addresses +
    + 10 + + Stimulus + +
  • The Router initiates an echo request to one of the Host's new global addresses, using the appropriate own global address as the source
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 64, no traffic class or flow label is being used
  • +
    + 11 + + Check + + The Router sends a 6LoWPAN packet containing the Echo Request message to the Host +
    + 12 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 13 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 14 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 15 + + Verify + + The Host receives the Echo Request message from the Router +
    + 16 + + Check + + The Host sends a 6LoWPAN packet containing the Echo Reply message to the Router +
    + 17 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 18 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 19 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 20 + + Verify + + The Router receives the Echo Reply message from the Host +
    + Notes: + +
  • Optional, as not all 6lrs and hosts allow multiple prefixes
  • +
  • The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different.
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_ND_HC_01 +
    Objective: + Check that EUTs make use of context 0 (EUI-64) +
    Configuration: + Host-6LR +
    References: + RFC 6775 5.4, RFC 6282 3.1.1 +
    Pre-test conditions: +
  • Header compression is enabled on both EUT1 and EUT2
  • +
  • EUT1 and EUT2 are configured to use EUI-64
  • +
  • EUT1 and EUT2 are configured with a default hop limit of 64
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + Host is set up with 6LR and receives context 0 for the global prefix +
    + 1 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's GP64 address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 64, no traffic class or flow label is being used
  • +
    + 2 + + Check + + EUT1 sends a 6LoWPAN packet containing the Echo Request message to EUT2 +
    + 3 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 4 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 5 + + Feature + + The compression makes use of the global prefix (SAC/DAC = 1, SAM/DAM=01/11) +
    + 6 + + Feature + + The context identifier extension is not present (CID = 0) +
    + 7 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 8 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 9 + + Check + + EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message to EUT1 +
    + 10 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 11 + + Feature + + The compression makes use of the global prefix (SAC/DAC = 1, SAM/DAM=01/11) +
    + 12 + + Feature + + The context identifier extension is not present (CID = 0) +
    + 13 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + Notes: + +
  • The feature tests check that good compression is used (but this is not a requirement for interoperability)
  • +
  • The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different.
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_ND_HC_02 +
    Objective: + Check that EUTs make use of context 0 (16-bit) +
    Configuration: + Host-6LR +
    References: + RFC 6775 5.4, RFC 6282 3.1.1 +
    Pre-test conditions: +
  • Header compression is enabled on both EUT1 and EUT2
  • +
  • EUT1 and EUT2 are configured to use 16-bit short address
  • +
  • EUT1 and EUT2 are configured with a default hop limit of 64
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + Host is set up with 6LR and receives context 0 for the global prefix +
    + 1 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's GP16 address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 64, no traffic class or flow label is being used
  • +
    + 2 + + Check + + EUT1 sends a 6LoWPAN packet containing the Echo Request message to EUT2 +
    + 3 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 4 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 5 + + Feature + + The compression makes use of the global prefix (SAC/DAC = 1, SAM/DAM=10/11) +
    + 6 + + Feature + + The context identifier extension is not present (CID = 0) +
    + 7 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 8 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 9 + + Check + + EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message to EUT1 +
    + 10 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 11 + + Feature + + The compression makes use of the global prefix (SAC/DAC = 1, SAM/DAM=10/11) +
    + 12 + + Feature + + The context identifier extension is not present (CID = 0) +
    + 13 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + Notes: + +
  • The feature tests check that good compression is used (but this is not a requirement for interoperability)
  • +
  • The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different.
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_ND_HC_03 +
    Objective: + Check that EUTs make use of context ≠ 0 (EUI-64) +
    Configuration: + Host-6LR +
    References: + RFC 6775 5.4, RFC 6282 3.1.2 +
    Pre-test conditions: +
  • Header compression is enabled on both EUT1 and EUT2
  • +
  • EUT1 and EUT2 are configured to use EUI-64
  • +
  • EUT1 and EUT2 are configured with a default hop limit of 64
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + Host is set up with 6LR and receives context ≠ 0 for the global prefix +
    + 1 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's GP64 address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 64, no traffic class or flow label is being used
  • +
    + 2 + + Check + + EUT1 sends a 6LoWPAN packet containing the Echo Request message to EUT2 +
    + 3 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 4 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 5 + + Feature + + The compression makes use of the global prefix (SAC/DAC = 1, SAM/DAM=01/11) +
    + 6 + + Check + + A Context Identifier Extension (CID) is used for this +
    + 7 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 8 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 9 + + Check + + EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message to EUT1 +
    + 10 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 11 + + Feature + + The compression makes use of the global prefix (SAC/DAC = 1, SAM/DAM=01/11) +
    + 12 + + Check + + A Context Identifier Extension (CID) is used for this +
    + 13 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + Notes: + +
  • The feature tests check that good compression is used (but this is not a requirement for interoperability)
  • +
  • The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different.
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Interoperability Test Description
    Identifier: + TD_6LoWPAN_ND_HC_04 +
    Objective: + Check that EUTs make use of context ≠ 0 (16-bit) +
    Configuration: + Host-6LR +
    References: + RFC 6775 5.4, RFC 6282 3.1.2 +
    Pre-test conditions: +
  • Header compression is enabled on both EUT1 and EUT2
  • +
  • EUT1 and EUT2 are configured to use 16-bit short address
  • +
  • EUT1 and EUT2 are configured with a default hop limit of 64
  • +
    Test Sequence:StepTypeDescription
    + 0 + + Stimulus + + Host is set up with 6LR and receives context ≠ 0 for the global prefix +
    + 1 + + Stimulus + +
  • EUT1 initiates an echo request to EUT2's GP16 address
  • +
  • ICMP payload = 4 bytes, total IPv6 size 52 bytes
  • +
  • Hop Limit is 64, no traffic class or flow label is being used
  • +
    + 2 + + Check + + EUT1 sends a 6LoWPAN packet containing the Echo Request message to EUT2 +
    + 3 + + Feature + + In IP_HC, TF is 11 and the ecn, dscp and flow label fields are compressed away +
    + 4 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 5 + + Feature + + The compression makes use of the global prefix (SAC/DAC = 1, SAM/DAM=10/11) +
    + 6 + + Check + + A Context Identifier Extension (CID) is used for this +
    + 7 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + 8 + + Verify + + EUT2 receives the Echo Request message from EUT1 +
    + 9 + + Check + + EUT2 sends a compressed 6LoWPAN packet containing the Echo Reply message to EUT1 +
    + 10 + + Feature + + In IP_HC, HLIM (HL) is 10 and the hop limit field is compressed away +
    + 11 + + Feature + + The compression makes use of the global prefix (SAC/DAC = 1, SAM/DAM=10/11) +
    + 12 + + Check + + A Context Identifier Extension (CID) is used for this +
    + 13 + + Check + + Dispatch value in 6LowPAN packet is “011TFxHL” +
    + Notes: + +
  • The feature tests check that good compression is used (but this is not a requirement for interoperability)
  • +
  • The Echo Reply message might use a different hop limit in some implementations, then the HLIM value might also be different.
  • +
    + + diff --git a/6lpplugtest/test_coap_ping.c b/6lpplugtest/test_coap_ping.c new file mode 100644 index 0000000..b2065d8 --- /dev/null +++ b/6lpplugtest/test_coap_ping.c @@ -0,0 +1,112 @@ +#include "test_coap_ping.h" +#include "test_utils.h" + +#ifdef MODULE_LIBCOAP +#include + +#include "coap.h" +#include "cpu-conf.h" +#include "thread.h" +#include "ipv6.h" +#include "transceiver.h" + +#define COAP_SERVER_STACK_SIZE (4 * MINIMUM_STACK_SIZE) +#define COAP_SERVER_PORT (UPPER_LAYER_5) + +char coap_server_stack[COAP_SERVER_STACK_SIZE]; + +coap_context_t *get_context(ipv6_addr_t *node, uint16_t port) +{ + coap_address_t addr; + + memset(&addr, 0, sizeof(coap_address_t)); + if (node != NULL) { + memcpy(&addr.addr.sin6.sin6_addr, node, sizeof (struct in6_addr)); + } + + addr.size = sizeof(struct sockaddr_in6); + addr.addr.sin6.sin6_family = AF_INET6; + addr.addr.sin6.sin6_port = (in_port_t)port; + + return coap_new_context(&addr); +} + +int slpt_coap_send_ping(uint16_t local_port, const ipv6_addr_t *node, + uint16_t node_port) +{ + coap_address_t addr; + coap_context_t *ctx = get_context(NULL, local_port); + coap_hdr_t hdr; + coap_pdu_t pdu; + + if (!ctx) { + ERROR("Could not initialize CoAP context\n"); + } + + memset(&hdr, 0, sizeof (coap_hdr_t)); + hdr.version = 1; + + memset(&pdu, 0, sizeof (coap_pdu_t)); + pdu.hdr = &hdr; + pdu.length = 4; + + memset(&addr, 0, sizeof(coap_address_t)); + memcpy(&addr.addr.sin6.sin6_addr, node, sizeof (struct in6_addr)); + addr.size = sizeof(struct sockaddr_in6); + addr.addr.sin6.sin6_family = AF_INET6; + addr.addr.sin6.sin6_port = (in_port_t)node_port; + + coap_send_confirmed(ctx, &addr, &pdu); + + return 1; +} + +void coap_server_process(void) +{ + msg_t msg; + uint16_t server_port; + coap_context_t *ctx; + + msg.type = 0; + + while (msg.type != COAP_SERVER_PORT) { + msg_receive(&msg); + } + + server_port = (uint16_t) msg.content.value; + ctx = get_context(NULL, server_port); + if (!ctx) { + return; + } + + while (1) { + if (coap_read(ctx) >= 0) { + coap_dispatch(ctx); + return; + } + } +} + +int slpt_coap_run_server(uint16_t server_port) +{ + msg_t msg; + int pid; + + if (!slplugtest_utils_initialize_queue()) { + return -1; + } + + pid = thread_create(coap_server_stack, COAP_SERVER_STACK_SIZE, + PRIORITY_MAIN - 1, CREATE_STACKTEST, + coap_server_process, "coap ping server"); + + msg.type = COAP_SERVER_PORT; + msg.content.value = (uint32_t) server_port; + + if (msg_send(&msg, pid, 0) != 1) { + return -1; + } + + return pid; +} +#endif diff --git a/6lpplugtest/test_coap_ping.h b/6lpplugtest/test_coap_ping.h new file mode 100644 index 0000000..161ff14 --- /dev/null +++ b/6lpplugtest/test_coap_ping.h @@ -0,0 +1,7 @@ +#include "ipv6.h" +#include "inttypes.h" + + +int slpt_coap_send_ping(uint16_t local_port, const ipv6_addr_t *node, + uint16_t node_port); +int slpt_coap_run_server(uint16_t server_port); diff --git a/6lpplugtest/test_format.c b/6lpplugtest/test_format.c new file mode 100644 index 0000000..2a0c029 --- /dev/null +++ b/6lpplugtest/test_format.c @@ -0,0 +1,1150 @@ +/* + * Copyright (C) 2013-14 Martin Lenders. + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file LICENSE in the top level directory for more + * details. + */ +#include "inet_ntop.h" +#include "ipv6.h" +#include "msg.h" +#include "net_if.h" +#include "sixlowpan.h" + +#include "test_format.h" +#include "test_utils.h" + +#if defined(MODULE_SHELL) || defined(FORMAT) +int sixlowpan_format_init(void) +{ + ipv6_addr_t tmp; + char addr_str[IPV6_MAX_ADDR_STR_LEN]; + + sixlowpan_lowpan_set_iphc_status(LOWPAN_IPHC_DISABLE); + ipv6_addr_set_link_local_prefix(&tmp); + +#if 0 + if (net_if_set_channel(IF_ID, CHANNEL) < 0) { + printf("Can not set channel %d.\n", CHANNEL); + return 0; + } + + if (net_if_set_pan_id(IF_ID, PAN_ID) < 0) { + printf("Can not set PAN ID %d.\n", PAN_ID); + return 0; + } +#endif + + if (!ipv6_addr_set_by_eui64(&tmp, IF_ID, &tmp)) { + printf("Can not set link-local by EUI-64 on interface %d\n", IF_ID); + return 0; + } + + printf("Add link local address to interface %d: %s\n", IF_ID, + inet_ntop(AF_INET6, &tmp, addr_str, IPV6_MAX_ADDR_STR_LEN)); + + if (!ipv6_net_if_add_addr(IF_ID, &tmp, NDP_ADDR_STATE_PREFERRED, + NDP_OPT_PI_VLIFETIME_INFINITE, + NDP_OPT_PI_PLIFETIME_INFINITE, 0)) { + printf("Can not add link-local address to interface %d\n", IF_ID); + return 0; + } + + /* add all nodes multicast address */ + ipv6_addr_set_all_nodes_addr(&tmp); + printf("Add all nodes multicast address to interface %d: %s\n", IF_ID, + inet_ntop(AF_INET6, &tmp, addr_str, IPV6_MAX_ADDR_STR_LEN)); + + if (!ipv6_net_if_add_addr(IF_ID, &tmp, NDP_ADDR_STATE_PREFERRED, + NDP_OPT_PI_VLIFETIME_INFINITE, + NDP_OPT_PI_PLIFETIME_INFINITE, 0)) { + printf("Can not add all nodes address to interface %d\n", IF_ID); + return 0; + } + + return 1; +} + +int sixlowpan_format_init_long(ipv6_addr_t *eut_addr) +{ + net_if_eui64_t eut_eui64; + + memcpy(&eut_eui64, &eut_addr->uint8[8], 8); + eut_eui64.uint8[0] ^= 0x02; + + net_if_set_src_address_mode(IF_ID, NET_IF_TRANS_ADDR_M_LONG); + return sixlowpan_format_init() && (eut_addr == NULL || + ndp_neighbor_cache_add(IF_ID, eut_addr, &eut_eui64, 8, 0, + NDP_NCE_STATUS_REACHABLE, + NDP_NCE_TYPE_TENTATIVE, 0xffff) == + NDP_OPT_ARO_STATE_SUCCESS); +} + +int sixlowpan_format_init_short(ipv6_addr_t *eut_addr) +{ + net_if_set_src_address_mode(IF_ID, NET_IF_TRANS_ADDR_M_SHORT); + return sixlowpan_format_init() && (eut_addr == NULL || + ndp_neighbor_cache_add(IF_ID, eut_addr, &eut_addr->uint16[7], 2, 0, + NDP_NCE_STATUS_REACHABLE, + NDP_NCE_TYPE_TENTATIVE, 0xffff) == + NDP_OPT_ARO_STATE_SUCCESS); +} + +int sixlowpan_format_init_src_long_dst_short(ipv6_addr_t *eut_addr) +{ + net_if_set_src_address_mode(IF_ID, NET_IF_TRANS_ADDR_M_LONG); + return sixlowpan_format_init() && (eut_addr == NULL || + ndp_neighbor_cache_add(IF_ID, eut_addr, &eut_addr->uint16[7], 2, 0, + NDP_NCE_STATUS_REACHABLE, + NDP_NCE_TYPE_TENTATIVE, 0xffff) == + NDP_OPT_ARO_STATE_SUCCESS); +} + +int sixlowpan_format_init_src_short_dst_long(ipv6_addr_t *eut_addr) +{ + net_if_eui64_t eut_eui64; + + memcpy(&eut_eui64, &eut_addr->uint8[8], 8); + eut_eui64.uint8[0] ^= 0x02; + + net_if_set_src_address_mode(IF_ID, NET_IF_TRANS_ADDR_M_SHORT); + return sixlowpan_format_init() && (eut_addr == NULL || + ndp_neighbor_cache_add(IF_ID, eut_addr, &eut_eui64, 8, 0, + NDP_NCE_STATUS_REACHABLE, + NDP_NCE_TYPE_TENTATIVE, 0xffff) == + NDP_OPT_ARO_STATE_SUCCESS); +} + +int sixlowpan_format_ip_check(msg_t *msg, ipv6_addr_t *sender, char *data, + int data_len) { + uint8_t success = 0; + char sender_str[41]; + + if (msg == NULL) { + ERROR("Message not set\n"); + } + + if (msg->type == IPV6_PACKET_RECEIVED) { + if (sender && slplugtest_utils_check_sender((ipv6_hdr_t *)msg->content.ptr, + sender)) { + success++; + } + else { + FAILURE("Sender of received packet is not %s.\n", + inet_ntop(AF_INET6, sender, sender_str, IPV6_MAX_ADDR_STR_LEN)); + } + if (data && slplugtest_utils_check_echo_data((uint8_t *)msg->content.ptr, + (uint8_t *)data, data_len)) { + success++; + } + else { + FAILURE("Received echo data is not as expected.\n"); + } + } + + if (success > 0) { + return success; + } + else { + return -1; + } +} + +int sixlowpan_format_ip_both_from_long(msg_t *msg) { + uint8_t success = 0; + + if (msg == NULL) { + ERROR("Message not set\n"); + } + + if (msg->type == IPV6_PACKET_RECEIVED) { + if (!sixlowpan_lowpan_eui64_to_short_addr((net_if_eui64_t *) + &(((ipv6_hdr_t *)msg->content.ptr)->srcaddr.uint8[8]))) { + success++; + } + if (!sixlowpan_lowpan_eui64_to_short_addr((net_if_eui64_t *) + &(((ipv6_hdr_t *)msg->content.ptr)->destaddr.uint8[8]))) { + success++; + } + } + + if (success > 0) { + return success; + } + else { + return -1; + } +} + +int sixlowpan_format_ip_both_from_short(msg_t *msg) { + uint8_t success = 0; + + if (msg == NULL) { + ERROR("Message not set\n"); + } + + if (msg->type == IPV6_PACKET_RECEIVED) { + if (sixlowpan_lowpan_eui64_to_short_addr((net_if_eui64_t *) + &(((ipv6_hdr_t *)msg->content.ptr)->srcaddr.uint8[8]))) { + success++; + } + if (sixlowpan_lowpan_eui64_to_short_addr((net_if_eui64_t *) + &(((ipv6_hdr_t *)msg->content.ptr)->destaddr.uint8[8]))) { + success++; + } + } + + if (success > 0) { + return success; + } + else { + return -1; + } +} + +int sixlowpan_format_ip_src_from_long_dst_from_short(msg_t *msg) { + uint8_t success = 0; + + if (msg == NULL) { + ERROR("Message not set\n"); + } + + if (msg->type == IPV6_PACKET_RECEIVED) { + if (!sixlowpan_lowpan_eui64_to_short_addr((net_if_eui64_t *) + &(((ipv6_hdr_t *)msg->content.ptr)->srcaddr.uint8[8]))) { + success++; + } + if (sixlowpan_lowpan_eui64_to_short_addr((net_if_eui64_t *) + &(((ipv6_hdr_t *)msg->content.ptr)->destaddr.uint8[8]))) { + success++; + } + } + + if (success > 0) { + return success; + } + else { + return -1; + } +} + +int sixlowpan_format_ip_src_from_short_dst_from_long(msg_t *msg) { + uint8_t success = 0; + + if (msg == NULL) { + ERROR("Message not set\n"); + } + + if (msg->type == IPV6_PACKET_RECEIVED) { + if (sixlowpan_lowpan_eui64_to_short_addr((net_if_eui64_t *) + &(((ipv6_hdr_t *)msg->content.ptr)->srcaddr.uint8[8]))) { + success++; + } + if (!sixlowpan_lowpan_eui64_to_short_addr((net_if_eui64_t *) + &(((ipv6_hdr_t *)msg->content.ptr)->destaddr.uint8[8]))) { + success++; + } + } + + if (success > 0) { + return success; + } + else { + return -1; + } +} + +int sixlowpan_format_check_uncompressed(msg_t *msg) +{ + uint8_t disp[] = {0x41}; + uint8_t disp_mask = 0xff; + + if (msg == NULL) { + ERROR("Message not set\n"); + } + + if (msg->type == LOWPAN_FRAME_RECEIVED) { + if (slplugtest_utils_check_dispatch( + (sixlowpan_lowpan_frame_t *) msg->content.ptr, disp, + &disp_mask, 1)) { + return 1; + } + else { + FAILURE("Received dispatch is not %02x (01000001).\n", disp[0]); + } + } + + return -1; +} + +int sixlowpan_format_check_fragment(msg_t *msg, uint8_t first) +{ + uint8_t disp[] = {0xc0, 0xe0}; + uint8_t disp_mask = 0xf8; + + if (msg == NULL) { + ERROR("Message not set\n"); + } + + if (msg->type == LOWPAN_FRAME_RECEIVED) { + if (first && slplugtest_utils_check_dispatch( + (sixlowpan_lowpan_frame_t *) msg->content.ptr, &disp[0], + &disp_mask, 1)) { + return 1; + } + if (!first && slplugtest_utils_check_dispatch( + (sixlowpan_lowpan_frame_t *) msg->content.ptr, &disp[1], + &disp_mask, 1)) { + return 1; + } + else { + if (first) { + FAILURE("First received dispatch is not 11000xxx (0xc0).\n"); + } + else { + FAILURE("Following received dispatch is not 11100xxx (0xe0).\n"); + } + } + } + + return -1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST1) && defined(EUT1)) +int sixlowpan_format01_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t eut2; + msg_t msg; + uint8_t success = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + if (!sixlowpan_format_init_long(&eut2)) { + ERROR("Interface initialization failed.\n"); + } + + icmpv6_send_echo_request(&eut2, 1, 1, (uint8_t *) data, 4); + + printf("Waiting for echo reply (seq = 1, id = 0x0001) from %s\n", + eut2_str); +#if 0 + while (success < 5) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut2, data, 4); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_ip_both_from_long(&msg); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_uncompressed(&msg); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + } + } +#endif + + SUCCESS("TD_6LoWPAN_FORMAT_01 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST1) && defined(EUT2)) +int sixlowpan_format01_eut2(char *eut1_str, char *data) +{ + ipv6_addr_t eut1; + msg_t msg; + uint8_t success = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_format_init_long(&eut1)) { + ERROR("Interface initialization failed.\n"); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); +#if 0 + while (success < 5) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut1, data, 4); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_ip_both_from_long(&msg); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_uncompressed(&msg); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + } + } +#endif + SUCCESS("TD_6LoWPAN_FORMAT_01 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST2) && defined(EUT1)) +int sixlowpan_format02_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t eut2; + msg_t msg; + uint8_t success = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + if (!sixlowpan_format_init_short(&eut2)) { + ERROR("Interface initialization failed.\n"); + } + + icmpv6_send_echo_request(&eut2, 1, 1, (uint8_t *) data, 4); + + printf("Waiting for echo reply (seq = 1, id = 0x0001) from %s\n", + eut2_str); + while (success < 5) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut2, data, 4); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_ip_both_from_short(&msg); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_uncompressed(&msg); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + } + } + + SUCCESS("TD_6LoWPAN_FORMAT_02 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST2) && defined(EUT2)) +int sixlowpan_format02_eut2(char *eut1_str, char *data) +{ + ipv6_addr_t eut1; + msg_t msg; + uint8_t success = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + if (!sixlowpan_format_init_short(&eut1)) { + ERROR("Interface initialization failed.\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); + while (success < 5) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut1, data, 4); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_uncompressed(&msg); + + success += res; + res = sixlowpan_format_ip_both_from_short(&msg); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + } + } + + SUCCESS("TD_6LoWPAN_FORMAT_02 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST3) && defined(EUT1)) +int sixlowpan_format03_eut1(char *eut2_str, char *data_tmplt) +{ + ipv6_addr_t eut2; + msg_t msg; + uint8_t success = 0; + uint8_t first = 0; + char data[254]; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_format_init_short(&eut2)) { + ERROR("Interface initialization failed.\n"); + } + + if (data_tmplt == NULL) { + ERROR("Data string not initialized\n"); + } + + slplugtest_utils_generate_data(data, data_tmplt, 253); + + icmpv6_send_echo_request(&eut2, 1, 1, (uint8_t *) data, 253); + + printf("Waiting for echo reply (seq = 1, id = 0x0001) from %s\n", + eut2_str); + while (success < 3) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut2, data, 253); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_fragment(&msg, first); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + first = 1; + } + } + + SUCCESS("TD_6LoWPAN_FORMAT_03 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST3) && defined(EUT2)) +int sixlowpan_format03_eut2(char *eut1_str, char *data) +{ + ipv6_addr_t eut1; + msg_t msg; + uint8_t success = 0; + uint8_t first = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_format_init_short(&eut1)) { + ERROR("Interface initialization failed.\n"); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); + while (success < 3) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut1, data, 253); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_fragment(&msg, first); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + first = 1; + } + } + + SUCCESS("TD_6LoWPAN_FORMAT_03 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST4) && defined(EUT1)) +int sixlowpan_format04_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t eut2; + msg_t msg; + uint8_t success = 0; + uint8_t first = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_format_init_short(&eut2)) { + ERROR("Interface initialization failed.\n"); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + icmpv6_send_echo_request(&eut2, 1, 1, (uint8_t *) data, 1232); + + printf("Waiting for echo reply (seq = 1, id = 0x0001) from %s\n", + eut2_str); + while (success < 3) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut2, data, 1232); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_fragment(&msg, first); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + first = 1; + } + } + + SUCCESS("TD_6LoWPAN_FORMAT_04 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST4) && defined(EUT2)) +int sixlowpan_format04_eut2(char *eut1_str, char *data) +{ + ipv6_addr_t eut1; + msg_t msg; + uint8_t success = 0; + uint8_t first = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_format_init_short(&eut1)) { + ERROR("Interface initialization failed.\n"); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); + while (success < 3) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut1, data, 1232); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_fragment(&msg, first); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + first = 1; + } + } + + SUCCESS("TD_6LoWPAN_FORMAT_04 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST5) && defined(EUT1)) +int sixlowpan_format05_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t target, eut2; + msg_t msg; + uint8_t success = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + ipv6_addr_set_all_nodes_addr(&target); + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + if (!sixlowpan_format_init_short(NULL)) { + ERROR("Interface initialization failed.\n"); + } + + icmpv6_send_echo_request(&target, 1, 1, (uint8_t *) data, 4); + + printf("Waiting for echo reply (seq = 1, id = 0x0001) from %s\n", + eut2_str); + while (success < 3) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut2, data, 4); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_uncompressed(&msg); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + } + } + + SUCCESS("TD_6LoWPAN_FORMAT_05 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST5) && defined(EUT2)) +int sixlowpan_format05_eut2(char *eut1_str, char *data) +{ + ipv6_addr_t eut1; + msg_t msg; + uint8_t success = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + if (!sixlowpan_format_init_short(&eut1)) { + ERROR("Interface initialization failed.\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); + while (success < 3) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut1, data, 4); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_uncompressed(&msg); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + } + } + + SUCCESS("TD_6LoWPAN_FORMAT_05 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST6) && defined(EUT1)) +int sixlowpan_format06_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t target, eut2; + msg_t msg; + uint8_t success = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + ipv6_addr_set_all_nodes_addr(&target); + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + if (!sixlowpan_format_init_long(&eut2)) { + ERROR("Interface initialization failed.\n"); + } + + icmpv6_send_echo_request(&target, 1, 1, (uint8_t *) data, 4); + + printf("Waiting for echo reply (seq = 1, id = 0x0001) from %s\n", + eut2_str); +#if 0 + while (success < 3) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut2, data, 4); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_uncompressed(&msg); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + } + } + +#endif + SUCCESS("TD_6LoWPAN_FORMAT_06 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST6) && defined(EUT2)) +int sixlowpan_format06_eut2(char *eut1_str, char *data) +{ + ipv6_addr_t eut1; + msg_t msg; + uint8_t success = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + if (!sixlowpan_format_init_long(&eut1)) { + ERROR("Interface initialization failed.\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); +#if 0 + while (success < 3) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut1, data, 4); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_uncompressed(&msg); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + } + } +#endif + + SUCCESS("TD_6LoWPAN_FORMAT_06 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST7) && defined(EUT1)) +int sixlowpan_format07_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t eut2; + msg_t msg; + uint8_t success = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + if (!sixlowpan_format_init_src_long_dst_short(&eut2)) { + ERROR("Interface initialization failed.\n"); + } + + icmpv6_send_echo_request(&eut2, 1, 1, (uint8_t *) data, 4); + + printf("Waiting for echo reply (seq = 1, id = 0x0001) from %s\n", + eut2_str); + while (success < 5) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut2, data, 4); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_ip_src_from_short_dst_from_long(&msg); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_uncompressed(&msg); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + } + } + + SUCCESS("TD_6LoWPAN_FORMAT_07 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST7) && defined(EUT2)) +int sixlowpan_format07_eut2(char *eut1_str, char *data) +{ + ipv6_addr_t eut1; + msg_t msg; + uint8_t success = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + if (!sixlowpan_format_init_src_short_dst_long(&eut1)) { + ERROR("Interface initialization failed.\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); + while (success < 5) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut1, data, 4); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_ip_src_from_long_dst_from_short(&msg); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_uncompressed(&msg); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + } + } + + SUCCESS("TD_6LoWPAN_FORMAT_07 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST8) && defined(EUT1)) +int sixlowpan_format08_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t eut2; + msg_t msg; + uint8_t success = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + if (!sixlowpan_format_init_src_short_dst_long(&eut2)) { + ERROR("Interface initialization failed.\n"); + } + + icmpv6_send_echo_request(&eut2, 1, 1, (uint8_t *) data, 4); + + printf("Waiting for echo reply (seq = 1, id = 0x0001) from %s\n", + eut2_str); + while (success < 5) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut2, data, 4); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_ip_src_from_long_dst_from_short(&msg); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_uncompressed(&msg); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + } + } + + SUCCESS("TD_6LoWPAN_FORMAT_08 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(FORMAT) && defined(TEST8) && defined(EUT2)) +int sixlowpan_format08_eut2(char *eut1_str, char *data) +{ + ipv6_addr_t eut1; + msg_t msg; + uint8_t success = 0; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_format_init_src_long_dst_short(&eut1)) { + ERROR("Interface initialization failed.\n"); + } + + if (data == NULL) { + ERROR("Data string not initialized\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); + while (success < 5) { + int res = 0; + + msg_receive(&msg); + res = sixlowpan_format_ip_check(&msg, &eut1, data, 4); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_ip_src_from_short_dst_from_long(&msg); + + if (res != 2 && res >= 0) { + SILENT_FAILURE(); + } + + success += res; + res = sixlowpan_format_check_uncompressed(&msg); + + if (!res) { + SILENT_FAILURE(); + } + else if (res > 0) { + success++; + } + } + + SUCCESS("TD_6LoWPAN_FORMAT_08 [EUT2]\n"); + return 1; +} +#endif diff --git a/6lpplugtest/test_format.h b/6lpplugtest/test_format.h new file mode 100644 index 0000000..13e2005 --- /dev/null +++ b/6lpplugtest/test_format.h @@ -0,0 +1,359 @@ +/* + * Copyright (C) 2013-14 Martin Lenders. + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file LICENSE in the top level directory for more + * details. + */ + +/** + * @file test_format.h + * @brief 6LoWPAN format Plugtests. + */ +#ifndef _6LPPLUGTEST_TEST_FORMAT_H +#define _6LPPLUGTEST_TEST_FORMAT_H +#include + +#include "ipv6.h" + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN packets in + * Node-Node configuration (EUI-64 link-local); EUT1 behavior. + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 8 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_format01_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format01_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN packets in + * Node-Node configuration (EUI-64 link-local); EUT2 behavior. + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 8 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * @param[in] data Test data to expect (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format01_eut2(char *eut1_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN packets in + * Node-Node configuration (16-bit link-local); EUT1 behavior. + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 8 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_format02_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format02_eut1(char *eut1_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN packets in + * Node-Node configuration (16-bit link-local); EUT2 behavior. + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 8 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * @param[in] data Test data to expect (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format02_eut2(char *eut1_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN fragmented + * packets in Node-Node configuration; EUT1 behavior. + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 5.3 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_format03_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 253). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format03_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN fragmented + * packets in Node-Node configuration; EUT2 behavior. + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 5.3 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * @param[in] data Test data to expect (min length 253). + * + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format03_eut2(char *eut1_addr, char *data); + +/** + * @brief Check that EUTs correctly handle maximum size uncompressed 6LoWPAN + * fragmented packets in Node-Node configuration; EUT1 behavior. + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 5.3 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_format04_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 1232). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format04_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs correctly handle maximum size uncompressed 6LoWPAN + * fragmented packets in Node-Node configuration; EUT2 behavior. + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 5.3 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * @param[in] data Test data to expect (min length 1232). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format04_eut2(char *eut1_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN multicast to + * all-nodes (16-bit link-local) in Node-Node configuration; EUT1 + * behavior + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 8 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_format05_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format05_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN multicast to + * all-nodes (16-bit link-local) in Node-Node configuration; EUT2 + * behavior + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 8 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * @param[in] data Test data to expect (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format05_eut2(char *eut1_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN multicast to + * all-nodes (EUI-64 link-local) in Node-Node configuration; EUT1 + * behavior + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 8 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_format06_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format06_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN multicast to + * all-nodes (EUI-64 link-local) in Node-Node configuration; EUT2 + * behavior + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 8 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * @param[in] data Test data to expect (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format06_eut2(char *eut1_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN packets in + * Node-Node configuration (EUI-64 to 16-bit link-local); EUT1 + * behavior. + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 8 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_format07_eut2()). + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_format07_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format07_eut1(char *eut1_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN packets in + * Node-Node configuration (EUI-64 to 16-bit link-local); EUT2 + * behavior. + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 8 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * @param[in] data Test data to expect (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format07_eut2(char *eut1_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN packets in + * Node-Node configuration (16-bit to EUI-64 link-local); EUT1 + * behavior. + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 8 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_format08_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format08_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs correctly handle uncompressed 6LoWPAN packets in + * Node-Node configuration (16-bit to EUI-64 link-local); EUT2 + * behavior. + * + * @see + * RFC 4944, section 5.1 + * + * @see + * RFC 4944, section 8 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * @param[in] data Test data to expect (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_format08_eut2(char *eut1_addr, char *data); + +#endif /* _6LPPLUGTEST_TEST_FORMAT_H */ diff --git a/6lpplugtest/test_hc.c b/6lpplugtest/test_hc.c new file mode 100644 index 0000000..9dc339e --- /dev/null +++ b/6lpplugtest/test_hc.c @@ -0,0 +1,827 @@ +/* + * Copyright (C) 2013-14 Martin Lenders. + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file LICENSE in the top level directory for more + * details. + */ +#include "ipv6.h" +#include "msg.h" +#include "net_if.h" +#include "sixlowpan.h" + +#include "test_hc.h" +#include "test_utils.h" +#include "test_coap_ping.h" + +#if defined(MODULE_SHELL) || defined(HC) +int sixlowpan_hc_init(uint8_t hoplimit) +{ + ipv6_addr_t tmp; + char addr_str[IPV6_MAX_ADDR_STR_LEN]; + + sixlowpan_lowpan_set_iphc_status(LOWPAN_IPHC_ENABLE); + ipv6_set_default_hop_limit(hoplimit); + ipv6_addr_set_link_local_prefix(&tmp); + +#if 0 + if (net_if_set_channel(IF_ID, CHANNEL) < 0) { + printf("Can not set channel.\n"); + return 0; + } + + if (net_if_set_pan_id(IF_ID, PAN_ID) < 0) { + printf("Can not set PAN ID %d.\n", PAN_ID); + return 0; + } +#endif + + if (!ipv6_addr_set_by_eui64(&tmp, IF_ID, &tmp)) { + printf("Can not set link-local by EUI-64 on interface %d\n", IF_ID); + return 0; + } + + printf("Add link local address to interface %d: %s\n", IF_ID, + inet_ntop(AF_INET6, &tmp, addr_str, IPV6_MAX_ADDR_STR_LEN)); + + if (!ipv6_net_if_add_addr(IF_ID, &tmp, NDP_ADDR_STATE_PREFERRED, + NDP_OPT_PI_VLIFETIME_INFINITE, + NDP_OPT_PI_PLIFETIME_INFINITE, 0)) { + printf("Can not add link-local address to interface %d\n", IF_ID); + return 0; + } + + /* add all nodes multicast address */ + ipv6_addr_set_all_nodes_addr(&tmp); + printf("Add all nodes multicast address to interface %d: %s\n", IF_ID, + inet_ntop(AF_INET6, &tmp, addr_str, IPV6_MAX_ADDR_STR_LEN)); + + if (!ipv6_net_if_add_addr(IF_ID, &tmp, NDP_ADDR_STATE_PREFERRED, + NDP_OPT_PI_VLIFETIME_INFINITE, + NDP_OPT_PI_PLIFETIME_INFINITE, 0)) { + printf("Can not add all nodes address to interface %d\n", IF_ID); + return 0; + } + + return 1; +} + +int sixlowpan_hc_router_init(uint8_t hoplimit, ipv6_addr_t *prefix) +{ + sixlowpan_lowpan_set_iphc_status(LOWPAN_IPHC_ENABLE); + ipv6_set_default_hop_limit(hoplimit); + + if (net_if_set_channel(IF_ID, CHANNEL) < 0) { + printf("Can not set channel."); + } + + return sixlowpan_lowpan_init_adhoc_interface(IF_ID, prefix); +} + + +int sixlowpan_hc_init_long(uint8_t hoplimit, ipv6_addr_t *eut_addr, + ipv6_addr_t *prefix) +{ + net_if_eui64_t eut_eui64; + + memcpy(&eut_eui64, &eut_addr->uint8[8], 8); + if (eut_eui64.uint32[0] != HTONL(0x000000ff) && + eut_eui64.uint16[2] != HTONS(0xfe00)) { + eut_eui64.uint8[0] ^= 0x02; + } + + net_if_set_src_address_mode(IF_ID, NET_IF_TRANS_ADDR_M_LONG); + + if (prefix == NULL) { + return sixlowpan_hc_init(hoplimit) && (eut_addr == NULL || + ndp_neighbor_cache_add(IF_ID, eut_addr, &eut_eui64, 8, 0, + NDP_NCE_STATUS_REACHABLE, + NDP_NCE_TYPE_TENTATIVE, 0xffff) == + NDP_OPT_ARO_STATE_SUCCESS); + } + else { + return sixlowpan_hc_router_init(hoplimit, prefix) && (eut_addr == NULL || + ndp_neighbor_cache_add(IF_ID, eut_addr, &eut_eui64, 8, 0, + NDP_NCE_STATUS_REACHABLE, + NDP_NCE_TYPE_TENTATIVE, 0xffff) == + NDP_OPT_ARO_STATE_SUCCESS); + } +} + +int sixlowpan_hc_init_short(uint8_t hoplimit, ipv6_addr_t *eut_addr, + ipv6_addr_t *prefix) +{ + net_if_set_src_address_mode(IF_ID, NET_IF_TRANS_ADDR_M_SHORT); + + if (prefix == NULL) { + return sixlowpan_hc_init(hoplimit) && (eut_addr == NULL || + ndp_neighbor_cache_add(IF_ID, eut_addr, &eut_addr->uint16[7], 2, + 0, NDP_NCE_STATUS_REACHABLE, + NDP_NCE_TYPE_TENTATIVE, 0xffff) == + NDP_OPT_ARO_STATE_SUCCESS); + } + else { + return sixlowpan_hc_router_init(hoplimit, prefix) && (eut_addr == NULL || + ndp_neighbor_cache_add(IF_ID, eut_addr, &eut_addr->uint16[7], 2, + 0, NDP_NCE_STATUS_REACHABLE, + NDP_NCE_TYPE_TENTATIVE, 0xffff) == + NDP_OPT_ARO_STATE_SUCCESS); + } +} + +int sixlowpan_hc_init_src_long_dst_short(uint8_t hoplimit, ipv6_addr_t *eut_addr, + ipv6_addr_t *prefix) +{ + net_if_set_src_address_mode(IF_ID, NET_IF_TRANS_ADDR_M_LONG); + + if (prefix == NULL) { + return sixlowpan_hc_init(hoplimit) && (eut_addr == NULL || + ndp_neighbor_cache_add(IF_ID, eut_addr, &eut_addr->uint16[7], 2, + 0, NDP_NCE_STATUS_REACHABLE, + NDP_NCE_TYPE_TENTATIVE, 0xffff) == + NDP_OPT_ARO_STATE_SUCCESS); + } + else { + return sixlowpan_hc_router_init(hoplimit, prefix) && (eut_addr == NULL || + ndp_neighbor_cache_add(IF_ID, eut_addr, &eut_addr->uint16[7], 2, + 0, NDP_NCE_STATUS_REACHABLE, + NDP_NCE_TYPE_TENTATIVE, 0xffff) == + NDP_OPT_ARO_STATE_SUCCESS); + } +} + +int sixlowpan_hc_init_src_short_dst_long(uint8_t hoplimit, ipv6_addr_t *eut_addr, + ipv6_addr_t *prefix) +{ + net_if_eui64_t eut_eui64; + + memcpy(&eut_eui64, &eut_addr->uint8[8], 8); + eut_eui64.uint8[0] ^= 0x02; + + net_if_set_src_address_mode(IF_ID, NET_IF_TRANS_ADDR_M_SHORT); + + if (prefix == NULL) { + return sixlowpan_hc_init(hoplimit) && (eut_addr == NULL || + ndp_neighbor_cache_add(IF_ID, eut_addr, &eut_eui64, 8, 0, + NDP_NCE_STATUS_REACHABLE, + NDP_NCE_TYPE_TENTATIVE, 0xffff) == + NDP_OPT_ARO_STATE_SUCCESS); + } + else { + return sixlowpan_hc_router_init(hoplimit, prefix) && (eut_addr == NULL || + ndp_neighbor_cache_add(IF_ID, eut_addr, &eut_eui64, 8, 0, + NDP_NCE_STATUS_REACHABLE, + NDP_NCE_TYPE_TENTATIVE, 0xffff) == + NDP_OPT_ARO_STATE_SUCCESS); + } +} + +#if defined(MODULE_SHELL) || defined(EUT2) +int sixlowpan_hc_check_iphc(msg_t *msg, uint8_t expected_tf_flag, + uint8_t expected_hl_flag, + uint8_t expected_addr_comp_flags) +{ + uint8_t disp[] = {0x60, 0x00}; + uint8_t disp_mask[] = {0xe0, 0x00}; + + if (msg == NULL) { + ERROR("Message not set\n"); + } + + if (msg->type == LOWPAN_FRAME_RECEIVED) { + if (slplugtest_utils_check_dispatch( + (sixlowpan_lowpan_frame_t *) msg->content.ptr, disp, + disp_mask, 2)) { + sixlowpan_lowpan_frame_t *frame = (sixlowpan_lowpan_frame_t *)msg->content.ptr; + + if (!(frame->data[0] & expected_tf_flag)) { + printf("INFO: Either traffic class or flow label not compressed " + "as expected but this is only a feature\n"); + } + if (!(frame->data[0] & expected_hl_flag)) { + printf("INFO: Hop limit not compressed as expectded, but this " + "is only a feature\n"); + } + if (!(frame->data[1] & expected_addr_comp_flags)) { + printf("INFO: Source and destination address not compressed as " + "expected\n"); + } + + return 1; + } + else { + FAILURE("Received dispatch is not %02x%02x (with certain flags).\n", + disp[0], disp[1]); + } + } + + return -1; +} +#endif + +int sixlowpan_hc_check_udp_nhc(msg_t *msg, uint8_t flags, uint8_t mask) { + sixlowpan_lowpan_frame_t *frame = (sixlowpan_lowpan_frame_t *)msg->content.ptr; + uint8_t nhc_idx = 2; + + if (frame->length < nhc_idx) { + return 0; + } + + if (msg->type == LOWPAN_FRAME_RECEIVED) { + if (frame->data[0] & 0x04) { + return 0; + } + + if (((frame->data[0] & 0x18) >> 3) == 0) { + nhc_idx += 4; + } + else if (((frame->data[0] & 0x18) >> 3) == 1) { + nhc_idx += 3; + } + else if (((frame->data[0] & 0x18) >> 3) == 2) { + nhc_idx += 1; + } + + if (!(frame->data[0] & 0x03)) { + nhc_idx += 1; + } + + if (!(frame->data[1] & 0x80)) { + nhc_idx += 1; + } + if (frame->data[1] & 0x40) { + if (((frame->data[1] & 0x30) >> 4) == 0) { + nhc_idx += 16; + } + if (((frame->data[1] & 0x30) >> 4) == 1) { + nhc_idx += 8; + } + else if (((frame->data[1] & 0x30) >> 4) == 2) { + nhc_idx += 2; + } + } + else { + if (((frame->data[1] & 0x30) >> 4) == 1) { + nhc_idx += 8; + } + else if (((frame->data[1] & 0x30) >> 4) == 2) { + nhc_idx += 2; + } + } + + if (frame->data[1] & 0x08 && frame->data[1] & 0x04) { + if ((frame->data[1] & 0x03) == 0) { + nhc_idx += 6; + } + } + else if (frame->data[1] & 0x08 && !(frame->data[1] & 0x04)) { + if ((frame->data[1] & 0x03) == 0) { + nhc_idx += 16; + } + if ((frame->data[1] & 0x03) == 1) { + nhc_idx += 6; + } + else if ((frame->data[1] & 0x03) == 2) { + nhc_idx += 4; + } + else if ((frame->data[1] & 0x03) == 3) { + nhc_idx += 1; + } + } + else if (!(frame->data[1] & 0x08) && frame->data[1] & 0x04) { + if ((frame->data[1] & 0x03) == 1) { + nhc_idx += 8; + } + else if ((frame->data[1] & 0x03) == 2) { + nhc_idx += 2; + } + } + else { + if ((frame->data[1] & 0x03) == 0) { + nhc_idx += 16; + } + if ((frame->data[1] & 0x03) == 1) { + nhc_idx += 8; + } + else if ((frame->data[1] & 0x03) == 2) { + nhc_idx += 2; + } + } + } + + return (frame->data[nhc_idx] & (0xf8 | mask)) == (0xf8 | flags); +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST1) && defined(EUT1)) +int sixlowpan_hc01_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t eut2; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized or shorter than 4\n"); + } + + if (!sixlowpan_hc_init_long(64, &eut2, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + icmpv6_send_echo_request(&eut2, 1, 1, (uint8_t *) data, 4); + + SUCCESS("TD_6LoWPAN_HC_01 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST1) && defined(EUT2)) +int sixlowpan_hc01_eut2(char *eut1_str) +{ + ipv6_addr_t eut1; + msg_t msg; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_long(64, &eut1, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); + + msg_receive(&msg); + + if (sixlowpan_hc_check_iphc(&msg, 0x18, 0x2, 0x55) < 0) { + SILENT_FAILURE(); + } + + SUCCESS("TD_6LoWPAN_HC_01 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST2) && defined(EUT1)) +int sixlowpan_hc02_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t eut2; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized or shorter than 4\n"); + } + + if (!sixlowpan_hc_init_short(64, &eut2, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + icmpv6_send_echo_request(&eut2, 1, 1, (uint8_t *) data, 4); + + SUCCESS("TD_6LoWPAN_HC_02 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST2) && defined(EUT2)) +int sixlowpan_hc02_eut2(char *eut1_str) +{ + ipv6_addr_t eut1; + msg_t msg; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_short(64, &eut1, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); + + msg_receive(&msg); + + if (sixlowpan_hc_check_iphc(&msg, 0x18, 0x2, 0x55) < 0) { + SILENT_FAILURE(); + } + + SUCCESS("TD_6LoWPAN_HC_02 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST3) && defined(EUT1)) +int sixlowpan_hc03_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t eut2; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized or shorter than 4\n"); + } + + if (!sixlowpan_hc_init_long(63, &eut2, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + icmpv6_send_echo_request(&eut2, 1, 1, (uint8_t *) data, 4); + + SUCCESS("TD_6LoWPAN_HC_03 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST3) && defined(EUT2)) +int sixlowpan_hc03_eut2(char *eut1_str) +{ + ipv6_addr_t eut1; + msg_t msg; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_long(63, &eut1, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); + + msg_receive(&msg); + + if (sixlowpan_hc_check_iphc(&msg, 0x18, 0x00, 0x55) < 0) { + SILENT_FAILURE(); + } + + SUCCESS("TD_6LoWPAN_HC_03 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST4) && defined(EUT1)) +int sixlowpan_hc04_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t eut2; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized or shorter than 4\n"); + } + + if (!sixlowpan_hc_init_short(63, &eut2, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + icmpv6_send_echo_request(&eut2, 1, 1, (uint8_t *) data, 4); + + SUCCESS("TD_6LoWPAN_HC_04 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST4) && defined(EUT2)) +int sixlowpan_hc04_eut2(char *eut1_str) +{ + ipv6_addr_t eut1; + msg_t msg; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_short(63, &eut1, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); + + msg_receive(&msg); + + if (sixlowpan_hc_check_iphc(&msg, 0x18, 0x00, 0x55) < 0) { + SILENT_FAILURE(); + } + + SUCCESS("TD_6LoWPAN_HC_04 [EUT2]\n"); + return 1; +} +#endif + +#ifdef MODULE_LIBCOAP +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST5) && defined(EUT1)) +int sixlowpan_hc05_6lr(char *prefix_str, char *r_addr_str) +{ + ipv6_addr_t prefix, r_addr; + int prefix_len; + + if (!slplugtest_utils_init_ll_eut_addr(&r_addr, r_addr_str)) { + SILENT_ERROR(); + } + + if (!slplugtest_utils_init_prefix(&prefix, &prefix_len, prefix_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_long(255, &r_addr, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + slpt_coap_send_ping(5683, &r_addr, 5683); + + SUCCESS("TD_6LoWPAN_HC_05 [6LoWPAN router]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST5) && defined(EUT2)) +int sixlowpan_hc05_host(char *host_addr_str) +{ + ipv6_addr_t host_addr; + msg_t msg; + + if (!slplugtest_utils_init_ll_eut_addr(&host_addr, host_addr_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_short(255, &host_addr, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + slpt_coap_run_server(5683); + + msg_receive(&msg); + + if (sixlowpan_hc_check_udp_nhc(&msg, 0x00, 0x0d) < 0) { + SILENT_FAILURE(); + } + + SUCCESS("TD_6LoWPAN_HC_04 [6LoWPAN host]"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST6) && defined(EUT1)) +int sixlowpan_hc06_6lr(char *prefix_str, char *r_addr_str) +{ + ipv6_addr_t prefix, r_addr; + + if (!slplugtest_utils_init_ll_eut_addr(&r_addr, r_addr_str)) { + SILENT_ERROR(); + } + + if (!slplugtest_utils_init_ll_eut_addr(&prefix, prefix_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_short(255, &r_addr, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + slpt_coap_send_ping(5683, &r_addr, 5683); + + SUCCESS("TD_6LoWPAN_HC_05 [6LoWPAN router]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST6) && defined(EUT2)) +int sixlowpan_hc06_host(char *host_addr_str) +{ + ipv6_addr_t host_addr; + msg_t msg; + + if (!slplugtest_utils_init_ll_eut_addr(&host_addr, host_addr_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_short(255, &host_addr, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + slpt_coap_run_server(5683); + + msg_receive(&msg); + + if (sixlowpan_hc_check_udp_nhc(&msg, 0x00, 0x0d) < 0) { + SILENT_FAILURE(); + } + + SUCCESS("TD_6LoWPAN_HC_04 [6LoWPAN host]"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST7) && defined(EUT1)) +int sixlowpan_hc07_6lr(char *prefix_str, char *r_addr_str) +{ + ipv6_addr_t prefix, r_addr; + + if (!slplugtest_utils_init_ll_eut_addr(&r_addr, r_addr_str)) { + SILENT_ERROR(); + } + + if (!slplugtest_utils_init_ll_eut_addr(&prefix, prefix_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_long(255, &r_addr, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + slpt_coap_send_ping(61616, &r_addr, 61616); + + SUCCESS("TD_6LoWPAN_HC_05 [6LoWPAN router]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST7) && defined(EUT2)) +int sixlowpan_hc07_host(char *host_addr_str) +{ + ipv6_addr_t host_addr; + msg_t msg; + + if (!slplugtest_utils_init_ll_eut_addr(&host_addr, host_addr_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_short(255, &host_addr, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + slpt_coap_run_server(61616); + + msg_receive(&msg); + + if (sixlowpan_hc_check_udp_nhc(&msg, 0x00, 0x0d) < 0) { + SILENT_FAILURE(); + } + + SUCCESS("TD_6LoWPAN_HC_04 [6LoWPAN host]"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST8) && defined(EUT1)) +int sixlowpan_hc08_6lr(char *prefix_str, char *r_addr_str) +{ + ipv6_addr_t prefix, r_addr; + + if (!slplugtest_utils_init_ll_eut_addr(&r_addr, r_addr_str)) { + SILENT_ERROR(); + } + + if (!slplugtest_utils_init_ll_eut_addr(&prefix, prefix_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_short(255, &r_addr, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + slpt_coap_send_ping(61616, &r_addr, 61616); + + SUCCESS("TD_6LoWPAN_HC_05 [6LoWPAN router]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST8) && defined(EUT2)) +int sixlowpan_hc08_host(char *host_addr_str) +{ + ipv6_addr_t host_addr; + msg_t msg; + + if (!slplugtest_utils_init_ll_eut_addr(&host_addr, host_addr_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_short(255, &host_addr, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + slpt_coap_run_server(61616); + + msg_receive(&msg); + + if (sixlowpan_hc_check_udp_nhc(&msg, 0x00, 0x0d) < 0) { + SILENT_FAILURE(); + } + + SUCCESS("TD_6LoWPAN_HC_04 [6LoWPAN host]"); + return 1; +} +#endif +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST9) && defined(EUT1)) +int sixlowpan_hc09_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t eut2; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized or shorter than 4\n"); + } + + if (!sixlowpan_hc_init_src_long_dst_short(64, &eut2, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + icmpv6_send_echo_request(&eut2, 1, 1, (uint8_t *) data, 4); + + SUCCESS("TD_6LoWPAN_HC_09 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST9) && defined(EUT2)) +int sixlowpan_hc09_eut2(char *eut1_str) +{ + ipv6_addr_t eut1; + msg_t msg; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_src_short_dst_long(64, &eut1, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); + + msg_receive(&msg); + + if (sixlowpan_hc_check_iphc(&msg, 0x18, 0x2, 0x55) < 0) { + SILENT_FAILURE(); + } + + SUCCESS("TD_6LoWPAN_HC_09 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST10) && defined(EUT1)) +int sixlowpan_hc10_eut1(char *eut2_str, char *data) +{ + ipv6_addr_t eut2; + + if (!slplugtest_utils_init_ll_eut_addr(&eut2, eut2_str)) { + SILENT_ERROR(); + } + + if (data == NULL) { + ERROR("Data string not initialized or shorter than 4\n"); + } + + if (!sixlowpan_hc_init_src_short_dst_long(64, &eut2, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + icmpv6_send_echo_request(&eut2, 1, 1, (uint8_t *) data, 4); + + SUCCESS("TD_6LoWPAN_HC_10 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(HC) && defined(TEST10) && defined(EUT2)) +int sixlowpan_hc10_eut2(char *eut1_str) +{ + ipv6_addr_t eut1; + msg_t msg; + + if (!slplugtest_utils_init_ll_eut_addr(&eut1, eut1_str)) { + SILENT_ERROR(); + } + + if (!sixlowpan_hc_init_src_long_dst_short(64, &eut1, NULL)) { + ERROR("Interface initialization failed.\n"); + } + + printf("Waiting for echo request from %s\n", eut1_str); + + msg_receive(&msg); + + if (sixlowpan_hc_check_iphc(&msg, 0x18, 0x2, 0x55) < 0) { + SILENT_FAILURE(); + } + + SUCCESS("TD_6LoWPAN_HC_10 [EUT2]\n"); + return 1; +} +#endif diff --git a/6lpplugtest/test_hc.h b/6lpplugtest/test_hc.h new file mode 100644 index 0000000..9b9c9fb --- /dev/null +++ b/6lpplugtest/test_hc.h @@ -0,0 +1,366 @@ +/* + * Copyright (C) 2013-14 Martin Lenders. + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file LICENSE in the top level directory for more + * details. + */ + +/** + * @file test_hc.h + * @brief 6LoWPAN header compression Plugtests. + */ +#ifndef _6LPPLUGTEST_TEST_HC_H +#define _6LPPLUGTEST_TEST_HC_H + +#include + +/** + * @brief Check that EUTs correctly handle compressed 6LoWPAN packets in + * Node-Node configuration (EUI-64 link-local, hop limit=64); EUT1 + * behavior. + * + * @see + * RFC 6282, section 3 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_hc01_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc01_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs correctly handle compressed 6LoWPAN packets in + * Node-Node configuration (EUI-64 link-local, hop limit=64); EUT2 + * behavior. + * + * @see + * RFC 6282, section 3 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc01_eut2(char *eut1_addr); + +/** + * @brief Check that EUTs correctly handle compressed 6LoWPAN packets in + * Node-Node configuration (16-bit link-local, hop limit=64); EUT1 + * behavior. + * + * @see + * RFC 6282, section 3 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_hc02_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc02_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs correctly handle compressed 6LoWPAN packets in + * Node-Node configuration (16-bit link-local, hop limit=64); EUT2 + * behavior. + * + * @see + * RFC 6282, section 3 + * + * + * @pre EUT is configured to use 16-bit short address. + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc02_eut2(char *eut1_addr); + +/** + * @brief Check that EUTs correctly handle compressed 6LoWPAN packets in + * Node-Node configuration (EUI-64 link-local, hop limit=63); EUT1 + * behavior. + * + * @see + * RFC 6282, section 3 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_hc03_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc03_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs correctly handle compressed 6LoWPAN packets in + * Node-Node configuration (EUI-64 link-local, hop limit=63); EUT2 + * behavior. + * + * @see + * RFC 6282, section 3 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc03_eut2(char *eut1_addr); + +/** + * @brief Check that EUTs correctly handle compressed 6LoWPAN packets in + * Node-Node configuration (16-bit link-local, hop limit=63); EUT1 + * behavior. + * + * @see + * RFC 6282, section 3 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_hc02_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc04_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs correctly handle compressed 6LoWPAN packets in + * Node-Node configuration (16-bit link-local, hop limit=63); EUT2 + * behavior. + * + * @see + * RFC 6282, section 3 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc04_eut2(char *eut1_addr); + +/** + * @brief Check that EUTs correctly handle compressed UDP packets in Node-Node + * configuration (EUI-64 link-local, server port=5683); Host behavior. + * + * @see + * RFC 6282, section 4.3 + * + * + * @pre Host is configured to use EUI-64. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc05_host(char *r_addr); + +/** + * @brief Check that EUTs correctly handle compressed UDP packets in Node-Node + * configuration (EUI-64 link-local, server port=5683); 6LoWPAN router + * behavior. + * + * @see + * RFC 6282, section 4.3 + * + * + * @pre Host is configured to react to this test (On RIOT: run + * sixlowpan_hc05_host()). + * + * @param[in] host_addr IPv6 link-local address of the host in string + * representation. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc05_6lr(char *prefix, char *host_addr); + +/** + * @brief Check that EUTs correctly handle compressed UDP packets in Node-Node + * configuration (16-bit link-local, server port=5683); Host behavior. + * + * @see + * RFC 6282, section 4.3 + * + * + * @pre Host is configured to use 16-bit short address. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc06_host(char *r_addr); + +/** + * @brief Check that EUTs correctly handle compressed UDP packets in Node-Node + * configuration (16-bit link-local, server port=5683); 6LoWPAN router + * behavior. + * + * @see + * RFC 6282, section 4.3 + * + * + * @pre Host is configured to react to this test (On RIOT: run + * sixlowpan_hc06_host()). + * + * @param[in] host_addr IPv6 link-local address of the host in string + * representation. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc06_6lr(char *prefix, char *host_addr); + +/** + * @brief Check that EUTs correctly handle compressed UDP packets in Node-Node + * configuration (EUI-64 link-local, server port=5683); Host behavior. + * + * @see + * RFC 6282, section 4.3 + * + * + * @pre Host is configured to use EUI-64. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc07_host(char *r_addr); + +/** + * @brief Check that EUTs correctly handle compressed UDP packets in Node-Node + * configuration (EUI-64 link-local, server port=61616); 6LoWPAN router + * behavior. + * + * @see + * RFC 6282, section 4.3 + * + * + * @pre Host is configured to react to this test (On RIOT: run + * sixlowpan_hc07_host()). + * + * @param[in] host_addr IPv6 link-local address of the host in string + * representation. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc07_6lr(char *prefix, char *host_addr); + +/** + * @brief Check that EUTs correctly handle compressed UDP packets in Node-Node + * configuration (16-bit link-local, server port=61616); Host behavior. + * + * @see + * RFC 6282, section 4.3 + * + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc08_host(char *r_addr); + +/** + * @brief Check that EUTs correctly handle compressed UDP packets in Node-Node + * configuration (16-bit link-local, server port=61616); 6LoWPAN router + * behavior. + * + * @see + * RFC 6282, section 4.3 + * + * + * @pre Host is configured to react to this test (On RIOT: run + * sixlowpan_hc08_host()). + * + * @param[in] host_addr IPv6 link-local address of the host in string + * representation. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc08_6lr(char *prefix, char *host_addr); + +/** + * @brief Check that EUTs correctly handle compressed 6LoWPAN packets in + * Node-Node configuration (EUI-64 TO 16-bit link-local, hop limit=64); + * EUT1 behavior. + * + * @see + * RFC 6282, section 3 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_hc09_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc09_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs correctly handle compressed 6LoWPAN packets in + * Node-Node configuration (EUI-64 TO 16-bit link-local, hop limit=64); + * EUT2 behavior. + * + * @see + * RFC 6282, section 3 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc09_eut2(char *eut1_addr); + +/** + * @brief Check that EUTs correctly handle compressed 6LoWPAN packets in + * Node-Node configuration (16-bit to EUI-64 link-local, hop limit=64); + * EUT1 behavior. + * + * @see + * RFC 6282, section 3 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_hc10_eut2()). + * + * @param[in] eut2_addr IPv6 link-local address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc10_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs correctly handle compressed 6LoWPAN packets in + * Node-Node configuration (16-bit to EUI-64 link-local, hop limit=64); + * EUT2 behavior. + * + * @see + * RFC 6282, section 3 + * + * + * @param[in] eut1_addr IPv6 link-local address of EUT1 in string + * representation. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_hc10_eut2(char *eut1_addr); + +#endif /* _6LPPLUGTEST_TEST_HC_H */ diff --git a/6lpplugtest/test_nd.c b/6lpplugtest/test_nd.c new file mode 100644 index 0000000..06d84e8 --- /dev/null +++ b/6lpplugtest/test_nd.c @@ -0,0 +1,201 @@ +#include "ipv6.h" +#include "msg.h" +#include "net_if.h" +#include "vtimer.h" +#include "sixlowpan.h" + +#include "test_format.h" +#include "test_utils.h" + +#if defined(MODULE_SHELL) || defined(ND) +int sixlowpan_nd_init(ipv6_addr_t *prefix) +{ + sixlowpan_lowpan_set_iphc_status(LOWPAN_IPHC_ENABLE); + ipv6_set_default_hop_limit(64); + + if (net_if_set_channel(IF_ID, CHANNEL) < 0) { + printf("Can not set channel.\n"); + return 0; + } + + if (net_if_set_pan_id(IF_ID, PAN_ID) < 0) { + printf("Can not set PAN ID %d.\n", PAN_ID); + return 0; + } + + if (prefix) { + return sixlowpan_lowpan_init_adhoc_interface(IF_ID, prefix); + } + else { + return sixlowpan_lowpan_init_interface(IF_ID); + } +} + +int sixlowpan_nd_init_long(ipv6_addr_t *prefix) { + net_if_set_src_address_mode(IF_ID, NET_IF_TRANS_ADDR_M_LONG); + return sixlowpan_nd_init(prefix); +} + +int sixlowpan_nd_init_short(ipv6_addr_t *prefix) { + net_if_set_src_address_mode(IF_ID, NET_IF_TRANS_ADDR_M_SHORT); + return sixlowpan_nd_init(prefix); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST1) && defined(EUT1)) +int sixlowpan_nd01_host(void) +{ + if (!sixlowpan_nd_init_long(NULL)) { + ERROR("Interface initialization failed.\n"); + } + + SUCCESS("TD_6LoWPAN_ND_01 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST1) && defined(EUT2)) +int sixlowpan_nd01_6lr(char *prefix_str, char *host_str, char *data) +{ + ipv6_addr_t prefix, host; + int prefix_len; + + if (!slplugtest_utils_init_ll_eut_addr(&host, host_str)) { + SILENT_ERROR(); + } + + if (!slplugtest_utils_init_prefix(&prefix, &prefix_len, prefix_str)) { + ERROR("Error parsing prefix string\n"); + } + + if (!sixlowpan_nd_init_long(&prefix)) { + ERROR("Interface initialization failed.\n"); + } + + vtimer_usleep(1000); + + icmpv6_send_echo_request(&host, 1, 1, (uint8_t *) data, 4); + + SUCCESS("TD_6LoWPAN_ND_01 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST2) && defined(EUT1)) +int sixlowpan_nd02_host(void) +{ + if (!sixlowpan_nd_init_short(NULL)) { + ERROR("Interface initialization failed.\n"); + } + + SUCCESS("TD_6LoWPAN_ND_02 [EUT1]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST2) && defined(EUT2)) +int sixlowpan_nd02_6lr(char *prefix_str, char *host_str, char *data) +{ + ipv6_addr_t prefix, host; + int prefix_len; + + if (!slplugtest_utils_init_ll_eut_addr(&host, host_str)) { + SILENT_ERROR(); + } + + if (!slplugtest_utils_init_prefix(&prefix, &prefix_len, prefix_str)) { + ERROR("Error parsing prefix string\n"); + } + + if (!sixlowpan_nd_init_short(&prefix)) { + ERROR("Interface initialization failed.\n"); + } + + vtimer_usleep(1000); + + icmpv6_send_echo_request(&host, 1, 1, (uint8_t *) data, 4); + + SUCCESS("TD_6LoWPAN_ND_02 [EUT2]\n"); + return 1; +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST3) && defined(EUT1)) +int sixlowpan_nd03_host(void) +{ + ERROR("NUD not implemented in RIOT yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST3) && defined(EUT2)) +int sixlowpan_nd03_6lr(void) +{ + ERROR("NUD not implemented in RIOT yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST4) && defined(EUT1)) +int sixlowpan_nd04_6lr(char *prefix, char *host_str, char *data) +{ + (void)prefix; + (void)host_str; + (void)data; + ERROR("NUD not implemented in RIOT yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST4) && defined(EUT2)) +int sixlowpan_nd04_host(void) +{ + ERROR("NUD not implemented in RIOT yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST5) && defined(EUT1)) +int sixlowpan_nd05_6lr(char *prefix) +{ + (void)prefix; + ERROR("NUD not implemented in RIOT yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST5) && defined(EUT2)) +int sixlowpan_nd05_host(void) +{ + ERROR("NUD not implemented in RIOT yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST6) && defined(EUT1)) +int sixlowpan_nd06_host(void) +{ + ERROR("Test not implemented yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST6) && defined(EUT2)) +int sixlowpan_nd06_6lr(char *prefix_list, char *host_str, char *data) +{ + (void)prefix_list; + (void)host_str; + (void)data; + ERROR("Test not implemented yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST7) && defined(EUT1)) +int sixlowpan_nd07_host(void) +{ + ERROR("Test not implemented yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND) && defined(TEST7) && defined(EUT2)) +int sixlowpan_nd07_6lr(char *prefix_list, char *host_str, char *data) +{ + (void)prefix_list; + (void)host_str; + (void)data; + ERROR("Test not implemented yet.\n"); +} +#endif diff --git a/6lpplugtest/test_nd.h b/6lpplugtest/test_nd.h new file mode 100644 index 0000000..562386d --- /dev/null +++ b/6lpplugtest/test_nd.h @@ -0,0 +1,252 @@ +/* + * Copyright (C) 2013-14 Martin Lenders. + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file LICENSE in the top level directory for more + * details. + */ + +/** + * @file test_nd.h + * @brief 6LoWPAN neighbor discovery Plugtests. + */ +#ifndef _6LPPLUGTEST_TEST_ND_H +#define _6LPPLUGTEST_TEST_ND_H + +#include "ipv6.h" + +/** + * @brief Check that a host is able to register its global IPv6 address in + * Host-6LR configuration (EUI-64); Host behavior. + * + * @see + * RFC 6775, section 10.2 + * + * + * @pre 6LR is configured to react to this test (On RIOT: run + * sixlowpan_nd01_6lr()). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd01_host(void); + +/** + * @brief Check that a host is able to register its global IPv6 address in + * Host-6LR configuration (EUI-64); 6LoWPAN router behavior. + * + * @see + * RFC 6775, section 10.2 + * + * + * @param[in] prefix The prefix to use in PIO of this 6LoWPAN router in + * string representation. + * @param[in] host_addr IPv6 link-local address of the host in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd01_6lr(char *prefix, char *host_addr, char* data); + +/** + * @brief Check that a host is able to register its global IPv6 address in + * Host-6LR configuration (16-bit); Host behavior. + * + * @see + * RFC 6775, section 10.2 + * + * + * @pre 6LR is configured to react to this test (On RIOT: run + * sixlowpan_nd02_6lr()). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd02_host(void); + +/** + * @brief Check that a host is able to register its global IPv6 address in + * Host-6LR configuration (16-bit); 6LoWPAN router behavior. + * + * @see + * RFC 6775, section 10.2 + * + * + * @param[in] prefix The prefix to use in PIO of this 6LoWPAN router in + * string representation. + * @param[in] host_addr IPv6 link-local address of the host in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd02_6lr(char *prefix, char *host_addr, char* data); + +/** + * @brief Check Host NUD behavior in Host-6LR configuration; Host behavior. + * + * @see + * RFC 6775, section 5.5 + * + * + * @pre 6LR is configured to react to this test (On RIOT: run + * sixlowpan_nd03_6lr()). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd03_host(void); + +/** + * @brief Check Host NUD behavior in Host-6LR configuration; 6LoWPAN router + * behavior. + * + * @see + * RFC 6775, section 5.5 + * + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd03_6lr(void); + +/** + * @brief Check Host NUD behavior (ICMP version) in Host-6LR configuration; + * Host behavior. + * + * @see + * RFC 6775, section 5.5 + * + * + * @pre Host is configured to use EUI-64. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd04_host(void); + +/** + * @brief Check Host NUD behavior (ICMP version) in Host-6LR configuration; + * 6LoWPAN router behavior. + * + * @see + * RFC 6775, section 5.5 + * + * + * @pre Host is configured to react to this test (On RIOT: run + * sixlowpan_nd04_host()). + * + * @param[in] prefix The prefix to use in PIO of this 6LoWPAN router in + * string representation. + * @param[in] host_addr IPv6 link-local address of the host in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd04_6lr(char *prefix, char *host_addr, char* data); + +/** + * @brief Check Host NUD behavior (UDP version) in Host-6LR configuration; + * Host behavior. + * + * @see + * RFC 6775, section 5.5 + * + * + * @pre Host is configured to use EUI-64. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd05_host(void); + +/** + * @brief Check Host NUD behavior (UDP version) in Host-6LR configuration; + * 6LoWPAN router behavior. + * + * @see + * RFC 6775, section 5.5 + * + * + * @pre Host is configured to react to this test (On RIOT: run + * sixlowpan_nd05_host()). + * + * @param[in] prefix The prefix to use in PIO of this 6LoWPAN router in + * string representation. + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd05_6lr(char *prefix); + +/** + * @brief Check host behavior under multiple prefixes (EUI-64) in Host-6LR + * configuration; Host behavior. + * + * @see + * RFC 6775, section 3.1 + * + * + * @pre Host is configured to use EUI-64. + * @pre 6LR is configured to react to this test (On RIOT: run + * sixlowpan_nd06_6lr()). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd06_host(void); + +/** + * @brief Check host behavior under multiple prefixes (EUI-64) in Host-6LR + * configuration; 6LoWPAN router behavior. + * + * @see + * RFC 6775, section 3.1 + * + * + * @pre prefixes is not NULL + * @pre prefixes contains more than one address + * @pre prefix_num > 1 + * + * @param[in] prefix_list_len Length of prefix list + * @param[in] prefix_list Prefixes this router should send in its PIO + * as string representation. + * @param[in] host_addr IPv6 link-local address of the host in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd06_6lr(int prefix_list_len, char **prefix_list, char *host_addr, + char* data); + +/** + * @brief Check host behavior under multiple prefixes (16-bit) in Host-6LR + * configuration; Host behavior. + * + * @see + * RFC 6775, section 3.1 + * + * + * @pre 6LR is configured to react to this test (On RIOT: run + * sixlowpan_nd07_6lr()). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd07_host(void); + +/** + * @brief Check host behavior under multiple prefixes (16-bit) in Host-6LR + * configuration; 6LoWPAN router behavior. + * + * @see + * RFC 6775, section 3.1 + * + * + * @param[in] prefix_list_len Length of prefix list + * @param[in] prefix_list Prefixes this router should send in its PIO + * as string representation. + * @param[in] host_addr IPv6 link-local address of the host in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd07_6lr(int prefix_list_len, char **prefix_list, char *host_addr, + char* data); + +#endif /* _6LPPLUGTEST_TEST_ND_H */ diff --git a/6lpplugtest/test_nd_hc.c b/6lpplugtest/test_nd_hc.c new file mode 100644 index 0000000..5e2f489 --- /dev/null +++ b/6lpplugtest/test_nd_hc.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2013-14 Martin Lenders. + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file LICENSE in the top level directory for more + * details. + */ +#include "test_nd_hc.h" +#include "test_utils.h" + +#if defined(MODULE_SHELL) || defined(ND_HC) +void sixlowpan_nd_hc_6lr(char *prefix, uint8_t flags) +{ + (void)prefix; + (void)flags; + printf("Test not implemented yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND_HC) && defined(TEST1) && defined(EUT1)) +int sixlowpan_nd_hc01_eut1(char *eut2_addr, char *data) +{ + (void)eut2_addr; + (void)data; + ERROR("Test not implemented yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND_HC) && defined(TEST1) && defined(EUT2)) +int sixlowpan_nd_hc01_eut2(void) +{ + ERROR("Test not implemented yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND_HC) && defined(TEST2) && defined(EUT1)) +int sixlowpan_nd_hc02_eut1(char *eut2_addr, char *data) +{ + (void)eut2_addr; + (void)data; + ERROR("Test not implemented yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND_HC) && defined(TEST2) && defined(EUT2)) +int sixlowpan_nd_hc02_eut2(void) +{ + ERROR("Test not implemented yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND_HC) && defined(TEST3) && defined(EUT1)) +int sixlowpan_nd_hc03_eut1(char *eut2_addr, char *data) +{ + (void)eut2_addr; + (void)data; + ERROR("Test not implemented yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND_HC) && defined(TEST3) && defined(EUT2)) +int sixlowpan_nd_hc03_eut2(void) +{ + ERROR("Test not implemented yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND_HC) && defined(TEST4) && defined(EUT1)) +int sixlowpan_nd_hc04_eut1(char *eut2_addr, char *data) +{ + (void)eut2_addr; + (void)data; + ERROR("Test not implemented yet.\n"); +} +#endif + +#if defined(MODULE_SHELL) || (defined(ND_HC) && defined(TEST4) && defined(EUT2)) +int sixlowpan_nd_hc04_eut2(void) +{ + ERROR("Test not implemented yet.\n"); +} +#endif diff --git a/6lpplugtest/test_nd_hc.h b/6lpplugtest/test_nd_hc.h new file mode 100644 index 0000000..3c6911a --- /dev/null +++ b/6lpplugtest/test_nd_hc.h @@ -0,0 +1,270 @@ +/* + * Copyright (C) 2013-14 Martin Lenders. + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file LICENSE in the top level directory for more + * details. + */ + +/** + * @file test_nd_hc.h + * @brief 6LoWPAN neighbor discovery + header compression Plugtests. + */ +#ifndef _6LPPLUGTEST_TEST_ND_HC_H +#define _6LPPLUGTEST_TEST_ND_HC_H + +#include "ipv6.h" + +/** + * Run 6LoWPAN router (initialized with sixlowpan_nd_hc_6lr()) not as an EUT + * simultanously if set. + */ +#define SLPT_6LR_FLAG_STANDALONE 0x1 + +/** + * Run 6LoWPAN router (initialized with sixlowpan_nd_hc_6lr()) with global + * IPv6 prefix as context = 0 if set. + */ +#define SLPT_6LR_FLAG_CONTEXT0 0x2 + +/** + * Run 6LoWPAN router (initialized with sixlowpan_nd_hc_6lr()) with EUI-64 + * if set or with 16-bit short address otherwise. + */ +#define SLPT_6LR_FLAG_64BIT 0x4 + +/** + * @brief Assures that this node will be initialized as 6LoWPAN router + * in the tests of this scope. + * + * @param[in] prefix the prefix to put into context + * @param[in] flags configuration flags for the router (prefixed with + * SLPT_6LR_FLAG_). + */ +void sixlowpan_nd_hc_6lr(char *prefix, uint8_t flags); + +/** + * @brief Check that EUTs make use of context = 0 in Host-6LR configuration + * (EUI-64); EUT1 behavior. + * + * @see + * RFC 6282, section 3.1.1 + * + * @see + * RFC 6775, section 5.4 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_nd_hc01_eut2()). + * @pre An 6LoWPAN router (6LR) is running in the network (On RIOT: run + * sixlowpan_nd_hc_6lr() on one of the EUTs before + * sixlowpan_nd_hc01_eut1() or sixlowpan_nd_hc01_eut2() respectively or + * standalone). + * @pre 6LR is configured to use EUI-64 (On RIOT: run sixlowpan_nd_hc_6lr() + * with flag 6LPPLUGTEST_6LR_FLAG_64BIT set). + * @pre The PAN's global/64-prefix is stored as context = 0 in the 6LoWPAN + * router's context table. (On RIOT: run sixlowpan_nd_hc_6lr() with + * flag 6LPPLUGTEST_6LR_FLAG_CONTEXT0 set). + * + * @param[in] eut2_addr IPv6 global/64-prefixed address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd_hc01_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs make use of context = 0 in Host-6LR configuration + * (EUI-64); EUT2 behavior. + * + * @see + * RFC 6282, section 3.1.1 + * + * @see + * RFC 6775, section 5.4 + * + * + * @pre An 6LoWPAN router (6LR) is running in the network (On RIOT: run + * sixlowpan_nd_hc_6lr() on one of the EUTs before + * sixlowpan_nd_hc01_eut1() or sixlowpan_nd_hc01_eut2() respectively or + * standalone). + * @pre 6LR is configured to use EUI-64 (On RIOT: run sixlowpan_nd_hc_6lr() + * with flag 6LPPLUGTEST_6LR_FLAG_64BIT set). + * @pre The PAN's global/64-prefix is stored as context = 0 in the 6LoWPAN + * router's context table. (On RIOT: run sixlowpan_nd_hc_6lr() with + * flag 6LPPLUGTEST_6LR_FLAG_CONTEXT0 set). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd_hc01_eut2(void); + +/** + * @brief Check that EUTs make use of context = 0 in Host-6LR configuration + * (16-bit); EUT1 behavior. + * + * @see + * RFC 6282, section 3.1.1 + * + * @see + * RFC 6775, section 5.4 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_nd_hc02_eut2()). + * @pre An 6LoWPAN router (6LR) is running in the network (On RIOT: run + * sixlowpan_nd_hc_6lr() on one of the EUTs before + * sixlowpan_nd_hc02_eut1() or sixlowpan_nd_hc02_eut2() respectively or + * standalone). + * @pre 6LR is configured to use 16-bit short address (On RIOT: + * run sixlowpan_nd_hc_6lr() with flag 6LPPLUGTEST_6LR_FLAG_64BIT unset). + * @pre The PAN's global/16-prefix is stored as context = 0 in the 6LoWPAN + * router's context table. (On RIOT: run sixlowpan_nd_hc_6lr() with + * flag 6LPPLUGTEST_6LR_FLAG_CONTEXT0 set). + * + * @param[in] eut2_addr IPv6 global/64-prefixed address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd_hc02_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs make use of context = 0 in Host-6LR configuration + * (16-bit); EUT2 behavior. + * + * @see + * RFC 6282, section 3.1.1 + * + * @see + * RFC 6775, section 5.4 + * + * + * @pre An 6LoWPAN router (6LR) is running in the network (On RIOT: run + * sixlowpan_nd_hc_6lr() on one of the EUTs before + * sixlowpan_nd_hc02_eut1() or sixlowpan_nd_hc02_eut2() respectively or + * standalone). + * @pre 6LR is configured to use 16-bit short address (On RIOT: + * run sixlowpan_nd_hc_6lr() with flag 6LPPLUGTEST_6LR_FLAG_64BIT unset). + * @pre The PAN's global/16-prefix is stored as context = 0 in the 6LoWPAN + * router's context table. (On RIOT: run sixlowpan_nd_hc_6lr() with + * flag 6LPPLUGTEST_6LR_FLAG_CONTEXT0 set). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd_hc02_eut2(void); + +/** + * @brief Check that EUTs make use of context != 0 in Host-6LR configuration + * (EUI-64); EUT1 behavior. + * + * @see + * RFC 6282, section 3.1.2 + * + * @see + * RFC 6775, section 5.4 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_nd_hc03_eut2()). + * @pre An 6LoWPAN router (6LR) is running in the network (On RIOT: run + * sixlowpan_nd_hc_6lr() on one of the EUTs before + * sixlowpan_nd_hc03_eut1() or sixlowpan_nd_hc03_eut2() respectively or + * standalone). + * @pre 6LR is configured to use EUI-64 (On RIOT: run sixlowpan_nd_hc_6lr() + * with flag 6LPPLUGTEST_6LR_FLAG_64BIT set). + * @pre The PAN's global/64-prefix is stored as context != 0 in the 6LoWPAN + * router's context table. (On RIOT: run sixlowpan_nd_hc_6lr() with + * flag 6LPPLUGTEST_6LR_FLAG_CONTEXT0 unset). + * + * @param[in] eut2_addr IPv6 global/64-prefixed address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd_hc03_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs make use of context != 0 in Host-6LR configuration + * (EUI-64); EUT2 behavior. + * + * @see + * RFC 6282, section 3.1.2 + * + * @see + * RFC 6775, section 5.4 + * + * + * @pre An 6LoWPAN router (6LR) is running in the network (On RIOT: run + * sixlowpan_nd_hc_6lr() on one of the EUTs before + * sixlowpan_nd_hc03_eut1() or sixlowpan_nd_hc03_eut2() respectively or + * standalone). + * @pre 6LR is configured to use EUI-64 (On RIOT: run sixlowpan_nd_hc_6lr() + * with flag 6LPPLUGTEST_6LR_FLAG_64BIT set). + * @pre The PAN's global/64-prefix is stored as context != 0 in the 6LoWPAN + * router's context table. (On RIOT: run sixlowpan_nd_hc_6lr() with + * flag 6LPPLUGTEST_6LR_FLAG_CONTEXT0 unset). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd_hc03_eut2(void); + +/** + * @brief Check that EUTs make use of context != 0 in Host-6LR configuration + * (16-bit); EUT1 behavior. + * + * @see + * RFC 6282, section 3.1.2 + * + * @see + * RFC 6775, section 5.4 + * + * + * @pre EUT2 is configured to react to this test (On RIOT: run + * sixlowpan_nd_hc04_eut2()). + * @pre An 6LoWPAN router (6LR) is running in the network (On RIOT: run + * sixlowpan_nd_hc_6lr() on one of the EUTs before + * sixlowpan_nd_hc04_eut1() or sixlowpan_nd_hc04_eut2() respectively or + * standalone). + * @pre 6LR is configured to use 16-bit short address (On RIOT: + * run sixlowpan_nd_hc_6lr() with flag 6LPPLUGTEST_6LR_FLAG_64BIT unset). + * @pre The PAN's global/16-prefix is stored as context != 0 in the 6LoWPAN + * router's context table. (On RIOT: run sixlowpan_nd_hc_6lr() with + * flag 6LPPLUGTEST_6LR_FLAG_CONTEXT0 unset). + * + * @param[in] eut2_addr IPv6 global/64-prefixed address of EUT2 in string + * representation. + * @param[in] data Test data to send (min length 4). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd_hc04_eut1(char *eut2_addr, char *data); + +/** + * @brief Check that EUTs make use of context != 0 in Host-6LR configuration + * (16-bit); EUT2 behavior. + * + * @see + * RFC 6282, section 3.1.2 + * + * @see + * RFC 6775, section 5.4 + * + * + * @pre An 6LoWPAN router (6LR) is running in the network (On RIOT: run + * sixlowpan_nd_hc_6lr() on one of the EUTs before + * sixlowpan_nd_hc04_eut1() or sixlowpan_nd_hc04_eut2() respectively or + * standalone). + * @pre 6LR is configured to use 16-bit short address (On RIOT: + * run sixlowpan_nd_hc_6lr() with flag 6LPPLUGTEST_6LR_FLAG_64BIT unset). + * @pre The PAN's global/16-prefix is stored as context != 0 in the 6LoWPAN + * router's context table. (On RIOT: run sixlowpan_nd_hc_6lr() with + * flag 6LPPLUGTEST_6LR_FLAG_CONTEXT0 unset). + * + * @return 1 if test is successful, 0 otherwise + */ +int sixlowpan_nd_hc04_eut2(void); + +#endif /* _6LPPLUGTEST_TEST_ND_HC_H */ diff --git a/6lpplugtest/test_shell.c b/6lpplugtest/test_shell.c new file mode 100644 index 0000000..ea89e52 --- /dev/null +++ b/6lpplugtest/test_shell.c @@ -0,0 +1,782 @@ +#ifdef MODULE_SHELL +#include +#include +#include +#include +#include + +#include "cpu-conf.h" +#include "board_uart0.h" +#include "posix_io.h" +#include "shell.h" +#include "net_if.h" + +#include "test_shell.h" +#include "test_utils.h" +#include "test_format.h" +#include "test_hc.h" +#include "test_nd.h" +#include "test_nd_hc.h" + +uint8_t hexchar_to_decdigit(char c) { + if (c >= '0' && c <= '9') { + return (uint8_t)c - 48; + } + else if (c >= 'A' && c <= 'F') { + return (uint8_t)c - 55; + } + else if (c >= 'a' && c <= 'f') { + return (uint8_t)c - 87; + } else { + return 0xff; + } +} + +uint16_t hexstring_to_short(char *str) { + uint16_t value = 0; + uint8_t count = 0; + + while (*str && count < 4) { + uint8_t tmp = hexchar_to_decdigit(*str); + if (tmp != 0xff) { + value <<= 4; + value += (uint16_t)value; + } + str++; + count++; + } + return value; +} + +void usage(void) +{ + puts("Usage: test {format|hc|nd|nd_hc} []\n"); +} + +void usage_one_param(char *group, int number, char *device) +{ + printf("Usage: test %s %d %s \n", + group, number, device); +} + +void usage_one_param_router(char *group, int number, char *device) +{ + printf("Usage: test %s %d %s \n", + group, number, device); +} + +void usage_opt_router(char *group, int number, char *device) +{ + printf("Usage: test %s %d %s [router ]\n", + group, number, device); +} + + +void usage_param_router_list(char *group, int number, char *device) +{ + printf("Usage: test %s %d %s ...\n", + group, number, device); +} + +void usage_two_param(char *group, int number, char *device) +{ + printf("Usage: test %s %d %s \n", + group, number, device); +} + +void usage_two_param_opt_router(char *group, int number, char *device) +{ + printf("Usage: test %s %d %s [router ] \n", + group, number, device); +} + +void usage_two_param_router(char *group, int number, char *device) +{ + printf("Usage: test %s %d %s \n", + group, number, device); +} + +void usage_three_param_router(char *group, int number, char *device) +{ + printf("Usage: test %s %d %s \n", + group, number, device); +} + +void sixlpplugtest_test(int argc, char **argv) +{ + char *group, *device, *tmp; + int number, i; + + if (argc < 4) { + usage(); + return; + } + + group = argv[1]; + tmp = argv[2]; + device = argv[3]; + + number = atoi(tmp); + + for (i = 0; group[i] != 0; i++) { + group[i] = (char)tolower((int)group[i]); + } + + for (i = 0; device[i] != 0; i++) { + device[i] = (char)tolower((int)device[i]); + } + + if (strcmp(group, "format") == 0) { + switch (number) { + case (1): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format01_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format01_eut2(argv[4], argv[5]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + case (2): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format02_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format02_eut2(argv[4], argv[5]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + case (3): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format03_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format03_eut2(argv[4], argv[5]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + case (4): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format04_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format04_eut2(argv[4], argv[5]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + case (5): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format05_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format05_eut2(argv[4], argv[5]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + case (6): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format06_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format06_eut2(argv[4], argv[5]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + case (7): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format07_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format07_eut2(argv[4], argv[5]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + case (8): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format08_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_format08_eut2(argv[4], argv[5]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + default: + puts(" for group FORMAT must be between 1 and 8.\n"); + return; + } + } + else if (strcmp(group, "hc") == 0) { + switch (number) { + case (1): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_hc01_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 5) { + usage_one_param(group, number, device); + } + sixlowpan_hc01_eut2(argv[4]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + case (2): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_hc02_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 5) { + usage_one_param(group, number, device); + } + sixlowpan_hc02_eut2(argv[4]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + case (3): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_hc03_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 5) { + usage_one_param(group, number, device); + } + sixlowpan_hc03_eut2(argv[4]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + + case (4): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_hc04_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 5) { + usage_one_param(group, number, device); + } + sixlowpan_hc04_eut2(argv[4]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + + case (5): + if (strcmp(device, "6lr") == 0) { + if (argc < 6) { + usage_two_param_router(group, number, device); + } + sixlowpan_hc05_6lr(argv[4], argv[5]); + } + else if (strcmp(device, "host") == 0) { + if (argc < 5) { + usage_one_param(group, number, device); + } + sixlowpan_hc05_host(argv[4]); + } + else { + puts(" must be \"6lr\" or \"host\"\n"); + } + break; + + case (6): + if (strcmp(device, "6lr") == 0) { + if (argc < 6) { + usage_two_param_router(group, number, device); + } + sixlowpan_hc06_6lr(argv[4], argv[5]); + } + else if (strcmp(device, "host") == 0) { + if (argc < 5) { + usage_one_param(group, number, device); + } + sixlowpan_hc06_host(argv[4]); + } + else { + puts(" must be \"6lr\" or \"host\"\n"); + } + break; + + case (7): + if (strcmp(device, "6lr") == 0) { + if (argc < 6) { + usage_two_param_router(group, number, device); + } + sixlowpan_hc07_6lr(argv[4], argv[5]); + } + else if (strcmp(device, "host") == 0) { + if (argc < 5) { + usage_one_param(group, number, device); + } + sixlowpan_hc07_host(argv[4]); + } + else { + puts(" must be \"6lr\" or \"host\"\n"); + } + break; + + case (8): + if (strcmp(device, "6lr") == 0) { + if (argc < 6) { + usage_two_param_router(group, number, device); + } + sixlowpan_hc08_6lr(argv[4], argv[5]); + } + else if (strcmp(device, "host") == 0) { + if (argc < 5) { + usage_one_param(group, number, device); + } + sixlowpan_hc08_host(argv[4]); + } + else { + puts(" must be \"6lr\" or \"host\"\n"); + } + break; + + case (9): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_hc09_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 5) { + usage_one_param(group, number, device); + } + sixlowpan_hc09_eut2(argv[4]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + + case (10): + if (strcmp(device, "eut1") == 0) { + if (argc < 6) { + usage_two_param(group, number, device); + } + sixlowpan_hc10_eut1(argv[4], argv[5]); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 5) { + usage_one_param(group, number, device); + } + sixlowpan_hc10_eut2(argv[4]); + } + else { + puts(" must be \"eut1\" or \"eut2\"\n"); + } + break; + + default: + puts(" for group HC must be between 1 and 10.\n"); + return; + } + } + else if (strcmp(group, "nd") == 0) { + switch (number) { + case (1): + if (strcmp(device, "6lr") == 0) { + if (argc < 7) { + usage_three_param_router(group, number, device); + } + sixlowpan_nd01_6lr(argv[6], argv[4], argv[5]); + } + else if (strcmp(device, "host") == 0) { + sixlowpan_nd01_host(); + } + else { + puts(" must be \"6lr\" or \"host\"\n"); + } + break; + + case (2): + if (strcmp(device, "6lr") == 0) { + if (argc < 7) { + usage_three_param_router(group, number, device); + } + sixlowpan_nd02_6lr(argv[6], argv[4], argv[5]); + } + else if (strcmp(device, "host") == 0) { + sixlowpan_nd02_host(); + } + else { + puts(" must be \"6lr\" or \"host\"\n"); + } + break; + + case (3): + if (strcmp(device, "6lr") == 0) { + sixlowpan_nd03_6lr(); + } + else if (strcmp(device, "host") == 0) { + sixlowpan_nd03_host(); + } + else { + puts(" must be \"6lr\" or \"host\"\n"); + } + break; + + case (4): + if (strcmp(device, "6lr") == 0) { + if (argc < 7) { + usage_three_param_router(group, number, device); + } + sixlowpan_nd04_6lr(argv[6], argv[4], argv[5]); + } + else if (strcmp(device, "host") == 0) { + sixlowpan_nd04_host(); + } + else { + puts(" must be \"6lr\" or \"host\"\n"); + } + break; + + case (5): + if (strcmp(device, "6lr") == 0) { + if (argc < 5) { + usage_one_param_router(group, number, device); + } + sixlowpan_nd05_6lr(argv[4]); + } + else if (strcmp(device, "host") == 0) { + sixlowpan_nd05_host(); + } + else { + puts(" must be \"6lr\" or \"host\"\n"); + } + break; + + case (6): + if (strcmp(device, "6lr") == 0) { + if (argc < 8) { + usage_param_router_list(group, number, device); + } + sixlowpan_nd06_6lr(argc - 6, &argv[6], argv[4], argv[5]); + } + else if (strcmp(device, "host") == 0) { + sixlowpan_nd06_host(); + } + else { + puts(" must be \"6lr\" or \"host\"\n"); + } + break; + + case (7): + if (strcmp(device, "6lr") == 0) { + if (argc < 8) { + usage_param_router_list(group, number, device); + } + sixlowpan_nd07_6lr(argc - 6, &argv[6], argv[4], argv[5]); + } + else if (strcmp(device, "host") == 0) { + sixlowpan_nd07_host(); + } + else { + puts(" must be \"6lr\" or \"host\"\n"); + } + break; + + default: + puts(" for group ND must be between 1 and 7.\n"); + return; + } + } + else if (strcmp(group, "nd_hc") == 0) { + switch (number) { + case (1): + if (strcmp(device, "6lr") == 0) { + if (argc < 5) { + printf("Usage: test %s %d router \n", + group, number); + } + sixlowpan_nd_hc_6lr(argv[4], + SLPT_6LR_FLAG_64BIT | + SLPT_6LR_FLAG_CONTEXT0 | + SLPT_6LR_FLAG_STANDALONE); + } + else if (strcmp(device, "eut1") == 0) { + char *dest, *data; + if (argc < 6) { + usage_two_param_opt_router(group, number, device); + } + if (argc > 7) { + if (strcmp(argv[4], "router") != 0) { + usage_two_param_opt_router(group, number, device); + } + dest = argv[6]; + data = argv[7]; + sixlowpan_nd_hc_6lr(argv[5], + SLPT_6LR_FLAG_64BIT | + SLPT_6LR_FLAG_CONTEXT0); + } + else { + dest = argv[4]; + data = argv[5]; + } + sixlowpan_nd_hc01_eut1(dest, data); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 5) { + usage_opt_router(group, number, device); + } + if (argc > 6) { + if (strcmp(argv[4], "router") != 0) { + usage_two_param_opt_router(group, number, device); + } + sixlowpan_nd_hc_6lr(argv[5], + SLPT_6LR_FLAG_64BIT | + SLPT_6LR_FLAG_CONTEXT0); + } + sixlowpan_nd_hc01_eut2(); + } + else { + puts(" must be \"6lr\", \"eut1\" or \"eut2\"\n"); + } + break; + + case (2): + if (strcmp(device, "6lr") == 0) { + if (argc < 5) { + printf("Usage: test %s %d router \n", + group, number); + } + sixlowpan_nd_hc_6lr(argv[4], + SLPT_6LR_FLAG_CONTEXT0 | + SLPT_6LR_FLAG_STANDALONE); + } + else if (strcmp(device, "eut1") == 0) { + char *dest, *data; + if (argc < 6) { + usage_two_param_opt_router(group, number, device); + } + if (argc > 7) { + if (strcmp(argv[4], "router") != 0) { + usage_two_param_opt_router(group, number, device); + } + dest = argv[6]; + data = argv[7]; + sixlowpan_nd_hc_6lr(argv[5], SLPT_6LR_FLAG_CONTEXT0); + } + else { + dest = argv[4]; + data = argv[5]; + } + sixlowpan_nd_hc02_eut1(dest, data); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 5) { + usage_opt_router(group, number, device); + } + if (argc > 6) { + if (strcmp(argv[4], "router") != 0) { + usage_two_param_opt_router(group, number, device); + } + sixlowpan_nd_hc_6lr(argv[5], SLPT_6LR_FLAG_CONTEXT0); + } + sixlowpan_nd_hc02_eut2(); + } + else { + puts(" must be \"6lr\", \"eut1\" or \"eut2\"\n"); + } + break; + + case (3): + if (strcmp(device, "6lr") == 0) { + if (argc < 5) { + printf("Usage: test %s %d router \n", + group, number); + } + sixlowpan_nd_hc_6lr(argv[4], SLPT_6LR_FLAG_64BIT | + SLPT_6LR_FLAG_STANDALONE); + } + else if (strcmp(device, "eut1") == 0) { + char *dest, *data; + if (argc < 6) { + usage_two_param_opt_router(group, number, device); + } + if (argc > 7) { + if (strcmp(argv[4], "router") != 0) { + usage_two_param_opt_router(group, number, device); + } + dest = argv[6]; + data = argv[7]; + sixlowpan_nd_hc_6lr(argv[5], SLPT_6LR_FLAG_64BIT); + } + else { + dest = argv[4]; + data = argv[5]; + } + sixlowpan_nd_hc03_eut1(dest, data); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 5) { + usage_opt_router(group, number, device); + } + if (argc > 6) { + if (strcmp(argv[4], "router") != 0) { + usage_two_param_opt_router(group, number, device); + } + sixlowpan_nd_hc_6lr(argv[5], SLPT_6LR_FLAG_64BIT); + } + sixlowpan_nd_hc03_eut2(); + } + else { + puts(" must be \"6lr\", \"eut1\" or \"eut2\"\n"); + } + break; + + case (4): + if (strcmp(device, "6lr") == 0) { + if (argc < 5) { + printf("Usage: test %s %d router \n", + group, number); + } + sixlowpan_nd_hc_6lr(argv[4], SLPT_6LR_FLAG_STANDALONE); + } + else if (strcmp(device, "eut1") == 0) { + char *dest, *data; + if (argc < 7) { + usage_two_param_opt_router(group, number, device); + } + if (argc > 6) { + if (strcmp(argv[4], "router") != 0) { + usage_two_param_opt_router(group, number, device); + } + dest = argv[6]; + data = argv[7]; + sixlowpan_nd_hc_6lr(argv[5], 0); + } + else { + dest = argv[4]; + data = argv[5]; + } + sixlowpan_nd_hc04_eut1(dest, data); + } + else if (strcmp(device, "eut2") == 0) { + if (argc < 5) { + usage_opt_router(group, number, device); + } + if (argc > 6) { + if (strcmp(argv[4], "router") != 0) { + usage_two_param_opt_router(group, number, device); + } + sixlowpan_nd_hc_6lr(argv[5], 0); + } + sixlowpan_nd_hc04_eut2(); + } + else { + puts(" must be \"6lr\", \"eut1\" or \"eut2\"\n"); + } + break; + + default: + puts(" for group ND_HC must be between 1 and 4.\n"); + return; + } + } + else { + usage(); + } +} + +const shell_command_t shell_commands[] = { + {"test", "Runs a 6LoWPAN plugtest.\n", + sixlpplugtest_test}, + {NULL, NULL, NULL} +}; + +void sixlpplugtest_shell_init(void) { + posix_open(uart0_handler_pid, 0); + + shell_t shell; + shell_init(&shell, shell_commands, UART0_BUFSIZE, uart0_readc, uart0_putc); + + shell_run(&shell); +} +#else +void sixlpplugtest_empty(void) { + return; +} +#endif diff --git a/6lpplugtest/test_shell.h b/6lpplugtest/test_shell.h new file mode 100644 index 0000000..0c4d2a2 --- /dev/null +++ b/6lpplugtest/test_shell.h @@ -0,0 +1,6 @@ +#ifndef _6LPPLUGTEST_TEST_SHELL_H +#define _6LPPLUGTEST_TEST_SHELL_H + +void sixlpplugtest_shell_init(void); + +#endif /* _6LPPLUGTEST_TEST_SHELL_H */ diff --git a/6lpplugtest/test_utils.c b/6lpplugtest/test_utils.c new file mode 100644 index 0000000..2fc33df --- /dev/null +++ b/6lpplugtest/test_utils.c @@ -0,0 +1,268 @@ +/* + * Copyright (C) 2013-14 Martin Lenders. + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file LICENSE in the top level directory for more + * details. + */ +#include +#include +#include +#include + +#include "ipv6.h" +#include "msg.h" +#include "inet_ntop.h" +#include "inet_pton.h" +#include "net_help.h" +#include "sixlowpan.h" +#include "test_utils.h" +#include "thread.h" + +#define RCV_BUFFER_SIZE (2048) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) + +static uint8_t registered_to_lowpan = 0; +static uint8_t registered_to_ipv6 = 0; +static uint8_t queue_initialized = 0; + +static msg_t msg_q[RCV_BUFFER_SIZE]; + +int slplugtest_utils_isnumber(char *str) +{ + for (; *str; str++) { + if (!isdigit((int)*str)) { + return 0; + } + } + + return 1; +} + +uint8_t slplugtest_utils_hex_to_dec(char c) +{ + if (c >= '0' && c <= '9') { + return (uint8_t)(c - '0'); + } + else if (c >= 'A' && c <= 'F') { + return (uint8_t)(c - 55); + } + else if (c >= 'a' && c <= 'f') { + return (uint8_t)(c - 87); + } + else { + return 0xff; + } +} + +void slplugtest_utils_generate_data(char *data_out, char *data_in, size_t data_len) +{ + char *tmp; + size_t current_len = strlen(data_in); + + memset(data_out, 0, data_len + 1); + + for (tmp = data_out; strlen(data_out) < data_len; tmp += strlen(data_in)) { + size_t cpy_len = (current_len < data_len) ? strlen(data_in) : data_len; + + if (current_len + cpy_len > data_len) { + cpy_len = data_len - current_len; + } + + memcpy(tmp, data_in, cpy_len); + } +} + +void slplugtest_utils_str_to_eui64(net_if_eui64_t *eui64, char *eui64_str) +{ + if (slplugtest_utils_isnumber(eui64_str)) { + eui64->uint64 = HTONLL((uint64_t)atol(eui64_str)); + } + else { + int i; + char *eui64_rev = &eui64_str[strlen(eui64_str) - 1]; + eui64->uint64 = 0; + + for (i = 7; i >= 0 || eui64_rev >= eui64_str; i--) { + uint8_t digit; + + while ((digit = slplugtest_utils_hex_to_dec(*eui64_rev)) == 0xFF) { + if (--eui64_rev < eui64_str) { + goto ret; + } + } + + eui64->uint8[i] = digit; + eui64_rev--; + + while ((digit = slplugtest_utils_hex_to_dec(*eui64_rev)) == 0xFF) { + if (--eui64_rev < eui64_str) { + goto ret; + } + } + + eui64->uint8[i] |= digit << 4; + eui64_rev--; + } + + ret: + return; + } +} + +uint8_t slplugtest_utils_init_eut_addr(ipv6_addr_t *eut_addr, char *eut_addr_str) +{ + int res; + + if (eut_addr_str == NULL) { + ERROR("Destination is not defined.\n"); + } + + res = inet_pton(AF_INET6, eut_addr_str, eut_addr); + + if (res == 0) { + ERROR("Given string is no IPv6 address\n"); + } + + if (res < 0) { + ERROR("Unexpected error in address initialization\n"); + } + + return 1; +} + +uint8_t slplugtest_utils_init_ll_eut_addr(ipv6_addr_t *eut_addr, char *eut_addr_str) +{ + if (!slplugtest_utils_init_eut_addr(eut_addr, eut_addr_str)) { + SILENT_ERROR(); + } + + if (!ipv6_addr_is_link_local(eut_addr)) { + ERROR("Destination is not a link-local address.\n"); + } + + return 1; +} + +uint8_t slplugtest_utils_init_prefix(ipv6_addr_t *prefix, int *prefix_len, + char *prefix_str) +{ + char prefix_str_cpy[IPV6_MAX_ADDR_STR_LEN + 8], *tmp; + + if (!prefix_str) { + return 0; + } + + strcpy(prefix_str_cpy, prefix_str); + tmp = (char *)&prefix_str_cpy[0]; + + for (; *tmp != '/' && *tmp != '\0'; tmp++); + + if (*tmp) { + tmp++; + *(tmp-1) = '\0'; + *prefix_len = atoi(tmp); + } + else { + *prefix_len = 128; + } + + if (!slplugtest_utils_init_eut_addr(prefix, prefix_str_cpy)) { + return 0; + } + + return 1; +} + +void slplugtest_utils_print_bytestream(uint8_t *bytes, uint16_t len) { + for (int i = 0; i < len; i++) { + printf("%02x ", bytes[i]); + if ((i+1) % 20 == 0) { + printf("\n"); + } + } + if (len % 20 != 0) { + printf("\n"); + } +} + +uint8_t slplugtest_utils_initialize_queue(void) +{ + if (queue_initialized) { + return 1; + } + else { + queue_initialized = 1; + return msg_init_queue(msg_q, RCV_BUFFER_SIZE) == 0; + } +} + +uint8_t slplugtest_utils_register_to_lowpan(void) +{ + if (registered_to_lowpan) { + return 1; + } + else { + if (sixlowpan_lowpan_register(thread_getpid()) == 1) { + registered_to_lowpan = 1; + return 1; + } + return 0; + } +} + +uint8_t slplugtest_utils_register_to_ipv6(void) +{ + if (registered_to_ipv6) { + return 1; + } + else { + registered_to_ipv6 = 1; + if (ipv6_register_packet_handler(thread_getpid()) == 1) { + registered_to_ipv6 = 1; + return 1; + } + return 0; + } +} + +uint8_t slplugtest_utils_check_dispatch(sixlowpan_lowpan_frame_t *data, + uint8_t *disp, uint8_t *disp_mask, + uint8_t disp_len) +{ + if (data->length < disp_len) { + return 0; + } + + printf("6LoWPAN dispatch was: "); + slplugtest_utils_print_bytestream(data->data, disp_len); + + for (int i = 0; i < disp_len; i++) { + if ((data->data[i] & disp_mask[i]) != disp[i]) { + return 0; + } + } + return 1; +} + +uint8_t slplugtest_utils_check_sender(ipv6_hdr_t *header, ipv6_addr_t *addr) +{ + char str[41]; + printf("sender was: %s\n", inet_ntop(AF_INET6, addr, str, 41)); + return ipv6_addr_is_equal(&header->srcaddr, addr); +} + +uint8_t slplugtest_utils_check_echo_data(uint8_t *packet, uint8_t *data, + uint8_t data_len) +{ + ipv6_hdr_t *header = (ipv6_hdr_t *)packet; + + if (header->length < 48 + data_len) { + return 0; + } + + printf("echo data was:\n"); + slplugtest_utils_print_bytestream(data, data_len); + + return memcmp(&packet[48], data, data_len) == 0; +} diff --git a/6lpplugtest/test_utils.h b/6lpplugtest/test_utils.h new file mode 100644 index 0000000..40245fc --- /dev/null +++ b/6lpplugtest/test_utils.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2013-14 Martin Lenders. + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file LICENSE in the top level directory for more + * details. + */ + +/** + * @file test_utils.h + * @brief Common 6LoWPAN Plugtest functions. + * @author Martine Lenders + */ +#ifndef _6LPPLUGTEST_TEST_UTILS_H +#define _6LPPLUGTEST_TEST_UTILS_H +#include +#include + +#include "ipv6.h" +#include "sixlowpan.h" + +#define IF_ID (0) + +#define ERROR(...) fprintf(stderr, "ERROR: " __VA_ARGS__); return 0 +#define SILENT_ERROR() return 0 +#define FAILURE(...) printf("FAILURE: "__VA_ARGS__) // ; return 0 +#define SILENT_FAILURE() printf("DEBUG:FAILURE: %s:%d\n", __FILE__, __LINE__) // ; return 0 +#define SUCCESS(...) printf("SUCCESS: "__VA_ARGS__) + +uint8_t slplugtest_utils_initialize_queue(void); +void slplugtest_utils_generate_data(char *data_out, char *data_in, size_t data_len); +uint8_t slplugtest_utils_init_ll_eut_addr(ipv6_addr_t *eut_addr, char *eut_addr_str); +uint8_t slplugtest_utils_init_eut_addr(ipv6_addr_t *eut_addr, char *eut_addr_str); +uint8_t slplugtest_utils_init_prefix(ipv6_addr_t *prefix, int *prefix_len, + char *prefix_str); +uint8_t slplugtest_utils_register_to_lowpan(void); +uint8_t slplugtest_utils_register_to_ipv6(void); +uint8_t slplugtest_utils_check_dispatch(sixlowpan_lowpan_frame_t *data, + uint8_t *disp, uint8_t *disp_mask, + uint8_t disp_len); +uint8_t slplugtest_utils_check_sender(ipv6_hdr_t *header, ipv6_addr_t *addr); +uint8_t slplugtest_utils_check_echo_data(uint8_t *packet, uint8_t *data, + uint8_t data_len); +void slplugtest_utils_str_to_eui64(net_if_eui64_t *eui64, char *eui64_str); +#endif /* _6LPPLUGTEST_TEST_UTILS_H */