From c4425da5b7cf880b8ca76158e0bfecbf5202a333 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 5 Feb 2013 13:06:56 +0100 Subject: [snmp/compiler] Added test case for BITS import --- lib/snmp/test/snmp_compiler_test.erl | 31 ++++++++--- lib/snmp/test/snmp_test_data/OTP10799-MIB.mib | 75 +++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 6 deletions(-) create mode 100644 lib/snmp/test/snmp_test_data/OTP10799-MIB.mib (limited to 'lib/snmp') diff --git a/lib/snmp/test/snmp_compiler_test.erl b/lib/snmp/test/snmp_compiler_test.erl index 257fc47952..4c5a945984 100644 --- a/lib/snmp/test/snmp_compiler_test.erl +++ b/lib/snmp/test/snmp_compiler_test.erl @@ -53,7 +53,8 @@ otp_6150/1, otp_8574/1, - otp_8595/1 + otp_8595/1, + otp_10799/1 ]). @@ -132,7 +133,7 @@ all() -> ]. groups() -> - [{tickets, [], [otp_6150, otp_8574, otp_8595]}]. + [{tickets, [], [otp_6150, otp_8574, otp_8595, otp_10799]}]. init_per_group(_GroupName, Config) -> Config. @@ -326,13 +327,14 @@ warnings_as_errors(Config) when is_list(Config) -> otp_6150(suite) -> []; otp_6150(Config) when is_list(Config) -> - put(tname,otp_6150), + put(tname, otp6150), p("starting with Config: ~p~n", [Config]), Dir = ?config(case_top_dir, Config), MibDir = ?config(mib_dir, Config), MibFile = join(MibDir, "ERICSSON-TOP-MIB.mib"), - ?line {ok, Mib} = snmpc:compile(MibFile, [{outdir, Dir}, {verbosity, trace}]), + ?line {ok, Mib} = + snmpc:compile(MibFile, [{outdir, Dir}, {verbosity, trace}]), io:format("otp_6150 -> Mib: ~n~p~n", [Mib]), ok. @@ -342,7 +344,7 @@ otp_6150(Config) when is_list(Config) -> otp_8574(suite) -> []; otp_8574(Config) when is_list(Config) -> - put(tname,otp_8574), + put(tname, otp8574), p("starting with Config: ~p~n", [Config]), Dir = ?config(case_top_dir, Config), @@ -375,7 +377,7 @@ otp_8574(Config) when is_list(Config) -> otp_8595(suite) -> []; otp_8595(Config) when is_list(Config) -> - put(tname,otp_8595), + put(tname, otp8595), p("starting with Config: ~p~n", [Config]), Dir = ?config(case_top_dir, Config), @@ -389,6 +391,23 @@ otp_8595(Config) when is_list(Config) -> ok. +%%====================================================================== + +otp_10799(suite) -> + []; +otp_10799(Config) when is_list(Config) -> + put(tname, otp10799), + p("starting with Config: ~p~n", [Config]), + + Dir = ?config(case_top_dir, Config), + MibDir = ?config(mib_dir, Config), + MibFile = join(MibDir, "OTP10799-MIB.mib"), + ?line {ok, Mib} = + snmpc:compile(MibFile, [{outdir, Dir}, {verbosity, trace}]), + p("Mib: ~n~p~n", [Mib]), + ok. + + %%====================================================================== augments_extra_info(suite) -> diff --git a/lib/snmp/test/snmp_test_data/OTP10799-MIB.mib b/lib/snmp/test/snmp_test_data/OTP10799-MIB.mib new file mode 100644 index 0000000000..f47bcfd7da --- /dev/null +++ b/lib/snmp/test/snmp_test_data/OTP10799-MIB.mib @@ -0,0 +1,75 @@ +OTP10799-MIB DEFINITIONS ::= BEGIN + +IMPORTS + MODULE-IDENTITY, OBJECT-TYPE, snmpModules, mib-2, BITS + FROM SNMPv2-SMI + MODULE-COMPLIANCE, OBJECT-GROUP + FROM SNMPv2-CONF + ; + +otp10799MIB MODULE-IDENTITY + LAST-UPDATED "1004210000Z" + ORGANIZATION "" + CONTACT-INFO + "" + DESCRIPTION + "Test mib for OTP-10799" + ::= { snmpModules 1 } + + +-- Administrative assignments **************************************** + +otp10799MIBObjects OBJECT IDENTIFIER ::= { otp10799MIB 1 } +otp10799MIBConformance OBJECT IDENTIFIER ::= { otp10799MIB 2 } + +-- + +test OBJECT IDENTIFIER ::= { mib-2 16 } + +bits1 OBJECT-TYPE + SYNTAX BITS { + b0(0), + b1(1), + b2(2), + b3(3), + b4(4), + b5(5), + b6(6), + b7(7) + } + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "" + ::= { test 1 } + +-- Conformance Information ******************************************* + +otp10799MIBCompliances OBJECT IDENTIFIER + ::= { otp10799MIBConformance 1 } +otp10799MIBGroups OBJECT IDENTIFIER + ::= { otp10799MIBConformance 2 } + +-- Compliance statements + +otp10799MIBCompliance MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "The compliance statement for SNMP engines which + implement the SNMP-COMMUNITY-MIB." + + MODULE -- this module + MANDATORY-GROUPS { otp10799Group } + + ::= { otp10799Compliances 1 } + +otp10799Group OBJECT-GROUP + OBJECTS { + bits1 + } + STATUS current + DESCRIPTION + "A group." + ::= { otp10799MIBGroups 1 } + +END -- cgit v1.2.3