Examples of SnmpPduTrap


Examples of org.opennms.protocols.snmp.SnmpPduTrap

      }
       
      Mapping m = (Mapping)this.notificationMapList.get(index);
       
      // Create trap
      SnmpPduTrap trapPdu = new SnmpPduTrap();
       
      trapPdu.setTimeStamp(this.clock.uptime());
       
      // Organise the 'variable' payload
      trapPdu.setGeneric(m.getGeneric());
      trapPdu.setSpecific(m.getSpecific());
      trapPdu.setEnterprise(m.getEnterprise());
       
      // Append the specified varbinds. Get varbinds from mapping and for
      // each one of the former use the wrapper to get the corresponding
      // values

      // Get the coresponding wrapper to get access to notification payload
      NotificationWrapper wrapper =
         (NotificationWrapper)this.notificationWrapperCache.get(index);
       
      if(wrapper != null)
      {
         // Prime the wrapper with the notification contents
         wrapper.prime(n);
           
         // Iterate through mapping specified varbinds and organise values
         // for each
         List vbList = m.getVarBindList().getVarBindList();
        
         for (int i = 0; i < vbList.size(); i++)
         {
            VarBind vb = (VarBind)vbList.get(i);
               
            // Append the var bind. Interrogate read vb for OID and
            // variable tag. The later is used as the key passed to the
            // wrapper in order for it to locate the required value. That
            // value and the aforementioned OID are used to generate the
            // variable binding
            trapPdu.addVarBind(
               this.snmpVBFactory.make(vb.getOid(), wrapper.get(vb.getTag())));
         }
      }
      else
      {
View Full Code Here

Examples of org.opennms.protocols.snmp.SnmpPduTrap

            return;    
         }
      }
          
      // Cache the translated notification
      SnmpPduTrap v1TrapPdu = null;
      SnmpPduPacket v2TrapPdu = null;
      
      // Send trap. Synchronise on the subscription collection while
      // iterating
      synchronized(this.managers) {
           
         // Iterate over sessions and emit the trap on each one
         Iterator i = this.managers.iterator();
         while (i.hasNext()) {
            ManagerRecord s = (ManagerRecord)i.next();      

            try {
               switch (s.getVersion()) {
                  case SnmpAgentService.SNMPV1:
                     if (v1TrapPdu == null)
                        v1TrapPdu = this.trapFactory.generateV1Trap(n);
                    
                     // fix the agent ip in the trap depending on which local address is bound
                     v1TrapPdu.setAgentAddress(new SnmpIPAddress(s.getLocalAddress()));
                           
                     // Advance the trap counter
                     this.trapCount.advance();
                           
                     // Send
View Full Code Here

Examples of org.opennms.protocols.snmp.SnmpPduTrap

      }
       
      Mapping m = (Mapping)this.notificationMapList.get(index);
       
      // Create trap
      SnmpPduTrap trapPdu = new SnmpPduTrap();
       
      trapPdu.setTimeStamp(this.clock.uptime());
       
      // Organise the 'variable' payload
      trapPdu.setGeneric(m.getGeneric());
      trapPdu.setSpecific(m.getSpecific());
      trapPdu.setEnterprise(m.getEnterprise());
       
      // Append the specified varbinds. Get varbinds from mapping and for
      // each one of the former use the wrapper to get the corresponding
      // values

      // Get the coresponding wrapper to get access to notification payload
      NotificationWrapper wrapper =
         (NotificationWrapper)this.notificationWrapperCache.get(index);
       
      if(wrapper != null)
      {
         // Prime the wrapper with the notification contents
         wrapper.prime(n);
           
         // Iterate through mapping specified varbinds and organise values
         // for each
         List vbList = m.getVarBindList().getVarBindList();
        
         for (int i = 0; i < vbList.size(); i++)
         {
            VarBind vb = (VarBind)vbList.get(i);
               
            // Append the var bind. Interrogate read vb for OID and
            // variable tag. The later is used as the key passed to the
            // wrapper in order for it to locate the required value. That
            // value and the aforementioned OID are used to generate the
            // variable binding
            trapPdu.addVarBind(
               this.snmpVBFactory.make(vb.getOid(), wrapper.get(vb.getTag())));
         }
      }
      else
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.