diff --git a/modules/network/base/bin/start_module b/modules/network/base/bin/start_module index 6de62f1a5..8e8cb5e4b 100644 --- a/modules/network/base/bin/start_module +++ b/modules/network/base/bin/start_module @@ -29,7 +29,7 @@ useradd $HOST_USER sysctl net.ipv6.conf.all.disable_ipv6=0 sysctl -p -#Read in the config file +# Read in the config file CONF_FILE="/testrun/conf/module_config.json" CONF=`cat $CONF_FILE` @@ -92,8 +92,8 @@ then fi fi -#Small pause to let all core services stabalize +# Small pause to let all core services stabalize sleep 3 -#Start the networking service +# Start the networking service $BIN_DIR/start_network_service $MODULE_NAME $INTF \ No newline at end of file diff --git a/modules/network/dhcp-1/bin/start_network_service b/modules/network/dhcp-1/bin/start_network_service index 82b4c6e33..413c48ceb 100644 --- a/modules/network/dhcp-1/bin/start_network_service +++ b/modules/network/dhcp-1/bin/start_network_service @@ -38,7 +38,6 @@ touch $RA_LOG_FILE chown $HOST_USER $DHCP_LOG_FILE chown $HOST_USER $RA_LOG_FILE - # Move the config files to the correct location cp /testrun/conf/isc-dhcp-server /etc/default/ cp /testrun/conf/dhcpd.conf /etc/dhcp/dhcpd.conf diff --git a/modules/network/dhcp-1/conf/radvd.conf b/modules/network/dhcp-1/conf/radvd.conf index f6d6f30d9..89995785f 100644 --- a/modules/network/dhcp-1/conf/radvd.conf +++ b/modules/network/dhcp-1/conf/radvd.conf @@ -8,5 +8,6 @@ interface veth0 AdvOnLink on; AdvAutonomous on; AdvRouterAddr on; + AdvSourceLLAddress off; }; }; \ No newline at end of file diff --git a/modules/test/conn/conf/module_config.json b/modules/test/conn/conf/module_config.json index 4053b4e26..496b6aada 100644 --- a/modules/test/conn/conf/module_config.json +++ b/modules/test/conn/conf/module_config.json @@ -36,6 +36,16 @@ "name": "connection.target_ping", "description": "The device under test responds to an ICMP echo (ping) request.", "expected_behavior": "The device under test responds to an ICMP echo (ping) request." + }, + { + "name": "connection.ipv6_slaac", + "description": "The device forms a valid IPv6 address as a combination of the IPv6 router prefix and the device interface identifier", + "expected_behavior": "The device under test complies with RFC4862 and forms a valid IPv6 SLAAC address" + }, + { + "name": "connection.ipv6_ping", + "description": "The device responds to an IPv6 ping (ICMPv6 Echo) request to the SLAAC address", + "expected_behavior": "The device responds to the ping as per RFC4443" } ] } diff --git a/modules/test/conn/python/src/connection_module.py b/modules/test/conn/python/src/connection_module.py index b4635ffb8..0b11fde24 100644 --- a/modules/test/conn/python/src/connection_module.py +++ b/modules/test/conn/python/src/connection_module.py @@ -25,6 +25,7 @@ DHCP_SERVER_CAPTURE_FILE = '/runtime/network/dhcp-1.pcap' STARTUP_CAPTURE_FILE = '/runtime/device/startup.pcap' MONITOR_CAPTURE_FILE = '/runtime/device/monitor.pcap' +SLAAC_PREFIX = "fd10:77be:4186" class ConnectionModule(TestModule): @@ -83,6 +84,8 @@ def _connection_dhcp_address(self): LOGGER.info('No DHCP lease found for: ' + self._device_mac) return False, 'No DHCP lease found for: ' + self._device_mac + self._ipv6_addr = None + def _connection_mac_address(self): LOGGER.info('Running connection.mac_address') if self._device_mac is not None: @@ -158,7 +161,43 @@ def _get_oui_manufacturer(self, mac_address): return line[start:].strip() # Extract the company name return None + def _connection_ipv6_slaac(self): + LOGGER.info("Running connection.ipv6_slaac") + packet_capture = rdpcap(MONITOR_CAPTURE_FILE) + + sends_ipv6 = False + + for packet in packet_capture: + if IPv6 in packet and packet.src == self._device_mac: + sends_ipv6 = True + if ICMPv6ND_NS in packet: + ipv6_addr = str(packet[ICMPv6ND_NS].tgt) + if ipv6_addr.startswith(SLAAC_PREFIX): + self._ipv6_addr = ipv6_addr + LOGGER.info(f"Device has formed SLAAC address {ipv6_addr}") + return True + + if sends_ipv6: + LOGGER.info("Device does not support IPv6 SLAAC") + else: + LOGGER.info("Device does not support IPv6") + return False + + def _connection_ipv6_ping(self): + LOGGER.info("Running connection.ipv6_ping") + + if self._ipv6_addr is None: + LOGGER.info("No IPv6 SLAAC address found. Cannot ping") + return + + if self._ping(self._ipv6_addr): + LOGGER.info(f"Device responds to IPv6 ping on {self._ipv6_addr}") + return True + else: + LOGGER.info("Device does not respond to IPv6 ping") + return False + def _ping(self, host): - cmd = 'ping -c 1 ' + str(host) + cmd = "ping -c 1 " + str(host) success = util.run_command(cmd, output=False) return success