Previous section.

Inter-Domain Management: Specification Translation (JIDM_ST)
Copyright © 2000 The Open Group

Translation of SMI to IDL

Introduction

This part of the document describes the translation of SMIv2 MIB Specifications into CORBA IDL. It does not address how the messages in the SNMP protocol are converted into the messages in the CORBA environment.

SNMP/CORBA Interoperability Scenarios describes possible scenarios using CORBA-based SNMP managers and agents. The specification of the SNMP Gateway is addressed in the associated JIDM Interaction Translation specification.

The SNMP MIB definition language is built on ASN.1 and this section re-uses the translation given in Translation of ASN.1 to IDL.

This chapter describes CORBA/TMN interworking for SNMP, gives an outline description of the basic scheme for translating SMIv2 to CORBA-IDL, and defines the mapping of SNMP information modules into CORBA-IDL. Mapping of SMIv2 Macros to IDL describes the mapping of SNMP SMI macros to CORBA-IDL.

The previous version of this specification (JIDM Specification Translation, Preliminary Specification P509) addressed the issues related to the mapping of ASN.1 types and SMI macros to IDL types and interfaces. The mapping rules of specification translation are based on the SMI specifications in SNMP and applicable to MIB information modules specified for SNMPv1, SNMPv2 (all the versions) and SNMPv3. This mapping has been completely revised, and so the definitions given in this document supersede those defined in the previous (P509) publication.

CORBA/TMN interworking for SNMP

The inter-operability specification between SNMP and CORBA domains is designed as a stand alone specification solely based on the CORBA IDL and CORBA Object Services (COSS). The specification consists of two parts:

The specification translation (this JIDM_ST document) addresses the issues related to the mapping of ASN.1 types and SMI macros to IDL types and interfaces. The ST mapping rules are based on the SMI specifications in SNMP and applicable to MIB information modules specified for SNMPv1, SNMPv2 (all the versions) and SNMPv3.

The interaction translation (associated JIDM_IT document) address the mapping of names, messages and events in the SNMP domain to names, operation invocation, and events, in th CORBA domain and vice-versa.

The JIDM interaction translation specification consists of two parts:

Figure: SNMP MIB to IDL in CORBA Domain

SNMP MIB to IDL in CORBA Domain describes the usage of the SNMP SMI based MIB specification and the IDL files (obtained from MIB using ST) in the CORBA domain, in contrast to the usage of MIB in the non-CORBA domain. In CORBA domains, SMI based MIB information modules are converted to IDL based on the ST mapping. The generated IDL interfaces are used to implement server-side MIB objects (table entries/groups) at the network devices, as part of agent-side instrumentation. The same IDL interfaces are also used to generate language specific stubs to write manager-side applications that would interact with the server side MIB implementation.

The main difference between implementing SNMP MIBs or writing management applications in a CORBA domain with a non-CORBA domain is in how the language-dependent APIs are generated from the MIB information modules. In a non-CORBA domain, the MIB specification is mapped directly to specific languages using either proprietary or standard methods. In the JIDM_ST approach (as described in this document), the MIB is first mapped to CORBA-IDL and then the language specific APIs (stubs/skeletons) are obtained using IDL->[C/C++/Java/SmallTalk] mapping rules defined in the CORBA 2.1 specification (see referencved documents). The specification translation approach supports both static and dynamic binding in a CORBA compliant way. Since the specification translation maps MIB to IDL, one can take advantage of the Dynamic Invocation Interface (DII) on the client side to write applications, and the Dynamic Skeleton Interface (DSI) on the server side to implement a SNMP MIB or an extension of the MIB.

Programming with DII and DSI does not need stubs/skeletons generated from the IDL and thus reduces the code size significantly. JIDM_ST supports both strongly typed programming using stubs/skeletons as well as untyped programming using DII/DSI interfaces. In addition, the JIDM_ST approach maps the MIB to IDL in such a way that generated interfaces are compatible with requirements of CORBA object services (LifeCycle, Event/Notification, and Naming, Interface Repository etc.).

In summary, the SMI to IDL translation approach described in this document is defined to be an "all CORBA solution" for implementing SNMP MIBs in the CORBA domain, for management of CORBA/non-CORBA objects as well as writing of management applications in the CORBA domain for managed objects in CORBA and SNMP domains.

Outline of Translation Algorithm

The basic scheme for translation of an SMI MIB specification to a CORBA-IDL specification is illustrated in Mapping of SNMP Information Module to IDL.
Figure: Mapping of SNMP Information Module to IDL

  1. Map an SMIv2 Information module (SMI document) into an IDL module:

  2. Map each of the ASN.1 type into IDL type using the translation scheme defined in this specification. A complex ASN.1 data type (used to describe PDUs for SNMP) may generate more than one IDL data type.

  3. Map the value-specification of SYNTAX clause of TEXTUAL-CONVENTION macro, such as DisplayString, into an IDL type.

    If DISPLAY-HINT clause is present then, define two operations within the scope of TextualConventions interface for converting the typed value to string and string to typed value.

  4. Map the value of the invocation of the MODULE-IDENTITY macros into a constant IDL literal of type string.

  5. Map the value of the invocation of the OBJECT-IDENTITY macros into a constant IDL literal of type string.

  6. Each group is mapped as follows. One IDL interface is generated for the group (G in Mapping of SNMP Information Module to IDL) and one IDL interface (T in Mapping of SNMP Information Module to IDL) for entry of each table in the group.

  7. Map the value of the invocation of the NOTIFICATION-TYPE/TRAP-TYPE macros into a constant IDL literal of type ASN1_ObjectIdentifier:

  8. The compiler will generate a file, with name <module-name>.oid, where each line the file contains four elements in given order: IDL Scoped name, OID, SMI type of the variable, and the MAX-ACCESS.

  9. Ignore the macros related to module compliance rules.

Note:
Since the SNMPv3 specification only enhances the security administration part of the SNMPv2 specification and does not specify any changes to the SMI part, the mapping scheme defined in this document is also applicable to the MIB module specified for SNMPv3.

Changes from Preliminary Specification

The following key changes have been made to the definition of SNMP-to-IDL translation as was defined in the previously published JIDM Specification Translation Preliminary Specification (Open Group document number P509):

Issues Related SMIv1 and SMIv2 MIB Modules

This SMI to IDL translation specification is targeted towards the SMIv2 specification. It is expected that the SMI to IDL translators based on this specification will use the IETF's SMIv1 to SMIv2 specification (see referenced documents) to internally map the SMIv1 MIB module to SMIv2 module before generating the IDL files. Since the IMPORT clauses in the SMIv1 will reference the SMIv1 MIB modules, the output IDL file will include proper IDL files.

Since the TRAP-TYPE macro in SMIv1 is not present in SMIv2, this specification includes explicit mapping of the TRAP-TYPE macro to IDL, based on the SMIv1 to SMIv2 mapping specification in the referenced SMIv1 to SMIv2 document.

Lexical Translation of ASN.1 Identifiers/Macros Descriptors

The lexical translation for the ASN.1 character set and identifiers follows the rules defined in the ASN.1->IDL translation specification (Part 4 of this document).

The Type suffix is added to all types generated from the ASN.1 types and the SYNTAX clause of the OBJECT-TYPE and TEXTUAL-CONVENTION macros defined in a SNMPv2 Information module. Consideration was given to dropping the Type suffix rule for ASN.1 types, but this would have required implementing two different ASN.1->IDL compilers, one for GDMO/ASN.1 and one for SNMP/ASN.1. The Type suffix rule also helps to generate identifiers for subtyping of values of SYNTAX clause in OBJECT-TYPE macro. It was therefore decided to keep the Type suffix rule for ASN.1 types.

The ASN.1 hyphen ("-") maps to IDL underscore ("_").

Compiler Options

The SNMP MIB to IDL compiler may accept following recommended options:

-A
Output IDL files for every imported module

-I<path>
Specifies directory where imported MIB files reside

-D<path>
Specifies the directory where IDL file is put.

Standard IDL Files Used

The specification translation assumes the existence of the following IDL files:

ASN1Types.idl
Contains the base definitions for translating ASN.1 types

SNMPMgmt.idl
Contains the definition for base IDL interface for SNMP groups or Tables; it also contains the specification of generic factory interface.

It also contains the IDL types for untyped event communication and base interfaces for generic typed event communication for Traps/Notifications.

RFC1155_SMI.idl
Contains SNMPv1 specific SMI defined ASN.1 types in IDL.

SNMPv2_SMI.idl
Contains SNMPv2 specific SMI defined ASN.1 types in IDL.

The IDL interfaces and types in these files are described later in this Part of the document.

Contents of SNMPMgmt.idl file

The SNMPMgmt.idl file contains the definitions for the base interface for the IDL interface for SNMP groups or table-entries. The base interface is called SmiEntry and defined within the module named SNMPMgmt. The IDL interface for SmiEntry is defined in OBJECT-TYPE Macro.

This file also defines generic factory interface, called GenericFactory, for SNMP specific LifeCycle service.

The SNMPMgmt module comprises a collection of interfaces that together define a basic set of services for developing Systems Management Applications based on CORBA. This module contains the following interfaces and the interfaces are describe in the referenced Interaction Translation document:

Mapping of Module Definition

The DEFINITIONS/BEGIN statement is used to start an SNMPv2 information module in the following format:

<module-identifier> DEFINITIONS ::= BEGIN <macro-instances> END

The DEFINITIONS statement is mapped to IDL as follows:


module <module-identifier> { <idl-mapped-macro-invocations> };

where <module-identifier> is mapped as an ASN.1 identifier as defined in the referenced Common Management Facilities document. The END statement at the end of the information module is mapped to the closing brace for the IDL module.

The SNMP->IDL compiler generated IDL file follows the following rules:

Naming of the Generated IDL Files

The <module-identifier> is used to name the IDL file generated by the SNMP->IDL compiler. The file name is formed by concatenating ".idl" to the <module-identifier>.

Naming of the Generated OID Files

The <module-identifier> is used to name the OID file generated by the SNMP->IDL compiler. The file name is formed by concatenating ".oid" to the <module-identifier>.

Mapping of IMPORT/FROM Clause

In SNMPv2 information modules IMPORTS statement is used to reference an external object by identifying both the descriptor and the module defining the descriptor in the following format:

IMPORTS <descriptor1> [, <descriptor2 ... [, descriptorn] ] FROM <module-name>

Descriptors, which are not macro reference or macro descriptor, in the IMPORTS statement are declared within the scope of the IDL module by way of typedef in the following format:


typedef <module-name>::<descriptor1>Type <descriptor1>Type; typedef <module-name>::<descriptor2>Type <descriptor2>Type; typedef <module-name>::<descriptor1>Type <descriptor1>Type;

Note that we have added the "Type" suffix to all types that are defined in another module. Since base ASN.1 types are assumed globally defined and they are not explicitly imported, the rule is always consistent.

If there is no "IMPORTS ... FROM" statement in the SMI module, then the following include directives will be added at the beginning of the file:


#include <ASN1Types.idl > #include <SNMPMgmt.idl >

in order to include the global ASN.1 types and base IDL interface.

Each FROM <module-name> clause will map to a #include statement at the beginning of the file (even if the imported elements from the <module-name> are ignored), as follows:


#include <<module-name>.idl>

Example

Example of Mapping of IMPORT clause describes the mapping of import clauses in RFC1907 to the following definition in a file named SNMPv2_MIB.idl:

Table: Example of Mapping of IMPORT clause

SMI
SNMPv2-MIB DEFINITIONS ::= BEGIN
IMPORTS
MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
ObjectName, Integer32, Counter32, snmpModules FROM SNMPv2-SMI
TruthValue, DisplayString, TestAndIncr, TimeStamp FROM SNMPv2-TC
MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF
system, ifIndex, egpNeighAddr FROM RFC1213-MIB
partyEntry FROM SNMPv2-PARTY-MIB;

END

IDL
#ifndef _SNMPv2_MIB_IDL_
#define _SNMPv2_MIB_IDL_
#include <ASN1Types.idl >
#include <SNMPMgmt.idl >
#include <SNMPv2_SMI.idl>
#include <SNMPv2.idl > // Based on the NOTIFICATION-TYPE macro clause
#include <SNMPv2_TC.idl>
#include <SNMPv2_CONF.idl>
#include <RFC1213_MIB.idl>
#include <SNMPv2_PARTY_MIB.idl>
module SNMPv2_MIB {

// MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE are ignored
typedef SNMPv2_SMI::ObjectNameType ObjectNameType;
typedef SNMPv2_SMI::Integer32Type Integer32Type;
typedef SNMPv2_SMI::Counter32Type Counter32Type;
// snmpModules is macro descriptor so it is ignored
typedef SNMPv2_TC::TruthValueType TruthValueType;
typedef SNMPv2_TC::DisplayStringType DisplayStringType;
typedef SNMPv2_TC::TestAndIncrType TestAndIncrType;
typedef SNMPv2_CONF::TimeStampType TimeStampType;
// system, ifIndex, egpNeighAddr are ignored because they
// are macro-descriptors
// partyEntry is ignored because its is macro-descriptor


}; /* End of SNMPv2_MIB module */
#endif /* ! _SNMPv2_MIB_IDL_ */






Mapping of DESCRIPTION Clause as Block Comments


The value-specification of the DESCRIPTION is clause of a macro is mapped as block
comment so that we can use the IDLDOC program to generate HTML file from the output IDL
file. The comments that are generated from other clauses are appended to the block comments
generated from DESCRIPTION clause of the corresponding macro.


If the REFERENCE clause is present in a macro then the value-specification for this clause
is to the block comment of the DESCRIPTION clause of the corresponding macro.




/*
<DESCRIPTION-value-specification>

<REFERENCE-value-specification>
*/


Mapping of ASN.1 OBJECT IDENTIFIER


The ASN.1 OBJECT IDENTIFIER assignments (if they do
not denote a SMI based groups)
are mapped as IDL constant of type ASN1_ObjectIdentfier,
which in turn is defined as typedef for string.
The value of the constant is defined to be fully scoped name
of the identifier for the constant as shown below:





MODULE


IDENTITY


RFC1155-SMI DEFINITIONS ::= BEGIN

internet OBJECT IDENTIFIER ::= { iso org(3) dod(6) 1 }
directory OBJECT IDENTIFIER ::= { internet 1 }
mgmt OBJECT IDENTIFIER ::= { internet 2 }
experimental OBJECT IDENTIFIER ::= { internet 3 }
private OBJECT IDENTIFIER ::= { internet 4 }
enterprises OBJECT IDENTIFIER ::= { private 1 }

END



IDL
module RFC1155_SMI {


const ASN1_ObjectIdentifer directory= "::RFC1155_SMI::directory";
const ASN1_ObjectIdentifier mgmt= "::RFC1155_SMI::mgmt";
const ASN1_ObjectIdentifier experimental= "::RFC1155_SMI::experimental";
const ASN1_ObjectIdentifier private= "::RFC1155_SMI::private";
const ASN1_ObjectIdentifier private_1= "::RFC1155_SMI::private";
const ASN1_ObjectIdentifier internet= "::RFC1155_SMI::private";
const ASN1_ObjectIdentifier enterprises= "::RFC1155_SMI::enterprises";
};
Entries in
RFC1155_SMI


::RFC1155_SMI::directory 1.3.6.1.1 ASN1_ObjectIdentifier not-accessible
::RFC1155_SMI::mgmt 1.3.6.1.2 ASN1_ObjectIdentifier not-accessible
::RFC1155_SMI::experimental 1.3.6.1.3 ASN1_ObjectIdentifier not-accessible
::RFC1155_SMI::private 1.3.6.1.4 ASN1_ObjectIdentifier not-accessible
::RFC1155_SMI::enterprises 1.3.6.1.4.1 ASN1_ObjectIdentifier not-accessible

Table: Conversion of OBJECT IDENTIFIER to IDL String Constant

The value of the OBJECT IDENTIFIER assignment and the IDL scoped name of the mapped descriptor are declared in the .oid file for the MIB module in the following format:


<IDL-SCOPED-NAME> <OID> ASN1_ObjectIdentifier not-accessible

Please note that each of the elements of the above declarations are separated by one or more spaces and the declaration is terminated by a new line character.

Mapping between OID and ScopedName in Separate File

In addition to the IDL file, the MIB->IDL compiler also generates an ASCII text file that contains the information about mapping IDL scoped name for interfaces and attributes and OID constants to corresponding SNMP OID. The name of the file is derived from the corresponding IDL module name and have an .oid suffix. For example, if we map RFC1213-MIB module to IDL, then the corresponding file name would be RFC1213_MIB.oid.

Each line of the .oid file represents one entry in MIB module and contains exactly four elements in the given order:

Use of RFC1213_MIB.oid for Mapping IDL ScopedName describes a subset of entries in RFC1213_MIB.oid file obtained from the RFC1213-MIB mib information module.

# Scoped-Name OID SMI-Type MAX-ACCESS
::RFC1213_MIB::mib_2 1.3.6.1.2.1 ASN1_ObjectIdentifier not-accessible
::RFC1213_MIB::transmission 1.3.6.1.2.1.10 ASN1_ObjectIdentifier not-accessible
::RFC1213_MIB::system 1.3.6.1.2.1.1 Group not-accessible
::RFC1213_MIB::system::sysDescr 1.3.6.1.2.1.1.1 ASN1_OctetString read-only
::RFC1213_MIB::system::sysObjectID 1.3.6.1.2.1.1.2 ASN1_ObjectIdentifier read-only
::RFC1213_MIB::system::sysUpTime 1.3.6.1.2.1.1.3 TimeTicksType read-only
::RFC1213_MIB::system::sysContact 1.3.6.1.2.1.1.4 ASN1_OctetString read-write
::RFC1213_MIB::system::sysName 1.3.6.1.2.1.1.5 ASN1_OctetString read-write
::RFC1213_MIB::system::sysLocation 1.3.6.1.2.1.1.6 ASN1_OctetString read-write
::RFC1213_MIB::system::sysServices 1.3.6.1.2.1.1.7 ASN1_Integer read-only
::RFC1213_MIB::interfaces 1.3.6.1.2.1.2 Group not-accessible
::RFC1213_MIB::interfaces::ifNumber 1.3.6.1.2.1.2.1 ASN1_Integer read-only
::RFC1213_MIB::ifTable 1.3.6.1.2.1.2.2 Table read-only
::RFC1213_MIB::ifEntry 1.3.6.1.2.1.2.2.1 TableEntry not-accessible
::RFC1213_MIB::ifEntry::ifIndex 1.3.6.1.2.1.2.2.1.1 ASN1_Integer read-only
::RFC1213_MIB::ifEntry::ifDescr 1.3.6.1.2.1.2.2.1.2 ASN1_OctetString read-only
::RFC1213_MIB::ifEntry::ifType 1.3.6.1.2.1.2.2.1.3 ASN1_Integer read-only
::RFC1213_MIB::ifEntry::ifMtu 1.3.6.1.2.1.2.2.1.4 ASN1_Integer read-only
::RFC1213_MIB::ifEntry::ifSpeed 1.3.6.1.2.1.2.2.1.5 GaugeType read-only
::RFC1213_MIB::ifEntry::ifPhysAddress 1.3.6.1.2.1.2.2.1.6 ASN1_OctetString read-only
::RFC1213_MIB::ifEntry::ifAdminStatus 1.3.6.1.2.1.2.2.1.7 ASN1_Integer read-write
::RFC1213_MIB::ifEntry::ifOperStatus 1.3.6.1.2.1.2.2.1.8 ASN1_Integer read-only
::RFC1213_MIB::ifEntry::ifLastChange 1.3.6.1.2.1.2.2.1.9 TimeTicksType read-only

Table: Use of RFC1213_MIB.oid for Mapping IDL ScopedName


Why not acquire a nicely bound hard copy?
Click here to return to the publication details or order a copy of this publication.

Contents Next section Index