Re: How to include your own MIBs

Reto Beeler (beeler@tech.ascom.ch)
Wed, 24 Aug 94 15:38:46 +0200

Juergen Schoenwaelder writes:
> Things get really complicated if you have MIB definitions that are
> based on the newer SNMPv2 SMI, since I do not kown of a smic version
> that supports SNMPv2 SMI. You can try to use mosy (another MIB
> compiler which is part of the isode SNMP implementation) to convert v2
> SMI to v1 SMI. I have tried this but I have had no luck with it.

I do not have any problems with this.
When I get an SNMPv2 file, I send an e-mail to
"mib-v2tov1@dbc.mtview.ca.us" with the SNMPv2 MIB description in its body.
If the SNMPv2 MIB is correct, I get a reply with the
corresponding SNMPv1 MIB. The mail server does run mosy for me.
(Of course, if the SNMPv2 MIB description is broken, I get some
error messages that I have to interpret in order to correct the MIB.)

> Conclusion: You can do it but it is not very easy (as far as I know).
> Has anyone out there done this before? Has anyone written a script
> that will convert mosy output to the dbm format? Or any other
> solutions? I still use the smic files created by P.H. Kamp because I
> have not been able to create my own smic files...

I always use my own set of MIBs.
I use the following steps:
1. Create a file including all desired mibs for smic.
I call it allmibs.
It looks like the following:
-----------------------------------------------------------------------------
-- file: allmibs

-- include base mibs
#include "rfc1155.smi" -- SMI items
#include "rfc1212.smi" -- OBJECT-TYPE macro
#include "rfc1215.smi" -- TRAP-TYPE macro
#include "rfc1213.mib" -- MIB-II
#include "rfc1215.trp" -- SNMP generic traps
#include "rfc1443.tc" -- SNMPv2 Textual conventions
-- rewritten for SNMPv1

----------------------------------------------------
-- RFC - MIBs that are RFCs (As of April 6, 1993) --
----------------------------------------------------

-- extensions to mib-2 --
-------------------------

#include "rfc1229.mib" -- if extensions mib-2 (12) --> rfc1573
#include "rfc1243.mib" -- appletalk mib-2 (13)
#include "rfc1253.mib" -- ospf mib-2 (14)
#include "rfc1269.mib" -- bgp mib-2 (15)
#include "rfc1271.mib" -- rmon mib-2 (16)
#include "rfc1493.mib" -- dot1dBridge mib-2 (17)
#include "rfc1559.mib" -- phiv (DECnet) mib-2 (18)
#include "rfc1316.mib" -- char mib-2 (19)
#include "rfc1353.mib" -- snmpParties,snmpSecrets mib-2 (20-21)
#include "rfc1516.mib" -- snmpDot3RptrMgt mib-2 (22)
#include "rfc1389.mib" -- rip2 mib-2 (23)
#include "rfc1414.mib" -- ident mib-2 (24)
#include "rfc1514.mib" -- host mib-2 (25)

#include "rfc1565.mib" -- application mib-2 (27)
#include "rfc1566.mib" -- mta (Mail) mib-2 (28)
#include "rfc1567.mib" -- dsa (X.500) mib-2 (29)
#include "rfc1573.mib-a" -- ianaifType mib-2 (30)

-- and many more includes

-----------------------------------------------------------------------------
2. run "smic -z allmibs > allmibs.z"
3. run "scotty -nf smic2dbm allmibs.z" yields mib.dir, mib.pag, mib.str.
4. replace the default version of mib.dir, mib.pag, mib.str by
my own version.

> BTW, our SNMPv1/v2 implementation which will replace the current SNMP
> module sometimes in the future (dont ask me what this means) reads a
> MIB ASN.1 file at runtime. If you can wait, it will become as simple
> as typing 'cat my.mib >> scotty.mib'.

PLEASE have a second thought about this, before you do it. Myself,
I use an enormous mib-file including many rfcs, experimental mibs and
private mibs. I have doubts that a runtime translation of my mibs would
be feasible with reasonable performance.
I always found that the approach with smic and smic2dbm was pretty easy.

Just an additional note to the conversion from SNMPv2 to SNMPv1:

The mosy converter (or any other converter) may return
an import statement
IMPORTS
XYZ
FROM SNMPv2-TC;

XYZ is an SNMPv2 textual convention. These conventions are not known in
SNMPv1. I then include in my allmibs file the file "rfc1443.tc" that is
my own re-definition of these conventions for SNMPv1. "rfc1443.tc" looks like
this:
-----------------------------------------------------------------------------
SNMPv2-TC DEFINITIONS ::= BEGIN

IMPORTS
TimeTicks
FROM RFC1155-SMI;

-- definition of textual conventions

PhysAddress ::= OCTET STRING

MacAddress ::= OCTET STRING (SIZE (6))

TruthValue ::= INTEGER { true(1), false(2) }

TestAndIncr ::= INTEGER (0..2147483647)

AutonomousType ::= OBJECT IDENTIFIER

InstancePointer ::= OBJECT IDENTIFIER

RowStatus ::= INTEGER {
active(1),
notInService(2),
notReady(3),
createAndGo(4),
createAndWait(5),
destroy(6)
}

TimeStamp ::= TimeTicks

TimeInterval ::= INTEGER (0..2147483647)

DateAndTime ::= OCTET STRING (SIZE (8..11))

END
-----------------------------------------------------------------------------

With best regards
Reto

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ _/
_/ Reto Beeler tel:+41 31 999 4267 email: beeler@tech.ascom.ch _/
_/ ASCOM TECH fax:+41 31 999 3607 Morgenstr.129,3018 Bern,Switzerland _/
_/ _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/