ark::snmp::SnmpMockAgentFixture

Defined in header “ark/snmp/testing/snmp_mock_agent_fixture.hh”.


Lightweight UDP mock SNMP agent used by tests.

This fixture runs a background thread that listens for incoming SNMP requests and emits a minimal response set for known OIDs.

Typedefs

  • using ValueCallback = std::function< std::optional< SnmpValue >(std::string_view oid)>
    Callback used to resolve a requested OID into a response value.

  • using MibMap = std::unordered_map< std::string, ValueCallback >
    Map of textual dotted OIDs to callbacks that produce response values.

Methods

  • SnmpMockAgentFixture(uint16_t port)
    Constructor. Starts the background mock-agent thread bound to the given port.

  • SnmpMockAgentFixture(uint16_t port, MibMap mibs)
    Constructor. Starts the background mock-agent thread with custom MIB handlers.

  • ~SnmpMockAgentFixture()
    Destructor. Stops the background thread and releases resources.

  • SnmpMockAgentFixture()
    No copies.

  • SnmpMockAgentFixture & operator=()
    No copies.

  • uint16_t port()
    Returns the actual UDP port the fixture bound (useful when constructed with port 0).

  • void rethrow_if_failed()
    Rethrows any exception captured from the background worker thread.