[AGENT++] agentpro generated row_index?

dominik.vogt at external.thalesgroup.com dominik.vogt at external.thalesgroup.com
Thu Feb 24 11:14:11 CET 2011


I wonder if we are doing something wrong:  We're generating code
for a notification from a mib we wrote with agentpro 2.7.4.  This
is an excerpt of the mib:

  ...
  tatmMAGSSegmentUnitID OBJECT-TYPE
	  SYNTAX  Unsigned32
	  MAX-ACCESS read-only
	  STATUS  current
	  DESCRIPTION
		  "ID of the unit."
	  ::= { tatmMAGSSegmentUnitsEntry 1 }
  ...
  tatmMAGSSegmentNotificationAccessReq NOTIFICATION-TYPE
	  OBJECTS {
		  tatmMAGSSegmentAccessReqUnitID,
		  tatmMAGSSegmentAccessReqUnitName,
		  tatmMAGSSegmentAccessReqUserName,
		  tatmMAGSSegmentAccessReqType}
	  STATUS  current
	  DESCRIPTION
		  "Notification will be sent if an access request was insert
		  into the access request table"
	  ::= { tatmSMAAccessEvents 1 }

Now this is the prepare_vbs function generated by agentpro:

  void NotificationAccessReq::prepare_vbs(Vbx* &vbs, int &size, const int row_index)
  {
      __attribute__ ((unused)) static const char *const ident = "NotificationAccessReq::prepare_vbs";

      //insert here code needed to update the values of MIB-leafs, if neccesary!
      //--AgentGen BEGIN=tatmMAGSSegmentNotificationAccessReq::prepare_vbs:pre
      //--AgentGen END

	  size = 4;
	  vbs = new Vbx[size];
	  vbs[0] = AccessReqEntry::instance->get(nTatmMAGSSegmentAccessReqUnitID, row_index - 1)->get_value();	
	  vbs[1] = AccessReqEntry::instance->get(nTatmMAGSSegmentAccessReqUnitName, row_index - 1)->get_value();	
	  vbs[2] = AccessReqEntry::instance->get(nTatmMAGSSegmentAccessReqUserName, row_index - 1)->get_value();	
	  vbs[3] = AccessReqEntry::instance->get(nTatmMAGSSegmentAccessReqType, row_index - 1)->get_value();	

      //--AgentGen BEGIN=tatmMAGSSegmentNotificationAccessReq::prepare_vbs
      //--AgentGen END
  }

Note that the code uses (row_index - 1) as an argument to
MibTable::get().  Now we use prepare_vbs like this:

  row_index = row->index_of(index);
  foo.prepare_vbs(vbs, size, row_index);

According to the comments in mib.h both, MibTableRoww::index_of()
and MibTable::get() count the index from zero.  So if we have a
row with index 40, the notification is sent for the row with the
index 39.

Are we doing something wrong, or is this a bug?

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt



More information about the AGENTPP mailing list