diff options
author | Micael Karlberg <[email protected]> | 2011-03-02 13:49:11 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-03-02 13:49:11 +0100 |
commit | 455ff4bc78f94c997d43a46fd2619b7d683c10c5 (patch) | |
tree | 376e4c476c1a50facdbd1ff59e0f6633bc06b2d3 /lib/snmp/test | |
parent | 6daf9097abb20ae9fef69f60eb1b994aeaac0baf (diff) | |
parent | cf7f5f99f46708db185d927d0c7681fc4f6f3a0e (diff) | |
download | otp-455ff4bc78f94c997d43a46fd2619b7d683c10c5.tar.gz otp-455ff4bc78f94c997d43a46fd2619b7d683c10c5.tar.bz2 otp-455ff4bc78f94c997d43a46fd2619b7d683c10c5.zip |
Merge branch 'bmk/snmp/snmp419_integration/OTP-9068' into dev
* [compiler] Added support for textual convention AGENT-CAPABILITIES
and full support for textual convention MODULE-COMPLIANCE:
OTP-8966
* [agent] Added a "complete" set of (snmp) table and variable
print functions:
OTP-8977
* [agent] For is_set_ok and set operations on the table
vacmAccessTable, all values of the vacmAccessSecurityModel
column was incorrectly translated into any:
OTP-8980
* [agent] Reconfigure of SNMP-VIEW-BASED-ACM-MIB could after
a change in the vacm config file (vacm.conf):
OTP-8981
* [compiler] Added a MIB compiler (frontend) escript, snmpc:
OTP-9004
Diffstat (limited to 'lib/snmp/test')
25 files changed, 1084 insertions, 100 deletions
diff --git a/lib/snmp/test/modules.mk b/lib/snmp/test/modules.mk index 6a0c3e9481..eacc749b53 100644 --- a/lib/snmp/test/modules.mk +++ b/lib/snmp/test/modules.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2004-2010. All Rights Reserved. +# Copyright Ericsson AB 2004-2011. 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 @@ -62,6 +62,8 @@ COMPILER_MIB_FILES = \ OTP8574-MIB MIB_FILES = \ + AC-TEST-MIB.mib \ + MC-TEST-MIB.mib \ OLD-SNMPEA-MIB.mib \ OLD-SNMPEA-MIB-v2.mib \ Klas1.mib \ diff --git a/lib/snmp/test/snmp_SUITE.erl b/lib/snmp/test/snmp_SUITE.erl index 3f6473893b..b6d72da2fa 100644 --- a/lib/snmp/test/snmp_SUITE.erl +++ b/lib/snmp/test/snmp_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. 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 @@ -19,26 +19,14 @@ -module(snmp_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, +-export([all/0, + suite/0, + groups/0, + init_per_suite/1, end_per_suite/1, + init_per_group/2, end_per_group/2, init_per_testcase/2, end_per_testcase/2 ]). --export([]). - --export([ - - - - - - - - - - - - -]). %% %% ----- @@ -54,39 +42,43 @@ end_per_testcase(_Case, Config) when is_list(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks, [ts_install_cth]}]. all() -> -[{group, app}, {group, compiler}, {group, misc}, - {group, agent}, {group, manager}]. + [{group, app}, + {group, compiler}, + {group, misc}, + {group, agent}, + {group, manager}]. groups() -> - [{app, [], [{group, app_test}, {group, appup_test}]}, - {compiler, [], [{group, compiler_test}]}, - {misc, [], - [{group, conf_test}, {group, pdus_test}, - {group, log_test}, {group, note_store_test}]}, - {agent, [], - [{group, mibs_test}, {group, nfilter_test}, - {group, agent_test}]}, - {manager, [], - [{group, manager_config_test}, - {group, manager_user_test}, {group, manager_test}]}, - {app_test, [], [{snmp_app_test, all}]}, - {appup_test, [], [{snmp_appup_test, all}]}, - {compiler_test, [], [{snmp_compiler_test, all}]}, - {conf_test, [], [{snmp_conf_test, all}]}, - {pdus_test, [], [{snmp_pdus_test, all}]}, - {log_test, [], [{snmp_log_test, all}]}, - {note_store_test, [], [{snmp_note_store_test, all}]}, - {mibs_test, [], [{snmp_agent_mibs_test, all}]}, - {nfilter_test, [], [{snmp_agent_nfilter_test, all}]}, - {agent_test, [], [{snmp_agent_test, all}]}, - {manager_config_test, [], - [{snmp_manager_config_test, all}]}, - {manager_user_test, [], - [{snmp_manager_user_test, all}]}, - {manager_test, [], [{snmp_manager_test, all}]}]. + [{app, [], [{group, app_test}, + {group, appup_test}]}, + {compiler, [], [{group, compiler_test}]}, + {misc, [], [{group, conf_test}, + {group, pdus_test}, + {group, log_test}, + {group, note_store_test}]}, + {agent, [], [{group, mibs_test}, + {group, nfilter_test}, + {group, agent_test}]}, + {manager, [], [{group, manager_config_test}, + {group, manager_user_test}, + {group, manager_test}]}, + {app_test, [], [{snmp_app_test, all}]}, + {appup_test, [], [{snmp_appup_test, all}]}, + {compiler_test, [], [{snmp_compiler_test, all}]}, + {conf_test, [], [{snmp_conf_test, all}]}, + {pdus_test, [], [{snmp_pdus_test, all}]}, + {log_test, [], [{snmp_log_test, all}]}, + {note_store_test, [], [{snmp_note_store_test, all}]}, + {mibs_test, [], [{snmp_agent_mibs_test, all}]}, + {nfilter_test, [], [{snmp_agent_nfilter_test, all}]}, + {agent_test, [], [{snmp_agent_test, all}]}, + {manager_config_test, [], [{snmp_manager_config_test, all}]}, + {manager_user_test, [], [{snmp_manager_user_test, all}]}, + {manager_test, [], [{snmp_manager_test, all}]}]. init_per_suite(Config) -> Config. @@ -95,41 +87,8 @@ end_per_suite(_Config) -> ok. init_per_group(_GroupName, Config) -> - Config. + Config. end_per_group(_GroupName, Config) -> - Config. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Config. diff --git a/lib/snmp/test/snmp_appup_test.erl b/lib/snmp/test/snmp_appup_test.erl index b93f960814..99994a2410 100644 --- a/lib/snmp/test/snmp_appup_test.erl +++ b/lib/snmp/test/snmp_appup_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-2011. 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 @@ -23,14 +23,17 @@ -module(snmp_appup_test). -export([ - all/0,groups/0,init_per_group/2,end_per_group/2, init_per_suite/1, - end_per_suite/1, + all/0, + groups/0, init_per_group/2, end_per_group/2, + init_per_suite/1, end_per_suite/1, init_per_testcase/2, end_per_testcase/2, appup_file/1 ]). +-compile({no_auto_import, [error/1]}). + -include_lib("common_test/include/ct.hrl"). -include("snmp_test_lib.hrl"). @@ -38,17 +41,20 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% all() -> -Cases = [appup_file], - Cases. + Cases = + [ + appup_file + ], + Cases. groups() -> []. init_per_group(_GroupName, Config) -> - Config. + Config. end_per_group(_GroupName, Config) -> - Config. + Config. diff --git a/lib/snmp/test/snmp_compiler_test.erl b/lib/snmp/test/snmp_compiler_test.erl index 98ffaf8bae..2e6020ae7a 100644 --- a/lib/snmp/test/snmp_compiler_test.erl +++ b/lib/snmp/test/snmp_compiler_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-2011. 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 @@ -37,15 +37,17 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/0,groups/0,init_per_group/2,end_per_group/2, + all/0, + groups/0, init_per_group/2, end_per_group/2, init_per_testcase/2, end_per_testcase/2, description/1, oid_conflicts/1, imports/1, module_identity/1, + agent_capabilities/1, + module_compliance/1, - otp_6150/1, otp_8574/1, otp_8595/1 @@ -78,7 +80,7 @@ init_per_testcase(_Case, Config) when is_list(Config) -> MibDir = join(lists:reverse(["snmp_test_data"|RL])), CompDir = join(Dir, "comp_dir/"), ?line ok = file:make_dir(CompDir), - [{comp_dir, CompDir},{mib_dir, MibDir}|Config]. + [{comp_dir, CompDir}, {mib_dir, MibDir} | Config]. end_per_testcase(_Case, Config) when is_list(Config) -> CompDir = ?config(comp_dir, Config), @@ -91,17 +93,24 @@ end_per_testcase(_Case, Config) when is_list(Config) -> %%====================================================================== all() -> -[description, oid_conflicts, imports, module_identity, - {group, tickets}]. + [ + description, + oid_conflicts, + imports, + module_identity, + agent_capabilities, + module_compliance, + {group, tickets} + ]. groups() -> [{tickets, [], [otp_6150, otp_8574, otp_8595]}]. init_per_group(_GroupName, Config) -> - Config. + Config. end_per_group(_GroupName, Config) -> - Config. + Config. @@ -168,6 +177,88 @@ module_identity(Config) when is_list(Config) -> ?SKIP(not_yet_implemented). +agent_capabilities(suite) -> + []; +agent_capabilities(Config) when is_list(Config) -> + put(tname,agent_capabilities), + p("starting with Config: ~p~n", [Config]), + + SnmpPrivDir = code:priv_dir(snmp), + SnmpMibsDir = join(SnmpPrivDir, "mibs"), + OtpMibsPrivDir = code:priv_dir(otp_mibs), + OtpMibsMibsDir = join(OtpMibsPrivDir, "mibs"), + Dir = ?config(mib_dir, Config), + AcMib = join(Dir,"AC-TEST-MIB.mib"), + ?line {ok, MibFile1} = snmpc:compile(AcMib, [options, + version, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib1} = snmp_misc:read_mib(MibFile1), + ?line {ok, MibFile2} = snmpc:compile(AcMib, [options, + version, + agent_capabilities, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib2} = snmp_misc:read_mib(MibFile2), + MEDiff = Mib2#mib.mes -- Mib1#mib.mes, + %% This is a rather pathetic test, but it is somthing... + io:format("agent_capabilities -> " + "~n MEDiff: ~p" + "~n Mib1: ~p" + "~n Mib2: ~p" + "~n", [MEDiff, Mib1, Mib2]), + case length(MEDiff) of + 2 -> + ok; + _BadLen -> + exit({unexpected_mes, MEDiff}) + end, + ok. + + +module_compliance(suite) -> + []; +module_compliance(Config) when is_list(Config) -> + put(tname,module_compliance), + p("starting with Config: ~p~n", [Config]), + + SnmpPrivDir = code:priv_dir(snmp), + SnmpMibsDir = join(SnmpPrivDir, "mibs"), + OtpMibsPrivDir = code:priv_dir(otp_mibs), + OtpMibsMibsDir = join(OtpMibsPrivDir, "mibs"), + Dir = ?config(mib_dir, Config), + AcMib = join(Dir,"MC-TEST-MIB.mib"), + ?line {ok, MibFile1} = snmpc:compile(AcMib, [options, + version, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib1} = snmp_misc:read_mib(MibFile1), + ?line {ok, MibFile2} = snmpc:compile(AcMib, [options, + version, + module_compliance, + {i, [SnmpMibsDir, OtpMibsMibsDir]}, + {outdir, Dir}, + {verbosity, trace}]), + ?line {ok, Mib2} = snmp_misc:read_mib(MibFile2), + MEDiff = Mib2#mib.mes -- Mib1#mib.mes, + %% This is a rather pathetic test, but it is somthing... + io:format("agent_capabilities -> " + "~n MEDiff: ~p" + "~n Mib1: ~p" + "~n Mib2: ~p" + "~n", [MEDiff, Mib1, Mib2]), + case length(MEDiff) of + 1 -> + ok; + _BadLen -> + exit({unexpected_mes, MEDiff}) + end, + ok. + + otp_6150(suite) -> []; otp_6150(Config) when is_list(Config) -> @@ -256,7 +347,7 @@ LAST-UPDATED \"0005290000Z\" Ericsson Utvecklings AB Open System Box 1505 -SE-125 25 �LVSJ�\" +SE-125 25 ÄLVSJÖ\" DESCRIPTION \" Objects for management \" diff --git a/lib/snmp/test/snmp_test_data/AC-TEST-MIB.mib b/lib/snmp/test/snmp_test_data/AC-TEST-MIB.mib new file mode 100644 index 0000000000..58defbe1cf --- /dev/null +++ b/lib/snmp/test/snmp_test_data/AC-TEST-MIB.mib @@ -0,0 +1,131 @@ +--
+-- AC-TEST-MIB.mib
+-- MIB generated by MG-SOFT Visual MIB Builder Version 5.0 Build 250
+-- Tuesday, November 30, 2010 at 23:03:18
+--
+
+ AC-TEST-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+ otpExpr
+ FROM OTP-REG
+ OBJECT-GROUP, AGENT-CAPABILITIES
+ FROM SNMPv2-CONF
+ Integer32, OBJECT-TYPE, MODULE-IDENTITY, OBJECT-IDENTITY
+ FROM SNMPv2-SMI;
+
+
+ acTestModule MODULE-IDENTITY
+ LAST-UPDATED "201011302230Z" -- November 30, 2010 at 22:30 GMT
+ ORGANIZATION
+ "Ac Test Co."
+ CONTACT-INFO
+ "[email protected]."
+ DESCRIPTION
+ "Ac Test module."
+ ::= { reg 1 }
+
+
+
+--
+-- Node definitions
+--
+
+ acTest OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "Test area."
+ ::= { otpExpr 4321 }
+
+
+ reg OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "Registrations."
+ ::= { acTest 1 }
+
+
+ mib OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "Objects."
+ ::= { acTest 2 }
+
+
+ someObject OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Description."
+ ::= { mib 1 }
+
+
+ oneMore OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Description."
+ ::= { mib 2 }
+
+
+ grp OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "Groups
+ ."
+ ::= { acTest 3 }
+
+
+ basicGrp OBJECT-GROUP
+ OBJECTS { someObject }
+ STATUS current
+ DESCRIPTION
+ "Basic set of objects."
+ ::= { grp 1 }
+
+
+ allObjects OBJECT-GROUP
+ OBJECTS { someObject, oneMore }
+ STATUS current
+ DESCRIPTION
+ "Complete set."
+ ::= { grp 2 }
+
+
+ cap OBJECT-IDENTITY
+ STATUS current
+ DESCRIPTION
+ "Capabilities."
+ ::= { acTest 5 }
+
+
+ basicAgent AGENT-CAPABILITIES
+ PRODUCT-RELEASE
+ "Product release v1."
+ STATUS current
+ DESCRIPTION
+ "Basic agent."
+ SUPPORTS AC-TEST-MIB
+ INCLUDES { basicGrp }
+ ::= { cap 1 }
+
+
+ fullAgent AGENT-CAPABILITIES
+ PRODUCT-RELEASE
+ "Product release v2."
+ STATUS current
+ DESCRIPTION
+ "Full featured agent."
+ SUPPORTS AC-TEST-MIB
+ INCLUDES { allObjects }
+ ::= { cap 2 }
+
+
+
+ END
+
+--
+-- AC-TEST-MIB.mib
+--
diff --git a/lib/snmp/test/snmp_test_data/MC-TEST-MIB.mib b/lib/snmp/test/snmp_test_data/MC-TEST-MIB.mib new file mode 100644 index 0000000000..cadaa6f891 --- /dev/null +++ b/lib/snmp/test/snmp_test_data/MC-TEST-MIB.mib @@ -0,0 +1,173 @@ +MC-TEST-MIB DEFINITIONS ::= BEGIN + +IMPORTS + otpExpr + FROM OTP-REG + MODULE-IDENTITY, OBJECT-TYPE, + mib-2, NOTIFICATION-TYPE, OBJECT-IDENTITY + FROM SNMPv2-SMI + TDomain, TAddress, DisplayString, TEXTUAL-CONVENTION, + AutonomousType, RowPointer, TimeStamp, + RowStatus, StorageType + FROM SNMPv2-TC + MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP + FROM SNMPv2-CONF; + +mcTestModule MODULE-IDENTITY + LAST-UPDATED "9605160000Z" + ORGANIZATION "MC Test Co." + CONTACT-INFO + "[email protected]." + DESCRIPTION + "MC Test module." + ::= { reg 1 } + +mcObjects OBJECT IDENTIFIER ::= { mcTestModule 1 } + +-- MIB contains one group + +mcMisc OBJECT IDENTIFIER ::= { mcObjects 1 } +mcGeneral OBJECT IDENTIFIER ::= { mcObjects 2 } + + +mcTest OBJECT-IDENTITY + STATUS current + DESCRIPTION + "Test area." + ::= { otpExpr 4322 } + + +reg OBJECT-IDENTITY + STATUS current + DESCRIPTION + "Registrations." + ::= { mcTest 1 } + + +mcTable OBJECT-TYPE + SYNTAX SEQUENCE OF McEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table contains one row per physical entity. There is + always at least one row for an 'overall' physical entity." + ::= { mcMisc 1 } + +mcEntry OBJECT-TYPE + SYNTAX McEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Table entry..." + INDEX { mcIndex } + ::= { mcTable 1 } + +McEntry ::= SEQUENCE { + mcIndex INTEGER, + mcName DisplayString, + mcStorageType StorageType, + mcRowStatus RowStatus +} + +mcIndex OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The index for this entry." + ::= { mcEntry 1 } + +mcName OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Name of... " + ::= { mcEntry 2 } + + +mcStorageType OBJECT-TYPE + SYNTAX StorageType + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The storage type for this conceptual row." + DEFVAL { nonVolatile } + ::= { mcEntry 3 } + +mcRowStatus OBJECT-TYPE + SYNTAX RowStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status of this conceptual row..." + ::= { mcEntry 4 } + + +-- last change time stamp for the whole MIB +mcTimeStamp OBJECT-TYPE + SYNTAX TimeStamp + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The sysUpTime value when of the last time *anything* in the + MIB was changed. " + ::= { mcGeneral 1 } + +-- Entity MIB Trap Definitions +mcTraps OBJECT IDENTIFIER ::= { mcTestModule 2 } +mcTrapPrefix OBJECT IDENTIFIER ::= { mcTraps 0 } + +mcConfigChange NOTIFICATION-TYPE + STATUS current + DESCRIPTION + "An mcConfigChange trap is sent when the value of + entLastChangeTime changes..." + ::= { mcTrapPrefix 1 } + +-- conformance information +mcConformance OBJECT IDENTIFIER ::= { mcTestModule 3 } + +mcCompliances OBJECT IDENTIFIER ::= { mcConformance 1 } +mcGroups OBJECT IDENTIFIER ::= { mcConformance 2 } + +-- compliance statements + + +mcCompliance MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "The compliance statement for SNMP entities which implement + the MC Test MIB." + MODULE -- this module + MANDATORY-GROUPS { mcGeneralGroup, + mcNotificationsGroup } + ::= { mcCompliances 1 } + +-- MIB groupings + +mcGeneralGroup OBJECT-GROUP + OBJECTS { + mcName, + mcStorageType, + mcRowStatus, + mcTimeStamp + } + STATUS current + DESCRIPTION + "The collection of objects which are used to represent + general information..." + ::= { mcGroups 1 } + +mcNotificationsGroup NOTIFICATION-GROUP + NOTIFICATIONS { mcConfigChange } + STATUS current + DESCRIPTION + "The collection of notifications..." + ::= { mcGroups 2 } + + +END + + + diff --git a/lib/snmp/test/snmp_test_mgr_misc.erl b/lib/snmp/test/snmp_test_mgr_misc.erl index ef1ba0b948..fc6dedd96d 100644 --- a/lib/snmp/test/snmp_test_mgr_misc.erl +++ b/lib/snmp/test/snmp_test_mgr_misc.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2011. 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 @@ -33,6 +33,8 @@ %% internal exports -export([init_packet/10]). +-compile({no_auto_import, [error/2]}). + -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). diff --git a/lib/snmp/test/test_config/.gitignore b/lib/snmp/test/test_config/.gitignore new file mode 100644 index 0000000000..fc2d5dbadf --- /dev/null +++ b/lib/snmp/test/test_config/.gitignore @@ -0,0 +1,19 @@ +# 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/usm.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 new file mode 100644 index 0000000000..4953de7fe8 --- /dev/null +++ b/lib/snmp/test/test_config/Makefile @@ -0,0 +1,199 @@ +#-*-makefile-*- ; force emacs to enter makefile-mode + +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2009. 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% + +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../../vsn.mk + +VSN = $(SNMP_VSN) + + +# ---------------------------------------------------- +# Configured variables +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# 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) + +TARGETS = \ + $(ERL_TARGETS) \ + $(CONFIG_FILES) + + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +ifeq ($(TESTROOT),) +TESTROOT=/tmp +endif +RELSYSDIR = $(TESTROOT) + + +# ---------------------------------------------------- +# FLAGS AND VARIABLES +# ---------------------------------------------------- + +EBIN = . + +ERL_COMPILE_FLAGS += +'{parse_transform,sys_pre_attributes}' \ + +'{attribute,insert,app_vsn,$(APP_VSN)}' + +ifeq ($(ADDR),) +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 + +ifeq ($(AGENT_ENGINE_ID),) +AGENT_ENGINE_ID = Agent engine of $(USER) +endif + +ifeq ($(AGENT_USM_ENGINE_ID),) +AGENT_USM_ENGINE_ID = $(AGENT_ENGINE_ID) +endif + +ifeq ($(MANAGER_ENGINE_ID),) +MANAGER_ENGINE_ID = Manager engine of $(USER) +endif + +ifeq ($(MANAGER_USM_ENGINE_ID),) +MANAGER_USM_ENGINE_ID = $(MANAGER_ENGINE_ID) +endif + + + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +tests debug opt: $(TARGETS) + +clean: + rm -f $(CONFIG_FILES) + rm -f $(ERL_TARGETS) + rm -f core + +docs: + +%.config: %.config.src + @echo "$< -> $@" + $(PERL) -p -e 's?%DIR%?$(RELSYSDIR)? ' < $< > $@ + +agent/%.conf: agent/%.conf.src + @echo "$< -> $@" + 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)? ' \ + -e 's?%ENGINE_ID%?\"$(AGENT_ENGINE_ID)\"? ' \ + -e 's?%USM_ENGINE_ID%?\"$(AGENT_USM_ENGINE_ID)\"? ' < $< > $@ + +manager/%.conf: manager/%.conf.src + @echo "$< -> $@" + sed -e 's?%ADDR%?$(ADDR)? ' \ + -e 's?%ENGINE_ID%?\"$(MANAGER_ENGINE_ID)\"? ' \ + -e 's?%USM_ENGINE_ID%?\"$(MANAGER_USM_ENGINE_ID)\"? ' < $< > $@ + + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: + +release_tests_spec: clean opt + $(INSTALL_DIR) $(RELSYSDIR) + chmod -f -R u+w $(RELSYSDIR) + $(INSTALL_DIR) $(RELSYSDIR)/agent + chmod -f -R u+w $(RELSYSDIR)/agent + $(INSTALL_DIR) $(RELSYSDIR)/agent/conf + chmod -f -R u+w $(RELSYSDIR)/agent/conf + $(INSTALL_DIR) $(RELSYSDIR)/agent/db + chmod -f -R u+w $(RELSYSDIR)/agent/db + $(INSTALL_DIR) $(RELSYSDIR)/agent/log + chmod -f -R u+w $(RELSYSDIR)/agent/log + $(INSTALL_DIR) $(RELSYSDIR)/manager + chmod -f -R u+w $(RELSYSDIR)/manager + $(INSTALL_DIR) $(RELSYSDIR)/manager/conf + chmod -f -R u+w $(RELSYSDIR)/manager/conf + $(INSTALL_DIR) $(RELSYSDIR)/manager/db + chmod -f -R u+w $(RELSYSDIR)/manager/db + $(INSTALL_DIR) $(RELSYSDIR)/manager/log + chmod -f -R u+w $(RELSYSDIR)/manager/log + $(INSTALL_DATA) $(SYS_CONFIG_FILES) $(RELSYSDIR) + $(INSTALL_DATA) $(AGENT_CONFIG_FILES) $(RELSYSDIR)/agent/conf + $(INSTALL_DATA) $(MANAGER_CONFIG_FILES) $(RELSYSDIR)/manager/conf + +release_docs_spec: + + +info: + @echo "" + @echo "RELSYSDIR = $(RELSYSDIR)" + @echo "" + @echo "SYS_CONFIG_SRCS = $(SYS_CONFIG_SRCS)" + @echo "SYS_CONFIG_FILES = $(SYS_CONFIG_FILES)" + @echo "" + @echo "AGENT_CONFIG_SRCS = $(AGENT_CONFIG_SRCS)" + @echo "AGENT_CONFIG_FILES = $(AGENT_CONFIG_FILES)" + @echo "" + @echo "MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_SRCS)" + @echo "MANAGER_CONFIG_FILES = $(MANAGER_CONFIG_FILES)" + @echo "" + @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 new file mode 100644 index 0000000000..1fe95cc72d --- /dev/null +++ b/lib/snmp/test/test_config/agent/agent.conf.src @@ -0,0 +1,19 @@ +%% 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 +%% in OTP-SNMPEA-MIB. +%% Each row is a 2-tuple: +%% {AgentVariable, Value}. +%% For example +%% {intAgentUDPPort, 4000}. +%% The ip address for the agent is sent as id in traps. +%% {intAgentIpAddress, [127,42,17,5]}. +%% {snmpEngineID, "agentEngine"}. +%% {snmpEngineMaxMessageSize, 484}. +%% + + +{intAgentUDPPort, 4000}. +{intAgentIpAddress, %ADDR%}. +{snmpEngineID, %ENGINE_ID%}. +{snmpEngineMaxMessageSize, 484}. diff --git a/lib/snmp/test/test_config/agent/community.conf.src b/lib/snmp/test/test_config/agent/community.conf.src new file mode 100644 index 0000000000..8dccb929c9 --- /dev/null +++ b/lib/snmp/test/test_config/agent/community.conf.src @@ -0,0 +1,15 @@ +%% This file defines the community info which maps to VACM parameters. +%% The data is inserted into the snmpCommunityTable defined +%% in SNMP-COMMUNITY-MIB. +%% Each row is a 5-tuple: +%% {CommunityIndex, CommunityName, SecurityName, ContextName, TransportTag}. +%% For example +%% {"1", "public", "initial", "", ""}. +%% {"2", "secret", "secret_name", "", "tag"}. +%% {"3", "bridge1", "initial", "bridge1", ""}. +%% + + +{"public", "public", "initial", "", ""}. +{"all-rights", "all-rights", "all-rights", "", ""}. +{"standard trap", "standard trap", "initial", "", ""}. diff --git a/lib/snmp/test/test_config/agent/context.conf.src b/lib/snmp/test/test_config/agent/context.conf.src new file mode 100644 index 0000000000..ea8b5a97eb --- /dev/null +++ b/lib/snmp/test/test_config/agent/context.conf.src @@ -0,0 +1,14 @@ +%% This file defines the contexts known to the agent. +%% The data is inserted into the vacmContextTable defined +%% in SNMP-VIEW-BASED-ACM-MIB. +%% Each row is a string: +%% ContextName. +%% +%% The empty string is the default context. +%% For example +%% "bridge1". +%% "bridge2". +%% + + +"". diff --git a/lib/snmp/test/test_config/agent/notify.conf.src b/lib/snmp/test/test_config/agent/notify.conf.src new file mode 100644 index 0000000000..164fd25b95 --- /dev/null +++ b/lib/snmp/test/test_config/agent/notify.conf.src @@ -0,0 +1,13 @@ +%% This file defines the notification parameters. +%% The data is inserted into the snmpNotifyTable defined +%% in SNMP-NOTIFICATION-MIB. +%% The Name is used as CommunityString for v1 and v2c. +%% Each row is a 3-tuple: +%% {Name, Tag, Type}. +%% For example +%% {"standard trap", "std_trap", trap}. +%% {"standard inform", "std_inform", inform}. +%% + + +{"stadard_trap", "std_trap", trap}. diff --git a/lib/snmp/test/test_config/agent/standard.conf.src b/lib/snmp/test/test_config/agent/standard.conf.src new file mode 100644 index 0000000000..31e04e7695 --- /dev/null +++ b/lib/snmp/test/test_config/agent/standard.conf.src @@ -0,0 +1,21 @@ +%% 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, "[email protected]"}. +%% {sysName, "test"}. +%% {sysLocation, "erlang"}. +%% {sysServices, 72}. +%% {snmpEnableAuthenTraps, enabled}. +%% + + +{sysDescr, "Erlang SNMP agent"}. +{sysObjectID, [1,2,3]}. +{sysContact, "%SYS_CONTACT%"}. +{sysLocation, "%SYS_LOCATION%"}. +{sysServices, 72}. +{snmpEnableAuthenTraps, disabled}. +{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 new file mode 100644 index 0000000000..740df74ecf --- /dev/null +++ b/lib/snmp/test/test_config/agent/target_addr.conf.src @@ -0,0 +1,21 @@ +%% This file defines the target address parameters. +%% The data is inserted into the snmpTargetAddrTable defined +%% in SNMP-TARGET-MIB, and in the snmpTargetAddrExtTable defined +%% in SNMP-COMMUNITY-MIB. +%% Each row is a 10-tuple: +%% {Name, Ip, Udp, Timeout, RetryCount, TagList, ParamsName, EngineId, +%% TMask, MaxMessageSize}. +%% The EngineId value is only used if Inform-Requests are sent to this +%% target. If Informs are not sent, this value is ignored, and can be +%% e.g. an empty string. However, if Informs are sent, it is essential +%% that the value of EngineId matches the value of the target's +%% actual snmpEngineID. +%% For example +%% {"1.2.3.4 v1", [1,2,3,4], 162, +%% 1500, 3, "std_inform", "otp_v2", "", +%% [127,0,0,0], 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 new file mode 100644 index 0000000000..a4a535baa2 --- /dev/null +++ b/lib/snmp/test/test_config/agent/target_params.conf.src @@ -0,0 +1,11 @@ +%% This file defines the target parameters. +%% The data is inserted into the snmpTargetParamsTable defined +%% in SNMP-TARGET-MIB. +%% Each row is a 5-tuple: +%% {Name, MPModel, SecurityModel, SecurityName, SecurityLevel}. +%% For example +%% {"target_v3", v3, usm, "", noAuthNoPriv}. +%% + + +{"target_v2", v2c, v2c, "initial", noAuthNoPriv}. diff --git a/lib/snmp/test/test_config/agent/usm.conf.src b/lib/snmp/test/test_config/agent/usm.conf.src new file mode 100644 index 0000000000..0409084048 --- /dev/null +++ b/lib/snmp/test/test_config/agent/usm.conf.src @@ -0,0 +1,17 @@ +%% This file defines the security parameters for the user-based +%% security model. +%% The data is inserted into the usmUserTable defined +%% in SNMP-USER-BASED-SM-MIB. +%% Each row is a 13-tuple: +%% {EngineID, UserName, SecName, Clone, AuthP, AuthKeyC, OwnAuthKeyC, +%% PrivP, PrivKeyC, OwnPrivKeyC, Public, AuthKey, PrivKey}. +%% For example +%% {"agentEngine", "initial", "initial", zeroDotZero, +%% usmNoAuthProtocol, "", "", usmNoPrivProtocol, "", "", "", +%% "", ""}. +%% + + +{%USM_ENGINE_ID%, "initial", "initial", zeroDotZero, usmHMACMD5AuthProtocol, "", "", usmNoPrivProtocol, "", "", "", [160,66,33,136,178,59,246,214,102,63,131,131,54,14,221,177], ""}. +{%USM_ENGINE_ID%, "templateMD5", "templateMD5", zeroDotZero, usmHMACMD5AuthProtocol, "", "", usmNoPrivProtocol, "", "", "", [160,66,33,136,178,59,246,214,102,63,131,131,54,14,221,177], ""}. +{%USM_ENGINE_ID%, "templateSHA", "templateSHA", zeroDotZero, usmHMACSHAAuthProtocol, "", "", usmNoPrivProtocol, "", "", "", [199,94,239,13,229,135,141,77,124,129,65,189,230,240,115,163,239,15,13,242], ""}. diff --git a/lib/snmp/test/test_config/agent/vacm.conf.src b/lib/snmp/test/test_config/agent/vacm.conf.src new file mode 100644 index 0000000000..86271443ad --- /dev/null +++ b/lib/snmp/test/test_config/agent/vacm.conf.src @@ -0,0 +1,27 @@ +%% This file defines the Mib Views. +%% The data is inserted into the vacm* tables defined +%% in SNMP-VIEW-BASED-ACM-MIB. +%% Each row is one of 3 tuples; one for each table in the MIB: +%% {vacmSecurityToGroup, SecModel, SecName, GroupName}. +%% {vacmAccess, GroupName, Prefix, SecModel, SecLevel, Match, RV, WV, NV}. +%% {vacmViewTreeFamily, ViewIndex, ViewSubtree, ViewStatus, ViewMask}. +%% For example +%% {vacmSecurityToGroup, v2c, "initial", "initial"}. +%% {vacmSecurityToGroup, usm, "initial", "initial"}. +%% read/notify access to system +%% {vacmAccess, "initial", "", any, noAuthNoPriv, exact, +%% "system", "", "system"}. +%% {vacmViewTreeFamily, "system", [1,3,6,1,2,1,1], included, null}. +%% {vacmViewTreeFamily, "exmib", [1,3,6,1,3], included, null}. % for EX1-MIB +%% {vacmViewTreeFamily, "internet", [1,3,6,1], included, null}. +%% + + +{vacmSecurityToGroup, v2c, "initial", "initial"}. +{vacmSecurityToGroup, v2c, "all-rights", "all-rights"}. +{vacmAccess, "initial", "", any, noAuthNoPriv, exact, "restricted", "", "restricted"}. +{vacmAccess, "initial", "", usm, authNoPriv, exact, "internet", "internet", "internet"}. +{vacmAccess, "initial", "", usm, authPriv, exact, "internet", "internet", "internet"}. +{vacmAccess, "all-rights", "", any, noAuthNoPriv, exact, "internet", "internet", "internet"}. +{vacmViewTreeFamily, "restricted", [1,3,6,1], included, null}. +{vacmViewTreeFamily, "internet", [1,3,6,1], included, null}. diff --git a/lib/snmp/test/test_config/manager/manager.conf.src b/lib/snmp/test/test_config/manager/manager.conf.src new file mode 100644 index 0000000000..c38a61b13c --- /dev/null +++ b/lib/snmp/test/test_config/manager/manager.conf.src @@ -0,0 +1,16 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:05 +%% This file defines the Manager local configuration info +%% Each row is a 2-tuple: +%% {Variable, Value}. +%% For example +%% {port, 5000}. +%% {address, [127,42,17,5]}. +%% {engine_id, "managerEngine"}. +%% {max_message_size, 484}. +%% + + +{port, 5000}. +{address, %ADDR%}. +{engine_id, %ENGINE_ID%}. +{max_message_size, 484}. diff --git a/lib/snmp/test/test_config/manager/usm.conf.src b/lib/snmp/test/test_config/manager/usm.conf.src new file mode 100644 index 0000000000..a558c86710 --- /dev/null +++ b/lib/snmp/test/test_config/manager/usm.conf.src @@ -0,0 +1,9 @@ +%% This file was generated by snmp_config (version-4.9.3) 2007-06-29 13:35:05 +%% This file defines the usm users the manager handles +%% Each row is a 6 or 7-tuple: +%% {EngineID, UserName, AuthP, AuthKey, PrivP, PrivKey} +%% {EngineID, UserName, SecName, AuthP, AuthKey, PrivP, PrivKey} +%% + +{%USM_ENGINE_ID%, "initial", usmNoAuthProtocol, "", usmNoPrivProtocol, ""}. + diff --git a/lib/snmp/test/test_config/modules.mk b/lib/snmp/test/test_config/modules.mk new file mode 100644 index 0000000000..3d084cef01 --- /dev/null +++ b/lib/snmp/test/test_config/modules.mk @@ -0,0 +1,41 @@ +#-*-makefile-*- ; force emacs to enter makefile-mode + +# %CopyrightBegin% +# +# Copyright Ericsson AB 2004-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% + +SYS_CONFIG_FILES = \ + sys.config \ + sys-agent.config \ + sys-manager.config + +AGENT_CONFIG_FILES = \ + agent/agent.conf \ + agent/community.conf \ + agent/context.conf \ + agent/notify.conf \ + agent/standard.conf \ + agent/target_addr.conf \ + agent/target_params.conf \ + agent/usm.conf \ + agent/vacm.conf + +MANAGER_CONFIG_FILES = \ + manager/manager.conf \ + manager/usm.conf + +MODULES = \ + snmp_test_config 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..550a276c4c --- /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(snmp_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/sys-agent.config.src b/lib/snmp/test/test_config/sys-agent.config.src new file mode 100644 index 0000000000..46a458203d --- /dev/null +++ b/lib/snmp/test/test_config/sys-agent.config.src @@ -0,0 +1,43 @@ +%% This is an example sys config file for starting the snmp application +%% with only a agent running. +[{snmp, + [ + {agent, + [ + {priority, normal}, + {versions, [v1,v2,v3]}, + {db_dir, "%DIR%/agent/db"}, + {mib_storage, ets}, +%% {agent_mib_storage, volatile}, + {agent_mib_storage, persistent}, + {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, trace}, + {audit_trail_log, [{type, read}, + {dir, "%DIR%/agent/log"}, + {size, {10240,10}}]}, + {config, [{dir, "%DIR%/agent/conf"}, + {force_load, true}, + {verbosity, trace}]}, + {multi_threaded, true}, + {mib_server, [{mibentry_override, false}, + {trapentry_override, false}, + {cache, true}, + {verbosity, trace}]}, + {note_store, [{timeout,30000}, {verbosity,silence}]}, + {supervisor, [{verbosity,silence}]}, + {net_if, [{module, snmpa_net_if}, + {verbosity, silence}, + {options, [{bind_to, true}, + {no_reuse, false}, + {req_limit, infinity}, + {sndbuf, 32000}, + {recbuf, 32000}]}]} + ] + } + ] + } +]. diff --git a/lib/snmp/test/test_config/sys-manager.config.src b/lib/snmp/test/test_config/sys-manager.config.src new file mode 100644 index 0000000000..4366263084 --- /dev/null +++ b/lib/snmp/test/test_config/sys-manager.config.src @@ -0,0 +1,35 @@ +%% This is an example sys config file for starting the snmp application +%% with only a manager running. +[{snmp, + [ + {manager, + [ + {priority, normal}, + {versions, [v1,v2,v3]}, + {config, [{dir, "%DIR%/manager/conf"}, + {verbosity, trace}, + {db_dir, "%DIR%/manager/db"}, + {repair, true}, + {auto_save, 5000}]}, + {inform_request_behaviour, user}, + {mibs, []}, + {server, [{timeout, 30000}, + {verbosity, trace}]}, + {note_store, [{timeout,30000}, + {verbosity,silence}]}, + {audit_trail_log, [{type, read}, + {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}]}]}, + {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 new file mode 100644 index 0000000000..b2cd399883 --- /dev/null +++ b/lib/snmp/test/test_config/sys.config.src @@ -0,0 +1,68 @@ +%% 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, [v1,v2,v3]}, + {db_dir, "%DIR%/agent/db"}, + {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}, + {audit_trail_log, [{type, read}, + {dir, "%DIR%/agent/log"}, + {size, {10240,10}}]}, + {config, [{dir, "%DIR%/agent/conf"}, + {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}, + {sndbuf, 32000}, + {recbuf, 32000}]}]} + ] + }, + {manager, + [ + {priority, normal}, + {versions, [v1,v2,v3]}, + {config, [{dir, "%DIR%/manager/conf"}, + {verbosity, silence}, + {db_dir, "%DIR%/manager/db"}, + {repair, true}, + {auto_save, 5000}]}, + {inform_request_behaviour, auto}, + {mibs, []}, + {server, [{timeout, 30000}, + {verbosity, silence}]}, + {note_store, [{timeout, 30000}, + {verbosity, silence}]}, + {audit_trail_log, [{type, read}, + {dir, "%DIR%/manager/log"}, + {size, {10240,10}}]}, + {net_if, [{module,snmpm_net_if}, + {verbosity, silence}, + {options, [{bind_to, true}, + {no_reuse, false}, + {recbuf, 33000}, + {sndbuf, 34000}]}]}, + {def_user_mod, snmpm_user_default}, + {def_user_data, undefined} + ] + } + ] + } +]. |