Skip to content

Commit 4bc638e

Browse files
qarlosalbertocodebot
authored andcommitted
ci: reest test
1 parent aa3ab3a commit 4bc638e

File tree

4 files changed

+160
-2
lines changed

4 files changed

+160
-2
lines changed

.gitlab/ci/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ amari 32UE:
266266
- *retina-needs
267267
parallel:
268268
matrix:
269-
- KEYWORDS: ["attach_detach", "ping", "iperf and udp", "iperf and tcp"]
269+
- KEYWORDS: ["attach_detach", "reestablishment", "ping", "iperf and udp", "iperf and tcp"]
270270

271271
amari 32UE asan:
272272
extends: .zmq

.gitlab/ci/e2e/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SRSGNB_REGISTRY_URI=registry.gitlab.com/softwareradiosystems/srsgnb
22
RETINA_REGISTRY_PREFIX=registry.gitlab.com/softwareradiosystems/ci/retina
3-
RETINA_VERSION=0.42.2
3+
RETINA_VERSION=0.42.3
44
AMARISOFT_VERSION=2023-03-17
55
SRSUE_VERSION=23.11
66
OPEN5GS_VERSION=2.6.1
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#
2+
# Copyright 2021-2024 Software Radio Systems Limited
3+
#
4+
# By using this file, you agree to the terms and conditions set
5+
# forth in the LICENSE file which can be found at the top level of
6+
# the distribution.
7+
#
8+
9+
"""
10+
Ping / Reestablishment Tests
11+
"""
12+
import logging
13+
import time
14+
from typing import Optional, Sequence, Tuple, Union
15+
16+
from pytest import mark
17+
from retina.client.manager import RetinaTestManager
18+
from retina.launcher.artifacts import RetinaTestData
19+
from retina.launcher.utils import configure_artifacts, param
20+
from retina.protocol.fivegc_pb2_grpc import FiveGCStub
21+
from retina.protocol.gnb_pb2_grpc import GNBStub
22+
from retina.protocol.ue_pb2_grpc import UEStub
23+
24+
from .steps.configuration import configure_test_parameters
25+
from .steps.stub import ping_start, ping_wait_until_finish, start_network, stop, ue_reestablishment, ue_start_and_attach
26+
27+
28+
@mark.parametrize(
29+
"band, common_scs, bandwidth, always_download_artifacts",
30+
(
31+
param(3, 15, 50, True, id="band:%s-scs:%s-bandwidth:%s-artifacts:%s"),
32+
param(41, 30, 50, False, id="band:%s-scs:%s-bandwidth:%s-artifacts:%s"),
33+
),
34+
)
35+
@mark.zmq
36+
@mark.flaky(reruns=3, only_rerun=["failed to start"])
37+
# pylint: disable=too-many-arguments
38+
def test_zmq_reestablishment(
39+
retina_manager: RetinaTestManager,
40+
retina_data: RetinaTestData,
41+
ue_32: Tuple[UEStub, ...],
42+
fivegc: FiveGCStub,
43+
gnb: GNBStub,
44+
band: int,
45+
common_scs: int,
46+
bandwidth: int,
47+
always_download_artifacts: bool,
48+
):
49+
"""
50+
ZMQ Attach / reestablishment
51+
"""
52+
53+
test_duration_sec = 15 * 60
54+
reestablishment_interval = 3 # seconds
55+
reestablishment_count = int(test_duration_sec / reestablishment_interval)
56+
57+
_ping_and_reestablishment_multi_ues(
58+
retina_manager=retina_manager,
59+
retina_data=retina_data,
60+
ue_array=ue_32,
61+
gnb=gnb,
62+
fivegc=fivegc,
63+
band=band,
64+
common_scs=common_scs,
65+
bandwidth=bandwidth,
66+
sample_rate=None, # default from testbed
67+
global_timing_advance=0,
68+
time_alignment_calibration=0,
69+
always_download_artifacts=always_download_artifacts,
70+
reestablishment_count=reestablishment_count,
71+
reestablishment_interval=reestablishment_interval,
72+
ping_count=test_duration_sec,
73+
warning_as_errors=True,
74+
)
75+
76+
77+
# pylint: disable=too-many-arguments,too-many-locals
78+
def _ping_and_reestablishment_multi_ues(
79+
retina_manager: RetinaTestManager,
80+
retina_data: RetinaTestData,
81+
ue_array: Sequence[UEStub],
82+
fivegc: FiveGCStub,
83+
gnb: GNBStub,
84+
band: int,
85+
common_scs: int,
86+
bandwidth: int,
87+
sample_rate: Optional[int],
88+
global_timing_advance: int,
89+
time_alignment_calibration: Union[int, str],
90+
always_download_artifacts: bool,
91+
ping_count: int,
92+
warning_as_errors: bool = True,
93+
reestablishment_count: int = 1,
94+
reestablishment_interval: int = 3,
95+
):
96+
logging.info("Reestablishment / Ping Test")
97+
98+
configure_test_parameters(
99+
retina_manager=retina_manager,
100+
retina_data=retina_data,
101+
band=band,
102+
common_scs=common_scs,
103+
bandwidth=bandwidth,
104+
sample_rate=sample_rate,
105+
global_timing_advance=global_timing_advance,
106+
time_alignment_calibration=time_alignment_calibration,
107+
pcap=False,
108+
)
109+
110+
configure_artifacts(
111+
retina_data=retina_data,
112+
always_download_artifacts=always_download_artifacts,
113+
)
114+
115+
start_network(ue_array, gnb, fivegc)
116+
117+
ue_attach_info_dict = ue_start_and_attach(ue_array, gnb, fivegc)
118+
ping_task_array = ping_start(ue_attach_info_dict, fivegc, ping_count)
119+
120+
for _ in range(reestablishment_count):
121+
ue_reestablishment(ue_array)
122+
time.sleep(reestablishment_interval)
123+
124+
ping_wait_until_finish(ping_task_array)
125+
126+
stop(ue_array, gnb, fivegc, retina_data, warning_as_errors=warning_as_errors)

tests/e2e/tests/steps/stub.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ def ping(ue_attach_info_dict: Dict[UEStub, UEAttachedInfo], fivegc: FiveGCStub,
226226
"""
227227
Ping command between an UE and a 5GC
228228
"""
229+
ping_task_array = ping_start(ue_attach_info_dict, fivegc, ping_count, time_step)
230+
ping_wait_until_finish(ping_task_array)
231+
232+
233+
def ping_start(
234+
ue_attach_info_dict: Dict[UEStub, UEAttachedInfo], fivegc: FiveGCStub, ping_count, time_step: int = 1
235+
) -> List[grpc.Future]:
236+
"""
237+
Ping command between an UE and a 5GC
238+
"""
229239

230240
# Launch ping (ue -> 5gc and 5gc -> ue) for each attached ue in parallel
231241

@@ -245,6 +255,13 @@ def ping(ue_attach_info_dict: Dict[UEStub, UEAttachedInfo], fivegc: FiveGCStub,
245255
ping_task_array.append(fivegc_to_ue)
246256
sleep(time_step)
247257

258+
return ping_task_array
259+
260+
261+
def ping_wait_until_finish(ping_task_array: List[grpc.Future]) -> None:
262+
"""
263+
Wait until the requested ping has finished.
264+
"""
248265
ping_success = True
249266
for ping_task in ping_task_array:
250267
ping_success &= ping_task.result().status
@@ -254,6 +271,9 @@ def ping(ue_attach_info_dict: Dict[UEStub, UEAttachedInfo], fivegc: FiveGCStub,
254271

255272

256273
def _print_ping_result(msg: str, result: PingResponse):
274+
"""
275+
Print ping result
276+
"""
257277
log_fn = logging.info
258278
if not result.status:
259279
log_fn = logging.error
@@ -589,6 +609,18 @@ def _stop_stub(
589609
return error_msg
590610

591611

612+
def ue_reestablishment(
613+
ue_array: Sequence[UEStub],
614+
):
615+
"""
616+
Reestablishment an array of UEs from already running gnb and 5gc
617+
"""
618+
for index, ue_stub in enumerate(ue_array):
619+
name = f"UE_{index+1}"
620+
logging.info("Reestablishment %s", name)
621+
ue_stub.Reestablishment(Empty())
622+
623+
592624
def _get_metrics(stub: RanStub, name: str, fail_if_kos: bool = False) -> str:
593625
error_msg = ""
594626

0 commit comments

Comments
 (0)