Giter Club home page Giter Club logo

Comments (11)

soniah avatar soniah commented on May 30, 2024

👍 Thanks MrSpock. Yes it's a feature I'd like to add, I'll keep this issue open. We're all pretty busy (you, me, others on the gosnmp project). Perhaps you'd like to submit a pull request? Otherwise I'll get onto this when I next have a holiday :-)

from gosnmp.

soniah avatar soniah commented on May 30, 2024

PS Would you mind sending a couple of packet captures of doing some SNMP string sets? That would help for developing the code (TDD - Test Driven Development).

How to do packet captures is detailed in the readme.

Thanks, Sonia.

from gosnmp.

MrSpock avatar MrSpock commented on May 30, 2024

Sonia,
I have few days of holiday and I'm already sitting with wireshark pcap files from my SNMP session and maybe I will submit push request before your next holidays :)

from gosnmp.

MrSpock avatar MrSpock commented on May 30, 2024

Sonia,
Since I needed this really hard after ~1.5h with tcpdump and wireshark I made it :)
I've made code for SNMP Set OctetString and String (they are the same on PDU layer since string is sent as bytes).
It works for me and you can set either Octet String (not always printable chars you have to send) or strings.
Example when creating SnmpPDU:
// set string
pdu := []gosnmp.SnmpPDU{gosnmp.SnmpPDU{oid, gosnmp.OctetString, "foo"}}
// set bytes (not necessary readable string. Any 0x0-0xff is ok in SNMP OctetString)
pdu := []gosnmp.SnmpPDU{gosnmp.SnmpPDU{oid, gosnmp.OctetString, []byte{0x62, 0x61, 0x72}}}

I made pull request.

from gosnmp.

soniah avatar soniah commented on May 30, 2024

Thanks Marcin, I'm working on the patch at the moment. The pcap file - would you mind emailing it to me ([email protected]) or putting it somewhere I can download it?

I like to use TDD for gosnmp - catch all those corner cases. I'll use the pcap file to write a test.

from gosnmp.

MrSpock avatar MrSpock commented on May 30, 2024

Sonia,
First pcap is from native Linux snmputils snmpset and it sends 4 sets -two integers and two OctetStrings:
https://dl.dropboxusercontent.com/u/7660386/github/snmpset_native.pcap
Second is from my code (example used http://pastebin.com/WBW02b5F )
Here is pcap file:
https://dl.dropboxusercontent.com/u/7660386/github/snmpset_go.pcap

from gosnmp.

soniah avatar soniah commented on May 30, 2024

Thanks!

from gosnmp.

soniah avatar soniah commented on May 30, 2024

See also #30

from gosnmp.

soniah avatar soniah commented on May 30, 2024

Hi Marcin, would you mind doing the following, to make writing the tests easier:

  • do the snmpset as one command (ie set 4 values at once), rather than 4 separate sets
  • tell me what the snmpset commandline is, so I can see what types and what expected values are being used. For example see [1], but use v2c, numeric options rather than ascii for OIDs, and not the equals format. For example snmpset -c private -v 1 test-hub system.sysContact.0 s [email protected] gers.edu ip.ipforwarding.0 = 2
  • send me a URL to the pcap for that

Thanks very much for your help :-)

[1] http://www.linuxcommand.org/man_pages/snmpset1.html

from gosnmp.

MrSpock avatar MrSpock commented on May 30, 2024

Sonia,

Here is command:
snmpset -c private -v2c 10.80.0.14 .1.3.6.1.4.1.2863.205.10.1.33.2.5.1.2.2 i 5001 .1.3.6.1.4.1.2863.205.10.1.33.2.5.1.3.2 i 5001 .1.3.6.1.4.1.2863.205.10.1.33.2.5.1.4.2 i 2 .1.3.6.1.4.1.2863.205.10.1.33.2.5.1.5.2 i 1

Here is resulted file.

https://dl.dropboxusercontent.com/u/7660386/github/snmp_multiset.pcap

I don't know why snmpset repeates queries. Device which receives them respond slow so maybe this is somehow related to timeout. However packet content is ok and this is nice example of multiple varbinds in one packet.

from gosnmp.

soniah avatar soniah commented on May 30, 2024

Thanks very much! Tests written, merged. Would you mind sending a pcap for a couple of ipaddress sets and and the snmpset command line, so I can write the tests :-)

(I've rebased your set_ipaddress branch)

from gosnmp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.