コード例 #1
0
ファイル: snmp_autoload.py プロジェクト: CoYe/qualisnmp
    def __init__(self, ip, port=161, community='private'):
        """ Initialize SNMP environment and read tables.

        Read entPhysicalTable and ifTable.
        entPhysicalTable is saved in self.entPhysicalTable
        ifTable is saved in self.ifTable

        :param ip: device IP.
        :param port: device SNMP port.
        :param community: device community.
        """
        super(AutoLoad, self).__init__()

        self.snmp = QualiSnmp(ip, port, community)
        self.entPhysicalTable = self.snmp.walk(
            ('ENTITY-MIB', 'entPhysicalTable'))
        self.ifTable = self.snmp.walk(('IF-MIB', 'ifTable'))