#!/usr/bin/env python3 """Yealink VCS gap report: что уже есть и чего не хватает.""" import re import yaml from collections import Counter BASE = "/opt/work-hub/compat" cat = yaml.safe_load(open(BASE + "/catalog.yaml", encoding="utf-8")) devs = cat.get("devices") or [] features = yaml.safe_load(open(BASE + "/features.yaml", encoding="utf-8")).get("devices") or [] values = yaml.safe_load(open(BASE + "/values.yaml", encoding="utf-8")).get("devices") or [] graph = yaml.safe_load(open(BASE + "/graph.yaml", encoding="utf-8")).get("edges") or [] kits = yaml.safe_load(open(BASE + "/kits.yaml", encoding="utf-8")).get("kits") or [] def norm(s): return re.sub(r"[^a-z0-9]", "", str(s).lower()) feats = {} for x in features: feats.setdefault(norm(x.get("device")), set()).update(x.get("features") or []) # protocols.yaml: features как словарь/список (как в Data.feats) try: proto = yaml.safe_load(open(BASE + "/protocols.yaml", encoding="utf-8")).get("devices") or [] for x in proto: v = x.get("features") or {} vals = list(v.keys()) if isinstance(v, dict) else list(v) feats.setdefault(norm(x.get("device")), set()).update(vals) except Exception: pass attrs = {} for x in values: attrs[norm(x.get("device"))] = x.get("attributes") or {} edges = {} for e in graph: edges.setdefault(norm(e.get("from")), []).append(e) vcs = [d for d in devs if (d.get("domain") or "vcs") == "vcs"] tel = [d for d in devs if (d.get("domain") or "") == "telephony"] rows = [] for d in vcs: n = d.get("name") or d.get("model") or "" k = norm(n) f = feats.get(k, set()) a = attrs.get(k, {}) protocols = [p for p in (d.get("protocols") or []) if p] if not protocols: protocols = [p for p in ("SIP", "H.323") if p in f or p in a] has4k = "4K" in f or any("4k" in str(v).lower() or "3840" in str(v) for v in a.values()) room = d.get("room_size") or a.get("room.max_participants") rows.append({ "model": n, "family": d.get("line") or d.get("group") or "—", "role": d.get("role") or "—", "class": d.get("solution_class") or "—", "protocols": protocols, "4k": bool(has4k), "room": room, "attrs": bool(a), "compat": bool(edges.get(k)), "datasheet": d.get("datasheet_url") or d.get("source_url") or "", "lifecycle": d.get("lifecycle") or "", }) n = len(rows) stats = { "total": n, "telephony": len(tel), "protocols": sum(1 for x in rows if x["protocols"]), "4k": sum(1 for x in rows if x["4k"]), "room": sum(1 for x in rows if x["room"]), "attrs": sum(1 for x in rows if x["attrs"]), "compat": sum(1 for x in rows if x["compat"]), "datasheet": sum(1 for x in rows if x["datasheet"]), "lifecycle": sum(1 for x in rows if x["lifecycle"]), "compat_edges": len(graph), "kits": len(kits), } fams = Counter(x["family"] for x in rows) missing = { "protocols": [x["model"] for x in rows if not x["protocols"]], "4k": [x["model"] for x in rows if not x["4k"]], "room": [x["model"] for x in rows if not x["room"]], "compat": [x["model"] for x in rows if not x["compat"]], "datasheet": [x["model"] for x in rows if not x["datasheet"]], "lifecycle": [x["model"] for x in rows if not x["lifecycle"]], } out = "/root/buryan-infra/ops/combine/YEALINK-GAP-REPORT-2026-11-18.md" lines = ["# Yealink VCS — gap report", "", "Дата: 18.11.2026", "", "## База", "", "| Метрика | Значение |", "|---|---|"] for k, v in stats.items(): lines.append("| %s | %s |" % (k, v)) lines += ["", "## Семейства", "", "| Семейство | Моделей |", "|---|---|"] for k, v in fams.most_common(): lines.append("| %s | %d |" % (k, v)) lines += ["", "## Пробелы (первые 30)", ""] for k, vals in missing.items(): lines.append("### %s — нет у %d" % (k, len(vals))) lines.append(", ".join(vals[:30]) or "—") lines.append("") lines += ["## Вывод", "", "Технический слой Yealink ещё неполный: room size и datasheet/lifecycle почти отсутствуют,", "compatibility покрывает не все модели. Приоритет — официальные datasheets + compatibility", "guide + kits + room guidance + EOL, а не новые вендоры.", ""] open(out, "w", encoding="utf-8").write("\n".join(lines)) print("wrote", out, stats) print("missing", {k: len(v) for k, v in missing.items()})