0

There is one simulator available using pySNMP called SNMP simulator.

It sets a default context name value. Is there anyway to set custom context name value for snmpv3 ?

Here is an extract from snmpsimd.py where i tried to give context name value.

config.addContext(snmpEngine, '')

Giving value as custom parameter is not setting value there.

Antarus
  • 1,573
  • 2
  • 15
  • 32

1 Answers1

1

If you are building an Agent, you should register your contextName at SnmpContext class instance. See examples here and here.

If your app is a Manager based on pysnmp's high-level API, you should pass contextName to getCmd/setCmd(). See example an here (search for contextName).

Please clarify your task if my suggestions do not help.

Pooh
  • 244
  • 1
  • 2
  • The addContext() function just adds your new contextName into a table of contextNames potentially available at this Agent. So it has a purely informational purpose and optional nature. – Pooh Dec 04 '12 at 08:12
  • I'm using a simulator written by Ilya Etingof. The file name is [snmpsimd.py](http://pypi.python.org/packages/source/s/snmpsim/snmpsim-0.1.5.tar.gz) I tried passing a parameter to `config.addContext(snmpEngine, 'test-parameter-context')` But still the context name remains the same. – Antarus Dec 04 '12 at 09:43
  • Your intention is still not clear to me. Do you need to change SNMP simulator somehow? What is your ultimate goal? Please explain or it would be really hard to help out. – Pooh Dec 04 '12 at 20:26
  • Aim -> change context name of simulator. The link above is the code for the simulator. Pasting it here will be pretty long. – Antarus Dec 05 '12 at 04:19
  • If you need to configure additional contextName to snmpEngine, use the snmpContext.registerContextName(contextName, mibInstrum) call. It will register a MIB subtree under particular contextName (which is a string). – Ilya Etingof Dec 07 '12 at 17:27