Shumoku Docs

Search documentation

Shared docs and current release

Loading search…

日本語

@shumoku/core · 0.4.0 · function

normalizeMacKey

Source

Canonical spelling for a MAC-shaped identity key: lowercase, colon-separated. Sources disagree on how to write the same wire address. Huawei NCE returns `50-04-01-01-D5-50` in its device list and `CC:D8:1F:9F:D4:AB` in its LLDP table; an SNMP walk of the very same switch yields `cc:d8:1f:9f:d4:ab`; Cisco gear writes `ccd8.1f9f.d4ab`. Identity keys are matched as exact strings, so without one canonical spelling a device arrives as two entities that never merge — the failure is silent, which is what makes it worth normalizing here rather than in each plugin. Anything that is not twelve hex digits once separators are stripped is returned untouched: `chassisId` is only sometimes a MAC (LLDP also permits interface names and network addresses) and must survive as written.

normalizeMacKey(value: string): string

Parameters

Parameter Type Description Default
value string No additional description.

Returns

string

libs/@shumoku/core/src/plugin-kit/stamp.ts:43