Skip to content

Inject printer faults

Real printers fail, and the code that drives them needs to handle it. The lab can push a printer into specific fault states on demand, flipping both sides at once: the CUPS queue state on the print server, and the SNMP device OIDs that the print-snmp sidecar serves.

Terminal window
make print-fault STATE=toner-low Q=GH12-pLab # SNMP toner OID drops, error bit set
make print-fault STATE=rejecting Q=GH12-pLab # CUPS queue refuses jobs
make print-fault STATE=offline # all queues down
make print-fault STATE=clear Q=GH12-pLab # reset one queue to healthy
StateLayerEffect
toner-lowSNMP onlyToner OID drops, error bit set; the queue stays up
paper-outSNMP onlyPaper-input status reports empty; the queue stays up
offlineCUPS + SNMPThe queue goes down
pausedCUPSThe queue is paused (holds jobs)
rejectingCUPSThe queue refuses new jobs at submission
clearCUPS + SNMPReset to healthy

toner-low and paper-out are physical conditions, so they reflect only in SNMP; the queue keeps accepting jobs. The other states change the CUPS queue itself.

make print-fault writes a state file into a shared ./print-fault-state/ directory that the print-snmp sidecar polls, and it runs cupsdisable / cupsreject on the print server. That is why a single command can make the device report low toner and the queue refuse jobs, the way a real printer would behave when something is wrong.

Terminal window
make test-fault-path

This injects rejecting, proves a submitted job is refused, then clears the state and proves the same queue prints again. That before-and-after is the evidence your error handling has something real to react to.

Terminal window
make snmp-walk DEV=bmh12-plab # hrPrinterStatus + toner level for one device
make ipp-validate # ipptool Get-Printer-Attributes conformance

Both exec into the sidecars, which matters: the host-networked DC is the macvlan parent and cannot reach macvlan children, so query from inside the sidecar rather than from the host.