<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>logIt &#187; emulator</title>
	<atom:link href="https://lakm.us/logit/tag/emulator/feed/" rel="self" type="application/rss+xml" />
	<link>https://lakm.us/logit</link>
	<description>Log Around The Clock</description>
	<lastBuildDate>Sat, 06 Jun 2015 14:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Hello World with JamVM Embedded JVM on Ubuntu ARM</title>
		<link>https://lakm.us/logit/2011/12/hello-world-with-jamvm-embedded-jvm-on-ubuntu-arm/</link>
		<comments>https://lakm.us/logit/2011/12/hello-world-with-jamvm-embedded-jvm-on-ubuntu-arm/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 09:53:19 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ARMv7]]></category>
		<category><![CDATA[embedded system]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JVM]]></category>
		<category><![CDATA[QEMU]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=380</guid>
		<description><![CDATA[While waiting for my BeagleBoard xM shipment, I was considering Java as one of the possible application platforms. Anyhow, the keyword &#8220;embedded Java ARM&#8221; landed me to the tiny JamVm. This JVM is said to be working with ARM Cortex A8 which can be emulated under QEMU running Ubuntu ARM. The fact that there had [...]]]></description>
				<content:encoded><![CDATA[<p>While waiting for my <a href="http://beagleboard.org/hardware-xM" title="http://beagleboard.org/hardware-xM" target="_blank">BeagleBoard xM</a> shipment, I was considering Java as one of the possible application platforms. Anyhow, the keyword &#8220;embedded Java ARM&#8221; landed me to the tiny <a href="http://jamvm.sourceforge.net/" title="http://jamvm.sourceforge.net/" target="_blank">JamVm</a>. This JVM is said to be working with <a href="http://en.wikipedia.org/wiki/ARM_Cortex-A8" title="http://en.wikipedia.org/wiki/ARM_Cortex-A8" target="_blank">ARM Cortex A8</a> which can be emulated under <a href="./2011/11/ubuntu-on-qemu-processor-emulator/" title="Ubuntu on QEMU Processor Emulator" target="_blank">QEMU running Ubuntu ARM</a>. The fact that there had been already a Karmic image that work with QEMU would shorten the time.</p>
<p>A &#8220;Hello World&#8221; class to test the JVM will be:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> HelloWorldJamVM <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hello world&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>saved as <code>HelloWorldJamVM.java</code>. However, executing a &#8220;Hello World&#8221; requires longer steps than writing that class.</p>
<p>In order for the JamVM 1.5.4 to run on Ubuntu, we need (1) <code>build-essential</code> (certainly so) and (2) <a href="http://gcc.gnu.org/java/ " title="The GNU Compiler for Java" target="_blank">GCJ</a> with dependency of (3) <code>zlib1g-dev</code>. It&#8217;s all available in the Karmic ARM repo. Another thing that we need is <a href="http://www.gnu.org/software/classpath/classpath.html" title="GNU Classpath" target="_blank">GNU Classpath 0.98</a>.</p>
<p>Following the instruction, as <code>root</code> we can then <code>configure, make, make install, make install-strip</code> sources under <code>jamvm-1.5.4</code> directory. Continue them with the <code>classpath-0.98</code> sources by configuring as follow</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--disable-gtk-peer</span> <span style="color: #660033;">--disable-gconf-peer</span> <span style="color: #660033;">--disable-plugin</span> <span style="color: #660033;">--disable-Werror</span></pre></div></div>

<p>and then <code>make install</code> as usual. The whole compiling will run slow for sure as QEMU emulates ARM far from nearing native processor performance in my case.</p>
<p>We can compile the above &#8220;Hello World&#8221; using GCJ with the command <code>javac</code>, which is actually linked to <code>/usr/bin/gcj-wrapper-4.4</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">javac HelloWorldJamVM.java</pre></div></div>

<p>A <code>HelloWorldJamVM.class</code> bytecode file will appear and we can run this with JamVM</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PATH</span>=<span style="color: #007800;">$PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>jamvm<span style="color: #000000; font-weight: bold;">/</span>bin 
<span style="color: #7a0874; font-weight: bold;">export</span> PATH
jamvm HelloWorldJamVM</pre></div></div>

<div class="wp-caption alignleft" style="width: 510px"><img alt="qemu-ubuntu-arm-cortex-a8-running-jamvm-embedded-jvm.jpg" src="../../../../images/qemu-ubuntu-arm-cortex-a8-running-jamvm-embedded-jvm.jpg" title="QEMU with Ubuntu ARM Cortex A8 running JamVM embedded JVM" width="450" height="261" /><p class="wp-caption-text">QEMU with Ubuntu ARM Cortex A8 running JamVM embedded JVM</p></div>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2011/12/hello-world-with-jamvm-embedded-jvm-on-ubuntu-arm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu ARM on QEMU Processor Emulator</title>
		<link>https://lakm.us/logit/2011/11/ubuntu-on-qemu-processor-emulator/</link>
		<comments>https://lakm.us/logit/2011/11/ubuntu-on-qemu-processor-emulator/#comments</comments>
		<pubDate>Sun, 27 Nov 2011 04:14:55 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ARMv7]]></category>
		<category><![CDATA[embedded system]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[Lucid]]></category>
		<category><![CDATA[OMAP3]]></category>
		<category><![CDATA[QEMU]]></category>
		<category><![CDATA[rootfs]]></category>
		<category><![CDATA[RootStock]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://xp-racy.lan/it/?p=300</guid>
		<description><![CDATA[There are times when you need to try things on virtualized environment before hand e.g. 1) checking application functionality or 2) actual device shipment is still on its long way. Those were also my cases with ARM Linux. Unlike virtualization in production environment however, putting software to emulate CPU architecture will slow down the guest [...]]]></description>
				<content:encoded><![CDATA[<p>There are times when you need to try things on virtualized environment before hand e.g. 1) checking application functionality or 2) actual device shipment is still on its long way. Those were also my cases with ARM Linux. Unlike virtualization in production environment however, putting software to emulate CPU architecture will slow down the guest machine a lot.</p>
<p>Ready-to-use image for from the old Ubuntu 9.10 Karmic is avalaible as suggested in <a href="https://wiki.ubuntu.com/ARM/RootfsFromScratch">RootStock Wiki</a> .</p>
<p>To run Ubuntu 10,04 Lucid you can create similar <code>.img</code> filled by RootStock generated root file system as described in <a href="../2011/10/running-ubuntu-on-devkit8500d-natty-kernel-and-lucid-rootfs/">this post</a> generating <code>lucid-arm.img</code>. Boot image is obtained from <a href="http://ports.ubuntu.com/dists/lucid/main/installer-armel/current/images/versatile/netboot/vmlinuz">Lucid port page</a>, of which I saved with the name <code>vmlinuz-lucid-current-ports</code> which is actually linux kernel 2.6.32-21. Running QEMU is then:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">qemu-system-arm <span style="color: #660033;">-M</span> versatilepb <span style="color: #660033;">-cpu</span> cortex-a8 \
  <span style="color: #660033;">-kernel</span> vmlinuz-lucid-current-ports \
  <span style="color: #660033;">-hda</span> lucid-arm.img <span style="color: #660033;">-m</span> <span style="color: #000000;">256</span> <span style="color: #660033;">-append</span> <span style="color: #ff0000;">&quot;root=/dev/sda mem=256M devtmpfs.mount=0 rw&quot;</span></pre></div></div>

<p>However, adding <code>-redir tcp:3232::22</code> isn&#8217;t directly working (although <code>telnet</code> is showing both directions are functional). This redirection is working with the Karmic image which gives instant <code>ssh</code> on my host laptop as in:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> localhost <span style="color: #660033;">-oPort</span>=<span style="color: #000000;">3232</span> <span style="color: #660033;">-l</span> ubuntu</pre></div></div>

<p>Note: successful QEMU machine image probably won&#8217;t boot successfully with the real board. I can&#8217;t use kernel 2.6.38-10 for Lucid rootfs on QEMU, but successfully boot that on DevKit8500D board.</p>
<div class="wp-caption aligncenter" style="width: 510px"><img alt="qemu-ubuntu-10.04-lucid-kernel-2.6.32-21.jpg" src="../../../../images/qemu-ubuntu-10.04-lucid-kernel-2.6.32-21.jpg" title="qemu-ubuntu-10.04-lucid-kernel-2.6.32-21.jpg" class="aligncenter" width="480" height="435" /><p class="wp-caption-text">QEMU console of Ubuntu 10.04 VM</p></div>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2011/11/ubuntu-on-qemu-processor-emulator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Raddle (2): snmpd &amp; Replay Custom Private Enterprise MIB</title>
		<link>https://lakm.us/logit/2011/08/running-raddle-2-snmpd-replay-custom-private-enterprise-mib/</link>
		<comments>https://lakm.us/logit/2011/08/running-raddle-2-snmpd-replay-custom-private-enterprise-mib/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 03:13:44 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=217</guid>
		<description><![CDATA[Net-SNMP wiki gives tutorial on extending snmpd using Perl. In basic run of Raddle (previous post) this involves r1.pl called by r1.conf fed to snmpd. Private enterprise MIB i.e. Microchip&#8217;s in this example can be replayed without really ever captured the real device&#8217;s SNMP data. This is necessary when the actual device is yet existed; normal [...]]]></description>
				<content:encoded><![CDATA[<p>Net-SNMP wiki gives tutorial on 	<a href="http://www.net-snmp.org/wiki/index.php/Tut:Extending_snmpd_using_perl">extending <code>snmpd</code> using Perl</a>. In basic run of Raddle (<a href="./215/running-raddle-in-rhel/">previous post</a>) this involves <code>r1.pl</code> called by <code>r1.conf</code> fed to <code>snmpd</code>. Private enterprise MIB i.e. <a href="http://read.pudn.com/downloads133/sourcecode/embed/567121/TCPIP%20Demo%20App/mchip.mib__.htm" target="_blank">Microchip&#8217;s </a>in this example can be replayed without really ever captured the real device&#8217;s SNMP data. This is necessary when the actual device is yet existed; normal situation when developing.  There are two simple ways of replaying this artificial SNMP data over which either way requires correct OID.</p>
<p>First put the <code>Microchip.TXT</code> (the MIB file) under <code>/usr/share/snmp/mibs</code> to easily exchange OID canonical form and name vice versa while making dummy. In this case I&#8217;ve modify the MIB to have some additional object i.e. <code>name</code>:<br />
<code>$ snmptranslate -m +Microchip -On Microchip::name<br />
.1.3.6.1.4.1.17095.1.1</code><br />
so we can then use this correct OID for our dummy.</p>
<p>How?</p>
<ol>
<li>use <code>SetMIBValue()</code> in <code>r1.pl</code>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #0000ff;">$agent</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">SetMIBValue</span><span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">'.1.3.6.1.4.1.17095.1.1'</span><span style="color: #339933;">,</span> ASN_OCTET_STR<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Microchip&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$agent</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">SetMIBValue</span><span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">'.1.3.6.1.4.1.17095.3.13'</span><span style="color: #339933;">,</span> ASN_INTEGER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">82</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>Feed <code>r1.snmp </code>for playing as in

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #0000ff;">$agent</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">ParseDataFile</span><span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">'/usr/local/etc/snmp-emulator/r1.snmp'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span></pre></div></div>

<p>with the content of</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.1.3.6.1.4.1.17095.1.1 = STRING: Microchip
.1.3.6.1.4.1.17095.3.13 = INTEGER: <span style="color: #000000;">82</span></pre></div></div>

</li>
</ol>
<p>In all above two examples we can only <code>GET</code> for Raddle to return an answer for each OID. <code>GETNEXT</code> as in bulk <code>snmpwalk</code> won&#8217;t give output because they are not sequenced.</p>
<p>A sample of sequenced data inside a real <code>snmpwalk</code> dump is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpwalk <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public <span style="color: #660033;">-On</span> localhost
&nbsp;
.1.3.6.1.2.1.1.1.0 = STRING: Linux xp-racy 2.6.38-<span style="color: #000000;">10</span>-generic <span style="color: #666666; font-style: italic;">#46~lucid1-Ubuntu SMP Wed Jul 6 18:40:11 UTC 2011 i686</span>
.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.8072.3.2.10
.1.3.6.1.2.1.1.3.0 = Timeticks: <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">496371</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1</span>:<span style="color: #000000;">22</span>:<span style="color: #000000;">43.71</span>
.1.3.6.1.2.1.1.4.0 = STRING: Root  <span style="color: #7a0874; font-weight: bold;">&#40;</span>configure <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>snmp<span style="color: #000000; font-weight: bold;">/</span>snmpd.local.conf<span style="color: #7a0874; font-weight: bold;">&#41;</span>
.1.3.6.1.2.1.1.5.0 = STRING:
.1.3.6.1.2.1.1.6.0 = STRING: Unknown <span style="color: #7a0874; font-weight: bold;">&#40;</span>configure <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>snmp<span style="color: #000000; font-weight: bold;">/</span>snmpd.local.conf<span style="color: #7a0874; font-weight: bold;">&#41;</span>
.1.3.6.1.2.1.1.8.0 = Timeticks: <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">0</span>:00:<span style="color: #000000;">00.00</span>
.1.3.6.1.2.1.1.9.1.2.1 = OID: .1.3.6.1.6.3.10.3.1.1
.1.3.6.1.2.1.1.9.1.2.2 = OID: .1.3.6.1.6.3.11.3.1.1</pre></div></div>

<p>thus, we can only</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpget <span style="color: #660033;">-m</span> +Microchip <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public localhost Microchip::control.13
Microchip::control.13 = INTEGER: <span style="color: #000000;">82</span></pre></div></div>

<p>or from other system with no Microchip MIB use</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpget <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public 192.168.40.105 .1.3.6.1.4.1.17095.3.13
SNMPv2-SMI::enterprises.17095.3.13 = INTEGER: <span style="color: #000000;">82</span></pre></div></div>

<p>The tree below may visually explains sequenced data for <code>GETNEXT</code> where our Microchip is branched at <code>private.enterprises.microchip</code> :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmptranslate <span style="color: #660033;">-m</span> +Microchip <span style="color: #660033;">-Tp</span>
&nbsp;
+--iso<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
   <span style="color: #000000; font-weight: bold;">|</span>
   +--org<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
      <span style="color: #000000; font-weight: bold;">|</span>
      +--dod<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">6</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
         <span style="color: #000000; font-weight: bold;">|</span>
         +--internet<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>
            +--directory<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>
            +--mgmt<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>  +--mib-<span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>     +--system<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
...
            +--private<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
...
            <span style="color: #000000; font-weight: bold;">|</span>  +--enterprises<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>
...
            <span style="color: #000000; font-weight: bold;">|</span>     +--microchip<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">17095</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>        +--product<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span></pre></div></div>

<p>How <code>GET</code> and <code>GETNEXT</code> appeared in SNMP can be viewed by running snmpd in debug mode with this options:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpd <span style="color: #660033;">-m</span> +Microchip <span style="color: #660033;">-f</span> <span style="color: #660033;">-L</span> <span style="color: #660033;">-V</span> <span style="color: #660033;">-C</span> <span style="color: #660033;">-I</span> vacm_vars <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>snmp-emulator<span style="color: #000000; font-weight: bold;">/</span>r1.conf
NET-SNMP version 5.3.1
Connection from UDP: <span style="color: #7a0874; font-weight: bold;">&#91;</span>127.0.0.1<span style="color: #7a0874; font-weight: bold;">&#93;</span>:<span style="color: #000000;">32770</span>
Received SNMP packet<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span> from UDP: <span style="color: #7a0874; font-weight: bold;">&#91;</span>127.0.0.1<span style="color: #7a0874; font-weight: bold;">&#93;</span>:<span style="color: #000000;">32770</span>
  GET message
    <span style="color: #660033;">--</span> control.13</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2011/08/running-raddle-2-snmpd-replay-custom-private-enterprise-mib/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Raddle in RHEL</title>
		<link>https://lakm.us/logit/2011/08/running-raddle-in-rhel/</link>
		<comments>https://lakm.us/logit/2011/08/running-raddle-in-rhel/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 07:43:05 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[install-deinstall]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=215</guid>
		<description><![CDATA[Raddle is a great SNMP player written in Perl. I say player to this emulator application, meaning that I can append or dump snmpwalk output from a device and then replay that from Raddle. Installing it can be both simple and tedious tasks. I used Red Hat Enterprise Linux 5.2 inside a virtual machine (VirtualBox) [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://raddle.sourceforge.net/" target="_blank">Raddle</a> is a great SNMP player written in Perl. I say player to this emulator application, meaning that I can append or dump <code>snmpwalk</code> output from a device and then replay that from Raddle. Installing it can be both simple and tedious tasks. I used Red Hat Enterprise Linux 5.2 inside  a virtual machine (VirtualBox) to make it compact without interfering my own host <code>snmpd</code> setting.</p>
<p>net-SNMP packages are required for Raddle to work on top of primarily <code>snmpd</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> net-snmp net-snmp-utils</pre></div></div>

<p>Prior to installation some rpm packages must be downloaded separately as my local repo (created from original RHEL CD images) may not contain them. They are installed as follow:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rpm <span style="color: #660033;">-i</span> perl-Carp-Clan-<span style="color: #000000;">6.00</span>-1.el4.rf.noarch.rpm
rpm <span style="color: #660033;">-i</span> perl-Bit-Vector-<span style="color: #000000;">6.4</span>-2.el5.rf.i386.rpm
rpm <span style="color: #660033;">-i</span> perl-Crypt-DES-<span style="color: #000000;">2.05</span>-3.2.el5.rf.i386.rpm
rpm <span style="color: #660033;">-i</span> perl-Digest-SHA1-<span style="color: #000000;">2.11</span>-1.el5.rf.i386.rpm
rpm <span style="color: #660033;">-i</span> perl-Digest-HMAC-<span style="color: #000000;">1.01</span>-2.2.el5.rf.noarch.rpm
rpm <span style="color: #660033;">-i</span> perl-Socket6-<span style="color: #000000;">0.20</span>-1.el5.rf.i386.rpm
rpm <span style="color: #660033;">-i</span> perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch.rpm
rpm <span style="color: #660033;">-i</span> perl-Date-Pcalc-<span style="color: #000000;">1.2</span>-1.2.el5.rf.noarch.rpm
rpm <span style="color: #660033;">-i</span> perl-Date-Calc-<span style="color: #000000;">5.4</span>-1.el5.rf.i386.rpm</pre></div></div>

<p>continued by installing <code>net-snmp-perl</code> from original repo</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> net-snmp-perl</pre></div></div>

<p>Uncompressing Raddle and successful <code>make test</code> will mean installation is good and can be finished by <code>make install</code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> Net-Raddle-<span style="color: #000000;">0.08</span>
<span style="color: #c20cb9; font-weight: bold;">perl</span> Makefile.PL
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #7a0874; font-weight: bold;">test</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<h1>Replaying SNMP Packets</h1>
<p>The idea is to run <code>snmpd</code> which replays a specific prepared-SNMP-packets instead of our own real time system SNMP data (in this case the condition of RHEL 5.2 host). There are three files to do that, let&#8217;s name them <code>r1.*</code>:</p>
<ol>
<li><code>r1.snmp</code><br />
A capture from i.e.<br />
<code>snmpwalk -v 1 -c &lt;community string&gt; -OneU &lt;device&gt; &gt; r1.snmp</code></li>
<li><code>r1.conf</code><br />
<code>snmpd</code> will run this instead of the original OS default:<br />
<code>snmpd -C -I vacm_vars -c /usr/local/etc/snmp-emulator/r1.conf</code></li>
<li><code>r1.pl</code><br />
the perl script where the most basic is to just replay the above <code>r1.snmp</code></li>
</ol>
<p>An official documentation to replay SNMP can be found <a href="http://raddle.sourceforge.net/docs/SNMPAgent.html" target="_blank">here</a>. I got hold back when trying to listen from other host, it turns out that I must remove the localhost section in <code>r1.conf</code> which will make it to use standard port 161 as well</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Listen on port 9501</span>
<span style="color: #666666; font-style: italic;">#agentaddress    udp:localhost:9501,tcp:localhost:9501</span></pre></div></div>

<p>It is also wise to always cut the <code>r1.snmp</code> first to see if the perl works (test with <code>perl -w /usr/local/etc/snmp-emulator/r1.pl</code>) either with warning or clean, meaning no problem with just some of the OIDs found inside the file.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2011/08/running-raddle-in-rhel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
