blob: 7ebb420a3f205beafc3c26f833ba4bba257a2a35 (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
import pytest
from common import process
import time
@pytest.fixture()
def accel_pppd_config(veth_pair_netns):
print("accel_pppd_config veth_pair_netns: " + str(veth_pair_netns))
return (
"""
[modules]
connlimit
radius
ipoe
ippool
[ip-pool]
gw-ip-address=192.0.2.1
192.0.2.2-255
[cli]
tcp=127.0.0.1:2001
[core]
log-error=/dev/stderr
[log]
log-debug=/dev/stdout
log-file=/dev/stdout
log-emerg=/dev/stderr
level=5
[radius]
[ipoe]
noauth=1
shared=1
gw-ip-address=192.0.2.1/24
interface=re:."""
+ veth_pair_netns["veth_a"][1:]
)
# test dhcpv4 shared session without auth check
@pytest.mark.dependency(depends=["ipoe_driver_loaded"], scope = 'session')
@pytest.mark.ipoe_driver
def test_ipoe_shared_session_wo_auth(dhclient_instance, accel_cmd, veth_pair_netns):
# test that dhclient (with accel-pppd) started successfully
assert dhclient_instance["is_started"]
# wait until session is started
max_wait_time = 10.0
sleep_time = 0.0
is_started = False # is session started
while sleep_time < max_wait_time:
(exit, out, err) = process.run(
[
accel_cmd,
"show sessions called-sid,ip,state",
]
)
assert exit == 0 # accel-cmd fails
# print(out)
if veth_pair_netns["veth_a"] in out and "192.0.2." in out and "active" in out:
# session is found
print(
"test_pppoe_session_wo_auth: session found in (sec): " + str(sleep_time)
)
is_started = True
break
time.sleep(0.1)
sleep_time += 0.1
print("test_ipoe_shared_session_wo_auth: last accel-cmd out: " + out)
# test that session is started
assert is_started == True
|