Re: A very basic question

Juergen Schoenwaelder (schoenw@cs.utwente.nl)
Mon, 6 May 1996 13:32:51 +0200

Hi!

"Bjorn J. Villa" <Bjorn.J.Villa@delab.sintef.no> wrote:

> I am sorry to ask you such a childish question, but I do it anyway.
>
> How do I make SNMP SET operation with scotty ?
>
> I try: snmp# set sysDescr.0 TESTDESCR
>
> ......without any luck.

The syntax for this command is:

snmp# set varlist [callback]

So you have to build a varbind list. A varbind list is a Tcl list of
varbinds. A varbind is again a Tcl list which contains three elements:
The label or object identifier of an instance, the ASN.1 syntax of the
instance and its value. For example:

1.3.6.1.2.1.1.1.0 {OCTET STRING} {some text here}

This is what I call a fully qualified varbind. You can however omit
some parts: The syntax element can be omitted if the MIB module can
provide this information. The value can be omitted if you are going to
read a value. Therefore,

1.3.6.1.2.1.1.1.0 {some text here}
and
1.3.6.1.2.1.1.1.0
or
sysDescr.0

are all legal varbinds. The last one however is only useful for
reading values. Now, it should be hopefully more obvious how to do a
set operation. The safest way to do this (avoiding the Tcl quoting
hell) is to use the following code fragment:

snmp# set [list [list sysDescr.0 "some text"]]

The list commands make sure that the list elements are quoted
correctly.

Juergen