[AGENT++] Index allocation for multi-index shared table fails
Frank Fock
fock at agentpp.com
Thu May 17 08:37:19 CEST 2018
Hi Isaac,
The problem is the AgentX standard. It defines that only the first sub-index is relevant for the index allocation.
That is, of course, below common expectations. My recommendation is to do only region registration and to leave index allocation unused. It provides not much benefit for multi-variable indexed tables.
Hope this helps anyway.
Best regards,
Frank
> On 16. May 2018, at 15:44, Isaac Nickaein <nickaein.i at gmail.com> wrote:
>
> Hi,
>
> The shared table with multi-index is defined as below:
>
> char* oid_table_root = "1.3.6.1.4.1.38523.1.2.1537.1.1.1.1.1";
>
> index_info my_index_info[2] = {
> {sNMP_SYNTAX_INT, FALSE, 1, 1},
> {sNMP_SYNTAX_INT, FALSE, 1, 1}
> };
>
> const Oidx my_index_oids[2] = {
> "1.3.6.1.4.1.38523.1.2.1537.1.1.1.1.1.1",
> "1.3.6.1.4.1.38523.1.2.1537.1.1.1.1.1.2",
> };
>
> MyTableStatus::MyTableStatus(Agentpp::SubAgentXMib* mib_root)
> : AgentXSharedTable(
> oid_table_root,
> my_index_info, 2,
> my_index_oids,
> mib_root,
> OctetStr()
> )
> {
> // Code to add columns
> }
>
>
> I have tried different ways of allocating a multi-index for this table, but
> all of them fail with error 259 (AGENTX_INDEX_ALREADY_ALLOCATED):
>
>
> void MyTableStatus::my_init_table_rows()
> {
> for(int dev_id = 0; dev_id < 10 ; dev_id++)
> {
> for(int tuner_id = 0; tuner_id < 4; tuner_id++)
> {
> // Index1 value: dev_id+1
> // Index2 value: tuner_id+1
>
> // Method 1
> // std::string index_oid_str = std::to_string(dev_id + 1) + "."
> + std::to_string(tuner_id + 1);
> // Oid index_val_oid(index_oid_str.c_str());
>
> // Method 2
> // Oid index_val_oid;
> // index_val_oid += Oid(std::to_string(dev_id + 1).c_str());
> // index_val_oid += Oid(std::to_string(tuner_id + 1).c_str());
>
> // Method 3
> unsigned long* oid_values = new unsigned long[2];
> oid_values[0] = dev_id + 1;
> oid_values[1] = tuner_id + 1;
> Oid index_val_oid(oid_values, 2);
>
> // Request new index
> Oidx index_val(index_val_oid);
> this->allocate_index(index_val);
> }
> }
> }
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> https://oosnmp.net/mailman/listinfo/agentpp
More information about the AGENTPP
mailing list