def test_send_v3_trap(self, mock_call): """Verify SNMP v3 informs are generated with the correct options """ snmp_settings = { 'traphost': 'localhost', 'version': '3', 'secname': 'eosplus', 'seclevel': 'authPriv', 'authprotocol': 'MD5', 'authpassword': '******', 'privprotocol': 'DES', 'privpassword': '******' } msg = "This is a test message" send_trap(snmp_settings, msg, uptime=0, test=True) mock_call.assert_called_with([ 'snmptrap', '-v', snmp_settings['version'], '-Ci', '-l', snmp_settings['seclevel'], '-u', snmp_settings['secname'], '-a', snmp_settings['authprotocol'], '-A', snmp_settings['authpassword'], '-x', snmp_settings['privprotocol'], '-X', snmp_settings['privpassword'], snmp_settings['traphost'], '0', '.1.3.6.1.4.1.30065', '.1.3.6.1.4.1.30065.6', 's', msg ])
def test_send_v3_trap(self, mock_call): """Verify SNMP v3 informs are generated with the correct options """ snmp_settings = {'traphost': 'localhost', 'version': '3', 'secname': 'eosplus', 'seclevel': 'authPriv', 'authprotocol': 'MD5', 'authpassword': '******', 'privprotocol': 'DES', 'privpassword': '******' } msg = "This is a test message" send_trap(snmp_settings, msg, uptime=0, test=True) mock_call.assert_called_with(['snmptrap', '-v', snmp_settings['version'], '-Ci', '-l', snmp_settings['seclevel'], '-u', snmp_settings['secname'], '-a', snmp_settings['authprotocol'], '-A', snmp_settings['authpassword'], '-x', snmp_settings['privprotocol'], '-X', snmp_settings['privpassword'], snmp_settings['traphost'], '0', '.1.3.6.1.4.1.30065', '.1.3.6.1.4.1.30065.6', 's', msg])
def test_send_v2_trap(self, mock_call): """Verify snmp v2c traps are called with the right settings """ snmp_settings = { 'traphost': 'localhost', 'community': 'eosplus', 'version': '2c', } msg = "This is a test message" send_trap(snmp_settings, msg, uptime=0, test=True) mock_call.assert_called_with([ 'snmptrap', '-v', snmp_settings['version'], '-c', snmp_settings['community'], snmp_settings['traphost'], '0', '.1.3.6.1.4.1.30065', '.1.3.6.1.4.1.30065.6', 's', msg ])
def test_send_v2_trap(self, mock_call): """Verify snmp v2c traps are called with the right settings """ snmp_settings = {'traphost': 'localhost', 'community': 'eosplus', 'version': '2c', } msg = "This is a test message" send_trap(snmp_settings, msg, uptime=0, test=True) mock_call.assert_called_with(['snmptrap', '-v', snmp_settings['version'], '-c', snmp_settings['community'], snmp_settings['traphost'], '0', '.1.3.6.1.4.1.30065', '.1.3.6.1.4.1.30065.6', 's', msg])