📄 net-snmp-test-cases.html
字号:
<!-- Copyright (C) 2003 Red Hat, Inc. --><!-- This material may be distributed only subject to the terms --><!-- and conditions set forth in the Open Publication License, v1.0 --><!-- or later (the latest version is presently available at --><!-- http://www.opencontent.org/openpub/). --><!-- Distribution of the work or derivative of the work in any --><!-- standard (paper) book form is prohibited unless prior --><!-- permission is obtained from the copyright holder. --><HTML><HEAD><TITLE>Test cases</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos Reference Manual"HREF="ecos-ref.html"><LINKREL="UP"TITLE="SNMP for eCos"HREF="net-snmp-ecos-port.html"><LINKREL="PREVIOUS"TITLE="Configuring eCos"HREF="net-snmp-configuring-ecos.html"><LINKREL="NEXT"TITLE="SNMP clients and package use"HREF="net-snmp-clients-and-package-use.html"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="net-snmp-configuring-ecos.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 47. SNMP for <SPANCLASS="emphasis"><ICLASS="EMPHASIS">eCos</I></SPAN></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="net-snmp-clients-and-package-use.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="NET-SNMP-TEST-CASES">Test cases</H1><P>Currently only one test program is provided which uses SNMP.</P><P>"snmpping" in the SNMP agent package runs the ping test fromthe TCPIP package, with the snmpd running also. This allows youto interrogate it using host tools of your choice. It supports MIBsas documented above, so eg. <BCLASS="COMMAND">snmpwalk<TTCLASS="REPLACEABLE"><I><hostname></I></TT> public dot3</B> underLinux/UNIX should have the desired effect.</P><P>For serious testing, you should increase the length of timethe test runs by setting CYGNUM_SNMPAGENT_TESTS_ITERATIONSto something big (e.g., 999999). Build the test(<BCLASS="COMMAND">make -C net/snmp/agent/current tests</B>)and run it on the target.</P><P>Then start several jobs, some for pinging the board (to makethe stats change) and some for interrogating the snmpd. Set $IPto whatever IP address the board has:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING"># in a root shell, for flood pingwhile(1)dateping -f -c 3001 $IPsleep 5ping -c 32 -s 2345 $IPend</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING"># have more than one of these going at oncesetenv MIBS allwhile (1)snmpwalk -OS $IP publicdateend</PRE></TD></TR></TABLE><P>Leave to run for a couple of days or so to test stability.</P><P>The test program can also test snmpd.conf support. It tries to build a minimalsnmpd.conf file on a RAM filesystem and passes it to the snmp sub-system. Withthis profile on target, the following snmp[cmd] (cmd=walk, get, set) shouldwork :</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">snmp[cmd] -v1 $IP crux $OIDsnmp[cmd] -v2 $IP crux $OIDsnmp[cmd] -v3 $IP -u root -L noAuthNoPriv $OIDsnmp[cmd] -v3 $IP -u root -L authNoPriv -A MD5 -a md5passwd $OID</PRE></TD></TR></TABLE><P>The following commands would however fail since they violate the access model :</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">snmp[cmd] $IP public $OIDsnmp[cmd] -v1 $IP public $OIDsnmp[cmd] -v2c $IP public $OIDsnmp[cmd] -v3 $IP -u no_user -L noAuthNoPriv $OIDsnmp[cmd] -v3 $IP -u root -L authNoPriv -A MD5 -a badpasswd $OID</PRE></TD></TR></TABLE></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="net-snmp-configuring-ecos.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="net-snmp-clients-and-package-use.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Configuring eCos</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="net-snmp-ecos-port.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">SNMP clients and package use</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -