diff options
author | Ilya Etingof <etingof@gmail.com> | 2017-02-14 10:42:22 +0100 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2017-02-14 10:42:22 +0100 |
commit | 8eb880295475a1a48fcf660b4c21d46b8cf25043 (patch) | |
tree | 23acd96cc89f12682b0bbf1bf7234eac0e71ed14 /pysnmp/proto/api | |
parent | 3d26f4e8fd6c799f3c537f31f4a6a75b7e78c1e4 (diff) | |
download | pysnmp-git-8eb880295475a1a48fcf660b4c21d46b8cf25043.tar.gz |
required pyasn1 version is now 0.2.3
added matchTags, matchConstraints flags to .setComponentBy() call
Diffstat (limited to 'pysnmp/proto/api')
-rw-r--r-- | pysnmp/proto/api/v1.py | 26 | ||||
-rw-r--r-- | pysnmp/proto/api/v2c.py | 14 |
2 files changed, 19 insertions, 21 deletions
diff --git a/pysnmp/proto/api/v1.py b/pysnmp/proto/api/v1.py index a863afd5..9b62f76a 100644 --- a/pysnmp/proto/api/v1.py +++ b/pysnmp/proto/api/v1.py @@ -39,8 +39,7 @@ class VarBindAPI(object): varBind.setComponentByPosition(0, oid) if val is None: val = null - varBind.setComponentByPosition(1).getComponentByPosition(1).setComponentByType(val.getTagSet(), val, 1, - verifyConstraints=False) + varBind.setComponentByPosition(1).getComponentByPosition(1).setComponentByType(val.getTagSet(), val, verifyConstraints=False, matchTags=False, matchConstraints=False, innerFlag=True) return varBind @staticmethod @@ -59,13 +58,13 @@ class PDUAPI(object): def setDefaults(self, pdu): pdu.setComponentByPosition( - 0, getNextRequestID(), verifyConstraints=False + 0, getNextRequestID(), verifyConstraints=False, matchTags=False, matchConstraints=False ) pdu.setComponentByPosition( - 1, self._errorStatus, verifyConstraints=False + 1, self._errorStatus, verifyConstraints=False, matchTags=False, matchConstraints=False ) pdu.setComponentByPosition( - 2, self._errorIndex, verifyConstraints=False + 2, self._errorIndex, verifyConstraints=False, matchTags=False, matchConstraints=False ) pdu.setComponentByPosition(3) @@ -171,11 +170,11 @@ class TrapPDUAPI(object): except Exception: agentAddress = IpAddress('0.0.0.0') self._networkAddress = NetworkAddress().setComponentByPosition(0, agentAddress) - pdu.setComponentByPosition(0, self._entOid, verifyConstraints=False) - pdu.setComponentByPosition(1, self._networkAddress, verifyConstraints=False) - pdu.setComponentByPosition(2, self._genericTrap, verifyConstraints=False) - pdu.setComponentByPosition(3, self._zeroInt, verifyConstraints=False) - pdu.setComponentByPosition(4, self._zeroTime, verifyConstraints=False) + pdu.setComponentByPosition(0, self._entOid, verifyConstraints=False, matchTags=False, matchConstraints=False) + pdu.setComponentByPosition(1, self._networkAddress, verifyConstraints=False, matchTags=False, matchConstraints=False) + pdu.setComponentByPosition(2, self._genericTrap, verifyConstraints=False, matchTags=False, matchConstraints=False) + pdu.setComponentByPosition(3, self._zeroInt, verifyConstraints=False, matchTags=False, matchConstraints=False) + pdu.setComponentByPosition(4, self._zeroTime, verifyConstraints=False, matchTags=False, matchConstraints=False) pdu.setComponentByPosition(5) @staticmethod @@ -257,8 +256,8 @@ class MessageAPI(object): _community = univ.OctetString('public') def setDefaults(self, msg): - msg.setComponentByPosition(0, self._version, verifyConstraints=False) - msg.setComponentByPosition(1, self._community, verifyConstraints=False) + msg.setComponentByPosition(0, self._version, verifyConstraints=False, matchTags=False, matchConstraints=False) + msg.setComponentByPosition(1, self._community, verifyConstraints=False, matchTags=False, matchConstraints=False) return msg @staticmethod @@ -283,8 +282,7 @@ class MessageAPI(object): @staticmethod def setPDU(msg, value): - msg.setComponentByPosition(2).getComponentByPosition(2).setComponentByType(value.getTagSet(), value, 1, - verifyConstraints=False) + msg.setComponentByPosition(2).getComponentByPosition(2).setComponentByType(value.getTagSet(), value, verifyConstraints=False, matchTags=False, matchConstraints=False, innerFlag=True) def getResponse(self, reqMsg): rspMsg = Message() diff --git a/pysnmp/proto/api/v2c.py b/pysnmp/proto/api/v2c.py index 960c0c74..29e0ee3d 100644 --- a/pysnmp/proto/api/v2c.py +++ b/pysnmp/proto/api/v2c.py @@ -63,13 +63,13 @@ class PDUAPI(v1.PDUAPI): def setEndOfMibError(self, pdu, errorIndex): varBindList = self.getVarBindList(pdu) varBindList[errorIndex - 1].setComponentByPosition( - 1, rfc1905.endOfMibView, verifyConstraints=False + 1, rfc1905.endOfMibView, verifyConstraints=False, matchTags=False, matchConstraints=False ) def setNoSuchInstanceError(self, pdu, errorIndex): varBindList = self.getVarBindList(pdu) varBindList[errorIndex - 1].setComponentByPosition( - 1, rfc1905.noSuchInstance, verifyConstraints=False + 1, rfc1905.noSuchInstance, verifyConstraints=False, matchTags=False, matchConstraints=False ) @@ -83,13 +83,13 @@ class BulkPDUAPI(PDUAPI): def setDefaults(self, pdu): PDUAPI.setDefaults(self, pdu) pdu.setComponentByPosition( - 0, getNextRequestID(), verifyConstraints=False + 0, getNextRequestID(), verifyConstraints=False, matchTags=False, matchConstraints=False ) pdu.setComponentByPosition( - 1, self._nonRepeaters, verifyConstraints=False + 1, self._nonRepeaters, verifyConstraints=False, matchTags=False, matchConstraints=False ) pdu.setComponentByPosition( - 2, self._maxRepetitions, verifyConstraints=False + 2, self._maxRepetitions, verifyConstraints=False, matchTags=False, matchConstraints=False ) pdu.setComponentByPosition(3) @@ -160,8 +160,8 @@ class MessageAPI(v1.MessageAPI): _version = rfc1901.version.clone(1) def setDefaults(self, msg): - msg.setComponentByPosition(0, self._version, verifyConstraints=False) - msg.setComponentByPosition(1, self._community, verifyConstraints=False) + msg.setComponentByPosition(0, self._version, verifyConstraints=False, matchTags=False, matchConstraints=False) + msg.setComponentByPosition(1, self._community, verifyConstraints=False, matchTags=False, matchConstraints=False) return msg def getResponse(self, reqMsg): |