Skip to content

Commit

Permalink
nixos/tests/pppd: init
Browse files Browse the repository at this point in the history
This test creates a PPPoE link between two machines, and verifies
that the machines can ping each other.
  • Loading branch information
danderson committed Oct 15, 2019
1 parent 997a6f6 commit ae02b3d
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Expand Up @@ -227,6 +227,7 @@ in
postgresql = handleTest ./postgresql.nix {};
postgresql-wal-receiver = handleTest ./postgresql-wal-receiver.nix {};
powerdns = handleTest ./powerdns.nix {};
pppd = handleTest ./pppd.nix {};
predictable-interface-names = handleTest ./predictable-interface-names.nix {};
printing = handleTest ./printing.nix {};
prometheus = handleTest ./prometheus.nix {};
Expand Down
62 changes: 62 additions & 0 deletions 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");
'';
})

0 comments on commit ae02b3d

Please sign in to comment.