From 7fdb4132b5996b02509ed0f1f66de7aeb57ad05a Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Mon, 5 Aug 2019 10:24:57 +0200 Subject: Fix malformed OBJECT-TYPE MAX-ACCESS constants --- .../v3arch/asyncore/agent/cmdrsp/implementing-snmp-table.py | 12 ++++++------ pysnmp/smi/mibs/SNMP-VIEW-BASED-ACM-MIB.py | 2 +- pysnmp/smi/mibs/SNMPv2-SMI.py | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/v3arch/asyncore/agent/cmdrsp/implementing-snmp-table.py b/examples/v3arch/asyncore/agent/cmdrsp/implementing-snmp-table.py index cedcc15e..e2d49ea8 100644 --- a/examples/v3arch/asyncore/agent/cmdrsp/implementing-snmp-table.py +++ b/examples/v3arch/asyncore/agent/cmdrsp/implementing-snmp-table.py @@ -74,23 +74,23 @@ mibBuilder.exportSymbols( '__EXAMPLE-MIB', # table object exampleTable=MibTable((1, 3, 6, 6, 1)) - .setMaxAccess('readcreate'), + .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 --- diff --git a/pysnmp/smi/mibs/SNMP-VIEW-BASED-ACM-MIB.py b/pysnmp/smi/mibs/SNMP-VIEW-BASED-ACM-MIB.py index 6deba234..4cf64858 100644 --- a/pysnmp/smi/mibs/SNMP-VIEW-BASED-ACM-MIB.py +++ b/pysnmp/smi/mibs/SNMP-VIEW-BASED-ACM-MIB.py @@ -210,7 +210,7 @@ vacmContextStatus = _VacmContextStatus_Object( (1, 3, 6, 1, 6, 3, 16, 1, 1, 1, 2), _VacmContextStatus_Type() ) -vacmContextStatus.setMaxAccess("readcreate") +vacmContextStatus.setMaxAccess("read-create") if mibBuilder.loadTexts: vacmContextStatus.setStatus('current') if mibBuilder.loadTexts: diff --git a/pysnmp/smi/mibs/SNMPv2-SMI.py b/pysnmp/smi/mibs/SNMPv2-SMI.py index 35e24635..a328ad12 100644 --- a/pysnmp/smi/mibs/SNMPv2-SMI.py +++ b/pysnmp/smi/mibs/SNMPv2-SMI.py @@ -1096,7 +1096,7 @@ class MibScalar(ManagedMibObject): | +-----MibScalarInstance """ - maxAccess = 'readonly' + maxAccess = 'read-only' _suffix = (0,) @@ -1195,7 +1195,7 @@ class MibScalar(ManagedMibObject): acFun = context.get('acFun') if acFun: - if (self.maxAccess not in ('readonly', 'readwrite', 'readcreate') or + if (self.maxAccess not in ('read-only', 'read-write', 'read-create') or acFun('read', (name, self.syntax), **context)): cbFun((name, exval.noSuchInstance), **context) return @@ -1259,7 +1259,7 @@ class MibScalar(ManagedMibObject): acFun = context.get('acFun') if acFun: - if (self.maxAccess not in ('readonly', 'readwrite', 'readcreate') or + if (self.maxAccess not in ('read-only', 'read-write', 'read-create') or acFun('read', (name, self.syntax), **context)): nextName = context.get('nextName') if nextName: @@ -1328,7 +1328,7 @@ class MibScalar(ManagedMibObject): acFun = context.get('acFun') if acFun: - if (self.maxAccess not in ('readwrite', 'readcreate') or + if (self.maxAccess not in ('read-write', 'read-create') or acFun('write', (name, self.syntax), **context)): exc = error.NotWritableError(name=name, idx=context.get('idx')) cbFun = context['cbFun'] @@ -1397,7 +1397,7 @@ class MibScalar(ManagedMibObject): acFun = context.get('acFun') if acFun: - if self.maxAccess != 'readcreate' or acFun('write', varBind, **context): + if self.maxAccess != 'read-create' or acFun('write', varBind, **context): debug.logger & debug.FLAG_ACL and debug.logger( 'createTest: %s=%r %s at %s' % (name, val, self.maxAccess, self.name)) exc = error.NoCreationError(name=name, idx=context.get('idx')) @@ -2245,7 +2245,7 @@ class MibTableColumn(MibScalar, ObjectType): acFun = context.get('acFun') if acFun: - if self.maxAccess != 'readcreate' or acFun('write', varBind, **context): + if self.maxAccess != 'read-create' or acFun('write', varBind, **context): debug.logger & debug.FLAG_ACL and debug.logger( 'destroyTest: %s=%r %s at %s' % (name, val, self.maxAccess, self.name)) exc = error.NotWritableError(name=name, idx=context.get('idx')) -- cgit v1.2.1