This project has moved. For the latest updates, please go here.

Get/GetNext enable/disable

Topics: bug report (break and fix), usage (how to ...)
Nov 14, 2008 at 3:58 PM
I have questions about get/getnext enable/disable. I know about the validation. Why is it enable when index 2 and 5.
GetNext should not be disabled when it reaches to last item in the current node. Can you please let me know I want
some urgent solution for it.
Thanks
Coordinator
Nov 15, 2008 at 1:33 AM
Hi Anita,

I am going to re-state the question according to my understanding and provide an answer. If you find it incorrect, let me know.

I think you mean when you use GET NEXT to walk along a table, then you find "for a specific element of the table entry object, GET NEXT returns two of them whose indexes are 2 and 5, while you expect other indexes as well."

This is hard to answer if you don't provide me more information about the table. Such behaviour of GET NEXT is strongly related to how the table objects are organized by the remote SNMP agent and sometimes the result you get is by design.

One possible cause may be that the agent maintains it as a sparse table. In such a case, there is no element for other indexes, so the agent does not insert place holders (NULL instances). Then when GET NEXT actions execute, you suddenly jump to index 2 and 5.

Another cause may be that this table in fact is a slave. It is designed in a way to hold objects related to a master table. In such a case, its content may be sparse, too. It is common to see some indexes missing.

You may also test your remote agent with another SNMP utility to see if GET NEXT gives you the same result.

Regards,

-Lex


Nov 17, 2008 at 7:33 PM

My question is regarding on what bases Get/Get Next are enabled and disabled in popup menu. I went through source code and it is enabled based on following validation. My point is why it returns true only when index is 2 or 5.

        private static bool Validate(TreeNode treeNode)
        {
            if (treeNode == null)
            {
                return false;
            }
            return treeNode.ImageIndex == 2 || treeNode.ImageIndex == 5;
        }

My another question is:

If you are in a branch - eg iso.org.dod.internet.mgmt.mib-2.snmp, and select the last entry - eg snmpProxyDrops, you can not get the GET NEXT option in the right click menu - it is disabled. Under these circumstance, the use of the GET NEXT is used to get the next valid MIB from the agent, which will be in a different branch.

Coordinator
Nov 22, 2008 at 1:10 AM
Well, the first question is about the Browser. You may find the definition for 2 and 5 in DefinitionType.cs. Generally speaking, only Scalar and Column types can be used for GET and GET NEXT. But if you want more, you can modify the source directly.

About the second one I am not sure yet. I will get back later.

-Lex
Coordinator
Nov 22, 2008 at 12:51 PM
Hi seem that I find the answer to question two.

        private void actGetNext_Update(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode != null && treeView1.SelectedNode.NextNode != null)
            {
                actGetNext.Enabled = Validate(treeView1.SelectedNode.NextNode);
            }
            else
            {
                actGetNext.Enabled = false;
            }
        }

You can change the if to,

if (treeView1.SelectedNode != null)

then everything should be fine. 

I will talk with Steve later so he may check in this change to the repository. Thank you so much for pointing out this issue.

-Lex
Coordinator
Nov 23, 2008 at 11:56 AM
Sorry that I have to correct myself here. The complete fix should be,

        private void actGetNext_Update(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode != null)
            {
                actGetNext.Enabled = Validate(treeView1.SelectedNode);
            }
            else
            {
                actGetNext.Enabled = false;
            }
        }
Marked as answer by lextm on 10/6/2013 at 9:09 PM