tests: use config.networking.hosts not networking.extraHosts
The latter is an opaque string but IP addresses can be extracted by hostname from the former.
This commit is contained in:
parent
80c7fbba10
commit
257696260c
|
@ -91,15 +91,14 @@ rec {
|
||||||
# interfaces, use the IP address corresponding to
|
# interfaces, use the IP address corresponding to
|
||||||
# the first interface (i.e. the first network in its
|
# the first interface (i.e. the first network in its
|
||||||
# virtualisation.vlans option).
|
# virtualisation.vlans option).
|
||||||
networking.extraHosts = flip concatMapStrings machines (m':
|
networking.hosts = mapAttrs' (name: machine:
|
||||||
let config = (getAttr m' nodes).config;
|
let config = machine.config;
|
||||||
in optionalString (config.networking.primaryIPAddress != "")
|
in {
|
||||||
("${config.networking.primaryIPAddress} "
|
name = config.networking.primaryIPAddress;
|
||||||
+ optionalString (config.networking.domain != null)
|
value = optional (config.networking.domain != null)
|
||||||
"${config.networking.hostName}.${config.networking.domain} "
|
"${config.networking.hostName}.${config.networking.domain}"
|
||||||
+ ''
|
++ [ config.networking.hostName ];
|
||||||
${config.networking.hostName}
|
}) nodes;
|
||||||
''));
|
|
||||||
|
|
||||||
virtualisation.qemu.options = forEach interfacesNumbered
|
virtualisation.qemu.options = forEach interfacesNumbered
|
||||||
({ fst, snd }: qemuNICFlags snd fst m.snd);
|
({ fst, snd }: qemuNICFlags snd fst m.snd);
|
||||||
|
|
|
@ -4,13 +4,17 @@
|
||||||
|
|
||||||
a = { pkgs, ... }: { imports = [ ../nixos-modules/hardware.nix ]; };
|
a = { pkgs, ... }: { imports = [ ../nixos-modules/hardware.nix ]; };
|
||||||
|
|
||||||
b = { config, pkgs, ... }: {
|
b = { config, pkgs, lib, ... }: {
|
||||||
imports = [ ../nixos-modules/hardware.nix ];
|
imports = [ ../nixos-modules/hardware.nix ];
|
||||||
networking.interfaces.eth1.genode.stack = null;
|
networking.interfaces.eth1.genode.stack = null;
|
||||||
genode.init.children.ping = {
|
genode.init.children.ping = {
|
||||||
inputs = with pkgs.genodePackages; [ ping ];
|
inputs = with pkgs.genodePackages; [ ping ];
|
||||||
configFile = let
|
configFile = let
|
||||||
ip = builtins.head config.networking.interfaces.eth1.ipv4.addresses;
|
ipA = builtins.head config.networking.interfaces.eth1.ipv4.addresses;
|
||||||
|
ipAddrB = with builtins;
|
||||||
|
head (attrNames
|
||||||
|
(lib.attrsets.filterAttrs (name: (any (host: host == "a")))
|
||||||
|
config.networking.hosts));
|
||||||
in pkgs.writeText "ping.dhall" ''
|
in pkgs.writeText "ping.dhall" ''
|
||||||
let Genode = env:DHALL_GENODE
|
let Genode = env:DHALL_GENODE
|
||||||
|
|
||||||
|
@ -25,8 +29,10 @@
|
||||||
, routes = [ Init.ServiceRoute.child "Nic" "eth1.driver" ]
|
, routes = [ Init.ServiceRoute.child "Nic" "eth1.driver" ]
|
||||||
, config = Init.Config::{
|
, config = Init.Config::{
|
||||||
, attributes = toMap
|
, attributes = toMap
|
||||||
{ interface = "${ip.address}/${toString ip.prefixLength}"
|
{ interface = "${ipA.address}/${
|
||||||
, dst_ip = "192.168.1.1"
|
toString ipA.prefixLength
|
||||||
|
}"
|
||||||
|
, dst_ip = "${ipAddrB}"
|
||||||
, period_sec = "1"
|
, period_sec = "1"
|
||||||
, count = "10"
|
, count = "10"
|
||||||
, verbose = "yes"
|
, verbose = "yes"
|
||||||
|
|
Loading…
Reference in New Issue