Skip to content

Commit b885f90

Browse files
FabianEckermanncodebot
authored andcommitted
ci: move mobility helper to stub
1 parent 04b79a5 commit b885f90

File tree

3 files changed

+168
-157
lines changed

3 files changed

+168
-157
lines changed

tests/e2e/tests/handover.py

Lines changed: 3 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
from .steps.configuration import configure_test_parameters
3030
from .steps.kpis import get_kpis
3131
from .steps.stub import (
32-
iperf_start,
33-
iperf_wait_until_finish,
32+
multi_ue_mobility_iperf,
3433
ping_start,
3534
ping_wait_until_finish,
3635
start_network,
@@ -493,7 +492,7 @@ def test_zmq_handover_iperf(
493492
ZMQ Handover iperf test
494493
"""
495494

496-
with _handover_multi_ues_iperf(
495+
with multi_ue_mobility_iperf(
497496
retina_manager=retina_manager,
498497
retina_data=retina_data,
499498
ue_array=[ue],
@@ -568,7 +567,7 @@ def test_zmq_handover_noise(
568567
ZMQ Handover noise test
569568
"""
570569

571-
with _handover_multi_ues_iperf(
570+
with multi_ue_mobility_iperf(
572571
retina_manager=retina_manager,
573572
retina_data=retina_data,
574573
ue_array=[ue],
@@ -609,156 +608,6 @@ def test_zmq_handover_noise(
609608
)
610609

611610

612-
# pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-locals
613-
@contextmanager
614-
def _handover_multi_ues_iperf(
615-
*, # This enforces keyword-only arguments
616-
retina_manager: RetinaTestManager,
617-
retina_data: RetinaTestData,
618-
ue_array: Sequence[UEStub],
619-
fivegc: FiveGCStub,
620-
gnb_array: Sequence[GNBStub],
621-
metrics_summary: Optional[MetricsSummary],
622-
band: int,
623-
common_scs: int,
624-
bandwidth: int,
625-
bitrate: int,
626-
protocol: IPerfProto,
627-
direction: IPerfDir,
628-
sample_rate: Optional[int],
629-
global_timing_advance: int,
630-
time_alignment_calibration: Union[int, str],
631-
always_download_artifacts: bool,
632-
noise_spd: int,
633-
warning_as_errors: bool = True,
634-
movement_steps: int = 10,
635-
sleep_between_movement_steps: int = 2,
636-
cell_position_offset: Tuple[float, float, float] = (1000, 0, 0),
637-
allow_failure: bool = False,
638-
) -> Generator[
639-
Tuple[
640-
Dict[UEStub, UEAttachedInfo],
641-
Tuple[Tuple[Tuple[float, float, float], Tuple[float, float, float], int, int], ...],
642-
int,
643-
],
644-
None,
645-
None,
646-
]:
647-
logging.info("Handover Test (iPerf%s)", ", allowing failure)" if allow_failure else "")
648-
649-
original_position = (0, 0, 0)
650-
651-
configure_test_parameters(
652-
retina_manager=retina_manager,
653-
retina_data=retina_data,
654-
band=band,
655-
common_scs=common_scs,
656-
bandwidth=bandwidth,
657-
sample_rate=sample_rate,
658-
global_timing_advance=global_timing_advance,
659-
time_alignment_calibration=time_alignment_calibration,
660-
noise_spd=noise_spd,
661-
num_cells=2,
662-
cell_position_offset=cell_position_offset,
663-
log_ip_level="debug",
664-
warning_allowlist=[
665-
"MAC max KOs reached",
666-
"Reached maximum number of RETX",
667-
"UL buffering timed out",
668-
'RRC Setup Procedure" timed out',
669-
'RRC Reconfiguration Procedure" timed out',
670-
'Intra CU Handover Target Routine" failed',
671-
"RRC reconfiguration failed",
672-
"Some or all PDUSessionResourceSetupItems failed to setup",
673-
"UL buffering timed out",
674-
"Discarding SDU",
675-
"Discarding PDU",
676-
"PDCP unpacking did not provide any SDU",
677-
"Could not allocate Paging's DCI in PDCCH",
678-
],
679-
)
680-
681-
configure_artifacts(
682-
retina_data=retina_data,
683-
always_download_artifacts=always_download_artifacts,
684-
)
685-
686-
start_network(
687-
ue_array=ue_array,
688-
gnb_array=gnb_array,
689-
fivegc=fivegc,
690-
gnb_post_cmd=("log --cu_level=debug --hex_max_size=32", "log --mac_level=debug"),
691-
)
692-
693-
ue_attach_info_dict = ue_start_and_attach(
694-
ue_array=ue_array,
695-
du_definition=[gnb.GetDefinition(UInt32Value(value=idx)) for idx, gnb in enumerate(gnb_array)],
696-
fivegc=fivegc,
697-
)
698-
699-
try:
700-
# HO while iPerf
701-
movement_duration = (movement_steps + 1) * sleep_between_movement_steps
702-
movements: Tuple[Tuple[Tuple[float, float, float], Tuple[float, float, float], int, int], ...] = (
703-
(original_position, cell_position_offset, movement_steps, sleep_between_movement_steps),
704-
(cell_position_offset, original_position, movement_steps, sleep_between_movement_steps),
705-
(original_position, cell_position_offset, movement_steps, sleep_between_movement_steps),
706-
(cell_position_offset, original_position, movement_steps, sleep_between_movement_steps),
707-
)
708-
traffic_seconds = (len(movements) * movement_duration) + len(ue_array)
709-
710-
# Starting iperf in the UEs
711-
iperf_array = []
712-
for ue_stub in ue_array:
713-
iperf_array.append(
714-
(
715-
ue_attach_info_dict[ue_stub],
716-
*iperf_start(
717-
ue_stub=ue_stub,
718-
ue_attached_info=ue_attach_info_dict[ue_stub],
719-
fivegc=fivegc,
720-
protocol=protocol,
721-
direction=direction,
722-
duration=traffic_seconds,
723-
bitrate=bitrate,
724-
),
725-
)
726-
)
727-
728-
yield ue_attach_info_dict, movements, traffic_seconds
729-
730-
# Stop and validate iperfs.
731-
if allow_failure:
732-
# The BITRATE_THRESHOLD is reduced because of noise and possible handover failures
733-
bitrate_threshold = BITRATE_THRESHOLD * 0.05
734-
else:
735-
bitrate_threshold = BITRATE_THRESHOLD
736-
737-
for ue_attached_info, task, iperf_request in iperf_array:
738-
iperf_wait_until_finish(
739-
ue_attached_info=ue_attached_info,
740-
fivegc=fivegc,
741-
task=task,
742-
iperf_request=iperf_request,
743-
bitrate_threshold_ratio=bitrate_threshold,
744-
)
745-
746-
if not allow_failure:
747-
for ue_stub in ue_array:
748-
ue_validate_no_reattaches(ue_stub)
749-
750-
stop(
751-
ue_array=ue_array,
752-
gnb_array=gnb_array,
753-
fivegc=fivegc,
754-
retina_data=retina_data,
755-
ue_stop_timeout=16,
756-
warning_as_errors=warning_as_errors,
757-
)
758-
finally:
759-
get_kpis(du_or_gnb_array=gnb_array, ue_array=ue_array, metrics_summary=metrics_summary)
760-
761-
762611
def _do_ho(
763612
*, # This enforces keyword-only arguments
764613
ue_array: Tuple[UEStub, ...],

tests/e2e/tests/inter_cu_handover.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
from retina.protocol.ue_pb2 import IPerfDir, IPerfProto
2222
from retina.protocol.ue_pb2_grpc import UEStub
2323

24-
from .handover import _do_ho, _handover_multi_ues_iperf, _handover_sequentially
24+
from .handover import _do_ho, _handover_sequentially
25+
from .steps.stub import multi_ue_mobility_iperf
2526

2627
HIGH_BITRATE = int(15e6)
2728

@@ -102,7 +103,7 @@ def test_zmq_handover_iperf(
102103
ZMQ Handover iperf test
103104
"""
104105

105-
with _handover_multi_ues_iperf(
106+
with multi_ue_mobility_iperf(
106107
retina_manager=retina_manager,
107108
retina_data=retina_data,
108109
ue_array=[ue],

tests/e2e/tests/steps/stub.py

Lines changed: 162 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from concurrent.futures import as_completed, ThreadPoolExecutor
1414
from contextlib import contextmanager, suppress
1515
from time import sleep, time
16-
from typing import Dict, Generator, List, Optional, Sequence, Tuple
16+
from typing import Dict, Generator, List, Optional, Sequence, Tuple, Union
1717

1818
import grpc
1919
import pytest
@@ -22,7 +22,10 @@
2222
from google.protobuf.text_format import MessageToString
2323
from google.protobuf.wrappers_pb2 import StringValue, UInt32Value
2424
from retina.client.exception import ErrorReportedByAgent
25+
from retina.client.manager import RetinaTestManager
2526
from retina.launcher.artifacts import RetinaTestData
27+
from retina.launcher.public import MetricsSummary
28+
from retina.launcher.utils import configure_artifacts
2629
from retina.protocol import RanStub
2730
from retina.protocol.base_pb2 import (
2831
ChannelEmulatorType,
@@ -57,6 +60,10 @@
5760
)
5861
from retina.protocol.ue_pb2_grpc import UEStub
5962

63+
from .configuration import configure_test_parameters
64+
from .kpis import get_kpis
65+
66+
BITRATE_THRESHOLD: float = 0.1
6067
RF_MAX_TIMEOUT: int = 5 * 60 # Time enough in RF when loading a new image in the sdr
6168
UE_STARTUP_TIMEOUT: int = RF_MAX_TIMEOUT
6269
GNB_STARTUP_TIMEOUT: int = 2 # GNB delay (we wait x seconds and check it's still alive). UE later and has a big timeout
@@ -856,6 +863,160 @@ def ue_move(
856863
logging.info("UE [%s] moved to position %s, %s, %s", id(ue_stub), x_coordinate, y_coordinate, z_coordinate)
857864

858865

866+
# pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-locals
867+
@contextmanager
868+
def multi_ue_mobility_iperf(
869+
*, # This enforces keyword-only arguments
870+
retina_manager: RetinaTestManager,
871+
retina_data: RetinaTestData,
872+
ue_array: Sequence[UEStub],
873+
fivegc: FiveGCStub,
874+
gnb_array: Sequence[GNBStub],
875+
metrics_summary: Optional[MetricsSummary],
876+
band: int,
877+
common_scs: int,
878+
bandwidth: int,
879+
bitrate: int,
880+
protocol: IPerfProto,
881+
direction: IPerfDir,
882+
sample_rate: Optional[int],
883+
global_timing_advance: int,
884+
time_alignment_calibration: Union[int, str],
885+
always_download_artifacts: bool,
886+
noise_spd: int,
887+
warning_as_errors: bool = True,
888+
movement_steps: int = 10,
889+
sleep_between_movement_steps: int = 2,
890+
cell_position_offset: Tuple[float, float, float] = (1000, 0, 0),
891+
allow_failure: bool = False,
892+
) -> Generator[
893+
Tuple[
894+
Dict[UEStub, UEAttachedInfo],
895+
Tuple[Tuple[Tuple[float, float, float], Tuple[float, float, float], int, int], ...],
896+
int,
897+
],
898+
None,
899+
None,
900+
]:
901+
"""
902+
Do mobility with multiple UEs
903+
"""
904+
905+
logging.info("Mobility Test (iPerf%s)", ", allowing failure)" if allow_failure else "")
906+
907+
original_position = (0, 0, 0)
908+
909+
configure_test_parameters(
910+
retina_manager=retina_manager,
911+
retina_data=retina_data,
912+
band=band,
913+
common_scs=common_scs,
914+
bandwidth=bandwidth,
915+
sample_rate=sample_rate,
916+
global_timing_advance=global_timing_advance,
917+
time_alignment_calibration=time_alignment_calibration,
918+
noise_spd=noise_spd,
919+
num_cells=2,
920+
cell_position_offset=cell_position_offset,
921+
log_ip_level="debug",
922+
warning_allowlist=[
923+
"MAC max KOs reached",
924+
"Reached maximum number of RETX",
925+
"UL buffering timed out",
926+
'RRC Setup Procedure" timed out',
927+
'RRC Reconfiguration Procedure" timed out',
928+
'Intra CU Handover Target Routine" failed',
929+
"RRC reconfiguration failed",
930+
"Some or all PDUSessionResourceSetupItems failed to setup",
931+
"UL buffering timed out",
932+
"Discarding SDU",
933+
"Discarding PDU",
934+
"PDCP unpacking did not provide any SDU",
935+
"Could not allocate Paging's DCI in PDCCH",
936+
],
937+
)
938+
939+
configure_artifacts(
940+
retina_data=retina_data,
941+
always_download_artifacts=always_download_artifacts,
942+
)
943+
944+
start_network(
945+
ue_array=ue_array,
946+
gnb_array=gnb_array,
947+
fivegc=fivegc,
948+
gnb_post_cmd=("log --cu_level=debug --hex_max_size=32", "log --mac_level=debug"),
949+
)
950+
951+
ue_attach_info_dict = ue_start_and_attach(
952+
ue_array=ue_array,
953+
du_definition=[gnb.GetDefinition(UInt32Value(value=idx)) for idx, gnb in enumerate(gnb_array)],
954+
fivegc=fivegc,
955+
)
956+
957+
try:
958+
# HO while iPerf
959+
movement_duration = (movement_steps + 1) * sleep_between_movement_steps
960+
movements: Tuple[Tuple[Tuple[float, float, float], Tuple[float, float, float], int, int], ...] = (
961+
(original_position, cell_position_offset, movement_steps, sleep_between_movement_steps),
962+
(cell_position_offset, original_position, movement_steps, sleep_between_movement_steps),
963+
(original_position, cell_position_offset, movement_steps, sleep_between_movement_steps),
964+
(cell_position_offset, original_position, movement_steps, sleep_between_movement_steps),
965+
)
966+
traffic_seconds = (len(movements) * movement_duration) + len(ue_array)
967+
968+
# Starting iperf in the UEs
969+
iperf_array = []
970+
for ue_stub in ue_array:
971+
iperf_array.append(
972+
(
973+
ue_attach_info_dict[ue_stub],
974+
*iperf_start(
975+
ue_stub=ue_stub,
976+
ue_attached_info=ue_attach_info_dict[ue_stub],
977+
fivegc=fivegc,
978+
protocol=protocol,
979+
direction=direction,
980+
duration=traffic_seconds,
981+
bitrate=bitrate,
982+
),
983+
)
984+
)
985+
986+
yield ue_attach_info_dict, movements, traffic_seconds
987+
988+
# Stop and validate iperfs.
989+
if allow_failure:
990+
# The BITRATE_THRESHOLD is reduced because of noise and possible handover failures
991+
bitrate_threshold = BITRATE_THRESHOLD * 0.05
992+
else:
993+
bitrate_threshold = BITRATE_THRESHOLD
994+
995+
for ue_attached_info, task, iperf_request in iperf_array:
996+
iperf_wait_until_finish(
997+
ue_attached_info=ue_attached_info,
998+
fivegc=fivegc,
999+
task=task,
1000+
iperf_request=iperf_request,
1001+
bitrate_threshold_ratio=bitrate_threshold,
1002+
)
1003+
1004+
if not allow_failure:
1005+
for ue_stub in ue_array:
1006+
ue_validate_no_reattaches(ue_stub)
1007+
1008+
stop(
1009+
ue_array=ue_array,
1010+
gnb_array=gnb_array,
1011+
fivegc=fivegc,
1012+
retina_data=retina_data,
1013+
ue_stop_timeout=16,
1014+
warning_as_errors=warning_as_errors,
1015+
)
1016+
finally:
1017+
get_kpis(du_or_gnb_array=gnb_array, ue_array=ue_array, metrics_summary=metrics_summary)
1018+
1019+
8591020
def ue_expect_handover(*, ue_stub: UEStub, timeout: int) -> grpc.Future: # The "*" enforces keyword-only arguments
8601021
"""
8611022
Creates a future object that will finish when a HO takes places or when the timeout is reached

0 commit comments

Comments
 (0)