To interface with a Cordex of Alpha Technologies, I need to use the SNMP protocol. I've been going through the documentation and examples from pysnmp in order to get some aspects working, and I have particular issues when using external MIB files from alpha technologies. My first test was the following:
from pysnmp.hlapi import *
from pysnmp.smi import builder, view, compiler, rfc1902
from pysnmp import debug
#debug.setLogger(debug.Debug('all'))
debug.setLogger(debug.Debug('msgproc', 'mibbuild'))
mibBuilder = builder.MibBuilder()
mibViewController = view.MibViewController(mibBuilder)
test = ObjectIdentity('SNMPv2-MIB', 'sysDescr').addAsn1MibSource('file:///C:/Users/SLN9000/Repositories/cordex/MIB/@mib@')
test.resolveWithMib(mibViewController)
test.getOid()
when I do this it correctly prints out the correct OID:
>>> ObjectName('1.3.6.1.2.1.1.1')
However, when looking at the debug logs, it seems to be using the compiled MIB files from the pysnmp library instead of the ASN.1 files located in "C:/Users/SLN9000/Repositories/cordex/MIB/@mib@". When I do something similar for the MIB file from Alpha technologies
from pysnmp.hlapi import *
from pysnmp.smi import builder, view, compiler, rfc1902
from pysnmp import debug
#debug.setLogger(debug.Debug('all'))
debug.setLogger(debug.Debug('msgproc', 'mibbuild'))
mibBuilder = builder.MibBuilder()
mibViewController = view.MibViewController(mibBuilder)
test = ObjectIdentity('03409602D__Alpha_System_Controller', 'dcpower', 1).addAsn1MibSource('file:///C:/Users/SLN9000/Repositories/cordex/MIB/')
test.resolveWithMib(mibViewController)
test.getOid()
It fails at the step test.resolveWithMib(mibViewController)
with the error
pysnmp.smi.error.MibNotFoundError: 03409602D__Alpha_System_Controller compilation error(s): missing
It's not completely clear to me what I am doing wrong. The MIB file I am using can be downloaded from here. Any help is appreciated!