Post

#SNMP Pro: Syntax Validation in SharpSnmpPro.Mib

This post talks about the syntax validation support in SharpSnmpPro.Mib assembly.

SMI defines the syntax of MIB documents. One of the most important part of SMI is the syntax that governs the value of an object. For example,

1
2
3
4
5
6
7
8
9
10
testEntity13 OBJECT-TYPE
SYNTAX INTEGER (30000000..31000000 | 13750000..14500000 | 5850000..6425000 | 7900000..8400000)
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"A textual description of the entity. This value should
include the full name and version identification of
the system's hardware type, software operating-system,
and networking software."
::= { test 13 }

The above OBJECT-TYPE definition uses a syntax that requires an INTEGER value which falls into the four intervals defined.

Many MIB compilers are able to compile such objects, extract their type (INTEGER) and OID (test.13), and interpret other properties. However, they are not able to extract the full syntax and make good use of it. So what about #SNMP MIB Compiler? Does it support full syntax validation?

As the foundation of #SNMP MIB Compiler, SharpSnmpPro.Mib assembly of course provides full validation support. For example, the below test case is part of our test suite, which shows how to load a MIB document into memory, and then use the information extract (including the full syntax) to validate input data,

Clearly when this test case passes we know the syntax validation works like a charm,

This is the very first post about SharpSnmpPro.Mib assembly. I am going to write more about it once the API set is further finalized.

© Lex Li. All rights reserved. The code included is licensed under CC BY 4.0 unless otherwise noted.
Advertisement

© - Lex Li. All rights reserved.

Using the Chirpy theme for Jekyll.

Last updated on October 30, 2024