test_net

Note: This test relies on boardenv_* containing configuration values to define which network environment is available for testing. Without this, this test will be automatically skipped.

For example:

# Boolean indicating whether the Ethernet device is attached to USB, and hence
# USB enumeration needs to be performed prior to network tests.
# This variable may be omitted if its value is False.
env__net_uses_usb = False

# Boolean indicating whether the Ethernet device is attached to PCI, and hence
# PCI enumeration needs to be performed prior to network tests.
# This variable may be omitted if its value is False.
env__net_uses_pci = True

# True if a DHCP server is attached to the network, and should be tested.
# If DHCP testing is not possible or desired, this variable may be omitted or
# set to False.
env__net_dhcp_server = True

# False or omitted if a DHCP server is attached to the network, and dhcp abort
# case should be tested.
# If DHCP abort testing is not possible or desired, set this variable to True.
# For example: On some setup, dhcp is too fast and this case may not work.
env__dhcp_abort_test_skip = True

# True if a DHCPv6 server is attached to the network, and should be tested.
# If DHCPv6 testing is not possible or desired, this variable may be omitted or
# set to False.
env__net_dhcp6_server = True

# A list of environment variables that should be set in order to configure a
# static IP. If solely relying on DHCP, this variable may be omitted or set to
# an empty list.
env__net_static_env_vars = [
    ('ipaddr', '10.0.0.100'),
    ('netmask', '255.255.255.0'),
    ('serverip', '10.0.0.1'),
]

# Details regarding a file that may be read from a TFTP server. This variable
# may be omitted or set to None if TFTP testing is not possible or desired.
env__net_tftp_readable_file = {
    'fn': 'ubtest-readable.bin',
    'addr': 0x10000000,
    'size': 5058624,
    'crc32': 'c2244b26',
    'timeout': 50000,
    'fnu': 'ubtest-upload.bin',
}

# Details regarding a file that may be read from a NFS server. This variable
# may be omitted or set to None if NFS testing is not possible or desired.
env__net_nfs_readable_file = {
    'fn': 'ubtest-readable.bin',
    'addr': 0x10000000,
    'size': 5058624,
    'crc32': 'c2244b26',
}

# Details regarding a file that may be read from a TFTP server. This variable
# may be omitted or set to None if PXE testing is not possible or desired.
env__net_pxe_readable_file = {
    'fn': 'default',
    'addr': 0x2000000,
    'size': 74,
    'timeout': 50000,
    'pattern': 'Linux',
}

# True if a router advertisement service is connected to the network, and should
# be tested. If router advertisement testing is not possible or desired, this
variable may be omitted or set to False.
env__router_on_net = True
test_net.test_net_pre_commands(ubman)

Execute any commands required to enable network hardware.

These commands are provided by the boardenv_* file; see the comment at the beginning of this file.

test_net.test_net_dhcp(ubman)

Test the dhcp command.

The boardenv_* file may be used to enable/disable this test; see the comment at the beginning of this file.

test_net.test_net_dhcp_abort(ubman)

Test the dhcp command by pressing ctrl+c in the middle of dhcp request

The boardenv_* file may be used to enable/disable this test; see the comment at the beginning of this file.

test_net.test_net_dhcp6(ubman)

Test the dhcp6 command.

The boardenv_* file may be used to enable/disable this test; see the comment at the beginning of this file.

test_net.test_net_setup_static(ubman)

Set up a static IP configuration.

The configuration is provided by the boardenv_* file; see the comment at the beginning of this file.

test_net.test_net_ping(ubman)

Test the ping command.

The $serverip (as set up by either test_net_dhcp or test_net_setup_static) is pinged. The test validates that the host is alive, as reported by the ping command’s output.

test_net.test_net_network_discovery(ubman)

Test the network discovery feature of IPv6.

An IPv6 network command (ping6 in this case) is run to make U-Boot send a router solicitation packet, receive a router advertisement message, and parse it. A router advertisement service needs to be running for this test to succeed. U-Boot receives the RA, processes it, and if successful, assigns the gateway IP and prefix length. The configuration is provided by the boardenv_* file; see the comment at the beginning of this file.

test_net.test_net_tftpboot(ubman)

Test the tftpboot command.

A file is downloaded from the TFTP server, its size and optionally its CRC32 are validated.

The details of the file to download are provided by the boardenv_* file; see the comment at the beginning of this file.

test_net.test_net_nfs(ubman)

Test the nfs command.

A file is downloaded from the NFS server, its size and optionally its CRC32 are validated.

The details of the file to download are provided by the boardenv_* file; see the comment at the beginning of this file.

test_net.test_net_pxe_get(ubman)

Test the pxe get command.

A pxe configuration file is downloaded from the TFTP server and interpreted to boot the images mentioned in pxe configuration file.

The details of the file to download are provided by the boardenv_* file; see the comment at the beginning of this file.

test_net.test_net_tftpput(ubman)

Test the tftpput command.

A file is downloaded from the TFTP server and then uploaded to the TFTP server, its size and its CRC32 are validated.

The details of the file to download are provided by the boardenv_* file; see the comment at the beginning of this file.