Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smi.GetParentNode() seems to always return the Node and not the Parent #22

Closed
lparkes opened this issue Mar 20, 2021 · 1 comment
Closed

Comments

@lparkes
Copy link

lparkes commented Mar 20, 2021

Hi,
I'm using smi.GetParentNode() and it always seems to return the same node that I pass it as a parameter instead of that node's parent.

e.g. The following code

node, _ := gosmi.GetNodeByOID(oid)
log.Printf("node name: %s::%s of %s", GetModule().Name, node.Name, node.Kind)
parent := gosmi.CreateNode(smi.GetParentNode(node.GetRaw()))
log.Printf("parent name: %s::%s of %s", parent.GetModule().Name, parent.Name, parent.Kind)

produces the output

bug 2021/03/20 13:08:47 node name: IF-MIB::ifPhysAddress of Scalar
bug 2021/03/20 13:08:47 parent name: IF-MIB::ifPhysAddress of Scalar

when I'm expecting it to produce the output

bug 2021/03/20 13:08:47 node name: IF-MIB::ifPhysAddress of Scalar
bug 2021/03/20 13:08:47 parent name: IF-MIB::ifEntry of Column

I couldn't help but notice that the smi.GetParentNode() function searches for the given node a lot, but never actually dereferences the Parent field. That's probably the problem. Those data structures are sufficiently complicated that I can't work out what the correct fix is. (Any data structure in any programming language that handles ASN.1 source seems to be complicated).

Cheers

@sleepinggenius2
Copy link
Owner

Your analysis is absolutely correct. New release coming your way momentarily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants