diff options
author | David Anderson <dave@natulte.net> | 2019-10-14 21:26:54 -0700 |
---|---|---|
committer | David Anderson <dave@natulte.net> | 2019-10-15 08:36:09 -0700 |
commit | ae02b3dd1f450b51ef69bb13e4c7728106009936 (patch) | |
tree | 838beeb6569eeac852d521eeece377bd2a14451b /nixos/tests/pppd.nix | |
parent | 997a6f6f1eee4f2191bbb73fab08a5765014cd1e (diff) | |
download | nixpkgs-ae02b3dd1f450b51ef69bb13e4c7728106009936.tar nixpkgs-ae02b3dd1f450b51ef69bb13e4c7728106009936.tar.gz nixpkgs-ae02b3dd1f450b51ef69bb13e4c7728106009936.tar.bz2 nixpkgs-ae02b3dd1f450b51ef69bb13e4c7728106009936.tar.lz nixpkgs-ae02b3dd1f450b51ef69bb13e4c7728106009936.tar.xz nixpkgs-ae02b3dd1f450b51ef69bb13e4c7728106009936.tar.zst nixpkgs-ae02b3dd1f450b51ef69bb13e4c7728106009936.zip |
nixos/tests/pppd: init
This test creates a PPPoE link between two machines, and verifies that the machines can ping each other.
Diffstat (limited to 'nixos/tests/pppd.nix')
-rw-r--r-- | nixos/tests/pppd.nix | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/nixos/tests/pppd.nix b/nixos/tests/pppd.nix new file mode 100644 index 00000000000..91f81185909 --- /dev/null +++ b/nixos/tests/pppd.nix @@ -0,0 +1,62 @@ +import ./make-test.nix ( + let + chap-secrets = { + text = ''"flynn" * "reindeerflotilla" *''; + mode = "0640"; + }; + in { + nodes = { + server = {config, pkgs, ...}: { + config = { + # Run a PPPoE access concentrator server. It will spawn an + # appropriate PPP server process when a PPPoE client sets up a + # PPPoE session. + systemd.services.pppoe-server = { + restartTriggers = [ + config.environment.etc."ppp/pppoe-server-options".source + config.environment.etc."ppp/chap-secrets".source + ]; + after = ["network.target"]; + serviceConfig = { + ExecStart = "${pkgs.rpPPPoE}/sbin/pppoe-server -F -O /etc/ppp/pppoe-server-options -q ${pkgs.ppp}/sbin/pppd -I eth1 -L 192.0.2.1 -R 192.0.2.2"; + }; + wantedBy = ["multi-user.target"]; + }; + environment.etc = { + "ppp/pppoe-server-options".text = '' + lcp-echo-interval 10 + lcp-echo-failure 2 + plugin rp-pppoe.so + require-chap + nobsdcomp + noccp + novj + ''; + "ppp/chap-secrets" = chap-secrets; + }; + }; + }; + client = {config, pkgs, ...}: { + services.pppd = { + enable = true; + peers.test = { + config = '' + plugin rp-pppoe.so eth1 + name "flynn" + noipdefault + persist + noauth + debug + ''; + }; + }; + environment.etc."ppp/chap-secrets" = chap-secrets; + }; + }; + + testScript = '' + startAll; + $client->waitUntilSucceeds("ping -c1 -W1 192.0.2.1"); + $server->waitUntilSucceeds("ping -c1 -W1 192.0.2.2"); + ''; + }) |