Verified Commit 32d2f461 authored by Jan Betik's avatar Jan Betik Committed by Karel Koci
Browse files

tests: Added wan-pppoe tests

Added pppoe tests and pppoe container
Be aware that isp-pppoe container requires mounted dev/ppp
parent 987b1333
#!/bin/bash
# nsfarm:isp-common char:/dev/ppp
##################################################################################
# This is simulating ISP with PPPoE setup.
##################################################################################
set -e
wait4network
# DHCP server
apk add busybox-extras busybox-initscripts
# rp-pppoe PPPoE server
apk add rp-pppoe ppp
rc-update add rp-pppoe default
awall enable isp-pppoe
awall activate --force
---
description: ISP PPPoE service
import: isp
zone:
local: { iface: ppp+ }
filter:
- { in: local, out: _fw, service: dhcp, action: accept }
PPPOE_PARAMS="-S Jsem-pryncezna-vole! -N 16 -s -r -u -k -I wan -m 1412 -q /usr/sbin/pppd -Q /usr/sbin/pppoe"
# Secrets for authentication using CHAP
# client server secret IP addresses
turris * "turris" *
omnia * "omnia" *
mox * "mox" *
# Secrets for authentication using PAP
# client server secret IP addresses
turris * "turris" *
omnia * "omnia" *
mox * "mox" *
# PPP options for the PPPoE server
# LIC: GPL
debug
kdebug 6
#require-mppe
#require-mppe-128
#refuse-pap
#refuse-chap
refuse-mschap
#refuse-mschap-v2
require-pap
require-chap
#require-mschap
require-mschap-v2
noproxyarp
idle 0
show-password
#login
#
mtu 1480
mru 1480
#
lcp-echo-interval 5
lcp-echo-failure 8
#
ms-dns 1.1.1.1
ms-dns 8.8.8.8
#
plugin rp-pppoe.so
wan
logfile /var/log/pppoe-server.log
......@@ -66,6 +66,7 @@ class Image:
self._devices.pop(param, None)
else:
raise LXDImageParameterError(self.name, param)
self._wants_internet = self._devices.pop(
"internet", self._parent.wants_internet if isinstance(self._parent, Image) else False)
......
......@@ -2,10 +2,10 @@
This checks if we are able to support various ISP configurations.
"""
import time
import pytest
import nsfarm.lxd
from . import common
import pdb
# pylint: disable=no-self-use
# TODO: add support for IPV6, currently we only test IPv4
......@@ -16,8 +16,8 @@ class TestStatic(common.InternetTests):
"""Test WAN with network settings configured statically.
"""
@pytest.fixture(scope="class", autouse=True)
def client(self, lxd, device_map, client_board):
@pytest.fixture(name="client", scope="class", autouse=True)
def fixture_client(self, lxd, device_map, client_board):
"""Configure WAN to use static IP
"""
print("We are in client fixture once")
......@@ -46,8 +46,8 @@ class TestDHCP(common.InternetTests):
"""Test WAN with network settings provided by DHCP server.
"""
@pytest.fixture(scope="class", autouse=True)
def client(self, lxd, device_map, board, client_board):
@pytest.fixture(name="client", scope="class", autouse=True)
def fixture_client(self, lxd, device_map, client_board):
"""Configure WAN to use DHCP
"""
with nsfarm.lxd.Container(lxd, 'isp-dhcp', device_map) as container:
......@@ -59,3 +59,27 @@ class TestDHCP(common.InternetTests):
yield client_board
client_board.run("uci set network.wan.proto='none'")
client_board.run("uci commit network")
@pytest.mark.debug
class TestPPPoE(common.InternetTests):
"""Test of PPPoE
"""
@pytest.fixture(name="client", scope="class", autouse=True)
def fixture_client(self, lxd, device_map, client_board):
with nsfarm.lxd.Container(lxd, 'isp-pppoe', device_map) as container:
client_board.run("uci set network.wan.proto='pppoe'")
client_board.run("uci set network.wan.username='turris'")
client_board.run("uci set network.wan.password='turris'")
client_board.run("uci del network.wan.auto", None)
client_board.run("uci commit network")
client_board.run('/etc/init.d/network restart')
client_board.run('while ! ping -c1 -w1 172.16.1.1 >/dev/null; do true; done')
yield client_board
commands = ["uci set network.wan.proto='none'",
"uci del network.wan.username",
"uci del network.wan.password",
"uci set network.wan.auto='1'",
"uci commit network"]
client_board.run(" && ".join(commands))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment