aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/test
diff options
context:
space:
mode:
Diffstat (limited to 'lib/snmp/test')
-rw-r--r--lib/snmp/test/modules.mk3
-rw-r--r--lib/snmp/test/snmp_compiler_test.erl48
-rw-r--r--lib/snmp/test/snmp_test_data/Test3.mib123
3 files changed, 171 insertions, 3 deletions
diff --git a/lib/snmp/test/modules.mk b/lib/snmp/test/modules.mk
index eacc749b53..7b0bdc5b8f 100644
--- a/lib/snmp/test/modules.mk
+++ b/lib/snmp/test/modules.mk
@@ -76,7 +76,8 @@ MIB_FILES = \
TestTrap.mib \
TestTrapv2.mib \
Test1.mib \
- Test2.mib
+ Test2.mib \
+ Test3.mib
SPECS = snmp.spec snmp.spec.vxworks
diff --git a/lib/snmp/test/snmp_compiler_test.erl b/lib/snmp/test/snmp_compiler_test.erl
index f3a1e77322..257fc47952 100644
--- a/lib/snmp/test/snmp_compiler_test.erl
+++ b/lib/snmp/test/snmp_compiler_test.erl
@@ -49,6 +49,7 @@
agent_capabilities/1,
module_compliance/1,
warnings_as_errors/1,
+ augments_extra_info/1,
otp_6150/1,
otp_8574/1,
@@ -59,6 +60,7 @@
%%----------------------------------------------------------------------
%% Internal exports
%%----------------------------------------------------------------------
+
-export([
]).
@@ -125,6 +127,7 @@ all() ->
agent_capabilities,
module_compliance,
warnings_as_errors,
+ augments_extra_info,
{group, tickets}
].
@@ -387,6 +390,47 @@ otp_8595(Config) when is_list(Config) ->
%%======================================================================
+
+augments_extra_info(suite) ->
+ [];
+augments_extra_info(Config) when is_list(Config) ->
+ put(tname, augments_extra_info),
+ p("starting with Config: ~p~n", [Config]),
+
+ Dir = ?config(case_top_dir, Config),
+ MibDir = ?config(mib_dir, Config),
+ Test2File = join(MibDir, "Test2.mib"),
+ Test3File = join(MibDir, "Test3.mib"),
+ ?line {ok, Test2BinFile} =
+ snmpc:compile(Test2File, [{outdir, Dir},
+ {verbosity, silence},
+ {group_check, false}]),
+ io:format("Test2BinFile: ~n~p~n", [Test2BinFile]),
+ ?line {ok, Test3BinFile} =
+ snmpc:compile(Test3File, [{i, [MibDir]},
+ {outdir, Dir},
+ {verbosity, silence},
+ {group_check, true}]),
+ io:format("Test3BinFile: ~n~p~n", [Test3BinFile]),
+ {ok, Test3Mib} = snmp_misc:read_mib(Test3BinFile),
+ io:format("Test3Mib: ~n~p~n", [Test3Mib]),
+ %% There is only one table in this mib
+ #mib{table_infos = [{TableName, TI}]} = Test3Mib,
+ io:format("TableName: ~p"
+ "~n Table Info: ~p"
+ "~n", [TableName, TI]),
+ #table_info{nbr_of_cols = 4,
+ defvals = DefVals,
+ not_accessible = [2,4],
+ index_types = {augments, {tEntry, undefined}},
+ first_accessible = 1} = TI,
+ io:format("Table info: ~p"
+ "~n DefVals: ~p"
+ "~n", [TableName, DefVals]),
+ ok.
+
+
+%%======================================================================
%% Internal functions
%%======================================================================
@@ -540,11 +584,11 @@ DESCRIPTION \"" ++ Desc ++ "\"
::= { test 1 }
END",
- Message = file:write_file(Filename ,Binary),
+ Message = file:write_file(Filename, Binary),
case Message of
ok -> ok;
{error, Reason} ->
- exit({failed_writing_mib,Reason})
+ exit({failed_writing_mib, Reason})
end.
diff --git a/lib/snmp/test/snmp_test_data/Test3.mib b/lib/snmp/test/snmp_test_data/Test3.mib
new file mode 100644
index 0000000000..7f76e4dba4
--- /dev/null
+++ b/lib/snmp/test/snmp_test_data/Test3.mib
@@ -0,0 +1,123 @@
+Test3 DEFINITIONS ::= BEGIN
+
+IMPORTS
+ MODULE-IDENTITY, OBJECT-TYPE, Integer32, snmpModules, mib-2
+ FROM SNMPv2-SMI
+ MODULE-COMPLIANCE, OBJECT-GROUP
+ FROM SNMPv2-CONF
+ tEntry
+ FROM Test2;
+
+t3MIB MODULE-IDENTITY
+ LAST-UPDATED "1203090000Z"
+ ORGANIZATION ""
+ CONTACT-INFO
+ ""
+ DESCRIPTION
+ "Test mib, used to test processing of requests."
+ ::= { snmpModules 42 }
+
+
+-- Administrative assignments ****************************************
+
+t3MIBObjects OBJECT IDENTIFIER ::= { t3MIB 1 }
+t3MIBConformance OBJECT IDENTIFIER ::= { t3MIB 2 }
+
+
+-- test4 OBJECT IDENTIFIER ::= { mib-2 18 }
+
+tAugTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF TAugEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "This table AUGMENTS tTable of the Test2 MIB."
+ ::= { t3MIBObjects 1 }
+
+tAugEntry OBJECT-TYPE
+ SYNTAX TAugEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "An entry (conceptual row) in the sysORTable."
+ AUGMENTS { tEntry }
+ ::= { tAugTable 1 }
+
+TAugEntry ::= SEQUENCE {
+ tFoo1 OCTET STRING,
+ tFoo2 OCTET STRING,
+ tBar1 Integer32,
+ tBar2 Integer32
+}
+
+tFoo1 OBJECT-TYPE
+ SYNTAX OCTET STRING (SIZE (0..255))
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "A string."
+ DEFVAL { "foo 1" }
+ ::= { tAugEntry 1 }
+
+tFoo2 OBJECT-TYPE
+ SYNTAX OCTET STRING (SIZE (0..255))
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A string."
+ DEFVAL { "foo 2" }
+ ::= { tAugEntry 2 }
+
+tBar1 OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "An integer."
+ DEFVAL { 42 }
+ ::= { tAugEntry 3 }
+
+tBar2 OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "An integer."
+ DEFVAL { 42 }
+ ::= { tAugEntry 4 }
+
+
+-- Conformance Information *******************************************
+
+t3MIBCompliances OBJECT IDENTIFIER
+ ::= { t3MIBConformance 1 }
+t3MIBGroups OBJECT IDENTIFIER
+ ::= { t3MIBConformance 2 }
+
+-- Compliance statements
+
+t3MIBCompliance MODULE-COMPLIANCE
+ STATUS current
+ DESCRIPTION
+ "The compliance statement for SNMP engines which
+ implement the SNMP-COMMUNITY-MIB."
+
+ MODULE -- this module
+ MANDATORY-GROUPS { t3Group }
+
+ ::= { t3MIBCompliances 1 }
+
+t3Group OBJECT-GROUP
+ OBJECTS {
+ tFoo1,
+ tFoo2,
+ tBar1,
+ tBar2
+ }
+ STATUS current
+ DESCRIPTION
+ "A group."
+ ::= { t3MIBGroups 1 }
+
+
+END