예제 #1
0
 def test__parse_driver_info_snmp_port_default(self):
     # Make sure default SNMP UDP port numbers are correct
     info = dict(INFO_DICT)
     del info['snmp_port']
     node = self._get_test_node(info)
     info = snmp._parse_driver_info(node)
     self.assertEqual(161, info.get('port'))
예제 #2
0
 def test__parse_driver_info_snmp_v1(self):
     # Make sure SNMPv1 is parsed with a community string.
     info = db_utils.get_test_snmp_info(snmp_version='1',
                                        snmp_community='public')
     node = self._get_test_node(info)
     info = snmp._parse_driver_info(node)
     self.assertEqual('1', info.get('version'))
     self.assertEqual('public', info.get('community'))
예제 #3
0
 def test__parse_driver_info_default_version(self):
     # Make sure version defaults to 1 when it is missing.
     info = dict(INFO_DICT)
     del info['snmp_version']
     node = self._get_test_node(info)
     info = snmp._parse_driver_info(node)
     self.assertEqual('1', info.get('version'))
     self.assertEqual(INFO_DICT['snmp_community'], info.get('community'))
예제 #4
0
 def test__parse_driver_info_snmp_v3(self):
     # Make sure SNMPv3 is parsed with a security string.
     info = db_utils.get_test_snmp_info(snmp_version='3',
                                        snmp_security='pass')
     node = self._get_test_node(info)
     info = snmp._parse_driver_info(node)
     self.assertEqual('3', info.get('version'))
     self.assertEqual('pass', info.get('security'))
예제 #5
0
 def test__parse_driver_info_default(self):
     # Make sure we get back the expected things.
     node = self._get_test_node(INFO_DICT)
     info = snmp._parse_driver_info(node)
     self.assertEqual(INFO_DICT['snmp_driver'], info.get('driver'))
     self.assertEqual(INFO_DICT['snmp_address'], info.get('address'))
     self.assertEqual(INFO_DICT['snmp_port'], str(info.get('port')))
     self.assertEqual(INFO_DICT['snmp_outlet'], info.get('outlet'))
     self.assertEqual(INFO_DICT['snmp_version'], info.get('version'))
     self.assertEqual(INFO_DICT.get('snmp_community'),
                      info.get('community'))
     self.assertEqual(INFO_DICT.get('snmp_security'),
                      info.get('security'))
예제 #6
0
 def test__parse_driver_info_teltronix(self):
     # Make sure the Teltronix driver type is parsed.
     info = db_utils.get_test_snmp_info(snmp_driver='teltronix')
     node = self._get_test_node(info)
     info = snmp._parse_driver_info(node)
     self.assertEqual('teltronix', info.get('driver'))
예제 #7
0
 def test__parse_driver_info_eatonpower(self):
     # Make sure the Eaton Power driver type is parsed.
     info = db_utils.get_test_snmp_info(snmp_driver='eatonpower')
     node = self._get_test_node(info)
     info = snmp._parse_driver_info(node)
     self.assertEqual('eatonpower', info.get('driver'))
예제 #8
0
 def test__parse_driver_info_apc(self):
     # Make sure the APC driver type is parsed.
     info = db_utils.get_test_snmp_info(snmp_driver='apc')
     node = self._get_test_node(info)
     info = snmp._parse_driver_info(node)
     self.assertEqual('apc', info.get('driver'))
예제 #9
0
 def test__parse_driver_info_snmp_port(self):
     # Make sure non-default SNMP UDP port numbers can be configured
     info = db_utils.get_test_snmp_info(snmp_port='10161')
     node = self._get_test_node(info)
     info = snmp._parse_driver_info(node)
     self.assertEqual(10161, info.get('port'))