pdbmux backfill: consume the puppet lldp fact to populate NetBox switch/port cabling #7
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
NetBox has no source for physical switch/port topology: which switch and which port each host is cabled to. It is the one reality dimension that exists nowhere else in the estate today (not in intent YAML, not in any other fact, not in DHCP/DNS). Without it, NetBox device interfaces have no cable/connection endpoint, so the "reality" side of the backfill (PR #6, issue #1) is incomplete for the physical fleet.
The upstream data now exists. puppet-prod PR (
benvin/lldpd) runs lldpd on physical hosts and publishes a structuredlldpcustom fact. LLDP is the only topology source available, so the backfill should consume it.lldpfact shapePuppetDB serves the fact as a map keyed by local interface; only interfaces that have a neighbour appear. Real sample (prodnxsr0019, interface
enp1s0):Proposal
Extend
tools/backfill/(pdbmux.go / reality.go / emit.go) to:lldpfact alongside the interface/inventory facts already consumed, decoding it into amap[localIface]Neighbor.neighbor_chassis_name(LLDP SysName, e.g.sg3429x-m2-02) to a NetBox device;neighbor_port_descr(LLDP PortDescr, e.g.two-gigabitEthernet 1/0/11) to that device's interface, falling back toneighbor_port_idwhere PortDescr is not a usable interface name.LLDP: <sysname> <port>note so the data lands idempotently now and can be upgraded to a real cable later).Prerequisite: the switches themselves must exist as NetBox devices with their ports for a true cable to be created; until then, the custom-field/note fallback is acceptable.
Acceptance
lldpfact and, for a physical host with LLDP neighbours, creates the local-interface -> switch/port connection in NetBox (or records the neighbour on the fallback field when the switch/port is not yet modelled).lldpfact (VMs, hosts where lldpd is down) are skipped cleanly.lldpfact fixture (using the prodnxsr0019 sample above) asserting the emitted connection/record.Refs
benvin/lldpd(profiles::lldpd on physicals +lldpfact).