diff options
Diffstat (limited to 'lib/snmp')
89 files changed, 4693 insertions, 2205 deletions
diff --git a/lib/snmp/doc/man1/.gitignore b/lib/snmp/doc/man1/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/snmp/doc/man1/.gitignore diff --git a/lib/snmp/doc/src/Makefile b/lib/snmp/doc/src/Makefile index e8d9efb148..70c2e1d09e 100644 --- a/lib/snmp/doc/src/Makefile +++ b/lib/snmp/doc/src/Makefile @@ -67,12 +67,15 @@ XML_OUTPUT = $(XML_FILES:%.xml=%.latex.xmls_output) \ INFO_FILE = ../../info +#HTML_REF1_FILES = $(XML_REF1_FILES:%.xml=$(HTMLDIR)/%.html) HTML_REF3_FILES = $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) HTML_REF6_FILES = $(XML_REF6_FILES:%.xml=$(HTMLDIR)/%.html) HTML_CHAP_FILES = $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) -EXTRA_FILES = summary.html.src \ +EXTRA_FILES = \ + summary.html.src \ $(DEFAULT_HTML_FILES) \ + $(HTML_REF1_FILES) \ $(HTML_REF3_FILES) \ $(HTML_REF6_FILES) \ $(HTML_CHAP_FILES) @@ -80,6 +83,7 @@ EXTRA_FILES = summary.html.src \ MAN7DIR = $(DOCDIR)/man7 +MAN1_FILES = $(MAN1DIR)/snmpc.1 MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) MAN6_FILES = $(XML_REF6_FILES:%_app.xml=$(MAN6DIR)/%.6) MAN7_FILES = $(MIB_FILES:$(MIBSDIR)/%.mib=$(MAN7DIR)/%.7) @@ -95,6 +99,7 @@ else TEX_FILES_BOOK = \ $(BOOK_FILES:%.xml=%.tex) TEX_FILES_REF_MAN = \ + $(XML_REF1_FILES:%.xml=%.tex) \ $(XML_REF3_FILES:%.xml=%.tex) \ $(XML_REF6_FILES:%.xml=%.tex) \ $(XML_APPLICATION_FILES:%.xml=%.tex) @@ -169,7 +174,7 @@ ps: $(TOP_PS_FILE) html: $(HTML_FILES) $(TOP_HTML_FILES) gifs -html2: gifs $(TOP_HTML_FILES) $(HTML_FILES) $(HTML_REF3_FILES) $(HTML_REF6_FILES) $(HTML_CHAP_FILES) +html2: gifs $(TOP_HTML_FILES) $(HTML_FILES) $(HTML_REF1_FILES) $(HTML_REF3_FILES) $(HTML_REF6_FILES) $(HTML_CHAP_FILES) clean: clean_tex clean_html clean_man clean_docs @@ -195,7 +200,9 @@ endif $(INDEX_TARGET): $(INDEX_SRC) ../../vsn.mk # Create top make file sed -e 's;%VSN%;$(VSN);' $< > $@ # inserting version number -man: man3 man6 man7 +man: man1 man3 man6 man7 + +man1: $(MAN1_FILES) man3: $(MAN3_FILES) @@ -213,6 +220,7 @@ clean_pdf: clean_man: @echo "cleaning man:" + rm -f $(MAN1DIR)/* rm -f $(MAN3DIR)/* rm -f $(MAN6DIR)/* rm -f $(MAN7DIR)/* @@ -233,6 +241,11 @@ $(MAN7DIR)/%.7: $(MIBSDIR)/%.mib # ---------------------------------------------------- # Release Target # ---------------------------------------------------- + +$(MAN1DIR)/snmpc.1: snmpc_cmd.xml + date=`date +"%B %e %Y"`; \ + xsltproc --output "$@" --stringparam company "Ericsson AB" --stringparam docgen "$(DOCGEN)" --stringparam gendate "$$date" --stringparam appname "$(APPLICATION)" --stringparam appver "$(VSN)" --xinclude -path $(DOCGEN)/priv/docbuilder_dtd -path $(DOCGEN)/priv/dtd_man_entities $(DOCGEN)/priv/xsl/db_man.xsl $< + include $(ERL_TOP)/make/otp_release_targets.mk ifdef DOCSUPPORT @@ -244,6 +257,8 @@ release_docs_spec: docs $(INSTALL_DATA) $(HTMLDIR)/* \ $(RELSYSDIR)/doc/html $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR) + $(INSTALL_DIR) $(RELEASE_PATH)/man/man1 + $(INSTALL_DATA) $(MAN1DIR)/* $(RELEASE_PATH)/man/man1 $(INSTALL_DIR) $(RELEASE_PATH)/man/man3 $(INSTALL_DATA) $(MAN3DIR)/* $(RELEASE_PATH)/man/man3 $(INSTALL_DIR) $(RELEASE_PATH)/man/man6 @@ -269,7 +284,9 @@ release_docs_spec: docs $(INSTALL_DATA) $(GIF_FILES) $(EXTRA_FILES) $(HTML_FILES) \ $(RELSYSDIR)/doc/html $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR) - $(INSTALL_DIR) $(RELEASE_PATH)/man/man3 + $(INSTALL_DIR) $(RELEASE_PATH)/man/man1 + $(INSTALL_DATA) $(MAN1_FILES) $(RELEASE_PATH)/man/man1 + $(INSTALL_DIR) $(RELEASE_PATH)/man/man $(INSTALL_DATA) $(MAN3_FILES) $(RELEASE_PATH)/man/man3 $(INSTALL_DIR) $(RELEASE_PATH)/man/man6 $(INSTALL_DATA) $(MAN6_FILES) $(RELEASE_PATH)/man/man6 @@ -286,6 +303,10 @@ release_spec: ifdef DOCSUPPORT info: info_xml info_man info_html + @echo "MAN1DIR: $(MAN1DIR)" + @echo "MAN3DIR: $(MAN3DIR)" + @echo "MAN6DIR: $(MAN6DIR)" + @echo "MAN7DIR: $(MAN7DIR)" else info: info_xml info_man info_html info_tex @echo "DVI2PS = $(DVI2PS)" @@ -297,6 +318,7 @@ endif info_man: @echo "man files:" + @echo "MAN1_FILES = $(MAN1_FILES)" @echo "MAN3_FILES = $(MAN3_FILES)" @echo "MAN6_FILES = $(MAN6_FILES)" @echo "MAN7_FILES = $(MAN7_FILES)" @@ -305,6 +327,7 @@ info_man: info_xml: @echo "xml files:" +# @echo "XML_REF1_FILES = $(XML_REF1_FILES)" @echo "XML_REF3_FILES = $(XML_REF3_FILES)" @echo "XML_REF6_FILES = $(XML_REF6_FILES)" @echo "XML_PART_FILES = $(XML_PART_FILES)" @@ -333,6 +356,7 @@ info_html: @echo "" @echo "DEFAULT_HTML_FILES = $(DEFAULT_HTML_FILES)" @echo "" +# @echo "HTML_REF1_FILES = $(HTML_REF1_FILES)" @echo "HTML_REF3_FILES = $(HTML_REF3_FILES)" @echo "HTML_REF6_FILES = $(HTML_REF6_FILES)" @echo "HTML_CHAP_FILES = $(HTML_CHAP_FILES)" diff --git a/lib/snmp/doc/src/depend.mk b/lib/snmp/doc/src/depend.mk index bf9833274d..4538f744de 100644 --- a/lib/snmp/doc/src/depend.mk +++ b/lib/snmp/doc/src/depend.mk @@ -48,6 +48,7 @@ $(HTMLDIR)/ref_man.html: \ snmp_app.xml \ snmp.xml \ snmpc.xml \ + snmpc_cmd.xml \ snmpa.xml \ snmpa_conf.xml \ snmpa_discovery_handler.xml \ diff --git a/lib/snmp/doc/src/files.mk b/lib/snmp/doc/src/files.mk index 293fb52ce0..f8462098be 100644 --- a/lib/snmp/doc/src/files.mk +++ b/lib/snmp/doc/src/files.mk @@ -23,6 +23,9 @@ XML_APPLICATION_FILES = \ XML_APP_REF3_FILES = \ snmp.xml +XML_COMP_REF1_FILES = \ + snmpc_cmd.xml + XML_COMP_REF3_FILES = \ snmpc.xml @@ -98,12 +101,13 @@ XML_CHAPTER_FILES = \ BOOK_FILES = book.xml -XML_FILES = $(BOOK_FILES) \ - $(XML_CHAPTER_FILES) \ - $(XML_PART_FILES) \ - $(XML_REF6_FILES) \ - $(XML_REF3_FILES) \ - $(XML_APPLICATION_FILES) +XML_FILES = $(BOOK_FILES) \ + $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) \ + $(XML_REF1_FILES) \ + $(XML_REF3_FILES) \ + $(XML_REF6_FILES) \ + $(XML_APPLICATION_FILES) GIF_FILES = book.gif \ getnext1.gif \ diff --git a/lib/snmp/doc/src/make.dep b/lib/snmp/doc/src/make.dep index ccd01b9d3a..6d741ec1b9 100644 --- a/lib/snmp/doc/src/make.dep +++ b/lib/snmp/doc/src/make.dep @@ -52,7 +52,7 @@ book.dvi: book.tex part.tex ref_man.tex snmp.tex snmp_advanced_agent.tex \ snmpa_notification_delivery_info_receiver.tex \ snmpa_notification_filter.tex \ snmpa_supervisor.tex \ - snmpc.tex snmpm.tex snmpm_conf.tex snmpm_mpd.tex \ + snmpc.tex snmpc_cmd.tex snmpm.tex snmpm_conf.tex snmpm_mpd.tex \ snmpm_network_interface.tex snmpm_network_interface_filter.tex \ snmpm_user.tex diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 03881f1823..665c78f603 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -32,18 +32,125 @@ <file>notes.xml</file> </header> - <section><title>SNMP 4.18</title> + <section> + <title>SNMP Development Toolkit 4.19</title> + <p>Version 4.19 supports code replacement in runtime from/to + version 4.18.</p> + <section> <title>Improvements and new features</title> +<!-- + <p>-</p> +--> + <list type="bulleted"> + <item> + <p>[compiler] Added support for textual convention + <c>AGENT-CAPABILITIES</c> and "full" support for textual + convention MODULE-COMPLIANCE, both defined by the SNMPv2-CONF + mib.</p> + <p>The <c>reference</c> and <c>modules</c> part(s) are + stored in the <c>assocList</c> of the mib-entry (<c>me</c>) + record. + Only handled <em>if</em> the option(s) <c>agent_capabilities</c> + and <c>module_compliance</c> (respectively) are provided to the + compiler. </p> + <p>See <seealso marker="snmpc#compile">compile/2</seealso> + for more info. </p> + <p>For backward compatibillity, the MIBs provided with + this application are <em>not</em> compiled with these + options. </p> + <p>Own Id: OTP-8966</p> + </item> + + <item> + <p>[agent] Added a "complete" set of (snmp) table and variable + print functions, for each mib handled by the SNMP (agent) + application. This will be usefull when debugging a running agent.</p> + <p>See + <seealso marker="snmpa#print_mib_info">print_mib_info/0</seealso>, + <seealso marker="snmpa#print_mib_tables">print_mib_tables/0</seealso> + and + <seealso marker="snmpa#print_mib_variables">print_mib_variables/0</seealso> + for more info. </p> + <p>Own Id: OTP-8977</p> + </item> + + <item> + <p>[compiler] Added a MIB compiler (frontend) escript, + <seealso marker="snmpc_cmd">snmpc</seealso>. </p> + <p>Own Id: OTP-9004</p> + </item> + + </list> + </section> + + <section> + <title>Fixed Bugs and Malfunctions</title> +<!-- <p>-</p> +--> + <list type="bulleted"> + <item> + <p>[agent] For the table vacmAccessTable, + when performing the is_set_ok and set operation(s), + all values of the vacmAccessSecurityModel column was + incorrectly translated to <c>any</c>. </p> +<!-- +that is when calling: +snmp_view_basec_acm_mib:vacmAccessTable(set, RowIndex, Cols). +--> + <p>Own Id: OTP-8980</p> + </item> + + <item> + <p>[agent] When calling + <seealso marker="snmp_view_based_acm_mib#reconfigure">snmp_view_based_acm_mib:reconfigure/1</seealso> + on a running node, the table <c>vacmAccessTable</c> was not properly + cleaned. + This meant that if some entries in the vacm.conf file was removed + (compared to the <c>current</c> config), + while others where modified and/or added, the removed entrie(s) + would still exist in the <c>vacmAccessTable</c> table. </p> + <p>Own Id: OTP-8981</p> + <p>Aux Id: Seq 11750</p> + </item> + + </list> + </section> + + + <section> + <title>Incompatibilities</title> + <p>-</p> + </section> + + </section> <!-- 4.19 --> + + <section> + <title>SNMP Development Toolkit 4.18</title> + <p>Version 4.18 supports code replacement in runtime from/to + version 4.17.1 and 4.17.</p> + + <section> + <title>Improvements and new features</title> + <list type="bulleted"> + <item> + <p>Prepared for R14B release.</p> + </item> + </list> </section> <section><title>Fixed Bugs and Malfunctions</title> - <list> + <p>-</p> +<!-- + <list type="bulleted"> <item> - <p>Cosmetic prep for R14B (plain) release. </p> + <p>[agent] When the function FilterMod:accept_recv/2 returned false + the SNMP agent stopped collecting messages from UDP.</p> + <p>Own Id: OTP-8761</p> </item> </list> +--> </section> <section> @@ -68,7 +175,8 @@ <list type="bulleted"> <item> <p>When the function FilterMod:accept_recv/2 - returned false the SNMP agent stopped collecting messages from UDP.</p> + returned false the SNMP agent stopped collecting + messages from UDP.</p> <p>Own Id: OTP-8761</p> </item> </list> diff --git a/lib/snmp/doc/src/ref_man.xml b/lib/snmp/doc/src/ref_man.xml index 1ae5a8205b..815d21d33e 100644 --- a/lib/snmp/doc/src/ref_man.xml +++ b/lib/snmp/doc/src/ref_man.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE application SYSTEM "application.dtd"> <application xmlns:xi="http://www.w3.org/2001/XInclude"> @@ -61,6 +61,7 @@ <xi:include href="snmp_user_based_sm_mib.xml"/> <xi:include href="snmp_view_based_acm_mib.xml"/> <xi:include href="snmpc.xml"/> + <xi:include href="snmpc_cmd.xml"/> <xi:include href="snmpm.xml"/> <xi:include href="snmpm_conf.xml"/> <xi:include href="snmpm_mpd.xml"/> diff --git a/lib/snmp/doc/src/snmp_config.xml b/lib/snmp/doc/src/snmp_config.xml index 769b908adc..4e41cb5037 100644 --- a/lib/snmp/doc/src/snmp_config.xml +++ b/lib/snmp/doc/src/snmp_config.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> @@ -1004,36 +1004,16 @@ ok </taglist> <p>Another usefull way to debug the agent is to pretty-print the content of - some of the (MIB-) tables handled directly by the agent. This can be done - for the following tables: </p> - <taglist> - <tag><c><![CDATA[snmpCommunityTable]]></c></tag> - <item> - <p><c><![CDATA[snmp_community_mib:snmpCommunityTable(print).]]></c></p> - </item> - - <tag><c><![CDATA[snmpNotifyTable]]></c></tag> - <item> - <p><c><![CDATA[snmp_notification_mib:snmpNotifyTable(print).]]></c></p> - </item> - - <tag><c><![CDATA[snmpTargetAddrTable]]></c></tag> - <item> - <p><c><![CDATA[snmp_target_mib:snmpTargetAddrTable(print).]]></c></p> - </item> - - <tag><c><![CDATA[snmpTargetParamsTable]]></c></tag> - <item> - <p><c><![CDATA[snmp_target_mib:snmpTargetParamsTable(print).]]></c></p> - </item> - - <tag><c><![CDATA[usmUserTable]]></c></tag> - <item> - <p><c><![CDATA[snmp_user_based_sm_mib:usmUserTable(print).]]></c></p> - </item> - - </taglist> - + all the tables and/or variables handled directly by the agent. + This can be done by simply calling: </p> + <p><c><![CDATA[snmpa:print_mib_info()]]></c></p> + <p>See + <seealso marker="snmpa#print_mib_info">print_mib_info/0</seealso>, + <seealso marker="snmpa#print_mib_tables">print_mib_tables/0</seealso> + or + <seealso marker="snmpa#print_mib_variables">print_mib_variables/0</seealso> + for more info. </p> + </section> </chapter> diff --git a/lib/snmp/doc/src/snmp_view_based_acm_mib.xml b/lib/snmp/doc/src/snmp_view_based_acm_mib.xml index ffea256608..d595f6b93b 100644 --- a/lib/snmp/doc/src/snmp_view_based_acm_mib.xml +++ b/lib/snmp/doc/src/snmp_view_based_acm_mib.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1999</year><year>2009</year> + <year>1999</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -38,7 +38,10 @@ SNMP-VIEW-BASED-ACM-MIB, and functions for configuring the database. </p> <p>The configuration files are described in the SNMP User's Manual.</p> + + <marker id="configure"></marker> </description> + <funcs> <func> <name>configure(ConfDir) -> void()</name> @@ -48,27 +51,24 @@ </type> <desc> <p>This function is called from the supervisor at system - start-up. - </p> + start-up. </p> <p>Inserts all data in the configuration files into the - database and destroys all old rows with StorageType - <c>volatile</c>. The rows created from the configuration file - will have StorageType <c>nonVolatile</c>. - </p> - <p>All <c>snmp</c> counters are set to zero. - </p> + database and destroys all old rows with StorageType + <c>volatile</c>. The rows created from the configuration file + will have StorageType <c>nonVolatile</c>. </p> + <p>All <c>snmp</c> counters are set to zero. </p> <p>If an error is found in the configuration file, it is - reported using the function <c>config_err/2</c> of the error - report module, and the function fails with the reason - <c>configuration_error</c>. - </p> + reported using the function <c>config_err/2</c> of the error + report module, and the function fails with the reason + <c>configuration_error</c>. </p> <p><c>ConfDir</c> is a string which points to the directory - where the configuration files are found. - </p> - <p>The configuration file read is: <c>vacm.conf</c>. - </p> + where the configuration files are found. </p> + <p>The configuration file read is: <c>vacm.conf</c>. </p> + + <marker id="reconfigure"></marker> </desc> </func> + <func> <name>reconfigure(ConfDir) -> void()</name> <fsummary>Configure the SNMP-VIEW-BASED-ACM-MIB</fsummary> @@ -88,18 +88,20 @@ <p>All <c>snmp</c> counters are set to zero. </p> <p>If an error is found in the configuration file, it is - reported using the function <c>config_err/2</c> of the error - report module, and the function fails with the reason + reported using the function + <seealso marker="snmpa_error#config_err">config_err/2</seealso> + of the error report module, and the function fails with the reason <c>configuration_error</c>. </p> <p><c>ConfDir</c> is a string which points to the directory where the configuration files are found. </p> - <p>The configuration file read is: <c>vacm.conf</c>. - <marker id="add_sec2group"></marker> -</p> + <p>The configuration file read is: <c>vacm.conf</c>. </p> + + <marker id="add_sec2group"></marker> </desc> </func> + <func> <name>add_sec2group(SecModel, SecName, GroupName) -> Ret</name> <fsummary>Add one security to group definition</fsummary> @@ -113,10 +115,13 @@ </type> <desc> <p>Adds a security to group definition to the agent config. - Equivalent to one vacmSecurityToGroup-line in the <c>vacm.conf</c> file.</p> + Equivalent to one vacmSecurityToGroup-line in the + <c>vacm.conf</c> file.</p> + <marker id="delete_sec2group"></marker> </desc> </func> + <func> <name>delete_sec2group(Key) -> Ret</name> <fsummary>Delete one security to group definition</fsummary> @@ -127,9 +132,11 @@ </type> <desc> <p>Delete a security to group definition from the agent config.</p> + <marker id="add_access"></marker> </desc> </func> + <func> <name>add_access(GroupName, Prefix, SecModel, SecLevel, Match, RV, WV, NV) -> Ret</name> <fsummary>Add one access definition</fsummary> @@ -148,10 +155,12 @@ </type> <desc> <p>Adds a access definition to the agent config. - Equivalent to one vacmAccess-line in the <c>vacm.conf</c> file.</p> - <marker id="delete_access"></marker> + Equivalent to one vacmAccess-line in the <c>vacm.conf</c> file.</p> + + <marker id="delete_access"></marker> </desc> </func> + <func> <name>delete_access(Key) -> Ret</name> <fsummary>Delete one access definition</fsummary> @@ -161,10 +170,12 @@ <v>Reason = term()</v> </type> <desc> - <p>Delete a access definition from the agent config.</p> - <marker id="add_view_tree_fam"></marker> + <p>Delete a access definition from the agent config.</p> + + <marker id="add_view_tree_fam"></marker> </desc> </func> + <func> <name>add_view_tree_fam(ViewIndex, SubTree, Status, Mask) -> Ret</name> <fsummary>Add one view tree family definition</fsummary> @@ -178,11 +189,14 @@ <v>Reason = term()</v> </type> <desc> - <p>Adds a view tree family definition to the agent config. - Equivalent to one vacmViewTreeFamily-line in the <c>vacm.conf</c> file.</p> - <marker id="delete_view_tree_fam"></marker> + <p>Adds a view tree family definition to the agent config. + Equivalent to one vacmViewTreeFamily-line in the + <c>vacm.conf</c> file.</p> + + <marker id="delete_view_tree_fam"></marker> </desc> </func> + <func> <name>delete_view_tree_fam(Key) -> Ret</name> <fsummary>Delete one view tree family definition</fsummary> diff --git a/lib/snmp/doc/src/snmpa.xml b/lib/snmp/doc/src/snmpa.xml index f546724a78..1d680e80f5 100644 --- a/lib/snmp/doc/src/snmpa.xml +++ b/lib/snmp/doc/src/snmpa.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>2004</year><year>2010</year> + <year>2004</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -1252,6 +1252,39 @@ snmp_agent:register_subagent(SA1,[1,2,3], SA2). <p>This is a utility function, that can be useful when e.g. debugging instrumentation functions.</p> + <marker id="print_mib_info"></marker> + </desc> + </func> + + <func> + <name>print_mib_info() -> void()</name> + <fsummary>Print mib info</fsummary> + <desc> + <p>Prints the content of all the (snmp) tables and variables + for all mibs handled by the snmp agent. </p> + + <marker id="print_mib_tables"></marker> + </desc> + </func> + + <func> + <name>print_mib_tables() -> void()</name> + <fsummary>Print mib tables</fsummary> + <desc> + <p>Prints the content of all the (snmp) tables + for all mibs handled by the snmp agent. </p> + + <marker id="print_mib_variables"></marker> + </desc> + </func> + + <func> + <name>print_mib_variables() -> void()</name> + <fsummary>Print mib variables</fsummary> + <desc> + <p>Prints the content of all the (snmp) variables + for all mibs handled by the snmp agent. </p> + <marker id="verbosity"></marker> </desc> </func> diff --git a/lib/snmp/doc/src/snmpa_error.xml b/lib/snmp/doc/src/snmpa_error.xml index a7312e8b24..4dbafdfbb7 100644 --- a/lib/snmp/doc/src/snmpa_error.xml +++ b/lib/snmp/doc/src/snmpa_error.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2002</year><year>2009</year> + <year>2002</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -51,6 +51,8 @@ <c>error_report_mod</c>, see <seealso marker="snmp_config#configuration_params">configuration parameters</seealso>. </p> + + <marker id="config_err"></marker> </description> <funcs> <func> @@ -67,8 +69,11 @@ </p> <p><c>Format</c> and <c>Args</c> are as in <c>io:format(Format, Args)</c>.</p> + + <marker id="user_err"></marker> </desc> </func> + <func> <name>user_err(Format, Args) -> void()</name> <fsummary>Called if a user related error occurs</fsummary> diff --git a/lib/snmp/doc/src/snmpc.xml b/lib/snmp/doc/src/snmpc.xml index fbd0950c69..771629492d 100644 --- a/lib/snmp/doc/src/snmpc.xml +++ b/lib/snmp/doc/src/snmpc.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>2004</year><year>2010</year> + <year>2004</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -37,6 +37,7 @@ <p>The module <c>snmpc</c> contains interface functions to the SNMP toolkit MIB compiler.</p> + <marker id="compile"></marker> </description> <funcs> @@ -47,7 +48,7 @@ <type> <v>File = string()</v> <v>Options = [opt()]</v> - <v>opt() = db() | relaxed_row_name_assign_check() | deprecated() | description() | reference() | group_check() | i() | il() | imports() | module() | module_identity() | outdir() | no_defs() | verbosity() | warnings()</v> + <v>opt() = db() | relaxed_row_name_assign_check() | deprecated() | description() | reference() | group_check() | i() | il() | imports() | module() | module_identity() | module_compliance() | agent_capabilities() | outdir() | no_defs() | verbosity() | warnings()</v> <v>db() = {db, volatile|persistent|mnesia}</v> <v>deprecated() = {deprecated, bool()}</v> <v>relaxed_row_name_assign_check() = relaxed_row_name_assign_check</v> @@ -59,6 +60,8 @@ <v>imports() = imports</v> <v>module() = {module, atom()}</v> <v>module_identity() = module_identity</v> + <v>module_compliance() = module_compliance</v> + <v>agent_capabilities() = agent_capabilities</v> <v>no_defs() = no_defs</v> <v>outdir() = {outdir, dir()}</v> <v>verbosity() = {verbosity, silence|warning|info|log|debug|trace}</v> @@ -77,6 +80,7 @@ be used for the default instrumentation. </p> <p>Default is <c>volatile</c>. </p> </item> + <item> <p>The option <c>deprecated</c> specifies if a deprecated definition should be kept or not. If the option is @@ -84,6 +88,7 @@ definitions. </p> <p>Default is <c>true</c>. </p> </item> + <item> <p>The option <c>relaxed_row_name_assign_check</c>, if present, specifies that the row name assign check shall not be done @@ -94,12 +99,14 @@ <p>By default it is not included, but if this option is present it will be. </p> </item> + <item> <p>The option <c>description</c> specifies if the text of the DESCRIPTION field will be included or not. </p> <p>By default it is not included, but if this option is present it will be. </p> </item> + <item> <p>The option <c>reference</c> specifies if the text of the REFERENCE field, when found in a table definition, @@ -108,18 +115,21 @@ it will be. The reference text will be placed in the allocList field of the mib-entry record (#me{}) for the table. </p> </item> + <item> <p>The option <c>group_check</c> specifies whether the mib compiler should check the OBJECT-GROUP macro and the NOTIFICATION-GROUP macro for correctness or not. </p> <p>Default is <c>true</c>. </p> </item> + <item> <p>The option <c>i</c> specifies the path to search for imported (compiled) MIB files. The directories should be strings with a trailing directory delimiter. </p> <p>Default is <c>["./"]</c>. </p> </item> + <item> <p>The option <c>il</c> (include_lib) also specifies a list of directories to search for imported MIBs. It @@ -132,11 +142,13 @@ <c><![CDATA[<snmp-home>/priv/mibs/]]></c> are always listed last in the include path. </p> </item> + <item> <p>The option <c>imports</c>, if present, specifies that the IMPORT statement of the MIB shall be included in the compiled mib. </p> </item> + <item> <p>The option <c>module</c>, if present, specifies the name of a module which implements all instrumentation @@ -145,11 +157,29 @@ functions must be the same as the corresponding managed object it implements. </p> </item> + <item> <p>The option <c>module_identity</c>, if present, specifies that the info part of the MODULE-IDENTITY statement of the MIB shall be included in the compiled mib. </p> </item> + + <item> + <p>The option <c>module_compliance</c>, if present, specifies + that the MODULE-COMPLIANCE statement of the MIB shall be included + (with a mib-entry record) in the compiled mib. The mib-entry record + of the module-compliance will contain <c>reference</c> and <c>module</c> + part(s) this info in the <c>assocList</c> field). </p> + </item> + + <item> + <p>The option <c>agent_capabilities</c>, if present, specifies + that the AGENT-CAPABILITIES statement of the MIB shall be included + (with a mib-entry record) in the compiled mib. The mib-entry record + of the agent-capabilitie will contain <c>reference</c> and <c>modules</c> + part(s) this info in the <c>assocList</c> field). </p> + </item> + <item> <p>The option <c>no_defs</c>, if present, specifies that if a managed object does not have an instrumentation @@ -157,6 +187,7 @@ be used, instead this is reported as an error, and the compilation aborts. </p> </item> + <item> <p>The option <c>verbosity</c> specifies the verbosity of the SNMP mib compiler. I.e. if warning, info, log, debug @@ -166,11 +197,13 @@ option <c>verbosity</c> is <c>silence</c>, warning messages will still be shown. </p> </item> + <item> <p>The option <c>warnings</c> specifies whether warning messages should be shown. </p> <p>Default is <c>true</c>. </p> </item> + </list> <p>The MIB compiler understands both SMIv1 and SMIv2 MIBs. It uses the <c>MODULE-IDENTITY</c> statement to determine if the MIB is @@ -185,8 +218,11 @@ have to be specified to <c>erlc</c> using the syntax <c>+term</c>. See <c>erlc(1)</c> for details. </p> + + <marker id="is_consistent"></marker> </desc> </func> + <func> <name>is_consistent(Mibs) -> ok | {error, Reason}</name> <fsummary>Check for OID conflicts between MIBs</fsummary> @@ -198,8 +234,11 @@ <p>Checks for multiple usage of object identifiers and traps between MIBs. </p> + + <marker id="mib_to_hrl"></marker> </desc> </func> + <func> <name>mib_to_hrl(MibName) -> ok | {error, Reason}</name> <fsummary>Generate constants for the objects in the MIB</fsummary> diff --git a/lib/snmp/include/snmp_types.hrl b/lib/snmp/include/snmp_types.hrl index 1fd6d153c9..4adb24361c 100644 --- a/lib/snmp/include/snmp_types.hrl +++ b/lib/snmp/include/snmp_types.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -192,7 +192,7 @@ %%---------------------------------------------------------------------- -record(mib, {misc = [], - mib_format_version = "3.1", + mib_format_version = "3.2", name = "", module_identity, %% Not in SMIv1, and only with +module_identity mes = [], diff --git a/lib/snmp/mibs/Makefile.in b/lib/snmp/mibs/Makefile.in index b85a8b0767..7aefb0ea34 100644 --- a/lib/snmp/mibs/Makefile.in +++ b/lib/snmp/mibs/Makefile.in @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 1996-2009. 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 @@ -108,20 +108,28 @@ TARGET_FILES = \ # FLAGS # ---------------------------------------------------- -SNMP_FLAGS += -pa ../ebin +version +SNMP_FLAGS += -pa ../ebin +version ifneq ($(MIBS_VERBOSITY),) -SNMP_FLAGS += +'{verbosity,$(MIBS_VERBOSITY)}' +SNMP_FLAGS += +'{verbosity, $(MIBS_VERBOSITY)}' endif -ifneq ($(MIBS_REFERENCE),) +ifeq ($(MIBS_REFERENCE),true) SNMP_FLAGS += +reference endif -ifneq ($(MIBS_OPTIONS),) +ifeq ($(MIBS_OPTIONS),true) SNMP_FLAGS += +options endif +ifeq ($(MIBS_MC),true) +SNMP_FLAGS += +module_compliance +endif + +ifeq ($(MIBS_AC),true) +SNMP_FLAGS += +agent_capabilities +endif + # ---------------------------------------------------- # Targets @@ -148,6 +156,14 @@ conf: cd ..; $(MAKE) conf info: + @echo "MIBS_REFERENCE = $(MIBS_REFERENCE)" + @echo "" + @echo "MIBS_OPTIONS = $(MIBS_OPTIONS)" + @echo "" + @echo "MIBS_MC = $(MIBS_MC)" + @echo "" + @echo "MIBS_AC = $(MIBS_AC)" + @echo "" @echo "SNMP_FLAGS = $(SNMP_FLAGS)" @echo "" @echo "MIBS = $(MIBS)" diff --git a/lib/snmp/src/agent/snmp_community_mib.erl b/lib/snmp/src/agent/snmp_community_mib.erl index 8f0f4cad73..5644a43345 100644 --- a/lib/snmp/src/agent/snmp_community_mib.erl +++ b/lib/snmp/src/agent/snmp_community_mib.erl @@ -336,6 +336,8 @@ get_target_addr_ext_mms(TDomain, TAddress, Key) -> get_target_addr_ext_mms(TDomain, TAddress, NextKey) end end. + + %%----------------------------------------------------------------- %% Instrumentation Functions %%----------------------------------------------------------------- @@ -347,7 +349,7 @@ snmpCommunityTable(print) -> PrintRow = fun(Prefix, Row) -> lists:flatten( - io_lib:format("~sIndex: ~p" + io_lib:format("~sIndex: ~p" "~n~sName: ~p" "~n~sSecurityName: ~p" "~n~sContextEngineID: ~p" diff --git a/lib/snmp/src/agent/snmp_framework_mib.erl b/lib/snmp/src/agent/snmp_framework_mib.erl index d9bf7e8551..0d7866d94d 100644 --- a/lib/snmp/src/agent/snmp_framework_mib.erl +++ b/lib/snmp/src/agent/snmp_framework_mib.erl @@ -373,15 +373,27 @@ intAgentUDPPort(Op) -> intAgentIpAddress(Op) -> snmp_generic:variable_func(Op, db(intAgentIpAddress)). +snmpEngineID(print) -> + VarAndValue = [{snmpEngineID, snmpEngineID(get)}], + snmpa_mib_lib:print_variables(VarAndValue); snmpEngineID(Op) -> snmp_generic:variable_func(Op, db(snmpEngineID)). +snmpEngineMaxMessageSize(print) -> + VarAndValue = [{snmpEngineMaxMessageSize, snmpEngineMaxMessageSize(get)}], + snmpa_mib_lib:print_variables(VarAndValue); snmpEngineMaxMessageSize(Op) -> snmp_generic:variable_func(Op, db(snmpEngineMaxMessageSize)). +snmpEngineBoots(print) -> + VarAndValue = [{snmpEngineBoots, snmpEngineBoots(get)}], + snmpa_mib_lib:print_variables(VarAndValue); snmpEngineBoots(Op) -> snmp_generic:variable_func(Op, db(snmpEngineBoots)). +snmpEngineTime(print) -> + VarAndValue = [{snmpEngineTime, snmpEngineTime(get)}], + snmpa_mib_lib:print_variables(VarAndValue); snmpEngineTime(get) -> {value, get_engine_time()}. diff --git a/lib/snmp/src/agent/snmp_standard_mib.erl b/lib/snmp/src/agent/snmp_standard_mib.erl index 639172401d..b6834d278c 100644 --- a/lib/snmp/src/agent/snmp_standard_mib.erl +++ b/lib/snmp/src/agent/snmp_standard_mib.erl @@ -40,6 +40,28 @@ sys_object_id/1, sys_object_id/2, sys_or_table/3, variable_func/1, variable_func/2, inc/1, inc/2]). +-export([sysDescr/1, sysContact/1, sysName/1, sysLocation/1, + sysServices/1, sysUpTime/1, snmpEnableAuthenTraps/1, + sysObjectID/1, + snmpInPkts/1, snmpOutPkts/1, + snmpInBadVersions/1, + snmpInBadCommunityNames/1, snmpInBadCommunityUses/1, + snmpInASNParseErrs/1, + snmpInTooBigs/1, + snmpInNoSuchNames/1, snmpInBadValues/1, + snmpInReadOnlys/1, snmpInGenErrs/1, + snmpInTotalReqVars/1, snmpInTotalSetVars/1, + snmpInGetRequests/1, snmpInSetRequests/1, + snmpInGetNexts/1, + snmpInGetResponses/1, snmpInTraps/1, + snmpOutTooBigs/1, + snmpOutNoSuchNames/1, + snmpOutBadValues/1, + snmpOutGenErrs/1, + snmpOutGetRequests/1, snmpOutSetRequests/1, + snmpOutGetNexts/1, + snmpOutGetResponses/1, + snmpOutTraps/1]). -export([dummy/1, snmp_set_serial_no/1, snmp_set_serial_no/2]). -export([add_agent_caps/2, del_agent_caps/1, get_agent_caps/0]). -export([check_standard/1]). @@ -202,18 +224,257 @@ variable_func(get, Name) -> inc(Name) -> inc(Name, 1). inc(Name, N) -> ets:update_counter(snmp_agent_table, Name, N). + +sysDescr(print) -> + VarAndValue = [{sysDescr, sysDescr(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + +sysDescr(get) -> + VarDB = db(sysDescr), + snmp_generic:variable_get(VarDB). + + +sysContact(print) -> + VarAndValue = [{sysContact, sysContact(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + +sysContact(get) -> + VarDB = db(sysContact), + snmp_generic:variable_get(VarDB). + + +sysName(print) -> + VarAndValue = [{sysName, sysName(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + +sysName(get) -> + VarDB = db(sysName), + snmp_generic:variable_get(VarDB). + + +sysLocation(print) -> + VarAndValue = [{sysLocation, sysLocation(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + +sysLocation(get) -> + VarDB = db(sysLocation), + snmp_generic:variable_get(VarDB). + + +sysServices(print) -> + VarAndValue = [{sysServices, sysServices(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + +sysServices(get) -> + VarDB = db(sysServices), + snmp_generic:variable_get(VarDB). + + +snmpInPkts(print) -> + gen_counter(print, snmpInPkts); +snmpInPkts(get) -> + gen_counter(get, snmpInPkts). + + +snmpOutPkts(print) -> + gen_counter(print, snmpOutPkts); +snmpOutPkts(get) -> + gen_counter(get, snmpOutPkts). + + +snmpInASNParseErrs(print) -> + gen_counter(print, snmpInASNParseErrs); +snmpInASNParseErrs(get) -> + gen_counter(get, snmpInASNParseErrs). + + +snmpInBadCommunityNames(print) -> + gen_counter(print, snmpInBadCommunityNames); +snmpInBadCommunityNames(get) -> + gen_counter(get, snmpInBadCommunityNames). + + +snmpInBadCommunityUses(print) -> + gen_counter(print, snmpInBadCommunityUses); + +snmpInBadCommunityUses(get) -> + gen_counter(get, snmpInBadCommunityUses). + + +snmpInBadVersions(print) -> + gen_counter(print, snmpInBadVersions); +snmpInBadVersions(get) -> + gen_counter(get, snmpInBadVersions). + + +snmpInTooBigs(print) -> + gen_counter(print, snmpInTooBigs); +snmpInTooBigs(get) -> + gen_counter(get, snmpInTooBigs). + + +snmpInNoSuchNames(print) -> + gen_counter(print, snmpInNoSuchNames); +snmpInNoSuchNames(get) -> + gen_counter(get, snmpInNoSuchNames). + + +snmpInBadValues(print) -> + gen_counter(print, snmpInBadValues); +snmpInBadValues(get) -> + gen_counter(get, snmpInBadValues). + + +snmpInReadOnlys(print) -> + gen_counter(print, snmpInReadOnlys); +snmpInReadOnlys(get) -> + gen_counter(get, snmpInReadOnlys). + + +snmpInGenErrs(print) -> + gen_counter(print, snmpInGenErrs); +snmpInGenErrs(get) -> + gen_counter(get, snmpInGenErrs). + + +snmpInTotalReqVars(print) -> + gen_counter(print, snmpInTotalReqVars); +snmpInTotalReqVars(get) -> + gen_counter(get, snmpInTotalReqVars). + + +snmpInTotalSetVars(print) -> + gen_counter(print, snmpInTotalSetVars); +snmpInTotalSetVars(get) -> + gen_counter(get, snmpInTotalSetVars). + + +snmpInGetRequests(print) -> + gen_counter(print, snmpInGetRequests); +snmpInGetRequests(get) -> + gen_counter(get, snmpInGetRequests). + + +snmpInSetRequests(print) -> + gen_counter(print, snmpInSetRequests); +snmpInSetRequests(get) -> + gen_counter(get, snmpInSetRequests). + + +snmpInGetNexts(print) -> + gen_counter(print, snmpInGetNexts); +snmpInGetNexts(get) -> + gen_counter(get, snmpInGetNexts). + + +snmpInGetResponses(print) -> + gen_counter(print, snmpInGetResponses); +snmpInGetResponses(get) -> + gen_counter(get, snmpInGetResponses). + + +snmpInTraps(print) -> + gen_counter(print, snmpInTraps); +snmpInTraps(get) -> + gen_counter(get, snmpInTraps). + + +snmpOutTooBigs(print) -> + gen_counter(print, snmpOutTooBigs); +snmpOutTooBigs(get) -> + gen_counter(get, snmpOutTooBigs). + + +snmpOutNoSuchNames(print) -> + gen_counter(print, snmpOutNoSuchNames); +snmpOutNoSuchNames(get) -> + gen_counter(get, snmpOutNoSuchNames). + + +snmpOutBadValues(print) -> + gen_counter(print, snmpOutBadValues); +snmpOutBadValues(get) -> + gen_counter(get, snmpOutBadValues). + + +snmpOutGenErrs(print) -> + gen_counter(print, snmpOutGenErrs); +snmpOutGenErrs(get) -> + gen_counter(get, snmpOutGenErrs). + + +snmpOutGetRequests(print) -> + gen_counter(print, snmpOutGetRequests); +snmpOutGetRequests(get) -> + gen_counter(get, snmpOutGetRequests). + + +snmpOutSetRequests(print) -> + gen_counter(print, snmpOutSetRequests); +snmpOutSetRequests(get) -> + gen_counter(get, snmpOutSetRequests). + + +snmpOutGetNexts(print) -> + gen_counter(print, snmpOutGetNexts); +snmpOutGetNexts(get) -> + gen_counter(get, snmpOutGetNexts). + + +snmpOutGetResponses(print) -> + gen_counter(print, snmpOutGetResponses); +snmpOutGetResponses(get) -> + gen_counter(get, snmpOutGetResponses). + + +snmpOutTraps(print) -> + gen_counter(print, snmpOutTraps); +snmpOutTraps(get) -> + gen_counter(get, snmpOutTraps). + + +gen_counter(print, Counter) -> + Val = gen_counter(get, Counter), + VarAndValue = [{Counter, Val}], + snmpa_mib_lib:print_variables(VarAndValue); + +gen_counter(get, Counter) -> + variable_func(get, Counter). + + %%----------------------------------------------------------------- %% This is the instrumentation function for sysUpTime. %%----------------------------------------------------------------- +sysUpTime(print) -> + sys_up_time(print); +sysUpTime(get) -> + sys_up_time(get). + sys_up_time() -> snmpa:sys_up_time(). +sys_up_time(print) -> + VarAndValue = [{sysUpTime, sys_up_time(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + sys_up_time(get) -> {value, snmpa:sys_up_time()}. + %%----------------------------------------------------------------- %% This is the instrumentation function for snmpEnableAuthenTraps %%----------------------------------------------------------------- + +snmpEnableAuthenTraps(print) -> + snmp_enable_authen_traps(print); +snmpEnableAuthenTraps(get) -> + snmp_enable_authen_traps(get). + + +snmp_enable_authen_traps(print) -> + VarAndValue = [{snmpEnableAuthenTraps, snmp_enable_authen_traps(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + snmp_enable_authen_traps(new) -> snmp_generic:variable_func(new, db(snmpEnableAuthenTraps)); @@ -226,9 +487,19 @@ snmp_enable_authen_traps(get) -> snmp_enable_authen_traps(set, NewVal) -> snmp_generic:variable_func(set, NewVal, db(snmpEnableAuthenTraps)). + %%----------------------------------------------------------------- -%% This is the instrumentation function for sysObjectId +%% This is the instrumentation function for sysObjectID %%----------------------------------------------------------------- +sysObjectID(print) -> + sys_object_id(print); +sysObjectID(get) -> + sys_object_id(get). + +sys_object_id(print) -> + VarAndValue = [{sysObjectID, sys_object_id(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + sys_object_id(new) -> snmp_generic:variable_func(new, db(sysObjectID)); @@ -241,6 +512,7 @@ sys_object_id(get) -> sys_object_id(set, NewVal) -> snmp_generic:variable_func(set, NewVal, db(sysObjectID)). + %%----------------------------------------------------------------- %% This is a dummy instrumentation function for objects like %% snmpTrapOID, that is accessible-for-notify, with different @@ -249,6 +521,7 @@ sys_object_id(set, NewVal) -> %%----------------------------------------------------------------- dummy(_Op) -> ok. + %%----------------------------------------------------------------- %% This is the instrumentation function for snmpSetSerialNo. %% It is always volatile. diff --git a/lib/snmp/src/agent/snmp_target_mib.erl b/lib/snmp/src/agent/snmp_target_mib.erl index 3c32d1f59f..270a5fd5b6 100644 --- a/lib/snmp/src/agent/snmp_target_mib.erl +++ b/lib/snmp/src/agent/snmp_target_mib.erl @@ -511,6 +511,10 @@ set_target_engine_id(TargetAddrName, EngineId) -> %%----------------------------------------------------------------- %% Instrumentation Functions %%----------------------------------------------------------------- +snmpTargetSpinLock(print) -> + VarAndValue = [{snmpTargetSpinLock, snmpTargetSpinLock(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + snmpTargetSpinLock(new) -> snmp_generic:variable_func(new, {snmpTargetSpinLock, volatile}), {A1,A2,A3} = erlang:now(), @@ -591,12 +595,9 @@ snmpTargetAddrTable(print) -> ?'snmpTargetAddrRowStatus_active' -> active; _ -> undefined end, - Prefix, - element(?snmpTargetAddrEngineId, Row), - Prefix, - element(?snmpTargetAddrTMask, Row), - Prefix, - element(?snmpTargetAddrMMS, Row)])) + Prefix, element(?snmpTargetAddrEngineId, Row), + Prefix, element(?snmpTargetAddrTMask, Row), + Prefix, element(?snmpTargetAddrMMS, Row)])) end, snmpa_mib_lib:print_table(Table, DB, FOI, PrintRow); %% Op == new | delete diff --git a/lib/snmp/src/agent/snmp_user_based_sm_mib.erl b/lib/snmp/src/agent/snmp_user_based_sm_mib.erl index f40bb1a5b9..69cebc858b 100644 --- a/lib/snmp/src/agent/snmp_user_based_sm_mib.erl +++ b/lib/snmp/src/agent/snmp_user_based_sm_mib.erl @@ -26,6 +26,12 @@ table_next/2, is_engine_id_known/1, get_user/2, get_user_from_security_name/2, mk_key_change/3, mk_key_change/5, extract_new_key/3, mk_random/1]). +-export([usmStatsUnsupportedSecLevels/1, + usmStatsNotInTimeWindows/1, + usmStatsUnknownUserNames/1, + usmStatsUnknownEngineIDs/1, + usmStatsWrongDigests/1, + usmStatsDecryptionErrors/1]). -export([add_user/1, add_user/13, delete_user/1]). %% Internal @@ -303,6 +309,54 @@ gc_tabs() -> %%----------------------------------------------------------------- %% Counter functions %%----------------------------------------------------------------- + +usmStatsUnsupportedSecLevels(print) -> + VarAndValue = [{usmStatsUnsupportedSecLevels, + usmStatsUnsupportedSecLevels(get)}], + snmpa_mib_lib:print_variables(VarAndValue); +usmStatsUnsupportedSecLevels(get) -> + get_counter(usmStatsUnsupportedSecLevels). + +usmStatsNotInTimeWindows(print) -> + VarAndValue = [{usmStatsNotInTimeWindows, usmStatsNotInTimeWindows(get)}], + snmpa_mib_lib:print_variables(VarAndValue); +usmStatsNotInTimeWindows(get) -> + get_counter(usmStatsNotInTimeWindows). + +usmStatsUnknownUserNames(print) -> + VarAndValue = [{usmStatsUnknownUserNames, usmStatsUnknownUserNames(get)}], + snmpa_mib_lib:print_variables(VarAndValue); +usmStatsUnknownUserNames(get) -> + get_counter(usmStatsUnknownUserNames). + +usmStatsUnknownEngineIDs(print) -> + VarAndValue = [{usmStatsUnknownEngineIDs, usmStatsUnknownEngineIDs(get)}], + snmpa_mib_lib:print_variables(VarAndValue); +usmStatsUnknownEngineIDs(get) -> + get_counter(usmStatsUnknownEngineIDs). + +usmStatsWrongDigests(print) -> + VarAndValue = [{usmStatsWrongDigests, usmStatsWrongDigests(get)}], + snmpa_mib_lib:print_variables(VarAndValue); +usmStatsWrongDigests(get) -> + get_counter(usmStatsWrongDigests). + +usmStatsDecryptionErrors(print) -> + VarAndValue = [{usmStatsDecryptionErrors, usmStatsDecryptionErrors(get)}], + snmpa_mib_lib:print_variables(VarAndValue); +usmStatsDecryptionErrors(get) -> + get_counter(usmStatsDecryptionErrors). + + +get_counter(Name) -> + case (catch ets:lookup(snmp_agent_table, Name)) of + [{_, Val}] -> + {value, Val}; + _ -> + genErr + end. + + init_vars() -> lists:map(fun maybe_create_var/1, vars()). maybe_create_var(Var) -> @@ -323,6 +377,7 @@ vars() -> usmStatsDecryptionErrors ]. + %%----------------------------------------------------------------- %% API functions %%----------------------------------------------------------------- @@ -374,6 +429,11 @@ get_user_from_security_name(EngineID, SecName) -> %%----------------------------------------------------------------- %% Instrumentation Functions %%----------------------------------------------------------------- + +usmUserSpinLock(print) -> + VarAndValue = [{usmUserSpinLock, usmUserSpinLock(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + usmUserSpinLock(new) -> snmp_generic:variable_func(new, {usmUserSpinLock, volatile}), {A1,A2,A3} = erlang:now(), diff --git a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl index 657207b36e..3e5091a555 100644 --- a/lib/snmp/src/agent/snmp_view_based_acm_mib.erl +++ b/lib/snmp/src/agent/snmp_view_based_acm_mib.erl @@ -133,7 +133,6 @@ check_vacm({vacmSecurityToGroup, SecModel, SecName, GroupName}) -> {ok, SecM} = snmp_conf:check_sec_model(SecModel, []), snmp_conf:check_string(SecName), snmp_conf:check_string(GroupName), - Vacm = {SecM, SecName, GroupName, ?'StorageType_nonVolatile', ?'RowStatus_active'}, {ok, {vacmSecurityToGroup, Vacm}}; @@ -181,15 +180,22 @@ init_tabs(Sec2Group, Access, View) -> snmpa_local_db:table_delete(db(vacmSecurityToGroupTable)), snmpa_local_db:table_create(db(vacmSecurityToGroupTable)), init_sec2group_table(Sec2Group), + + ?vdebug("create vacm access table",[]), + snmpa_vacm:cleanup(), init_access_table(Access), + ?vdebug("create vacm view-tree-family table",[]), snmpa_local_db:table_delete(db(vacmViewTreeFamilyTable)), snmpa_local_db:table_create(db(vacmViewTreeFamilyTable)), - init_view_table(View). + init_view_table(View), + + ?vdebug("table(s) initiated",[]), + ok. init_sec2group_table([Row | T]) -> -% ?vtrace("init security-to-group table: " -% "~n Row: ~p",[Row]), +%% ?vtrace("init security-to-group table: " +%% "~n Row: ~p",[Row]), Key1 = element(1, Row), Key2 = element(2, Row), Key = [Key1, length(Key2) | Key2], @@ -198,12 +204,12 @@ init_sec2group_table([Row | T]) -> init_sec2group_table([]) -> true. init_access_table([{GN, Prefix, Model, Level, Row} | T]) -> -% ?vtrace("init access table: " -% "~n GN: ~p" -% "~n Prefix: ~p" -% "~n Model: ~p" -% "~n Level: ~p" -% "~n Row: ~p",[GN, Prefix, Model, Level, Row]), +%% ?vtrace("init access table: " +%% "~n GN: ~p" +%% "~n Prefix: ~p" +%% "~n Model: ~p" +%% "~n Level: ~p" +%% "~n Row: ~p",[GN, Prefix, Model, Level, Row]), Key = [length(GN) | GN] ++ [length(Prefix) | Prefix] ++ [Model, Level], snmpa_vacm:insert([{Key, Row}], false), init_access_table(T); @@ -211,8 +217,8 @@ init_access_table([]) -> snmpa_vacm:dump_table(). init_view_table([Row | T]) -> -% ?vtrace("init view table: " -% "~n Row: ~p",[Row]), +%% ?vtrace("init view table: " +%% "~n Row: ~p",[Row]), Key1 = element(1, Row), Key2 = element(2, Row), Key = [length(Key1) | Key1] ++ [length(Key2) | Key2], @@ -348,6 +354,49 @@ vacmContextTable(Op, Arg1, Arg2) -> snmp_framework_mib:intContextTable(Op, Arg1, Arg2). +vacmSecurityToGroupTable(print) -> + Table = vacmSecurityToGroupTable, + DB = db(Table), + FOI = foi(Table), + PrintRow = + fun(Prefix, Row) -> + lists:flatten( + io_lib:format("~sSecurityModel: ~p (~w)" + "~n~sSecurityName: ~p" + "~n~sGroupName: ~p" + "~n~sStorageType: ~p (~w)" + "~n~sStatus: ~p (~w)", + [Prefix, element(?vacmSecurityModel, Row), + case element(?vacmSecurityModel, Row) of + ?SEC_ANY -> any; + ?SEC_V1 -> v1; + ?SEC_V2C -> v2c; + ?SEC_USM -> usm; + _ -> undefined + end, + Prefix, element(?vacmSecurityName, Row), + Prefix, element(?vacmGroupName, Row), + Prefix, element(?vacmSecurityToGroupStorageType, Row), + case element(?vacmSecurityToGroupStorageType, Row) of + ?'vacmSecurityToGroupStorageType_readOnly' -> readOnly; + ?'vacmSecurityToGroupStorageType_permanent' -> permanent; + ?'vacmSecurityToGroupStorageType_nonVolatile' -> nonVolatile; + ?'vacmSecurityToGroupStorageType_volatile' -> volatile; + ?'vacmSecurityToGroupStorageType_other' -> other; + _ -> undefined + end, + Prefix, element(?vacmSecurityToGroupStatus, Row), + case element(?vacmSecurityToGroupStatus, Row) of + ?'vacmSecurityToGroupStatus_destroy' -> destroy; + ?'vacmSecurityToGroupStatus_createAndWait' -> createAndWait; + ?'vacmSecurityToGroupStatus_createAndGo' -> createAndGo; + ?'vacmSecurityToGroupStatus_notReady' -> notReady; + ?'vacmSecurityToGroupStatus_notInService' -> notInService; + ?'vacmSecurityToGroupStatus_active' -> active; + _ -> undefined + end])) + end, + snmpa_mib_lib:print_table(Table, DB, FOI, PrintRow); vacmSecurityToGroupTable(Op) -> snmp_generic:table_func(Op, db(vacmSecurityToGroupTable)). @@ -402,13 +451,13 @@ verify_vacmSecurityToGroupTable_cols([{Col, Val0}|Cols], Acc) -> verify_vacmSecurityToGroupTable_col(?vacmSecurityModel, Model) -> case Model of any -> ?SEC_ANY; - v1 -> ?SEC_ANY; - v2c -> ?SEC_ANY; - usm -> ?SEC_ANY; + v1 -> ?SEC_V1; + v2c -> ?SEC_V2C; + usm -> ?SEC_USM; ?SEC_ANY -> ?SEC_ANY; - ?SEC_V1 -> ?SEC_ANY; - ?SEC_V2C -> ?SEC_ANY; - ?SEC_USM -> ?SEC_ANY; + ?SEC_V1 -> ?SEC_V1; + ?SEC_V2C -> ?SEC_V2C; + ?SEC_USM -> ?SEC_USM; _ -> ?vlog("verification of vacmSecurityModel(~w) ~p failed", [?vacmSecurityModel, Model]), @@ -445,6 +494,49 @@ verify_vacmSecurityToGroupTable_col(_, Val) -> %% {RowIndex, {Col4, Col5, ..., Col9}} %% %%----------------------------------------------------------------- +vacmAccessTable(print) -> + %% M�ste jag g�ra om alla entrien till {RowIdx, Row}? + TableInfo = get_table(vacmAccessTable), + PrintRow = + fun(Prefix, Row) -> + lists:flatten( + io_lib:format("~sContextMatch: ~p (~w)" + "~n~sReadViewName: ~p" + "~n~sWriteViewName: ~p" + "~n~sNotifyViewName: ~p" + "~n~sStorageType: ~p (~w)" + "~n~sStatus: ~p (~w)", + [Prefix, element(?vacmAccessContextMatch-3, Row), + case element(?vacmAccessContextMatch-3, Row) of + ?vacmAccessContextMatch_exact -> exact; + ?vacmAccessContextMatch_prefix -> prefix; + _ -> undefined + end, + Prefix, element(?vacmAccessReadViewName-3, Row), + Prefix, element(?vacmAccessWriteViewName-3, Row), + Prefix, element(?vacmAccessNotifyViewName-3, Row), + Prefix, element(?vacmAccessStorageType-3, Row), + case element(?vacmAccessStorageType-3, Row) of + ?vacmAccessStorageType_other -> other ; + ?vacmAccessStorageType_volatile -> volatile; + ?vacmAccessStorageType_nonVolatile -> nonVolatile; + ?vacmAccessStorageType_permanent -> permanent; + ?vacmAccessStorageType_readOnly -> readOnly; + _ -> undefined + end, + Prefix, element(?vacmAccessStatus-3, Row), + case element(?vacmAccessStatus-3, Row) of + ?vacmAccessStatus_destroy -> destroy; + ?vacmAccessStatus_createAndWait -> createAndWait; + ?vacmAccessStatus_createAndGo -> createAndGo; + ?vacmAccessStatus_notReady -> notReady; + ?vacmAccessStatus_notInService -> notInService; + ?vacmAccessStatus_active -> active; + _ -> undefined + end + ])) + end, + snmpa_mib_lib:print_table(vacmAccessTable, {ok, TableInfo}, PrintRow); vacmAccessTable(_Op) -> ok. vacmAccessTable(get, RowIndex, Cols) -> @@ -540,24 +632,24 @@ verify_vacmAccessTable_col(?vacmAccessContextPrefix, Pref) -> verify_vacmAccessTable_col(?vacmAccessSecurityModel, Model) -> case Model of any -> ?SEC_ANY; - v1 -> ?SEC_ANY; - v2c -> ?SEC_ANY; - usm -> ?SEC_ANY; + v1 -> ?SEC_V1; + v2c -> ?SEC_V2C; + usm -> ?SEC_USM; ?SEC_ANY -> ?SEC_ANY; - ?SEC_V1 -> ?SEC_ANY; - ?SEC_V2C -> ?SEC_ANY; - ?SEC_USM -> ?SEC_ANY; + ?SEC_V1 -> ?SEC_V1; + ?SEC_V2C -> ?SEC_V2C; + ?SEC_USM -> ?SEC_USM; _ -> wrongValue(?vacmAccessSecurityModel) end; verify_vacmAccessTable_col(?vacmAccessSecurityLevel, Level) -> case Level of - noAuthNoPriv -> 1; - authNoPriv -> 2; - authPriv -> 3; - 1 -> 1; - 2 -> 2; - 3 -> 3; + noAuthNoPriv -> ?vacmAccessSecurityLevel_noAuthNoPriv; + authNoPriv -> ?vacmAccessSecurityLevel_authNoPriv; + authPriv -> ?vacmAccessSecurityLevel_authPriv; + ?vacmAccessSecurityLevel_noAuthNoPriv -> ?vacmAccessSecurityLevel_noAuthNoPriv; + ?vacmAccessSecurityLevel_authNoPriv -> ?vacmAccessSecurityLevel_authNoPriv; + ?vacmAccessSecurityLevel_authPriv -> ?vacmAccessSecurityLevel_authPriv; _ -> wrongValue(?vacmAccessSecurityLevel) end; verify_vacmAccessTable_col(?vacmAccessContextMatch, Match) -> @@ -664,6 +756,7 @@ do_get_next(RowIndex, Cols) -> end end. + %%----------------------------------------------------------------- %% Functions to manipulate vacmAccessRows. %%----------------------------------------------------------------- @@ -696,29 +789,76 @@ split_cols([Col | Cols], PreCols) when Col =< 3 -> split_cols(Cols, PreCols) -> {PreCols, Cols}. +vacmViewSpinLock(print) -> + VarAndValue = [{vacmViewSpinLock, vacmViewSpinLock(get)}], + snmpa_mib_lib:print_variables(VarAndValue); + vacmViewSpinLock(new) -> - snmp_generic:variable_func(new, {vacmViewSpinLock, volatile}), + snmp_generic:variable_func(new, volatile_db(vacmViewSpinLock)), {A1,A2,A3} = erlang:now(), random:seed(A1,A2,A3), Val = random:uniform(2147483648) - 1, - snmp_generic:variable_func(set, Val, {vacmViewSpinLock, volatile}); + snmp_generic:variable_func(set, Val, volatile_db(vacmViewSpinLock)); vacmViewSpinLock(delete) -> ok; vacmViewSpinLock(get) -> - snmp_generic:variable_func(get, {vacmViewSpinLock, volatile}). + snmp_generic:variable_func(get, volatile_db(vacmViewSpinLock)). vacmViewSpinLock(is_set_ok, NewVal) -> - case snmp_generic:variable_func(get, {vacmViewSpinLock, volatile}) of + case snmp_generic:variable_func(get, volatile_db(vacmViewSpinLock)) of {value, NewVal} -> noError; _ -> inconsistentValue end; vacmViewSpinLock(set, NewVal) -> snmp_generic:variable_func(set, (NewVal + 1) rem 2147483648, - {vacmViewSpinLock, volatile}). - - + volatile_db(vacmViewSpinLock)). + + +vacmViewTreeFamilyTable(print) -> + Table = vacmViewTreeFamilyTable, + DB = db(Table), + FOI = foi(Table), + PrintRow = + fun(Prefix, Row) -> + lists:flatten( + io_lib:format("~sViewName: ~p" + "~n~sSubtree: ~p" + "~n~sMask: ~p" + "~n~sType: ~p (~w)" + "~n~sStorageType: ~p (~w)" + "~n~sStatus: ~p (~w)", + [Prefix, element(?vacmViewTreeFamilyViewName, Row), + Prefix, element(?vacmViewTreeFamilySubtree, Row), + Prefix, element(?vacmViewTreeFamilyMask, Row), + Prefix, element(?vacmViewTreeFamilyType, Row), + case element(?vacmViewTreeFamilyType, Row) of + ?vacmViewTreeFamilyType_included -> included; + ?vacmViewTreeFamilyType_excluded -> excluded; + _ -> undefined + end, + Prefix, element(?vacmViewTreeFamilyStorageType, Row), + case element(?vacmViewTreeFamilyStorageType, Row) of + ?vacmViewTreeFamilyStorageType_readOnly -> readOnly; + ?vacmViewTreeFamilyStorageType_permanent -> permanent; + ?vacmViewTreeFamilyStorageType_nonVolatile -> nonVolatile; + ?vacmViewTreeFamilyStorageType_volatile -> volatile; + ?vacmViewTreeFamilyStorageType_other -> other; + _ -> undefined + end, + Prefix, element(?vacmViewTreeFamilyStatus, Row), + case element(?vacmViewTreeFamilyStatus, Row) of + ?vacmViewTreeFamilyStatus_destroy -> destroy; + ?vacmViewTreeFamilyStatus_createAndWait -> createAndWait; + ?vacmViewTreeFamilyStatus_createAndGo -> createAndGo; + ?vacmViewTreeFamilyStatus_notReady -> notReady; + ?vacmViewTreeFamilyStatus_notInService -> notInService; + ?vacmViewTreeFamilyStatus_active -> active; + _ -> undefined + end])) + end, + snmpa_mib_lib:print_table(Table, DB, FOI, PrintRow); vacmViewTreeFamilyTable(Op) -> snmp_generic:table_func(Op, db(vacmViewTreeFamilyTable)). vacmViewTreeFamilyTable(get_next, RowIndex, Cols) -> @@ -795,7 +935,25 @@ table_next(Name, RestOid) -> snmp_generic:table_next(db(Name), RestOid). -db(X) -> snmpa_agent:db(X). +get_table(vacmAccessTable) -> + do_get_vacmAccessTable([], []). + +do_get_vacmAccessTable(Key0, Acc) -> + case snmpa_vacm:get_next_row(Key0) of + {Key, _Row} = Entry -> + do_get_vacmAccessTable(Key, [Entry | Acc]); + false -> + lists:reverse(Acc) + end. + + +%%----------------------------------------------------------------- +%% Wrappers +%%----------------------------------------------------------------- + +db(X) -> snmpa_agent:db(X). +volatile_db(X) -> {X, volatile}. + fa(vacmSecurityToGroupTable) -> ?vacmGroupName; fa(vacmViewTreeFamilyTable) -> ?vacmViewTreeFamilyMask. diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index 87b191caed..22fbd33add 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -105,6 +105,8 @@ set_request_limit/1, set_request_limit/2 ]). +-export([print_mib_info/0, print_mib_tables/0, print_mib_variables/0]). + -include("snmpa_atl.hrl"). -define(EXTRA_INFO, undefined). @@ -283,6 +285,186 @@ whereis_mib(Agent, Mib) when is_atom(Mib) -> %% - +mibs_info() -> + [ + {snmp_standard_mib, + [], + [ + sysDescr, + sysObjectID, + sysContact, + sysName, + sysLocation, + sysServices, + snmpEnableAuthenTraps, + sysUpTime, + snmpInPkts, + snmpOutPkts, + snmpInBadVersions, + snmpInBadCommunityNames, + snmpInBadCommunityUses, + snmpInASNParseErrs, + snmpInTooBigs, + snmpInNoSuchNames, + snmpInBadValues, + snmpInReadOnlys, + snmpInGenErrs, + snmpInTotalReqVars, + snmpInTotalSetVars, + snmpInGetRequests, + snmpInSetRequests, + snmpInGetNexts, + snmpInGetResponses, + snmpInTraps, + snmpOutTooBigs, + snmpOutNoSuchNames, + snmpOutBadValues, + snmpOutGenErrs, + snmpOutGetRequests, + snmpOutSetRequests, + snmpOutGetNexts, + snmpOutGetResponses, + snmpOutTraps + ] + }, + {snmp_framework_mib, + [ + ], + [ + snmpEngineID, + snmpEngineBoots, + snmpEngineTime, + snmpEngineMaxMessageSize + ] + }, + {snmp_view_based_acm_mib, + [ + vacmAccessTable, + vacmSecurityToGroupTable, + vacmViewTreeFamilyTable + ], + [ + vacmViewSpinLock + ] + }, + {snmp_target_mib, + [ + snmpTargetAddrTable, + snmpTargetParamsTable + ], + [ + snmpTargetSpinLock + ] + }, + {snmp_community_mib, + [ + snmpCommunityTable + ], + [] + }, + {snmp_notification_mib, + [ + snmpNotifyTable + ], + []}, + {snmp_user_based_sm_mib, + [ + usmUserTable + ], + [ + usmUserSpinLock, + usmStatsUnsupportedSecLevels, + usmStatsNotInTimeWindows, + usmStatsUnknownUserNames, + usmStatsUnknownEngineIDs, + usmStatsWrongDigests, + usmStatsDecryptionErrors + ] + } + ]. + +print_mib_info() -> + MibsInfo = mibs_info(), + print_mib_info(MibsInfo). + +print_mib_info([]) -> + io:format("~n", []), + ok; +print_mib_info([{Mod, Tables, Variables} | MibsInfo]) -> + io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), + print_mib_variables2(Mod, Variables), + print_mib_tables2(Mod, Tables), + io:format("~n", []), + print_mib_info(MibsInfo). + + +print_mib_tables() -> + Tables = [{Mod, Tabs} || {Mod, Tabs, _Vars} <- mibs_info()], + print_mib_tables(Tables). + +print_mib_tables([]) -> + ok; +print_mib_tables([{Mod, Tabs}|MibTabs]) + when is_atom(Mod) andalso is_list(Tabs) -> + print_mib_tables(Mod, Tabs), + print_mib_tables(MibTabs); +print_mib_tables([_|MibTabs]) -> + print_mib_tables(MibTabs). + +print_mib_tables(_Mod, [] = _Tables) -> + ok; +print_mib_tables(Mod, Tables) -> + io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), + print_mib_tables2(Mod, Tables), + io:format("~n", []). + +print_mib_tables2(Mod, Tables) -> + [(catch Mod:Table(print)) || Table <- Tables]. + + +print_mib_variables() -> + Variables = [{Mod, Vars} || {Mod, _Tabs, Vars} <- mibs_info()], + print_mib_variables(Variables). + +print_mib_variables([]) -> + ok; +print_mib_variables([{Mod, Vars}|MibVars]) + when is_atom(Mod) andalso is_list(Vars) -> + print_mib_variables(Mod, Vars), + print_mib_variables(MibVars); +print_mib_variables([_|MibVars]) -> + print_mib_variables(MibVars). + +print_mib_variables(_Mod, [] = _Vars) -> + ok; +print_mib_variables(Mod, Vars) -> + io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), + print_mib_variables2(Mod, Vars), + io:format("~n", []). + +print_mib_variables2(Mod, Variables) -> + Vars = [{Var, (catch Mod:Var(get))} || Var <- Variables], + snmpa_mib_lib:print_variables(Vars). + + +make_pretty_mib(snmp_view_based_acm_mib) -> + "SNMP-VIEW-BASED-ACM-MIB"; +make_pretty_mib(snmp_target_mib) -> + "SNMP-TARGET-MIB"; +make_pretty_mib(snmp_community_mib) -> + "SNMP-COMMUNITY-MIB"; +make_pretty_mib(snmp_notification_mib) -> + "SNMP-NOTIFICATION-MIB"; +make_pretty_mib(snmp_user_based_sm_mib) -> + "SNMP-USER-BASED-SM-MIB"; +make_pretty_mib(snmp_framework_mib) -> + "SNMP-FRAMEWORK-MIB"; +make_pretty_mib(Mod) -> + atom_to_list(Mod). + + +%% - + mib_of(Oid) -> snmpa_agent:mib_of(Oid). diff --git a/lib/snmp/src/agent/snmpa_mib_lib.erl b/lib/snmp/src/agent/snmpa_mib_lib.erl index 441228b9ee..cb96ff8056 100644 --- a/lib/snmp/src/agent/snmpa_mib_lib.erl +++ b/lib/snmp/src/agent/snmpa_mib_lib.erl @@ -19,7 +19,8 @@ -module(snmpa_mib_lib). -export([table_cre_row/3, table_del_row/2]). --export([get_table/2, print_table/3, print_table/4, print_tables/1]). +-export([get_table/2]). +-export([print_variables/1, print_table/3, print_table/4, print_tables/1]). -export([gc_tab/3, gc_tab/5]). -include("SNMPv2-TC.hrl"). @@ -81,31 +82,69 @@ get_table(NameDb, FOI, Oid, Acc) -> end. +print_variables(Variables) when is_list(Variables) -> + Variables2 = print_variables_prefixify(Variables), + lists:foreach(fun({Variable, ValueResult, Prefix}) -> + print_variable(Variable, ValueResult, Prefix) + end, Variables2), + ok. + +print_variable(Variable, {value, Val}, Prefix) when is_atom(Variable) -> + io:format("~w~s=> ~p~n", [Variable, Prefix, Val]); +print_variable(Variable, Error, Prefix) when is_atom(Variable) -> + io:format("~w~s=> [e] ~p~n", [Variable, Prefix, Error]). + +print_variables_prefixify(Variables) -> + MaxVarLength = print_variables_maxlength(Variables), + print_variables_prefixify(Variables, MaxVarLength, []). + +print_variables_prefixify([], _MaxVarLength, Acc) -> + lists:reverse(Acc); +print_variables_prefixify([{Var, Res}|Variables], MaxVarLength, Acc) -> + Prefix = make_variable_print_prefix(Var, MaxVarLength), + print_variables_prefixify(Variables, MaxVarLength, + [{Var, Res, Prefix}|Acc]). + +make_variable_print_prefix(Var, MaxVarLength) -> + lists:duplicate(MaxVarLength - length(atom_to_list(Var)) + 1, $ ). + +print_variables_maxlength(Variables) -> + print_variables_maxlength(Variables, 0). + +print_variables_maxlength([], MaxLength) -> + MaxLength; +print_variables_maxlength([{Var, _}|Variables], MaxLength) when is_atom(Var) -> + VarLen = length(atom_to_list(Var)), + if + VarLen > MaxLength -> + print_variables_maxlength(Variables, VarLen); + true -> + print_variables_maxlength(Variables, MaxLength) + end. + + print_tables(Tables) when is_list(Tables) -> lists:foreach(fun({Table, DB, FOI, PrintRow}) -> print_table(Table, DB, FOI, PrintRow) end, Tables), ok. -%% print_table(Table, DB, FOI, PrintRow) -> -%% TableInfo = get_table(DB(Table), FOI(Table)), -%% print_table(Table, TableInfo, PrintRow), -%% ok. - print_table(Table, DB, FOI, PrintRow) -> TableInfo = get_table(DB, FOI), print_table(Table, TableInfo, PrintRow). print_table(Table, TableInfo, PrintRow) when is_function(PrintRow, 2) -> - io:format("~w => ~n", [Table]), + io:format("~w =>", [Table]), do_print_table(TableInfo, PrintRow). +do_print_table({ok, [] = _TableInfo}, _PrintRow) -> + io:format(" -~n", []); do_print_table({ok, TableInfo}, PrintRow) when is_function(PrintRow, 2) -> + io:format("~n", []), lists:foreach(fun({RowIdx, Row}) -> io:format(" ~w => ~n~s~n", [RowIdx, PrintRow(" ", Row)]) - end, TableInfo), - io:format("~n", []); + end, TableInfo); do_print_table({error, {invalid_rowindex, BadRowIndex, []}}, _PrintRow) -> io:format("Error: Bad rowindex ~w~n", [BadRowIndex]); do_print_table({error, {invalid_rowindex, BadRowIndex, TableInfo}}, PrintRow) -> diff --git a/lib/snmp/src/agent/snmpa_vacm.erl b/lib/snmp/src/agent/snmpa_vacm.erl index 2eacea4301..892dc265f1 100644 --- a/lib/snmp/src/agent/snmpa_vacm.erl +++ b/lib/snmp/src/agent/snmpa_vacm.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -21,7 +21,7 @@ -export([get_mib_view/5]). -export([init/1, init/2, backup/1]). -export([delete/1, get_row/1, get_next_row/1, insert/1, insert/2, - dump_table/0]). + cleanup/0, dump_table/0]). -include("SNMPv2-TC.hrl"). -include("SNMP-VIEW-BASED-ACM-MIB.hrl"). @@ -256,6 +256,11 @@ delete(Key) -> ets:delete(snmpa_vacm, Key), dump_table(). + +cleanup() -> + ets:delete_all_objects(snmpa_vacm), + dump_table(). + dump_table(true) -> dump_table(); dump_table(_) -> diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 4f76095c04..de0e5d6e14 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -24,6 +24,28 @@ [ {"4.18", [ + {load_module, snmp_misc, soft_purge, soft_purge, []}, + {load_module, snmpa_vacm, soft_purge, soft_purge, []}, + {load_module, snmpa, soft_purge, soft_purge, + [snmp_community_mib, + snmp_framework_mib, + snmp_standard_mib, + snmp_target_mib, + snmp_user_based_sm_mib, + snmp_view_based_acm_mib]}, + {load_module, snmp_community_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmpa_mib_lib, snmpa_vacm]}, + {load_module, snmpa_mib_lib, soft_purge, soft_purge, []} ] } ], @@ -33,6 +55,28 @@ [ {"4.18", [ + {load_module, snmp_misc, soft_purge, soft_purge, []}, + {load_module, snmpa_vacm, soft_purge, soft_purge, []}, + {load_module, snmpa, soft_purge, soft_purge, + [snmp_community_mib, + snmp_framework_mib, + snmp_standard_mib, + snmp_target_mib, + snmp_user_based_sm_mib, + snmp_view_based_acm_mib]}, + {load_module, snmp_community_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_framework_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_standard_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_target_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, + [snmpa_mib_lib]}, + {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, + [snmpa_mib_lib, snmpa_vacm]}, + {load_module, snmpa_mib_lib, soft_purge, soft_purge, []} ] } ] diff --git a/lib/snmp/src/compile/Makefile b/lib/snmp/src/compile/Makefile index 4be60e1835..1f1086eae1 100644 --- a/lib/snmp/src/compile/Makefile +++ b/lib/snmp/src/compile/Makefile @@ -20,6 +20,7 @@ include $(ERL_TOP)/make/target.mk EBIN = ../../ebin +BIN = ../../bin include $(ERL_TOP)/make/$(TARGET)/otp.mk @@ -44,9 +45,11 @@ RELSYSDIR = $(RELEASE_PATH)/lib/snmp-$(VSN) include modules.mk +ESCRIPT_BIN = $(ESCRIPT_SRC:%.src=$(BIN)/%) + ERL_FILES = $(MODULES:%=%.erl) -TARGET_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +TARGET_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(ESCRIPT_BIN) GENERATED_PARSER = $(PARSER_MODULE:%=%.erl) @@ -97,8 +100,12 @@ info: @echo "" @echo "EBIN: $(EBIN)" @echo "" + @echo "ESCRIPT_SRC: $(ESCRIPT_SRC)" + @echo "ESCRIPT_BIN: $(ESCRIPT_BIN)" + @echo "" @echo "" + # ---------------------------------------------------- # Special Build Targets # ---------------------------------------------------- @@ -107,6 +114,7 @@ parser: $(PARSER_TARGET) $(GENERATED_PARSER): $(PARSER_SRC) + # ---------------------------------------------------- # Release Target # ---------------------------------------------------- @@ -115,9 +123,11 @@ include $(ERL_TOP)/make/otp_release_targets.mk release_spec: opt $(INSTALL_DIR) $(RELSYSDIR)/src $(INSTALL_DIR) $(RELSYSDIR)/src/compiler - $(INSTALL_DATA) $(PARSER_SRC) $(ERL_FILES) $(INTERNAL_HRL_FILES) $(RELSYSDIR)/src/compiler + $(INSTALL_DATA) $(ESCRIPT_SRC) $(PARSER_SRC) $(ERL_FILES) $(INTERNAL_HRL_FILES) $(RELSYSDIR)/src/compiler $(INSTALL_DIR) $(RELSYSDIR)/ebin $(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)/ebin + $(INSTALL_DIR) $(RELSYSDIR)/bin + $(INSTALL_SCRIPT) $(ESCRIPT_BIN) $(RELSYSDIR)/bin release_docs_spec: diff --git a/lib/snmp/src/compile/depend.mk b/lib/snmp/src/compile/depend.mk index 75af1bf293..74eb6e0864 100644 --- a/lib/snmp/src/compile/depend.mk +++ b/lib/snmp/src/compile/depend.mk @@ -44,3 +44,6 @@ $(EBIN)/snmpc_mib_gram.$(EMULATOR): \ ../../include/snmp_types.hrl \ snmpc_mib_gram.erl +$(BIN)/snmpc: snmpc.src + $(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ + chmod 755 $@ diff --git a/lib/snmp/src/compile/modules.mk b/lib/snmp/src/compile/modules.mk index 6365b0e694..ca78e2e6a9 100644 --- a/lib/snmp/src/compile/modules.mk +++ b/lib/snmp/src/compile/modules.mk @@ -21,6 +21,9 @@ PARSER_SRC = snmpc_mib_gram.yrl PARSER_MODULE = $(PARSER_SRC:%.yrl=%) +ESCRIPT_SRC = \ + snmpc.src + MODULES = \ $(PARSER_MODULE) \ snmpc \ diff --git a/lib/snmp/src/compile/snmpc.erl b/lib/snmp/src/compile/snmpc.erl index a7f2cdc2bc..c4b3d7090f 100644 --- a/lib/snmp/src/compile/snmpc.erl +++ b/lib/snmp/src/compile/snmpc.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 @@ -112,6 +112,8 @@ compile(FileName) -> %% description %% reference %% imports +%% agent_capabilities +%% module_compliance %% module_identity %% {module, string()} %% no_defs @@ -203,6 +205,10 @@ get_options([imports|Opts], Formats, Args) -> get_options(Opts, ["~n imports"|Formats], Args); get_options([module_identity|Opts], Formats, Args) -> get_options(Opts, ["~n module_identity"|Formats], Args); +get_options([module_compliance|Opts], Formats, Args) -> + get_options(Opts, ["~n module_compliance"|Formats], Args); +get_options([agent_capabilities|Opts], Formats, Args) -> + get_options(Opts, ["~n agent_capabilities"|Formats], Args); get_options([relaxed_row_name_assign_check|Opts], Formats, Args) -> get_options(Opts, ["~n relaxed_row_name_assign_check"|Formats], Args); get_options([_|Opts], Formats, Args) -> @@ -288,6 +294,10 @@ check_options([imports| T]) -> check_options(T); check_options([module_identity| T]) -> check_options(T); +check_options([module_compliance| T]) -> + check_options(T); +check_options([agent_capabilities| T]) -> + check_options(T); check_options([relaxed_row_name_assign_check| T]) -> check_options(T); check_options([{module, M} | T]) when is_atom(M) -> @@ -315,6 +325,12 @@ get_description(Options) -> get_reference(Options) -> get_bool_option(reference, Options). +get_agent_capabilities(Options) -> + get_bool_option(agent_capabilities, Options). + +get_module_compliance(Options) -> + get_bool_option(module_compliance, Options). + get_relaxed_row_name_assign_check(Options) -> lists:member(relaxed_row_name_assign_check, Options). @@ -387,10 +403,12 @@ get_verbosity(Options) -> init(From, MibFileName, Options) -> {A,B,C} = now(), random:seed(A,B,C), - put(options, Options), - put(verbosity, get_verbosity(Options)), - put(description, get_description(Options)), - put(reference, get_reference(Options)), + put(options, Options), + put(verbosity, get_verbosity(Options)), + put(description, get_description(Options)), + put(reference, get_reference(Options)), + put(agent_capabilities, get_agent_capabilities(Options)), + put(module_compliance, get_module_compliance(Options)), File = filename:rootname(MibFileName, ".mib"), put(filename, filename:basename(File ++ ".mib")), R = case catch c_impl(File) of @@ -921,10 +939,96 @@ definitions_loop([{#mc_notification{name = TrapName, snmpc_lib:add_cdata(#cdata.traps, [Notif]), definitions_loop(T, Data); -definitions_loop([{#mc_module_compliance{name = Name},Line}|T], Data) -> - ?vlog2("defloop -> module_compliance:" - "~n Name: ~p", [Name], Line), +definitions_loop([{#mc_agent_capabilities{name = Name, + status = Status, + description = Desc, + reference = Ref, + modules = Mods, + name_assign = {Parent, SubIdx}},Line}|T], Data) -> + ?vlog2("defloop -> agent_capabilities ~p:" + "~n Status: ~p" + "~n Desc: ~p" + "~n Ref: ~p" + "~n Mods: ~p" + "~n Parent: ~p" + "~n SubIndex: ~p", + [Name, Status, Desc, Ref, Mods, Parent, SubIdx], Line), + ensure_macro_imported('AGENT-CAPABILITIES', Line), + case get(agent_capabilities) of + true -> + update_status(Name, Status), + snmpc_lib:register_oid(Line, Name, Parent, SubIdx), + NewME = snmpc_lib:makeInternalNode2(false, Name), + Description = make_description(Desc), + Reference = + case Ref of + undefined -> + []; + _ -> + [{reference, Ref}] + end, + Modules = + case Mods of + undefined -> + []; + [] -> + []; + _ -> + [{modules, Mods}] + end, + AssocList = Reference ++ Modules, + NewME2 = NewME#me{description = Description, + assocList = AssocList}, + snmpc_lib:add_cdata(#cdata.mes, [NewME2]); + _ -> + ok + end, + definitions_loop(T, Data); + +definitions_loop([{#mc_module_compliance{name = Name, + status = Status, + description = Desc, + reference = Ref, + modules = Mods, + name_assign = {Parent, SubIdx}},Line}|T], Data) -> + ?vlog2("defloop -> module_compliance: ~p" + "~n Status: ~p" + "~n Desc: ~p" + "~n Ref: ~p" + "~n Mods: ~p" + "~n Parent: ~p" + "~n SubIndex: ~p", + [Name, Status, Desc, Ref, Mods, Parent, SubIdx], Line), ensure_macro_imported('MODULE-COMPLIANCE', Line), + case get(module_compliance) of + true -> + update_status(Name, Status), + snmpc_lib:register_oid(Line, Name, Parent, SubIdx), + NewME = snmpc_lib:makeInternalNode2(false, Name), + Description = make_description(Desc), + Reference = + case Ref of + undefined -> + []; + _ -> + [{reference, Ref}] + end, + Modules = + case Mods of + undefined -> + []; + [] -> + []; + _ -> + [{modules, Mods}] + end, + AssocList = Reference ++ Modules, + NewME2 = NewME#me{description = Description, + assocList = AssocList}, + snmpc_lib:add_cdata(#cdata.mes, [NewME2]); + _ -> + ok + end, definitions_loop(T, Data); definitions_loop([{#mc_object_group{name = Name, @@ -1328,22 +1432,26 @@ save(Filename, MibName, Options) -> parse(FileName) -> +%% ?vtrace("parse -> start tokenizer for ~p", [FileName]), case snmpc_tok:start_link(reserved_words(), [{file, FileName ++ ".mib"}, {forget_stringdata, true}]) of {error,ReasonStr} -> snmpc_lib:error(lists:flatten(ReasonStr),[]); {ok, TokPid} -> +%% ?vtrace("parse -> tokenizer start, now get tokens", []), Toks = snmpc_tok:get_all_tokens(TokPid), +%% ?vtrace("parse -> tokens: ~p", [Toks]), set_version(Toks), - %% io:format("parse -> lexical analysis: ~n~p~n", [Toks]), - %% t("parse -> lexical analysis: ~n~p", [Toks]), + %% ?vtrace("parse -> lexical analysis: ~n~p", [Toks]), CDataArg = case lists:keysearch(module, 1, get(options)) of {value, {module, M}} -> {module, M}; _ -> {file, FileName ++ ".funcs"} end, put(cdata,snmpc_lib:make_cdata(CDataArg)), +%% ?vtrace("parse -> stop tokenizer and then do the actual parse", +%% []), snmpc_tok:stop(TokPid), Res = if is_list(Toks) -> @@ -1351,7 +1459,7 @@ parse(FileName) -> true -> Toks end, - %% t("parse -> parsed: ~n~p", [Res]), +%% ?vtrace("parse -> parsed result: ~n~p", [Res]), case Res of {ok, PData} -> {ok, PData}; @@ -1443,6 +1551,10 @@ reserved_words() -> 'NOTIFICATION-GROUP', 'NOTIFICATIONS', 'MODULE-COMPLIANCE', + 'AGENT-CAPABILITIES', + 'PRODUCT-RELEASE', + 'SUPPORTS', + 'INCLUDES', 'MODULE', 'MANDATORY-GROUPS', 'GROUP', diff --git a/lib/snmp/src/compile/snmpc.hrl b/lib/snmp/src/compile/snmpc.hrl index eb896cde6b..1c0808d065 100644 --- a/lib/snmp/src/compile/snmpc.hrl +++ b/lib/snmp/src/compile/snmpc.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. 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 @@ -103,16 +103,75 @@ ). +-record(mc_agent_capabilities, + {name, + product_release, + status, + description, + reference, + modules, + name_assign + } + ). + +-record(mc_ac_module, + {name, + groups, + variation + } + ). + +-record(mc_ac_object_variation, + {name, + syntax, + write_syntax, + access, + creation, + default_value, + description + } + ). + +-record(mc_ac_notification_variation, + {name, + access, + description + } + ). + + -record(mc_module_compliance, {name, status, description, reference, - module, + modules, name_assign } ). +-record(mc_mc_compliance_group, + {name, + description + } + ). + +-record(mc_mc_object, + {name, + syntax, + write_syntax, + access, + description + } + ). + +-record(mc_mc_module, + {name, + mandatory, + compliance + } + ). + -record(mc_object_group, {name, diff --git a/lib/snmp/src/compile/snmpc.src b/lib/snmp/src/compile/snmpc.src new file mode 100644 index 0000000000..e0734c056e --- /dev/null +++ b/lib/snmp/src/compile/snmpc.src @@ -0,0 +1,381 @@ +#!/usr/bin/env escript +%% -*- erlang -*- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-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% +%% +%% SNMP MIB compiler frontend +%% + +-mode(compile). + +-include_lib("kernel/include/file.hrl"). +-include_lib("snmp/include/snmp_types.hrl"). + + +-record(state, + { + version = "%VSN%", + mfv, + file, % .mib or .bin depending on which are compiled + outdir = "./", + db = volatile, + include_dirs = ["./"], + include_lib_dirs = [], + deprecated = false, + group_check = true, + description = false, + reference = false, + imports = false, + module_identity = false, + module_compliance = false, + agent_capabilities = false, + module, + no_defaults = false, + relaxed_row_name_assigne_check = false, + %% The default verbosity (silence) will be filled in + %% during argument processing. + verbosity, + warnings = false + }). + + +%% ------------------------------------------------------------------------ +%% Valid arguments: +%% --o Dir [defaults to "./"] +%% --i Dir [defaults to "./"] +%% --il Dir +%% --sgc +%% --db DB [defaults to volatile] +%% --dep +%% --desc +%% --ref +%% --imp +%% --mi +%% --mc +%% --ac +%% --mod Mod +%% --nd +%% --rrnac +%% --version +%% --verbosity V +%% --warnings +main(Args) when is_list(Args) -> + case (catch process_args(Args)) of + ok -> + usage(); + {ok, State} when is_record(State, state) -> + compile(State); + {ok, Str} when is_list(Str) -> + io:format("~s~n~n", [Str]), + halt(1); + {error, ReasonStr} -> + usage(ReasonStr) + end; +main(_) -> + usage(). + +compile(State) -> + %% io:format("snmpc: ~p~n", [State]), + case mk_file(State) of + {mib, File} -> + Options = mk_mib_options(State), + case mib2bin(File, Options) of + {ok, _BinFileName} -> + ok; + {error, Reason} -> + io:format("ERROR: Failed compiling mib: " + "~n ~p~n", [Reason]), + halt(1) + end; + {bin, File} -> + Options = mk_hrl_options(State), + case bin2hrl(File, Options) of + ok -> + ok; + {error, Reason} -> + io:format("ERROR: Failed generating hrl from mib: " + "~n ~p~n", [Reason]), + halt(1) + end + end. + +mib2bin(MibFileName, Options) -> + snmpc:compile(MibFileName, Options). + +bin2hrl(BinFileName, {OutDir, Verbosity}) -> + MibName = filename:basename(BinFileName), + BinFile = BinFileName ++ ".bin", + HrlFile = filename:join(OutDir, MibName) ++ ".hrl", + put(verbosity, Verbosity), + snmpc_mib_to_hrl:convert(BinFile, HrlFile, MibName). + + +mk_file(#state{file = MIB}) -> + DirName = filename:dirname(MIB), + case filename:extension(MIB) of + ".mib" -> + BaseName = filename:basename(MIB, ".mib"), + {mib, filename:join(DirName, BaseName)}; + ".bin" -> + BaseName = filename:basename(MIB, ".bin"), + {bin, filename:join(DirName, BaseName)}; + BadExt -> + e(lists:flatten(io_lib:format("Unsupported file type: ~s", [BadExt]))) + end. + +mk_mib_options(#state{outdir = OutDir, + db = DB, + include_dirs = IDs, + include_lib_dirs = ILDs, + deprecated = Dep, + group_check = GC, + description = Desc, + reference = Ref, + imports = Imp, + module_identity = MI, + module_compliance = MC, + agent_capabilities = AC, + module = Mod, + no_defaults = ND, + relaxed_row_name_assigne_check = RRNAC, + %% The default verbosity (silence) will be filled in + %% during argument processing. + verbosity = V, + warnings = W}) -> + [{outdir, OutDir}, + {db, DB}, + {i, IDs}, + {il, ILDs}, + {group_check, GC}, + {verbosity, V}, + {warnings, W}, + {deprecated, Dep}] ++ + if + (Mod =/= undefined) -> + [{module, Mod}]; + true -> + [] + end ++ + maybe_option(ND, no_defs) ++ + maybe_option(RRNAC, relaxed_row_name_assign_check) ++ + maybe_option(Desc, description) ++ + maybe_option(Ref, reference) ++ + maybe_option(Imp, imports) ++ + maybe_option(MI, module_identity) ++ + maybe_option(MC, module_compliance) ++ + maybe_option(AC, agent_capabilities). + +maybe_option(true, Opt) -> [Opt]; +maybe_option(_, _) -> []. + + +mk_hrl_options(#state{outdir = OutDir, + verbosity = Verbosity}) -> + {OutDir, Verbosity}. + + +process_args([]) -> + e("No input file"); +process_args(Args) -> + #mib{mib_format_version = MFV} = #mib{}, + State = #state{}, + process_args(Args, State#state{mfv = MFV}). + +process_args([], #state{verbosity = Verbosity0, file = MIB} = State) -> + if + (MIB =:= undefined) -> + e("No input file"); + true -> + Verbosity = + case Verbosity0 of + undefined -> + silence; + _ -> + Verbosity0 + end, + IPath = lists:reverse(State#state.include_dirs), + IlPath = lists:reverse(State#state.include_lib_dirs), + {ok, State#state{verbosity = Verbosity, + include_dirs = IPath, + include_lib_dirs = IlPath}} + end; +process_args(["--help"|_Args], _State) -> + ok; +process_args(["--version"|_Args], #state{version = Version, mfv = MFV} = _State) -> + {ok, lists:flatten(io_lib:format("snmpc ~s (~s)", [Version, MFV]))}; +process_args(["--verbosity", Verbosity0|Args], #state{verbosity = V} = State) + when (V =:= undefined) -> + Verbosity = list_to_atom(Verbosity0), + case lists:member(Verbosity, [trace,debug,log,info,silence]) of + true -> + process_args(Args, State#state{verbosity = Verbosity}); + false -> + e(lists:flatten(io_lib:format("Unknown verbosity: ~s", [Verbosity0]))) + end; +process_args(["--verbosity"|_Args], #state{verbosity = V}) + when (V =/= undefined) -> + e(lists:flatten(io_lib:format("Verbosity already set to ~w", [V]))); +process_args(["--warnings"|Args], State) -> + process_args(Args, State#state{warnings = true}); +process_args(["--o", Dir|Args], State) -> + case (catch file:read_file_info(Dir)) of + {ok, #file_info{type = directory}} -> + process_args(Args, State#state{outdir = Dir}); + {ok, #file_info{type = BadType}} -> + e(lists:flatten(io_lib:format("Not a directory: ~p (~w)", [Dir, BadType]))); + _ -> + e(lists:flatten(io_lib:format("Bad directory: ~p", [Dir]))) + end; +process_args(["--i", Dir|Args], State) -> + case (catch file:read_file_info(Dir)) of + {ok, #file_info{type = directory}} -> + IPath = [Dir | State#state.include_dirs], + process_args(Args, State#state{include_dirs = IPath}); + {ok, #file_info{type = BadType}} -> + e(lists:flatten(io_lib:format("Not a directory: ~p (~w)", [Dir, BadType]))); + _ -> + e(lists:flatten(io_lib:format("Bad directory: ~p", [Dir]))) + end; +process_args(["--il", Dir|Args], State) -> + case (catch file:read_file_info(Dir)) of + {ok, #file_info{type = directory}} -> + IlPath = [Dir | State#state.include_lib_dirs], + process_args(Args, State#state{include_lib_dirs = IlPath}); + {ok, #file_info{type = BadType}} -> + e(lists:flatten(io_lib:format("Not a directory: ~p (~w)", [Dir, BadType]))); + _ -> + e(lists:flatten(io_lib:format("Bad directory: ~p", [Dir]))) + end; +process_args(["--db", DB0|Args], State) -> + DB = list_to_atom(DB0), + case lists:member(DB, [volatile,persistent,mnesia]) of + true -> + process_args(Args, State#state{db = DB}); + false -> + e(lists:flatten(io_lib:format("Invalid db: ~s", [DB0]))) + end; +process_args(["--dep"|Args], State) -> + process_args(Args, State#state{deprecated = true}); +process_args(["--sgc"|Args], State) -> + process_args(Args, State#state{group_check = false}); +process_args(["--desc"|Args], State) -> + process_args(Args, State#state{description = true}); +process_args(["--ref"|Args], State) -> + process_args(Args, State#state{reference = true}); +process_args(["--imp"|Args], State) -> + process_args(Args, State#state{imports = true}); +process_args(["--mi"|Args], State) -> + process_args(Args, State#state{module_identity = true}); +process_args(["--mod", Module0|Args], #state{module = M} = State) + when (M =:= undefined) -> + Module = list_to_atom(Module0), + process_args(Args, State#state{module = Module}); +process_args(["--mod"|_Args], #state{module = M}) + when (M =/= undefined) -> + e(lists:flatten(io_lib:format("Module already set to ~w", [M]))); +process_args(["--nd"|Args], State) -> + process_args(Args, State#state{no_defaults = true}); +process_args(["--rrnac"|Args], State) -> + process_args(Args, State#state{relaxed_row_name_assigne_check = true}); +process_args([MIB], State) -> + Ext = filename:extension(MIB), + if + ((Ext =:= ".mib") orelse (Ext =:= ".bin")) -> + case (catch file:read_file_info(MIB)) of + {ok, #file_info{type = regular}} -> + process_args([], State#state{file = MIB}); + {ok, #file_info{type = BadType}} -> + e(lists:flatten(io_lib:format("~s not a file: ~w", [MIB, BadType]))); + {error, enoent} -> + e(lists:flatten(io_lib:format("No such file: ~s", [MIB]))); + _ -> + e(lists:flatten(io_lib:format("Bad file: ~s", [MIB]))) + end; + true -> + e(lists:flatten(io_lib:format("Unknown option: ~s", [MIB]))) + end; +process_args([Arg|Args], _State) when Args =/= [] -> + e(lists:flatten(io_lib:format("Unknown option: ~s", [Arg]))). + +usage(ReasonStr) -> + io:format("ERROR: ~s~n", [ReasonStr]), + usage(). + +usage() -> + io:format("Usage: snmpc [options] MIB.mib|MIB.bin" + "~nCompile a MIB (.mib -> .bin) or generate an erlang header " + "~nfile from a compiled MIB file (.bin -> .hrl)" + "~nOptions:" + "~n --help - Prints this info." + "~n --version - Prints compiler version." + "~n --verbosity <verbosity> - Print debug info." + "~n verbosity = trace | debug | log | info | silence" + "~n Defaults to silence." + "~n --warnings - Print warning messages." + "~n --o <output dir> - The output dir." + "~n Defaults to current working dir." + "~n --i <include dir> - Add this dir to the list of dirs that will be" + "~n searched for imported (compiled) MIB files." + "~n The current workin dir will always be included. " + "~n --il <include_lib dir> - Add this dir to the list of dirs that will be" + "~n searched for imported (compiled) MIB files." + "~n It assumes that the first element in the dir name" + "~n correspond to an OTP application. For example snmp/mibs/" + "~n The current workin dir and the <snmp-home>/priv/mibs " + "~n are always listed last the includ path. " + "~n --db <DB> - Database to used for the default instrumentation." + "~n Defaults to volatile." + "~n --sgc - This option (skip group check), if present, disables " + "~n the \"group check\" of the mib compiler. " + "~n That is, should the OBJECT-GROUP and the NOTIFICATION-GROUP " + "~n macro(s) be checked for correctness or not. " + "~n By default the check is done. " + "~n --dep - Keep deprecated definition(s)." + "~n If not specified the compiler will ignore" + "~n deprecated definitions." + "~n --desc - The DESCRIPTION field will be included." + "~n --ref - The REFERENCE field will be included." + "~n --imp - The IMPORTS field will be included." + "~n --mi - The MODULE-IDENTITY field will be included." + "~n --mc - The MODULE-COMPLIANCE field will be included." + "~n --ac - The AGENT-CAPABILITIES field will be included." + "~n --mod <module> - The module which implements all the instrumentation" + "~n functions. " + "~n The name of all instrumentation functions must" + "~n be the same as the corresponding managed object" + "~n it implements." + "~n --nd - The default instrumentation functions will *not* be used" + "~n if a managed object have no instrumentation function. " + "~n Instead this will be reported as an error, and the " + "~n compilation aborts. " + "~n --rrnac - This option, if present, specifies that the row name " + "~n assign check shall not be done strictly according to" + "~n the SMI (which allows only the value 1). " + "~n With this option, all values greater than zero is allowed" + "~n (>= 1). This means that the error will be converted to " + "~n a warning. " + "~n By default it is not included, but if this option is " + "~n present it will be. " + "~n " + "~n", []), + halt(1). + + +e(Reason) -> + throw({error, Reason}). + diff --git a/lib/snmp/src/compile/snmpc_lib.erl b/lib/snmp/src/compile/snmpc_lib.erl index 4490412e84..4f71c47bfa 100644 --- a/lib/snmp/src/compile/snmpc_lib.erl +++ b/lib/snmp/src/compile/snmpc_lib.erl @@ -306,7 +306,10 @@ import_mib({{'SNMPv2-TC', ImportsFromMib},Line}) -> Macros = ['TEXTUAL-CONVENTION'], import_built_in_loop(ImportsFromMib,Nodes,Types,Macros,'SNMPv2-TC',Line); import_mib({{'SNMPv2-CONF', ImportsFromMib},Line}) -> - Macros = ['OBJECT-GROUP','NOTIFICATION-GROUP','MODULE-COMPLIANCE'], + Macros = ['OBJECT-GROUP', + 'NOTIFICATION-GROUP', + 'MODULE-COMPLIANCE', + 'AGENT-CAPABILITIES'], import_built_in_loop(ImportsFromMib,[],[],Macros,'SNMPv2-CONF',Line); import_mib({{'RFC1155-SMI', ImportsFromMib},Line}) -> Nodes = [makeInternalNode(internet, [1,3,6,1]), diff --git a/lib/snmp/src/compile/snmpc_mib_gram.yrl b/lib/snmp/src/compile/snmpc_mib_gram.yrl index 1957f52936..74b9ddaa25 100644 --- a/lib/snmp/src/compile/snmpc_mib_gram.yrl +++ b/lib/snmp/src/compile/snmpc_mib_gram.yrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. 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 @@ -59,6 +59,7 @@ newtypename objectidentifier objectname objecttypev1 +prodrel range_num referpart size @@ -79,7 +80,7 @@ revisions listofdefinitionsv2 mibid last_updated -oranization +organization contact_info revision revision_string @@ -101,19 +102,31 @@ textualconvention objectgroup notificationgroup modulecompliance -modulepart -modules -module -modulenamepart -mandatorypart -compliancepart -compliances -compliance -compliancegroup -object +mc_modulepart +mc_modules +mc_module +mc_modulenamepart +mc_mandatorypart +mc_compliancepart +mc_compliances +mc_compliance +mc_compliancegroup +mc_object +mc_accesspart +agentcapabilities +ac_status +ac_modulepart +ac_modules +ac_module +ac_modulenamepart +ac_variationpart +ac_variations +ac_variation +ac_accesspart +ac_access +ac_creationpart syntaxpart writesyntaxpart -accesspart fsyntax defbitsvalue defbitsnames @@ -161,6 +174,12 @@ integer variable atom string quote '{' '}' '::=' ':' '=' ',' '.' '(' ')' ';' '|' 'CONTACT-INFO' 'MODULE-IDENTITY' 'NOTIFICATION-TYPE' +'PRODUCT-RELEASE' +'AGENT-CAPABILITIES' +'INCLUDES' +'SUPPORTS' +'VARIATION' +'CREATION-REQUIRES' 'MODULE-COMPLIANCE' 'OBJECT-GROUP' 'NOTIFICATION-GROUP' @@ -212,8 +231,8 @@ mib -> mibname 'DEFINITIONS' implies 'BEGIN' defs = Defs}. v1orv2 -> moduleidentity listofdefinitionsv2 : - {v2_mib, ['$1'|lists:reverse('$2')]}. -v1orv2 -> listofdefinitions : {v1_mib, lists:reverse('$1')}. + {v2_mib, ['$1'|lreverse(v1orv2_mod, '$2')]}. +v1orv2 -> listofdefinitions : {v1_mib, lreverse(v1orv2_list, '$1')}. definition -> objectidentifier : '$1'. definition -> objecttypev1 : '$1'. @@ -231,7 +250,7 @@ imports -> imports_from_one_mib : ['$1']. imports -> imports_from_one_mib imports : ['$1' | '$2']. imports_from_one_mib -> listofimports 'FROM' variable : - {{val('$3'), lists:reverse('$1')}, line_of('$2')}. + {{val('$3'), lreverse(imports_from_one_mib, '$1')}, line_of('$2')}. listofimports -> import_stuff : ['$1']. listofimports -> listofimports ',' import_stuff : ['$3' | '$1']. @@ -251,6 +270,8 @@ import_stuff -> 'MODULE-IDENTITY' : ensure_ver(2,'$1'), {builtin, 'MODULE-IDENTITY'}. import_stuff -> 'NOTIFICATION-TYPE' : ensure_ver(2,'$1'), {builtin, 'NOTIFICATION-TYPE'}. +import_stuff -> 'AGENT-CAPABILITIES' + : ensure_ver(2,'$1'), {builtin, 'AGENT-CAPABILITIES'}. import_stuff -> 'MODULE-COMPLIANCE' : ensure_ver(2,'$1'), {builtin, 'MODULE-COMPLIANCE'}. import_stuff -> 'NOTIFICATION-GROUP' @@ -296,7 +317,7 @@ import_stuff -> 'TAddress' traptype -> objectname 'TRAP-TYPE' 'ENTERPRISE' objectname varpart description referpart implies integer : - Trap = make_trap('$1', '$4', lists:reverse('$5'), + Trap = make_trap('$1', '$4', lreverse(traptype, '$5'), '$6', '$7', val('$9')), {Trap, line_of('$2')}. @@ -324,7 +345,7 @@ newtype -> newtypename implies syntax : {NT, line_of('$2')}. tableentrydefinition -> newtypename implies 'SEQUENCE' '{' fields '}' : - Seq = make_sequence('$1', lists:reverse('$5')), + Seq = make_sequence('$1', lreverse(tableentrydefinition, '$5')), {Seq, line_of('$3')}. % returns: list of {<fieldname>, <asn1_type>} @@ -408,9 +429,9 @@ variables -> variables ',' objectname : ['$3' | '$1']. implies -> '::=' : '$1'. implies -> ':' ':' '=' : w("Sloppy asignment on line ~p", [line_of('$1')]), '$1'. -descriptionfield -> string : lists:reverse(val('$1')). +descriptionfield -> string : lreverse(descriptionfield, val('$1')). descriptionfield -> '$empty' : undefined. -description -> 'DESCRIPTION' string : lists:reverse(val('$2')). +description -> 'DESCRIPTION' string : lreverse(description, val('$2')). description -> '$empty' : undefined. displaypart -> 'DISPLAY-HINT' string : display_hint('$2') . @@ -418,7 +439,7 @@ displaypart -> '$empty' : undefined . % returns: {indexes, undefined} % | {indexes, IndexList} where IndexList is a list of aliasnames. -indexpartv1 -> 'INDEX' '{' indextypesv1 '}' : {indexes, lists:reverse('$3')}. +indexpartv1 -> 'INDEX' '{' indextypesv1 '}' : {indexes, lreverse(indexpartv1, '$3')}. indexpartv1 -> '$empty' : {indexes, undefined}. indextypesv1 -> indextypev1 : ['$1']. @@ -436,14 +457,16 @@ parentintegers -> atom '(' integer ')' parentintegers : [val('$3') | '$5']. defvalpart -> 'DEFVAL' '{' integer '}' : {defval, val('$3')}. defvalpart -> 'DEFVAL' '{' atom '}' : {defval, val('$3')}. defvalpart -> 'DEFVAL' '{' '{' defbitsvalue '}' '}' : {defval, '$4'}. -defvalpart -> 'DEFVAL' '{' quote atom '}' - : {defval, make_defval_for_string(line_of('$1'), lists:reverse(val('$3')), - val('$4'))}. -defvalpart -> 'DEFVAL' '{' quote variable '}' - : {defval, make_defval_for_string(line_of('$1'), lists:reverse(val('$3')), - val('$4'))}. -defvalpart -> 'DEFVAL' '{' string '}' - : {defval, lists:reverse(val('$3'))}. +defvalpart -> 'DEFVAL' '{' quote atom '}' : + {defval, make_defval_for_string(line_of('$1'), + lreverse(defvalpart_quote_atom, val('$3')), + val('$4'))}. +defvalpart -> 'DEFVAL' '{' quote variable '}' : + {defval, make_defval_for_string(line_of('$1'), + lreverse(defvalpart_quote_variable, val('$3')), + val('$4'))}. +defvalpart -> 'DEFVAL' '{' string '}' : + {defval, lreverse(defvalpart_string, val('$3'))}. defvalpart -> '$empty' : undefined. defbitsvalue -> defbitsnames : '$1'. @@ -461,7 +484,7 @@ accessv1 -> atom: accessv1('$1'). statusv1 -> atom : statusv1('$1'). -referpart -> 'REFERENCE' string : lists:reverse(val('$2')). +referpart -> 'REFERENCE' string : lreverse(referpart, val('$2')). referpart -> '$empty' : undefined. @@ -471,7 +494,7 @@ referpart -> '$empty' : undefined. %%---------------------------------------------------------------------- moduleidentity -> mibid 'MODULE-IDENTITY' 'LAST-UPDATED' last_updated - 'ORGANIZATION' oranization + 'ORGANIZATION' organization 'CONTACT-INFO' contact_info 'DESCRIPTION' descriptionfield revisionpart nameassign : @@ -480,20 +503,20 @@ moduleidentity -> mibid 'MODULE-IDENTITY' {MI, line_of('$2')}. mibid -> atom : val('$1'). -last_updated -> string : lists:reverse(val('$1')) . -oranization -> string : lists:reverse(val('$1')) . -contact_info -> string : lists:reverse(val('$1')) . +last_updated -> string : lreverse(last_updated, val('$1')) . +organization -> string : lreverse(organization, val('$1')) . +contact_info -> string : lreverse(contact_info, val('$1')) . revisionpart -> '$empty' : [] . -revisionpart -> revisions : lists:reverse('$1') . +revisionpart -> revisions : lreverse(revisionpart, '$1') . revisions -> revision : ['$1'] . revisions -> revisions revision : ['$2' | '$1'] . revision -> 'REVISION' revision_string 'DESCRIPTION' revision_desc : make_revision('$2', '$4') . -revision_string -> string : lists:reverse(val('$1')) . -revision_desc -> string : lists:reverse(val('$1')) . +revision_string -> string : lreverse(revision_string, val('$1')) . +revision_desc -> string : lreverse(revision_desc, val('$1')) . definitionv2 -> objectidentifier : '$1'. definitionv2 -> objecttypev2 : '$1'. @@ -505,6 +528,7 @@ definitionv2 -> notification : '$1'. definitionv2 -> objectgroup : '$1'. definitionv2 -> notificationgroup : '$1'. definitionv2 -> modulecompliance : '$1'. +definitionv2 -> agentcapabilities : '$1'. listofdefinitionsv2 -> '$empty' : [] . listofdefinitionsv2 -> listofdefinitionsv2 definitionv2 : ['$2' | '$1']. @@ -535,46 +559,127 @@ notificationgroup -> objectname 'NOTIFICATION-GROUP' 'NOTIFICATIONS' '{' {NG, line_of('$2')}. modulecompliance -> objectname 'MODULE-COMPLIANCE' 'STATUS' statusv2 - description referpart modulepart nameassign : + description referpart mc_modulepart nameassign : +%% io:format("modulecompliance -> " +%% "~n '$1': ~p" +%% "~n '$4': ~p" +%% "~n '$5': ~p" +%% "~n '$6': ~p" +%% "~n '$7': ~p" +%% "~n '$8': ~p" +%% "~n", ['$1', '$4', '$5', '$6', '$7', '$8']), MC = make_module_compliance('$1', '$4', '$5', '$6', '$7', '$8'), +%% io:format("modulecompliance -> " +%% "~n MC: ~p" +%% "~n", [MC]), {MC, line_of('$2')}. -modulepart -> '$empty'. -modulepart -> modules. -modules -> module. -modules -> modules module. +agentcapabilities -> objectname 'AGENT-CAPABILITIES' + 'PRODUCT-RELEASE' prodrel + 'STATUS' ac_status + description referpart ac_modulepart nameassign : + AC = make_agent_capabilities('$1', '$4', '$6', '$7', + '$8', '$9', '$10'), + {AC, line_of('$2')}. + +prodrel -> string : lreverse(prodrel, val('$1')). + +ac_status -> atom : ac_status('$1'). + +ac_modulepart -> ac_modules : + lreverse(ac_modulepart, '$1'). +ac_modulepart -> '$empty' : + []. + +ac_modules -> ac_module : + ['$1']. +ac_modules -> ac_module ac_modules : + ['$1' | '$2']. + +ac_module -> 'SUPPORTS' ac_modulenamepart 'INCLUDES' '{' objects '}' ac_variationpart : + make_ac_module('$2', '$5', '$7'). + +ac_modulenamepart -> mibname : '$1'. +ac_modulenamepart -> '$empty' : undefined. + +ac_variationpart -> '$empty' : + []. +ac_variationpart -> ac_variations : + lreverse(ac_variationpart, '$1'). + +ac_variations -> ac_variation : + ['$1']. +ac_variations -> ac_variation ac_variations : + ['$1' | '$2']. + +%% ac_variation -> ac_objectvariation. +%% ac_variation -> ac_notificationvariation. + +ac_variation -> 'VARIATION' objectname syntaxpart writesyntaxpart ac_accesspart ac_creationpart defvalpart description : + make_ac_variation('$2', '$3', '$4', '$5', '$6', '$7', '$8'). + +ac_accesspart -> 'ACCESS' ac_access : '$2'. +ac_accesspart -> '$empty' : undefined. + +ac_access -> atom: ac_access('$1'). + +ac_creationpart -> 'CREATION-REQUIRES' '{' objects '}' : + lreverse(ac_creationpart, '$3'). +ac_creationpart -> '$empty' : + []. + +mc_modulepart -> '$empty' : + []. +mc_modulepart -> mc_modules : + lreverse(mc_modulepart, '$1'). + +mc_modules -> mc_module : + ['$1']. +mc_modules -> mc_module mc_modules : + ['$1' | '$2']. -module -> 'MODULE' modulenamepart mandatorypart compliancepart. +mc_module -> 'MODULE' mc_modulenamepart mc_mandatorypart mc_compliancepart : + make_mc_module('$2', '$3', '$4'). -modulenamepart -> mibname. -modulenamepart -> '$empty'. +mc_modulenamepart -> mibname : '$1'. +mc_modulenamepart -> '$empty' : undefined. -mandatorypart -> 'MANDATORY-GROUPS' '{' objects '}'. -mandatorypart -> '$empty'. +mc_mandatorypart -> 'MANDATORY-GROUPS' '{' objects '}' : + lreverse(mc_mandatorypart, '$3'). +mc_mandatorypart -> '$empty' : + []. -compliancepart -> compliances. -compliancepart -> '$empty'. +mc_compliancepart -> mc_compliances : + lreverse(mc_compliancepart, '$1'). +mc_compliancepart -> '$empty' : + []. -compliances -> compliance. -compliances -> compliances compliance. +mc_compliances -> mc_compliance : + ['$1']. +mc_compliances -> mc_compliance mc_compliances : + ['$1' | '$2']. -compliance -> compliancegroup. -compliance -> object. +mc_compliance -> mc_compliancegroup : + '$1'. +mc_compliance -> mc_object : + '$1'. -compliancegroup -> 'GROUP' objectname description. +mc_compliancegroup -> 'GROUP' objectname description : + make_mc_compliance_group('$2', '$3'). -object -> 'OBJECT' objectname syntaxpart writesyntaxpart accesspart description. +mc_object -> 'OBJECT' objectname syntaxpart writesyntaxpart mc_accesspart description : + make_mc_object('$2', '$3', '$4', '$5', '$6'). -syntaxpart -> 'SYNTAX' syntax. -syntaxpart -> '$empty'. +syntaxpart -> 'SYNTAX' syntax : '$2'. +syntaxpart -> '$empty' : undefined. -writesyntaxpart -> 'WRITE-SYNTAX' syntax. -writesyntaxpart -> '$empty'. +writesyntaxpart -> 'WRITE-SYNTAX' syntax : '$2'. +writesyntaxpart -> '$empty' : undefined. -accesspart -> 'MIN-ACCESS' accessv2. -accesspart -> '$empty'. +mc_accesspart -> 'MIN-ACCESS' accessv2 : '$2'. +mc_accesspart -> '$empty' : undefined. objecttypev2 -> objectname 'OBJECT-TYPE' 'SYNTAX' syntax @@ -589,7 +694,7 @@ objecttypev2 -> objectname 'OBJECT-TYPE' '$11', '$12', Kind, '$15'), {OT, line_of('$2')}. -indexpartv2 -> 'INDEX' '{' indextypesv2 '}' : {indexes, lists:reverse('$3')}. +indexpartv2 -> 'INDEX' '{' indextypesv2 '}' : {indexes, lreverse(indexpartv2, '$3')}. indexpartv2 -> 'AUGMENTS' '{' entry '}' : {augments, '$3'}. indexpartv2 -> '$empty' : {indexes, undefined}. @@ -614,7 +719,7 @@ notification -> objectname 'NOTIFICATION-TYPE' objectspart Not = make_notification('$1','$3','$5', '$7', '$8', '$9'), {Not, line_of('$2')}. -objectspart -> 'OBJECTS' '{' objects '}' : lists:reverse('$3'). +objectspart -> 'OBJECTS' '{' objects '}' : lreverse(objectspart, '$3'). objectspart -> '$empty' : []. objects -> objectname : ['$1']. @@ -655,6 +760,14 @@ statusv2(Tok) -> "syntax error before: " ++ atom_to_list(Else)) end. +ac_status(Tok) -> + case val(Tok) of + current -> current; + obsolete -> obsolete; + Else -> return_error(line_of(Tok), + "syntax error before: " ++ atom_to_list(Else)) + end. + accessv1(Tok) -> case val(Tok) of 'read-only' -> 'read-only'; @@ -676,6 +789,18 @@ accessv2(Tok) -> "syntax error before: " ++ atom_to_list(Else)) end. +ac_access(Tok) -> + case val(Tok) of + 'not-implemented' -> 'not-implemented'; % only for notifications + 'accessible-for-notify' -> 'accessible-for-notify'; + 'read-only' -> 'read-only'; + 'read-write' -> 'read-write'; + 'read-create' -> 'read-create'; + 'write-only' -> 'write-only'; % for backward-compatibility only + Else -> return_error(line_of(Tok), + "syntax error before: " ++ atom_to_list(Else)) + end. + %% --------------------------------------------------------------------- %% Various basic record build functions %% --------------------------------------------------------------------- @@ -744,14 +869,79 @@ make_notification(Name, Vars, Status, Desc, Ref, NA) -> reference = Ref, name_assign = NA}. -make_module_compliance(Name, Status, Desc, Ref, Mod, NA) -> +make_agent_capabilities(Name, ProdRel, Status, Desc, Ref, Mods, NA) -> + #mc_agent_capabilities{name = Name, + product_release = ProdRel, + status = Status, + description = Desc, + reference = Ref, + modules = Mods, + name_assign = NA}. + +make_ac_variation(Name, + undefined = _Syntax, + undefined = _WriteSyntax, + Access, + undefined = _Creation, + undefined = _DefVal, + Desc) -> +%% io:format("make_ac_variation -> entry with" +%% "~n Name: ~p" +%% "~n Access: ~p" +%% "~n Desc: ~p" +%% "~n", [Name, Access, Desc]), + #mc_ac_notification_variation{name = Name, + access = Access, + description = Desc}; + +make_ac_variation(Name, Syntax, WriteSyntax, Access, Creation, DefVal, Desc) -> +%% io:format("make_ac_variation -> entry with" +%% "~n Name: ~p" +%% "~n Syntax: ~p" +%% "~n WriteSyntax: ~p" +%% "~n Access: ~p" +%% "~n Creation: ~p" +%% "~n DefVal: ~p" +%% "~n Desc: ~p" +%% "~n", [Name, Syntax, WriteSyntax, Access, Creation, DefVal, Desc]), + #mc_ac_object_variation{name = Name, + syntax = Syntax, + write_syntax = WriteSyntax, + access = Access, + creation = Creation, + default_value = DefVal, + description = Desc}. + +make_ac_module(Name, Grps, Var) -> + #mc_ac_module{name = Name, + groups = Grps, + variation = Var}. + + +make_module_compliance(Name, Status, Desc, Ref, Mods, NA) -> #mc_module_compliance{name = Name, status = Status, description = Desc, reference = Ref, - module = Mod, + modules = Mods, name_assign = NA}. +make_mc_module(Name, Mand, Compl) -> + #mc_mc_module{name = Name, + mandatory = Mand, + compliance = Compl}. + +make_mc_compliance_group(Name, Desc) -> + #mc_mc_compliance_group{name = Name, + description = Desc}. + +make_mc_object(Name, Syntax, WriteSyntax, Access, Desc) -> + #mc_mc_object{name = Name, + syntax = Syntax, + write_syntax = WriteSyntax, + access = Access, + description = Desc}. + make_object_group(Name, Objs, Status, Desc, Ref, NA) -> #mc_object_group{name = Name, objects = Objs, @@ -968,6 +1158,12 @@ filter_v2imports(_,Type) -> {type, Type}. w(F, A) -> ?vwarning(F, A). -%i(F, A) -> -% io:format("~w:" ++ F ++ "~n", [?MODULE|A]). +lreverse(_Tag, L) when is_list(L) -> + lists:reverse(L); +lreverse(Tag, X) -> + exit({bad_list, Tag, X}). + + +%% i(F, A) -> +%% io:format("~w:" ++ F ++ "~n", [?MODULE|A]). diff --git a/lib/snmp/src/compile/snmpc_mib_to_hrl.erl b/lib/snmp/src/compile/snmpc_mib_to_hrl.erl index 07bd29231b..decc1ce557 100644 --- a/lib/snmp/src/compile/snmpc_mib_to_hrl.erl +++ b/lib/snmp/src/compile/snmpc_mib_to_hrl.erl @@ -24,7 +24,8 @@ -include("snmpc_lib.hrl"). %% External exports --export([convert/1, compile/3]). +-export([convert/1, convert/3, compile/3]). + %%----------------------------------------------------------------- %% Func: convert/1 diff --git a/lib/snmp/src/compile/snmpc_tok.erl b/lib/snmp/src/compile/snmpc_tok.erl index 6b99e7ae43..e238b256d0 100644 --- a/lib/snmp/src/compile/snmpc_tok.erl +++ b/lib/snmp/src/compile/snmpc_tok.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-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 @@ -37,6 +37,8 @@ -export([null_get_line/0, format_error/1, terminate/2, handle_call/3, init/1, test/0]). +-include("snmpc_lib.hrl"). + %%---------------------------------------------------------------------- %% Reserved_words: list of KeyWords. Example: ['IF', 'BEGIN', ..., 'GOTO'] @@ -130,6 +132,10 @@ test() -> 'current','deprecated','not-accessible','obsolete', 'read-create','read-only','read-write', 'IMPORTS', 'FROM', 'MODULE-COMPLIANCE', + 'AGENT-CAPABILITIES', + 'PRODUCT-RELEASE', + 'SUPPORTS', + 'INCLUDES', 'DisplayString', 'PhysAddress', 'MacAddress', @@ -225,6 +231,7 @@ get_all_tokens(Str,Toks) -> case catch tokenise(Str) of {error, ErrorInfo} -> {error, ErrorInfo}; {Token, RestChars} when is_tuple(Token) -> + %% ?vtrace("get_all_tokens -> Token: ~p", [Token]), get_all_tokens(RestChars, [Token|Toks]) end. diff --git a/lib/snmp/test/klas3.erl b/lib/snmp/test/klas3.erl index a5ce2af8c5..ec78d19dbb 100644 --- a/lib/snmp/test/klas3.erl +++ b/lib/snmp/test/klas3.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 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/sa.erl b/lib/snmp/test/sa.erl index ad3ccce08f..fee50c0e8c 100644 --- a/lib/snmp/test/sa.erl +++ b/lib/snmp/test/sa.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 diff --git a/lib/snmp/test/snmp.cover b/lib/snmp/test/snmp.cover index 027dce68c1..a2e7dd978f 100644 --- a/lib/snmp/test/snmp.cover +++ b/lib/snmp/test/snmp.cover @@ -1,5 +1,7 @@ %% -*- erlang -*- -{exclude, +{incl_app,snmp,details}. + +{excl_mods,snmp, [snmp_index, snmpa_error_io, snmpa_authentication_service, diff --git a/lib/snmp/test/snmp.spec b/lib/snmp/test/snmp.spec index 0af52c139e..88ae0145f0 100644 --- a/lib/snmp/test/snmp.spec +++ b/lib/snmp/test/snmp.spec @@ -1 +1 @@ -{topcase, {dir, "../snmp_test"}}. +{suites,"../snmp_test",all}. diff --git a/lib/snmp/test/snmp_SUITE.erl b/lib/snmp/test/snmp_SUITE.erl index f560e36663..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-2009. 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,27 +19,14 @@ -module(snmp_SUITE). --export([all/1, - init_per_testcase/2, fin_per_testcase/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([app/1, compiler/1, misc/1, agent/1, manager/1]). - --export([ - app_test/1, - appup_test/1, - compiler_test/1, - conf_test/1, - pdus_test/1, - log_test/1, - note_store_test/1, - mibs_test/1, - nfilter_test/1, - agent_test/1, - manager_config_test/1, - manager_user_test/1, - manager_test/1 - ]). %% %% ----- @@ -48,110 +35,60 @@ init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -all(doc) -> - ["Test suites for the snmp application.", - "There are eight different sub test-suites."]; - -all(suite) -> - [ - app, - compiler, - misc, - agent, - manager - - ]. - -app(suite) -> - [ - app_test, - appup_test - ]. - -compiler(suite) -> - [ - compiler_test - ]. - -misc(suite) -> - [ - conf_test, - pdus_test, - log_test, - note_store_test - ]. - -agent(suite) -> - [ - mibs_test, - nfilter_test, - agent_test - ]. - -manager(suite) -> - [ - manager_config_test, - manager_user_test, - manager_test - ]. - - -app_test(suite) -> - [{snmp_app_test, all}]. - - -appup_test(suite) -> - [{snmp_appup_test, all}]. - - -compiler_test(suite) -> - [{snmp_compiler_test, all}]. - - -conf_test(suite) -> - [{snmp_conf_test, all}]. - - -pdus_test(suite) -> - [{snmp_pdus_test, all}]. - - -log_test(suite) -> - [{snmp_log_test, all}]. - - -note_store_test(suite) -> - [{snmp_note_store_test, all}]. - - -mibs_test(suite) -> - [{snmp_agent_mibs_test, all}]. - - -nfilter_test(suite) -> - [{snmp_agent_nfilter_test, all}]. - - -agent_test(suite) -> - [{snmp_agent_test, all}]. - - -manager_config_test(suite) -> - [{snmp_manager_config_test, all}]. - - -manager_user_test(suite) -> - [{snmp_manager_user_test, all}]. +suite() -> + [{ct_hooks, [ts_install_cth]}]. + +all() -> + [{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}]}]. + +init_per_suite(Config) -> + Config. +end_per_suite(_Config) -> + ok. -manager_test(suite) -> - [{snmp_manager_test, all}]. +init_per_group(_GroupName, Config) -> + Config. +end_per_group(_GroupName, Config) -> + Config. diff --git a/lib/snmp/test/snmp_agent_bl_test.erl b/lib/snmp/test/snmp_agent_bl_test.erl index 4608d90201..b17489a755 100644 --- a/lib/snmp/test/snmp_agent_bl_test.erl +++ b/lib/snmp/test/snmp_agent_bl_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -89,7 +89,7 @@ init_per_testcase(_Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:minutes(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), Config. diff --git a/lib/snmp/test/snmp_agent_mibs_test.erl b/lib/snmp/test/snmp_agent_mibs_test.erl index 5f1ff53a79..3e48130fac 100644 --- a/lib/snmp/test/snmp_agent_mibs_test.erl +++ b/lib/snmp/test/snmp_agent_mibs_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -26,7 +26,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -include_lib("snmp/include/snmp_types.hrl"). -include_lib("snmp/include/SNMP-COMMUNITY-MIB.hrl"). @@ -39,12 +39,12 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2, - init_all/1, finish_all/1, + all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, + init_per_suite/1, end_per_suite/1, start_and_stop/1, - size_check/1, + size_check_ets/1, size_check_dets/1, size_check_mnesia/1, @@ -58,8 +58,6 @@ %%---------------------------------------------------------------------- %% Internal exports %%---------------------------------------------------------------------- --export([ - ]). %%---------------------------------------------------------------------- %% Macros @@ -100,20 +98,20 @@ init_per_testcase(cache_test, Config) when is_list(Config) -> init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(size_check_dets, Config) when is_list(Config) -> +end_per_testcase(size_check_dets, Config) when is_list(Config) -> Dir = ?config(dets_dir, Config), ?line ok = ?DEL_DIR(Dir), lists:keydelete(dets_dir, 1, Config); -fin_per_testcase(size_check_mnesia, Config) when is_list(Config) -> +end_per_testcase(size_check_mnesia, Config) when is_list(Config) -> mnesia_stop(), Dir = ?config(mnesia_dir, Config), ?line ok = ?DEL_DIR(Dir), lists:keydelete(mnesia_dir, 1, Config); -fin_per_testcase(cache_test, Config) when is_list(Config) -> +end_per_testcase(cache_test, Config) when is_list(Config) -> Dog = ?config(watchdog, Config), test_server:timetrap_cancel(Dog), Config; -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. @@ -121,20 +119,25 @@ fin_per_testcase(_Case, Config) when is_list(Config) -> %% Test case definitions %%====================================================================== -all(suite) -> - {conf, init_all, cases(), finish_all}. +all() -> +cases(). + +groups() -> + [{size_check, [], + [size_check_ets, size_check_dets, size_check_mnesia]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + -cases() -> - [ - start_and_stop, - load_unload, - size_check, - me_lookup, - which_mib, - cache_test - ]. +cases() -> +[start_and_stop, load_unload, {group, size_check}, + me_lookup, which_mib, cache_test]. -init_all(Config) when is_list(Config) -> +init_per_suite(Config) when is_list(Config) -> %% Data dir points wrong DataDir0 = ?config(data_dir, Config), DataDir1 = filename:split(filename:absname(DataDir0)), @@ -142,7 +145,7 @@ init_all(Config) when is_list(Config) -> DataDir = filename:join(lists:reverse(DataDir2) ++ [?snmp_test_data]), [{snmp_data_dir, DataDir ++ "/"}|Config]. -finish_all(Config) when is_list(Config) -> +end_per_suite(Config) when is_list(Config) -> lists:keydelete(snmp_data_dir, 1, Config). @@ -217,12 +220,6 @@ load_unload(Config) when is_list(Config) -> %% --------------------------------------------------------------------- -size_check(suite) -> - [ - size_check_ets, - size_check_dets, - size_check_mnesia - ]. size_check_ets(suite) -> []; diff --git a/lib/snmp/test/snmp_agent_ms_test.erl b/lib/snmp/test/snmp_agent_ms_test.erl index 3a3a790e6a..1f34f1c8d1 100644 --- a/lib/snmp/test/snmp_agent_ms_test.erl +++ b/lib/snmp/test/snmp_agent_ms_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -28,7 +28,7 @@ -define(application, snmp). -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -83,39 +83,165 @@ _ -> V3 end). -all(suite) -> {req, - [mnesia, distribution, - {local_slave_nodes, 2}, {time, 360}], - [{conf, init_all, cases(), finish_all}]}. +all() -> +[cases()]. + +groups() -> + [{mib_storage, [], + [{group, mib_storage_ets}, {group, mib_storage_dets}, + {group, mib_storage_mnesia}, + {group, mib_storage_size_check_ets}, + {group, mib_storage_size_check_dets}, + {group, mib_storage_size_check_mnesia}, + {group, mib_storage_varm_dets}, + {group, mib_storage_varm_mnesia}]}, + {mib_storage_ets, [], mib_storage_ets_cases()}, + {mib_storage_dets, [], mib_storage_dets_cases()}, + {mib_storage_mnesia, [], mib_storage_mnesia_cases()}, + {mib_storage_size_check_ets, [], + mse_size_check_cases()}, + {mib_storage_size_check_dets, [], + msd_size_check_cases()}, + {mib_storage_size_check_mnesia, [], + msm_size_check_cases()}, + {mib_storage_varm_dets, [], + varm_mib_storage_dets_cases()}, + {mib_storage_varm_mnesia, [], + varm_mib_storage_mnesia_cases()}, + {test_v1, [], v1_cases()}, {test_v2, [], v2_cases()}, + {test_v1_v2, [], v1_v2_cases()}, + {test_v3, [], v3_cases()}, + {test_multi_threaded, [], mt_cases()}, + {multiple_reqs, [], mul_cases()}, + {multiple_reqs_2, [], mul_cases_2()}, + {v2_inform, [], [v2_inform_i]}, + {v3_security, [], + [v3_crypto_basic, v3_md5_auth, v3_sha_auth, + v3_des_priv]}, + {standard_mibs, [], + [snmp_standard_mib, snmp_community_mib, + snmp_framework_mib, snmp_target_mib, + snmp_notification_mib, snmp_view_based_acm_mib]}, + {standard_mibs_2, [], + [snmpv2_mib_2, snmp_community_mib_2, + snmp_framework_mib_2, snmp_target_mib_2, + snmp_notification_mib_2, snmp_view_based_acm_mib_2]}, + {standard_mibs_3, [], + [snmpv2_mib_3, snmp_framework_mib_3, snmp_mpd_mib_3, + snmp_target_mib_3, snmp_notification_mib_3, + snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]}, + {reported_bugs, [], + [otp_1128, otp_1129, otp_1131, otp_1162, otp_1222, + otp_1298, otp_1331, otp_1338, otp_1342, otp_2776, + otp_2979, otp_3187, otp_3725]}, + {reported_bugs_2, [], + [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, + otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, + otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]}, + {reported_bugs_3, [], + [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, + otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, + otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, + otp_3542]}, + {tickets, [], [{group, otp_4394}]}, + {otp_4394, [], [otp_4394_test]}]. + +init_per_group(otp_4394, Config) -> + init_otp_4394(Config); +init_per_group(v2_inform, Config) -> + init_v2_inform(Config); +init_per_group(multiple_reqs_2, Config) -> + init_mul(Config); +init_per_group(multiple_reqs, Config) -> + init_mul(Config); +init_per_group(test_multi_threaded, Config) -> + init_mt(Config); +init_per_group(test_v3, Config) -> + init_v3(Config); +init_per_group(test_v1_v2, Config) -> + init_v1_v2(Config); +init_per_group(test_v2, Config) -> + init_v2(Config); +init_per_group(test_v1, Config) -> + init_v1(Config); +init_per_group(mib_storage_varm_mnesia, Config) -> + init_varm_mib_storage_mnesia(Config); +init_per_group(mib_storage_varm_dets, Config) -> + init_varm_mib_storage_dets(Config); +init_per_group(mib_storage_size_check_mnesia, Config) -> + init_size_check_msm(Config); +init_per_group(mib_storage_size_check_dets, Config) -> + init_size_check_msd(Config); +init_per_group(mib_storage_size_check_ets, Config) -> + init_size_check_mse(Config); +init_per_group(mib_storage_mnesia, Config) -> + init_mib_storage_mnesia(Config); +init_per_group(mib_storage_dets, Config) -> + init_mib_storage_dets(Config); +init_per_group(mib_storage_ets, Config) -> + init_mib_storage_ets(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(otp_4394, Config) -> + finish_otp_4394(Config); +end_per_group(v2_inform, Config) -> + finish_v2_inform(Config); +end_per_group(multiple_reqs_2, Config) -> + finish_mul(Config); +end_per_group(multiple_reqs, Config) -> + finish_mul(Config); +end_per_group(test_multi_threaded, Config) -> + finish_mt(Config); +end_per_group(test_v3, Config) -> + finish_v3(Config); +end_per_group(test_v1_v2, Config) -> + finish_v1_v2(Config); +end_per_group(test_v2, Config) -> + finish_v2(Config); +end_per_group(test_v1, Config) -> + finish_v1(Config); +end_per_group(mib_storage_varm_mnesia, Config) -> + finish_varm_mib_storage_mnesia(Config); +end_per_group(mib_storage_varm_dets, Config) -> + finish_varm_mib_storage_dets(Config); +end_per_group(mib_storage_size_check_mnesia, Config) -> + finish_size_check_msm(Config); +end_per_group(mib_storage_size_check_dets, Config) -> + finish_size_check_msd(Config); +end_per_group(mib_storage_size_check_ets, Config) -> + finish_size_check_mse(Config); +end_per_group(mib_storage_mnesia, Config) -> + finish_mib_storage_mnesia(Config); +end_per_group(mib_storage_dets, Config) -> + finish_mib_storage_dets(Config); +end_per_group(mib_storage_ets, Config) -> + finish_mib_storage_ets(Config); +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:minutes(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), Config. -cases() -> - case ?OSTYPE() of - vxworks -> - %% No crypto app, so skip v3 testcases - [ - app_info, - test_v1, test_v2, test_v1_v2, - test_multi_threaded, - mib_storage, - tickets]; - _Else -> - [ - app_info, - test_v1, test_v2, test_v1_v2, test_v3, - test_multi_threaded, - mib_storage, - tickets - ] - end. +cases() -> +case ?OSTYPE() of + vxworks -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_multi_threaded}, + {group, mib_storage}, {group, tickets}]; + _Else -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_v3}, + {group, test_multi_threaded}, {group, mib_storage}, + {group, tickets}] +end. %%%----------------------------------------------------------------- @@ -460,144 +586,56 @@ delete_mib_storage_mnesia_tables() -> %% <base>, and a second version <base>_2. There may be several %% versions as well, <base>_N. %%----------------------------------------------------------------- -mib_storage(suite) -> [ - mib_storage_ets, - mib_storage_dets, - mib_storage_mnesia, - mib_storage_size_check_ets, - mib_storage_size_check_dets, - mib_storage_size_check_mnesia, - mib_storage_varm_dets, - mib_storage_varm_mnesia - ]. - -mib_storage_ets(suite) -> {req, [], {conf, init_mib_storage_ets, - mib_storage_ets_cases(), - finish_mib_storage_ets}}. - -mib_storage_dets(suite) -> {req, [], {conf, init_mib_storage_dets, - mib_storage_dets_cases(), - finish_mib_storage_dets}}. - -mib_storage_mnesia(suite) -> {req, [], {conf, init_mib_storage_mnesia, - mib_storage_mnesia_cases(), - finish_mib_storage_mnesia}}. - -mib_storage_size_check_ets(suite) -> - {req, [], {conf, - init_size_check_mse, - mse_size_check_cases(), - finish_size_check_mse}}. - -mib_storage_size_check_dets(suite) -> - {req, [], {conf, - init_size_check_msd, - msd_size_check_cases(), - finish_size_check_msd}}. - -mib_storage_size_check_mnesia(suite) -> - {req, [], {conf, - init_size_check_msm, - msm_size_check_cases(), - finish_size_check_msm}}. - -mib_storage_varm_dets(suite) -> - {req, [], {conf, - init_varm_mib_storage_dets, - varm_mib_storage_dets_cases(), - finish_varm_mib_storage_dets}}. - -mib_storage_varm_mnesia(suite) -> - {req, [], {conf, - init_varm_mib_storage_mnesia, - varm_mib_storage_mnesia_cases(), - finish_varm_mib_storage_mnesia}}. - -mib_storage_ets_cases() -> - [ - mse_simple, - mse_v1_processing, - mse_big, - mse_big2, - mse_loop_mib, - mse_api, - mse_sa_register, - mse_v1_trap, - mse_sa_error, - mse_next_across_sa, - mse_undo, - mse_standard_mib, - mse_community_mib, - mse_framework_mib, - mse_target_mib, - mse_notification_mib, - mse_view_based_acm_mib, - mse_sparse_table, - mse_me_of, - mse_mib_of]. - -mib_storage_dets_cases() -> - [ - msd_simple, - msd_v1_processing, - msd_big, - msd_big2, - msd_loop_mib, - msd_api, - msd_sa_register, - msd_v1_trap, - msd_sa_error, - msd_next_across_sa, - msd_undo, - msd_standard_mib, - msd_community_mib, - msd_framework_mib, - msd_target_mib, - msd_notification_mib, - msd_view_based_acm_mib, - msd_sparse_table, - msd_me_of, - msd_mib_of - ]. - -mib_storage_mnesia_cases() -> - [ - msm_simple, - msm_v1_processing, - msm_big, - msm_big2, - msm_loop_mib, - msm_api, - msm_sa_register, - msm_v1_trap, - msm_sa_error, - msm_next_across_sa, - msm_undo, - msm_standard_mib, - msm_community_mib, - msm_framework_mib, - msm_target_mib, - msm_notification_mib, - msm_view_based_acm_mib, - msm_sparse_table, - msm_me_of, - msm_mib_of - ]. - -mse_size_check_cases() -> - [mse_size_check]. - -msd_size_check_cases() -> - [msd_size_check]. - -msm_size_check_cases() -> - [msm_size_check]. - -varm_mib_storage_dets_cases() -> - [msd_varm_mib_start]. - -varm_mib_storage_mnesia_cases() -> - [msm_varm_mib_start]. + + + + + + + + + +mib_storage_ets_cases() -> +[mse_simple, mse_v1_processing, mse_big, mse_big2, + mse_loop_mib, mse_api, mse_sa_register, mse_v1_trap, + mse_sa_error, mse_next_across_sa, mse_undo, + mse_standard_mib, mse_community_mib, mse_framework_mib, + mse_target_mib, mse_notification_mib, + mse_view_based_acm_mib, mse_sparse_table, mse_me_of, + mse_mib_of]. + +mib_storage_dets_cases() -> +[msd_simple, msd_v1_processing, msd_big, msd_big2, + msd_loop_mib, msd_api, msd_sa_register, msd_v1_trap, + msd_sa_error, msd_next_across_sa, msd_undo, + msd_standard_mib, msd_community_mib, msd_framework_mib, + msd_target_mib, msd_notification_mib, + msd_view_based_acm_mib, msd_sparse_table, msd_me_of, + msd_mib_of]. + +mib_storage_mnesia_cases() -> +[msm_simple, msm_v1_processing, msm_big, msm_big2, + msm_loop_mib, msm_api, msm_sa_register, msm_v1_trap, + msm_sa_error, msm_next_across_sa, msm_undo, + msm_standard_mib, msm_community_mib, msm_framework_mib, + msm_target_mib, msm_notification_mib, + msm_view_based_acm_mib, msm_sparse_table, msm_me_of, + msm_mib_of]. + +mse_size_check_cases() -> +[mse_size_check]. + +msd_size_check_cases() -> +[msd_size_check]. + +msm_size_check_cases() -> +[msm_size_check]. + +varm_mib_storage_dets_cases() -> +[msd_varm_mib_start]. + +varm_mib_storage_mnesia_cases() -> +[msm_varm_mib_start]. init_mib_storage_ets(Config) when list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), @@ -1099,20 +1137,14 @@ app_dir(App) -> end. -test_v1(suite) -> {req, [], {conf, init_v1, v1_cases(), finish_v1}}. %v1_cases() -> [loop_mib]; -v1_cases() -> - [simple, - db_notify_client, - v1_processing, big, big2, loop_mib, - api, subagent, mnesia, multiple_reqs, - sa_register, v1_trap, sa_error, next_across_sa, undo, reported_bugs, - standard_mibs, sparse_table, cnt_64, - opaque, - % opaque]. - - change_target_addr_config]. +v1_cases() -> +[simple, db_notify_client, v1_processing, big, big2, + loop_mib, api, subagent, mnesia, {group, multiple_reqs}, + sa_register, v1_trap, sa_error, next_across_sa, undo, + {group, reported_bugs}, {group, standard_mibs}, + sparse_table, cnt_64, opaque, change_target_addr_config]. init_v1(Config) when list(Config) -> ?line SaNode = ?config(snmp_sa, Config), @@ -1129,15 +1161,15 @@ finish_v1(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v2(suite) -> {req, [], {conf, init_v2, v2_cases(), finish_v2}}. %v2_cases() -> [loop_mib_2]; -v2_cases() -> - [simple_2, v2_processing, big_2, big2_2, loop_mib_2, - api_2, subagent_2, mnesia_2, - multiple_reqs_2, sa_register_2, v2_trap, v2_inform, sa_error_2, - next_across_sa_2, undo_2, reported_bugs_2, standard_mibs_2, - v2_types, implied, sparse_table_2, cnt_64_2, opaque_2, v2_caps]. +v2_cases() -> +[simple_2, v2_processing, big_2, big2_2, loop_mib_2, + api_2, subagent_2, mnesia_2, {group, multiple_reqs_2}, + sa_register_2, v2_trap, {group, v2_inform}, sa_error_2, + next_across_sa_2, undo_2, {group, reported_bugs_2}, + {group, standard_mibs_2}, v2_types, implied, + sparse_table_2, cnt_64_2, opaque_2, v2_caps]. init_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1154,10 +1186,9 @@ finish_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v1_v2(suite) -> {req, [], {conf, init_v1_v2, v1_v2_cases(), finish_v1_v2}}. -v1_v2_cases() -> - [simple_bi]. +v1_v2_cases() -> +[simple_bi]. init_v1_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1174,16 +1205,16 @@ finish_v1_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v3(suite) -> {req, [], {conf, init_v3, v3_cases(), finish_v3}}. %v3_cases() -> [loop_mib_3]; -v3_cases() -> - [simple_3, v3_processing, - big_3, big2_3, api_3, subagent_3, mnesia_3, loop_mib_3, - multiple_reqs_3, sa_register_3, v3_trap, v3_inform, sa_error_3, - next_across_sa_3, undo_3, reported_bugs_3, standard_mibs_3, - v3_security, - v2_types_3, implied_3, sparse_table_3, cnt_64_3, opaque_3, v2_caps_3]. +v3_cases() -> +[simple_3, v3_processing, big_3, big2_3, api_3, + subagent_3, mnesia_3, loop_mib_3, multiple_reqs_3, + sa_register_3, v3_trap, v3_inform, sa_error_3, + next_across_sa_3, undo_3, {group, reported_bugs_3}, + {group, standard_mibs_3}, {group, v3_security}, + v2_types_3, implied_3, sparse_table_3, cnt_64_3, + opaque_3, v2_caps_3]. init_v3(Config) when list(Config) -> %% Make sure crypto works, otherwise start_agent will fail @@ -1221,10 +1252,9 @@ finish_v3(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_multi_threaded(suite) -> {req, [], {conf, init_mt, mt_cases(), finish_mt}}. -mt_cases() -> - [multi_threaded, mt_trap]. +mt_cases() -> +[multi_threaded, mt_trap]. init_mt(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1739,21 +1769,19 @@ mnesia_2(X) -> mnesia(X). mnesia_3(X) -> mnesia(X). -multiple_reqs(suite) -> - {req, [], {conf, init_mul, mul_cases(), finish_mul}}. -mul_cases() -> - [mul_get, mul_get_err, mul_next, mul_next_err, mul_set_err]. +mul_cases() -> +[mul_get, mul_get_err, mul_next, mul_next_err, + mul_set_err]. -multiple_reqs_2(suite) -> - {req, [], {conf, init_mul, mul_cases_2(), finish_mul}}. multiple_reqs_3(_X) -> {req, [], {conf, init_mul, mul_cases_3(), finish_mul}}. -mul_cases_2() -> - [mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, mul_set_err_2]. +mul_cases_2() -> +[mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, + mul_set_err_2]. mul_cases_3() -> @@ -1939,8 +1967,6 @@ v2_trap(Config) when list(Config) -> v3_trap(X) -> v2_trap(X). -v2_inform(suite) -> - {req, [], {conf, init_v2_inform, [v2_inform_i], finish_v2_inform}}. v3_inform(_X) -> %% v2_inform(X). @@ -2112,7 +2138,6 @@ v3_processing(Config) when list(Config) -> %% accomplished by the first inform sent. That one will generate a %% report, which makes it in sync. The notification-generating %% application times out, and send again. This time it'll work. -v3_security(suite) -> [v3_crypto_basic, v3_md5_auth, v3_sha_auth, v3_des_priv]. v3_crypto_basic(suite) -> []; v3_crypto_basic(_Config) -> @@ -3591,22 +3616,8 @@ bad_return() -> %%% Note that many of the functions in the standard mib is %%% already tested by the normal tests. %%%----------------------------------------------------------------- -standard_mibs(suite) -> - [snmp_standard_mib, snmp_community_mib, - snmp_framework_mib, - snmp_target_mib, snmp_notification_mib, - snmp_view_based_acm_mib]. - -standard_mibs_2(suite) -> - [snmpv2_mib_2, snmp_community_mib_2, - snmp_framework_mib_2, - snmp_target_mib_2, snmp_notification_mib_2, - snmp_view_based_acm_mib_2]. - -standard_mibs_3(suite) -> - [snmpv2_mib_3,snmp_framework_mib_3, snmp_mpd_mib_3, - snmp_target_mib_3, snmp_notification_mib_3, - snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]. + + %%----------------------------------------------------------------- %% For this test, the agent is configured for v1. @@ -4527,27 +4538,12 @@ loop_it_2(Oid, N) -> %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- -reported_bugs(suite) -> - [otp_1128, otp_1129, otp_1131, otp_1162, - otp_1222, otp_1298, otp_1331, otp_1338, - otp_1342, otp_2776, otp_2979, otp_3187, otp_3725]. -reported_bugs_2(suite) -> - [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, - otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, - otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]. -reported_bugs_3(suite) -> - [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, - otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, - otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, - otp_3542]. %% These are (ticket) test cases where the initiation has to be done %% individually. -tickets(suite) -> - [otp_4394]. %%----------------------------------------------------------------- %% Ticket: OTP-1128 @@ -4971,10 +4967,6 @@ otp_3725_test(MaNode) -> %%----------------------------------------------------------------- -otp_4394(suite) -> {req, [], {conf, - init_otp_4394, - [otp_4394_test], - finish_otp_4394}}. init_otp_4394(Config) when list(Config) -> ?DBG("init_otp_4394 -> entry with" diff --git a/lib/snmp/test/snmp_agent_mt_test.erl b/lib/snmp/test/snmp_agent_mt_test.erl index 8d5a57f58d..4f125c0017 100644 --- a/lib/snmp/test/snmp_agent_mt_test.erl +++ b/lib/snmp/test/snmp_agent_mt_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -28,7 +28,7 @@ -define(application, snmp). -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -83,39 +83,165 @@ _ -> V3 end). -all(suite) -> {req, - [mnesia, distribution, - {local_slave_nodes, 2}, {time, 360}], - [{conf, init_all, cases(), finish_all}]}. +all() -> +[cases()]. + +groups() -> + [{mib_storage, [], + [{group, mib_storage_ets}, {group, mib_storage_dets}, + {group, mib_storage_mnesia}, + {group, mib_storage_size_check_ets}, + {group, mib_storage_size_check_dets}, + {group, mib_storage_size_check_mnesia}, + {group, mib_storage_varm_dets}, + {group, mib_storage_varm_mnesia}]}, + {mib_storage_ets, [], mib_storage_ets_cases()}, + {mib_storage_dets, [], mib_storage_dets_cases()}, + {mib_storage_mnesia, [], mib_storage_mnesia_cases()}, + {mib_storage_size_check_ets, [], + mse_size_check_cases()}, + {mib_storage_size_check_dets, [], + msd_size_check_cases()}, + {mib_storage_size_check_mnesia, [], + msm_size_check_cases()}, + {mib_storage_varm_dets, [], + varm_mib_storage_dets_cases()}, + {mib_storage_varm_mnesia, [], + varm_mib_storage_mnesia_cases()}, + {test_v1, [], v1_cases()}, {test_v2, [], v2_cases()}, + {test_v1_v2, [], v1_v2_cases()}, + {test_v3, [], v3_cases()}, + {test_multi_threaded, [], mt_cases()}, + {multiple_reqs, [], mul_cases()}, + {multiple_reqs_2, [], mul_cases_2()}, + {v2_inform, [], [v2_inform_i]}, + {v3_security, [], + [v3_crypto_basic, v3_md5_auth, v3_sha_auth, + v3_des_priv]}, + {standard_mibs, [], + [snmp_standard_mib, snmp_community_mib, + snmp_framework_mib, snmp_target_mib, + snmp_notification_mib, snmp_view_based_acm_mib]}, + {standard_mibs_2, [], + [snmpv2_mib_2, snmp_community_mib_2, + snmp_framework_mib_2, snmp_target_mib_2, + snmp_notification_mib_2, snmp_view_based_acm_mib_2]}, + {standard_mibs_3, [], + [snmpv2_mib_3, snmp_framework_mib_3, snmp_mpd_mib_3, + snmp_target_mib_3, snmp_notification_mib_3, + snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]}, + {reported_bugs, [], + [otp_1128, otp_1129, otp_1131, otp_1162, otp_1222, + otp_1298, otp_1331, otp_1338, otp_1342, otp_2776, + otp_2979, otp_3187, otp_3725]}, + {reported_bugs_2, [], + [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, + otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, + otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]}, + {reported_bugs_3, [], + [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, + otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, + otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, + otp_3542]}, + {tickets, [], [{group, otp_4394}]}, + {otp_4394, [], [otp_4394_test]}]. + +init_per_group(otp_4394, Config) -> + init_otp_4394(Config); +init_per_group(v2_inform, Config) -> + init_v2_inform(Config); +init_per_group(multiple_reqs_2, Config) -> + init_mul(Config); +init_per_group(multiple_reqs, Config) -> + init_mul(Config); +init_per_group(test_multi_threaded, Config) -> + init_mt(Config); +init_per_group(test_v3, Config) -> + init_v3(Config); +init_per_group(test_v1_v2, Config) -> + init_v1_v2(Config); +init_per_group(test_v2, Config) -> + init_v2(Config); +init_per_group(test_v1, Config) -> + init_v1(Config); +init_per_group(mib_storage_varm_mnesia, Config) -> + init_varm_mib_storage_mnesia(Config); +init_per_group(mib_storage_varm_dets, Config) -> + init_varm_mib_storage_dets(Config); +init_per_group(mib_storage_size_check_mnesia, Config) -> + init_size_check_msm(Config); +init_per_group(mib_storage_size_check_dets, Config) -> + init_size_check_msd(Config); +init_per_group(mib_storage_size_check_ets, Config) -> + init_size_check_mse(Config); +init_per_group(mib_storage_mnesia, Config) -> + init_mib_storage_mnesia(Config); +init_per_group(mib_storage_dets, Config) -> + init_mib_storage_dets(Config); +init_per_group(mib_storage_ets, Config) -> + init_mib_storage_ets(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(otp_4394, Config) -> + finish_otp_4394(Config); +end_per_group(v2_inform, Config) -> + finish_v2_inform(Config); +end_per_group(multiple_reqs_2, Config) -> + finish_mul(Config); +end_per_group(multiple_reqs, Config) -> + finish_mul(Config); +end_per_group(test_multi_threaded, Config) -> + finish_mt(Config); +end_per_group(test_v3, Config) -> + finish_v3(Config); +end_per_group(test_v1_v2, Config) -> + finish_v1_v2(Config); +end_per_group(test_v2, Config) -> + finish_v2(Config); +end_per_group(test_v1, Config) -> + finish_v1(Config); +end_per_group(mib_storage_varm_mnesia, Config) -> + finish_varm_mib_storage_mnesia(Config); +end_per_group(mib_storage_varm_dets, Config) -> + finish_varm_mib_storage_dets(Config); +end_per_group(mib_storage_size_check_mnesia, Config) -> + finish_size_check_msm(Config); +end_per_group(mib_storage_size_check_dets, Config) -> + finish_size_check_msd(Config); +end_per_group(mib_storage_size_check_ets, Config) -> + finish_size_check_mse(Config); +end_per_group(mib_storage_mnesia, Config) -> + finish_mib_storage_mnesia(Config); +end_per_group(mib_storage_dets, Config) -> + finish_mib_storage_dets(Config); +end_per_group(mib_storage_ets, Config) -> + finish_mib_storage_ets(Config); +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:minutes(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), Config. -cases() -> - case ?OSTYPE() of - vxworks -> - %% No crypto app, so skip v3 testcases - [ - app_info, - test_v1, test_v2, test_v1_v2, - test_multi_threaded, - mib_storage, - tickets]; - _Else -> - [ - app_info, - test_v1, test_v2, test_v1_v2, test_v3, - test_multi_threaded, - mib_storage, - tickets - ] - end. +cases() -> +case ?OSTYPE() of + vxworks -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_multi_threaded}, + {group, mib_storage}, {group, tickets}]; + _Else -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_v3}, + {group, test_multi_threaded}, {group, mib_storage}, + {group, tickets}] +end. %%%----------------------------------------------------------------- @@ -460,144 +586,56 @@ delete_mib_storage_mnesia_tables() -> %% <base>, and a second version <base>_2. There may be several %% versions as well, <base>_N. %%----------------------------------------------------------------- -mib_storage(suite) -> [ - mib_storage_ets, - mib_storage_dets, - mib_storage_mnesia, - mib_storage_size_check_ets, - mib_storage_size_check_dets, - mib_storage_size_check_mnesia, - mib_storage_varm_dets, - mib_storage_varm_mnesia - ]. - -mib_storage_ets(suite) -> {req, [], {conf, init_mib_storage_ets, - mib_storage_ets_cases(), - finish_mib_storage_ets}}. - -mib_storage_dets(suite) -> {req, [], {conf, init_mib_storage_dets, - mib_storage_dets_cases(), - finish_mib_storage_dets}}. - -mib_storage_mnesia(suite) -> {req, [], {conf, init_mib_storage_mnesia, - mib_storage_mnesia_cases(), - finish_mib_storage_mnesia}}. - -mib_storage_size_check_ets(suite) -> - {req, [], {conf, - init_size_check_mse, - mse_size_check_cases(), - finish_size_check_mse}}. - -mib_storage_size_check_dets(suite) -> - {req, [], {conf, - init_size_check_msd, - msd_size_check_cases(), - finish_size_check_msd}}. - -mib_storage_size_check_mnesia(suite) -> - {req, [], {conf, - init_size_check_msm, - msm_size_check_cases(), - finish_size_check_msm}}. - -mib_storage_varm_dets(suite) -> - {req, [], {conf, - init_varm_mib_storage_dets, - varm_mib_storage_dets_cases(), - finish_varm_mib_storage_dets}}. - -mib_storage_varm_mnesia(suite) -> - {req, [], {conf, - init_varm_mib_storage_mnesia, - varm_mib_storage_mnesia_cases(), - finish_varm_mib_storage_mnesia}}. - -mib_storage_ets_cases() -> - [ - mse_simple, - mse_v1_processing, - mse_big, - mse_big2, - mse_loop_mib, - mse_api, - mse_sa_register, - mse_v1_trap, - mse_sa_error, - mse_next_across_sa, - mse_undo, - mse_standard_mib, - mse_community_mib, - mse_framework_mib, - mse_target_mib, - mse_notification_mib, - mse_view_based_acm_mib, - mse_sparse_table, - mse_me_of, - mse_mib_of]. - -mib_storage_dets_cases() -> - [ - msd_simple, - msd_v1_processing, - msd_big, - msd_big2, - msd_loop_mib, - msd_api, - msd_sa_register, - msd_v1_trap, - msd_sa_error, - msd_next_across_sa, - msd_undo, - msd_standard_mib, - msd_community_mib, - msd_framework_mib, - msd_target_mib, - msd_notification_mib, - msd_view_based_acm_mib, - msd_sparse_table, - msd_me_of, - msd_mib_of - ]. - -mib_storage_mnesia_cases() -> - [ - msm_simple, - msm_v1_processing, - msm_big, - msm_big2, - msm_loop_mib, - msm_api, - msm_sa_register, - msm_v1_trap, - msm_sa_error, - msm_next_across_sa, - msm_undo, - msm_standard_mib, - msm_community_mib, - msm_framework_mib, - msm_target_mib, - msm_notification_mib, - msm_view_based_acm_mib, - msm_sparse_table, - msm_me_of, - msm_mib_of - ]. - -mse_size_check_cases() -> - [mse_size_check]. - -msd_size_check_cases() -> - [msd_size_check]. - -msm_size_check_cases() -> - [msm_size_check]. - -varm_mib_storage_dets_cases() -> - [msd_varm_mib_start]. - -varm_mib_storage_mnesia_cases() -> - [msm_varm_mib_start]. + + + + + + + + + +mib_storage_ets_cases() -> +[mse_simple, mse_v1_processing, mse_big, mse_big2, + mse_loop_mib, mse_api, mse_sa_register, mse_v1_trap, + mse_sa_error, mse_next_across_sa, mse_undo, + mse_standard_mib, mse_community_mib, mse_framework_mib, + mse_target_mib, mse_notification_mib, + mse_view_based_acm_mib, mse_sparse_table, mse_me_of, + mse_mib_of]. + +mib_storage_dets_cases() -> +[msd_simple, msd_v1_processing, msd_big, msd_big2, + msd_loop_mib, msd_api, msd_sa_register, msd_v1_trap, + msd_sa_error, msd_next_across_sa, msd_undo, + msd_standard_mib, msd_community_mib, msd_framework_mib, + msd_target_mib, msd_notification_mib, + msd_view_based_acm_mib, msd_sparse_table, msd_me_of, + msd_mib_of]. + +mib_storage_mnesia_cases() -> +[msm_simple, msm_v1_processing, msm_big, msm_big2, + msm_loop_mib, msm_api, msm_sa_register, msm_v1_trap, + msm_sa_error, msm_next_across_sa, msm_undo, + msm_standard_mib, msm_community_mib, msm_framework_mib, + msm_target_mib, msm_notification_mib, + msm_view_based_acm_mib, msm_sparse_table, msm_me_of, + msm_mib_of]. + +mse_size_check_cases() -> +[mse_size_check]. + +msd_size_check_cases() -> +[msd_size_check]. + +msm_size_check_cases() -> +[msm_size_check]. + +varm_mib_storage_dets_cases() -> +[msd_varm_mib_start]. + +varm_mib_storage_mnesia_cases() -> +[msm_varm_mib_start]. init_mib_storage_ets(Config) when list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), @@ -1099,20 +1137,14 @@ app_dir(App) -> end. -test_v1(suite) -> {req, [], {conf, init_v1, v1_cases(), finish_v1}}. %v1_cases() -> [loop_mib]; -v1_cases() -> - [simple, - db_notify_client, - v1_processing, big, big2, loop_mib, - api, subagent, mnesia, multiple_reqs, - sa_register, v1_trap, sa_error, next_across_sa, undo, reported_bugs, - standard_mibs, sparse_table, cnt_64, - opaque, - % opaque]. - - change_target_addr_config]. +v1_cases() -> +[simple, db_notify_client, v1_processing, big, big2, + loop_mib, api, subagent, mnesia, {group, multiple_reqs}, + sa_register, v1_trap, sa_error, next_across_sa, undo, + {group, reported_bugs}, {group, standard_mibs}, + sparse_table, cnt_64, opaque, change_target_addr_config]. init_v1(Config) when list(Config) -> ?line SaNode = ?config(snmp_sa, Config), @@ -1129,15 +1161,15 @@ finish_v1(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v2(suite) -> {req, [], {conf, init_v2, v2_cases(), finish_v2}}. %v2_cases() -> [loop_mib_2]; -v2_cases() -> - [simple_2, v2_processing, big_2, big2_2, loop_mib_2, - api_2, subagent_2, mnesia_2, - multiple_reqs_2, sa_register_2, v2_trap, v2_inform, sa_error_2, - next_across_sa_2, undo_2, reported_bugs_2, standard_mibs_2, - v2_types, implied, sparse_table_2, cnt_64_2, opaque_2, v2_caps]. +v2_cases() -> +[simple_2, v2_processing, big_2, big2_2, loop_mib_2, + api_2, subagent_2, mnesia_2, {group, multiple_reqs_2}, + sa_register_2, v2_trap, {group, v2_inform}, sa_error_2, + next_across_sa_2, undo_2, {group, reported_bugs_2}, + {group, standard_mibs_2}, v2_types, implied, + sparse_table_2, cnt_64_2, opaque_2, v2_caps]. init_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1154,10 +1186,9 @@ finish_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v1_v2(suite) -> {req, [], {conf, init_v1_v2, v1_v2_cases(), finish_v1_v2}}. -v1_v2_cases() -> - [simple_bi]. +v1_v2_cases() -> +[simple_bi]. init_v1_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1174,16 +1205,16 @@ finish_v1_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v3(suite) -> {req, [], {conf, init_v3, v3_cases(), finish_v3}}. %v3_cases() -> [loop_mib_3]; -v3_cases() -> - [simple_3, v3_processing, - big_3, big2_3, api_3, subagent_3, mnesia_3, loop_mib_3, - multiple_reqs_3, sa_register_3, v3_trap, v3_inform, sa_error_3, - next_across_sa_3, undo_3, reported_bugs_3, standard_mibs_3, - v3_security, - v2_types_3, implied_3, sparse_table_3, cnt_64_3, opaque_3, v2_caps_3]. +v3_cases() -> +[simple_3, v3_processing, big_3, big2_3, api_3, + subagent_3, mnesia_3, loop_mib_3, multiple_reqs_3, + sa_register_3, v3_trap, v3_inform, sa_error_3, + next_across_sa_3, undo_3, {group, reported_bugs_3}, + {group, standard_mibs_3}, {group, v3_security}, + v2_types_3, implied_3, sparse_table_3, cnt_64_3, + opaque_3, v2_caps_3]. init_v3(Config) when list(Config) -> %% Make sure crypto works, otherwise start_agent will fail @@ -1221,10 +1252,9 @@ finish_v3(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_multi_threaded(suite) -> {req, [], {conf, init_mt, mt_cases(), finish_mt}}. -mt_cases() -> - [multi_threaded, mt_trap]. +mt_cases() -> +[multi_threaded, mt_trap]. init_mt(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1739,21 +1769,19 @@ mnesia_2(X) -> mnesia(X). mnesia_3(X) -> mnesia(X). -multiple_reqs(suite) -> - {req, [], {conf, init_mul, mul_cases(), finish_mul}}. -mul_cases() -> - [mul_get, mul_get_err, mul_next, mul_next_err, mul_set_err]. +mul_cases() -> +[mul_get, mul_get_err, mul_next, mul_next_err, + mul_set_err]. -multiple_reqs_2(suite) -> - {req, [], {conf, init_mul, mul_cases_2(), finish_mul}}. multiple_reqs_3(_X) -> {req, [], {conf, init_mul, mul_cases_3(), finish_mul}}. -mul_cases_2() -> - [mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, mul_set_err_2]. +mul_cases_2() -> +[mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, + mul_set_err_2]. mul_cases_3() -> @@ -1939,8 +1967,6 @@ v2_trap(Config) when list(Config) -> v3_trap(X) -> v2_trap(X). -v2_inform(suite) -> - {req, [], {conf, init_v2_inform, [v2_inform_i], finish_v2_inform}}. v3_inform(_X) -> %% v2_inform(X). @@ -2112,7 +2138,6 @@ v3_processing(Config) when list(Config) -> %% accomplished by the first inform sent. That one will generate a %% report, which makes it in sync. The notification-generating %% application times out, and send again. This time it'll work. -v3_security(suite) -> [v3_crypto_basic, v3_md5_auth, v3_sha_auth, v3_des_priv]. v3_crypto_basic(suite) -> []; v3_crypto_basic(_Config) -> @@ -3591,22 +3616,8 @@ bad_return() -> %%% Note that many of the functions in the standard mib is %%% already tested by the normal tests. %%%----------------------------------------------------------------- -standard_mibs(suite) -> - [snmp_standard_mib, snmp_community_mib, - snmp_framework_mib, - snmp_target_mib, snmp_notification_mib, - snmp_view_based_acm_mib]. - -standard_mibs_2(suite) -> - [snmpv2_mib_2, snmp_community_mib_2, - snmp_framework_mib_2, - snmp_target_mib_2, snmp_notification_mib_2, - snmp_view_based_acm_mib_2]. - -standard_mibs_3(suite) -> - [snmpv2_mib_3,snmp_framework_mib_3, snmp_mpd_mib_3, - snmp_target_mib_3, snmp_notification_mib_3, - snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]. + + %%----------------------------------------------------------------- %% For this test, the agent is configured for v1. @@ -4527,27 +4538,12 @@ loop_it_2(Oid, N) -> %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- -reported_bugs(suite) -> - [otp_1128, otp_1129, otp_1131, otp_1162, - otp_1222, otp_1298, otp_1331, otp_1338, - otp_1342, otp_2776, otp_2979, otp_3187, otp_3725]. -reported_bugs_2(suite) -> - [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, - otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, - otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]. -reported_bugs_3(suite) -> - [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, - otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, - otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, - otp_3542]. %% These are (ticket) test cases where the initiation has to be done %% individually. -tickets(suite) -> - [otp_4394]. %%----------------------------------------------------------------- %% Ticket: OTP-1128 @@ -4971,10 +4967,6 @@ otp_3725_test(MaNode) -> %%----------------------------------------------------------------- -otp_4394(suite) -> {req, [], {conf, - init_otp_4394, - [otp_4394_test], - finish_otp_4394}}. init_otp_4394(Config) when list(Config) -> ?DBG("init_otp_4394 -> entry with" diff --git a/lib/snmp/test/snmp_agent_nfilter_test.erl b/lib/snmp/test/snmp_agent_nfilter_test.erl index 269c7c96c9..f08060cee3 100644 --- a/lib/snmp/test/snmp_agent_nfilter_test.erl +++ b/lib/snmp/test/snmp_agent_nfilter_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% 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 @@ -25,7 +25,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). @@ -33,8 +33,8 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2 + all/0, + init_per_testcase/2, end_per_testcase/2 ]). %%---------------------------------------------------------------------- @@ -58,14 +58,14 @@ init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. %%====================================================================== %% Test case definitions %%====================================================================== -all(_) -> - ?SKIP(not_yet_implemented). +all() -> + {skip,not_yet_implemented}. %%====================================================================== diff --git a/lib/snmp/test/snmp_agent_test.erl b/lib/snmp/test/snmp_agent_test.erl index 9d2e9969c4..692d29fda0 100644 --- a/lib/snmp/test/snmp_agent_test.erl +++ b/lib/snmp/test/snmp_agent_test.erl @@ -28,7 +28,7 @@ -define(application, snmp). -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -85,18 +85,171 @@ end). -all(suite) -> - Reqs = [mnesia, distribution, {local_slave_nodes, 2}, {time, 360}], - Conf1 = [{conf, init_all, cases(), finish_all}], - Conf2 = [tickets2], - {req, Reqs, Conf1 ++ Conf2}. +all() -> + Reqs = [mnesia, distribution, {local_slave_nodes, 2}, + {time, 360}], + Conf1 = [{group, all_tcs}], + Conf2 = [{group, tickets2}], + Conf1 ++ Conf2. + +groups() -> + [{all_tcs, [], cases()}, + {mib_storage, [], + [{group, mib_storage_ets}, {group, mib_storage_dets}, + {group, mib_storage_mnesia}, + {group, mib_storage_size_check_ets}, + {group, mib_storage_size_check_dets}, + {group, mib_storage_size_check_mnesia}, + {group, mib_storage_varm_dets}, + {group, mib_storage_varm_mnesia}]}, + {mib_storage_ets, [], mib_storage_ets_cases()}, + {mib_storage_dets, [], mib_storage_dets_cases()}, + {mib_storage_mnesia, [], mib_storage_mnesia_cases()}, + {mib_storage_size_check_ets, [], + mse_size_check_cases()}, + {mib_storage_size_check_dets, [], + msd_size_check_cases()}, + {mib_storage_size_check_mnesia, [], + msm_size_check_cases()}, + {mib_storage_varm_dets, [], + varm_mib_storage_dets_cases()}, + {mib_storage_varm_mnesia, [], + varm_mib_storage_mnesia_cases()}, + {misc, [], misc_cases()}, {test_v1, [], v1_cases()}, + {test_v2, [], v2_cases()}, + {test_v1_v2, [], v1_v2_cases()}, + {test_v3, [], v3_cases()}, + {test_multi_threaded, [], mt_cases()}, + {multiple_reqs, [], mul_cases()}, + {multiple_reqs_2, [], mul_cases_2()}, + {v2_inform, [], [v2_inform_i]}, + {v3_security, [], + [v3_crypto_basic, v3_md5_auth, v3_sha_auth, + v3_des_priv]}, + {standard_mibs, [], + [snmp_standard_mib, snmp_community_mib, + snmp_framework_mib, snmp_target_mib, + snmp_notification_mib, snmp_view_based_acm_mib]}, + {standard_mibs_2, [], + [snmpv2_mib_2, snmp_community_mib_2, + snmp_framework_mib_2, snmp_target_mib_2, + snmp_notification_mib_2, snmp_view_based_acm_mib_2]}, + {standard_mibs_3, [], + [snmpv2_mib_3, snmp_framework_mib_3, snmp_mpd_mib_3, + snmp_target_mib_3, snmp_notification_mib_3, + snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]}, + {reported_bugs, [], + [otp_1128, otp_1129, otp_1131, otp_1162, otp_1222, + otp_1298, otp_1331, otp_1338, otp_1342, otp_2776, + otp_2979, otp_3187, otp_3725]}, + {reported_bugs_2, [], + [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, + otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, + otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]}, + {reported_bugs_3, [], + [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, + otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, + otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, + otp_3542]}, + {tickets1, [], [{group, otp_4394}, {group, otp_7157}]}, + {tickets2, [], [otp8395]}, + {otp_4394, [], [otp_4394_test]}, + {otp_7157, [], + begin Reqs = [], Conf = [otp_7157_test], Conf end}]. + +init_per_group(all_tcs, Config) -> + init_all(Config); +init_per_group(otp_7157, Config) -> + init_otp_7157(Config); +init_per_group(otp_4394, Config) -> + init_otp_4394(Config); +init_per_group(v2_inform, Config) -> + init_v2_inform(Config); +init_per_group(multiple_reqs_2, Config) -> + init_mul(Config); +init_per_group(multiple_reqs, Config) -> + init_mul(Config); +init_per_group(test_multi_threaded, Config) -> + init_mt(Config); +init_per_group(test_v3, Config) -> + init_v3(Config); +init_per_group(test_v1_v2, Config) -> + init_v1_v2(Config); +init_per_group(test_v2, Config) -> + init_v2(Config); +init_per_group(test_v1, Config) -> + init_v1(Config); +init_per_group(misc, Config) -> + init_misc(Config); +init_per_group(mib_storage_varm_mnesia, Config) -> + init_varm_mib_storage_mnesia(Config); +init_per_group(mib_storage_varm_dets, Config) -> + init_varm_mib_storage_dets(Config); +init_per_group(mib_storage_size_check_mnesia, Config) -> + init_size_check_msm(Config); +init_per_group(mib_storage_size_check_dets, Config) -> + init_size_check_msd(Config); +init_per_group(mib_storage_size_check_ets, Config) -> + init_size_check_mse(Config); +init_per_group(mib_storage_mnesia, Config) -> + init_mib_storage_mnesia(Config); +init_per_group(mib_storage_dets, Config) -> + init_mib_storage_dets(Config); +init_per_group(mib_storage_ets, Config) -> + init_mib_storage_ets(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(all_tcs, Config) -> + finish_all(Config); +end_per_group(otp_7157, Config) -> + finish_otp_7157(Config); +end_per_group(otp_4394, Config) -> + finish_otp_4394(Config); +end_per_group(v2_inform, Config) -> + finish_v2_inform(Config); +end_per_group(multiple_reqs_2, Config) -> + finish_mul(Config); +end_per_group(multiple_reqs, Config) -> + finish_mul(Config); +end_per_group(test_multi_threaded, Config) -> + finish_mt(Config); +end_per_group(test_v3, Config) -> + finish_v3(Config); +end_per_group(test_v1_v2, Config) -> + finish_v1_v2(Config); +end_per_group(test_v2, Config) -> + finish_v2(Config); +end_per_group(test_v1, Config) -> + finish_v1(Config); +end_per_group(misc, Config) -> + finish_misc(Config); +end_per_group(mib_storage_varm_mnesia, Config) -> + finish_varm_mib_storage_mnesia(Config); +end_per_group(mib_storage_varm_dets, Config) -> + finish_varm_mib_storage_dets(Config); +end_per_group(mib_storage_size_check_mnesia, Config) -> + finish_size_check_msm(Config); +end_per_group(mib_storage_size_check_dets, Config) -> + finish_size_check_msd(Config); +end_per_group(mib_storage_size_check_ets, Config) -> + finish_size_check_mse(Config); +end_per_group(mib_storage_mnesia, Config) -> + finish_mib_storage_mnesia(Config); +end_per_group(mib_storage_dets, Config) -> + finish_mib_storage_dets(Config); +end_per_group(mib_storage_ets, Config) -> + finish_mib_storage_ets(Config); +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(otp8395 = Case, Config) when is_list(Config) -> ?DBG("init_per_testcase -> entry with" "~n Case: ~p" "~n Config: ~p", [Case, Config]), - Config2 = init_per_testcase2(Case, init_suite(Config)), + Config2 = init_per_testcase2(Case, init_per_suite(Config)), otp8395({init, Config2}); init_per_testcase(otp_7157_test = _Case, Config) when is_list(Config) -> ?DBG("init_per_testcase -> entry with" @@ -123,10 +276,10 @@ init_per_testcase(_Case, Config) when is_list(Config) -> Dog = ?WD_START(?MINS(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(otp8395, Config) when is_list(Config) -> +end_per_testcase(otp8395, Config) when is_list(Config) -> otp8395({fin, Config}); -fin_per_testcase(_Case, Config) when is_list(Config) -> - ?DBG("fin_per_testcase -> entry with" +end_per_testcase(_Case, Config) when is_list(Config) -> + ?DBG("end_per_testcase -> entry with" "~n Case: ~p" "~n Config: ~p", [_Case, Config]), Dog = ?config(watchdog, Config), @@ -134,8 +287,8 @@ fin_per_testcase(_Case, Config) when is_list(Config) -> Config. -init_suite(Config) -> - ?DBG("init_suite -> entry with" +init_per_suite(Config) -> + ?DBG("init_per_suite -> entry with" "~n Config: ~p", [Config]), %% Suite root dir for test suite @@ -170,12 +323,12 @@ init_suite(Config) -> {mib_dir, MibDir}, {std_mib_dir, StdMibDir} | Config1], - ?DBG("init_suite -> done when" + ?DBG("init_per_suite -> done when" "~n Config2: ~p", [Config2]), Config2. %% end_per_suite(Config) -> -end_suite(Config) -> +end_per_suite(Config) -> Config. fix_data_dir(Config) -> @@ -220,35 +373,22 @@ init_per_testcase2(Case, Config) -> {sub_agent_top_dir, SubAgentTopDir}, {manager_top_dir, ManagerTopDir} | Config]. -fin_per_testcase2(_Case, Config) -> +end_per_testcase2(_Case, Config) -> Config. -cases() -> - case ?OSTYPE() of - vxworks -> - %% No crypto app, so skip v3 testcases - [ - misc, - test_v1, - test_v2, - test_v1_v2, - test_multi_threaded, - mib_storage, - tickets1 - ]; - _Else -> - [ - misc, - test_v1, - test_v2, - test_v1_v2, - test_v3, - test_multi_threaded, - mib_storage, - tickets1 - ] - end. +cases() -> +case ?OSTYPE() of + vxworks -> + [{group, misc}, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_multi_threaded}, + {group, mib_storage}, {group, tickets1}]; + _Else -> + [{group, misc}, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_v3}, + {group, test_multi_threaded}, {group, mib_storage}, + {group, tickets1}] +end. %%%----------------------------------------------------------------- @@ -355,144 +495,56 @@ delete_mib_storage_mnesia_tables() -> %% <base>, and a second version <base>_2. There may be several %% versions as well, <base>_N. %%----------------------------------------------------------------- -mib_storage(suite) -> [ - mib_storage_ets, - mib_storage_dets, - mib_storage_mnesia, - mib_storage_size_check_ets, - mib_storage_size_check_dets, - mib_storage_size_check_mnesia, - mib_storage_varm_dets, - mib_storage_varm_mnesia - ]. - -mib_storage_ets(suite) -> {req, [], {conf, init_mib_storage_ets, - mib_storage_ets_cases(), - finish_mib_storage_ets}}. - -mib_storage_dets(suite) -> {req, [], {conf, init_mib_storage_dets, - mib_storage_dets_cases(), - finish_mib_storage_dets}}. - -mib_storage_mnesia(suite) -> {req, [], {conf, init_mib_storage_mnesia, - mib_storage_mnesia_cases(), - finish_mib_storage_mnesia}}. - -mib_storage_size_check_ets(suite) -> - {req, [], {conf, - init_size_check_mse, - mse_size_check_cases(), - finish_size_check_mse}}. - -mib_storage_size_check_dets(suite) -> - {req, [], {conf, - init_size_check_msd, - msd_size_check_cases(), - finish_size_check_msd}}. - -mib_storage_size_check_mnesia(suite) -> - {req, [], {conf, - init_size_check_msm, - msm_size_check_cases(), - finish_size_check_msm}}. - -mib_storage_varm_dets(suite) -> - {req, [], {conf, - init_varm_mib_storage_dets, - varm_mib_storage_dets_cases(), - finish_varm_mib_storage_dets}}. - -mib_storage_varm_mnesia(suite) -> - {req, [], {conf, - init_varm_mib_storage_mnesia, - varm_mib_storage_mnesia_cases(), - finish_varm_mib_storage_mnesia}}. - -mib_storage_ets_cases() -> - [ - mse_simple, - mse_v1_processing, - mse_big, - mse_big2, - mse_loop_mib, - mse_api, - mse_sa_register, - mse_v1_trap, - mse_sa_error, - mse_next_across_sa, - mse_undo, - mse_standard_mib, - mse_community_mib, - mse_framework_mib, - mse_target_mib, - mse_notification_mib, - mse_view_based_acm_mib, - mse_sparse_table, - mse_me_of, - mse_mib_of]. - -mib_storage_dets_cases() -> - [ - msd_simple, - msd_v1_processing, - msd_big, - msd_big2, - msd_loop_mib, - msd_api, - msd_sa_register, - msd_v1_trap, - msd_sa_error, - msd_next_across_sa, - msd_undo, - msd_standard_mib, - msd_community_mib, - msd_framework_mib, - msd_target_mib, - msd_notification_mib, - msd_view_based_acm_mib, - msd_sparse_table, - msd_me_of, - msd_mib_of - ]. - -mib_storage_mnesia_cases() -> - [ - msm_simple, - msm_v1_processing, - msm_big, - msm_big2, - msm_loop_mib, - msm_api, - msm_sa_register, - msm_v1_trap, - msm_sa_error, - msm_next_across_sa, - msm_undo, - msm_standard_mib, - msm_community_mib, - msm_framework_mib, - msm_target_mib, - msm_notification_mib, - msm_view_based_acm_mib, - msm_sparse_table, - msm_me_of, - msm_mib_of - ]. - -mse_size_check_cases() -> - [mse_size_check]. - -msd_size_check_cases() -> - [msd_size_check]. - -msm_size_check_cases() -> - [msm_size_check]. - -varm_mib_storage_dets_cases() -> - [msd_varm_mib_start]. - -varm_mib_storage_mnesia_cases() -> - [msm_varm_mib_start]. + + + + + + + + + +mib_storage_ets_cases() -> +[mse_simple, mse_v1_processing, mse_big, mse_big2, + mse_loop_mib, mse_api, mse_sa_register, mse_v1_trap, + mse_sa_error, mse_next_across_sa, mse_undo, + mse_standard_mib, mse_community_mib, mse_framework_mib, + mse_target_mib, mse_notification_mib, + mse_view_based_acm_mib, mse_sparse_table, mse_me_of, + mse_mib_of]. + +mib_storage_dets_cases() -> +[msd_simple, msd_v1_processing, msd_big, msd_big2, + msd_loop_mib, msd_api, msd_sa_register, msd_v1_trap, + msd_sa_error, msd_next_across_sa, msd_undo, + msd_standard_mib, msd_community_mib, msd_framework_mib, + msd_target_mib, msd_notification_mib, + msd_view_based_acm_mib, msd_sparse_table, msd_me_of, + msd_mib_of]. + +mib_storage_mnesia_cases() -> +[msm_simple, msm_v1_processing, msm_big, msm_big2, + msm_loop_mib, msm_api, msm_sa_register, msm_v1_trap, + msm_sa_error, msm_next_across_sa, msm_undo, + msm_standard_mib, msm_community_mib, msm_framework_mib, + msm_target_mib, msm_notification_mib, + msm_view_based_acm_mib, msm_sparse_table, msm_me_of, + msm_mib_of]. + +mse_size_check_cases() -> +[mse_size_check]. + +msd_size_check_cases() -> +[msd_size_check]. + +msm_size_check_cases() -> +[msm_size_check]. + +varm_mib_storage_dets_cases() -> +[msd_varm_mib_start]. + +varm_mib_storage_mnesia_cases() -> +[msm_varm_mib_start]. init_mib_storage_ets(Config) when is_list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), @@ -975,8 +1027,6 @@ mib_of(Oid, ExpectedMibName) -> end. -misc(suite) -> - {req, [], {conf, init_misc, misc_cases(), finish_misc}}. init_misc(Config) -> init_v1(Config). @@ -984,11 +1034,8 @@ init_misc(Config) -> finish_misc(Config) -> finish_v1(Config). -misc_cases() -> - [ - app_info, - info_test - ]. +misc_cases() -> +[app_info, info_test]. app_info(suite) -> []; app_info(Config) when is_list(Config) -> @@ -1021,34 +1068,14 @@ app_dir(App) -> end. -test_v1(suite) -> {req, [], {conf, init_v1, v1_cases(), finish_v1}}. %v1_cases() -> [loop_mib]; -v1_cases() -> - [ - simple, - db_notify_client, - v1_processing, - big, - big2, - loop_mib, - api, - subagent, - mnesia, - multiple_reqs, - sa_register, - v1_trap, - sa_error, - next_across_sa, - undo, - reported_bugs, - standard_mibs, - sparse_table, - cnt_64, - opaque, - - change_target_addr_config - ]. +v1_cases() -> +[simple, db_notify_client, v1_processing, big, big2, + loop_mib, api, subagent, mnesia, {group, multiple_reqs}, + sa_register, v1_trap, sa_error, next_across_sa, undo, + {group, reported_bugs}, {group, standard_mibs}, + sparse_table, cnt_64, opaque, change_target_addr_config]. init_v1(Config) when is_list(Config) -> ?line SaNode = ?config(snmp_sa, Config), @@ -1065,34 +1092,14 @@ finish_v1(Config) when is_list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v2(suite) -> {req, [], {conf, init_v2, v2_cases(), finish_v2}}. - -v2_cases() -> - [ - simple_2, - v2_processing, - big_2, - big2_2, - loop_mib_2, - api_2, - subagent_2, - mnesia_2, - multiple_reqs_2, - sa_register_2, - v2_trap, - v2_inform, - sa_error_2, - next_across_sa_2, - undo_2, - reported_bugs_2, - standard_mibs_2, - v2_types, - implied, - sparse_table_2, - cnt_64_2, - opaque_2, - v2_caps - ]. + +v2_cases() -> +[simple_2, v2_processing, big_2, big2_2, loop_mib_2, + api_2, subagent_2, mnesia_2, {group, multiple_reqs_2}, + sa_register_2, v2_trap, {group, v2_inform}, sa_error_2, + next_across_sa_2, undo_2, {group, reported_bugs_2}, + {group, standard_mibs_2}, v2_types, implied, + sparse_table_2, cnt_64_2, opaque_2, v2_caps]. init_v2(Config) when is_list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1109,11 +1116,9 @@ finish_v2(Config) when is_list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v1_v2(suite) -> - {req, [], {conf, init_v1_v2, v1_v2_cases(), finish_v1_v2}}. -v1_v2_cases() -> - [simple_bi]. +v1_v2_cases() -> +[simple_bi]. init_v1_v2(Config) when is_list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1130,35 +1135,15 @@ finish_v1_v2(Config) when is_list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v3(suite) -> {req, [], {conf, init_v3, v3_cases(), finish_v3}}. - -v3_cases() -> - [ - simple_3, - v3_processing, - big_3, - big2_3, - api_3, - subagent_3, - mnesia_3, - loop_mib_3, - multiple_reqs_3, - sa_register_3, - v3_trap, - v3_inform, - sa_error_3, - next_across_sa_3, - undo_3, - reported_bugs_3, - standard_mibs_3, - v3_security, - v2_types_3, - implied_3, - sparse_table_3, - cnt_64_3, - opaque_3, - v2_caps_3 - ]. + +v3_cases() -> +[simple_3, v3_processing, big_3, big2_3, api_3, + subagent_3, mnesia_3, loop_mib_3, multiple_reqs_3, + sa_register_3, v3_trap, v3_inform, sa_error_3, + next_across_sa_3, undo_3, {group, reported_bugs_3}, + {group, standard_mibs_3}, {group, v3_security}, + v2_types_3, implied_3, sparse_table_3, cnt_64_3, + opaque_3, v2_caps_3]. init_v3(Config) when is_list(Config) -> %% Make sure crypto works, otherwise start_agent will fail @@ -1196,11 +1181,9 @@ finish_v3(Config) when is_list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_multi_threaded(suite) -> - {req, [], {conf, init_mt, mt_cases(), finish_mt}}. -mt_cases() -> - [multi_threaded, mt_trap]. +mt_cases() -> +[multi_threaded, mt_trap]. init_mt(Config) when is_list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1690,21 +1673,19 @@ mnesia_2(X) -> ?P(mnesia_2), mnesia(X). mnesia_3(X) -> ?P(mnesia_3), mnesia(X). -multiple_reqs(suite) -> - {req, [], {conf, init_mul, mul_cases(), finish_mul}}. -mul_cases() -> - [mul_get, mul_get_err, mul_next, mul_next_err, mul_set_err]. +mul_cases() -> +[mul_get, mul_get_err, mul_next, mul_next_err, + mul_set_err]. -multiple_reqs_2(suite) -> - {req, [], {conf, init_mul, mul_cases_2(), finish_mul}}. multiple_reqs_3(_X) -> {req, [], {conf, init_mul, mul_cases_3(), finish_mul}}. -mul_cases_2() -> - [mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, mul_set_err_2]. +mul_cases_2() -> +[mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, + mul_set_err_2]. mul_cases_3() -> @@ -1929,8 +1910,6 @@ v3_trap(Config) when is_list(Config) -> ?P(v3_trap), trap2(Config). -v2_inform(suite) -> - {req, [], {conf, init_v2_inform, [v2_inform_i], finish_v2_inform}}. v3_inform(_X) -> %% v2_inform(X). @@ -2190,13 +2169,6 @@ v3_processing(Config) when is_list(Config) -> %% accomplished by the first inform sent. That one will generate a %% report, which makes it in sync. The notification-generating %% application times out, and send again. This time it'll work. -v3_security(suite) -> - [ - v3_crypto_basic, - v3_md5_auth, - v3_sha_auth, - v3_des_priv - ]. v3_crypto_basic(suite) -> []; v3_crypto_basic(_Config) -> @@ -4044,36 +4016,8 @@ bad_return() -> %%% Note that many of the functions in the standard mib is %%% already tested by the normal tests. %%%----------------------------------------------------------------- -standard_mibs(suite) -> - [ - snmp_standard_mib, - snmp_community_mib, - snmp_framework_mib, - snmp_target_mib, - snmp_notification_mib, - snmp_view_based_acm_mib - ]. - -standard_mibs_2(suite) -> - [ - snmpv2_mib_2, - snmp_community_mib_2, - snmp_framework_mib_2, - snmp_target_mib_2, - snmp_notification_mib_2, - snmp_view_based_acm_mib_2 - ]. - -standard_mibs_3(suite) -> - [ - snmpv2_mib_3, - snmp_framework_mib_3, - snmp_mpd_mib_3, - snmp_target_mib_3, - snmp_notification_mib_3, - snmp_view_based_acm_mib_3, - snmp_user_based_sm_mib_3 - ]. + + %%----------------------------------------------------------------- %% For this test, the agent is configured for v1. @@ -5117,70 +5061,14 @@ loop_it_2(Oid, N) -> %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- -reported_bugs(suite) -> - [ - otp_1128, - otp_1129, - otp_1131, - otp_1162, - otp_1222, - otp_1298, - otp_1331, - otp_1338, - otp_1342, - otp_2776, - otp_2979, - otp_3187, - otp_3725 - ]. - -reported_bugs_2(suite) -> - [ - otp_1128_2, - otp_1129_2, - otp_1131_2, - otp_1162_2, - otp_1222_2, - otp_1298_2, - otp_1331_2, - otp_1338_2, - otp_1342_2, - otp_2776_2, - otp_2979_2, - otp_3187_2 - ]. - -reported_bugs_3(suite) -> - [ - otp_1128_3, - otp_1129_3, - otp_1131_3, - otp_1162_3, - otp_1222_3, - otp_1298_3, - otp_1331_3, - otp_1338_3, - otp_1342_3, - otp_2776_3, - otp_2979_3, - otp_3187_3, - otp_3542 - ]. + + %% These are (ticket) test cases where the initiation has to be done %% individually. -tickets1(suite) -> - [ - otp_4394, - otp_7157 - ]. -tickets2(suite) -> - [ - otp8395 - ]. @@ -5661,10 +5549,6 @@ otp_3725_test(MaNode) -> %%----------------------------------------------------------------- -otp_4394(suite) -> {req, [], {conf, - init_otp_4394, - [otp_4394_test], - finish_otp_4394}}. init_otp_4394(Config) when is_list(Config) -> ?DBG("init_otp_4394 -> entry with" @@ -5758,10 +5642,6 @@ otp_4394_test1() -> %%----------------------------------------------------------------- -otp_7157(suite) -> - Reqs = [], - Conf = [{conf, init_otp_7157, [otp_7157_test], finish_otp_7157}], - {req, Reqs, Conf}. init_otp_7157(Config) when is_list(Config) -> %% <CONDITIONAL-SKIP> diff --git a/lib/snmp/test/snmp_agent_v1_test.erl b/lib/snmp/test/snmp_agent_v1_test.erl index 52ac6cf58f..737bb25cc3 100644 --- a/lib/snmp/test/snmp_agent_v1_test.erl +++ b/lib/snmp/test/snmp_agent_v1_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -103,7 +103,7 @@ init_per_testcase(_Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:minutes(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), Config. diff --git a/lib/snmp/test/snmp_agent_v2_test.erl b/lib/snmp/test/snmp_agent_v2_test.erl index eca66dc30d..dc94c18ad9 100644 --- a/lib/snmp/test/snmp_agent_v2_test.erl +++ b/lib/snmp/test/snmp_agent_v2_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -28,7 +28,7 @@ -define(application, snmp). -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -83,39 +83,165 @@ _ -> V3 end). -all(suite) -> {req, - [mnesia, distribution, - {local_slave_nodes, 2}, {time, 360}], - [{conf, init_all, cases(), finish_all}]}. +all() -> +[cases()]. + +groups() -> + [{mib_storage, [], + [{group, mib_storage_ets}, {group, mib_storage_dets}, + {group, mib_storage_mnesia}, + {group, mib_storage_size_check_ets}, + {group, mib_storage_size_check_dets}, + {group, mib_storage_size_check_mnesia}, + {group, mib_storage_varm_dets}, + {group, mib_storage_varm_mnesia}]}, + {mib_storage_ets, [], mib_storage_ets_cases()}, + {mib_storage_dets, [], mib_storage_dets_cases()}, + {mib_storage_mnesia, [], mib_storage_mnesia_cases()}, + {mib_storage_size_check_ets, [], + mse_size_check_cases()}, + {mib_storage_size_check_dets, [], + msd_size_check_cases()}, + {mib_storage_size_check_mnesia, [], + msm_size_check_cases()}, + {mib_storage_varm_dets, [], + varm_mib_storage_dets_cases()}, + {mib_storage_varm_mnesia, [], + varm_mib_storage_mnesia_cases()}, + {test_v1, [], v1_cases()}, {test_v2, [], v2_cases()}, + {test_v1_v2, [], v1_v2_cases()}, + {test_v3, [], v3_cases()}, + {test_multi_threaded, [], mt_cases()}, + {multiple_reqs, [], mul_cases()}, + {multiple_reqs_2, [], mul_cases_2()}, + {v2_inform, [], [v2_inform_i]}, + {v3_security, [], + [v3_crypto_basic, v3_md5_auth, v3_sha_auth, + v3_des_priv]}, + {standard_mibs, [], + [snmp_standard_mib, snmp_community_mib, + snmp_framework_mib, snmp_target_mib, + snmp_notification_mib, snmp_view_based_acm_mib]}, + {standard_mibs_2, [], + [snmpv2_mib_2, snmp_community_mib_2, + snmp_framework_mib_2, snmp_target_mib_2, + snmp_notification_mib_2, snmp_view_based_acm_mib_2]}, + {standard_mibs_3, [], + [snmpv2_mib_3, snmp_framework_mib_3, snmp_mpd_mib_3, + snmp_target_mib_3, snmp_notification_mib_3, + snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]}, + {reported_bugs, [], + [otp_1128, otp_1129, otp_1131, otp_1162, otp_1222, + otp_1298, otp_1331, otp_1338, otp_1342, otp_2776, + otp_2979, otp_3187, otp_3725]}, + {reported_bugs_2, [], + [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, + otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, + otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]}, + {reported_bugs_3, [], + [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, + otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, + otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, + otp_3542]}, + {tickets, [], [{group, otp_4394}]}, + {otp_4394, [], [otp_4394_test]}]. + +init_per_group(otp_4394, Config) -> + init_otp_4394(Config); +init_per_group(v2_inform, Config) -> + init_v2_inform(Config); +init_per_group(multiple_reqs_2, Config) -> + init_mul(Config); +init_per_group(multiple_reqs, Config) -> + init_mul(Config); +init_per_group(test_multi_threaded, Config) -> + init_mt(Config); +init_per_group(test_v3, Config) -> + init_v3(Config); +init_per_group(test_v1_v2, Config) -> + init_v1_v2(Config); +init_per_group(test_v2, Config) -> + init_v2(Config); +init_per_group(test_v1, Config) -> + init_v1(Config); +init_per_group(mib_storage_varm_mnesia, Config) -> + init_varm_mib_storage_mnesia(Config); +init_per_group(mib_storage_varm_dets, Config) -> + init_varm_mib_storage_dets(Config); +init_per_group(mib_storage_size_check_mnesia, Config) -> + init_size_check_msm(Config); +init_per_group(mib_storage_size_check_dets, Config) -> + init_size_check_msd(Config); +init_per_group(mib_storage_size_check_ets, Config) -> + init_size_check_mse(Config); +init_per_group(mib_storage_mnesia, Config) -> + init_mib_storage_mnesia(Config); +init_per_group(mib_storage_dets, Config) -> + init_mib_storage_dets(Config); +init_per_group(mib_storage_ets, Config) -> + init_mib_storage_ets(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(otp_4394, Config) -> + finish_otp_4394(Config); +end_per_group(v2_inform, Config) -> + finish_v2_inform(Config); +end_per_group(multiple_reqs_2, Config) -> + finish_mul(Config); +end_per_group(multiple_reqs, Config) -> + finish_mul(Config); +end_per_group(test_multi_threaded, Config) -> + finish_mt(Config); +end_per_group(test_v3, Config) -> + finish_v3(Config); +end_per_group(test_v1_v2, Config) -> + finish_v1_v2(Config); +end_per_group(test_v2, Config) -> + finish_v2(Config); +end_per_group(test_v1, Config) -> + finish_v1(Config); +end_per_group(mib_storage_varm_mnesia, Config) -> + finish_varm_mib_storage_mnesia(Config); +end_per_group(mib_storage_varm_dets, Config) -> + finish_varm_mib_storage_dets(Config); +end_per_group(mib_storage_size_check_mnesia, Config) -> + finish_size_check_msm(Config); +end_per_group(mib_storage_size_check_dets, Config) -> + finish_size_check_msd(Config); +end_per_group(mib_storage_size_check_ets, Config) -> + finish_size_check_mse(Config); +end_per_group(mib_storage_mnesia, Config) -> + finish_mib_storage_mnesia(Config); +end_per_group(mib_storage_dets, Config) -> + finish_mib_storage_dets(Config); +end_per_group(mib_storage_ets, Config) -> + finish_mib_storage_ets(Config); +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:minutes(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), Config. -cases() -> - case ?OSTYPE() of - vxworks -> - %% No crypto app, so skip v3 testcases - [ - app_info, - test_v1, test_v2, test_v1_v2, - test_multi_threaded, - mib_storage, - tickets]; - _Else -> - [ - app_info, - test_v1, test_v2, test_v1_v2, test_v3, - test_multi_threaded, - mib_storage, - tickets - ] - end. +cases() -> +case ?OSTYPE() of + vxworks -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_multi_threaded}, + {group, mib_storage}, {group, tickets}]; + _Else -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_v3}, + {group, test_multi_threaded}, {group, mib_storage}, + {group, tickets}] +end. %%%----------------------------------------------------------------- @@ -460,144 +586,56 @@ delete_mib_storage_mnesia_tables() -> %% <base>, and a second version <base>_2. There may be several %% versions as well, <base>_N. %%----------------------------------------------------------------- -mib_storage(suite) -> [ - mib_storage_ets, - mib_storage_dets, - mib_storage_mnesia, - mib_storage_size_check_ets, - mib_storage_size_check_dets, - mib_storage_size_check_mnesia, - mib_storage_varm_dets, - mib_storage_varm_mnesia - ]. - -mib_storage_ets(suite) -> {req, [], {conf, init_mib_storage_ets, - mib_storage_ets_cases(), - finish_mib_storage_ets}}. - -mib_storage_dets(suite) -> {req, [], {conf, init_mib_storage_dets, - mib_storage_dets_cases(), - finish_mib_storage_dets}}. - -mib_storage_mnesia(suite) -> {req, [], {conf, init_mib_storage_mnesia, - mib_storage_mnesia_cases(), - finish_mib_storage_mnesia}}. - -mib_storage_size_check_ets(suite) -> - {req, [], {conf, - init_size_check_mse, - mse_size_check_cases(), - finish_size_check_mse}}. - -mib_storage_size_check_dets(suite) -> - {req, [], {conf, - init_size_check_msd, - msd_size_check_cases(), - finish_size_check_msd}}. - -mib_storage_size_check_mnesia(suite) -> - {req, [], {conf, - init_size_check_msm, - msm_size_check_cases(), - finish_size_check_msm}}. - -mib_storage_varm_dets(suite) -> - {req, [], {conf, - init_varm_mib_storage_dets, - varm_mib_storage_dets_cases(), - finish_varm_mib_storage_dets}}. - -mib_storage_varm_mnesia(suite) -> - {req, [], {conf, - init_varm_mib_storage_mnesia, - varm_mib_storage_mnesia_cases(), - finish_varm_mib_storage_mnesia}}. - -mib_storage_ets_cases() -> - [ - mse_simple, - mse_v1_processing, - mse_big, - mse_big2, - mse_loop_mib, - mse_api, - mse_sa_register, - mse_v1_trap, - mse_sa_error, - mse_next_across_sa, - mse_undo, - mse_standard_mib, - mse_community_mib, - mse_framework_mib, - mse_target_mib, - mse_notification_mib, - mse_view_based_acm_mib, - mse_sparse_table, - mse_me_of, - mse_mib_of]. - -mib_storage_dets_cases() -> - [ - msd_simple, - msd_v1_processing, - msd_big, - msd_big2, - msd_loop_mib, - msd_api, - msd_sa_register, - msd_v1_trap, - msd_sa_error, - msd_next_across_sa, - msd_undo, - msd_standard_mib, - msd_community_mib, - msd_framework_mib, - msd_target_mib, - msd_notification_mib, - msd_view_based_acm_mib, - msd_sparse_table, - msd_me_of, - msd_mib_of - ]. - -mib_storage_mnesia_cases() -> - [ - msm_simple, - msm_v1_processing, - msm_big, - msm_big2, - msm_loop_mib, - msm_api, - msm_sa_register, - msm_v1_trap, - msm_sa_error, - msm_next_across_sa, - msm_undo, - msm_standard_mib, - msm_community_mib, - msm_framework_mib, - msm_target_mib, - msm_notification_mib, - msm_view_based_acm_mib, - msm_sparse_table, - msm_me_of, - msm_mib_of - ]. - -mse_size_check_cases() -> - [mse_size_check]. - -msd_size_check_cases() -> - [msd_size_check]. - -msm_size_check_cases() -> - [msm_size_check]. - -varm_mib_storage_dets_cases() -> - [msd_varm_mib_start]. - -varm_mib_storage_mnesia_cases() -> - [msm_varm_mib_start]. + + + + + + + + + +mib_storage_ets_cases() -> +[mse_simple, mse_v1_processing, mse_big, mse_big2, + mse_loop_mib, mse_api, mse_sa_register, mse_v1_trap, + mse_sa_error, mse_next_across_sa, mse_undo, + mse_standard_mib, mse_community_mib, mse_framework_mib, + mse_target_mib, mse_notification_mib, + mse_view_based_acm_mib, mse_sparse_table, mse_me_of, + mse_mib_of]. + +mib_storage_dets_cases() -> +[msd_simple, msd_v1_processing, msd_big, msd_big2, + msd_loop_mib, msd_api, msd_sa_register, msd_v1_trap, + msd_sa_error, msd_next_across_sa, msd_undo, + msd_standard_mib, msd_community_mib, msd_framework_mib, + msd_target_mib, msd_notification_mib, + msd_view_based_acm_mib, msd_sparse_table, msd_me_of, + msd_mib_of]. + +mib_storage_mnesia_cases() -> +[msm_simple, msm_v1_processing, msm_big, msm_big2, + msm_loop_mib, msm_api, msm_sa_register, msm_v1_trap, + msm_sa_error, msm_next_across_sa, msm_undo, + msm_standard_mib, msm_community_mib, msm_framework_mib, + msm_target_mib, msm_notification_mib, + msm_view_based_acm_mib, msm_sparse_table, msm_me_of, + msm_mib_of]. + +mse_size_check_cases() -> +[mse_size_check]. + +msd_size_check_cases() -> +[msd_size_check]. + +msm_size_check_cases() -> +[msm_size_check]. + +varm_mib_storage_dets_cases() -> +[msd_varm_mib_start]. + +varm_mib_storage_mnesia_cases() -> +[msm_varm_mib_start]. init_mib_storage_ets(Config) when list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), @@ -1099,20 +1137,14 @@ app_dir(App) -> end. -test_v1(suite) -> {req, [], {conf, init_v1, v1_cases(), finish_v1}}. %v1_cases() -> [loop_mib]; -v1_cases() -> - [simple, - db_notify_client, - v1_processing, big, big2, loop_mib, - api, subagent, mnesia, multiple_reqs, - sa_register, v1_trap, sa_error, next_across_sa, undo, reported_bugs, - standard_mibs, sparse_table, cnt_64, - opaque, - % opaque]. - - change_target_addr_config]. +v1_cases() -> +[simple, db_notify_client, v1_processing, big, big2, + loop_mib, api, subagent, mnesia, {group, multiple_reqs}, + sa_register, v1_trap, sa_error, next_across_sa, undo, + {group, reported_bugs}, {group, standard_mibs}, + sparse_table, cnt_64, opaque, change_target_addr_config]. init_v1(Config) when list(Config) -> ?line SaNode = ?config(snmp_sa, Config), @@ -1129,15 +1161,15 @@ finish_v1(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v2(suite) -> {req, [], {conf, init_v2, v2_cases(), finish_v2}}. %v2_cases() -> [loop_mib_2]; -v2_cases() -> - [simple_2, v2_processing, big_2, big2_2, loop_mib_2, - api_2, subagent_2, mnesia_2, - multiple_reqs_2, sa_register_2, v2_trap, v2_inform, sa_error_2, - next_across_sa_2, undo_2, reported_bugs_2, standard_mibs_2, - v2_types, implied, sparse_table_2, cnt_64_2, opaque_2, v2_caps]. +v2_cases() -> +[simple_2, v2_processing, big_2, big2_2, loop_mib_2, + api_2, subagent_2, mnesia_2, {group, multiple_reqs_2}, + sa_register_2, v2_trap, {group, v2_inform}, sa_error_2, + next_across_sa_2, undo_2, {group, reported_bugs_2}, + {group, standard_mibs_2}, v2_types, implied, + sparse_table_2, cnt_64_2, opaque_2, v2_caps]. init_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1154,10 +1186,9 @@ finish_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v1_v2(suite) -> {req, [], {conf, init_v1_v2, v1_v2_cases(), finish_v1_v2}}. -v1_v2_cases() -> - [simple_bi]. +v1_v2_cases() -> +[simple_bi]. init_v1_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1174,16 +1205,16 @@ finish_v1_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v3(suite) -> {req, [], {conf, init_v3, v3_cases(), finish_v3}}. %v3_cases() -> [loop_mib_3]; -v3_cases() -> - [simple_3, v3_processing, - big_3, big2_3, api_3, subagent_3, mnesia_3, loop_mib_3, - multiple_reqs_3, sa_register_3, v3_trap, v3_inform, sa_error_3, - next_across_sa_3, undo_3, reported_bugs_3, standard_mibs_3, - v3_security, - v2_types_3, implied_3, sparse_table_3, cnt_64_3, opaque_3, v2_caps_3]. +v3_cases() -> +[simple_3, v3_processing, big_3, big2_3, api_3, + subagent_3, mnesia_3, loop_mib_3, multiple_reqs_3, + sa_register_3, v3_trap, v3_inform, sa_error_3, + next_across_sa_3, undo_3, {group, reported_bugs_3}, + {group, standard_mibs_3}, {group, v3_security}, + v2_types_3, implied_3, sparse_table_3, cnt_64_3, + opaque_3, v2_caps_3]. init_v3(Config) when list(Config) -> %% Make sure crypto works, otherwise start_agent will fail @@ -1221,10 +1252,9 @@ finish_v3(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_multi_threaded(suite) -> {req, [], {conf, init_mt, mt_cases(), finish_mt}}. -mt_cases() -> - [multi_threaded, mt_trap]. +mt_cases() -> +[multi_threaded, mt_trap]. init_mt(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1739,21 +1769,19 @@ mnesia_2(X) -> mnesia(X). mnesia_3(X) -> mnesia(X). -multiple_reqs(suite) -> - {req, [], {conf, init_mul, mul_cases(), finish_mul}}. -mul_cases() -> - [mul_get, mul_get_err, mul_next, mul_next_err, mul_set_err]. +mul_cases() -> +[mul_get, mul_get_err, mul_next, mul_next_err, + mul_set_err]. -multiple_reqs_2(suite) -> - {req, [], {conf, init_mul, mul_cases_2(), finish_mul}}. multiple_reqs_3(_X) -> {req, [], {conf, init_mul, mul_cases_3(), finish_mul}}. -mul_cases_2() -> - [mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, mul_set_err_2]. +mul_cases_2() -> +[mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, + mul_set_err_2]. mul_cases_3() -> @@ -1939,8 +1967,6 @@ v2_trap(Config) when list(Config) -> v3_trap(X) -> v2_trap(X). -v2_inform(suite) -> - {req, [], {conf, init_v2_inform, [v2_inform_i], finish_v2_inform}}. v3_inform(_X) -> %% v2_inform(X). @@ -2112,7 +2138,6 @@ v3_processing(Config) when list(Config) -> %% accomplished by the first inform sent. That one will generate a %% report, which makes it in sync. The notification-generating %% application times out, and send again. This time it'll work. -v3_security(suite) -> [v3_crypto_basic, v3_md5_auth, v3_sha_auth, v3_des_priv]. v3_crypto_basic(suite) -> []; v3_crypto_basic(_Config) -> @@ -3591,22 +3616,8 @@ bad_return() -> %%% Note that many of the functions in the standard mib is %%% already tested by the normal tests. %%%----------------------------------------------------------------- -standard_mibs(suite) -> - [snmp_standard_mib, snmp_community_mib, - snmp_framework_mib, - snmp_target_mib, snmp_notification_mib, - snmp_view_based_acm_mib]. - -standard_mibs_2(suite) -> - [snmpv2_mib_2, snmp_community_mib_2, - snmp_framework_mib_2, - snmp_target_mib_2, snmp_notification_mib_2, - snmp_view_based_acm_mib_2]. - -standard_mibs_3(suite) -> - [snmpv2_mib_3,snmp_framework_mib_3, snmp_mpd_mib_3, - snmp_target_mib_3, snmp_notification_mib_3, - snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]. + + %%----------------------------------------------------------------- %% For this test, the agent is configured for v1. @@ -4527,27 +4538,12 @@ loop_it_2(Oid, N) -> %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- -reported_bugs(suite) -> - [otp_1128, otp_1129, otp_1131, otp_1162, - otp_1222, otp_1298, otp_1331, otp_1338, - otp_1342, otp_2776, otp_2979, otp_3187, otp_3725]. -reported_bugs_2(suite) -> - [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, - otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, - otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]. -reported_bugs_3(suite) -> - [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, - otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, - otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, - otp_3542]. %% These are (ticket) test cases where the initiation has to be done %% individually. -tickets(suite) -> - [otp_4394]. %%----------------------------------------------------------------- %% Ticket: OTP-1128 @@ -4971,10 +4967,6 @@ otp_3725_test(MaNode) -> %%----------------------------------------------------------------- -otp_4394(suite) -> {req, [], {conf, - init_otp_4394, - [otp_4394_test], - finish_otp_4394}}. init_otp_4394(Config) when list(Config) -> ?DBG("init_otp_4394 -> entry with" diff --git a/lib/snmp/test/snmp_agent_v3_test.erl b/lib/snmp/test/snmp_agent_v3_test.erl index 823c914136..266be72878 100644 --- a/lib/snmp/test/snmp_agent_v3_test.erl +++ b/lib/snmp/test/snmp_agent_v3_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -28,7 +28,7 @@ -define(application, snmp). -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -83,39 +83,165 @@ _ -> V3 end). -all(suite) -> {req, - [mnesia, distribution, - {local_slave_nodes, 2}, {time, 360}], - [{conf, init_all, cases(), finish_all}]}. +all() -> +[cases()]. + +groups() -> + [{mib_storage, [], + [{group, mib_storage_ets}, {group, mib_storage_dets}, + {group, mib_storage_mnesia}, + {group, mib_storage_size_check_ets}, + {group, mib_storage_size_check_dets}, + {group, mib_storage_size_check_mnesia}, + {group, mib_storage_varm_dets}, + {group, mib_storage_varm_mnesia}]}, + {mib_storage_ets, [], mib_storage_ets_cases()}, + {mib_storage_dets, [], mib_storage_dets_cases()}, + {mib_storage_mnesia, [], mib_storage_mnesia_cases()}, + {mib_storage_size_check_ets, [], + mse_size_check_cases()}, + {mib_storage_size_check_dets, [], + msd_size_check_cases()}, + {mib_storage_size_check_mnesia, [], + msm_size_check_cases()}, + {mib_storage_varm_dets, [], + varm_mib_storage_dets_cases()}, + {mib_storage_varm_mnesia, [], + varm_mib_storage_mnesia_cases()}, + {test_v1, [], v1_cases()}, {test_v2, [], v2_cases()}, + {test_v1_v2, [], v1_v2_cases()}, + {test_v3, [], v3_cases()}, + {test_multi_threaded, [], mt_cases()}, + {multiple_reqs, [], mul_cases()}, + {multiple_reqs_2, [], mul_cases_2()}, + {v2_inform, [], [v2_inform_i]}, + {v3_security, [], + [v3_crypto_basic, v3_md5_auth, v3_sha_auth, + v3_des_priv]}, + {standard_mibs, [], + [snmp_standard_mib, snmp_community_mib, + snmp_framework_mib, snmp_target_mib, + snmp_notification_mib, snmp_view_based_acm_mib]}, + {standard_mibs_2, [], + [snmpv2_mib_2, snmp_community_mib_2, + snmp_framework_mib_2, snmp_target_mib_2, + snmp_notification_mib_2, snmp_view_based_acm_mib_2]}, + {standard_mibs_3, [], + [snmpv2_mib_3, snmp_framework_mib_3, snmp_mpd_mib_3, + snmp_target_mib_3, snmp_notification_mib_3, + snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]}, + {reported_bugs, [], + [otp_1128, otp_1129, otp_1131, otp_1162, otp_1222, + otp_1298, otp_1331, otp_1338, otp_1342, otp_2776, + otp_2979, otp_3187, otp_3725]}, + {reported_bugs_2, [], + [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, + otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, + otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]}, + {reported_bugs_3, [], + [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, + otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, + otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, + otp_3542]}, + {tickets, [], [{group, otp_4394}]}, + {otp_4394, [], [otp_4394_test]}]. + +init_per_group(otp_4394, Config) -> + init_otp_4394(Config); +init_per_group(v2_inform, Config) -> + init_v2_inform(Config); +init_per_group(multiple_reqs_2, Config) -> + init_mul(Config); +init_per_group(multiple_reqs, Config) -> + init_mul(Config); +init_per_group(test_multi_threaded, Config) -> + init_mt(Config); +init_per_group(test_v3, Config) -> + init_v3(Config); +init_per_group(test_v1_v2, Config) -> + init_v1_v2(Config); +init_per_group(test_v2, Config) -> + init_v2(Config); +init_per_group(test_v1, Config) -> + init_v1(Config); +init_per_group(mib_storage_varm_mnesia, Config) -> + init_varm_mib_storage_mnesia(Config); +init_per_group(mib_storage_varm_dets, Config) -> + init_varm_mib_storage_dets(Config); +init_per_group(mib_storage_size_check_mnesia, Config) -> + init_size_check_msm(Config); +init_per_group(mib_storage_size_check_dets, Config) -> + init_size_check_msd(Config); +init_per_group(mib_storage_size_check_ets, Config) -> + init_size_check_mse(Config); +init_per_group(mib_storage_mnesia, Config) -> + init_mib_storage_mnesia(Config); +init_per_group(mib_storage_dets, Config) -> + init_mib_storage_dets(Config); +init_per_group(mib_storage_ets, Config) -> + init_mib_storage_ets(Config); +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(otp_4394, Config) -> + finish_otp_4394(Config); +end_per_group(v2_inform, Config) -> + finish_v2_inform(Config); +end_per_group(multiple_reqs_2, Config) -> + finish_mul(Config); +end_per_group(multiple_reqs, Config) -> + finish_mul(Config); +end_per_group(test_multi_threaded, Config) -> + finish_mt(Config); +end_per_group(test_v3, Config) -> + finish_v3(Config); +end_per_group(test_v1_v2, Config) -> + finish_v1_v2(Config); +end_per_group(test_v2, Config) -> + finish_v2(Config); +end_per_group(test_v1, Config) -> + finish_v1(Config); +end_per_group(mib_storage_varm_mnesia, Config) -> + finish_varm_mib_storage_mnesia(Config); +end_per_group(mib_storage_varm_dets, Config) -> + finish_varm_mib_storage_dets(Config); +end_per_group(mib_storage_size_check_mnesia, Config) -> + finish_size_check_msm(Config); +end_per_group(mib_storage_size_check_dets, Config) -> + finish_size_check_msd(Config); +end_per_group(mib_storage_size_check_ets, Config) -> + finish_size_check_mse(Config); +end_per_group(mib_storage_mnesia, Config) -> + finish_mib_storage_mnesia(Config); +end_per_group(mib_storage_dets, Config) -> + finish_mib_storage_dets(Config); +end_per_group(mib_storage_ets, Config) -> + finish_mib_storage_ets(Config); +end_per_group(_GroupName, Config) -> + Config. + init_per_testcase(_Case, Config) when list(Config) -> Dog = ?t:timetrap(?t:minutes(6)), [{watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when list(Config) -> +end_per_testcase(_Case, Config) when list(Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), Config. -cases() -> - case ?OSTYPE() of - vxworks -> - %% No crypto app, so skip v3 testcases - [ - app_info, - test_v1, test_v2, test_v1_v2, - test_multi_threaded, - mib_storage, - tickets]; - _Else -> - [ - app_info, - test_v1, test_v2, test_v1_v2, test_v3, - test_multi_threaded, - mib_storage, - tickets - ] - end. +cases() -> +case ?OSTYPE() of + vxworks -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_multi_threaded}, + {group, mib_storage}, {group, tickets}]; + _Else -> + [app_info, {group, test_v1}, {group, test_v2}, + {group, test_v1_v2}, {group, test_v3}, + {group, test_multi_threaded}, {group, mib_storage}, + {group, tickets}] +end. %%%----------------------------------------------------------------- @@ -460,144 +586,56 @@ delete_mib_storage_mnesia_tables() -> %% <base>, and a second version <base>_2. There may be several %% versions as well, <base>_N. %%----------------------------------------------------------------- -mib_storage(suite) -> [ - mib_storage_ets, - mib_storage_dets, - mib_storage_mnesia, - mib_storage_size_check_ets, - mib_storage_size_check_dets, - mib_storage_size_check_mnesia, - mib_storage_varm_dets, - mib_storage_varm_mnesia - ]. - -mib_storage_ets(suite) -> {req, [], {conf, init_mib_storage_ets, - mib_storage_ets_cases(), - finish_mib_storage_ets}}. - -mib_storage_dets(suite) -> {req, [], {conf, init_mib_storage_dets, - mib_storage_dets_cases(), - finish_mib_storage_dets}}. - -mib_storage_mnesia(suite) -> {req, [], {conf, init_mib_storage_mnesia, - mib_storage_mnesia_cases(), - finish_mib_storage_mnesia}}. - -mib_storage_size_check_ets(suite) -> - {req, [], {conf, - init_size_check_mse, - mse_size_check_cases(), - finish_size_check_mse}}. - -mib_storage_size_check_dets(suite) -> - {req, [], {conf, - init_size_check_msd, - msd_size_check_cases(), - finish_size_check_msd}}. - -mib_storage_size_check_mnesia(suite) -> - {req, [], {conf, - init_size_check_msm, - msm_size_check_cases(), - finish_size_check_msm}}. - -mib_storage_varm_dets(suite) -> - {req, [], {conf, - init_varm_mib_storage_dets, - varm_mib_storage_dets_cases(), - finish_varm_mib_storage_dets}}. - -mib_storage_varm_mnesia(suite) -> - {req, [], {conf, - init_varm_mib_storage_mnesia, - varm_mib_storage_mnesia_cases(), - finish_varm_mib_storage_mnesia}}. - -mib_storage_ets_cases() -> - [ - mse_simple, - mse_v1_processing, - mse_big, - mse_big2, - mse_loop_mib, - mse_api, - mse_sa_register, - mse_v1_trap, - mse_sa_error, - mse_next_across_sa, - mse_undo, - mse_standard_mib, - mse_community_mib, - mse_framework_mib, - mse_target_mib, - mse_notification_mib, - mse_view_based_acm_mib, - mse_sparse_table, - mse_me_of, - mse_mib_of]. - -mib_storage_dets_cases() -> - [ - msd_simple, - msd_v1_processing, - msd_big, - msd_big2, - msd_loop_mib, - msd_api, - msd_sa_register, - msd_v1_trap, - msd_sa_error, - msd_next_across_sa, - msd_undo, - msd_standard_mib, - msd_community_mib, - msd_framework_mib, - msd_target_mib, - msd_notification_mib, - msd_view_based_acm_mib, - msd_sparse_table, - msd_me_of, - msd_mib_of - ]. - -mib_storage_mnesia_cases() -> - [ - msm_simple, - msm_v1_processing, - msm_big, - msm_big2, - msm_loop_mib, - msm_api, - msm_sa_register, - msm_v1_trap, - msm_sa_error, - msm_next_across_sa, - msm_undo, - msm_standard_mib, - msm_community_mib, - msm_framework_mib, - msm_target_mib, - msm_notification_mib, - msm_view_based_acm_mib, - msm_sparse_table, - msm_me_of, - msm_mib_of - ]. - -mse_size_check_cases() -> - [mse_size_check]. - -msd_size_check_cases() -> - [msd_size_check]. - -msm_size_check_cases() -> - [msm_size_check]. - -varm_mib_storage_dets_cases() -> - [msd_varm_mib_start]. - -varm_mib_storage_mnesia_cases() -> - [msm_varm_mib_start]. + + + + + + + + + +mib_storage_ets_cases() -> +[mse_simple, mse_v1_processing, mse_big, mse_big2, + mse_loop_mib, mse_api, mse_sa_register, mse_v1_trap, + mse_sa_error, mse_next_across_sa, mse_undo, + mse_standard_mib, mse_community_mib, mse_framework_mib, + mse_target_mib, mse_notification_mib, + mse_view_based_acm_mib, mse_sparse_table, mse_me_of, + mse_mib_of]. + +mib_storage_dets_cases() -> +[msd_simple, msd_v1_processing, msd_big, msd_big2, + msd_loop_mib, msd_api, msd_sa_register, msd_v1_trap, + msd_sa_error, msd_next_across_sa, msd_undo, + msd_standard_mib, msd_community_mib, msd_framework_mib, + msd_target_mib, msd_notification_mib, + msd_view_based_acm_mib, msd_sparse_table, msd_me_of, + msd_mib_of]. + +mib_storage_mnesia_cases() -> +[msm_simple, msm_v1_processing, msm_big, msm_big2, + msm_loop_mib, msm_api, msm_sa_register, msm_v1_trap, + msm_sa_error, msm_next_across_sa, msm_undo, + msm_standard_mib, msm_community_mib, msm_framework_mib, + msm_target_mib, msm_notification_mib, + msm_view_based_acm_mib, msm_sparse_table, msm_me_of, + msm_mib_of]. + +mse_size_check_cases() -> +[mse_size_check]. + +msd_size_check_cases() -> +[msd_size_check]. + +msm_size_check_cases() -> +[msm_size_check]. + +varm_mib_storage_dets_cases() -> +[msd_varm_mib_start]. + +varm_mib_storage_mnesia_cases() -> +[msm_varm_mib_start]. init_mib_storage_ets(Config) when list(Config) -> ?LOG("init_mib_storage_ets -> entry", []), @@ -1099,20 +1137,14 @@ app_dir(App) -> end. -test_v1(suite) -> {req, [], {conf, init_v1, v1_cases(), finish_v1}}. %v1_cases() -> [loop_mib]; -v1_cases() -> - [simple, - db_notify_client, - v1_processing, big, big2, loop_mib, - api, subagent, mnesia, multiple_reqs, - sa_register, v1_trap, sa_error, next_across_sa, undo, reported_bugs, - standard_mibs, sparse_table, cnt_64, - opaque, - % opaque]. - - change_target_addr_config]. +v1_cases() -> +[simple, db_notify_client, v1_processing, big, big2, + loop_mib, api, subagent, mnesia, {group, multiple_reqs}, + sa_register, v1_trap, sa_error, next_across_sa, undo, + {group, reported_bugs}, {group, standard_mibs}, + sparse_table, cnt_64, opaque, change_target_addr_config]. init_v1(Config) when list(Config) -> ?line SaNode = ?config(snmp_sa, Config), @@ -1129,15 +1161,15 @@ finish_v1(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v2(suite) -> {req, [], {conf, init_v2, v2_cases(), finish_v2}}. %v2_cases() -> [loop_mib_2]; -v2_cases() -> - [simple_2, v2_processing, big_2, big2_2, loop_mib_2, - api_2, subagent_2, mnesia_2, - multiple_reqs_2, sa_register_2, v2_trap, v2_inform, sa_error_2, - next_across_sa_2, undo_2, reported_bugs_2, standard_mibs_2, - v2_types, implied, sparse_table_2, cnt_64_2, opaque_2, v2_caps]. +v2_cases() -> +[simple_2, v2_processing, big_2, big2_2, loop_mib_2, + api_2, subagent_2, mnesia_2, {group, multiple_reqs_2}, + sa_register_2, v2_trap, {group, v2_inform}, sa_error_2, + next_across_sa_2, undo_2, {group, reported_bugs_2}, + {group, standard_mibs_2}, v2_types, implied, + sparse_table_2, cnt_64_2, opaque_2, v2_caps]. init_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1154,10 +1186,9 @@ finish_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v1_v2(suite) -> {req, [], {conf, init_v1_v2, v1_v2_cases(), finish_v1_v2}}. -v1_v2_cases() -> - [simple_bi]. +v1_v2_cases() -> +[simple_bi]. init_v1_v2(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1174,16 +1205,16 @@ finish_v1_v2(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_v3(suite) -> {req, [], {conf, init_v3, v3_cases(), finish_v3}}. %v3_cases() -> [loop_mib_3]; -v3_cases() -> - [simple_3, v3_processing, - big_3, big2_3, api_3, subagent_3, mnesia_3, loop_mib_3, - multiple_reqs_3, sa_register_3, v3_trap, v3_inform, sa_error_3, - next_across_sa_3, undo_3, reported_bugs_3, standard_mibs_3, - v3_security, - v2_types_3, implied_3, sparse_table_3, cnt_64_3, opaque_3, v2_caps_3]. +v3_cases() -> +[simple_3, v3_processing, big_3, big2_3, api_3, + subagent_3, mnesia_3, loop_mib_3, multiple_reqs_3, + sa_register_3, v3_trap, v3_inform, sa_error_3, + next_across_sa_3, undo_3, {group, reported_bugs_3}, + {group, standard_mibs_3}, {group, v3_security}, + v2_types_3, implied_3, sparse_table_3, cnt_64_3, + opaque_3, v2_caps_3]. init_v3(Config) when list(Config) -> %% Make sure crypto works, otherwise start_agent will fail @@ -1221,10 +1252,9 @@ finish_v3(Config) when list(Config) -> delete_files(C1), lists:keydelete(vsn, 1, C1). -test_multi_threaded(suite) -> {req, [], {conf, init_mt, mt_cases(), finish_mt}}. -mt_cases() -> - [multi_threaded, mt_trap]. +mt_cases() -> +[multi_threaded, mt_trap]. init_mt(Config) when list(Config) -> SaNode = ?config(snmp_sa, Config), @@ -1739,21 +1769,19 @@ mnesia_2(X) -> mnesia(X). mnesia_3(X) -> mnesia(X). -multiple_reqs(suite) -> - {req, [], {conf, init_mul, mul_cases(), finish_mul}}. -mul_cases() -> - [mul_get, mul_get_err, mul_next, mul_next_err, mul_set_err]. +mul_cases() -> +[mul_get, mul_get_err, mul_next, mul_next_err, + mul_set_err]. -multiple_reqs_2(suite) -> - {req, [], {conf, init_mul, mul_cases_2(), finish_mul}}. multiple_reqs_3(_X) -> {req, [], {conf, init_mul, mul_cases_3(), finish_mul}}. -mul_cases_2() -> - [mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, mul_set_err_2]. +mul_cases_2() -> +[mul_get_2, mul_get_err_2, mul_next_2, mul_next_err_2, + mul_set_err_2]. mul_cases_3() -> @@ -1939,8 +1967,6 @@ v2_trap(Config) when list(Config) -> v3_trap(X) -> v2_trap(X). -v2_inform(suite) -> - {req, [], {conf, init_v2_inform, [v2_inform_i], finish_v2_inform}}. v3_inform(_X) -> %% v2_inform(X). @@ -2112,7 +2138,6 @@ v3_processing(Config) when list(Config) -> %% accomplished by the first inform sent. That one will generate a %% report, which makes it in sync. The notification-generating %% application times out, and send again. This time it'll work. -v3_security(suite) -> [v3_crypto_basic, v3_md5_auth, v3_sha_auth, v3_des_priv]. v3_crypto_basic(suite) -> []; v3_crypto_basic(_Config) -> @@ -3591,22 +3616,8 @@ bad_return() -> %%% Note that many of the functions in the standard mib is %%% already tested by the normal tests. %%%----------------------------------------------------------------- -standard_mibs(suite) -> - [snmp_standard_mib, snmp_community_mib, - snmp_framework_mib, - snmp_target_mib, snmp_notification_mib, - snmp_view_based_acm_mib]. - -standard_mibs_2(suite) -> - [snmpv2_mib_2, snmp_community_mib_2, - snmp_framework_mib_2, - snmp_target_mib_2, snmp_notification_mib_2, - snmp_view_based_acm_mib_2]. - -standard_mibs_3(suite) -> - [snmpv2_mib_3,snmp_framework_mib_3, snmp_mpd_mib_3, - snmp_target_mib_3, snmp_notification_mib_3, - snmp_view_based_acm_mib_3, snmp_user_based_sm_mib_3]. + + %%----------------------------------------------------------------- %% For this test, the agent is configured for v1. @@ -4527,27 +4538,12 @@ loop_it_2(Oid, N) -> %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- -reported_bugs(suite) -> - [otp_1128, otp_1129, otp_1131, otp_1162, - otp_1222, otp_1298, otp_1331, otp_1338, - otp_1342, otp_2776, otp_2979, otp_3187, otp_3725]. -reported_bugs_2(suite) -> - [otp_1128_2, otp_1129_2, otp_1131_2, otp_1162_2, - otp_1222_2, otp_1298_2, otp_1331_2, otp_1338_2, - otp_1342_2, otp_2776_2, otp_2979_2, otp_3187_2]. -reported_bugs_3(suite) -> - [otp_1128_3, otp_1129_3, otp_1131_3, otp_1162_3, - otp_1222_3, otp_1298_3, otp_1331_3, otp_1338_3, - otp_1342_3, otp_2776_3, otp_2979_3, otp_3187_3, - otp_3542]. %% These are (ticket) test cases where the initiation has to be done %% individually. -tickets(suite) -> - [otp_4394]. %%----------------------------------------------------------------- %% Ticket: OTP-1128 @@ -4971,10 +4967,6 @@ otp_3725_test(MaNode) -> %%----------------------------------------------------------------- -otp_4394(suite) -> {req, [], {conf, - init_otp_4394, - [otp_4394_test], - finish_otp_4394}}. init_otp_4394(Config) when list(Config) -> ?DBG("init_otp_4394 -> entry with" diff --git a/lib/snmp/test/snmp_app_test.erl b/lib/snmp/test/snmp_app_test.erl index 5c5a5285a0..64dd638f83 100644 --- a/lib/snmp/test/snmp_app_test.erl +++ b/lib/snmp/test/snmp_app_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -23,8 +23,9 @@ -module(snmp_app_test). -export([ - all/1, init_suite/1, fin_suite/1, - init_per_testcase/2, fin_per_testcase/2, + 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, fields/1, modules/1, @@ -32,7 +33,7 @@ app_depend/1, undef_funcs/1, - start_and_stop/1, + start_and_stop_empty/1, start_and_stop_with_agent/1, start_and_stop_with_manager/1, @@ -44,25 +45,34 @@ -include_lib("kernel/include/file.hrl"). --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> - Cases = - [ - fields, - modules, - exportall, - app_depend, - undef_funcs, - start_and_stop - ], - {conf, init_suite, Cases, fin_suite}. - -init_suite(Config) when is_list(Config) -> +all() -> +Cases = [fields, modules, exportall, app_depend, + undef_funcs, {group, start_and_stop}], + Cases. + +groups() -> + [{start_and_stop, [], + [start_and_stop_empty, start_and_stop_with_agent, + start_and_stop_with_manager, + start_and_stop_with_agent_and_manager, + start_epmty_and_then_agent_and_manager_and_stop, + start_with_agent_and_then_manager_and_stop, + start_with_manager_and_then_agent_and_stop]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +init_per_suite(Config) when is_list(Config) -> ?DISPLAY_SUITE_INFO(), PrivDir = ?config(priv_dir, Config), TopDir = filename:join(PrivDir, app), @@ -97,9 +107,9 @@ is_app(App) -> {error, {invalid_format, Error}} end. -fin_suite(suite) -> []; -fin_suite(doc) -> []; -fin_suite(Config) when is_list(Config) -> +end_per_suite(suite) -> []; +end_per_suite(doc) -> []; +end_per_suite(Config) when is_list(Config) -> Config. @@ -112,7 +122,7 @@ init_per_testcase(undef_funcs, Config) -> init_per_testcase(_Case, Config) -> Config. -fin_per_testcase(_Case, Config) -> +end_per_testcase(_Case, Config) -> Config. @@ -319,16 +329,6 @@ undef_funcs_make_name(App, PostFix) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -start_and_stop(suite) -> - [ - start_and_stop_empty, - start_and_stop_with_agent, - start_and_stop_with_manager, - start_and_stop_with_agent_and_manager, - start_epmty_and_then_agent_and_manager_and_stop, - start_with_agent_and_then_manager_and_stop, - start_with_manager_and_then_agent_and_stop - ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/snmp/test/snmp_appup_mgr.erl b/lib/snmp/test/snmp_appup_mgr.erl index 271d6a2847..6648ce9dbe 100644 --- a/lib/snmp/test/snmp_appup_mgr.erl +++ b/lib/snmp/test/snmp_appup_mgr.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 diff --git a/lib/snmp/test/snmp_appup_test.erl b/lib/snmp/test/snmp_appup_test.erl index 18509526cf..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-2009. 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,32 +23,46 @@ -module(snmp_appup_test). -export([ - all/1, init_suite/1, fin_suite/1, - init_per_testcase/2, fin_per_testcase/2, + 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 ]). --include("test_server.hrl"). +-compile({no_auto_import, [error/1]}). + +-include_lib("common_test/include/ct.hrl"). -include("snmp_test_lib.hrl"). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -all(suite) -> +all() -> Cases = [ appup_file ], - {conf, init_suite, Cases, fin_suite}. + Cases. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -init_suite(suite) -> []; -init_suite(doc) -> []; -init_suite(Config) when is_list(Config) -> +init_per_suite(suite) -> []; +init_per_suite(doc) -> []; +init_per_suite(Config) when is_list(Config) -> PrivDir = ?config(priv_dir, Config), TopDir = filename:join(PrivDir, appup), case file:make_dir(TopDir) of @@ -76,9 +90,9 @@ file_name(App, Ext) -> filename:join([LibDir, "ebin", atom_to_list(App) ++ Ext]). -fin_suite(suite) -> []; -fin_suite(doc) -> []; -fin_suite(Config) when is_list(Config) -> +end_per_suite(suite) -> []; +end_per_suite(doc) -> []; +end_per_suite(Config) when is_list(Config) -> Config. @@ -88,7 +102,7 @@ fin_suite(Config) when is_list(Config) -> init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. diff --git a/lib/snmp/test/snmp_compiler_test.erl b/lib/snmp/test/snmp_compiler_test.erl index ad77b01362..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 @@ -28,7 +28,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -include_lib("snmp/include/snmp_types.hrl"). @@ -37,15 +37,17 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - init_per_testcase/2, fin_per_testcase/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, - tickets/1, otp_6150/1, otp_8574/1, otp_8595/1 @@ -78,9 +80,9 @@ 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]. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> CompDir = ?config(comp_dir, Config), ?line ok = ?DEL_DIR(CompDir), lists:keydelete(comp_dir, 1, Config). @@ -90,21 +92,27 @@ fin_per_testcase(_Case, Config) when is_list(Config) -> %% Test case definitions %%====================================================================== -all(suite) -> +all() -> [ - description, - oid_conflicts, - imports, + description, + oid_conflicts, + imports, module_identity, - tickets + agent_capabilities, + module_compliance, + {group, tickets} ]. -tickets(suite) -> - [ - otp_6150, - otp_8574, - otp_8595 - ]. +groups() -> + [{tickets, [], [otp_6150, otp_8574, otp_8595]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%====================================================================== @@ -169,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) -> @@ -257,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_conf_test.erl b/lib/snmp/test/snmp_conf_test.erl index d2f9631947..c4341d8d7e 100644 --- a/lib/snmp/test/snmp_conf_test.erl +++ b/lib/snmp/test/snmp_conf_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -26,7 +26,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -include_lib("snmp/include/STANDARD-MIB.hrl"). @@ -37,8 +37,8 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2, + all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, check_mandatory/1, check_integer1/1, @@ -80,32 +80,28 @@ init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. %%====================================================================== %% Test case definitions %%====================================================================== -all(suite) -> - [ - check_mandatory, - check_integer1, - check_integer2, - check_string1, - check_string2, - check_atom, - check_ip, - check_taddress, - check_packet_size, - check_oid, - check_sec_model1, - check_sec_model2, - check_sec_level, - check_timer, - - read, - read_files - ]. +all() -> +[check_mandatory, check_integer1, check_integer2, + check_string1, check_string2, check_atom, check_ip, + check_taddress, check_packet_size, check_oid, + check_sec_model1, check_sec_model2, check_sec_level, + check_timer, read, read_files]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%====================================================================== diff --git a/lib/snmp/test/snmp_log_test.erl b/lib/snmp/test/snmp_log_test.erl index 91bdc3e849..b692017407 100644 --- a/lib/snmp/test/snmp_log_test.erl +++ b/lib/snmp/test/snmp_log_test.erl @@ -29,7 +29,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -define(SNMP_USE_V3, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -40,19 +40,19 @@ %% External exports %%---------------------------------------------------------------------- -export([ - init_per_testcase/2, fin_per_testcase/2, + init_per_testcase/2, end_per_testcase/2, - all/1, + all/0,groups/0,init_per_group/2,end_per_group/2, open_and_close/1, - open_write_and_close/1, + open_write_and_close1/1, open_write_and_close2/1, open_write_and_close3/1, open_write_and_close4/1, - log_to_io/1, + log_to_io1/1, log_to_io2/1, - log_to_txt/1, + log_to_txt1/1, log_to_txt2/1, log_to_txt3/1 @@ -97,7 +97,7 @@ init_per_testcase(Case, Config) when is_list(Config) -> Dog = ?WD_START(?MINS(5)), [{log_dir, CaseDir}, {watchdog, Dog}|Config]. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> %% Leave the dirs created above (enable debugging of the test case(s)) Dog = ?config(watchdog, Config), ?WD_STOP(Dog), @@ -108,37 +108,30 @@ fin_per_testcase(_Case, Config) when is_list(Config) -> %% Test case definitions %%====================================================================== %% ?SKIP(not_yet_implemented). -all(suite) -> - [ - open_and_close, - open_write_and_close, - log_to_io, - log_to_txt - ]. - - -open_write_and_close(suite) -> - [ - open_write_and_close1, - open_write_and_close2, - open_write_and_close3, - open_write_and_close4 - ]. - - -log_to_io(suite) -> - [ - log_to_io1, - log_to_io2 - ]. - - -log_to_txt(suite) -> - [ - log_to_txt1, - log_to_txt2, - log_to_txt3 - ]. +all() -> +[open_and_close, {group, open_write_and_close}, + {group, log_to_io}, {group, log_to_txt}]. + +groups() -> + [{open_write_and_close, [], + [open_write_and_close1, open_write_and_close2, + open_write_and_close3, open_write_and_close4]}, + {log_to_io, [], [log_to_io1, log_to_io2]}, + {log_to_txt, [], + [log_to_txt1, log_to_txt2, log_to_txt3]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + + + + + + %%====================================================================== diff --git a/lib/snmp/test/snmp_manager_config_test.erl b/lib/snmp/test/snmp_manager_config_test.erl index d5dc1387f7..a72dd0cc22 100644 --- a/lib/snmp/test/snmp_manager_config_test.erl +++ b/lib/snmp/test/snmp_manager_config_test.erl @@ -31,7 +31,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -include_lib("snmp/src/manager/snmpm_usm.hrl"). @@ -42,10 +42,10 @@ %% -compile(export_all). -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2, + all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, - start_and_stop/1, + simple_start_and_stop/1, start_without_mandatory_opts1/1, @@ -58,36 +58,36 @@ start_with_invalid_agents_conf_file1/1, start_with_invalid_usm_conf_file1/1, - normal_op/1, + - system/1, + simple_system_op/1, - users/1, + register_user_using_file/1, register_user_using_function/1, register_user_failed_using_function1/1, - agents/1, + register_agent_using_file/1, register_agent_using_function/1, register_agent_failed_using_function1/1, - usm_users/1, + register_usm_user_using_file/1, register_usm_user_using_function/1, register_usm_user_failed_using_function1/1, update_usm_user_info/1, - counter/1, + create_and_increment/1, - stats_counter/1, + stats_create_and_increment/1, - tickets/1, + otp_7219/1, - otp_8395/1, + otp_8395_1/1, otp_8395_2/1, otp_8395_3/1, @@ -150,8 +150,8 @@ init_per_testcase(Case, Config) when is_list(Config) -> {manager_log_dir, MgrLogDir} | Config]. -fin_per_testcase(Case, Config) when is_list(Config) -> - p("fin_per_testcase -> Case: ~p", [Case]), +end_per_testcase(Case, Config) when is_list(Config) -> + p("end_per_testcase -> Case: ~p", [Case]), %% The cleanup is removed due to some really discusting NFS behaviour... %% CaseTopDir = ?config(manager_dir, Config), %% ?line ok = ?DEL_DIR(CaseTopDir), @@ -163,33 +163,55 @@ fin_per_testcase(Case, Config) when is_list(Config) -> %%====================================================================== % all(doc) -> % "The top snmp manager config test case"; -all(suite) -> - [ - start_and_stop, - normal_op, - tickets - ]. +all() -> +[{group, start_and_stop}, {group, normal_op}, + {group, tickets}]. + +groups() -> + [{start_and_stop, [], + [simple_start_and_stop, start_without_mandatory_opts1, + start_without_mandatory_opts2, + start_with_all_valid_opts, start_with_unknown_opts, + start_with_incorrect_opts, + start_with_invalid_manager_conf_file1, + start_with_invalid_users_conf_file1, + start_with_invalid_agents_conf_file1, + start_with_invalid_usm_conf_file1]}, + {normal_op, [], + [{group, system}, {group, agents}, {group, users}, + {group, usm_users}, {group, counter}, + {group, stats_counter}]}, + {system, [], [simple_system_op]}, + {users, [], + [register_user_using_file, register_user_using_function, + register_user_failed_using_function1]}, + {agents, [], + [register_agent_using_file, + register_agent_using_function, + register_agent_failed_using_function1]}, + {usm_users, [], + [register_usm_user_using_file, + register_usm_user_using_function, + register_usm_user_failed_using_function1, + update_usm_user_info]}, + {counter, [], [create_and_increment]}, + {stats_counter, [], [stats_create_and_increment]}, + {tickets, [], [otp_7219, {group, otp_8395}]}, + {otp_8395, [], + [otp_8395_1, otp_8395_2, otp_8395_3, otp_8395_4]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%====================================================================== %% Test functions %%====================================================================== -start_and_stop(doc) -> - "A collection of start and stop tests"; -start_and_stop(suite) -> - [ - simple_start_and_stop, - start_without_mandatory_opts1, - start_without_mandatory_opts2, - start_with_all_valid_opts, - start_with_unknown_opts, - start_with_incorrect_opts, - start_with_invalid_manager_conf_file1, - start_with_invalid_users_conf_file1, - start_with_invalid_agents_conf_file1, - start_with_invalid_usm_conf_file1 - ]. %% @@ -1641,29 +1663,12 @@ start_with_invalid_usm_conf_file1(Conf) when is_list(Conf) -> %% --- %% -normal_op(doc) -> - "A collection of tests for normal operation"; -normal_op(suite) -> - [ - system, - agents, - users, - usm_users, - counter, - stats_counter - ]. %% %% --- %% -system(doc) -> - "Various system related operations with the snmp manager config"; -system(suite) -> - [ - simple_system_op - ]. simple_system_op(suite) -> []; simple_system_op(doc) -> @@ -1702,14 +1707,6 @@ simple_system_op(Conf) when is_list(Conf) -> %% --- %% -users(doc) -> - "Various users related operations with the snmp manager config"; -users(suite) -> - [ - register_user_using_file, - register_user_using_function, - register_user_failed_using_function1 - ]. %% @@ -1764,14 +1761,6 @@ register_user_failed_using_function1(Conf) when is_list(Conf) -> %% --- %% -agents(doc) -> - "Various agents related operations with the snmp manager config"; -agents(suite) -> - [ - register_agent_using_file, - register_agent_using_function, - register_agent_failed_using_function1 - ]. %% @@ -1950,15 +1939,6 @@ register_agent_failed_using_function1(Conf) when is_list(Conf) -> %% --- %% -usm_users(doc) -> - "Various USM users related operations with the snmp manager config"; -usm_users(suite) -> - [ - register_usm_user_using_file, - register_usm_user_using_function, - register_usm_user_failed_using_function1, - update_usm_user_info - ]. %% @@ -2208,12 +2188,6 @@ update_usm_user_info(Conf) when is_list(Conf) -> %% --- %% -counter(doc) -> - "Various counter related operations with the snmp manager config"; -counter(suite) -> - [ - create_and_increment - ]. %% @@ -2258,13 +2232,6 @@ create_and_increment(Conf) when is_list(Conf) -> %% --- %% -stats_counter(doc) -> - "Various statistic counter related operations with the " - "snmp manager config"; -stats_counter(suite) -> - [ - stats_create_and_increment - ]. %% @@ -2323,11 +2290,6 @@ loop(N, _, F) when (N > 0) andalso is_function(F) -> %% Ticket test-cases %%====================================================================== -tickets(suite) -> - [ - otp_7219, - otp_8395 - ]. otp_7219(suite) -> @@ -2379,13 +2341,6 @@ otp_7219(Config) when is_list(Config) -> -otp_8395(suite) -> - [ - otp_8395_1, - otp_8395_2, - otp_8395_3, - otp_8395_4 - ]. otp_8395_1(suite) -> []; otp_8395_1(doc) -> diff --git a/lib/snmp/test/snmp_manager_test.erl b/lib/snmp/test/snmp_manager_test.erl index cef96417dc..50836db731 100644 --- a/lib/snmp/test/snmp_manager_test.erl +++ b/lib/snmp/test/snmp_manager_test.erl @@ -31,7 +31,7 @@ %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). -include("snmp_test_data/Test2.hrl"). @@ -43,10 +43,10 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2, + all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, - start_and_stop_tests/1, + simple_start_and_stop1/1, simple_start_and_stop2/1, simple_start_and_monitor_crash1/1, @@ -54,49 +54,49 @@ notify_started01/1, notify_started02/1, - user_tests/1, + register_user1/1, - agent_tests/1, + register_agent1/1, register_agent2/1, - misc_tests/1, + info/1, - request_tests/1, + - get_tests/1, + simple_sync_get1/1, simple_sync_get2/1, simple_async_get1/1, simple_async_get2/1, - get_next_tests/1, + simple_sync_get_next1/1, simple_sync_get_next2/1, simple_async_get_next1/1, simple_async_get_next2/1, - set_tests/1, + simple_sync_set1/1, simple_sync_set2/1, simple_async_set1/1, simple_async_set2/1, - bulk_tests/1, + simple_sync_get_bulk1/1, simple_sync_get_bulk2/1, simple_async_get_bulk1/1, simple_async_get_bulk2/1, - misc_request_tests/1, + misc_async1/1, misc_async2/1, discovery/1, - event_tests/1, + trap1/1, trap2/1, @@ -109,10 +109,10 @@ report/1, - tickets/1, - otp8015/1, + + otp8015_1/1, - otp8395/1, + otp8395_1/1 ]). @@ -289,18 +289,18 @@ init_per_testcase3(Case, Config) -> Config end. -fin_per_testcase(Case, Config) when is_list(Config) -> +end_per_testcase(Case, Config) when is_list(Config) -> ?DBG("fin [~w] Nodes [1]: ~p", [Case, erlang:nodes()]), Dog = ?config(watchdog, Config), ?WD_STOP(Dog), Conf1 = lists:keydelete(watchdog, 1, Config), - Conf2 = fin_per_testcase2(Case, Conf1), + Conf2 = end_per_testcase2(Case, Conf1), ?DBG("fin [~w] Nodes [2]: ~p", [Case, erlang:nodes()]), %% TopDir = ?config(top_dir, Conf2), %% ?DEL_DIR(TopDir), Conf2. -fin_per_testcase2(Case, Config) -> +end_per_testcase2(Case, Config) -> OldApiCases = [ simple_sync_get1, @@ -359,118 +359,64 @@ fin_per_testcase2(Case, Config) -> %% Test case definitions %%====================================================================== -all(suite) -> - [ - start_and_stop_tests, - misc_tests, - user_tests, - agent_tests, - request_tests, - event_tests, - discovery, - tickets - ]. - -start_and_stop_tests(suite) -> - [ - simple_start_and_stop1, - simple_start_and_stop2, - simple_start_and_monitor_crash1, - simple_start_and_monitor_crash2, - notify_started01, - notify_started02 - ]. - -misc_tests(suite) -> - [ - info - ]. - -user_tests(suite) -> - [ - register_user1 - ]. - -agent_tests(suite) -> - [ - register_agent1, - register_agent2 - ]. - -request_tests(suite) -> - [ - get_tests, - get_next_tests, - set_tests, - bulk_tests, - misc_request_tests - ]. - -get_tests(suite) -> - [ - simple_sync_get1, - simple_sync_get2, - simple_async_get1, - simple_async_get2 - ]. - -get_next_tests(suite) -> - [ - simple_sync_get_next1, - simple_sync_get_next2, - simple_async_get_next1, - simple_async_get_next2 - ]. - -set_tests(suite) -> - [ - simple_sync_set1, - simple_sync_set2, - simple_async_set1, - simple_async_set2 - ]. - -bulk_tests(suite) -> - [ - simple_sync_get_bulk1, - simple_sync_get_bulk2, - simple_async_get_bulk1, - simple_async_get_bulk2 - ]. - -misc_request_tests(suite) -> - [ - misc_async1, - misc_async2 - ]. - -event_tests(suite) -> - [ - trap1, - trap2, - inform1, - inform2, - inform3, - inform4, - inform_swarm, - report - ]. - -tickets(suite) -> - [ - otp8015, - otp8395 - ]. - -otp8015(suite) -> - [ - otp8015_1 - ]. - -otp8395(suite) -> - [ - otp8395_1 - ]. +all() -> +[{group, start_and_stop_tests}, {group, misc_tests}, + {group, user_tests}, {group, agent_tests}, + {group, request_tests}, {group, event_tests}, discovery, + {group, tickets}]. + +groups() -> + [{start_and_stop_tests, [], + [simple_start_and_stop1, simple_start_and_stop2, + simple_start_and_monitor_crash1, + simple_start_and_monitor_crash2, notify_started01, + notify_started02]}, + {misc_tests, [], [info]}, + {user_tests, [], [register_user1]}, + {agent_tests, [], [register_agent1, register_agent2]}, + {request_tests, [], + [{group, get_tests}, {group, get_next_tests}, + {group, set_tests}, {group, bulk_tests}, + {group, misc_request_tests}]}, + {get_tests, [], + [simple_sync_get1, simple_sync_get2, simple_async_get1, + simple_async_get2]}, + {get_next_tests, [], + [simple_sync_get_next1, simple_sync_get_next2, + simple_async_get_next1, simple_async_get_next2]}, + {set_tests, [], + [simple_sync_set1, simple_sync_set2, simple_async_set1, + simple_async_set2]}, + {bulk_tests, [], + [simple_sync_get_bulk1, simple_sync_get_bulk2, + simple_async_get_bulk1, simple_async_get_bulk2]}, + {misc_request_tests, [], [misc_async1, misc_async2]}, + {event_tests, [], + [trap1, trap2, inform1, inform2, inform3, inform4, + inform_swarm, report]}, + {tickets, [], [{group, otp8015}, {group, otp8395}]}, + {otp8015, [], [otp8015_1]}, {otp8395, [], [otp8395_1]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + + + + + + + + + + + + + + %%====================================================================== diff --git a/lib/snmp/test/snmp_manager_user.erl b/lib/snmp/test/snmp_manager_user.erl index 07b56bde39..b0e192344d 100644 --- a/lib/snmp/test/snmp_manager_user.erl +++ b/lib/snmp/test/snmp_manager_user.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 diff --git a/lib/snmp/test/snmp_manager_user_old.erl b/lib/snmp/test/snmp_manager_user_old.erl index b53514d699..edffc80dd4 100755 --- a/lib/snmp/test/snmp_manager_user_old.erl +++ b/lib/snmp/test/snmp_manager_user_old.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009. All Rights Reserved. +%% Copyright Ericsson AB 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 diff --git a/lib/snmp/test/snmp_manager_user_test.erl b/lib/snmp/test/snmp_manager_user_test.erl index 0f47d70873..fefa1ad713 100644 --- a/lib/snmp/test/snmp_manager_user_test.erl +++ b/lib/snmp/test/snmp_manager_user_test.erl @@ -26,7 +26,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("test_server/include/test_server.hrl"). -include("snmp_test_lib.hrl"). @@ -36,10 +36,10 @@ %% -compile(export_all). -export([ - all/1, - init_per_testcase/2, fin_per_testcase/2, +all/0,groups/0,init_per_group/2,end_per_group/2, + init_per_testcase/2, end_per_testcase/2, + - register_user/1, simple_register_and_unregister1/1, simple_register_and_unregister2/1, simple_register_and_unregister3/1, @@ -62,7 +62,7 @@ register_monitor_request_and_crash3/1, register_monitor_request_and_crash4/1, - tickets/1, + otp7902/1 ]). @@ -123,8 +123,8 @@ init_per_testcase(Case, Config) when is_list(Config) -> {manager_log_dir, MgrLogDir} | Config]. -fin_per_testcase(Case, Config) when is_list(Config) -> - p("fin_per_testcase -> Case: ~p", [Case]), +end_per_testcase(Case, Config) when is_list(Config) -> + p("end_per_testcase -> Case: ~p", [Case]), % MgrTopDir = ?config(manager_dir, Config), % ?DEL_DIR(MgrTopDir), Config. @@ -134,42 +134,41 @@ fin_per_testcase(Case, Config) when is_list(Config) -> %% Test case definitions %%====================================================================== -all(suite) -> - [ - register_user, - tickets - ]. - -register_user(suite) -> - [ - simple_register_and_unregister1, - simple_register_and_unregister2, - simple_register_and_unregister3, - register_and_crash1, - register_and_crash2, - register_and_crash3, - register_request_and_crash1, - register_request_and_crash2, - register_request_and_crash3, - simple_register_monitor_and_unregister1, - simple_register_monitor_and_unregister2, - simple_register_monitor_and_unregister3, - register_monitor_and_crash1, - register_monitor_and_crash2, - register_monitor_and_crash3, - register_monitor_and_crash4, - register_monitor_and_crash5, - register_monitor_request_and_crash1, - register_monitor_request_and_crash2, - register_monitor_request_and_crash3, - register_monitor_request_and_crash4 - ]. - - -tickets(suite) -> - [ - otp7902 - ]. +all() -> +[{group, register_user}, {group, tickets}]. + +groups() -> + [{register_user, [], + [simple_register_and_unregister1, + simple_register_and_unregister2, + simple_register_and_unregister3, register_and_crash1, + register_and_crash2, register_and_crash3, + register_request_and_crash1, + register_request_and_crash2, + register_request_and_crash3, + simple_register_monitor_and_unregister1, + simple_register_monitor_and_unregister2, + simple_register_monitor_and_unregister3, + register_monitor_and_crash1, + register_monitor_and_crash2, + register_monitor_and_crash3, + register_monitor_and_crash4, + register_monitor_and_crash5, + register_monitor_request_and_crash1, + register_monitor_request_and_crash2, + register_monitor_request_and_crash3, + register_monitor_request_and_crash4]}, + {tickets, [], [otp7902]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + + + %%====================================================================== diff --git a/lib/snmp/test/snmp_manager_user_test_lib.erl b/lib/snmp/test/snmp_manager_user_test_lib.erl index a49fe93178..bf8fff7c4c 100644 --- a/lib/snmp/test/snmp_manager_user_test_lib.erl +++ b/lib/snmp/test/snmp_manager_user_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% 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 diff --git a/lib/snmp/test/snmp_note_store_test.erl b/lib/snmp/test/snmp_note_store_test.erl index 8686a47468..24ba88f986 100644 --- a/lib/snmp/test/snmp_note_store_test.erl +++ b/lib/snmp/test/snmp_note_store_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% 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 @@ -25,7 +25,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("snmp_test_lib.hrl"). @@ -33,8 +33,8 @@ %% External exports %%---------------------------------------------------------------------- -export([ - init_per_testcase/2, fin_per_testcase/2, - all/1, + init_per_testcase/2, end_per_testcase/2, + all/0,groups/0,init_per_group/2,end_per_group/2, start_and_stop/1, notes/1, info/1, @@ -63,20 +63,24 @@ init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. %%====================================================================== %% Test case definitions %%====================================================================== -all(suite) -> - [ - start_and_stop, - notes, - info, - garbage_in - - ]. +all() -> +[start_and_stop, notes, info, garbage_in]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + %%====================================================================== diff --git a/lib/snmp/test/snmp_pdus_test.erl b/lib/snmp/test/snmp_pdus_test.erl index 6dc5b779aa..ef510ad62e 100644 --- a/lib/snmp/test/snmp_pdus_test.erl +++ b/lib/snmp/test/snmp_pdus_test.erl @@ -25,7 +25,7 @@ %%---------------------------------------------------------------------- %% Include files %%---------------------------------------------------------------------- --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("snmp_test_lib.hrl"). -include_lib("snmp/include/snmp_types.hrl"). @@ -34,11 +34,11 @@ %% External exports %%---------------------------------------------------------------------- -export([ - all/1, - tickets/1, + all/0,groups/0,init_per_group/2,end_per_group/2, + otp7575/1, otp8563/1, - init_per_testcase/2, fin_per_testcase/2 + init_per_testcase/2, end_per_testcase/2 ]). @@ -64,23 +64,26 @@ init_per_testcase(_Case, Config) when is_list(Config) -> Config. -fin_per_testcase(_Case, Config) when is_list(Config) -> +end_per_testcase(_Case, Config) when is_list(Config) -> Config. %%====================================================================== %% Test case definitions %%====================================================================== -all(suite) -> - [ - tickets - ]. - -tickets(suite) -> - [ - otp7575, - otp8563 - ]. +all() -> +[{group, tickets}]. + +groups() -> + [{tickets, [], [otp7575, otp8563]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + 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_manager.erl b/lib/snmp/test/snmp_test_manager.erl index 9d9c52ef8d..4cc6d36acc 100644 --- a/lib/snmp/test/snmp_test_manager.erl +++ b/lib/snmp/test/snmp_test_manager.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 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/snmp_test_server.erl b/lib/snmp/test/snmp_test_server.erl index d0a5185452..ffbd2126a3 100644 --- a/lib/snmp/test/snmp_test_server.erl +++ b/lib/snmp/test/snmp_test_server.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -33,7 +33,7 @@ fatal_skip/3, init_per_testcase/2, - fin_per_testcase/2 + end_per_testcase/2 ]). -include("snmp_test_lib.hrl"). @@ -229,7 +229,7 @@ eval(Mod, Fun, Config) -> Eval = fun() -> do_eval(Self, Mod, Fun, Config2) end, Pid = spawn_link(Eval), R = wait_for_evaluator(Pid, Mod, Fun, Config2, []), - Mod:fin_per_testcase(Fun, Config2), + Mod:end_per_testcase(Fun, Config2), global:unregister_name(?TEST_CASE_SUP), process_flag(trap_exit, Flag), R. @@ -361,7 +361,7 @@ init_per_testcase(_Case, Config) -> global:register_name(?GLOBAL_LOGGER, group_leader()), Config. -fin_per_testcase(_Case, _Config) -> +end_per_testcase(_Case, _Config) -> global:unregister_name(?GLOBAL_LOGGER), ok. diff --git a/lib/snmp/test/snmp_test_suite.erl b/lib/snmp/test/snmp_test_suite.erl index a6e203eba3..77aaa508ad 100644 --- a/lib/snmp/test/snmp_test_suite.erl +++ b/lib/snmp/test/snmp_test_suite.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -29,7 +29,7 @@ behaviour_info(callbacks) -> [ {all, 1}, {init_per_testcase, 2}, - {fin_per_testcase, 2} + {end_per_testcase, 2} ]; behaviour_info(_Other) -> undefined. diff --git a/lib/snmp/test/test1.erl b/lib/snmp/test/test1.erl index b26b03d4ce..23cfaf6aaa 100644 --- a/lib/snmp/test/test1.erl +++ b/lib/snmp/test/test1.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 diff --git a/lib/snmp/test/test2.erl b/lib/snmp/test/test2.erl index dc010cfa11..a33208af7b 100644 --- a/lib/snmp/test/test2.erl +++ b/lib/snmp/test/test2.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-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 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} + ] + } + ] + } +]. |