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

GetIndex #28

Closed
MyaLongmire opened this issue Aug 16, 2021 · 3 comments
Closed

GetIndex #28

MyaLongmire opened this issue Aug 16, 2021 · 3 comments

Comments

@MyaLongmire
Copy link

I am having an error when calling gosmi.GetIndex() saying it is not declared by gosmi. Can you please provide an example of how to use GetIndex().

@sleepinggenius2
Copy link
Owner

I'm assuming you're referring to this function:

gosmi/table.go

Line 109 in 841095e

func (t SmiNode) GetIndex() (index []SmiNode) {

If so, that method needs to be called on a row node (SmiNode with Kind==types.NodeRow) or table node (SmiNode with Kind==types.NodeTable).

@MyaLongmire
Copy link
Author

Say I run snmptranslate -Td IF-MIB::ifTable.1 and the output is

IF-MIB::ifEntry
ifEntry OBJECT-TYPE
  -- FROM	IF-MIB
  MAX-ACCESS	not-accessible
  STATUS	current
  INDEX		{ ifIndex }
  DESCRIPTION	"An entry containing management information applicable to a
            particular interface."
::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) interfaces(2) ifTable(2) 1 }

how would I get the index so it would return ifIndex?

@MyaLongmire
Copy link
Author

I figured it out.

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