// src/services/voiceDiag/checks/wan/wanSite.js // // Info-only anchor check for the WAN bucket. Confirms which Prisma // SD-WAN site the store resolved to and how many appliances / // links we're seeing. Doesn't grade anything — its whole purpose is // to give the operator context ("yes we found the site; here's what // we're seeing") before the per-signal checks below start emitting // warn/error verdicts. // // Skipped when no Prisma site was matched — the runner shows that // as `skipped: not applicable — missing sdwanSite`, which is more // honest than a hard-coded "we couldn't reach Prisma" error // because there are two genuine reasons the site is null: (1) // this store isn't Prisma-managed at all, or (2) the Prisma // integration is misconfigured. buildContext() logs which one it // was. import { maybeSkippedByKillSwitch } from './_helpers.js'; export const WAN_SITE_STANDARDS = Object.freeze({ // No thresholds — this is a discovery/context check. requiresPrismaSite: true, }); export const wanSiteCheck = { id: 'wanSite', label: 'SD-WAN Site Discovery', requires: ['sdwanSite'], scope: null, standards: WAN_SITE_STANDARDS, async run(ctx) { const skip = maybeSkippedByKillSwitch(wanSiteCheck); if (skip) return skip; const site = ctx.sdwanSite; const elements = Array.isArray(ctx.sdwanData?.elements) ? ctx.sdwanData.elements : []; const links = Array.isArray(ctx.sdwanData?.links) ? ctx.sdwanData.links : []; const connectedCount = elements.filter((e) => e.connected).length; return { status: 'ok', message: `Site **${site.name}** (${elements.length} element${elements.length === 1 ? '' : 's'}, ` + `${connectedCount} connected) with ${links.length} WAN path${links.length === 1 ? '' : 's'}.`, details: { siteId: site.id, siteName: site.name, elementCount: elements.length, connectedElementCount: connectedCount, linkCount: links.length, }, remediation: null, }; }, };