telcoladder 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. {telcoladder-0.3.0/telcoladder.egg-info → telcoladder-0.4.0}/PKG-INFO +57 -19
  2. {telcoladder-0.3.0 → telcoladder-0.4.0}/README.md +56 -18
  3. {telcoladder-0.3.0 → telcoladder-0.4.0}/pyproject.toml +1 -1
  4. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/__init__.py +1 -1
  5. telcoladder-0.4.0/telcoladder/behavior.py +320 -0
  6. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/callflow.py +44 -0
  7. telcoladder-0.4.0/telcoladder/connections.py +70 -0
  8. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/lanes.py +23 -1
  9. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/nf.py +19 -18
  10. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/procedures.py +67 -1
  11. telcoladder-0.4.0/telcoladder/static/app.css +1 -0
  12. telcoladder-0.4.0/telcoladder/static/app.js +288 -0
  13. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/xdr.py +2 -0
  14. {telcoladder-0.3.0 → telcoladder-0.4.0/telcoladder.egg-info}/PKG-INFO +57 -19
  15. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder.egg-info/SOURCES.txt +5 -0
  16. telcoladder-0.4.0/tests/test_behavior.py +343 -0
  17. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_callflow_api.py +16 -0
  18. telcoladder-0.4.0/tests/test_initiator_side.py +126 -0
  19. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_lanes.py +59 -0
  20. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_nf_ladder.py +1 -0
  21. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_procedures.py +2 -0
  22. telcoladder-0.4.0/tests/test_radio_connections.py +139 -0
  23. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_web_assets.py +4 -0
  24. telcoladder-0.3.0/telcoladder/static/app.css +0 -1
  25. telcoladder-0.3.0/telcoladder/static/app.js +0 -282
  26. {telcoladder-0.3.0 → telcoladder-0.4.0}/LICENSE +0 -0
  27. {telcoladder-0.3.0 → telcoladder-0.4.0}/NOTICE +0 -0
  28. {telcoladder-0.3.0 → telcoladder-0.4.0}/setup.cfg +0 -0
  29. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/__main__.py +0 -0
  30. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/activity.py +0 -0
  31. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/__init__.py +0 -0
  32. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/carrier.py +0 -0
  33. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/diameter.py +0 -0
  34. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/enum.py +0 -0
  35. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/gtp.py +0 -0
  36. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/gtpv2.py +0 -0
  37. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/megaco.py +0 -0
  38. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/nas5gs.py +0 -0
  39. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/naseps.py +0 -0
  40. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/ngap.py +0 -0
  41. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/pfcp.py +0 -0
  42. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/s1ap.py +0 -0
  43. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/sbi.py +0 -0
  44. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/sgsap.py +0 -0
  45. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/adapters/sip.py +0 -0
  46. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/anonymize.py +0 -0
  47. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/calls.py +0 -0
  48. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/causes.py +0 -0
  49. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/chrome.py +0 -0
  50. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/cli.py +0 -0
  51. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/correlate.py +0 -0
  52. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/coverage.py +0 -0
  53. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/diameter_3gpp.yaml +0 -0
  54. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/diameter_base.yaml +0 -0
  55. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/gtpv2.yaml +0 -0
  56. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/megaco_error.yaml +0 -0
  57. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/nas_5gmm.yaml +0 -0
  58. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/nas_5gsm.yaml +0 -0
  59. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/nas_eps_emm.yaml +0 -0
  60. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/nas_eps_esm.yaml +0 -0
  61. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/ngap_misc.yaml +0 -0
  62. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/ngap_nas.yaml +0 -0
  63. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/ngap_protocol.yaml +0 -0
  64. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/ngap_radioNetwork.yaml +0 -0
  65. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/ngap_transport.yaml +0 -0
  66. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/pfcp.yaml +0 -0
  67. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/q850.yaml +0 -0
  68. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/s1ap_misc.yaml +0 -0
  69. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/s1ap_nas.yaml +0 -0
  70. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/s1ap_protocol.yaml +0 -0
  71. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/s1ap_radioNetwork.yaml +0 -0
  72. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/s1ap_transport.yaml +0 -0
  73. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/causes/sip_status.yaml +0 -0
  74. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/data/decode-as.yaml +0 -0
  75. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/decode.py +0 -0
  76. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/decodeas.py +0 -0
  77. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/diameterflows.py +0 -0
  78. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/endpoints.py +0 -0
  79. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/extract.py +0 -0
  80. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/flowtable.py +0 -0
  81. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/framebytes.py +0 -0
  82. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/hpack_huffman.py +0 -0
  83. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/i18n.py +0 -0
  84. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/identities.py +0 -0
  85. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/identity.py +0 -0
  86. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/interfaces.py +0 -0
  87. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/ipsec.py +0 -0
  88. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/lifecycle.py +0 -0
  89. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/mcp.py +0 -0
  90. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/model.py +0 -0
  91. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/nettrace.py +0 -0
  92. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/overview.py +0 -0
  93. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/packets.py +0 -0
  94. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/pdusession.py +0 -0
  95. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/pipeline.py +0 -0
  96. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/plugins.py +0 -0
  97. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/prefilter.py +0 -0
  98. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/probe.py +0 -0
  99. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/render_mermaid.py +0 -0
  100. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/session.py +0 -0
  101. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/slicer.py +0 -0
  102. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/static/theme.js +0 -0
  103. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/summary.py +0 -0
  104. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/timers.py +0 -0
  105. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/translations/__init__.py +0 -0
  106. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/translations/zh_tw.py +0 -0
  107. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/tshark.py +0 -0
  108. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/viewer.py +0 -0
  109. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/web.py +0 -0
  110. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder/wireview.py +0 -0
  111. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder.egg-info/dependency_links.txt +0 -0
  112. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder.egg-info/entry_points.txt +0 -0
  113. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder.egg-info/requires.txt +0 -0
  114. {telcoladder-0.3.0 → telcoladder-0.4.0}/telcoladder.egg-info/top_level.txt +0 -0
  115. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_4g_identity_model.py +0 -0
  116. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_4g_nas_completeness.py +0 -0
  117. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_4g_s_tmsi_and_transactions.py +0 -0
  118. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_4g_scenarios.py +0 -0
  119. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_adapter_diameter.py +0 -0
  120. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_adapter_gtpv2.py +0 -0
  121. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_adapter_megaco.py +0 -0
  122. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_adapter_naseps.py +0 -0
  123. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_adapter_s1ap.py +0 -0
  124. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_adapter_sgsap.py +0 -0
  125. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_adapter_sip.py +0 -0
  126. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_adapters.py +0 -0
  127. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_anonymize.py +0 -0
  128. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_archmap.py +0 -0
  129. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_batch.py +0 -0
  130. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_blast_radius.py +0 -0
  131. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_calls.py +0 -0
  132. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_carrier_polymorphism.py +0 -0
  133. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_causes.py +0 -0
  134. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_cli_encoding.py +0 -0
  135. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_cli_help.py +0 -0
  136. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_cli_summarize.py +0 -0
  137. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_correlate_nf.py +0 -0
  138. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_coverage.py +0 -0
  139. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_coverage_pieces.py +0 -0
  140. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_decode.py +0 -0
  141. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_decodeas.py +0 -0
  142. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_diameter_flow.py +0 -0
  143. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_diameter_redirect.py +0 -0
  144. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_diameter_roles.py +0 -0
  145. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_docs_support_table.py +0 -0
  146. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_e2e_correlation.py +0 -0
  147. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_embedded_supi.py +0 -0
  148. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_extract.py +0 -0
  149. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_failure_scenarios.py +0 -0
  150. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_filter_composition.py +0 -0
  151. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_flow_handle.py +0 -0
  152. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_flows_api.py +0 -0
  153. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_flowtable.py +0 -0
  154. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_frame_filter.py +0 -0
  155. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_frame_time.py +0 -0
  156. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_framebytes.py +0 -0
  157. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_gtp_adapter.py +0 -0
  158. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_i18n.py +0 -0
  159. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_identifier_reuse.py +0 -0
  160. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_identities.py +0 -0
  161. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_index_race.py +0 -0
  162. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_ip_fragments.py +0 -0
  163. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_ipsec.py +0 -0
  164. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_load_progress.py +0 -0
  165. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_mcp.py +0 -0
  166. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_message_abs_ts.py +0 -0
  167. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_min_python.py +0 -0
  168. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_n26_handover.py +0 -0
  169. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_nettrace.py +0 -0
  170. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_no_real_subscriber_data.py +0 -0
  171. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_overview.py +0 -0
  172. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_packaging.py +0 -0
  173. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_packets.py +0 -0
  174. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_pdusession.py +0 -0
  175. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_pfcp_correlation.py +0 -0
  176. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_plugins.py +0 -0
  177. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_prefilter.py +0 -0
  178. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_probe.py +0 -0
  179. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_procedure_labels.py +0 -0
  180. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_procedure_taxonomy.py +0 -0
  181. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_python_baseline.py +0 -0
  182. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_quoted_tunnels.py +0 -0
  183. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_release_attribution.py +0 -0
  184. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_render_mermaid.py +0 -0
  185. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_rrc_containers.py +0 -0
  186. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_sbi_consumer_roles.py +0 -0
  187. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_sbi_late_body.py +0 -0
  188. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_sbi_n1n2_sender.py +0 -0
  189. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_sbi_n2_bridge.py +0 -0
  190. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_sbi_provider_roles.py +0 -0
  191. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_sequence_rules.py +0 -0
  192. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_session_activity.py +0 -0
  193. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_session_decode_params.py +0 -0
  194. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_sip_calls.py +0 -0
  195. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_summary.py +0 -0
  196. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_timers.py +0 -0
  197. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_tmsi_identity.py +0 -0
  198. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_tshark.py +0 -0
  199. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_tshark_prefs.py +0 -0
  200. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_ue_role.py +0 -0
  201. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_ui_readability.py +0 -0
  202. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_user_dlt.py +0 -0
  203. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_validation_gate.py +0 -0
  204. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_viewer_session.py +0 -0
  205. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_volte_e2e_call.py +0 -0
  206. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_volte_e2e_decoding.py +0 -0
  207. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_volte_e2e_identity.py +0 -0
  208. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_web.py +0 -0
  209. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_web_i18n.py +0 -0
  210. {telcoladder-0.3.0 → telcoladder-0.4.0}/tests/test_wireview.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: telcoladder
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Turn telecom signalling captures into Mermaid sequence diagrams — 5G core, 4G/EPC and IMS on one timeline.
5
5
  Author: gollumw
6
6
  License: PolyForm-Noncommercial-1.0.0
@@ -120,9 +120,14 @@ rather than shown as an IP, with the evidence for that name on hover.
120
120
  | A bare cause number and a trip to the spec | 775 causes with the specification named, plain language and field root causes; clauses where a person checked them |
121
121
  | RAN and core blaming each other for a dropped context | Every UE context release marked **requested by the RAN** or **ordered by the core** — a wire fact, not an opinion |
122
122
  | A procedure that stalls for no visible reason | The gap named when it matches a NAS timer's default (T3560, T3460 …), and failures counted by TAC, cell, DNN and core element |
123
+ | VoLTE Gm signalling hidden inside IPsec ESP | NULL-encrypted ESP is detected and decoded, so the SIP and SDP inside join the subscriber's ladder. ESP that is really encrypted stays unreadable and is counted, not guessed |
124
+ | A B2BUA (an AS, or an SBC that keeps the charging ID) changes the Call-ID, so one call shows up as unrelated dialogs | Legs that share a charging ID (ICID) and overlap in time are one call, end to end — H.248, HSS, charging and ENUM attached only where evidence ties them to that call |
123
125
  | Customer captures that must never leave the building | A command on your machine: no network listener beyond `127.0.0.1`, no telemetry, no cloud, no model |
124
126
 
125
- ## Thirty seconds, four ways in
127
+ ## Quickstart: five ways in
128
+
129
+ > **Windows without Python?** Skip `pip` and jump to
130
+ > [4. Windows, no install](#windows-no-install) — the only prerequisite is Wireshark.
126
131
 
127
132
  ```bash
128
133
  # 1. CLI — one page of deterministic facts, Markdown or JSON
@@ -136,6 +141,24 @@ telcoladder serve # http://127.0.0.1:3005
136
141
  claude mcp add telcoladder -- telcoladder mcp
137
142
  ```
138
143
 
144
+ <a id="windows-no-install"></a>
145
+ **4. Windows, no install.** A standalone executable in a portable zip, built by
146
+ CI from the tagged source. Nothing is installed and no registry key is written;
147
+ it needs Wireshark 4.0 or newer on the machine, nothing else.
148
+
149
+ 1. **Download and unzip.** Get `TelcoLadder-Windows-x64.zip` (about 10 MB) from
150
+ the [Releases](https://github.com/gollumw/TelcoLadder/releases) page.
151
+ 2. **Double-click `check-environment.cmd`.** It finds `tshark.exe` in
152
+ Wireshark's default install location under Program Files — or wherever
153
+ `TELCOLADDER_TSHARK` points — and checks the dissectors.
154
+ 3. **Run it from that folder.**
155
+ ```bat
156
+ telcoladder.exe summarize capture.pcapng
157
+ telcoladder.exe serve
158
+ ```
159
+ `serve` listens on `http://127.0.0.1:3005`: open it in your browser, drop a
160
+ capture (up to 1 GB), or paste a path for anything larger.
161
+
139
162
  **5. Hand a capture to someone else.** `telcoladder anonymize in.pcap out.pcap`
140
163
  rewrites subscriber identities, addresses, hostnames, PLMN and cell identifiers
141
164
  into keyed pseudonyms of the *same length* — TBCD, ASCII, JSON and HPACK-Huffman
@@ -146,12 +169,6 @@ Same key, same pseudonyms across captures; the key is printed once and never
146
169
  written down. Compressed HTTP/2 bodies cannot be rewritten in place and are
147
170
  refused unless `--blank-opaque-bodies`.
148
171
 
149
- **4. Windows, no install.** Download `TelcoLadder-Windows-x64.zip` from the
150
- [Releases](https://github.com/gollumw/TelcoLadder/releases) page — a standalone
151
- executable in a portable zip, built by CI from the tagged source. Unzip,
152
- run `check-environment.cmd`, and use `telcoladder.exe` from that folder. It
153
- needs Wireshark 4.0 or newer on the machine, nothing else.
154
-
155
172
  Requires Python 3.11+ and `tshark` (Wireshark 4.0 or newer) for the `pip`
156
173
  route. Neither the macOS nor the Windows installer puts `tshark` on your `PATH`;
157
174
  TelcoLadder looks in the standard install directories and finds it anyway, or
@@ -292,22 +309,43 @@ diagram, Mermaid as the output, and a verified explanation of what went wrong.
292
309
  - **A fully transparent SCP** that sends no `3gpp-Sbi-Target-apiRoot` is
293
310
  indistinguishable from the endpoint and falls back to an unlabelled IP. The
294
311
  correct failure direction, and a real gap.
295
- - **Diameter covers seven interfaces** with roles and curated causes; the rest
296
- decode and show their Application-Id with no role inference. The fixture is
297
- written from RFC 6733, not captured: no SCTP, no reassembly, invented timing.
298
- - **SIP proxies are not yet told apart** (`Via` is recorded, Mw and ISC are
299
- unlabelled); H.248 gets neutral `MGC` / `MGW` roles and no reference point,
312
+ - **Diameter covers seven interfaces** with roles and curated causes (S6a/S6d,
313
+ Cx/Dx, Sh, Rx, Gx, SWx, S6b); the rest — Rf included — decode and show their
314
+ Application-Id with no role inference. Every Diameter fixture is written from
315
+ RFC 6733, not captured: TCP only, no SCTP, invented timing.
316
+ - **Four behavior rules have no capture behind them.** S10 inter-MME handover,
317
+ the Xn/X2 path switch, CS fallback and the Cx authentication delay inside a
318
+ call are written from message names and covered only by synthetic tests; how
319
+ they read a real capture is unmeasured. The chain shown before a failure is the
320
+ order of messages within one segment, not proven causation.
321
+ - **SIP alone does not name the core proxies.** The UE and the P-CSCF come from
322
+ Gm itself — the security-agreement headers, or which address holds IPsec
323
+ associations with several peers, falling back to a `Contact` that carries a
324
+ subscriber identity; an I-CSCF, S-CSCF or AS is named only when its Cx or Sh
325
+ exchange is in the same capture. Gm is the only SIP
326
+ reference point labelled — Mw and ISC are not, because no capture here has
327
+ verified them. H.248 gets neutral `MGC` / `MGW` roles and no reference point,
300
328
  because the protocol alone cannot say whether it is Iq, Mn or Mp.
301
- - **Only 7 of the 21 cause tables cite a clause.** The other 14 name the
329
+ - **Calls and numbers join only on evidence.** B2BUA legs become one call only
330
+ when they share a charging ID (ICID) and overlap in time — a B2BUA or SBC
331
+ that replaces the ICID leaves separate rows. A number joins HSS, charging and
332
+ ENUM records only in international form; a local-form number is never
333
+ completed with a guessed country code. VoLTE, VoNR and VoWiFi are shown only
334
+ where `P-Access-Network-Info` declares them; without that header the access
335
+ is reported as not declared.
336
+ - **Only 9 of the 21 cause tables cite a clause.** The other 12 name the
302
337
  specification and stop. An absent clause is better than a wrong one.
303
338
  - **The 4G, IMS and handover fixtures are written byte by byte** with `tshark`
304
339
  as the oracle: exact about the protocol, silent about any real deployment.
305
- Each `scenario.md` lists what its fixture cannot prove. There is no EPS → 5GS
306
- handover fixture yet, and no UE radio capability parsing.
340
+ Each `scenario.md` lists what its fixture cannot prove. UE radio capability
341
+ is not parsed: the NR and LTE RRC containers are skipped during extraction
342
+ because dissecting them is slow, and stay readable in the per-frame decode
343
+ tree.
307
344
  - **NAS after Security Mode Command is encrypted** and its content is
308
- invisible; the packets still appear as their NGAP carrier. GTP-U joins the
309
- subscriber but carries no throughput or loss KPIs; there is no RTP adapter;
310
- ISUP and CAMEL are recognised but not read.
345
+ invisible; the packets still appear as their NGAP carrier. The same holds for
346
+ IPsec ESP on Gm: only NULL-encrypted ESP is read, and encrypted ESP is counted
347
+ as unreadable. GTP-U joins the subscriber but carries no throughput or loss
348
+ KPIs; there is no RTP adapter; ISUP and CAMEL are recognised but not read.
311
349
  - **Joins through a tunnel an SBI message quotes are inferences.** They bind by
312
350
  direction, inside a time window, never across a release, and never where they
313
351
  would give one flow two SUPIs; the summary counts each one. What remains: a
@@ -88,9 +88,14 @@ rather than shown as an IP, with the evidence for that name on hover.
88
88
  | A bare cause number and a trip to the spec | 775 causes with the specification named, plain language and field root causes; clauses where a person checked them |
89
89
  | RAN and core blaming each other for a dropped context | Every UE context release marked **requested by the RAN** or **ordered by the core** — a wire fact, not an opinion |
90
90
  | A procedure that stalls for no visible reason | The gap named when it matches a NAS timer's default (T3560, T3460 …), and failures counted by TAC, cell, DNN and core element |
91
+ | VoLTE Gm signalling hidden inside IPsec ESP | NULL-encrypted ESP is detected and decoded, so the SIP and SDP inside join the subscriber's ladder. ESP that is really encrypted stays unreadable and is counted, not guessed |
92
+ | A B2BUA (an AS, or an SBC that keeps the charging ID) changes the Call-ID, so one call shows up as unrelated dialogs | Legs that share a charging ID (ICID) and overlap in time are one call, end to end — H.248, HSS, charging and ENUM attached only where evidence ties them to that call |
91
93
  | Customer captures that must never leave the building | A command on your machine: no network listener beyond `127.0.0.1`, no telemetry, no cloud, no model |
92
94
 
93
- ## Thirty seconds, four ways in
95
+ ## Quickstart: five ways in
96
+
97
+ > **Windows without Python?** Skip `pip` and jump to
98
+ > [4. Windows, no install](#windows-no-install) — the only prerequisite is Wireshark.
94
99
 
95
100
  ```bash
96
101
  # 1. CLI — one page of deterministic facts, Markdown or JSON
@@ -104,6 +109,24 @@ telcoladder serve # http://127.0.0.1:3005
104
109
  claude mcp add telcoladder -- telcoladder mcp
105
110
  ```
106
111
 
112
+ <a id="windows-no-install"></a>
113
+ **4. Windows, no install.** A standalone executable in a portable zip, built by
114
+ CI from the tagged source. Nothing is installed and no registry key is written;
115
+ it needs Wireshark 4.0 or newer on the machine, nothing else.
116
+
117
+ 1. **Download and unzip.** Get `TelcoLadder-Windows-x64.zip` (about 10 MB) from
118
+ the [Releases](https://github.com/gollumw/TelcoLadder/releases) page.
119
+ 2. **Double-click `check-environment.cmd`.** It finds `tshark.exe` in
120
+ Wireshark's default install location under Program Files — or wherever
121
+ `TELCOLADDER_TSHARK` points — and checks the dissectors.
122
+ 3. **Run it from that folder.**
123
+ ```bat
124
+ telcoladder.exe summarize capture.pcapng
125
+ telcoladder.exe serve
126
+ ```
127
+ `serve` listens on `http://127.0.0.1:3005`: open it in your browser, drop a
128
+ capture (up to 1 GB), or paste a path for anything larger.
129
+
107
130
  **5. Hand a capture to someone else.** `telcoladder anonymize in.pcap out.pcap`
108
131
  rewrites subscriber identities, addresses, hostnames, PLMN and cell identifiers
109
132
  into keyed pseudonyms of the *same length* — TBCD, ASCII, JSON and HPACK-Huffman
@@ -114,12 +137,6 @@ Same key, same pseudonyms across captures; the key is printed once and never
114
137
  written down. Compressed HTTP/2 bodies cannot be rewritten in place and are
115
138
  refused unless `--blank-opaque-bodies`.
116
139
 
117
- **4. Windows, no install.** Download `TelcoLadder-Windows-x64.zip` from the
118
- [Releases](https://github.com/gollumw/TelcoLadder/releases) page — a standalone
119
- executable in a portable zip, built by CI from the tagged source. Unzip,
120
- run `check-environment.cmd`, and use `telcoladder.exe` from that folder. It
121
- needs Wireshark 4.0 or newer on the machine, nothing else.
122
-
123
140
  Requires Python 3.11+ and `tshark` (Wireshark 4.0 or newer) for the `pip`
124
141
  route. Neither the macOS nor the Windows installer puts `tshark` on your `PATH`;
125
142
  TelcoLadder looks in the standard install directories and finds it anyway, or
@@ -260,22 +277,43 @@ diagram, Mermaid as the output, and a verified explanation of what went wrong.
260
277
  - **A fully transparent SCP** that sends no `3gpp-Sbi-Target-apiRoot` is
261
278
  indistinguishable from the endpoint and falls back to an unlabelled IP. The
262
279
  correct failure direction, and a real gap.
263
- - **Diameter covers seven interfaces** with roles and curated causes; the rest
264
- decode and show their Application-Id with no role inference. The fixture is
265
- written from RFC 6733, not captured: no SCTP, no reassembly, invented timing.
266
- - **SIP proxies are not yet told apart** (`Via` is recorded, Mw and ISC are
267
- unlabelled); H.248 gets neutral `MGC` / `MGW` roles and no reference point,
280
+ - **Diameter covers seven interfaces** with roles and curated causes (S6a/S6d,
281
+ Cx/Dx, Sh, Rx, Gx, SWx, S6b); the rest — Rf included — decode and show their
282
+ Application-Id with no role inference. Every Diameter fixture is written from
283
+ RFC 6733, not captured: TCP only, no SCTP, invented timing.
284
+ - **Four behavior rules have no capture behind them.** S10 inter-MME handover,
285
+ the Xn/X2 path switch, CS fallback and the Cx authentication delay inside a
286
+ call are written from message names and covered only by synthetic tests; how
287
+ they read a real capture is unmeasured. The chain shown before a failure is the
288
+ order of messages within one segment, not proven causation.
289
+ - **SIP alone does not name the core proxies.** The UE and the P-CSCF come from
290
+ Gm itself — the security-agreement headers, or which address holds IPsec
291
+ associations with several peers, falling back to a `Contact` that carries a
292
+ subscriber identity; an I-CSCF, S-CSCF or AS is named only when its Cx or Sh
293
+ exchange is in the same capture. Gm is the only SIP
294
+ reference point labelled — Mw and ISC are not, because no capture here has
295
+ verified them. H.248 gets neutral `MGC` / `MGW` roles and no reference point,
268
296
  because the protocol alone cannot say whether it is Iq, Mn or Mp.
269
- - **Only 7 of the 21 cause tables cite a clause.** The other 14 name the
297
+ - **Calls and numbers join only on evidence.** B2BUA legs become one call only
298
+ when they share a charging ID (ICID) and overlap in time — a B2BUA or SBC
299
+ that replaces the ICID leaves separate rows. A number joins HSS, charging and
300
+ ENUM records only in international form; a local-form number is never
301
+ completed with a guessed country code. VoLTE, VoNR and VoWiFi are shown only
302
+ where `P-Access-Network-Info` declares them; without that header the access
303
+ is reported as not declared.
304
+ - **Only 9 of the 21 cause tables cite a clause.** The other 12 name the
270
305
  specification and stop. An absent clause is better than a wrong one.
271
306
  - **The 4G, IMS and handover fixtures are written byte by byte** with `tshark`
272
307
  as the oracle: exact about the protocol, silent about any real deployment.
273
- Each `scenario.md` lists what its fixture cannot prove. There is no EPS → 5GS
274
- handover fixture yet, and no UE radio capability parsing.
308
+ Each `scenario.md` lists what its fixture cannot prove. UE radio capability
309
+ is not parsed: the NR and LTE RRC containers are skipped during extraction
310
+ because dissecting them is slow, and stay readable in the per-frame decode
311
+ tree.
275
312
  - **NAS after Security Mode Command is encrypted** and its content is
276
- invisible; the packets still appear as their NGAP carrier. GTP-U joins the
277
- subscriber but carries no throughput or loss KPIs; there is no RTP adapter;
278
- ISUP and CAMEL are recognised but not read.
313
+ invisible; the packets still appear as their NGAP carrier. The same holds for
314
+ IPsec ESP on Gm: only NULL-encrypted ESP is read, and encrypted ESP is counted
315
+ as unreadable. GTP-U joins the subscriber but carries no throughput or loss
316
+ KPIs; there is no RTP adapter; ISUP and CAMEL are recognised but not read.
279
317
  - **Joins through a tunnel an SBI message quotes are inferences.** They bind by
280
318
  direction, inside a time window, never across a release, and never where they
281
319
  would give one flow two SUPIs; the summary counts each one. What remains: a
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "telcoladder"
3
- version = "0.3.0"
3
+ version = "0.4.0"
4
4
  description = "Turn telecom signalling captures into Mermaid sequence diagrams — 5G core, 4G/EPC and IMS on one timeline."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -5,4 +5,4 @@ Phase 2 主攻 IMS(SIP / Diameter / GTP)—— 協定以 adapter 形式插
5
5
  核心資料模型 (`telcoladder.model`) 已預留跨協定的身分關聯欄位。
6
6
  """
7
7
 
8
- __version__ = "0.3.0"
8
+ __version__ = "0.4.0"
@@ -0,0 +1,320 @@
1
+ """手機行為的語意膠囊:一段程序 → 一筆 `BehaviorRecord`(2026-09-16)。
2
+
3
+ ## 為什麼要有這一層
4
+
5
+ 讀一份 AMF/MME 側長擷取的人第一眼要的是三件事:**這是什麼行為**(開機註冊?被叫喚醒?跨代換手?)、
6
+ **成敗與慢不慢**、**失敗的話前面發生了什麼**。程序切段(`procedures.py`)與無線連線(`connections.py`)
7
+ 已經給了邊界與結局;這一層只把它們**重新編碼**成一份與網元無關的契約 —— 意圖 → 核心協同 → 結案 →
8
+ 成敗與度量 —— 不新增任何線路推論。將來接 SMF/PGW 的程序,畫面照同一份契約排版。
9
+
10
+ ## 契約
11
+
12
+ * **類別**(`BEHAVIOR_CATEGORIES`,六類)由 `procedures.CATEGORIES` 對應而來(`CATEGORY_OF`)。**兩份清單
13
+ 由 `tests/test_behavior.py` 釘住**:引擎加一個類別而這裡忘了,那條測試紅。`subscriber-data` 與 `other`
14
+ 不是手機行為(HSS 自己來的事、認不出的段),不產生紀錄。
15
+ * **意圖**(`INTENTS`)是封閉詞彙,全部來自 `Procedure` 已有的欄位:kind、註冊型別、觸發者、方向、
16
+ 釋放發起方、DNN、段裡有沒有 Path Switch、協定組合。
17
+ * **時延拆解**只放量到的數字 —— 換手的準備/執行(`ho_prep_s`/`ho_exec_s`)、通話的 PDD(`ring_s`,
18
+ INVITE 到第一個 180/183)與接通、通話期間 Cx 的 Multimedia-Auth 往返、成功註冊的耗時。沒量到的鍵不存在。
19
+ * **慢不慢不在這裡判**:閾值是看的人在瀏覽器裡設的(`localStorage`),後端讀不到。這裡只說「這一筆該拿
20
+ 哪個閾值比、比的是哪個數字」(`kpi`),比較由畫面做 —— 同一個判斷只有一份實作。預設值
21
+ `DEFAULT_KPI_THRESHOLDS` 隨回應送出,畫面的預設值由測試對齊。
22
+ * **因果鏈**(`trace_causal_chain`)只給失敗的段:開段那一則 → 核網的轉折點 → 第一則失敗 → 最後一則失敗。
23
+ **這是同一段裡的先後,不是證實的因果** —— 擷取檔看得到時序,看不到網元內部為什麼這樣決定。
24
+ 轉折點的定義是線路事實:第一則失敗之前、最後一則由核網角色送出、而且不是失敗那一方送的訊息。
25
+
26
+ ## 沒有 fixture 驗證的規則(寫明,不假裝驗過)
27
+
28
+ S10 跨 MME 換手、Xn/X2 的 Path Switch、CSFB、通話期間的 Cx 認證時延 —— 27 份 fixture 一份都沒有。
29
+ 規則照線路名稱寫,由合成訊息測試守;真實擷取上的表現未量測。
30
+ """
31
+
32
+ from __future__ import annotations
33
+
34
+ from dataclasses import dataclass, field
35
+
36
+ from telcoladder.lanes import RADIO_ROLES
37
+ from telcoladder.model import RELEASE_INITIATOR_KEY, Message
38
+ from telcoladder.wireview import CARRIED_JOINER
39
+
40
+ #: 六類行為。順序就是畫面的順序。
41
+ BEHAVIOR_CATEGORIES: tuple[str, ...] = (
42
+ "registration", "service-request", "handover", "voice", "session", "release",
43
+ )
44
+
45
+ #: `procedures.CATEGORIES` → 行為類別。**鍵必須正好是引擎的類別清單**(測試釘住)。None = 不是手機行為。
46
+ CATEGORY_OF: dict[str, str | None] = {
47
+ "registration": "registration",
48
+ # 閒置移動(TAU、跨代的 context 交換)與連線中的換手是同一個問題:「手機換了地方,核網跟上了沒」。
49
+ "mobility": "handover",
50
+ "handover": "handover",
51
+ "service-request": "service-request",
52
+ "session": "session",
53
+ "release": "release",
54
+ # 通話與 fallback(EPS fallback、CSFB)都是「為了語音」。
55
+ "call": "voice",
56
+ "fallback": "voice",
57
+ "subscriber-data": None,
58
+ "other": None,
59
+ }
60
+
61
+ #: 意圖的封閉詞彙。畫面的標籤表以它為準(`web/src/lib/behaviorLabels.ts`,測試對齊)。
62
+ INTENTS: tuple[str, ...] = (
63
+ "initial-registration", "registration-update", "registration", "attach",
64
+ "deregistration", "detach", "ims-registration",
65
+ "ue-service-request", "paging-service-request",
66
+ "n26-handover", "s10-handover", "path-switch", "ran-handover", "tau", "context-transfer",
67
+ "volte-call", "eps-fallback", "csfb",
68
+ "ims-session", "internet-session", "session",
69
+ "ran-release", "core-release", "release",
70
+ )
71
+
72
+ #: 時延拆解可能出現的鍵(`latency_breakdown`)。畫面的標籤表以它為準。
73
+ LATENCY_KEYS: tuple[str, ...] = (
74
+ "preparation_delay_s", "execution_delay_s", "pdd_s", "answer_s", "cx_auth_delay_s", "registration_s",
75
+ )
76
+
77
+ #: 閾值的鍵與預設秒數。畫面可改(存在瀏覽器);這裡的值只是出廠預設。
78
+ DEFAULT_KPI_THRESHOLDS: dict[str, float] = {"handover": 1.5, "volte_pdd": 3.0, "registration": 1.0}
79
+
80
+ #: 因果鏈的節點角色,依鏈上的先後。
81
+ CHAIN_STEPS: tuple[str, ...] = ("origin", "turning-point", "first-failure", "failure")
82
+
83
+ #: 鏈上每個節點帶的參數:只取 adapter 已經寫在 `detail` 的**非識別碼**欄位。**不放 IMSI/SUPI/門號**——
84
+ #: 那些是身分,不是「這一步要了什麼」。
85
+ KEY_PARAMETER_KEYS: tuple[str, ...] = (
86
+ "dnn", "APN", "registration-type", "handover-type", "rrc-establishment-cause", RELEASE_INITIATOR_KEY,
87
+ )
88
+
89
+ #: 意圖與時延要認的線路名稱。
90
+ PATH_SWITCH = "PathSwitchRequest"
91
+ CX_REFERENCE_POINT = "Cx/Dx"
92
+ CX_AUTH_REQUEST = "Multimedia-Auth Request"
93
+ CX_AUTH_ANSWER = "Multimedia-Auth Answer"
94
+
95
+ #: 連線的結局取成員裡最嚴重的那個 —— 與畫面的 `OUTCOME_SEVERITY` 同序。
96
+ OUTCOME_SEVERITY: tuple[str, ...] = ("failure", "incomplete", "cancelled", "ended-by-user", "success")
97
+
98
+
99
+ @dataclass(frozen=True, slots=True)
100
+ class CausalNode:
101
+ step: str
102
+ """`CHAIN_STEPS` 之一。"""
103
+ frame: int
104
+ label: str
105
+ role_from: str
106
+ role_to: str
107
+ key_parameters: dict[str, str] = field(default_factory=dict)
108
+
109
+ def to_json(self) -> dict:
110
+ return {"step": self.step, "frame": self.frame, "label": self.label, "role_from": self.role_from,
111
+ "role_to": self.role_to, "key_parameters": dict(self.key_parameters)}
112
+
113
+
114
+ @dataclass(frozen=True, slots=True)
115
+ class BehaviorRecord:
116
+ id: str
117
+ category: str
118
+ intent_label: str
119
+ kind: str
120
+ family: str | None
121
+ direction: str | None
122
+ initiator_side: str | None
123
+ outcome: str
124
+ cause: str | None
125
+ start_frame: int
126
+ end_frame: int
127
+ duration_s: float
128
+ latency_breakdown: dict[str, float]
129
+ kpi: tuple[str, float] | None
130
+ """(閾值鍵, 要比的秒數)。None = 這一筆沒有可比的數字(例如失敗的註冊:它的耗時不是註冊時延)。"""
131
+ causal_chain: tuple[CausalNode, ...]
132
+ member_frames: tuple[int, ...]
133
+ connection: int | None
134
+ """第一則落在某次無線連線裡的成員所屬的連線;一則都沒有是 None。"""
135
+
136
+ def to_json(self) -> dict:
137
+ return {
138
+ "id": self.id, "category": self.category, "intent_label": self.intent_label, "kind": self.kind,
139
+ "family": self.family, "direction": self.direction, "initiator_side": self.initiator_side,
140
+ "outcome": self.outcome, "cause": self.cause,
141
+ "start_frame": self.start_frame, "end_frame": self.end_frame, "duration_s": self.duration_s,
142
+ "latency_breakdown": dict(self.latency_breakdown),
143
+ "kpi": {"threshold": self.kpi[0], "value": self.kpi[1]} if self.kpi else None,
144
+ "causal_chain": [n.to_json() for n in self.causal_chain],
145
+ "member_frames": list(self.member_frames),
146
+ "connection": self.connection,
147
+ }
148
+
149
+
150
+ def _own(msg: Message) -> str:
151
+ return msg.label.split(CARRIED_JOINER, 1)[0]
152
+
153
+
154
+ def category_of(p) -> str | None:
155
+ return CATEGORY_OF.get(getattr(p, "category", None) or "other")
156
+
157
+
158
+ def classify_intent(p) -> str:
159
+ """一段程序的意圖。只讀 `Procedure` 已有的欄位;每個有類別的 kind 都落進 `INTENTS`(測試逐一檢查)。"""
160
+ kind = p.kind
161
+ if kind == "registration":
162
+ if p.registration_type == "initial-registration":
163
+ return "initial-registration"
164
+ return "registration-update" if p.registration_type else "registration"
165
+ if kind in ("attach", "deregistration", "detach", "tau", "context-transfer", "eps-fallback", "csfb"):
166
+ return kind
167
+ if kind == "sip-register":
168
+ return "ims-registration"
169
+ if kind == "service-request":
170
+ return "paging-service-request" if p.trigger == "network" else "ue-service-request"
171
+ if kind == "handover":
172
+ # 有方向就是跨代(N26)—— 方向是 HandoverType IE 的線路事實,蓋過其他線索。
173
+ if p.direction:
174
+ return "n26-handover"
175
+ if any(_own(m) == PATH_SWITCH for m in getattr(p, "members", ())):
176
+ return "path-switch"
177
+ # 只看到 Forward Relocation 而對端不是 AMF:`_family_of` 判成 4G,那是 MME 池內的 S10。
178
+ if p.family == "4g" and "gtpv2" in p.protocols:
179
+ return "s10-handover"
180
+ return "ran-handover"
181
+ if kind == "sip-call":
182
+ return "volte-call"
183
+ if kind == "ue-context-release":
184
+ return {"ran": "ran-release", "core": "core-release"}.get(p.release_initiator or "", "release")
185
+ if category_of(p) == "session":
186
+ # IMS 的 DNN/APN 以 `ims` 為第一個標籤(營運商的 APN-OI 接在後面)。不是 IMS 的一律算上網 ——
187
+ # 沒帶 DNN 就不猜。
188
+ if not p.dnn:
189
+ return "session"
190
+ return "ims-session" if p.dnn.split(".", 1)[0].lower() == "ims" else "internet-session"
191
+ return "registration" if category_of(p) == "registration" else "session"
192
+
193
+
194
+ def cx_auth_delay(p, messages: list[Message]) -> float | None:
195
+ """通話期間第一次 Cx Multimedia-Auth 的往返秒數。答覆以 End-to-End 配對;沒有就是 None。"""
196
+ members = getattr(p, "members", ())
197
+ if not members:
198
+ return None
199
+ start, stop = min(m.ts for m in members), max(m.ts for m in members)
200
+ for request in messages:
201
+ if not (start <= request.ts <= stop) or request.detail.get("reference_point") != CX_REFERENCE_POINT:
202
+ continue
203
+ if not request.label.startswith(CX_AUTH_REQUEST):
204
+ continue
205
+ e2e = request.detail.get("end-to-end-id")
206
+ answer = next((m for m in messages if e2e and m.ts >= request.ts and m.label.startswith(CX_AUTH_ANSWER)
207
+ and m.detail.get("end-to-end-id") == e2e), None)
208
+ if answer is not None:
209
+ return round(answer.ts - request.ts, 6)
210
+ return None
211
+
212
+
213
+ def latency_breakdown(p, messages: list[Message]) -> dict[str, float]:
214
+ out: dict[str, float] = {}
215
+ if getattr(p, "ho_prep_s", None) is not None:
216
+ out["preparation_delay_s"] = p.ho_prep_s
217
+ if getattr(p, "ho_exec_s", None) is not None:
218
+ out["execution_delay_s"] = p.ho_exec_s
219
+ if p.kind == "sip-call":
220
+ if p.ring_s is not None:
221
+ out["pdd_s"] = p.ring_s
222
+ if p.answer_s is not None:
223
+ out["answer_s"] = p.answer_s
224
+ cx = cx_auth_delay(p, messages)
225
+ if cx is not None:
226
+ out["cx_auth_delay_s"] = cx
227
+ # 失敗的註冊不算:它的耗時多半是定時器在等(`timers`),不是註冊時延。
228
+ if category_of(p) == "registration" and p.outcome == "success":
229
+ out["registration_s"] = round(p.duration, 6)
230
+ return out
231
+
232
+
233
+ def kpi_of(p, breakdown: dict[str, float]) -> tuple[str, float] | None:
234
+ """這一筆要拿哪個閾值比、比哪個數字。比較本身在畫面做(閾值在瀏覽器)。"""
235
+ if "preparation_delay_s" in breakdown:
236
+ return "handover", round(breakdown["preparation_delay_s"] + breakdown.get("execution_delay_s", 0.0), 6)
237
+ if "pdd_s" in breakdown:
238
+ return "volte_pdd", breakdown["pdd_s"]
239
+ if "registration_s" in breakdown:
240
+ return "registration", breakdown["registration_s"]
241
+ return None
242
+
243
+
244
+ def _key_parameters(msg: Message) -> dict[str, str]:
245
+ params = {key: str(msg.detail[key]) for key in KEY_PARAMETER_KEYS if msg.detail.get(key)}
246
+ if msg.cause is not None:
247
+ params["cause"] = f"{msg.cause.table} #{msg.cause.value}"
248
+ return params
249
+
250
+
251
+ def _node(step: str, msg: Message) -> CausalNode:
252
+ return CausalNode(step=step, frame=msg.frame, label=msg.label, role_from=msg.src.label(),
253
+ role_to=msg.dst.label(), key_parameters=_key_parameters(msg))
254
+
255
+
256
+ def trace_causal_chain(p) -> tuple[CausalNode, ...]:
257
+ """失敗的段從結局往回找:開段 → 核網轉折點 → 第一則失敗 → 最後一則失敗。非失敗的段是空的。"""
258
+ members = list(getattr(p, "members", ()))
259
+ if p.outcome != "failure" or not members:
260
+ return ()
261
+ failed = [i for i, m in enumerate(members) if m.is_failure]
262
+ if not failed:
263
+ return ()
264
+ first, last = failed[0], failed[-1]
265
+ if first == 0:
266
+ picks = [("first-failure", 0)]
267
+ else:
268
+ picks = [("origin", 0)]
269
+ failing_sender = members[first].src.label()
270
+ turn = next((i for i in range(first - 1, 0, -1)
271
+ if members[i].src.role not in RADIO_ROLES and members[i].src.label() != failing_sender), None)
272
+ if turn is not None:
273
+ picks.append(("turning-point", turn))
274
+ picks.append(("first-failure", first))
275
+ if last != first:
276
+ picks.append(("failure", last))
277
+ return tuple(_node(step, members[i]) for step, i in picks)
278
+
279
+
280
+ def behavior_records(procedures: list, messages: list[Message], connection_of: dict[int, int]) -> list[BehaviorRecord]:
281
+ """每一段有行為類別的程序一筆,依開始的格號。`connection_of` 是 `id(message)` → 連線編號。"""
282
+ records = []
283
+ for p in sorted(procedures, key=lambda p: p.start_frame):
284
+ category = category_of(p)
285
+ if category is None:
286
+ continue
287
+ members = getattr(p, "members", ())
288
+ breakdown = latency_breakdown(p, messages)
289
+ records.append(BehaviorRecord(
290
+ id=f"{p.kind}@{p.start_frame}", category=category, intent_label=classify_intent(p), kind=p.kind,
291
+ family=getattr(p, "family", None), direction=getattr(p, "direction", None),
292
+ initiator_side=getattr(p, "initiator_side", None), outcome=p.outcome, cause=p.cause,
293
+ start_frame=p.start_frame, end_frame=p.end_frame, duration_s=round(p.duration, 6),
294
+ latency_breakdown=breakdown, kpi=kpi_of(p, breakdown), causal_chain=trace_causal_chain(p),
295
+ member_frames=tuple(m.frame for m in members),
296
+ connection=next((connection_of[id(m)] for m in members if id(m) in connection_of), None),
297
+ ))
298
+ return records
299
+
300
+
301
+ def connection_summary(connection, records: list[BehaviorRecord]) -> dict:
302
+ """一次連線膠囊的四個欄位:意圖(第一筆行為的)、結局(最嚴重的)、cause(第一筆失敗的)、耗時。
303
+ 連線裡沒有任何行為時意圖與結局是 None —— 不填看起來像樣的值。"""
304
+ mine = [r for r in records if r.connection == connection.index]
305
+ members = connection.members
306
+ duration = members[-1].ts - members[0].ts if members else 0.0
307
+ if not mine:
308
+ return {"intent_label": None, "outcome": None, "cause": None, "duration_s": round(duration, 6)}
309
+ outcome = min((r.outcome for r in mine),
310
+ key=lambda o: OUTCOME_SEVERITY.index(o) if o in OUTCOME_SEVERITY else len(OUTCOME_SEVERITY))
311
+ failed = next((r for r in mine if r.outcome == "failure"), None)
312
+ return {"intent_label": mine[0].intent_label, "outcome": outcome,
313
+ "cause": failed.cause if failed else None, "duration_s": round(duration, 6)}
314
+
315
+
316
+ __all__ = [
317
+ "BEHAVIOR_CATEGORIES", "CATEGORY_OF", "CHAIN_STEPS", "DEFAULT_KPI_THRESHOLDS", "INTENTS",
318
+ "BehaviorRecord", "CausalNode", "behavior_records", "classify_intent", "connection_summary",
319
+ "cx_auth_delay", "kpi_of", "latency_breakdown", "trace_causal_chain",
320
+ ]