summaryrefslogtreecommitdiff
path: root/tests/accel-pppd/pppoe/test_pppoe_disc.py
blob: eb069c42cda7e08e0fc40be006028ba3ba523a6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import pytest
from common import netns


@pytest.fixture()
def accel_pppd_config(veth_pair_netns):
    print(veth_pair_netns)
    return (
        """
    [modules]
    pppoe

    [log]
    log-debug=/dev/stdout
    level=5

    [cli]
    tcp=127.0.0.1:2001

    [pppoe]
    ac-name=test-accel
    interface="""
        + veth_pair_netns["veth_a"]
    )


# test pppoe discovery
def test_pppoe_discovery(accel_pppd_instance, veth_pair_netns):

    # test that accel-pppd started successfully
    assert accel_pppd_instance

    (exit_sh_stat, out_sh_stat, err_sh_stat) = netns.exec(
        veth_pair_netns["netns"], ["pppoe-discovery", "-I", veth_pair_netns["veth_b"]]
    )

    # test that ac-name=test-accel is in pppoe-discovery reply (PADO)
    assert (
        exit_sh_stat == 0
        and err_sh_stat == ""
        and "test-accel" in out_sh_stat
    )