tests: add simple networking test
Just a test that pings one machine from another.llvm-11
parent
7822090e58
commit
1dad7fa174
@ -0,0 +1,45 @@
|
||||
{
|
||||
name = "networking";
|
||||
nodes = {
|
||||
|
||||
a = { pkgs, ... }: { imports = [ ../nixos-modules/hardware.nix ]; };
|
||||
|
||||
b = { config, pkgs, ... }: {
|
||||
imports = [ ../nixos-modules/hardware.nix ];
|
||||
networking.interfaces.eth1.genode.stack = null;
|
||||
genode.init.children.ping = {
|
||||
inputs = with pkgs.genodePackages; [ ping ];
|
||||
configFile = let
|
||||
ip = builtins.head config.networking.interfaces.eth1.ipv4.addresses;
|
||||
in pkgs.writeText "ping.dhall" ''
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
||||
let Init = Genode.Init
|
||||
|
||||
let Child = Init.Child
|
||||
|
||||
in Child.flat
|
||||
Child.Attributes::{
|
||||
, binary = "ping"
|
||||
, resources = Init.Resources::{ ram = Genode.units.MiB 8 }
|
||||
, routes = [ Init.ServiceRoute.child "Nic" "eth1.driver" ]
|
||||
, config = Init.Config::{
|
||||
, attributes = toMap
|
||||
{ interface = "${ip.address}/${toString ip.prefixLength}"
|
||||
, dst_ip = "192.168.1.1"
|
||||
, period_sec = "1"
|
||||
, count = "10"
|
||||
, verbose = "yes"
|
||||
}
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
testScript = ''
|
||||
start_all()
|
||||
b.wait_until_serial_output('child "ping" exited with exit value 0')
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue