blob: 20d2e7bf69d05383f10ff1df6d0452e09edf4af9 [file] [log] [blame]
############################################## -*- Mib2c -*-
##
## File : mib2c.emulation.conf
## Author : Robert Story <rstory@freesnmp.com>
## Purpose: A mib2c conf file to generate snmpd.conf configuration to
## provide basic/simplistic emulation for a particular MIB.
##
##
## $Id$
######################################################################
@open ${name}-emulation.conf@
#
# $name.module MIB emulation
# Base OID: $name.objectID
#
# Requirements: Net-SNMP 5.2 or greater
#
# This file can be used as (part of) a Net-SNMP snmpd.conf
# configuration file to emulate (in a minimal fashion) the objects defined
# in the $name MIB.
#
# It is important to note that this file merely creates dummy values
# and variables and does not implement any of the functionality which
# the mib objects are actually supposed to implement!
#
# Also, it just defaults to 0, '' or 0.0 for initial values, so you'll need
# to tweak all the vaules. For any tables, you'll have set any indexes.
#
# The configuration tokens used in this file are documented in the
# snmpd.conf manual page, with the exception of the first line, which
# is documented in the snmp.conf and snmp_config manual pages.
#
#
# To use this file, you have several options:
#
# 1) add the contents to your existing snmpd.conf file
# 2) copy it to a new snmpd.conf, somewhere in SNMPCONFPATH
# 3) copy it to snmpd.conf.local, somewhere in SNMPCONFPATH
#
# The command 'net-snmp-config --snmpconfpath' will give your the
# SNMPCONFPATH (5.3.x and later).
# Here we tell the agent to load the MIB, so we can use names instead
# of OIDs. You may need to add other MIBs that this MIB depends on.
# Also, you might want to consider adding these to the global snmp.conf,
# so all users can reference them.
#
# See the Net-SNMP FAQ for more information on MIB loading.
#
[snmp] mibs +$name.module
#
# $name Scalar variables
#
@foreach $node scalar@
@ print Scalar: $node@
# $node.module::$node.parent.$node($node.subid) [$node.syntax = $node.type]
@ if "$node.status" eq "Deprecated"@
# **** WARNING: deprecated object ****
@ end@
@if $node.enums == 1@
@ eval $m2c_evals = ""@
@ eval $m2c_first = 1@
@ foreach $e $v enum@
@ if $m2c_first == 1@
@ eval $m2c_first = 0@
@ else@
@ eval $m2c_evals = "$m2c_evals,"@
@ end@
@ eval $m2c_evals = "$m2c_evals $e($v)"@
@ if $node.hasdefval == 1@
@ if (("$node.defval" eq "$e") || ("$node.defval" eq "$v"))@
@ eval $m2c_evals = "${m2c_evals}*"@
@ end@
@ end@
@ end@
# Enum range: $node.enumrange. Values: $m2c_evals
@elsif $node.ranges == 1@
@ eval $m2c_range_max = 0@
@ eval $m2c_evals = ""@
@ eval $m2c_first = 1@
@ foreach $a $b range $node@
@ if $m2c_first == 1@
@ eval $m2c_first = 0@
@ else@
@ eval $m2c_evals = "$m2c_evals,"@
@ end@
@ if $a == $b@
@ eval $m2c_evals = "$m2c_evals $a"@
@ else@
@ eval $m2c_evals = "$m2c_evals $a - $b"@
@ end@
@ eval $m2c_range_max = max($m2c_range_max,$b)@
@ end@
# Ranges: $m2c_evals;
@end@ #ranges
@ if $node.hasdefval == 1@
@ eval $m2c_emu_def = "$node.defval"@
@ else@
# (no default value)
@ if "$node.type" eq "ASN_OCTET_STR"@
@ eval $m2c_emu_def = "''" @
@ elsif "$node.type" eq "ASN_OBJECT_ID"@
@ eval $m2c_emu_def = "0.0" @
@ else@
@ eval $m2c_emu_def = "0" @
@ end@
@ end@
## uggh.. try to convert type into something 5.3.x override understands
@ eval $m2c_emu_type = lc($node.type)@
@ perleval $vars{'m2c_emu_type'} =~ s/asn_//; 0;@
@ if $node.settable@
#override -rw ${node}.0 $m2c_emu_type $m2c_emu_def
@ else@
#override ${node}.0 $m2c_emu_type $m2c_emu_def
@ end@
@end@
##======================================================================
#
# Note that in tables, all indices are shown first, then each
# readable column. This results in indices being given twice.
#
@foreach $node table@
@ print Table: $node@
# $node.module::$node.parent.$node($node.subid)
table $node
##============================================================
@ eval $m2c_idx_def = ""@
@ eval $m2c_add_def = ""@
@ foreach $col index@
# [$col] ($node.accessible) $col.syntax / $col.type / $m2c_decl ($col.decl)
@ if $col.enums == 1@
@ eval $m2c_evals = ""@
@ eval $m2c_first = 1@
@ foreach $e $v enum@
@ if $m2c_first == 1@
@ eval $m2c_first = 0@
@ else@
@ eval $m2c_evals = "$m2c_evals,"@
@ end@
@ eval $m2c_evals = "$m2c_evals $e($v)"@
@ if $col.hasdefval == 1@
@ if (("$col.defval" eq "$e") || ("$col.defval" eq "$v"))@
@ eval $m2c_evals = "${m2c_evals}*"@
@ end@
@ end@
@ end@
# enum range: $col.enumrange. Values: $m2c_evals
@ elsif $col.ranges == 1@
@ eval $m2c_range_max = 0@
@ eval $m2c_evals = ""@
@ eval $m2c_first = 1@
@ foreach $a $b range $col@
@ if $m2c_first == 1@
@ eval $m2c_first = 0@
@ else@
@ eval $m2c_evals = "$m2c_evals,"@
@ end@
@ if $a == $b@
@ eval $m2c_evals = "$m2c_evals $a"@
@ else@
@ eval $m2c_evals = "$m2c_evals $a - $b"@
@ end@
@ eval $m2c_range_max = max($m2c_range_max,$b)@
@ end@
# ranges: $m2c_evals;
@ end@ #ranges
@ if $col.hasdefval == 1@
@ eval $m2c_col_def = '$col.defval'@
@ else@
@ if "$col.type" eq "ASN_OCTET_STR"@
@ eval $m2c_col_def = "''" @
@ elsif "$col.type" eq "ASN_OBJECT_ID"@
@ eval $m2c_col_def = "0.0" @
@ else@
@ eval $m2c_col_def = "0" @
@ end@
@ end@
@ eval $m2c_add_def = "$m2c_add_def $m2c_col_def"@
##@ if $node.accessible == 1@
@ eval $m2c_idx_def = "$m2c_idx_def $m2c_col_def"@
##@ end@
@ end@ ## col
##===================================================
@ foreach $col nonindex@
# $col [$col.syntax = $col.type]
@ if "$col.status" eq "Deprecated"@
# **** WARNING: deprecated object ****
@ end@
@ if $col.enums == 1@
@ eval $m2c_evals = ""@
@ eval $m2c_first = 1@
@ foreach $e $v enum@
@ if $m2c_first == 1@
@ eval $m2c_first = 0@
@ else@
@ eval $m2c_evals = "$m2c_evals,"@
@ end@
@ eval $m2c_evals = "$m2c_evals $e($v)"@
@ if $col.hasdefval == 1@
@ if (("$col.defval" eq "$e") || ("$col.defval" eq "$v"))@
@ eval $m2c_evals = "${m2c_evals}*"@
@ end@
@ end@
@ end@
# enum range: $col.enumrange. Values: $m2c_evals
@ elsif $col.ranges == 1@
@ eval $m2c_range_max = 0@
@ eval $m2c_evals = ""@
@ eval $m2c_first = 1@
@ foreach $a $b range $col@
@ if $m2c_first == 1@
@ eval $m2c_first = 0@
@ else@
@ eval $m2c_evals = "$m2c_evals,"@
@ end@
@ if $a == $b@
@ eval $m2c_evals = "$m2c_evals $a"@
@ else@
@ eval $m2c_evals = "$m2c_evals $a - $b"@
@ end@
@ eval $m2c_range_max = max($m2c_range_max,$b)@
@ end@
# ranges: $m2c_evals;
@ end@ #ranges
@ if $col.hasdefval == 1@
@ eval $m2c_col_def = '$col.defval'@
@ else@
@ if "$col.type" eq "ASN_OCTET_STR"@
@ eval $m2c_col_def = "''" @
@ elsif "$col.type" eq "ASN_OBJECT_ID"@
@ eval $m2c_col_def = "0.0" @
@ else@
@ eval $m2c_col_def = "0" @
@ end@
@ end@
@ eval $m2c_add_def = "$m2c_add_def $m2c_col_def"@
@ end@ ## col
#add_row $node $m2c_idx_def $m2c_add_def
@end@ ## table