Skip to content

Commit

Permalink
Fixed access descriptors for PySMI.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Mar 24, 2024
1 parent 0473e5a commit 100662a
Show file tree
Hide file tree
Showing 34 changed files with 7,066 additions and 2,130 deletions.
12 changes: 6 additions & 6 deletions examples/v3arch/asyncio/agent/cmdrsp/implementing-snmp-table.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,27 @@
mibBuilder.exportSymbols(
"__EXAMPLE-MIB",
# table object
exampleTable=MibTable((1, 3, 6, 6, 1)).setMaxAccess("readcreate"),
exampleTable=MibTable((1, 3, 6, 6, 1)).setMaxAccess("read-create"),
# table row object, also carries references to table indices
exampleTableEntry=MibTableRow((1, 3, 6, 6, 1, 5))
.setMaxAccess("readcreate")
.setMaxAccess("read-create")
.setIndexNames((0, "__EXAMPLE-MIB", "exampleTableColumn1")),
# table column: string index
exampleTableColumn1=MibTableColumn(
(1, 3, 6, 6, 1, 5, 1), v2c.OctetString()
).setMaxAccess("readcreate"),
).setMaxAccess("read-create"),
# table column: string value
exampleTableColumn2=MibTableColumn(
(1, 3, 6, 6, 1, 5, 2), v2c.OctetString()
).setMaxAccess("readcreate"),
).setMaxAccess("read-create"),
# table column: integer value with default
exampleTableColumn3=MibTableColumn(
(1, 3, 6, 6, 1, 5, 3), v2c.Integer32(123)
).setMaxAccess("readcreate"),
).setMaxAccess("read-create"),
# table column: row status
exampleTableStatus=MibTableColumn(
(1, 3, 6, 6, 1, 5, 4), RowStatus("notExists")
).setMaxAccess("readcreate"),
).setMaxAccess("read-create"),
)

# --- end of custom SNMP table definition, empty table now exists ---
Expand Down
5 changes: 1 addition & 4 deletions pysnmp/smi/mibs/ASN1-ENUMERATION.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,4 @@
#
from pyasn1.type import namedval

mibBuilder.exportSymbols(
'ASN1-ENUMERATION',
NamedValues=namedval.NamedValues
)
mibBuilder.exportSymbols("ASN1-ENUMERATION", NamedValues=namedval.NamedValues)
4 changes: 2 additions & 2 deletions pysnmp/smi/mibs/ASN1-REFINEMENT.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from pyasn1.type import constraint

mibBuilder.exportSymbols(
'ASN1-REFINEMENT',
"ASN1-REFINEMENT",
ConstraintsUnion=constraint.ConstraintsUnion,
ConstraintsIntersection=constraint.ConstraintsIntersection,
SingleValueConstraint=constraint.SingleValueConstraint,
ValueRangeConstraint=constraint.ValueRangeConstraint,
ValueSizeConstraint=constraint.ValueSizeConstraint
ValueSizeConstraint=constraint.ValueSizeConstraint,
)
4 changes: 2 additions & 2 deletions pysnmp/smi/mibs/ASN1.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from pysnmp.proto import rfc1902

mibBuilder.exportSymbols(
'ASN1',
"ASN1",
ObjectIdentifier=univ.ObjectIdentifier,
# Instead of using base ASN,1 types we use SNMPv2 SMI ones to make
# SMI objects type-compatible with SNMP protocol values
Integer=rfc1902.Integer32,
OctetString=rfc1902.OctetString
OctetString=rfc1902.OctetString,
)
259 changes: 199 additions & 60 deletions pysnmp/smi/mibs/INET-ADDRESS-MIB.py

Large diffs are not rendered by default.

113 changes: 100 additions & 13 deletions pysnmp/smi/mibs/PYSNMP-MIB.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,90 @@
# ASN.1 source http://mibs.pysnmp.com:80/asn1/PYSNMP-MIB
# Produced by pysmi-0.1.3 at Mon Apr 17 11:46:02 2017
# On host grommit.local platform Darwin version 16.4.0 by user ilya
# Using Python version 3.4.2 (v3.4.2:ab2c023a9432, Oct 5 2014, 20:42:22)
# Using Python version 3.4.2 (v3.4.2:ab2c023a9432, Oct 5 2014, 20:42:22)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ModuleIdentity, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, NotificationType, IpAddress, MibIdentifier, Unsigned32, Counter32, ObjectIdentity, Counter64, Bits, Integer32, enterprises, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "NotificationType", "IpAddress", "MibIdentifier", "Unsigned32", "Counter32", "ObjectIdentity", "Counter64", "Bits", "Integer32", "enterprises", "TimeTicks")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols(
"ASN1", "Integer", "OctetString", "ObjectIdentifier"
)
(NamedValues,) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
(
SingleValueConstraint,
ValueRangeConstraint,
ConstraintsIntersection,
ValueSizeConstraint,
ConstraintsUnion,
) = mibBuilder.importSymbols(
"ASN1-REFINEMENT",
"SingleValueConstraint",
"ValueRangeConstraint",
"ConstraintsIntersection",
"ValueSizeConstraint",
"ConstraintsUnion",
)
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols(
"SNMPv2-CONF", "NotificationGroup", "ModuleCompliance"
)
(
ModuleIdentity,
iso,
MibScalar,
MibTable,
MibTableRow,
MibTableColumn,
Gauge32,
NotificationType,
IpAddress,
MibIdentifier,
Unsigned32,
Counter32,
ObjectIdentity,
Counter64,
Bits,
Integer32,
enterprises,
TimeTicks,
) = mibBuilder.importSymbols(
"SNMPv2-SMI",
"ModuleIdentity",
"iso",
"MibScalar",
"MibTable",
"MibTableRow",
"MibTableColumn",
"Gauge32",
"NotificationType",
"IpAddress",
"MibIdentifier",
"Unsigned32",
"Counter32",
"ObjectIdentity",
"Counter64",
"Bits",
"Integer32",
"enterprises",
"TimeTicks",
)
TextualConvention, DisplayString = mibBuilder.importSymbols(
"SNMPv2-TC", "TextualConvention", "DisplayString"
)
pysnmp = ModuleIdentity((1, 3, 6, 1, 4, 1, 20408))
if mibBuilder.loadTexts: pysnmp.setRevisions(('2017-04-14 00:00', '2005-05-14 00:00',))
if mibBuilder.loadTexts: pysnmp.setLastUpdated('201704140000Z')
if mibBuilder.loadTexts: pysnmp.setOrganization('The PySNMP Project')
if mibBuilder.loadTexts: pysnmp.setContactInfo('E-mail: Lex Li <[email protected]> GitHub: https://github.com/lextudio/pysnmp')
if mibBuilder.loadTexts: pysnmp.setDescription('PySNMP top-level MIB tree infrastructure')
if mibBuilder.loadTexts:
pysnmp.setRevisions(
(
"2017-04-14 00:00",
"2005-05-14 00:00",
)
)
if mibBuilder.loadTexts:
pysnmp.setLastUpdated("201704140000Z")
if mibBuilder.loadTexts:
pysnmp.setOrganization("The PySNMP Project")
if mibBuilder.loadTexts:
pysnmp.setContactInfo(
"E-mail: Lex Li <[email protected]> GitHub: https://github.com/lextudio/pysnmp"
)
if mibBuilder.loadTexts:
pysnmp.setDescription("PySNMP top-level MIB tree infrastructure")
pysnmpObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 20408, 1))
pysnmpExamples = MibIdentifier((1, 3, 6, 1, 4, 1, 20408, 2))
pysnmpEnumerations = MibIdentifier((1, 3, 6, 1, 4, 1, 20408, 3))
Expand All @@ -35,4 +105,21 @@
pysnmpConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 20408, 5))
pysnmpCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 20408, 5, 1))
pysnmpGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 20408, 5, 2))
mibBuilder.exportSymbols("PYSNMP-MIB", pysnmpCompliances=pysnmpCompliances, pysnmpObjects=pysnmpObjects, pysnmpNotificationPrefix=pysnmpNotificationPrefix, pysnmpModuleIDs=pysnmpModuleIDs, pysnmpGroups=pysnmpGroups, pysnmpNotificationObjects=pysnmpNotificationObjects, pysnmp=pysnmp, pysnmpExperimental=pysnmpExperimental, pysnmpNotifications=pysnmpNotifications, PYSNMP_MODULE_ID=pysnmp, pysnmpEnumerations=pysnmpEnumerations, pysnmpDomains=pysnmpDomains, pysnmpAgentOIDs=pysnmpAgentOIDs, pysnmpConformance=pysnmpConformance, pysnmpExamples=pysnmpExamples)
mibBuilder.exportSymbols(
"PYSNMP-MIB",
pysnmpCompliances=pysnmpCompliances,
pysnmpObjects=pysnmpObjects,
pysnmpNotificationPrefix=pysnmpNotificationPrefix,
pysnmpModuleIDs=pysnmpModuleIDs,
pysnmpGroups=pysnmpGroups,
pysnmpNotificationObjects=pysnmpNotificationObjects,
pysnmp=pysnmp,
pysnmpExperimental=pysnmpExperimental,
pysnmpNotifications=pysnmpNotifications,
PYSNMP_MODULE_ID=pysnmp,
pysnmpEnumerations=pysnmpEnumerations,
pysnmpDomains=pysnmpDomains,
pysnmpAgentOIDs=pysnmpAgentOIDs,
pysnmpConformance=pysnmpConformance,
pysnmpExamples=pysnmpExamples,
)
149 changes: 125 additions & 24 deletions pysnmp/smi/mibs/PYSNMP-SOURCE-MIB.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,136 @@
# ASN.1 source http://mibs.pysnmp.com:80/asn1/PYSNMP-SOURCE-MIB
# Produced by pysmi-0.1.3 at Mon Apr 17 11:46:02 2017
# On host grommit.local platform Darwin version 16.4.0 by user ilya
# Using Python version 3.4.2 (v3.4.2:ab2c023a9432, Oct 5 2014, 20:42:22)
# Using Python version 3.4.2 (v3.4.2:ab2c023a9432, Oct 5 2014, 20:42:22)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion")
pysnmpModuleIDs, = mibBuilder.importSymbols("PYSNMP-MIB", "pysnmpModuleIDs")
snmpTargetAddrEntry, = mibBuilder.importSymbols("SNMP-TARGET-MIB", "snmpTargetAddrEntry")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ModuleIdentity, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, NotificationType, IpAddress, MibIdentifier, Unsigned32, Counter32, ObjectIdentity, Counter64, Bits, Integer32, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "NotificationType", "IpAddress", "MibIdentifier", "Unsigned32", "Counter32", "ObjectIdentity", "Counter64", "Bits", "Integer32", "TimeTicks")
TextualConvention, DisplayString, TAddress = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "TAddress")
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols(
"ASN1", "Integer", "OctetString", "ObjectIdentifier"
)
(NamedValues,) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
(
SingleValueConstraint,
ValueRangeConstraint,
ConstraintsIntersection,
ValueSizeConstraint,
ConstraintsUnion,
) = mibBuilder.importSymbols(
"ASN1-REFINEMENT",
"SingleValueConstraint",
"ValueRangeConstraint",
"ConstraintsIntersection",
"ValueSizeConstraint",
"ConstraintsUnion",
)
(pysnmpModuleIDs,) = mibBuilder.importSymbols("PYSNMP-MIB", "pysnmpModuleIDs")
(snmpTargetAddrEntry,) = mibBuilder.importSymbols(
"SNMP-TARGET-MIB", "snmpTargetAddrEntry"
)
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols(
"SNMPv2-CONF", "NotificationGroup", "ModuleCompliance"
)
(
ModuleIdentity,
iso,
MibScalar,
MibTable,
MibTableRow,
MibTableColumn,
Gauge32,
NotificationType,
IpAddress,
MibIdentifier,
Unsigned32,
Counter32,
ObjectIdentity,
Counter64,
Bits,
Integer32,
TimeTicks,
) = mibBuilder.importSymbols(
"SNMPv2-SMI",
"ModuleIdentity",
"iso",
"MibScalar",
"MibTable",
"MibTableRow",
"MibTableColumn",
"Gauge32",
"NotificationType",
"IpAddress",
"MibIdentifier",
"Unsigned32",
"Counter32",
"ObjectIdentity",
"Counter64",
"Bits",
"Integer32",
"TimeTicks",
)
TextualConvention, DisplayString, TAddress = mibBuilder.importSymbols(
"SNMPv2-TC", "TextualConvention", "DisplayString", "TAddress"
)
pysnmpSourceMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 20408, 3, 1, 8))
if mibBuilder.loadTexts: pysnmpSourceMIB.setRevisions(('2017-04-14 00:00', '2015-01-16 00:00',))
if mibBuilder.loadTexts: pysnmpSourceMIB.setLastUpdated('201704140000Z')
if mibBuilder.loadTexts: pysnmpSourceMIB.setOrganization('The PySNMP Project')
if mibBuilder.loadTexts: pysnmpSourceMIB.setContactInfo('E-mail: Lex Li <[email protected]> GitHub: https://github.com/lextudio/pysnmp')
if mibBuilder.loadTexts: pysnmpSourceMIB.setDescription('This MIB module defines implementation specific objects that provide variable source transport endpoints feature to SNMP Engine and Standard SNMP Applications.')
if mibBuilder.loadTexts:
pysnmpSourceMIB.setRevisions(
(
"2017-04-14 00:00",
"2015-01-16 00:00",
)
)
if mibBuilder.loadTexts:
pysnmpSourceMIB.setLastUpdated("201704140000Z")
if mibBuilder.loadTexts:
pysnmpSourceMIB.setOrganization("The PySNMP Project")
if mibBuilder.loadTexts:
pysnmpSourceMIB.setContactInfo(
"E-mail: Lex Li <[email protected]> GitHub: https://github.com/lextudio/pysnmp"
)
if mibBuilder.loadTexts:
pysnmpSourceMIB.setDescription(
"This MIB module defines implementation specific objects that provide variable source transport endpoints feature to SNMP Engine and Standard SNMP Applications."
)
pysnmpSourceMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 20408, 3, 1, 8, 1))
pysnmpSourceMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 20408, 3, 1, 8, 2))
snmpSourceAddrTable = MibTable((1, 3, 6, 1, 4, 1, 20408, 3, 1, 8, 1, 1), )
if mibBuilder.loadTexts: snmpSourceAddrTable.setStatus('current')
if mibBuilder.loadTexts: snmpSourceAddrTable.setDescription('A table of transport addresses to be used as a source in the generation of SNMP messages. This table contains additional objects for the SNMP-TRANSPORT-ADDRESS::snmpSourceAddressTable.')
snmpSourceAddrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 20408, 3, 1, 8, 1, 1, 1), )
snmpSourceAddrTable = MibTable(
(1, 3, 6, 1, 4, 1, 20408, 3, 1, 8, 1, 1),
)
if mibBuilder.loadTexts:
snmpSourceAddrTable.setStatus("current")
if mibBuilder.loadTexts:
snmpSourceAddrTable.setDescription(
"A table of transport addresses to be used as a source in the generation of SNMP messages. This table contains additional objects for the SNMP-TRANSPORT-ADDRESS::snmpSourceAddressTable."
)
snmpSourceAddrEntry = MibTableRow(
(1, 3, 6, 1, 4, 1, 20408, 3, 1, 8, 1, 1, 1),
)
snmpTargetAddrEntry.registerAugmentions(("PYSNMP-SOURCE-MIB", "snmpSourceAddrEntry"))
snmpSourceAddrEntry.setIndexNames(*snmpTargetAddrEntry.getIndexNames())
if mibBuilder.loadTexts: snmpSourceAddrEntry.setStatus('current')
if mibBuilder.loadTexts: snmpSourceAddrEntry.setDescription('A transport address to be used as a source in the generation of SNMP operations. An entry containing additional management information applicable to a particular target.')
snmpSourceAddrTAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 20408, 3, 1, 8, 1, 1, 1, 1), TAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: snmpSourceAddrTAddress.setStatus('current')
if mibBuilder.loadTexts: snmpSourceAddrTAddress.setDescription('This object contains a transport address. The format of this address depends on the value of the snmpSourceAddrTDomain object.')
if mibBuilder.loadTexts:
snmpSourceAddrEntry.setStatus("current")
if mibBuilder.loadTexts:
snmpSourceAddrEntry.setDescription(
"A transport address to be used as a source in the generation of SNMP operations. An entry containing additional management information applicable to a particular target."
)
snmpSourceAddrTAddress = MibTableColumn(
(1, 3, 6, 1, 4, 1, 20408, 3, 1, 8, 1, 1, 1, 1), TAddress()
).setMaxAccess("read-create")
if mibBuilder.loadTexts:
snmpSourceAddrTAddress.setStatus("current")
if mibBuilder.loadTexts:
snmpSourceAddrTAddress.setDescription(
"This object contains a transport address. The format of this address depends on the value of the snmpSourceAddrTDomain object."
)
pysnmpSourceMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 20408, 3, 1, 8, 2, 1))
pysnmpSourceMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 20408, 3, 1, 8, 2, 2))
mibBuilder.exportSymbols("PYSNMP-SOURCE-MIB", pysnmpSourceMIBConformance=pysnmpSourceMIBConformance, pysnmpSourceMIB=pysnmpSourceMIB, snmpSourceAddrTable=snmpSourceAddrTable, snmpSourceAddrEntry=snmpSourceAddrEntry, pysnmpSourceMIBGroups=pysnmpSourceMIBGroups, PYSNMP_MODULE_ID=pysnmpSourceMIB, snmpSourceAddrTAddress=snmpSourceAddrTAddress, pysnmpSourceMIBObjects=pysnmpSourceMIBObjects, pysnmpSourceMIBCompliances=pysnmpSourceMIBCompliances)
mibBuilder.exportSymbols(
"PYSNMP-SOURCE-MIB",
pysnmpSourceMIBConformance=pysnmpSourceMIBConformance,
pysnmpSourceMIB=pysnmpSourceMIB,
snmpSourceAddrTable=snmpSourceAddrTable,
snmpSourceAddrEntry=snmpSourceAddrEntry,
pysnmpSourceMIBGroups=pysnmpSourceMIBGroups,
PYSNMP_MODULE_ID=pysnmpSourceMIB,
snmpSourceAddrTAddress=snmpSourceAddrTAddress,
pysnmpSourceMIBObjects=pysnmpSourceMIBObjects,
pysnmpSourceMIBCompliances=pysnmpSourceMIBCompliances,
)
Loading

0 comments on commit 100662a

Please sign in to comment.