Exemplo n.º 1
0
    def test_is_juniper(self):
        """Testing method / function is_juniper."""
        # Test for Juniper sysObjectID
        testobj = test_class.Query(sysobjectid='.1.2.3.4.5.6.2636.101.102')
        result = testobj.is_juniper()
        self.assertEqual(result, True)

        # Test for fake vendor
        testobj = test_class.Query(
            sysobjectid='.1.2.3.4.5.6.100000000000000.101.102')
        result = testobj.is_juniper()
        self.assertEqual(result, False)
Exemplo n.º 2
0
    def enterprise_number(self):
        """Return SNMP enterprise number for the device.

        Args:
            None

        Returns:
            enterprise: SNMP enterprise number

        """
        # Get the sysObjectID.0 value of the device
        sysid = self.sysobjectid()

        # Get the vendor ID
        enterprise_obj = jm_iana_enterprise.Query(sysobjectid=sysid)
        enterprise = enterprise_obj.enterprise()

        # Return
        return enterprise
Exemplo n.º 3
0
    def misc(self):
        """Provide miscellaneous information about device and the poll.

        Args:
            None

        Returns:
            data: Aggregated data

        """
        # Initialize data
        data = defaultdict(lambda: defaultdict(dict))
        data['timestamp'] = int(time.time())
        data['host'] = self.snmp_object.hostname()

        # Get vendor information
        sysobjectid = self.snmp_object.sysobjectid()
        vendor = jm_iana_enterprise.Query(sysobjectid=sysobjectid)
        data['IANAEnterpriseNumber'] = vendor.enterprise()

        # Return
        return data
Exemplo n.º 4
0
 def test_enterprise(self):
     """Testing method / function enterprise."""
     # Initializing key variables
     testobj = test_class.Query(sysobjectid='.1.2.3.4.5.6.100.101.102')
     result = testobj.enterprise()
     self.assertEqual(result, 100)