NIFI-10019: SendTrapSNMP works without flowfile, upgraded to JUnit5#6046
NIFI-10019: SendTrapSNMP works without flowfile, upgraded to JUnit5#6046Lehel44 wants to merge 5 commits intoapache:mainfrom
Conversation
nandorsoma
left a comment
There was a problem hiding this comment.
Hey @Lehel44!
Thank you for this contribution! I have tested the feature with ListenTrapSNMP receiving SendTrapSNMP's request. I have inline comments and I also found this bug during testing:
When I set Generic Trap Type to 1 and Specific Trap Type to 3 I get a validation exception, but after that a NullPointerException too. I think we shouldn't be able to start the processor and then we won't get the second exception.
java.lang.IllegalArgumentException: Invalid argument: Generic Trap Type is not [6 - Enterprise Specific] but Specific Trap Type is provided.
at org.apache.nifi.snmp.configuration.V1TrapConfiguration$Builder.build(V1TrapConfiguration.java:112)
at org.apache.nifi.snmp.processors.SendTrapSNMP.onTrigger(SendTrapSNMP.java:145)
…
2022-05-20 14:23:37,376 ERROR [Timer-Driven Process Thread-9] o.a.nifi.snmp.processors.SendTrapSNMP SendTrapSNMP[id=e14c1a22-0180-1000-8d49-668bf9378c73] Processing halted: yielding [1 sec]
java.lang.NullPointerException: null
at org.apache.nifi.controller.repository.StandardProcessSession.getRecord(StandardProcessSession.java:800)
at org.apache.nifi.controller.repository.StandardProcessSession.validateRecordState(StandardProcessSession.java:3701)
at org.apache.nifi.controller.repository.StandardProcessSession.penalize(StandardProcessSession.java:2195)
Fully configured processor looked like this when I was testing:

If I understand correctly Specific Trap Type is only needed when Generic Trap Type is 6. Shouldn't we make that property depends on the other? Also would it make sense to select the values instead of using a text field?
Another things I've found during testing, but they are not part of the PR:
- If 0 value for port is invalid, then why it is the default value? Why don't we init it with null value or with a standard port if there is any for this protocol?
- ListenTrapSNMP ran almost a million times, while for example ListenTCP ran 556 times in the same interval.
- More interesting is that ListenTCP measured correctly the Time for the task, but ListenTrapSNMP not, while as I said both were running for about 5 secs. Please see the screenshots below:


...-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/processors/SendTrapSNMP.java
Show resolved
Hide resolved
...nmp-processors/src/test/java/org/apache/nifi/snmp/configuration/V1TrapConfigurationTest.java
Show resolved
Hide resolved
...bundle/nifi-snmp-processors/src/test/java/org/apache/nifi/snmp/operations/SNMPRequestIT.java
Outdated
Show resolved
Hide resolved
...nmp-bundle/nifi-snmp-processors/src/test/java/org/apache/nifi/snmp/processors/GetSNMPIT.java
Outdated
Show resolved
Hide resolved
...nmp-bundle/nifi-snmp-processors/src/test/java/org/apache/nifi/snmp/processors/SetSNMPIT.java
Outdated
Show resolved
Hide resolved
|
@nandorsoma Thank you for the review! I will check the ListenTrapSNMP running times in #6034 as this PR deals only with SendTrapSNMP. |
nandorsoma
left a comment
There was a problem hiding this comment.
Hey @Lehel44!
Thank you for the additional changes. I have one question inline and also responded to you in one of our previous conversation.
...nmp-bundle/nifi-snmp-processors/src/test/java/org/apache/nifi/snmp/processors/GetSNMPIT.java
Outdated
Show resolved
Hide resolved
|
Oh, and an extra one: Shouldn't additional commits start with the ticket number? |
|
No, it will be squashed in the end. |
...-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/processors/SendTrapSNMP.java
Show resolved
Hide resolved
|
LGTM, thanks for your work @Lehel44! |
Summary
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000Pull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation