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

Fedja Jeleskovic mrawd2 at gmail.com
Tue Dec 21 23:46:32 CET 2004


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

 

 



More information about the AGENTPP mailing list