Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

2014-01-16 Thread Garcia, Maurice
Thank you and for your quick response!

Sent from my iPhone

 On Jan 16, 2014, at 2:24 AM, Frank Fock f...@agentpp.com wrote:
 
 Hi Maurice,
 
 Ok, it was a bit harder to implement it in a generic way than I thought 
 firstly.
 The escaping has to be done very carefully ;-)
 
 You can download version 1.1.1 which provides the option to set your own 
 quotes
 and corresponding escape sequences.
 
 I have put the most commonly used configuration options on the SNMP4J-SMI -FAQ
 at:
 https://oosnmp.net/confluence/pages/viewpage.action?pageId=5799981
 
 Best regards,
 Frank
 
 Am 15.01.2014 20:12, schrieb Garcia, Maurice:
 Thanks for the update!!!  Works great.
 
 Can the (double quote) be configurable to another character via the API?  My 
 lexer/parser interprets the double quote for another purpose.
 
 Here is an example of the configuration that will be ingested by the 
 application.
 
 I was going to try and do some preprocessing of the file and do a find and 
 replace with a tick (`) or something else, but if there is a way to do this 
 in the API that would be great.
 
 Snmp11 vacmAccessStorageType.readwritegroup..2.'noAuthNoPriv(1)' 
 Integer32 2; /* TLV: [11]*/
 
 Thanks,
 
 Maurice
 
 -Original Message-
 From: Frank Fock [mailto:f...@agentpp.com]
 Sent: Tuesday, January 14, 2014 3:10 PM
 To: Garcia, Maurice; snmp4j@agentpp.org
 Cc: Flickinger, Allen
 Subject: Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName
 
 Hi Maurice,
 
 Sorry, it was some error in the packaging which removed the innerclass enums.
 I have fixed the packaging and you can download the new version now.
 If you have problems downloading it through the original link because some 
 proxies are caching the old version then you may try this copy 
 http://www.snmp4j.com/smi/snmp4j-smi-1.1a-dist.zip
 (Same file but with an a in the name).
 
 Best regards,
 Frank
 
 
 Am 14.01.2014 19:47, schrieb Garcia, Maurice:
 Frank,
 
 I updated both SMI to 1.1 and SNMP4J to 2.2.3, removed the old JARS, clean 
 and rebuild.
 
 When implementing the setOidFormat I see the new ENUM 
 ObjectNameAndDecodedIndex4RoundTrip in the java doc but I am unable to 
 implement.
 
 Eclipse does not see it.  I looked at the examples, but I don't see how to 
 start it out.
 
 This is the  old way:
 smiManager.setOidFormat(SmiManager.OIDFormat.ObjectNameAndDecodedIndex
 );
 
 But I assume this is the new way:
 smiManager.setOidFormat(SmiManager.OIDFormat.ObjectNameAndDecodedIndex
 4RoundTrip);
 
 If this is the intention, then I will need to review my BuildPath or how I 
 am adding the external jars.
 
 I reverted back to the old Versions 2.2.0 and 1.0.1 and is working
 again, without the new updates
 
 Thanks,
 
 Maurice
 
 -Original Message-
 From: Frank Fock [mailto:f...@agentpp.com]
 Sent: Monday, January 06, 2014 10:26 AM
 To: Garcia, Maurice; snmp4j@agentpp.org
 Subject: Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName
 
 Hi Maurice,
 
 SNMP4J-SMI 1.1 is ready for download now - if you have not recognized it 
 yet.
 The examples below are not valid any more, because I had to change the 
 format a little bit. See the SmiManager JavaDoc for the details:
 http://www.snmp4j.org/smi/doc/com/snmp4j/smi/SmiManager.html
 
 Best regards,
 Frank
 
 Am 04.01.2014 02:56, schrieb Frank Fock:
 Maurice,
 
 You got it right. The decoded index format without quotes that is
 currently implemented is not suitable for round-trip coding/decoding.
 The new (additional) format uses double quotes for non-implied length
 sub-indexes with variable length, DISPLAY-HINT, or enum label encoding.
 It uses single quotes for implied length non-numeric sub-index values.
 
 Some examples from the unit tests I wrote to verify the new format:
 
  OID vacmAccessContextMatch = new
 OID(1.3.6.1.6.3.16.1.4.1.4.7.118.51.103.114.111.117.112.0.3.1);
 assertEquals(vacmAccessContextMatch.'v3group'.''.3.'noAuthNoPriv(1)'
 , vacmAccessContextMatch.toString());
 
  assertEquals(vacmAccessContextMatch, new
 OID(vacmAccessContextMatch.'v3group'.''.3.'noAuthNoPriv(1)'));
 
  OID vacmViewTreeFamilyMask = new
 OID(1.3.6.1.6.3.16.1.5.2.1.3.20.117.110.114.101.115.116.114.105.99.1
 1 6.101.100.82.101.97.100.86.105.101.119.3.1.3.6);
 assertEquals(vacmViewTreeFamilyMask.'unrestrictedReadView'.'dod',
 vacmViewTreeFamilyMask.toString());
 
  OID vacmViewTreeFamilyMask2 = new
 OID(1.3.6.1.6.3.16.1.5.2.1.3.20.117.110.114.101.115.116.114.105.99.1
 1 6.101.100.82.101.97.100.86.105.101.119.4.1.3.6.4976);
 assertEquals(vacmViewTreeFamilyMask.'unrestrictedReadView'.'dod.4976'
 ,
 vacmViewTreeFamilyMask2.toString());
 
  OID vacmViewTreeFamilyMask3 = new
 OID(1.3.6.1.6.3.16.1.5.2.1.3.20.117.110.114.101.115.116.114.105.99.1
 1 6.101.100.82.101.97.100.86.105.101.119.4.9.3.6.4976);
 assertEquals(vacmViewTreeFamilyMask.'unrestrictedReadView'.'9.3.6.49
 7
 6',
 vacmViewTreeFamilyMask3.toString());
 
 Best regards,
 Frank
 
 
 Am 03.01.2014 16:28, schrieb Garcia, Maurice

Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

2014-01-15 Thread Garcia, Maurice
Thanks for the update!!!  Works great.

Can the (double quote) be configurable to another character via the API?  My 
lexer/parser interprets the double quote for another purpose.

Here is an example of the configuration that will be ingested by the 
application.

I was going to try and do some preprocessing of the file and do a find and 
replace with a tick (`) or something else, but if there is a way to do this in 
the API that would be great.

Snmp11 vacmAccessStorageType.readwritegroup..2.'noAuthNoPriv(1)' Integer32 
2;  /* TLV: [11]*/

Thanks,

Maurice

-Original Message-
From: Frank Fock [mailto:f...@agentpp.com] 
Sent: Tuesday, January 14, 2014 3:10 PM
To: Garcia, Maurice; snmp4j@agentpp.org
Cc: Flickinger, Allen
Subject: Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

Hi Maurice,

Sorry, it was some error in the packaging which removed the innerclass enums.
I have fixed the packaging and you can download the new version now.
If you have problems downloading it through the original link because some 
proxies are caching the old version then you may try this copy 
http://www.snmp4j.com/smi/snmp4j-smi-1.1a-dist.zip
(Same file but with an a in the name).

Best regards,
Frank


Am 14.01.2014 19:47, schrieb Garcia, Maurice:
 Frank,

 I updated both SMI to 1.1 and SNMP4J to 2.2.3, removed the old JARS, clean 
 and rebuild.

 When implementing the setOidFormat I see the new ENUM 
 ObjectNameAndDecodedIndex4RoundTrip in the java doc but I am unable to 
 implement.

 Eclipse does not see it.  I looked at the examples, but I don't see how to 
 start it out.

 This is the  old way:  
 smiManager.setOidFormat(SmiManager.OIDFormat.ObjectNameAndDecodedIndex
 );

 But I assume this is the new way: 
 smiManager.setOidFormat(SmiManager.OIDFormat.ObjectNameAndDecodedIndex
 4RoundTrip);

 If this is the intention, then I will need to review my BuildPath or how I am 
 adding the external jars.

 I reverted back to the old Versions 2.2.0 and 1.0.1 and is working 
 again, without the new updates

 Thanks,

 Maurice

 -Original Message-
 From: Frank Fock [mailto:f...@agentpp.com]
 Sent: Monday, January 06, 2014 10:26 AM
 To: Garcia, Maurice; snmp4j@agentpp.org
 Subject: Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

 Hi Maurice,

 SNMP4J-SMI 1.1 is ready for download now - if you have not recognized it yet.
 The examples below are not valid any more, because I had to change the format 
 a little bit. See the SmiManager JavaDoc for the details:
 http://www.snmp4j.org/smi/doc/com/snmp4j/smi/SmiManager.html

 Best regards,
 Frank

 Am 04.01.2014 02:56, schrieb Frank Fock:
 Maurice,

 You got it right. The decoded index format without quotes that is 
 currently implemented is not suitable for round-trip coding/decoding.
 The new (additional) format uses double quotes for non-implied length 
 sub-indexes with variable length, DISPLAY-HINT, or enum label encoding.
 It uses single quotes for implied length non-numeric sub-index values.

 Some examples from the unit tests I wrote to verify the new format:

  OID vacmAccessContextMatch = new 
 OID(1.3.6.1.6.3.16.1.4.1.4.7.118.51.103.114.111.117.112.0.3.1);
 assertEquals(vacmAccessContextMatch.'v3group'.''.3.'noAuthNoPriv(1)'
 , vacmAccessContextMatch.toString());

  assertEquals(vacmAccessContextMatch, new 
 OID(vacmAccessContextMatch.'v3group'.''.3.'noAuthNoPriv(1)'));

  OID vacmViewTreeFamilyMask = new
 OID(1.3.6.1.6.3.16.1.5.2.1.3.20.117.110.114.101.115.116.114.105.99.1
 1 6.101.100.82.101.97.100.86.105.101.119.3.1.3.6);
 assertEquals(vacmViewTreeFamilyMask.'unrestrictedReadView'.'dod',
 vacmViewTreeFamilyMask.toString());

  OID vacmViewTreeFamilyMask2 = new
 OID(1.3.6.1.6.3.16.1.5.2.1.3.20.117.110.114.101.115.116.114.105.99.1
 1 6.101.100.82.101.97.100.86.105.101.119.4.1.3.6.4976);
 assertEquals(vacmViewTreeFamilyMask.'unrestrictedReadView'.'dod.4976'
 ,
 vacmViewTreeFamilyMask2.toString());

  OID vacmViewTreeFamilyMask3 = new
 OID(1.3.6.1.6.3.16.1.5.2.1.3.20.117.110.114.101.115.116.114.105.99.1
 1 6.101.100.82.101.97.100.86.105.101.119.4.9.3.6.4976);
 assertEquals(vacmViewTreeFamilyMask.'unrestrictedReadView'.'9.3.6.49
 7
 6',
 vacmViewTreeFamilyMask3.toString());

 Best regards,
 Frank


 Am 03.01.2014 16:28, schrieb Garcia, Maurice:
 Frank,

 Sorry for all the questions L

 One more related to this email trail...

 I implemented the change you suggested and now the OID is resolved:

 Output - *vacmSecurityToGroupStatus.1.readwritesec*

 But when I reverse the process, it will not encode back to BER.

 OID 'vacmGroupName.1.readwritesec' cannot be parsed

 at org.snmp4j.smi.OID.parseDottedString(_OID.java:148_)

 at org.snmp4j.smi.OID.init(_OID.java:83_)

 at
 com.comcast.cpe.cfb.ber.BERService.setOIDEncoding(_BERService.java:1
 5
 2_)

 I am not sure if this is related to the bug you found that will be 
 fixed in 1.0.2, but it appear to be the round-trip index conversion 
 that you were talking about

Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

2014-01-14 Thread Garcia, Maurice
Frank,

I updated both SMI to 1.1 and SNMP4J to 2.2.3, removed the old JARS, clean and 
rebuild.

When implementing the setOidFormat I see the new ENUM 
ObjectNameAndDecodedIndex4RoundTrip in the java doc but I am unable to 
implement.

Eclipse does not see it.  I looked at the examples, but I don't see how to 
start it out.

This is the  old way:  
smiManager.setOidFormat(SmiManager.OIDFormat.ObjectNameAndDecodedIndex);

But I assume this is the new way: 
smiManager.setOidFormat(SmiManager.OIDFormat.ObjectNameAndDecodedIndex4RoundTrip);

If this is the intention, then I will need to review my BuildPath or how I am 
adding the external jars.

I reverted back to the old Versions 2.2.0 and 1.0.1 and is working again, 
without the new updates

Thanks,

Maurice

-Original Message-
From: Frank Fock [mailto:f...@agentpp.com] 
Sent: Monday, January 06, 2014 10:26 AM
To: Garcia, Maurice; snmp4j@agentpp.org
Subject: Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

Hi Maurice,

SNMP4J-SMI 1.1 is ready for download now - if you have not recognized it yet.
The examples below are not valid any more, because I had to change the format a 
little bit. See the SmiManager JavaDoc for the details:
http://www.snmp4j.org/smi/doc/com/snmp4j/smi/SmiManager.html

Best regards,
Frank

Am 04.01.2014 02:56, schrieb Frank Fock:
 Maurice,

 You got it right. The decoded index format without quotes that is 
 currently implemented is not suitable for round-trip coding/decoding.
 The new (additional) format uses double quotes for non-implied length 
 sub-indexes with variable length, DISPLAY-HINT, or enum label encoding.
 It uses single quotes for implied length non-numeric sub-index values.

 Some examples from the unit tests I wrote to verify the new format:

 OID vacmAccessContextMatch = new
 OID(1.3.6.1.6.3.16.1.4.1.4.7.118.51.103.114.111.117.112.0.3.1);
 assertEquals(vacmAccessContextMatch.'v3group'.''.3.'noAuthNoPriv(1)'
 , vacmAccessContextMatch.toString());

 assertEquals(vacmAccessContextMatch, new 
 OID(vacmAccessContextMatch.'v3group'.''.3.'noAuthNoPriv(1)'));

 OID vacmViewTreeFamilyMask = new
 OID(1.3.6.1.6.3.16.1.5.2.1.3.20.117.110.114.101.115.116.114.105.99.11
 6.101.100.82.101.97.100.86.105.101.119.3.1.3.6);
 assertEquals(vacmViewTreeFamilyMask.'unrestrictedReadView'.'dod',
 vacmViewTreeFamilyMask.toString());

 OID vacmViewTreeFamilyMask2 = new 
 OID(1.3.6.1.6.3.16.1.5.2.1.3.20.117.110.114.101.115.116.114.105.99.11
 6.101.100.82.101.97.100.86.105.101.119.4.1.3.6.4976);
 assertEquals(vacmViewTreeFamilyMask.'unrestrictedReadView'.'dod.4976'
 ,
 vacmViewTreeFamilyMask2.toString());

 OID vacmViewTreeFamilyMask3 = new 
 OID(1.3.6.1.6.3.16.1.5.2.1.3.20.117.110.114.101.115.116.114.105.99.11
 6.101.100.82.101.97.100.86.105.101.119.4.9.3.6.4976);
 assertEquals(vacmViewTreeFamilyMask.'unrestrictedReadView'.'9.3.6.497
 6',
 vacmViewTreeFamilyMask3.toString());

 Best regards,
 Frank


 Am 03.01.2014 16:28, schrieb Garcia, Maurice:

 Frank,

 Sorry for all the questions L

 One more related to this email trail...

 I implemented the change you suggested and now the OID is resolved:

 Output - *vacmSecurityToGroupStatus.1.readwritesec*

 But when I reverse the process, it will not encode back to BER.

 OID 'vacmGroupName.1.readwritesec' cannot be parsed

 at org.snmp4j.smi.OID.parseDottedString(_OID.java:148_)

 at org.snmp4j.smi.OID.init(_OID.java:83_)

 at
 com.comcast.cpe.cfb.ber.BERService.setOIDEncoding(_BERService.java:15
 2_)

 I am not sure if this is related to the bug you found that will be 
 fixed in 1.0.2, but it appear to be the round-trip index conversion 
 that you were talking about?

 Thanks,

 Maurice

 *From:*Frank Fock [mailto:f...@agentpp.com]
 *Sent:* Thursday, January 02, 2014 12:15 PM
 *To:* Garcia, Maurice; snmp4j@agentpp.org
 *Subject:* Re: [SNMP4J] - BER - OID resolution i.e : 
 snmpCommunityName

 Hi Maurice,

 OK, I understand.
 To get the index decoded too, two steps are ncessary:

 1. Set the OID format to:
 smiManager.setOidFormat(SmiManager.OIDFormat.ObjectNameAndDecodedInde
 x);

 2. Call  oOID.format();

 While investigating this, I found two issues with SNMP4JSMI 1.0.1:

 1. When activating the OID format OIDFormat.ObjectNameAndDecodedIndex
 object names
 of non-instance OIDs (i.e. objects in the MIB tree path like mib-2) 
 will be decoded as numeric OIDs only. This bug will be fixed with 
 version 1.0.2 coming very soon.

 2. Currently OID.toString() will not return object names with 
 decoded index, because such OIDs cannot be parsed and thus are not 
 suitable for rountrip conversion.
 However, I think I have found  a solution to be able to do round-trip 
 index conversion and will implement it for version 1.0.2 too.

 Best regards,
 Frank

 Am 02.01.2014 04:40, schrieb Garcia, Maurice:

 Thanks for the quick reponse!!

 I am using the SNMP4J-SMI with the purchased license.

 I used both the OID.format() and OID.toString, but I am getting

Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

2014-01-03 Thread Garcia, Maurice
Frank,

Sorry for all the questions :(

One more related to this email trail...

I implemented the change you suggested and now the OID is resolved:

Output - vacmSecurityToGroupStatus.1.readwritesec

But when I reverse the process, it will not encode back to BER.


OID 'vacmGroupName.1.readwritesec' cannot be parsed
   at org.snmp4j.smi.OID.parseDottedString(OID.java:148)
   at org.snmp4j.smi.OID.init(OID.java:83)
   at com.comcast.cpe.cfb.ber.BERService.setOIDEncoding(BERService.java:152)


I am not sure if this is related to the bug you found that will be fixed in 
1.0.2, but it appear to be the round-trip index conversion that you were 
talking about?

Thanks,

Maurice


From: Frank Fock [mailto:f...@agentpp.com]
Sent: Thursday, January 02, 2014 12:15 PM
To: Garcia, Maurice; snmp4j@agentpp.org
Subject: Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

Hi Maurice,

OK, I understand.
To get the index decoded too, two steps are ncessary:

1. Set the OID format to:
smiManager.setOidFormat(SmiManager.OIDFormat.ObjectNameAndDecodedIndex);

2. Call  oOID.format();

While investigating this, I found two issues with SNMP4JSMI 1.0.1:

1. When activating the OID format OIDFormat.ObjectNameAndDecodedIndex object 
names
of non-instance OIDs (i.e. objects in the MIB tree path like mib-2) will be 
decoded as
numeric OIDs only. This bug will be fixed with version 1.0.2 coming very soon.

2. Currently OID.toString() will not return object names with decoded index, 
because
such OIDs cannot be parsed and thus are not suitable for rountrip conversion.
However, I think I have found  a solution to be able to do round-trip index 
conversion
and will implement it for version 1.0.2 too.

Best regards,
Frank

Am 02.01.2014 04:40, schrieb Garcia, Maurice:
Thanks for the quick reponse!!

I am using the SNMP4J-SMI with the purchased license.

I used both the OID.format() and OID.toString, but I am getting the same result.


  if (true) {
 System.out.println(BEROIDConversion.getOidName() - BER:  
+ new HexString(bBER).toString());
 System.out.println(BEROIDConversion.getOidName() - 
OID.toString():  + oOID.toString());
 System.out.println(BEROIDConversion.getOidName() - 
OID.format():  + oOID.format());
  }


BEROIDConversion.getOidName() - BER: 30 1C 06 11 2B 06 01 06 03 12 01 01 01 02 
6D 74 61 70 72 6F 76 04 07 6D 74 61 5F 70 77 64
BEROIDConversion.getOidName() - OID.toString(): 
snmpCommunityName.109.116.97.112.114.111.118
BEROIDConversion.getOidName() - OID.format(): 
snmpCommunityName.109.116.97.112.114.111.118


Am I doing something wrong, or is there more to the setup of SMI?

Thanks,

Maurice


From: Frank Fock [mailto:f...@agentpp.com]
Sent: Wednesday, January 01, 2014 12:03 PM
To: Garcia, Maurice; snmp4j@agentpp.orgmailto:snmp4j@agentpp.org
Subject: Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

Hi Maurice,

I think the BER (Basic Encoding Rules) isn't the problem here.
The BER encodes/decodes a numeric object identifier (i.e., an
array of usinged 32bit integer values) to/from a network encoding
that is independent from the byte and word order of a system.

What you are looking for is SNMP4J-SMI which provides
OID to object (last) name conversion and index to string
conversions.

If you have SNMP4J-SMI in place, OID.toString() will provide
you the value you are looking for.

Best regards,
Frank
Am 31.12.2013 17:18, schrieb Garcia, Maurice:
Hi,

I am trying to fully resolve the snmpCommunityName OID from BER to OID

I tried using all the methods in the OID Class and can't find anything in the 
SMI class that can help..

Any suggestions???

Example:

I get this - snmpCommunityName.109.116.97.112.114.111.118
But I want this - snmpCommunityName.'mtaprov1'

Thanks,

Maurice







--

---

AGENT++

Maximilian-Kolbe-Str. 10

73257 Koengen, Germany

https://agentpp.com

Phone: +49 7024 8688230

Fax:   +49 7024 8688231



--

---

AGENT++

Maximilian-Kolbe-Str. 10

73257 Koengen, Germany

https://agentpp.com

Phone: +49 7024 8688230

Fax:   +49 7024 8688231
___
SNMP4J mailing list
SNMP4J@agentpp.org
https://s16675406.onlinehome-server.info/mailman/listinfo/snmp4j


Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

2014-01-02 Thread Garcia, Maurice
Great!!!

I will be eagerly waiting for the new code drop!!

Thanks,

Maurice

From: Frank Fock [mailto:f...@agentpp.com]
Sent: Thursday, January 02, 2014 12:15 PM
To: Garcia, Maurice; snmp4j@agentpp.org
Subject: Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

Hi Maurice,

OK, I understand.
To get the index decoded too, two steps are ncessary:

1. Set the OID format to:
smiManager.setOidFormat(SmiManager.OIDFormat.ObjectNameAndDecodedIndex);

2. Call  oOID.format();

While investigating this, I found two issues with SNMP4JSMI 1.0.1:

1. When activating the OID format OIDFormat.ObjectNameAndDecodedIndex object 
names
of non-instance OIDs (i.e. objects in the MIB tree path like mib-2) will be 
decoded as
numeric OIDs only. This bug will be fixed with version 1.0.2 coming very soon.

2. Currently OID.toString() will not return object names with decoded index, 
because
such OIDs cannot be parsed and thus are not suitable for rountrip conversion.
However, I think I have found  a solution to be able to do round-trip index 
conversion
and will implement it for version 1.0.2 too.

Best regards,
Frank

Am 02.01.2014 04:40, schrieb Garcia, Maurice:
Thanks for the quick reponse!!

I am using the SNMP4J-SMI with the purchased license.

I used both the OID.format() and OID.toString, but I am getting the same result.


  if (true) {
 System.out.println(BEROIDConversion.getOidName() - BER:  
+ new HexString(bBER).toString());
 System.out.println(BEROIDConversion.getOidName() - 
OID.toString():  + oOID.toString());
 System.out.println(BEROIDConversion.getOidName() - 
OID.format():  + oOID.format());
  }


BEROIDConversion.getOidName() - BER: 30 1C 06 11 2B 06 01 06 03 12 01 01 01 02 
6D 74 61 70 72 6F 76 04 07 6D 74 61 5F 70 77 64
BEROIDConversion.getOidName() - OID.toString(): 
snmpCommunityName.109.116.97.112.114.111.118
BEROIDConversion.getOidName() - OID.format(): 
snmpCommunityName.109.116.97.112.114.111.118


Am I doing something wrong, or is there more to the setup of SMI?

Thanks,

Maurice


From: Frank Fock [mailto:f...@agentpp.com]
Sent: Wednesday, January 01, 2014 12:03 PM
To: Garcia, Maurice; snmp4j@agentpp.orgmailto:snmp4j@agentpp.org
Subject: Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

Hi Maurice,

I think the BER (Basic Encoding Rules) isn't the problem here.
The BER encodes/decodes a numeric object identifier (i.e., an
array of usinged 32bit integer values) to/from a network encoding
that is independent from the byte and word order of a system.

What you are looking for is SNMP4J-SMI which provides
OID to object (last) name conversion and index to string
conversions.

If you have SNMP4J-SMI in place, OID.toString() will provide
you the value you are looking for.

Best regards,
Frank
Am 31.12.2013 17:18, schrieb Garcia, Maurice:
Hi,

I am trying to fully resolve the snmpCommunityName OID from BER to OID

I tried using all the methods in the OID Class and can't find anything in the 
SMI class that can help..

Any suggestions???

Example:

I get this - snmpCommunityName.109.116.97.112.114.111.118
But I want this - snmpCommunityName.'mtaprov1'

Thanks,

Maurice







--

---

AGENT++

Maximilian-Kolbe-Str. 10

73257 Koengen, Germany

https://agentpp.com

Phone: +49 7024 8688230

Fax:   +49 7024 8688231



--

---

AGENT++

Maximilian-Kolbe-Str. 10

73257 Koengen, Germany

https://agentpp.com

Phone: +49 7024 8688230

Fax:   +49 7024 8688231
___
SNMP4J mailing list
SNMP4J@agentpp.org
https://s16675406.onlinehome-server.info/mailman/listinfo/snmp4j


Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

2014-01-01 Thread Garcia, Maurice
Thanks for the quick reponse!!

I am using the SNMP4J-SMI with the purchased license.

I used both the OID.format() and OID.toString, but I am getting the same result.


  if (true) {
 System.out.println(BEROIDConversion.getOidName() - BER:  
+ new HexString(bBER).toString());
 System.out.println(BEROIDConversion.getOidName() - 
OID.toString():  + oOID.toString());
 System.out.println(BEROIDConversion.getOidName() - 
OID.format():  + oOID.format());
  }


BEROIDConversion.getOidName() - BER: 30 1C 06 11 2B 06 01 06 03 12 01 01 01 02 
6D 74 61 70 72 6F 76 04 07 6D 74 61 5F 70 77 64
BEROIDConversion.getOidName() - OID.toString(): 
snmpCommunityName.109.116.97.112.114.111.118
BEROIDConversion.getOidName() - OID.format(): 
snmpCommunityName.109.116.97.112.114.111.118


Am I doing something wrong, or is there more to the setup of SMI?

Thanks,

Maurice


From: Frank Fock [mailto:f...@agentpp.com]
Sent: Wednesday, January 01, 2014 12:03 PM
To: Garcia, Maurice; snmp4j@agentpp.org
Subject: Re: [SNMP4J] - BER - OID resolution i.e : snmpCommunityName

Hi Maurice,

I think the BER (Basic Encoding Rules) isn't the problem here.
The BER encodes/decodes a numeric object identifier (i.e., an
array of usinged 32bit integer values) to/from a network encoding
that is independent from the byte and word order of a system.

What you are looking for is SNMP4J-SMI which provides
OID to object (last) name conversion and index to string
conversions.

If you have SNMP4J-SMI in place, OID.toString() will provide
you the value you are looking for.

Best regards,
Frank
Am 31.12.2013 17:18, schrieb Garcia, Maurice:
Hi,

I am trying to fully resolve the snmpCommunityName OID from BER to OID

I tried using all the methods in the OID Class and can't find anything in the 
SMI class that can help..

Any suggestions???

Example:

I get this - snmpCommunityName.109.116.97.112.114.111.118
But I want this - snmpCommunityName.'mtaprov1'

Thanks,

Maurice






--

---

AGENT++

Maximilian-Kolbe-Str. 10

73257 Koengen, Germany

https://agentpp.com

Phone: +49 7024 8688230

Fax:   +49 7024 8688231
___
SNMP4J mailing list
SNMP4J@agentpp.org
https://s16675406.onlinehome-server.info/mailman/listinfo/snmp4j


[SNMP4J] - BER - OID resolution i.e : snmpCommunityName

2013-12-31 Thread Garcia, Maurice
Hi,

I am trying to fully resolve the snmpCommunityName OID from BER to OID

I tried using all the methods in the OID Class and can't find anything in the 
SMI class that can help..

Any suggestions???

Example:

I get this - snmpCommunityName.109.116.97.112.114.111.118
But I want this - snmpCommunityName.'mtaprov1'

Thanks,

Maurice



___
SNMP4J mailing list
SNMP4J@agentpp.org
https://s16675406.onlinehome-server.info/mailman/listinfo/snmp4j


Re: [SNMP4J] OID Name to OID Dot Notation and vice Versa

2013-12-18 Thread Garcia, Maurice
Did the trick!!!

One more question, If I add more MIB files do they need to compiled or can they 
be read from the text?  Looking at the repository they are binary, so that 
leads me to believe they are compiled.

Thanks,

Maurice

-Original Message-
From: snmp4j-boun...@agentpp.org [mailto:snmp4j-boun...@agentpp.org] On Behalf 
Of Frank Fock
Sent: Wednesday, December 18, 2013 2:09 AM
To: snmp4j@agentpp.org
Subject: Re: [SNMP4J] OID Name to OID Dot Notation and vice Versa

Hi Maurice,

You simply need to load the MIB module(s). SmiManager.listModules() list the 
modules that are available in the repository. SmiManager.getLoadedModuleNames() 
returns the module names that are loaded and thus available for parsing.

Calling smiManager.loadModule(SNMPv2-MIB); once before the first parse will 
do the trick.

Best regards,
Frank


Am 18.12.2013 06:00, schrieb Garcia, Maurice:
 I hope this is a trivial fix, I am really new to SNMP4J.

 I simply want to simply translate an OID name to a OID dot notation.  I can 
 find any clear documentation on how to do this.

 Also do I need to compile new MIBS or simple provide the text files?

 Below is just a test file to get me started

 Any help Please

 Thanks,

 Maurice

 public class SmiManagerTest {

 public static void main(String[] args) {

SmiManager smiManager = null;

String sLicense = ;

try {

smiManager = new SmiManager(sLicense, new 
 File(C:\\mibrepository));
SNMP4JSettings.setOIDTextFormat(smiManager);
SNMP4JSettings.setVariableTextFormat(smiManager);

} catch (IOException e) {
   e.printStackTrace();
}

try {

   for (String sModule : smiManager.listModules()) {
 System.out.println(Module:  + sModule);
   }

} catch (IOException e) {
   e.printStackTrace();
}

try {
   smiManager.parse(sysContact.0);
} catch (ParseException e) {
   e.printStackTrace();
}

OID oOID = null;

try {
   oOID = new OID(smiManager.parse(sysContact.0));
} catch (ParseException e) {
   e.printStackTrace();
}

System.out.println(OID:   + oOID.format());

 }

 }


 OUTPUT:

 Module: ACCOUNTING-CONTROL-MIB
 Module: ADSL-LINE-EXT-MIB
 Module: ADSL-LINE-MIB
 Module: ADSL-TC-MIB
 Module: ADSL2-LINE-MIB
 Module: ADSL2-LINE-TC-MIB
 Module: AGENTPP-AGENTX-MIB
 Module: AGENTPP-BUILTIN-CAP
 .
 .
 .
 Module: VDSL-LINE-MIB
 Module: VRRP-MIB
 Module: WWW-MIB
 java.text.ParseException: Could not resolve OID 'sysContact'
 at com.snmp4j.smi.SmiManager.parse(SmiManager.java:784)
 at SmiManagerTest.main(SmiManagerTest.java:42)
 java.text.ParseException: Could not resolve OID 'sysContact.0'
 at com.snmp4j.smi.SmiManager.parse(SmiManager.java:784)
 at SmiManagerTest.main(SmiManagerTest.java:50)
 Exception in thread main java.lang.NullPointerException
 at SmiManagerTest.main(SmiManagerTest.java:55)
 ___
 SNMP4J mailing list
 SNMP4J@agentpp.org
 http://lists.agentpp.org/mailman/listinfo/snmp4j

--
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231

___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j
___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


[SNMP4J] OID Name to OID Dot Notation and vice Versa

2013-12-17 Thread Garcia, Maurice
I hope this is a trivial fix, I am really new to SNMP4J.

I simply want to simply translate an OID name to a OID dot notation.  I can 
find any clear documentation on how to do this.

Also do I need to compile new MIBS or simple provide the text files?

Below is just a test file to get me started

Any help Please

Thanks,

Maurice

public class SmiManagerTest {

   public static void main(String[] args) {

  SmiManager smiManager = null;

  String sLicense = ;

  try {

  smiManager = new SmiManager(sLicense, new 
File(C:\\mibrepository));
  SNMP4JSettings.setOIDTextFormat(smiManager);
  SNMP4JSettings.setVariableTextFormat(smiManager);

  } catch (IOException e) {
 e.printStackTrace();
  }

  try {

 for (String sModule : smiManager.listModules()) {
   System.out.println(Module:  + sModule);
 }

  } catch (IOException e) {
 e.printStackTrace();
  }

  try {
 smiManager.parse(sysContact.0);
  } catch (ParseException e) {
 e.printStackTrace();
  }

  OID oOID = null;

  try {
 oOID = new OID(smiManager.parse(sysContact.0));
  } catch (ParseException e) {
 e.printStackTrace();
  }

  System.out.println(OID:   + oOID.format());

   }

}


OUTPUT:

Module: ACCOUNTING-CONTROL-MIB
Module: ADSL-LINE-EXT-MIB
Module: ADSL-LINE-MIB
Module: ADSL-TC-MIB
Module: ADSL2-LINE-MIB
Module: ADSL2-LINE-TC-MIB
Module: AGENTPP-AGENTX-MIB
Module: AGENTPP-BUILTIN-CAP
.
.
.
Module: VDSL-LINE-MIB
Module: VRRP-MIB
Module: WWW-MIB
java.text.ParseException: Could not resolve OID 'sysContact'
   at com.snmp4j.smi.SmiManager.parse(SmiManager.java:784)
   at SmiManagerTest.main(SmiManagerTest.java:42)
java.text.ParseException: Could not resolve OID 'sysContact.0'
   at com.snmp4j.smi.SmiManager.parse(SmiManager.java:784)
   at SmiManagerTest.main(SmiManagerTest.java:50)
Exception in thread main java.lang.NullPointerException
   at SmiManagerTest.main(SmiManagerTest.java:55)
___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


Re: [SNMP4J] Going from BER Input Stream to OID String

2013-10-15 Thread Garcia, Maurice
Excellent! That worked!

Thank You

-Original Message-
From: snmp4j-boun...@agentpp.org [mailto:snmp4j-boun...@agentpp.org] On Behalf 
Of Frank Fock
Sent: Tuesday, October 15, 2013 1:18 PM
To: snmp4j@agentpp.org
Subject: Re: [SNMP4J] Going from BER Input Stream to OID String

Hi,

I am not sure, but I thiunk you need to rewind the input ByteBuffer to position 
0 before you can decode after the put.

Best regards,
Frank

Am 15.10.2013 19:12, schrieb Garcia, Maurice:
 Hi All,

 I've been working with SNMP4J for a couple of weeks adding it to a project 
 that I am working on.

 I am using SNMP4J for OID - BER  and vice-versa.

 In the below example, I am trying to from BER - OID, but I am getting an 
 error.

 I am not seeing where I am going wrong???  It is expecting more, but I am 
 using a direct conversion from oOID.encodeBER(), so I am not sure what more 
 it is expecting?


 Help Please!!!

 CODE:

String sSnmpOID = 1.3.6.1.2.1.4115.10.1.14.0;

System.out.println(PRE-OID-DOT-NOTATION:  + 
 sSnmpOID);

OID oOID = new OID(sSnmpOID);

ByteArrayOutputStream baosBER = new 
 ByteArrayOutputStream();

try {
   oOID.encodeBER(baosBER);
} catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
}

//This only displays what is contained in ByteArrayOutputStream
System.out.println(baosBER:  + new 
 HexString(baosBER.toByteArray()).toString());

//Convert to ByteBuffer
ByteBuffer bbBER = ByteBuffer.allocate(baosBER.size());

//Add byte Array
bbBER.put(baosBER.toByteArray());

//Create BERInputStream from ByteBuffer BER
BERInputStream bisOID = new BERInputStream(bbBER);

//Create OID Object
OID oOIDNew = new OID();

try {
   oOIDNew.decodeBER(bisOID);
} catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
}

System.out.println(PST-OID-DOT-NOTATION:  + 
 oOIDNew.toDottedString());
 OUTPUT:

 PRE-OID-DOT-NOTATION: 1.3.6.1.2.1.4115.10.1.14.0
 baosBER: 06 0B 2B 06 01 02 01 A0 13 0A 01 0E 00
 java.io.IOException: Unexpected end of input stream at position 13
 at org.snmp4j.asn1.BERInputStream.read(BERInputStream.java:58)
 at org.snmp4j.asn1.BER.decodeOID(BER.java:738)
 at org.snmp4j.smi.OID.decodeBER(OID.java:302)
 at BERTest.main(BERTest.java:119)
 PST-OID-DOT-NOTATION:
 ___
 SNMP4J mailing list
 SNMP4J@agentpp.org
 http://lists.agentpp.org/mailman/listinfo/snmp4j

--
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231

___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j
___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j