File size: 4,138 Bytes
7b6d659 | 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | from queries.process_ue_capability import infer_release, parse_uecap_files, parse_uecap_text
SAMPLE_UECAP_TEXT = """
08:33:50.000 LTE RRC Signaling
{
ueCapabilityInformation
{
ueCapabilityInformation-r8
{
uE-EUTRA-Capability
{
UE-EUTRA-Capability
{
accessStratumRelease
{
rel15
}
rf-Parameters
{
supportedBandListEUTRA
{
SupportedBandEUTRA #1
{
bandEUTRA
{
3
}
}
SupportedBandEUTRA #2
{
bandEUTRA
{
7
}
}
}
}
interRAT-Parameters
{
utraFDD
{
supportedBandListUTRA-FDD
{
SupportedBandUTRA-FDD #1
{
bandI
}
}
}
geran
{
supportedBandListGERAN
{
SupportedBandGERAN #1
{
gsm900E
}
}
}
}
featureGroupIndicators
{
01111111110011111111111010111110
}
nonCriticalExtension
{
rf-Parameters-v1020
{
supportedBandCombination-r10
{
BandCombinationParameters-r10 #1
{
BandParameters-r10 #1
{
bandEUTRA-r10
{
3
}
bandParametersDL-r10
{
CA-MIMO-ParametersDL-r10 #1
{
ca-BandwidthClassDL-r10
{
a
}
}
}
}
BandParameters-r10 #2
{
bandEUTRA-r10
{
7
}
bandParametersDL-r10
{
CA-MIMO-ParametersDL-r10 #1
{
ca-BandwidthClassDL-r10
{
a
}
}
}
}
}
}
}
}
}
}
}
}
}
"""
def test_parse_uecap_extracts_core_sections_and_new_assessments() -> None:
sheets = parse_uecap_text(SAMPLE_UECAP_TEXT, source_name="sample.txt")
assert not sheets["Summary"].empty
assert not sheets["Bands_LTE"].empty
assert not sheets["Bands_UTRA"].empty
assert not sheets["Bands_GERAN"].empty
assert not sheets["CA_Combinations"].empty
assert not sheets["CA_Assessment"].empty
assert not sheets["VoLTE_Assessment"].empty
summary = sheets["Summary"].iloc[0].to_dict()
assert str(summary["release_final"]).startswith("rel")
assert int(summary["lte_band_count"]) > 0
assert "volte_status" in summary
assert "ca_combo_normalized_count" in summary
def test_parse_files_is_stable_for_same_content_and_source() -> None:
content_bytes = SAMPLE_UECAP_TEXT.encode("utf-8")
first = parse_uecap_files([("sample.txt", content_bytes)])
second = parse_uecap_files([("sample.txt", content_bytes)])
first_ue_id = first["Summary"].iloc[0]["ue_id"]
second_ue_id = second["Summary"].iloc[0]["ue_id"]
assert first_ue_id == second_ue_id
def test_infer_release_prefers_explicit_release() -> None:
result = infer_release(
{
"explicit_release": "rel15",
"evidence": ["accessstratumrelease=rel15", "featuregroupindrel10-r10"],
}
)
assert result["explicit_release"] == "rel15"
assert result["final_release"] == "rel15"
assert result["confidence"] == 1.0
|