Skip to content

MIB files not getting parsed completely #42

@wasim-nihal

Description

@wasim-nihal

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions