feat: 5G 指标和 4G、5G 的 MR 改从即席查询取实际数据,评估不再用模拟指标
- 5G 流量、RRC、利用率、扇区取 5G 小区容量周表,接通率和掉线率取 5GSA_CU 的周粒度,MR 取 5GMRO 的周粒度 - 4G 的 MR 采样、覆盖率、竞对和三个是否取 MR 月表:停闭前用拆除日上一个月,停闭后用当月 - 周边站的 MR 弱覆盖填弱于 -110dBm 的比例(100 减平台的占比),和模板阈值一致 - 多粒度的表在请求里带上选中的时间粒度和地理维度 - 判断公式逐项检查停闭后有没有数值,缺了显示「/」;4G 的 MR 月数据没出时汇总行的 MR 一项不判断 - 扇区成员把 5G 小区也算进来
This commit is contained in:
@@ -75,8 +75,8 @@ def test_select_rows_inserts_the_list_before_city_and_batches(monkeypatch):
|
||||
async def session(client):
|
||||
return None
|
||||
|
||||
async def fetch(client, head, chosen, where):
|
||||
seen.append(([column["columnname"] for column in chosen], where))
|
||||
async def fetch(client, head, chosen, where, **dimensions):
|
||||
seen.append(([column["columnname"] for column in chosen], where, dimensions))
|
||||
return [{"cgi": "ok"}]
|
||||
|
||||
monkeypatch.setattr(adhoc, "_columns", fake_columns)
|
||||
@@ -93,5 +93,42 @@ def test_select_rows_inserts_the_list_before_city_and_batches(monkeypatch):
|
||||
("city", "in", "江门"),
|
||||
]
|
||||
assert seen[1][1][-2]["val"] == "460-00-1-3"
|
||||
assert seen[0][2] == {"time_dimension": None, "geo_dimension": None}
|
||||
assert asyncio.run(adhoc.select_rows(None, table, start, end, "江门", "cgi", [])) == []
|
||||
assert len(seen) == 2
|
||||
|
||||
|
||||
def test_tables_with_several_granularities_send_the_selected_one(monkeypatch):
|
||||
# 5GSA_CU 性能报表一张表有小时、天、周、月四种粒度,同一个字段登记了不止一次。
|
||||
table = "appdbv3.a_common_pm_sacu"
|
||||
config = {**HEAD, "tablename": table, "supporteddimension": "0,2,1,3", "supportedtimedimension": "0,1,2,3,4", "time_field": "starttime"}
|
||||
table_columns = [
|
||||
{**config, "columnname": "starttime"},
|
||||
{**config, "columnname": "ncgi"},
|
||||
{**config, "columnname": "kpi_rate", "fieldtype": "天粒度"},
|
||||
{**config, "columnname": "kpi_rate", "fieldtype": "周、月粒度"},
|
||||
]
|
||||
assert [column["fieldtype"] for column in adhoc._pick(table_columns, ("kpi_rate", "ncgi"))] == [HEAD["fieldtype"], "天粒度"]
|
||||
picked = json.loads(adhoc._result_json(config, table_columns[:2], time_dimension="2", geo_dimension="0"))
|
||||
assert picked["tableParams"] == {"supporteddimension": "0", "supportedtimedimension": "2"}
|
||||
assert json.loads(adhoc._result_json(config, table_columns[:2]))["tableParams"] == {"supporteddimension": "0,2,1,3", "supportedtimedimension": "0,1,2,3,4"}
|
||||
sent = []
|
||||
|
||||
async def fake_columns(client, name):
|
||||
return table_columns
|
||||
|
||||
async def session(client):
|
||||
return None
|
||||
|
||||
async def fake_post(client, url, form):
|
||||
sent.append((url.rsplit("/", 1)[-1], form))
|
||||
return {"count": 0, "indexcount": "0"}
|
||||
|
||||
monkeypatch.setattr(adhoc, "_columns", fake_columns)
|
||||
monkeypatch.setattr(adhoc, "ensure_session", session)
|
||||
monkeypatch.setattr(adhoc, "_post_json", fake_post)
|
||||
week = (datetime(2026, 11, 2), datetime(2026, 11, 8, 23, 59, 59))
|
||||
assert asyncio.run(adhoc.select_rows(None, table, *week, "江门", "ncgi", ["460-00-1-1"], ("starttime", "ncgi", "kpi_rate"), time_dimension="2", geo_dimension="0")) == []
|
||||
result = json.loads(sent[0][1]["result"])
|
||||
assert sent[0][0] == "getTableCount" and result["tableParams"] == {"supporteddimension": "0", "supportedtimedimension": "2"}
|
||||
assert [item["feild"] for item in result["result"]] == ["starttime", "ncgi", "kpi_rate"]
|
||||
|
||||
Reference in New Issue
Block a user