oscerd opened a new pull request, #2990:
URL: https://github.com/apache/camel-kamelets/pull/2990
Fixes #738.
The issue asks for "a camel-snmp kamelet" without saying which shape. The
component's own description — *"Receive traps and poll SNMP capable devices"* —
is consumer shaped, and polling/trap-listening is what SNMP is overwhelmingly
used for in an integration, so this adds a **source**. A producer Kamelet for
GET/SET could follow if there is demand; happy to take that as a follow-up
rather than guess at it now.
```yaml
from:
uri: "snmp:{{host}}:{{port}}"
parameters:
type: "{{type}}"
oids: "{{?oids}}"
protocol: "{{protocol}}"
delay: "{{delay}}"
snmpVersion: "{{snmpVersion}}"
snmpCommunity: "{{snmpCommunity}}"
treeList: "{{treeList}}"
securityName: "{{?securityName}}"
securityLevel: "{{securityLevel}}"
authenticationProtocol: "{{?authenticationProtocol}}"
authenticationPassphrase: "{{?authenticationPassphrase}}"
privacyProtocol: "{{?privacyProtocol}}"
privacyPassphrase: "{{?privacyPassphrase}}"
steps:
- to: "kamelet:sink"
```
## Properties
Only `host` is required. `type` selects the mode; `oids` lists what to query.
| property | default | notes |
|---|---|---|
| `host` | — | **required** |
| `port` | `161` | 161 for polling, 162 for trap listening |
| `type` | `POLL` | enum: `POLL` / `GET_NEXT` / `TRAP` |
| `oids` | — | comma separated; needed for `POLL` and `GET_NEXT`, unused for
`TRAP` |
| `protocol` | `udp` | enum: `udp` / `tcp` |
| `delay` | `60000` | poll interval; unused for `TRAP` |
| `snmpVersion` | `0` | `0`=v1, `1`=v2c, `3`=v3 |
| `snmpCommunity` | `public` | credentials descriptor — see below |
| `treeList` | `false` | `GET_NEXT` only |
| `securityName` | — | v3, credentials descriptor |
| `securityLevel` | `3` | v3: `1`=noAuthNoPriv, `2`=authNoPriv, `3`=authPriv
|
| `authenticationProtocol` | — | enum: `MD5` / `SHA1` |
| `authenticationPassphrase` | — | `format: password` + credentials |
| `privacyProtocol` | — | e.g. `DES`, `AES128` |
| `privacyPassphrase` | — | `format: password` + credentials |
## On the community string
`snmpCommunity` keeps the component default of `public`. I want to be
explicit about that choice rather than let it pass unnoticed, given the
catalog's secure-by-default direction.
SNMP v1 and v2c send the community string **in clear text on the wire**.
Changing the Kamelet default from `public` to something else would not make it
secret — it would just make the Kamelet fail against devices left on the
default, while still transmitting the value unencrypted. The real mitigation is
v3 with authPriv, so the Kamelet:
- marks `snmpCommunity` with the credentials descriptor so tooling groups it
with secrets,
- says in the property description that it is a clear-text shared secret,
- and points at `snmpVersion: 3` in the Kamelet description itself.
`securityLevel` defaults to `3` (authPriv), the strongest of the three, so
an operator who moves to v3 gets authentication *and* privacy unless they
deliberately weaken it.
Happy to be overruled if reviewers would rather have no default community at
all.
## Verification
`script/validator` reports no errors, `script/generator` adds the `nav.adoc`
entry, `mvn clean install` passes from the repository root.
Parameter binding checked against the real component with `camel run` rather
than by eye — unlike a network-dependent sink this one starts cleanly with no
device present:
```
Routes startup (total:1 started:1 kamelets:1)
Started snmp-probe (kamelet:snmp-source)
Apache Camel 4.21.0-SNAPSHOT (snmp-probe) started in 175ms
```
All thirteen parameters bound with no `unknown option` error; the consumer
then polls a device that is not there, which is the expected quiet outcome.
**No Citrus test** — exercising this needs a real SNMP agent and the
project's Citrus/Testcontainers toolchain has none, so it is marked `Preview`
and does not carry `kamelet.verified=true`.
The icon is a plain SVG glyph authored for this Kamelet, consistent with how
other protocol-based Kamelets (`ssh-sink`, `ftp-sink`) use generic glyphs
rather than a vendor logo.
---
_Claude Code on behalf of Andrea Cosentino_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]