Syntax Properties are used in OBJECT-TYPEs, Type Definitions (both ASN.1 Type Assignment forms and TEXTUAL-CONVENTIONs) and Variations in MODULE-COMPLIANCE and AGENT-CAPABILITIES statements. They define the data type associated with values for objects and any refinements or restrictions on allowed values, as well as structural information for table definitions. Information on using the GUI to edit these properties is collected here for brevity.
Figure - Type Definition Workspace, Syntax Page
The Class Filter allows the user to narrow the list of types available in the drop-down combobox for the "Primary Type" field to one of three settings. The default "All
" setting indicates no filtering, and all known types (subject to the setting of the Module Filter) are listed. The "ASN.1 Basic
" setting narrows the list to only those base types that come directly from ASN.1 that are allowed by SNMP and the SMI. The "SMIv1 Basic
" setting narrows the list to only those types that are defined by the SMIv1 specification. Similarly, the "SMIv2 Basic
" setting narrows the list to only those types that are defined by the SMIv2 specification. Finally, the "Derived
" setting narrows the list to only those types which are not base types but instead are those that have been derived from base types.
The Module Filter, available when the Class Filter setting is either "All
" or "Derived
", narrows the list of selectable types to those that have been defined within the selected module. If set to "All
", then all types defined in all loaded modules (subject to the Class Filter setting) will be listed. Each module loaded at the time the Type Definition's workspace was opened may be selected. MIB Smithy will automatically add the referenced type to the parent module's IMPORTS section if the selected type is unambiguous.
Checking the "Include module reference in type" option will preserve the selected module name when saving or previewing the module (as in SYNTAX EXAMPLE-MIB.ExampleTC
). This can be used in cases where a module references two or more external (imported) types having the same name. This feature of the SMI language is not widely supported so it should not be used unless absolutely necessary.
The Primary Type field is where one may specify the actual type that the Type Definition is derived from. It may either be entered manually or selected from a list of available types that is subject to the state of the Class and Module Filters. Depending on the type specified, the "Subtype Class" property allows the user to select or specify an appropriate form for subtyping or refinement. Except for a few exceptions from ASN.1 (e.g. OCTET STRING and OBJECT IDENTIFIER), valid values for the Primary Type consist of a single identifier (no spaces), starting with an uppercase letter, and consisting of zero or more letters and numbers. Hyphens are only allowed in SMIv1 (or in SMIv2 by way of conversion from SMIv1), provided the type doesn't end in a hyphen and no to hyphens are adjacent.
The Subtype Class property, whose available settings are governed by the "Primary Type" property, is used to select from available, legal forms of subtyping for the given type. Its setting controls the visibility of an appropriate set of controls in the lower section of the Syntax Page for specifying the desired refinement.
Depending on the base type, this may either be "None
" if for subtyping or refinements, "Sized
" if the type is to be refined by specifying an octet-length restriction, "Ranged
" if the type is to be refined by specifying a set of discrete ranges for allowed values, "Enumerated
" if the type is to be refined by specifying a set of named integer or bit values, or "Structured
" if the type is to be used to specify a conceptual table structure. For certain Primary Types such as SEQUENCE OF, the Subtype Class property allows specification a reference to another type definition.
Size and Range subtyping styles are available by selecting the Sized
and Ranged
options, respectively, from the Subtype Class combobox. The semantics are largely the same, except Sized subtyping causes the range list in the SMI output to be wrapped with a SIZE
keyword (as in SYNTAX OCTET STRING (SIZE(0..255))
), indicating that the list of discrete subranges indicate octet lengths rather than ranges of allowed numeric values. Which one to use depends on the data type involved, but MIB Smithy will usually only let you use an appropriate refinement for the selected data type. The main thing to remember is that data types that are typically variable length (e.g. OCTET STRING and its derivations) use size refinements, while integer values (e.g. INTEGER, Integer32, Gauge32, etc.) use range refinements. Certain datatypes (namely OBJECT IDENTIFIER) do not allow either.
'...'H
or '...'B
format required by the language.
Figure - Syntax Property - Sized/Ranged Subtypes
To extend the list of allowed sizes or lengths, enter an integer value for the minimum and maximum (which can be the same) and press the "Include" button. MIB Smithy will automatically join any overlapping ranges and place them in proper increasing order, as required by SMI rules.
To delete a range, enter an integer value for the minimum and maximum, or select from the list, and press the "Exclude" button. If the range to be excluded overlaps with any ranges currently allowed, MIB Smithy will automatically split ranges into multiple subranges as necessary.
In either case, the minimum/maximum values entered are inclusive. Meaning, if your range is currently (0..10)
and you add the range (11..16)
, the new range becomes (0..16)
. If you then delete the range (5..10)
, the new range becomes (0..4|11..16)
.
Enumerated subtyping allows symbolic names to be assigned to individual integer values or bits, depending on the base type. Only the INTEGER base type and the BITS construct, or non-base types derived from them, can use such refinements (Integer32, while derived from the ASN.1 INTEGER type, is considered a base type in SNMP and cannot be enumerated). These names are typically for the benefit of users of management applications, where the symbolic name(s) can be displayed rather than raw values, making it easier to understand management data. They also, of course, uniquely assign meaning to different values and bits. That meaning must not change between publications: SMI rules forbid such changes for the benefit of backwards-compatibility.
Figure - Syntax Property - Enumerated Subtype
To add an enumeration or bit label, enter its name, value and optional comments (such as a short description if the label does not suffice) into the spaces provided and press the "Add" button. MIB Smithy will automatically sort the enumerations in increasing order. A valid enumeration label begins with a lowercase letter, and may contain zero or more additional letters and numbers. Hyphens are permitted in SMIv1 provided the label does not end in a hyphen and no two hyphens are adjacent. Hyphens are not permitted in SMIv2 except by way of conversion from SMIv1.
Note that SMIv1 forbids integer enumerations from assigning the value 0, despite allowing negative enumerations. Although SMIv2 does not restrict the value 0, it's best to begin your integer enumerations at the value 1 for compatibility with SMIv1. On the other hand, BITS values (which don't exist in SMIv1) should always start with 0, and cannot be negative.
For maximum compatibility with other compilers, integer values should always be used for enumerations. However, hex and binary values are allowed by the SMI and COPS-PR-SPPI languages and are supported by MIB Smithy, provided they are entered in the '...'H
or '...'B
format required by the language.
Enumerations can be modified (provided SMI modification rules are followed) by entering its name or value or selecting it from the list, entering a new label or value, and pressing the "Modify" button.
To delete an enumeration, select it from the list or enter its name or value and press the "Delete" button.
In ASN.1, several types are considered structured or complex types: types that either consist of multiple components (such as SEQUENCE or SET) or multiple possible encodings (such as CHOICE). In MIBs, however, the SEQUENCE type is the only structured type, and the only time it is used is when defining the required ASN.1 Type Assignment listing the columns and types for a conceptual table definition. The type its self does not actually define any manageable data, and can't be used for an OBJECT-TYPE that's intended to be manageable.
While ASN.1 allows SEQUENCEs to be defined with multiple tiers of structure, MIB tables are defined with a single-tier list of column and type pairs. Selecting SEQUENCE as the Primary Type for a Type Definition record provides access to the Structured Subtype property, shown in the figure below.
Figure - Syntax Property - Structured Subtype
If you use the Table Wizard to create your tables, then normally you won't need to touch the sequence structure. If you add or remove OBJECT-TYPE records that are (or were) part of the table, or alter their names or types, then you will need to modify the SEQUENCE structure to match. The order and types for every column must exactly match those of the actual OID tree to be compliant.
To have MIB Smithy automatically scan for a table/row with a name similar to that of the type definition and rebuild the structure based on the list of column objects, use the "Auto" button.
To add a column to the structure, enter the name of the column OBJECT-TYPE and its data type into the spaces provided and press the "Add" button.
To remove a column to the structure, select it from the list or enter its name and press the "Remove" button.
To alter the order of the columns, select the column you wish to move, or enter its name, and use the "Move Up" and "Move Down" buttons as appropriate.