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

MIB files not getting parsed completely #42

Open
wasim-nihal opened this issue Apr 20, 2023 · 0 comments
Open

MIB files not getting parsed completely #42

wasim-nihal opened this issue Apr 20, 2023 · 0 comments

Comments

@wasim-nihal
Copy link

Hi, I am trying to load a mib file and try parsing it and print the type of the node using SmiNode.Type field. But every time the type is <nil> when trying to print it. Note: The SmiNode is not nil but SmiNode.Type is <nil> here. I am not getting the issue here. Is something to do with the way I am loading the mib files or it is to do with the mib itself?

I am trying to load the modules as below:

func initGosmi() {
	MibFilesPath := "C:\\Users\\sn\\Downloads\\mibs"
	Modules := "COMMON-DEFINITION,ALARM-IRP,SNMPv2-CONF,SNMPv2-SMI,SNMPv2-TC"

	var mibFiles []string = strings.Split(MibFilesPath, ",")
	var modules []string = strings.Split(Modules, ",")
	gosmi.Init()
	for _, path := range mibFiles {
		gosmi.AppendPath(path)
	}

	for _, module := range modules {
		_, err := gosmi.LoadModule(module)
		if err != nil {
			fmt.Printf("Init Error: %s\n", err)
		}
	}
}

Below is the definition of the node from the mib file:

From ALARM-IRP.mib file

        nAlarmEntry OBJECT-TYPE
        SYNTAX       NAlarmEntry
        MAX-ACCESS   not-accessible
        STATUS       current
        DESCRIPTION
                "One entry in the alarm table holds one active alarm."
        INDEX { nAlarmId }
        ::= { nAlarmTable 1 }

	NAlarmEntry ::= SEQUENCE {
	                 nAlarmId                  NAlarmId,
	                 nAlarmText                NAlarmText
        }

	nAlarmText OBJECT-TYPE
	        SYNTAX      NAlarmText
	        MAX-ACCESS  read-only
	        STATUS      current
	        DESCRIPTION
	                 "This object represents the alarm text and contains
	                  basic information on the fault"
	::= { nAlarmEntry 5 }


 From COMMON-DEFINITION.mib file

	NAlarmText ::= TEXTUAL-CONVENTION
	        DISPLAY-HINT "3072t"
	        STATUS current
	        DESCRIPTION
	                "Alarm text contains information on the fault situation 
	                in the NE in human readable format"
	        SYNTAX OCTET STRING (SIZE (0..3072))
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

1 participant