aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/snmp')
-rw-r--r--lib/snmp/test/test_config/Makefile36
-rw-r--r--lib/snmp/test/test_config/agent/agent.conf.src1
-rw-r--r--lib/snmp/test/test_config/agent/community.conf.src1
-rw-r--r--lib/snmp/test/test_config/agent/context.conf.src1
-rw-r--r--lib/snmp/test/test_config/agent/notify.conf.src1
-rw-r--r--lib/snmp/test/test_config/agent/standard.conf.src15
-rw-r--r--lib/snmp/test/test_config/agent/target_addr.conf.src5
-rw-r--r--lib/snmp/test/test_config/agent/target_params.conf.src1
-rw-r--r--lib/snmp/test/test_config/agent/vacm.conf.src1
-rw-r--r--lib/snmp/test/test_config/manager/manager.conf.src2
-rw-r--r--lib/snmp/test/test_config/snmp_test_config.erl (renamed from lib/snmp/test/test_config/test_config.erl)7
11 files changed, 45 insertions, 26 deletions
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 = [email protected]
+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, "[email protected]"}.
%% {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/test_config.erl b/lib/snmp/test/test_config/snmp_test_config.erl
index 2a94bf5e8d..8d2005d061 100644
--- a/lib/snmp/test/test_config/test_config.erl
+++ b/lib/snmp/test/test_config/snmp_test_config.erl
@@ -19,9 +19,14 @@
-module(test_config).
--export([ip_address/0]).
+-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]).