diff options
author | elie <elie> | 2007-08-15 13:22:48 +0000 |
---|---|---|
committer | elie <elie> | 2007-08-15 13:22:48 +0000 |
commit | 0af27200e0695992076c4d4954e23d864f94f50c (patch) | |
tree | cdb7abfdab578c3802aac131cd6386a486bfd491 /pysnmp | |
parent | 64da9d974ddd60dc211a494017fb14d56c701ec6 (diff) | |
download | pysnmp-git-0af27200e0695992076c4d4954e23d864f94f50c.tar.gz |
handle noSuchName error on v1 -> v2c PDU convertion
Diffstat (limited to 'pysnmp')
-rw-r--r-- | pysnmp/proto/proxy/rfc2576.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/pysnmp/proto/proxy/rfc2576.py b/pysnmp/proto/proxy/rfc2576.py index 0511989a..c01e2cf5 100644 --- a/pysnmp/proto/proxy/rfc2576.py +++ b/pysnmp/proto/proxy/rfc2576.py @@ -144,13 +144,21 @@ def v1ToV2(v1Pdu, origV2Pdu=None): ) if rfc3411.responseClassPDUs.has_key(pduType): - # 4.1.2.2 --> one-to-one mapping - v2c.apiPDU.setErrorStatus( - v2Pdu, int(v1.apiPDU.getErrorStatus(v1Pdu)) - ) - v2c.apiPDU.setErrorIndex( - v2Pdu, int(v1.apiPDU.getErrorIndex(v1Pdu)) - ) + # 4.1.2.2.1&2 + errorStatus = int(v1.apiPDU.getErrorStatus(v1Pdu)) + errorIndex = int(v1.apiPDU.getErrorIndex(v1Pdu)) + if errorStatus == 2: # noSuchName + if origV2Pdu.tagSet == v2c.GetNextRequestPDU.tagSet: + v2VarBinds[errorIndex-1] = ( + v2VarBinds[errorIndex-1][0], exval.endOfMib + ) + else: + v2VarBinds[errorIndex-1] = ( + v2VarBinds[errorIndex-1][0], exval.noSuchObject + ) + else: # one-to-one mapping + v2c.apiPDU.setErrorStatus(v2Pdu, errorStatus) + v2c.apiPDU.setErrorIndex(v2Pdu, errorIndex) # 4.1.2.1 --> no-op |