You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: add SNMP protocol support (issue #38)
- Add SNMPv1/v2c/v3 agent mock using GoSNMPServer (GET/GETNEXT/GETBULK/SET)
- Add outbound TRAP sending via gosnmp
- Add config types: SNMPConfig, SNMPMock, SNMPUser, SNMPTrap, SNMPTrapBinding
- Add internal/protocols/snmpserver package with 35 unit+integration tests
- Add 7 REST API endpoints: CRUD for OID mocks + trap config + trap send
- Wire SNMP server into cmd/mockly/main.go
- Update configs/example.yaml with full SNMP section
- Update README.md: features table, SNMP protocol section, API reference, architecture diagram
- Update docs/openapi.yaml: SNMPMock/SNMPTrap/SNMPUser schemas + 7 endpoint paths
- Add 6 E2E tests in tests/e2e/e2e_test.go
- Fix data race in restart loop: protect s.srv reads/writes with mutex
and capture srv pointer before launching ServeForever goroutine
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(snmp): eliminate double-Shutdown race on mock reload
SetMocks was calling srv.Shutdown() concurrently with the Start loop's
own current.Shutdown() call in the <-restartCh case, causing a data race
inside GoSNMPServer's UDPListener.
Fix: SetMocks only closes the restart channel; the Start loop is now the
sole owner of Shutdown. The <-restartCh case calls current.Shutdown()
before continuing, guaranteeing the UDP port is released before
buildAndListen re-binds it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test(api): replace nil snmp arg with stubSNMP consistent with other stubs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test(api): add SNMP handler tests and make stubSNMP stateful
- stubSNMP now holds mocks/traps state and validates IDs in SendTrap
- startAPI returns *stubSNMP for inspection in tests
- Add TestAPI_SNMP_MockCRUD: list/create/update/delete OID mocks via API
- Add TestAPI_SNMP_TrapsCRUD: list/create trap configs via API
- Add TestAPI_SNMP_SendTrap: send recorded trap, verify stub receives call
- Add TestAPI_SNMP_SendTrap_NotFound: unknown ID returns 500
- Add TestAPI_SNMP_UpdateMock_NotFound: unknown ID returns 404
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test(api): update startAPI calls to include additional parameters
* docs: fix architecture diagram alignment with SNMP box
Expand outer box to 92 chars so all 9 protocol boxes fit in a single
aligned row. Fix SNMP box width (was │SNMP│/│1161│ = 4-char content,
now │ SNMP │/│:1161 │ = 6-char content, matching HTTP/SMTP/MQTT).
Remove duplicate row left over from the initial SNMP addition.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: README.md
+88-18Lines changed: 88 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Mockly
2
2
3
-
**Cross-platform, multi-protocol mock server** — HTTP, WebSocket, gRPC, GraphQL, TCP, Redis, SMTP, and MQTT in a single binary with a built-in web UI, REST management API, scenario system, and fault injection.
3
+
**Cross-platform, multi-protocol mock server** — HTTP, WebSocket, gRPC, GraphQL, TCP, Redis, SMTP, MQTT, and SNMP in a single binary with a built-in web UI, REST management API, scenario system, and fault injection.
|**Response sequences**| Return a different response on each successive call — loop, hold last, or 404 when exhausted |
40
40
|**Response control**| Status code, headers, body, artificial delay |
@@ -506,6 +506,64 @@ Topic wildcards: `+` matches a single segment, `#` matches everything below.
506
506
507
507
---
508
508
509
+
### SNMP
510
+
511
+
Full SNMP agent (powered by GoSNMPServer) that responds to GET, GETNEXT, GETBULK, and SET requests. Supports SNMPv1, v2c, and v3 (USM with MD5/SHA auth and DES/AES privacy). Can also send outbound TRAPs to any target host via the management API.
**TRAP sending** — POST to `/api/snmp/traps/{id}/send` to trigger any configured trap. The agent connects to the trap's `target` over UDP and sends the PDU.
564
+
565
+
---
566
+
509
567
## Component Testing
510
568
511
569
Mockly is designed for **component testing** — testing how your application behaves when a dependency returns errors, timeouts, unexpected data, or edge-case responses. The config file is owned by the dependency team; consuming teams just load it and toggle scenarios.
@@ -788,7 +846,7 @@ Base URL: `http://localhost:9091`
0 commit comments