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.
Inject a fault
Section titled “Inject a fault”make print-fault STATE=toner-low Q=GH12-pLab # SNMP toner OID drops, error bit setmake print-fault STATE=rejecting Q=GH12-pLab # CUPS queue refuses jobsmake print-fault STATE=offline # all queues downmake print-fault STATE=clear Q=GH12-pLab # reset one queue to healthyThe states
Section titled “The states”| State | Layer | Effect |
|---|---|---|
toner-low | SNMP only | Toner OID drops, error bit set; the queue stays up |
paper-out | SNMP only | Paper-input status reports empty; the queue stays up |
offline | CUPS + SNMP | The queue goes down |
paused | CUPS | The queue is paused (holds jobs) |
rejecting | CUPS | The queue refuses new jobs at submission |
clear | CUPS + SNMP | Reset 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.
How it crosses both layers
Section titled “How it crosses both layers”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.
Prove an error path end to end
Section titled “Prove an error path end to end”make test-fault-pathThis 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.
Inspect the device side
Section titled “Inspect the device side”make snmp-walk DEV=bmh12-plab # hrPrinterStatus + toner level for one devicemake ipp-validate # ipptool Get-Printer-Attributes conformanceBoth 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.