[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
examples of draft-bierman-sming-ds-02.txt in SMIng (NMRG)
Below are some examples from draft-bierman-sming-ds-02.txt translated
into SMIng with flat OID naming.
// This file shows the examples from <draft-bierman-sming-ds-02.txt>
// expressed in SMIng syntax. There are also some notes about some
// of the differences. This file assumes flat OID naming as it is
// currently used by the SNMP standards.
// In case there is WG agreement to support Andy's hierarchical naming,
// then this can be easily accomodated, either by adding an additional
// mapping or (if we are really sure hierarchical naming is the future)
// by adding statements to define relative name portions in the attribute
// definitions.
union InetAddressUnion {
switch InetAddressType {
case unknown {
attribute unknown {
type InetAddress;
access readwrite;
status current;
description
"Represents an Internet address of unknown format.";
};
};
case ipv4 {
attribute ipv4 {
type InetAddressIPv4;
access readwrite;
status current;
description
"Represents an IPv4 Internet address.";
};
};
case ipv6 {
attribute ipv6 {
type InetAddressIPv6;
access readwrite;
status current;
description
"Represents an IPv6 Internet address.";
};
};
};
status current;
description
"Internet address in several different representations.";
};
class GenericInetAddress {
attribute addrType {
type InetAddressType;
access readwrite;
status current;
description
"The type of the generic Internet address.";
};
attribute addrValue {
type InetAddressUnion (addrType);
access readwrite;
status current;
description
"The value of the generic Internet address.";
};
status current;
description
"Generic Internet address consisting of an InetAddressType
discriminator and an InetAddressUnion.";
};
snmp {
scalars myAddress {
oid someBase.1;
implements GenericInetAddress {
object myAddressType addrType;
object myAddressValue addrValue;
};
status current;
description
"Internet address of this system.";
};
};
// Observations:
//
// - Mapping of the union in a single object statement is only possible
// if the union members are all of the same base type. Otherwise,
// multiple object statements are needed. This is due to the flat OID
// naming system in SMIv2, could be different with a hierarchical
// naming system.
typedef GenericCounterType {
type Enumeration (c32(1), c64(2), c32pair(3));
status current;
description
"A type to indicate the type of a GenericCounter value.";
};
class Counter32Pair {
attribute c32low {
type Counter32;
access readonly;
status deprecated;
description
"The lower 32 bits of a 64 bit counter.";
};
attribute c32high {
type Counter32;
access readonly;
status deprecated;
description
"The upper 32 bits of a 64 bit counter.";
};
status current
description
"Pair of 32 bit counters to represent a 64 bit counter.";
};
union GenericCounter {
switch GenericCounterType {
case c32 {
attribute c32 {
type Counter32;
access readonly
status current;
description
"The Counter32 representation of the counter";
};
};
case c64 {
attribute c64 {
type Counter64;
access readonly
status current;
description
"The Counter64 representation of the counter";
};
};
case c32pair {
attribute c32pair {
type Counter32Pair;
access readonly
status current;
description
"The Counter32Pair representation of the counter";
};
};
};
};
snmp {
scalars myCounter {
oid someBase.3;
implements GenericCounter {
object myCounter32 c32;
object myCounter64 c64;
object myCounter32low c32pair.c32low;
object myCounter32high c32pair.c32high;
};
status current;
description
"An example generic counter.";
};
};
// Observations:
//
// - This example implements a union where the members are not of the
// same base type and some members are constructed. This requires to
// use multiple object statements to "flatten" out the nesting.
//
// - This example does not use a discriminator. Instead, different values
// of the union are distinguished by the assigned OIDs.
class IpStats {
attribute inetAddrType {
//...
};
attribute inetAddr {
//...
};
attribute inPkts {
//...
};
attribute outPkts {
};
// ...
};
snmp {
table ipStats {
oid someBase.4;
index (ifIndex, inetAddrType, inetAddr);
implements IpStats {
object ipStatsInetAddrType inetAddrType;
object ipStatsInetAddr inetAddr;
object ipStatsInPkts inPkts;
object ipStatsOutPkts outPkts;
};
};
};
class TimeData {
attribute createTime {
//...
};
attribute updateInterval {
//...
};
//...
};
class IpXStats {
attribute inHCPkts {
// ...
};
attribute outHCPkts {
// ...
};
attribute timeData {
// ...
};
status current;
description
"Add high capacity counters and additional information to
the ipStats statistics.";
};
snmp {
table ipXStats {
oid someBase.5;
augments (ipStats);
implements IpXStats {
object ipXStatsInHCPkts inHCPkts;
object ipXStatsOutHCPkts outHCPkts;
object ipXStatsCreateTime timeData.createTime;
object ipXStatsUpdateInterval timeData.updateInterval;
};
};
};
class IpPortStats {
attribute inetPort {
type InetPortNumber;
access readonly;
status current;
description
"The Internet port number for this statistic.";
};
attribute uInPkts {
type GenericCounter;
access readonly;
status current;
description
"The number of packets received on this port.";
};
attribute uOutPkts {
type GenericCounter;
access readonly;
status current;
description
"The number of packets transmitted over this port.";
};
status current;
description
"Port specific statistics.";
};
snmp {
table ipXPortStats {
oid someBase.42;
expands (ipStats, inetPort);
implements IpPortStats {
object ipXPortStatsUInPkts32 uInPkts.c32;
object ipXPortStatsUInPkts64 uInPkts.c64;
// ...
object ipXPortStatsUOutPkts32 uOutPkts.c32;
object ipXPortStatsUOutPkts32 uOutPkts.c64;
// ...
};
};
};
// Observation:
//
// - With the current SMIng, you would model multi-valued attributes as separate tables.
// The expands clause defines this special kind of relationship.
//
// - Our emacs says snmp is green.
class EntSensorData {
attribute type {
//...
};
attribute scale {
//...
};
//...
};
snmp {
table entSensorData {
extends (entPhysicalTable);
implements EntSensorData {
object entSensorType type;
object entSensorScale scale;
};
};
};
/js
-frank
--
Juergen Schoenwaelder <http://www.informatik.uni-osnabrueck.de/schoenw/>
Frank Strauss <http://www.ibr.cs.tu-bs.de/~strauss/>