Alon Bar-Lev has posted comments on this change.

Change subject: notifier: modify the oid schema for SNMP notification.
......................................................................


Patch Set 4:

(3 comments)

http://gerrit.ovirt.org/#/c/32951/4/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/transport/snmp/Snmp.java
File 
backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/transport/snmp/Snmp.java:

Line 138:         v2pdu.add(new VariableBinding(SnmpConstants.sysUpTime,
Line 139:                                       new 
TimeTicks((System.nanoTime() - nanoStart) / 10000000)));
Line 140:         // { [baseoid] notifications(0) audit(1) }
Line 141:         v2pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID,
Line 142:                                       SnmpConstants.getTrapOID(new 
OID(profile.oid), ENTERPRISE_SPECIFIC, 1)));
this is much better :)))

can we have ovirtEngineNotifierNotifications as constant to 1?
Line 143: 
Line 144:         int auditLogId = AuditLogType.UNASSIGNED.getValue();
Line 145:         try {
Line 146:             auditLogId = 
AuditLogType.valueOf(event.getName()).getValue();


Line 147:         } catch (IllegalArgumentException e) {
Line 148:             log.warn("Could not find event: " + event.getName() + " 
in auditLogTypes");
Line 149:         }
Line 150:         // { [baseoid] objects(2) audit(1) }
Line 151:         OID auditObjects = new OID(profile.oid).append(2).append(1);
these also be better if have constants.

I think you can have:

 private static final OID objectsAuditSuffix = new OID(new int[] {2, 1});

and here:

 OID auditObjects = new OID(profile.oid).append(objectsAuditSuffix);
Line 152: 
Line 153:         v2pdu.add(new VariableBinding(
Line 154:             new OID(auditObjects).append(1),
Line 155:             new OctetString(event.getName())));


Line 224:             v2pdu.add(new VariableBinding(
Line 225:                 new OID(auditObjects).append(17),
Line 226:                 new OctetString(event.getStorageDomainName())));
Line 227:         }
Line 228:         if (event.getStorageDomainId() != null && 
!event.getStorageDomainId().equals(Guid.Empty)) {
can we have a function for these?

 void addString(PDU v2pdu, int instance, String x) {
     if (!StringUtils.isEmpty(x)) {
         ....
     }
 }

 void addGuide(PDU v2pdu, int instance, Guid x) {
     if (x != null && !Guid.Empty(x)) {
         addString(v2pdu, instance, x.toString());
     }
 }

please also define constants for the instance based on the mib.
Line 229:             v2pdu.add(new VariableBinding(
Line 230:                 new OID(auditObjects).append(18),
Line 231:                 new 
OctetString(event.getStorageDomainId().toString())));
Line 232:         }


-- 
To view, visit http://gerrit.ovirt.org/32951
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic8a06063f8ebbbe4d05783cb25036e870a6be3b7
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: mooli tayer <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Barak Azulay <[email protected]>
Gerrit-Reviewer: Martin PeÅ™ina <[email protected]>
Gerrit-Reviewer: Oved Ourfali <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-Reviewer: mooli tayer <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to