View Javadoc
1   /*
2    * This file is part of Waarp Project (named also Waarp or GG).
3    *
4    *  Copyright (c) 2019, Waarp SAS, and individual contributors by the @author
5    *  tags. See the COPYRIGHT.txt in the distribution for a full listing of
6    * individual contributors.
7    *
8    *  All Waarp Project is free software: you can redistribute it and/or
9    * modify it under the terms of the GNU General Public License as published by
10   * the Free Software Foundation, either version 3 of the License, or (at your
11   * option) any later version.
12   *
13   * Waarp is distributed in the hope that it will be useful, but WITHOUT ANY
14   * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15   * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16   *
17   *  You should have received a copy of the GNU General Public License along with
18   * Waarp . If not, see <http://www.gnu.org/licenses/>.
19   */
20  package org.waarp.snmp.r66;
21  
22  import org.snmp4j.agent.DuplicateRegistrationException;
23  import org.snmp4j.agent.MOServer;
24  import org.snmp4j.agent.mo.MOAccessImpl;
25  import org.snmp4j.agent.mo.snmp.SNMPv2MIB;
26  import org.snmp4j.agent.mo.snmp.SysUpTime;
27  import org.snmp4j.smi.Integer32;
28  import org.snmp4j.smi.OID;
29  import org.snmp4j.smi.OctetString;
30  import org.snmp4j.smi.SMIConstants;
31  import org.snmp4j.smi.TimeTicks;
32  import org.waarp.common.logging.WaarpLogger;
33  import org.waarp.common.logging.WaarpLoggerFactory;
34  import org.waarp.snmp.WaarpSnmpAgent;
35  import org.waarp.snmp.interf.WaarpInterfaceMib;
36  import org.waarp.snmp.utils.MemoryGauge32;
37  import org.waarp.snmp.utils.MemoryGauge32.MemoryType;
38  import org.waarp.snmp.utils.WaarpEntry;
39  import org.waarp.snmp.utils.WaarpMORow;
40  import org.waarp.snmp.utils.WaarpMOScalar;
41  import org.waarp.snmp.utils.WaarpUptime;
42  
43  /**
44   * Private MIB for Waarp OpenR66
45   */
46  public abstract class WaarpPrivateMib implements WaarpInterfaceMib {
47    /**
48     * Internal Logger
49     */
50    private static final WaarpLogger logger =
51        WaarpLoggerFactory.getLogger(WaarpPrivateMib.class);
52  
53    // These are both standard in RFC-1213
54    /**
55     * SnmpConstants.sysDescr
56     */
57    public final String textualSysDecr;
58  
59    /**
60     * SnmpConstants.sysObjectID
61     */
62    public final OID ggObjectId; // will be smiPrivateCode.typeWaarp
63  
64    /**
65     * SnmpConstants.sysContact
66     */
67    public String contactName = "Nobody";
68  
69    /**
70     * SnmpConstants.sysName
71     */
72    public String textualName = "OpenR66";
73  
74    /**
75     * SnmpConstants.sysLocation
76     */
77    public String address = "somewhere";
78  
79    /**
80     * SnmpConstants.sysServices
81     * <p>
82     * transport + application
83     */
84    public int service = 72;
85  
86    /**
87     * SnmpConstants.sysUpTime
88     */
89    public SysUpTime upTime;
90  
91    /**
92     * need to add ".port" like "6666" Only in TCP (no UDP supported for Waarp)
93     * <p>
94     * example: rootEnterpriseMib+"66666"+".1.1.4.";
95     */
96    public final String applicationProtocolBase;
97  
98    /**
99     * will be = new OID(applicationProtocolBase+port);
100    */
101   public final OID applicationProtocol;
102 
103   /**
104    * Private MIB: not published so take an OID probably not attributed
105    */
106   public int smiPrivateCode = 66666;
107 
108   /**
109    * identification of Waarp module
110    */
111   public int smiTypeWaarp = 66; // default = 66 = R66
112   /**
113    * root OID in String
114    */
115   public final String srootOIDWaarp;
116   /**
117    * root OID
118    */
119   public final OID rootOIDWaarp;
120 
121   /**
122    * Used in Notify
123    */
124   public final OID rootOIDWaarpNotif;
125 
126   /**
127    * Used in Notify Start or Shutdown
128    */
129   public final OID rootOIDWaarpNotifStartOrShutdown;
130 
131   /**
132    * Info static part
133    */
134   public final OID rootOIDWaarpInfo;
135   /**
136    * Info Row access
137    */
138   public WaarpMORow rowInfo;
139 
140   /**
141    * Global dynamic part
142    */
143   public final OID rootOIDWaarpGlobal;
144   /**
145    * Global Row access
146    */
147   public WaarpMORow rowGlobal;
148 
149   /**
150    * Uptime OID
151    */
152   public final OID rootOIDWaarpGlobalUptime;
153 
154   /**
155    * Corresponding UpTime in Mib
156    */
157   public WaarpMOScalar scalarUptime;
158 
159   /**
160    * Detailed dynamic part
161    */
162   public final OID rootOIDWaarpDetailed;
163   /**
164    * Detailed Row access
165    */
166   public WaarpMORow rowDetailed;
167 
168   /**
169    * Error dynamic part
170    */
171   public final OID rootOIDWaarpError;
172   /**
173    * Error Row access
174    */
175   public WaarpMORow rowError;
176 
177   /**
178    * New SNMPV2 MIB
179    */
180   public SNMPv2MIB snmpv2;
181 
182   /**
183    * Corresponding agent
184    */
185   public WaarpSnmpAgent agent;
186 
187   /**
188    * @param sysdesc The System Description to associate
189    * @param port the port to show as used by the application
190    * @param smiPrivateCodeFinal the smiPrivateCode (should be 66666)
191    * @param typeWaarpObject the type of Waarp Object (should be 66)
192    * @param scontactName the contact name to show
193    * @param stextualName the textual name to show
194    * @param saddress the address to show
195    * @param iservice the service to show (should be 72)
196    */
197   protected WaarpPrivateMib(final String sysdesc, final int port,
198                             final int smiPrivateCodeFinal,
199                             final int typeWaarpObject,
200                             final String scontactName,
201                             final String stextualName, final String saddress,
202                             final int iservice) {
203     textualSysDecr = sysdesc;
204     smiPrivateCode = smiPrivateCodeFinal;
205     smiTypeWaarp = typeWaarpObject;
206     contactName = scontactName;
207     textualName = stextualName;
208     address = saddress;
209     service = iservice;
210     srootOIDWaarp =
211         rootEnterpriseMib + "." + smiPrivateCode + '.' + smiTypeWaarp;
212     applicationProtocolBase = srootOIDWaarp + ".1.1.4.";
213     ggObjectId = new OID(srootOIDWaarp);
214     applicationProtocol = new OID(applicationProtocolBase + port);
215     rootOIDWaarp = new OID(srootOIDWaarp);
216     rootOIDWaarpInfo = new OID(srootOIDWaarp + ".1");
217     rootOIDWaarpGlobal = new OID(srootOIDWaarp + ".2");
218     rootOIDWaarpGlobalUptime = new OID(
219         rootOIDWaarpGlobal + "." + WaarpGlobalValuesIndex.applUptime.getOID() +
220         ".0");
221     rootOIDWaarpDetailed = new OID(srootOIDWaarp + ".3");
222     rootOIDWaarpError = new OID(srootOIDWaarp + ".4");
223     rootOIDWaarpNotif = new OID(srootOIDWaarp + ".5.1");
224     rootOIDWaarpNotifStartOrShutdown = new OID(srootOIDWaarp + ".5.1.1.1");
225   }
226 
227   @Override
228   public final void setAgent(final WaarpSnmpAgent agent) {
229     this.agent = agent;
230   }
231 
232   @Override
233   public final OID getBaseOidStartOrShutdown() {
234     return rootOIDWaarpNotifStartOrShutdown;
235   }
236 
237   @Override
238   public final SNMPv2MIB getSNMPv2MIB() {
239     return snmpv2;
240   }
241 
242   /**
243    * Unregister and Register again the SNMPv2MIB with System adapted to this
244    * Mib
245    *
246    * @throws DuplicateRegistrationException
247    */
248   protected final void agentRegisterSystem()
249       throws DuplicateRegistrationException {
250     // Since BaseAgent registers some mibs by default we need to unregister
251     // one before we register our own sysDescr. Normally you would
252     // override that method and register the mibs that you need
253 
254     agent.unregisterManagedObject(agent.getSnmpv2MIB());
255 
256     // Register a system description, use one from you product environment
257     // to test with
258     snmpv2 = new SNMPv2MIB(new OctetString(textualSysDecr), ggObjectId,
259                            new Integer32(service));
260     snmpv2.setContact(new OctetString(contactName));
261     snmpv2.setLocation(new OctetString(address));
262     snmpv2.setName(new OctetString(textualName));
263     snmpv2.registerMOs(agent.getServer(), null);
264     if (logger.isDebugEnabled()) {
265       logger.debug("SNMPV2: {}:{}:{}:{}:{}:{}:{}", snmpv2.getContact(),
266                    snmpv2.getDescr(), snmpv2.getLocation(), snmpv2.getName(),
267                    snmpv2.getObjectID(), snmpv2.getServices(),
268                    snmpv2.getUpTime());
269     }
270     // Save UpTime reference since used everywhere
271     upTime = snmpv2.getSysUpTime();
272   }
273 
274   /**
275    * Register this MIB
276    *
277    * @throws DuplicateRegistrationException
278    */
279   protected final void defaultAgentRegisterWaarpMib()
280       throws DuplicateRegistrationException {
281     // register Static info
282     rowInfo = new WaarpMORow(this, rootOIDWaarpInfo, WaarpDefinition,
283                              MibLevel.staticInfo.ordinal());
284     rowInfo.registerMOs(agent.getServer(), null);
285     // register General info
286     rowGlobal = new WaarpMORow(this, rootOIDWaarpGlobal, WaarpGlobalValues,
287                                MibLevel.globalInfo.ordinal());
288     WaarpMOScalar memoryScalar =
289         rowGlobal.getRow()[WaarpGlobalValuesIndex.memoryTotal.ordinal()];
290     memoryScalar.setValue(new MemoryGauge32(MemoryType.TotalMemory));
291     memoryScalar =
292         rowGlobal.getRow()[WaarpGlobalValuesIndex.memoryFree.ordinal()];
293     memoryScalar.setValue(new MemoryGauge32(MemoryType.FreeMemory));
294     memoryScalar =
295         rowGlobal.getRow()[WaarpGlobalValuesIndex.memoryUsed.ordinal()];
296     memoryScalar.setValue(new MemoryGauge32(MemoryType.UsedMemory));
297     rowGlobal.registerMOs(agent.getServer(), null);
298     // setup UpTime to SysUpTime and change status
299     scalarUptime =
300         rowGlobal.getRow()[WaarpGlobalValuesIndex.applUptime.ordinal()];
301     scalarUptime.setValue(new WaarpUptime(upTime));
302     changeStatus(OperStatus.restarting);
303     changeStatus(OperStatus.up);
304     // register Detailed info
305     rowDetailed =
306         new WaarpMORow(this, rootOIDWaarpDetailed, WaarpDetailedValues,
307                        MibLevel.detailedInfo.ordinal());
308     rowDetailed.registerMOs(agent.getServer(), null);
309     // register Error info
310     rowError = new WaarpMORow(this, rootOIDWaarpError, WaarpErrorValues,
311                               MibLevel.errorInfo.ordinal());
312     rowError.registerMOs(agent.getServer(), null);
313   }
314 
315   /**
316    * Register this MIB
317    *
318    * @throws DuplicateRegistrationException
319    */
320   protected abstract void agentRegisterWaarpMib()
321       throws DuplicateRegistrationException;
322 
323   /**
324    * Unregister this MIB
325    */
326   protected final void agentUnregisterMibs() {
327     logger.debug("UnRegisterWaarp");
328     rowInfo.unregisterMOs(agent.getServer(), agent.getDefaultContext());
329     rowGlobal.unregisterMOs(agent.getServer(), agent.getDefaultContext());
330     rowDetailed.unregisterMOs(agent.getServer(), agent.getDefaultContext());
331     rowError.unregisterMOs(agent.getServer(), agent.getDefaultContext());
332   }
333 
334   @Override
335   public final void registerMOs(final MOServer server,
336                                 final OctetString context)
337       throws DuplicateRegistrationException {
338     agentRegisterSystem();
339     agentRegisterWaarpMib();
340   }
341 
342   @Override
343   public final void unregisterMOs(final MOServer server,
344                                   final OctetString context) {
345     agentUnregisterMibs();
346   }
347 
348   /**
349    * Change the status and the LastChange Timeticks
350    *
351    * @param status
352    */
353   public final void changeStatus(final OperStatus status) {
354     final WaarpMOScalar statusScalar =
355         rowGlobal.getRow()[WaarpGlobalValuesIndex.applOperStatus.ordinal()];
356     final Integer32 var = (Integer32) statusScalar.getValue();
357     if (var.getValue() != status.status) {
358       var.setValue(status.status);
359       final WaarpMOScalar lastTimeScalar =
360           rowGlobal.getRow()[WaarpGlobalValuesIndex.applLastChange.ordinal()];
361       final TimeTicks time = (TimeTicks) lastTimeScalar.getValue();
362       time.setValue(upTime.get().getValue());
363     }
364   }
365 
366   /**
367    * MIB entry levels
368    */
369   public enum MibLevel {
370     staticInfo, globalInfo, detailedInfo, errorInfo, trapInfo
371   }
372 
373   // From now the MIB definition
374 
375   /**
376    * Notification Elements
377    */
378   public enum NotificationElements {
379     TrapShutdown(1), TrapError(2), TrapWarning(3), TrapOverloaded(4),
380     InfoTask(5);
381 
382     public final int[] oid;
383 
384     NotificationElements(final int oid) {
385       this.oid = new int[] { oid };
386     }
387 
388     public final OID getOID(final OID oidBase) {
389       return new OID(oidBase.getValue(), oid);
390     }
391 
392     public final OID getOID(final OID oidBase, final int rank) {
393       final int[] ids = { oid[0], rank };
394       return new OID(oidBase.getValue(), ids);
395     }
396   }
397 
398   /**
399    * Notification for a task trap
400    */
401   public enum NotificationTasks {
402     globalStepInfo, stepInfo, rankFileInfo, stepStatusInfo, filenameInfo,
403     originalNameInfo, idRuleInfo, modeTransInfo, retrieveModeInfo,
404     startTransInfo, infoStatusInfo, requesterInfo, requestedInfo, specialIdInfo;
405 
406     public final int getOID() {
407       return ordinal() + 1;
408     }
409   }
410 
411   /**
412    * Definition part
413    */
414   public enum WaarpDefinitionIndex {
415     applName, applServerName, applVersion, applDescription, applURL,
416     applApplicationProtocol;
417 
418     public final int getOID() {
419       return ordinal() + 1;
420     }
421   }
422 
423   /**
424    * Definition part
425    */
426   public static final WaarpEntry[] WaarpDefinition = {
427       // applName
428       new WaarpEntry(SMIConstants.SYNTAX_OCTET_STRING,
429                      MOAccessImpl.ACCESS_READ_ONLY),
430       // applServerName
431       new WaarpEntry(SMIConstants.SYNTAX_OCTET_STRING,
432                      MOAccessImpl.ACCESS_READ_ONLY),
433       // applVersion
434       new WaarpEntry(SMIConstants.SYNTAX_OCTET_STRING,
435                      MOAccessImpl.ACCESS_READ_ONLY),
436       // applDescription
437       new WaarpEntry(SMIConstants.SYNTAX_OCTET_STRING,
438                      MOAccessImpl.ACCESS_READ_ONLY),
439       // applURL
440       new WaarpEntry(SMIConstants.SYNTAX_OCTET_STRING,
441                      MOAccessImpl.ACCESS_READ_ONLY),
442       // applApplicationProtocol
443       new WaarpEntry(SMIConstants.SYNTAX_OBJECT_IDENTIFIER,
444                      MOAccessImpl.ACCESS_READ_ONLY)
445   };
446 
447   /**
448    * Global part
449    */
450   public enum WaarpGlobalValuesIndex {
451     applUptime, applOperStatus, applLastChange, applInboundAssociations,
452     applOutboundAssociations, applAccumInboundAssociations,
453     applAccumOutboundAssociations, applLastInboundActivity,
454     applLastOutboundActivity, applRejectedInboundAssociations,
455     applFailedOutboundAssociations, applInboundBandwidthKBS,
456     applOutboundBandwidthKBS, nbInfoUnknown, nbInfoNotUpdated,
457     nbInfoInterrupted, nbInfoToSubmit, nbInfoError, nbInfoRunning, nbInfoDone,
458     nbStepAllTransfer, memoryTotal, memoryFree, memoryUsed, nbThreads,
459     nbNetworkConnection;
460 
461     public final int getOID() {
462       return ordinal() + 1;
463     }
464   }
465 
466   /**
467    * Global part
468    */
469   public static final WaarpEntry[] WaarpGlobalValues = {
470       // applUptime
471       new WaarpEntry(SMIConstants.SYNTAX_TIMETICKS,
472                      MOAccessImpl.ACCESS_READ_ONLY),
473       // applOperStatus
474       new WaarpEntry(SMIConstants.SYNTAX_INTEGER,
475                      MOAccessImpl.ACCESS_READ_ONLY),
476       // applLastChange
477       new WaarpEntry(SMIConstants.SYNTAX_TIMETICKS,
478                      MOAccessImpl.ACCESS_READ_ONLY),
479       // applInboundAssociations
480       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
481                      MOAccessImpl.ACCESS_READ_ONLY),
482       // applOutboundAssociations
483       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
484                      MOAccessImpl.ACCESS_READ_ONLY),
485       // applAccumInboundAssociations
486       new WaarpEntry(SMIConstants.SYNTAX_COUNTER32,
487                      MOAccessImpl.ACCESS_READ_ONLY),
488       // applAccumOutboundAssociations
489       new WaarpEntry(SMIConstants.SYNTAX_COUNTER32,
490                      MOAccessImpl.ACCESS_READ_ONLY),
491       // applLastInboundActivity
492       new WaarpEntry(SMIConstants.SYNTAX_TIMETICKS,
493                      MOAccessImpl.ACCESS_READ_ONLY),
494       // applLastOutboundActivity
495       new WaarpEntry(SMIConstants.SYNTAX_TIMETICKS,
496                      MOAccessImpl.ACCESS_READ_ONLY),
497       // applRejectedInboundAssociations
498       new WaarpEntry(SMIConstants.SYNTAX_COUNTER32,
499                      MOAccessImpl.ACCESS_READ_ONLY),
500       // applFailedOutboundAssociations
501       new WaarpEntry(SMIConstants.SYNTAX_COUNTER32,
502                      MOAccessImpl.ACCESS_READ_ONLY),
503       // Bandwidth
504       // applInboundBandwidthKBS
505       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
506                      MOAccessImpl.ACCESS_READ_ONLY),
507       // applOutboundBandwidthKBS
508       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
509                      MOAccessImpl.ACCESS_READ_ONLY),
510       // Overall status including past, future and current transfers
511       // nbInfoUnknown
512       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
513                      MOAccessImpl.ACCESS_READ_ONLY),
514       // nbInfoNotUpdated
515       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
516                      MOAccessImpl.ACCESS_READ_ONLY),
517       // nbInfoInterrupted
518       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
519                      MOAccessImpl.ACCESS_READ_ONLY),
520       // nbInfoToSubmit
521       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
522                      MOAccessImpl.ACCESS_READ_ONLY),
523       // nbInfoError
524       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
525                      MOAccessImpl.ACCESS_READ_ONLY),
526       // nbInfoRunning
527       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
528                      MOAccessImpl.ACCESS_READ_ONLY),
529       // nbInfoDone
530       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
531                      MOAccessImpl.ACCESS_READ_ONLY),
532       // Current situation of all transfers, running or not
533       // nbStepAllTransfer
534       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
535                      MOAccessImpl.ACCESS_READ_ONLY),
536       // memoryTotal
537       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
538                      MOAccessImpl.ACCESS_READ_ONLY),
539       // memoryFree
540       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
541                      MOAccessImpl.ACCESS_READ_ONLY),
542       // memoryUsed
543       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
544                      MOAccessImpl.ACCESS_READ_ONLY),
545       // nbThreads
546       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
547                      MOAccessImpl.ACCESS_READ_ONLY),
548       // nbNetworkConnection
549       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32, MOAccessImpl.ACCESS_READ_ONLY)
550   };
551 
552   /**
553    * Detailed part
554    */
555   public enum WaarpDetailedValuesIndex {
556     nbStepNotask, nbStepPretask, nbStepTransfer, nbStepPosttask, nbStepAllDone,
557     nbStepError, nbAllRunningStep, nbRunningStep, nbInitOkStep,
558     nbPreProcessingOkStep, nbTransferOkStep, nbPostProcessingOkStep,
559     nbCompleteOkStep;
560 
561     public final int getOID() {
562       return ordinal() + 1;
563     }
564   }
565 
566   /**
567    * Detailed part
568    */
569   public static final WaarpEntry[] WaarpDetailedValues = {
570       // nbStepNotask
571       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
572                      MOAccessImpl.ACCESS_READ_ONLY),
573       // nbStepPretask
574       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
575                      MOAccessImpl.ACCESS_READ_ONLY),
576       // nbStepTransfer
577       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
578                      MOAccessImpl.ACCESS_READ_ONLY),
579       // nbStepPosttask
580       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
581                      MOAccessImpl.ACCESS_READ_ONLY),
582       // nbStepAllDone
583       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
584                      MOAccessImpl.ACCESS_READ_ONLY),
585       // nbStepError
586       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
587                      MOAccessImpl.ACCESS_READ_ONLY),
588       // First on Running Transfers only
589       // nbAllRunningStep
590       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
591                      MOAccessImpl.ACCESS_READ_ONLY),
592       // nbRunningStep
593       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
594                      MOAccessImpl.ACCESS_READ_ONLY),
595       // nbInitOkStep
596       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
597                      MOAccessImpl.ACCESS_READ_ONLY),
598       // nbPreProcessingOkStep
599       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
600                      MOAccessImpl.ACCESS_READ_ONLY),
601       // nbTransferOkStep
602       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
603                      MOAccessImpl.ACCESS_READ_ONLY),
604       // nbPostProcessingOkStep
605       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
606                      MOAccessImpl.ACCESS_READ_ONLY),
607       // nbCompleteOkStep
608       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32, MOAccessImpl.ACCESS_READ_ONLY)
609   };
610 
611   /**
612    * Error part
613    */
614   public enum WaarpErrorValuesIndex {
615     nbStatusConnectionImpossible, nbStatusServerOverloaded, nbStatusBadAuthent,
616     nbStatusExternalOp, nbStatusTransferError, nbStatusMD5Error,
617     nbStatusDisconnection, nbStatusFinalOp, nbStatusUnimplemented,
618     nbStatusInternal, nbStatusWarning, nbStatusQueryAlreadyFinished,
619     nbStatusQueryStillRunning, nbStatusNotKnownHost,
620     nbStatusQueryRemotelyUnknown, nbStatusCommandNotFound,
621     nbStatusPassThroughMode, nbStatusRemoteShutdown, nbStatusShutdown,
622     nbStatusRemoteError, nbStatusStopped, nbStatusCanceled,
623     nbStatusFileNotFound, nbStatusUnknown;
624 
625     public final int getOID() {
626       return ordinal() + 1;
627     }
628   }
629 
630   /**
631    * Error part
632    */
633   public static final WaarpEntry[] WaarpErrorValues = {
634       // Error Status on all transfers
635       // nbStatusConnectionImpossible
636       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
637                      MOAccessImpl.ACCESS_READ_ONLY),
638       // nbStatusServerOverloaded
639       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
640                      MOAccessImpl.ACCESS_READ_ONLY),
641       // nbStatusBadAuthent
642       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
643                      MOAccessImpl.ACCESS_READ_ONLY),
644       // nbStatusExternalOp
645       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
646                      MOAccessImpl.ACCESS_READ_ONLY),
647       // nbStatusTransferError
648       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
649                      MOAccessImpl.ACCESS_READ_ONLY),
650       // nbStatusMD5Error
651       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
652                      MOAccessImpl.ACCESS_READ_ONLY),
653       // nbStatusDisconnection
654       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
655                      MOAccessImpl.ACCESS_READ_ONLY),
656       // nbStatusFinalOp
657       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
658                      MOAccessImpl.ACCESS_READ_ONLY),
659       // nbStatusUnimplemented
660       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
661                      MOAccessImpl.ACCESS_READ_ONLY),
662       // nbStatusInternal
663       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
664                      MOAccessImpl.ACCESS_READ_ONLY),
665       // nbStatusWarning
666       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
667                      MOAccessImpl.ACCESS_READ_ONLY),
668       // nbStatusQueryAlreadyFinished
669       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
670                      MOAccessImpl.ACCESS_READ_ONLY),
671       // nbStatusQueryStillRunning
672       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
673                      MOAccessImpl.ACCESS_READ_ONLY),
674       // nbStatusNotKnownHost
675       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
676                      MOAccessImpl.ACCESS_READ_ONLY),
677       // nbStatusQueryRemotelyUnknown
678       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
679                      MOAccessImpl.ACCESS_READ_ONLY),
680       // nbStatusCommandNotFound
681       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
682                      MOAccessImpl.ACCESS_READ_ONLY),
683       // nbStatusPassThroughMode
684       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
685                      MOAccessImpl.ACCESS_READ_ONLY),
686       // nbStatusRemoteShutdown
687       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
688                      MOAccessImpl.ACCESS_READ_ONLY),
689       // nbStatusShutdown
690       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
691                      MOAccessImpl.ACCESS_READ_ONLY),
692       // nbStatusRemoteError
693       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
694                      MOAccessImpl.ACCESS_READ_ONLY),
695       // nbStatusStopped
696       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
697                      MOAccessImpl.ACCESS_READ_ONLY),
698       // nbStatusCanceled
699       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
700                      MOAccessImpl.ACCESS_READ_ONLY),
701       // nbStatusFileNotFound
702       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32,
703                      MOAccessImpl.ACCESS_READ_ONLY),
704       // nbStatusUnknown
705       new WaarpEntry(SMIConstants.SYNTAX_GAUGE32, MOAccessImpl.ACCESS_READ_ONLY)
706   };
707 
708   /**
709    * Oper Status (as defined in Net Application SNMP)
710    */
711   public enum OperStatus {
712     up(1), down(2), halted(3), congested(4), restarting(5), quiescing(6);
713 
714     public final int status;
715 
716     OperStatus(final int status) {
717       this.status = status;
718     }
719   }
720 }