From d49bdb7c372c93d5b8007cbc016a587d91539fe9 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 10 Dec 2010 13:41:38 +0100 Subject: "Completed" sed'ing of config files. --- lib/snmp/test/test_config/Makefile | 36 +++++++++++++++++----- lib/snmp/test/test_config/agent/agent.conf.src | 1 - lib/snmp/test/test_config/agent/community.conf.src | 1 - lib/snmp/test/test_config/agent/context.conf.src | 1 - lib/snmp/test/test_config/agent/notify.conf.src | 1 - lib/snmp/test/test_config/agent/standard.conf.src | 15 +++++---- .../test/test_config/agent/target_addr.conf.src | 5 ++- .../test/test_config/agent/target_params.conf.src | 1 - lib/snmp/test/test_config/agent/vacm.conf.src | 1 - lib/snmp/test/test_config/manager/manager.conf.src | 2 +- lib/snmp/test/test_config/snmp_test_config.erl | 32 +++++++++++++++++++ lib/snmp/test/test_config/test_config.erl | 27 ---------------- 12 files changed, 71 insertions(+), 52 deletions(-) create mode 100644 lib/snmp/test/test_config/snmp_test_config.erl delete mode 100644 lib/snmp/test/test_config/test_config.erl (limited to 'lib/snmp/test') diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index 064c9f4689..446e7d8adf 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -68,7 +68,7 @@ RELSYSDIR = $(TESTROOT) # ---------------------------------------------------- -# FLAGS +# FLAGS AND VARIABLES # ---------------------------------------------------- EBIN = . @@ -77,9 +77,26 @@ 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) +ADDR = $(shell erl -noshell -s snmp_test_config ip_address -s init stop) endif +ifeq ($(TARGET_NAME_PRE),) +TARGET_NAME_PRE = $(shell erl -noshell -s snmp_test_config ip_address2 -s init stop) +endif + +ifeq ($(SYS_CONTACT),) +SYS_CONTACT = foo@bar.ericsson.se +endif + +ifeq ($(SYS_LOCATION),) +SYS_LOCATION = Erlang/OTP +endif + +ifeq ($(SYS_NAME),) +SYS_NAME = FOO +endif + + # ---------------------------------------------------- # Targets @@ -94,15 +111,19 @@ clean: docs: -$(SYS_CONFIG_FILES): $(SYS_CONFIG_SRCS) +%.config: %.config.src @echo "$< -> $@" $(PERL) -p -e 's?%DIR%?$(RELSYSDIR)? ' < $< > $@ -$(AGENT_CONFIG_FILES): $(AGENT_CONFIG_SRCS) +agent/%.conf: agent/%.conf.src @echo "$< -> $@" - $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ + sed -e 's?%ADDR%?$(ADDR)? ' \ + -e 's?%SYS_CONTACT%?$(SYS_CONTACT)? ' \ + -e 's?%SYS_LOCATION%?$(SYS_LOCATION)? ' \ + -e 's?%SYS_NAME%?$(SYS_NAME)? ' \ + -e 's?%TARGET_NAME_PRE%?$(TARGET_NAME_PRE)? ' < $< > $@ -$(MANAGER_CONFIG_FILES): $(MANAGER_CONFIG_SRCS) +manager/%.conf: manager/%.conf.src @echo "$< -> $@" $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ @@ -153,7 +174,8 @@ info: @echo "MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_SRCS)" @echo "MANAGER_CONFIG_FILES = $(MANAGER_CONFIG_FILES)" @echo "" - @echo "ADDR = $(ADDR)" + @echo "ADDR = $(ADDR)" + @echo "TARGET_NAME_PRE = $(TARGET_NAME_PRE)" @echo "" diff --git a/lib/snmp/test/test_config/agent/agent.conf.src b/lib/snmp/test/test_config/agent/agent.conf.src index 900e6a4282..2977cd49f8 100644 --- a/lib/snmp/test/test_config/agent/agent.conf.src +++ b/lib/snmp/test/test_config/agent/agent.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the Agent local configuration info %% The data is inserted into the snmpEngine* variables defined %% in SNMP-FRAMEWORK-MIB, and the intAgent* variables defined diff --git a/lib/snmp/test/test_config/agent/community.conf.src b/lib/snmp/test/test_config/agent/community.conf.src index 4661267950..8dccb929c9 100644 --- a/lib/snmp/test/test_config/agent/community.conf.src +++ b/lib/snmp/test/test_config/agent/community.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the community info which maps to VACM parameters. %% The data is inserted into the snmpCommunityTable defined %% in SNMP-COMMUNITY-MIB. diff --git a/lib/snmp/test/test_config/agent/context.conf.src b/lib/snmp/test/test_config/agent/context.conf.src index 56000d0308..ea8b5a97eb 100644 --- a/lib/snmp/test/test_config/agent/context.conf.src +++ b/lib/snmp/test/test_config/agent/context.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the contexts known to the agent. %% The data is inserted into the vacmContextTable defined %% in SNMP-VIEW-BASED-ACM-MIB. diff --git a/lib/snmp/test/test_config/agent/notify.conf.src b/lib/snmp/test/test_config/agent/notify.conf.src index b63668f4fd..164fd25b95 100644 --- a/lib/snmp/test/test_config/agent/notify.conf.src +++ b/lib/snmp/test/test_config/agent/notify.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the notification parameters. %% The data is inserted into the snmpNotifyTable defined %% in SNMP-NOTIFICATION-MIB. diff --git a/lib/snmp/test/test_config/agent/standard.conf.src b/lib/snmp/test/test_config/agent/standard.conf.src index 9bcca18b5e..31e04e7695 100644 --- a/lib/snmp/test/test_config/agent/standard.conf.src +++ b/lib/snmp/test/test_config/agent/standard.conf.src @@ -1,11 +1,10 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the STANDARD-MIB info. %% Each row is a 2-tuple: %% {StandardVariable, Value}. %% For example %% {sysDescr, "Erlang SNMP agent"}. %% {sysObjectID, [1,2,3]}. -%% {sysContact, "{mbj,eklas}@erlang.ericsson.se"}. +%% {sysContact, "foo@bar.ericsson.se"}. %% {sysName, "test"}. %% {sysLocation, "erlang"}. %% {sysServices, 72}. @@ -13,10 +12,10 @@ %% -{sysDescr, "Erlang SNMP agent"}. -{sysObjectID, [1,2,3]}. -{sysContact, "{mbj,eklas}@erlang.ericsson.se"}. -{sysLocation, "erlang"}. -{sysServices, 72}. +{sysDescr, "Erlang SNMP agent"}. +{sysObjectID, [1,2,3]}. +{sysContact, "%SYS_CONTACT%"}. +{sysLocation, "%SYS_LOCATION%"}. +{sysServices, 72}. {snmpEnableAuthenTraps, disabled}. -{sysName, "foo"}. +{sysName, "%SYS_NAME%"}. diff --git a/lib/snmp/test/test_config/agent/target_addr.conf.src b/lib/snmp/test/test_config/agent/target_addr.conf.src index 2c7a6a15ad..740df74ecf 100644 --- a/lib/snmp/test/test_config/agent/target_addr.conf.src +++ b/lib/snmp/test/test_config/agent/target_addr.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the target address parameters. %% The data is inserted into the snmpTargetAddrTable defined %% in SNMP-TARGET-MIB, and in the snmpTargetAddrExtTable defined @@ -18,5 +17,5 @@ %% -{"127.0.0.1 v2", [127,0,0,1], 5000, 1500, 3, "std_trap", "target_v2", "", [], 2048}. -{"127.0.0.1 v2.2", [127,0,0,1], 5000, 1500, 3, "std_inform", "target_v2", "", [], 2048}. +{"%TARGET_NAME_PRE% v2", %ADDR%, 5000, 1500, 3, "std_trap", "target_v2", "", [], 2048}. +{"%TARGET_NAME_PRE% v2.2", %ADDR%, 5000, 1500, 3, "std_inform", "target_v2", "", [], 2048}. diff --git a/lib/snmp/test/test_config/agent/target_params.conf.src b/lib/snmp/test/test_config/agent/target_params.conf.src index 8e89b91d81..a4a535baa2 100644 --- a/lib/snmp/test/test_config/agent/target_params.conf.src +++ b/lib/snmp/test/test_config/agent/target_params.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the target parameters. %% The data is inserted into the snmpTargetParamsTable defined %% in SNMP-TARGET-MIB. diff --git a/lib/snmp/test/test_config/agent/vacm.conf.src b/lib/snmp/test/test_config/agent/vacm.conf.src index c7dc5170c2..86271443ad 100644 --- a/lib/snmp/test/test_config/agent/vacm.conf.src +++ b/lib/snmp/test/test_config/agent/vacm.conf.src @@ -1,4 +1,3 @@ -%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:32:48 %% This file defines the Mib Views. %% The data is inserted into the vacm* tables defined %% in SNMP-VIEW-BASED-ACM-MIB. diff --git a/lib/snmp/test/test_config/manager/manager.conf.src b/lib/snmp/test/test_config/manager/manager.conf.src index 164e5507c6..7d4104ded2 100644 --- a/lib/snmp/test/test_config/manager/manager.conf.src +++ b/lib/snmp/test/test_config/manager/manager.conf.src @@ -11,6 +11,6 @@ {port, 5000}. -{address, [127,0,0,1]}. +{address, %ADDR%}. {engine_id, "foo"}. {max_message_size, 484}. diff --git a/lib/snmp/test/test_config/snmp_test_config.erl b/lib/snmp/test/test_config/snmp_test_config.erl new file mode 100644 index 0000000000..8d2005d061 --- /dev/null +++ b/lib/snmp/test/test_config/snmp_test_config.erl @@ -0,0 +1,32 @@ +%% +%% %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_address2/0]). + +ip_address() -> + {ok, Hostname} = inet:gethostname(), + {ok, Address} = inet:getaddr(Hostname, inet), + io:format("~w", [tuple_to_list(Address)]). + +ip_address2() -> + {ok, Hostname} = inet:gethostname(), + {ok, {A1, A2, A3, A4}} = inet:getaddr(Hostname, inet), + io:format("~w.~w.~w.~w", [A1, A2, A3, A4]). diff --git a/lib/snmp/test/test_config/test_config.erl b/lib/snmp/test/test_config/test_config.erl deleted file mode 100644 index 2a94bf5e8d..0000000000 --- a/lib/snmp/test/test_config/test_config.erl +++ /dev/null @@ -1,27 +0,0 @@ -%% -%% %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)]). -- cgit v1.2.3