0

I have successfully managed to use opendaylight snmp-get REST API to get some configuration information from a network device. However, right now I have difficulty setting an integer value through snmp-set API.

The given example in the plugin documentation works on strings as follows:

   {
           "input": {
               "ip-address": "10.86.3.13",
               "oid" : "1.3.6.1.2.1.1.1.0",
               "value" : "Sample description",
               "community" : "private"
           }   
 }

For my case, this is the json code (the focus on the "value" field):

{
               "input": {
                   "ip-address": "some IP addr",
                   "oid" : "some OID",
                   "value" : 255,
                   "community" : "private"
               }   
     }

This is the error that I get when try using with an integer value:

{
       "errors": {
           "error": [
               {
                   "error-type": "application",
                   "error-tag": "operation-failed",
                   "error-message": "SnmpSET failed with error status: 3, error index: 0. StatusText: Bad Value"
               }
           ]
       }
   } 

Maybe I am doing something wrong or the integer type is not yet supported.

Any input is appreciated.

OiaSam
  • 560
  • 7
  • 19
  • Integer type? your value is string. – rkosegi Nov 15 '16 at 06:20
  • @rkosegi That was the example from the documentation, let me edit the question for more clarity. – OiaSam Nov 15 '16 at 06:33
  • You can look at source code : https://github.com/opendaylight/snmp/blob/master/snmp/src/main/java/org/opendaylight/snmp/plugin/internal/AsyncSetHandler.java#L54 it looks like it always wrap input into OctetString – rkosegi Nov 15 '16 at 06:38
  • @rkosegi, you are right. But in general, value type for snmp set should be specified and matched to the type that the snmp agent expects. If it is always wrapped into OctectString, then my guess the plugin does not yet support other than string type setting. what do you think? – OiaSam Nov 15 '16 at 06:53
  • You can ask on `ask.opendaylight.org` or if you believe that this is bug, then create report at `bugs.opendaylight.org` – rkosegi Nov 15 '16 at 06:57
  • Thanks for your input – OiaSam Nov 15 '16 at 07:03

1 Answers1

0

The odl-snmp-plugin is currently (Boron) very rudimentary. It has no MIB information and takes no value type hints in the RPCs so all it can do is always map to OctetString.

donaldh
  • 833
  • 1
  • 8
  • 14