2
0
Fork 0
genodepkgs/tests/networking.nix

46 lines
1.3 KiB
Nix

{
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')
'';
}