Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions modules/network/base/bin/start_module
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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
1 change: 0 additions & 1 deletion modules/network/dhcp-1/bin/start_network_service
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions modules/network/dhcp-1/conf/radvd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ interface veth0
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr on;
AdvSourceLLAddress off;
};
};
10 changes: 10 additions & 0 deletions modules/test/conn/conf/module_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
Expand Down
41 changes: 40 additions & 1 deletion modules/test/conn/python/src/connection_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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