[AGENT++] Problem with READ-CREATE tables...

Fedja Jeleskovic mrawd2 at gmail.com
Thu Dec 23 20:00:28 CET 2004


Hi Frank!



> You should move the SET preparation code to the
> prepare_set_request method.

I am not quite sure which code did you have in mind here. What would you
move to the prepare_set_request() method?



On the other hand, I have another question here. Once I delete a row,
indexing is left disrupted. So if I have rows from 1 to 6, once I delete row
4, I get indexes 1, 2, 3, 5, 6 as a leftover. I would like them to look like
1, 2, 3, 4, 5 instead. What is the best way to do this? My guess is to use
MibTable object that gets passed in the RangeEntry::row_delete() member and
either remove all of the rows and create them again in the right order, but
I am not sure what and how to do this. Is there a better way and what would
need to be done?




Thanks a lot!





Fedja



----- Original Message ----- 

From: "Frank Fock" <fock at agentpp.com>

To: "Fedja Jeleskovic" <mrawd2 at gmail.com>

Cc: <agentpp at agentpp.org>

Sent: Tuesday, December 21, 2004 6:08 PM

Subject: Re: [AGENT++] Problem with READ-CREATE tables...



> Hi Fedja,
>
> Most likely your implementation of the set method returns
> SNMP_ERROR_INCONSIST_VAL which is an illegal
> error status to be returned within a commit. The one and
> only error status that can be returned is
> SNMP_ERROR_COMMIT_FAIL. AGENT++ "corrects"
> the error status on the fly. That's why you get a commitFailed
> error status returned by SNMP.
>
> You should move the SET preparation code to the
> prepare_set_request method.
>
> Hope this helps.
>
> Best regards,
> Frank
>
>
> Fedja Jeleskovic wrote:
>
> >Hi there,
> >
> >
> >
> >I am trying to implement a table with READ-CREATE objects and I am having
some problems. First, I looked at the examples that are out there, and I
couldn't find anything that can help me here. Most of the examples have some
code created, but they are mostly empty as if they came out from the
AgenPro.
> >
> >
> >
> >The table is for interfaces and I want to be able to add new ones and
remove them as well. Let say that table has only three objects in there:
> >
> >1. index,
> >
> >2. interface name
> >
> >3. row status.
> >
> >
> >
> >The real data is stored in a file somewhere where agent has read-write
access to it. Ok, here we are!
> >
> >First of all, at the start up, I create as many rows as there are
interfaces in the file and set all rowStatus objects to ACTIVE. I was
wondering whether I need to set it or it should happen automatically, but it
seems to work once I do it.
> >
> >
> >
> >Now, for the creation of the new row, I start with the rowStatus for the
new index (whatever is the next one in the line) and set it to
createAndWait(5).
> >
> >
> >
> >Then, I set all of the settable objects in the table to the new values
(in our example that is an interface name object). When done, I set the
rowStatus to active(1), but when I do that, I get COMMIT error.
> >
> >
> >
> >The actual creation of the new line in the file is executed from the
rowStatus::set() objects and code looks like following:
> >
> >int config_mib_rowStatus::set(const Vbx& vb)
> >{
> >            //--AgentGen BEGIN=empConfigRangeStatus::set
> >
> >            uint32 l;
> >
> >            MibTableRow *row = get_reference_to_row();
> >            if (vb.get_value(l) != SNMP_CLASS_SUCCESS)
> >            {
> >                        return SNMP_ERROR_WRONG_TYPE;
> >            }
> >
> >            switch (l)
> >            {
> >            case rowCreateAndGo:
> >            case rowActive:
> >                        {
> >                                    Interface_Type interface;
> >
> >                                    interface =
((config_mib_InterfaceType *)row->get_nth(1))->get_state();
> >                                    if (FALSE ==
CInterface->SetData(interface))
> >                                    {
> >                                                return
SNMP_ERROR_INCONSIST_VAL;
> >                                    }
> >                                    break;
> >                        }
> >            case rowNotInService:
> >                        {
> >                                    break;
> >                        }
> >            case rowDestroy:
> >                        {
> >                                    break;
> >                        }
> >            }
> >
> >            //--AgentGen END
> >            return snmpRowStatus::set(vb);
> >}
> >
> >
> >
> >This just doesn't work and I was wondering if anyone can help with this!
> >
> >
> >
> >
> >
> >Thanks a lot
> >
> >
> >
> >
> >Fedja
> >
> >
> >
> >
> >_______________________________________________
> >AGENTPP mailing list
> >AGENTPP at agentpp.org
> >http://agentpp.org/mailman/listinfo/agentpp
> >
> >
> >
>
>




More information about the AGENTPP mailing list