1#!/usr/bin/env python 2############################################################################# 3# Copyright (c) 2020 One Identity 4# 5# This program is free software; you can redistribute it and/or modify it 6# under the terms of the GNU General Public License version 2 as published 7# by the Free Software Foundation, or (at your option) any later version. 8# 9# This program is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with this program; if not, write to the Free Software 16# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17# 18# As an additional exemption you are allowed to compile & link against the 19# OpenSSL libraries as published by the OpenSSL project. See the file 20# COPYING for details. 21# 22############################################################################# 23import pytest 24 25from src.helpers.snmptrapd.conftest import * # noqa:F403, F401 26 27 28@pytest.mark.snmp 29def test_snmp_dest_v2c_cisco_ios_trap(config, syslog_ng, snmptrapd, snmp_test_params): 30 generator_source = config.create_example_msg_generator_source(num=1) 31 snmp_destination = config.create_snmp_destination( 32 host=snmp_test_params.get_ip_address(), 33 port=snmptrapd.get_port(), 34 snmp_obj=snmp_test_params.get_cisco_snmp_obj(), 35 trap_obj=snmp_test_params.get_basic_trap_obj(), 36 version="v2c", 37 ) 38 config.create_logpath(statements=[generator_source, snmp_destination]) 39 40 syslog_ng.start(config) 41 42 expected_traps = snmp_test_params.get_expected_cisco_trap() 43 assert expected_traps == snmptrapd.get_traps(len(expected_traps)) 44