Example #1
0
def compile_module(modname, preload=None, all=False):
    if preload:
        for pm in preload:
            SMI.load_module(pm)
    smimodule = SMI.get_module(modname)
    if not smimodule:
        print "Could not load module", modname
        return
    if all:
        for dep in _get_dependents(smimodule):
            _compile_module(SMI.get_module(dep))
    _compile_module(smimodule)
Example #2
0
def compile_module(modname, preload=None, all=False):
    if preload:
        for pm in preload:
            SMI.load_module(pm)
    smimodule = SMI.get_module(modname)
    if not smimodule:
        print "Could not load module", modname
        return
    if all:
        for dep in _get_dependents(smimodule):
            _compile_module(SMI.get_module(dep))
    _compile_module(smimodule)
Example #3
0
 def test_ipmib(self):
     ipmod = SMI.get_module("IP-MIB")
     eslist = ipmod.get_scalars()
     for es in eslist:
         print(es.name, es.syntax)
     n = ipmod.get_node("ipForwarding")
     print(n.syntax.enumerations)
Example #4
0
 def test_index(self):
     print("index test: get an Index object of a row")
     rtpmib = SMI.get_module("RTP-MIB")
     rtpsess = rtpmib.get_node("rtpSessionInverseEntry")
     rtpsess_index = rtpsess.get_index()
     for ind in rtpsess_index:
         print(rtpmib.get_node(ind.name).value)
Example #5
0
 def test_ipmib(self):
     ipmod = SMI.get_module("IP-MIB")
     eslist = ipmod.get_scalars()
     for es in eslist:
         print(es.name, es.syntax)
     n = ipmod.get_node("ipForwarding")
     print(n.syntax.enumerations)
Example #6
0
 def test_index(self):
     print("index test: get an Index object of a row")
     rtpmib = SMI.get_module("RTP-MIB")
     rtpsess = rtpmib.get_node("rtpSessionInverseEntry")
     rtpsess_index = rtpsess.get_index()
     for ind in rtpsess_index:
         print(rtpmib.get_node(ind.name).value)
Example #7
0
    def test_augments(self):
        print("augments test: should see base conceptual row index.")
        snmpmib = SMI.get_module("SNMP-COMMUNITY-MIB")

        taenode = snmpmib.get_node("snmpTargetAddrExtEntry") # base row with implied index
        taenode_index = taenode.get_index()
        print(repr(taenode_index))

        comm = snmpmib.get_node("snmpCommunityEntry") # augmented row
        comm_index = comm.get_index()
        print(repr(comm_index))

        newoid = comm.OID
        print(newoid)
Example #8
0
    def test_augments(self):
        print("augments test: should see base conceptual row index.")
        snmpmib = SMI.get_module("SNMP-COMMUNITY-MIB")

        taenode = snmpmib.get_node("snmpTargetAddrExtEntry") # base row with implied index
        taenode_index = taenode.get_index()
        print(repr(taenode_index))

        comm = snmpmib.get_node("snmpCommunityEntry") # augmented row
        comm_index = comm.get_index()
        print(repr(comm_index))

        newoid = comm.OID
        print(newoid)
Example #9
0
def _get_dependents(module, hash=None):
    h = hash or {}
    for imp in module.get_imports():
        h[imp.module] = True
        _get_dependents(SMI.get_module(imp.module), h)
    return h.keys()
Example #10
0
def _get_dependents(module, hash=None):
    h = hash or {}
    for imp in module.get_imports():
        h[imp.module] = True
        _get_dependents(SMI.get_module(imp.module), h)
    return h.keys()
Example #11
0
 def test_types(self):
     print(" types test:")
     tcmib = SMI.get_module("SNMPv2-TC")
     smi_types = tcmib.get_types()
     for smi_type in smi_types:
         print("Type: ", smi_type, smi_type.snmptype)
Example #12
0
 def test_types(self):
     print(" types test:")
     tcmib = SMI.get_module("SNMPv2-TC")
     smi_types = tcmib.get_types()
     for smi_type in smi_types:
         print("Type: ", smi_type, smi_type.snmptype)