Closed lextudio-support closed 3 hours ago
Copied from CodePlex without authors:
http://tools.cisco.com/Support/SNMP/do/BrowseMIB.do?local=en&step=2&mibName=CISCO-TC-V1SMI
You have to know what is CiscoNetworkAddress
first. Cisco makes it a complex data type from OCTET STRING, and it can of course store 4 octets for IP addresses.
The sample app does not attempt to further analyze the type, so it always prints it out as strings.
Original Posted Date: 2013-06-02T16:00:58.067-07:00
Copied from CodePlex without authors:
You are right about the complex data type that requires further processing. By checking the cdpNeighborAddressType, implementation may decide on the processing logic. In my case, the return type is type=1 indicating that it is 4 octet IP. What I don't get was that the content of the return "variable" from Messenger.[Get] were the same first three octet as 63 from different devices. Also, I have verified that the device's return data are good by using a mib browser. Any suggestions?
Original Posted Date: 2013-06-02T21:21:21.337-07:00
Copied from CodePlex without authors:
** Closed by lextm 06/02/2013 4:02PM
Original Posted Date: 2013-06-02T16:02:19.653-07:00
Copied from CodePlex without authors:
https://sharpsnmplib.codeplex.com/wikipage?title=600008&referringTitle=KB
You might capture network packets as KB600008 indicates. That should tell what's up.
Original Posted Date: 2013-06-03T04:38:34.907-07:00
Copied from CodePlex without authors:
I have attached two captures, one from each devices. The data returned from the devices are as follow OctetString: c0a8fe0c from 192.168.254.11 (which corresponds to the correct cdp neighbor) OctetString: c0a8fe0b from 192.168.254.12
The data returned from the devices as seen on the wire are correct. However, I could not get the same value from teh Messenger.[Get]
The code I used for converting the retrieved "variable" iss follow: Dim memStream As New MemoryStream(4) 'memStream.Write(Encoding.Default.GetBytes(variable.Data.ToString), 0, 4) memStream.Write(Encoding.ASCII.GetBytes(variable.Data.ToString), 0, 4) memStream.Seek(0, SeekOrigin.Begin) Dim binReader As New BinaryReader(memStream) Dim testArray As Byte() = {0, 0, 0, 0} Dim count As Integer = binReader.Read(testArray, 0, 4) Console.WriteLine(testArray(0).ToString & "." & testArray(1).ToString & "." & testArray(2).ToString & _ "." & testArray(3).ToString)
I have tried diferent encoding scheme including ASCII, Unicode, UTF7, UTF8. The converted value does not corresponding to the captured result. Thanks for looking into this matter.
Original Posted Date: 2013-06-03T08:53:10.91-07:00
Copied from CodePlex without authors:
Your code is wrong. You should use OctetString.GetRaw()
to access the raw bytes. That's the only way you won't get distorted data.
Original Posted Date: 2013-06-03T15:14:26.933-07:00
Original Closed Date: 2013-06-03T15:15:22.843-07:00
Using sample application "snmpget" to retrieve the cdpCacheAddress (1.3.6.1.4.1.9.9.23.1.2.1.1.4), the return result is not correct. The return type is CiscoNetworkAddress which is OctetString and in my test case it is 4 octets IP address. The test on two Cisco devices always returned the same results in the first three octets. The last octets appears to match the 4th octet of the device's IP address.
For example: using the snmpget sample application with the following command line argument: -v=2 -c=public 192.168.254.11 .1.3.6.1.4.1.9.9.23.1.2.1.1.4.10003.1 The output received was as follow: Variable: Id: .1.3.6.1.4.1.9.9.23.1.2.1.1.4.10003.1; Data: ??? convert the Data to string: 63.63.63.11
using the snmpget sample application with the following command line argument: -v=2 -c=public 192.168.254.12 .1.3.6.1.4.1.9.9.23.1.2.1.1.4.8.2 The output received was as follow: Variable: Id: .1.3.6.1.4.1.9.9.23.1.2.1.1.4.8.2; Data: ??? convert the Data to string: 63.63.63.12
The code snippet from sample application snmpget: For Each variable As Variable In Messenger.[Get](version, receiver, New OctetString(community), vList, timeout) Console.WriteLine(variable) Next
I tried converting the returned result in different way, but I suspect the result from the call to Messenger.[Get] was wrong to begin with.
Information on cdpCacheAddress: http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?objectInput=.1.3.6.1.4.1.9.9.23.1.2.1.1.4.&translate=Translate&submitValue=SUBMIT&submitClicked=true
Original Reported Date: 2013-06-02T08:56:45.193-07:00 Planned For Release: Original CodePlex ID: 7256