Beispiel #1
0
    def test_ifphysaddress(self):
        """Testing function ifphysaddress."""
        # Initialize key variables
        oid_key = 'ifPhysAddress'
        oid = '.1.3.6.1.2.1.2.2.1.6'

        # Get results
        testobj = testimport.init_query(self.snmpobj_binary)
        results = testobj.ifphysaddress()

        # Basic testing of results
        for key, value in results.items():
            self.assertEqual(isinstance(key, int), True)
            self.assertEqual(value, self.expected_dict[key][oid_key])

        # Test that we are getting the correct OID
        results = testobj.ifphysaddress(oidonly=True)
        self.assertEqual(results, oid)
Beispiel #2
0
    def test_ifoutbroadcastpkts(self):
        """Testing function ifoutbroadcastpkts."""
        # Initialize key variables
        oid_key = 'ifOutBroadcastPkts'
        oid = '.1.3.6.1.2.1.31.1.1.1.5'

        # Get results
        testobj = testimport.init_query(self.snmpobj_integer)
        results = testobj.ifoutbroadcastpkts()

        # Basic testing of results
        for key, value in results.items():
            self.assertEqual(isinstance(key, int), True)
            self.assertEqual(value, self.expected_dict[key][oid_key])

        # Test that we are getting the correct OID
        results = testobj.ifoutbroadcastpkts(oidonly=True)
        self.assertEqual(results, oid)
Beispiel #3
0
    def test_ifindex(self):
        """Testing function ifindex."""
        # Initialize key variables
        oid_key = 'ifIndex'
        oid = '.1.3.6.1.2.1.2.2.1.1'

        # Get results
        testobj = testimport.init_query(self.snmpobj_ifindex)
        results = testobj.ifindex()

        # Basic testing of results
        for key, value in results.items():
            self.assertEqual(isinstance(key, int), True)
            self.assertEqual(value, self.expected_dict[key][oid_key])

            # The ifIndex value must match that of the key.
            # We are keying off of the ifIndex so this must be true.
            self.assertEqual(key, value)

        # Test that we are getting the correct OID
        results = testobj.ifindex(oidonly=True)
        self.assertEqual(results, oid)