Skip to content

Commit 3b36689

Browse files
committed
feat: Introduce a standalone SNMP debugging script and enhance snmp_manager with debug output.
1 parent 230cb4c commit 3b36689

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

core/snmp_manager.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
import logging, json
2+
# pysnmp 7.x maintains backward compatibility with traditional hlapi imports
3+
from pysnmp.hlapi import (
4+
CommunityData, UsmUserData, SnmpEngine, UdpTransportTarget,
5+
ContextData, ObjectType, ObjectIdentity, nextCmd, getCmd
6+
)
27
try:
3-
from pysnmp.hlapi.v3arch.sync import *
4-
from pysnmp.smi.rfc1902 import ObjectIdentity, ObjectType
8+
from pysnmp.hlapi.auth import usmHMACMD5AuthProtocol, usmHMACSHAAuthProtocol
9+
from pysnmp.hlapi import (
10+
usmDESPrivProtocol, usm3DESEDEPrivProtocol, usmAesCfb128Protocol,
11+
usmAesCfb192Protocol, usmAesCfb256Protocol
12+
)
513
except ImportError:
6-
# Fallback/Debug if structure is different, but strict 7.x requires this
7-
import logging
8-
logging.error("Failed to import pysnmp.hlapi.v3arch.sync. Ensure pysnmp 7.x is installed.")
9-
raise
10-
14+
# SNMPv3 protocols might not be needed for v2c
15+
pass
1116
from core.utils import ensure_directory_exists
1217

1318
class SNMPManager:

debug_snmp.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
from pysnmp.hlapi.v3arch.sync import *
2-
from pysnmp.smi.rfc1902 import ObjectIdentity, ObjectType
1+
from pysnmp.hlapi import (
2+
CommunityData, SnmpEngine, UdpTransportTarget,
3+
ContextData, ObjectType, ObjectIdentity, getCmd
4+
)
35
import logging
46

57
# Configure logging to stdout

0 commit comments

Comments
 (0)