These tests exercise Fuchsia's DHCP client abilities when interacting with a Debian DHCP server.
The key pieces to this test are
resources
.dhcp_validity
test, there is a config file for dhcpd and a bash script that runs on the Debian guest. Those need to be included in the resources
section so that netemul can send them to the guest before test program runs.meta
.binaries
.deps
.tests
.tests
needs a name
that points to an empty binary and has an associated component manifest in the meta directory."networks": [ { "endpoints": [ { "name": "client-ep" } ], "name": "net" } ]
This block describes all ethertap networks available to this test.
net
)."children": [ { "name": "dhcp_server", "services": { "fuchsia.net.SocketProvider": "fuchsia-pkg://fuchsia.com/netstack#meta/netstack_debug.cmx", "fuchsia.net.stack.Stack": "fuchsia-pkg://fuchsia.com/netstack#meta/netstack_debug.cmx", "fuchsia.netstack.Netstack": "fuchsia-pkg://fuchsia.com/netstack#meta/netstack_debug.cmx", "fuchsia.posix.socket.Provider": "fuchsia-pkg://fuchsia.com/netstack#meta/netstack_debug.cmx" }, "setup": [ { "arguments": [ "-e", "client-ep" ], "url": "fuchsia-pkg://fuchsia.com/netemul_sandbox#meta/helper_netstack_cfg.cmx" } ], "test": [ { "arguments": [], "url": "fuchsia-pkg://fuchsia.com/netemul_dhcp_tests#meta/dhcp_validity.cmx" } ] } ]
setup
contains all components and their arguments that run before the test. For this test client-ep
, the endpoint connected to net
, is added to the environment so that netstack can interact with the tap network.test
describes the components that constitute the test and any arguments that need to be provided.services
has all services on which setup
and test
rely.name
names the environment that netemul creates."guest": [ { "files": { "data/dhcp_setup.sh": "/root/input/dhcp_setup.sh", "data/dhcpd.conf": "/etc/dhcp/dhcpd.conf" }, "label": "debian_guest", "networks": [ "net" ], "url": "fuchsia-pkg://fuchsia.com/debian_guest#meta/debian_guest.cmx" } ],
files
contains a source to destination mapping for input files that should be transferred to the guest before the test starts.resources
section of the test_package
.label
defines the name of the guest that will be used to look up the guest during the test so that the test can control it.networks
lists the ethertap networks to which the guest will be connected. Currently, the guest may only connect to a single network.url
defines the type of guest VM will be launched for the test. Currently, only Debian guests are supported.The test program configures dhcpd on the Debian guest and then waits for 30 seconds to ensure that netstack gets a DHCP address. dhcpd.conf
and dhcp_setup.sh
are pushed to the guest by netemul before the test runs. The test leverages the GuestDiscoveryService
to get a handle to a GuestInteractionService
that enables the transfer of files and execution of commands on the guest (see the helper library).