diff options
Diffstat (limited to 'lib/snmp')
-rw-r--r-- | lib/snmp/test/test_config/.gitignore | 18 | ||||
-rw-r--r-- | lib/snmp/test/test_config/Makefile | 56 | ||||
-rw-r--r-- | lib/snmp/test/test_config/agent/agent.conf.src | 2 | ||||
-rw-r--r-- | lib/snmp/test/test_config/modules.mk | 3 | ||||
-rw-r--r-- | lib/snmp/test/test_config/sys-agent.config.src | 9 | ||||
-rw-r--r-- | lib/snmp/test/test_config/sys-manager.config.src | 32 | ||||
-rw-r--r-- | lib/snmp/test/test_config/sys.config.src | 15 | ||||
-rw-r--r-- | lib/snmp/test/test_config/test_config.erl | 27 |
8 files changed, 112 insertions, 50 deletions
diff --git a/lib/snmp/test/test_config/.gitignore b/lib/snmp/test/test_config/.gitignore new file mode 100644 index 0000000000..60d564fe4d --- /dev/null +++ b/lib/snmp/test/test_config/.gitignore @@ -0,0 +1,18 @@ +# Sys config files (Generated) +/sys.config +/sys-agent.config +/sys-manager.config + +# Agent config files (Generated) +/agent/agent.conf +/agent/community.conf +/agent/context.conf +/agent/notify.conf +/agent/standard.conf +/agent/target_addr.conf +/agent/target_params.conf +/agent/vacm.conf + +# Manager config files (Generated) +/manager/manager.conf +/manager/usm.conf diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index 250c594af6..064c9f4689 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -30,54 +30,81 @@ VSN = $(SNMP_VSN) # ---------------------------------------------------- +# Configured variables +# ---------------------------------------------------- +# PERL = @PERL@ +PERL = perl + + +# ---------------------------------------------------- # Target Specs # ---------------------------------------------------- include modules.mk +ERL_TARGETS = $(MODULES:%=$(EBIN)/%.$(EMULATOR)) + SYS_CONFIG_SRCS = $(SYS_CONFIG_FILES:%=%.src) AGENT_CONFIG_SRCS = $(AGENT_CONFIG_FILES:%=%.src) MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_FILES:%=%.src) +CONFIG_FILES = \ + $(SYS_CONFIG_FILES) \ + $(AGENT_CONFIG_FILES) \ + $(MANAGER_CONFIG_FILES) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH) +TARGETS = \ + $(ERL_TARGETS) \ + $(CONFIG_FILES) # ---------------------------------------------------- -# SNMP FLAGS +# Release directory specification # ---------------------------------------------------- +ifeq ($(TESTROOT),) +TESTROOT=/tmp +endif +RELSYSDIR = $(TESTROOT) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- +EBIN = . + +ERL_COMPILE_FLAGS += +'{parse_transform,sys_pre_attributes}' \ + +'{attribute,insert,app_vsn,$(APP_VSN)}' + +ifeq ($(ADDR),) +ADDR = $(shell erl -noshell -s test_config ip_address -s init stop) +endif + # ---------------------------------------------------- # Targets # ---------------------------------------------------- -tests debug opt: $(SYS_CONFIG_FILES) $(AGENT_CONFIG_FILES) $(MANAGER_CONFIG_FILES) +tests debug opt: $(TARGETS) clean: - rm -f $(SYS_CONFIG_FILES) - rm -f $(AGENT_CONFIG_FILES) - rm -f $(MANAGER_CONFIG_FILES) + rm -f $(CONFIG_FILES) + rm -f $(ERL_TARGETS) rm -f core docs: $(SYS_CONFIG_FILES): $(SYS_CONFIG_SRCS) - @echo "sys: $< -> $@" + @echo "$< -> $@" + $(PERL) -p -e 's?%DIR%?$(RELSYSDIR)? ' < $< > $@ $(AGENT_CONFIG_FILES): $(AGENT_CONFIG_SRCS) - @echo "agent: $< -> $@" + @echo "$< -> $@" + $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ $(MANAGER_CONFIG_FILES): $(MANAGER_CONFIG_SRCS) - @echo "manager: $< -> $@" + @echo "$< -> $@" + $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ # ---------------------------------------------------- @@ -114,6 +141,9 @@ release_docs_spec: info: + @echo "" + @echo "RELSYSDIR = $(RELSYSDIR)" + @echo "" @echo "SYS_CONFIG_SRCS = $(SYS_CONFIG_SRCS)" @echo "SYS_CONFIG_FILES = $(SYS_CONFIG_FILES)" @echo "" @@ -123,5 +153,7 @@ info: @echo "MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_SRCS)" @echo "MANAGER_CONFIG_FILES = $(MANAGER_CONFIG_FILES)" @echo "" + @echo "ADDR = $(ADDR)" + @echo "" diff --git a/lib/snmp/test/test_config/agent/agent.conf.src b/lib/snmp/test/test_config/agent/agent.conf.src index 53830dbc3e..900e6a4282 100644 --- a/lib/snmp/test/test_config/agent/agent.conf.src +++ b/lib/snmp/test/test_config/agent/agent.conf.src @@ -15,6 +15,6 @@ {intAgentUDPPort, 4000}. -{intAgentIpAddress, [127,0,0,1]}. +{intAgentIpAddress, %ADDR%}. {snmpEngineID, "foo"}. {snmpEngineMaxMessageSize, 484}. diff --git a/lib/snmp/test/test_config/modules.mk b/lib/snmp/test/test_config/modules.mk index 54e6e22966..956bb54af3 100644 --- a/lib/snmp/test/test_config/modules.mk +++ b/lib/snmp/test/test_config/modules.mk @@ -35,3 +35,6 @@ AGENT_CONFIG_FILES = \ MANAGER_CONFIG_FILES = \ manager/manager.conf \ manager/usm.conf + +MODULES = \ + test_config diff --git a/lib/snmp/test/test_config/sys-agent.config.src b/lib/snmp/test/test_config/sys-agent.config.src index 9df2c6a6bc..eb6b0916ff 100644 --- a/lib/snmp/test/test_config/sys-agent.config.src +++ b/lib/snmp/test/test_config/sys-agent.config.src @@ -1,11 +1,12 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:10 +%% This is an example sys config file for starting the snmp application +%% with only a agent running. [{snmp, [ {agent, [ {priority, normal}, {versions, [v2]}, - {db_dir, "/ldisk/bmk/tests/snmp/seq10689/a/db"}, + {db_dir, "%DIR%/agent/db"}, {mib_storage, ets}, %% {agent_mib_storage, volatile}, {agent_mib_storage, persistent}, @@ -16,9 +17,9 @@ {agent_type, master}, {agent_verbosity, trace}, {audit_trail_log, [{type, read}, - {dir, "/ldisk/bmk/tests/snmp/seq10689/a/log"}, + {dir, "%DIR%/agent/log"}, {size, {10240,10}}]}, - {config, [{dir, "/ldisk/bmk/tests/snmp/seq10689/a/conf"}, + {config, [{dir, "%DIR%/agent/conf"}, {force_load, true}, {verbosity, trace}]}, {multi_threaded, true}, diff --git a/lib/snmp/test/test_config/sys-manager.config.src b/lib/snmp/test/test_config/sys-manager.config.src index dc795e31ab..4366263084 100644 --- a/lib/snmp/test/test_config/sys-manager.config.src +++ b/lib/snmp/test/test_config/sys-manager.config.src @@ -1,33 +1,14 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:10 +%% This is an example sys config file for starting the snmp application +%% with only a manager running. [{snmp, [ -%% {agent, -%% [ -%% {priority, normal}, -%% {versions, [v2]}, -%% {db_dir, "/home/eklajoh/tmp/snmp-config-2/a/"}, -%% {mib_storage, ets}, -%% {agent_mib_storage, volatile}, -%% {target_cache, [{verbosity,silence}]}, -%% {symbolic_store, [{verbosity,silence}]}, -%% {local_db, [{repair,true},{auto_save,5000},{verbosity,silence}]}, -%% {error_report_module, snmpa_error_logger}, -%% {agent_type, master}, -%% {agent_verbosity, silence}, -%% {config, [{dir, "/home/eklajoh/tmp/snmp-config-2/a/"}, {force_load, true}, {verbosity, silence}]}, -%% {multi_threaded, false}, -%% {mib_server, [{mibentry_override,false},{trapentry_override,false},{verbosity,silence}]}, -%% {note_store, [{timeout,30000},{verbosity,silence}]}, -%% {net_if, [{module,snmpa_net_if},{verbosity,silence},{options,[{bind_to,true},{no_reuse,false},{req_limit,infinity}]}]} -%% ] -%% }, {manager, [ {priority, normal}, {versions, [v1,v2,v3]}, - {config, [{dir, "/ldisk/bmk/tests/snmp/seq10689/m/conf"}, + {config, [{dir, "%DIR%/manager/conf"}, {verbosity, trace}, - {db_dir, "/ldisk/bmk/tests/snmp/seq10689/m/db"}, + {db_dir, "%DIR%/manager/db"}, {repair, true}, {auto_save, 5000}]}, {inform_request_behaviour, user}, @@ -37,15 +18,14 @@ {note_store, [{timeout,30000}, {verbosity,silence}]}, {audit_trail_log, [{type, read}, - {dir, "/ldisk/bmk/tests/snmp/seq10689/m/log"}, + {dir, "%DIR%/manager/log"}, {size, {10240,10}}]}, {net_if, [{module,snmpm_net_if}, {verbosity, trace}, {options, [{bind_to, true}, {no_reuse, false}, % {sndbuf, 32000}, - {recbuf, 45000} -]}]}, + {recbuf, 45000}]}]}, {def_user_mod, snmpm_user_default}, {def_user_data, undefined} ] diff --git a/lib/snmp/test/test_config/sys.config.src b/lib/snmp/test/test_config/sys.config.src index 5a0fa0624b..7e4e3b0acd 100644 --- a/lib/snmp/test/test_config/sys.config.src +++ b/lib/snmp/test/test_config/sys.config.src @@ -1,11 +1,12 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:10 +%% This is an example sys config file for starting the snmp application +%% with both an agent and a manager running. [{snmp, [ {agent, [ {priority, normal}, {versions, [v2]}, - {db_dir, "/ldisk/bmk/tests/snmp/seq10689/a/db"}, + {db_dir, "%DIR%/agent/db"}, {mib_storage, ets}, {agent_mib_storage, volatile}, {target_cache, [{verbosity,silence}]}, @@ -15,9 +16,9 @@ {agent_type, master}, {agent_verbosity, silence}, {audit_trail_log, [{type, read}, - {dir, "/ldisk/bmk/tests/snmp/seq10689/a/log"}, + {dir, "%DIR%/agent/log"}, {size, {10240,10}}]}, - {config, [{dir, "/ldisk/bmk/tests/snmp/seq10689/a/conf"}, + {config, [{dir, "%DIR%/agent/conf"}, {force_load, true}, {verbosity, silence}]}, {multi_threaded, false}, @@ -38,9 +39,9 @@ [ {priority, normal}, {versions, [v2]}, - {config, [{dir, "/ldisk/bmk/tests/snmp/seq10689/m/conf"}, + {config, [{dir, "%DIR%/manager/conf"}, {verbosity, silence}, - {db_dir, "/ldisk/bmk/tests/snmp/seq10689/m/db"}, + {db_dir, "%DIR%/manager/db"}, {repair, true}, {auto_save, 5000}]}, {inform_request_behaviour, auto}, @@ -50,7 +51,7 @@ {note_store, [{timeout, 30000}, {verbosity, silence}]}, {audit_trail_log, [{type, read}, - {dir, "/ldisk/bmk/tests/snmp/seq10689/m/log"}, + {dir, "%DIR%/manager/log"}, {size, {10240,10}}]}, {net_if, [{module,snmpm_net_if}, {verbosity, silence}, diff --git a/lib/snmp/test/test_config/test_config.erl b/lib/snmp/test/test_config/test_config.erl new file mode 100644 index 0000000000..2a94bf5e8d --- /dev/null +++ b/lib/snmp/test/test_config/test_config.erl @@ -0,0 +1,27 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2002-2010. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +-module(test_config). + +-export([ip_address/0]). + +ip_address() -> + {ok, Hostname} = inet:gethostname(), + {ok, Address} = inet:getaddr(Hostname, inet), + io:format("~w", [tuple_to_list(Address)]). |