| 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 |
|
|