8.1   Simulation Agent Configuration

The Agent panel has four settings defining the agent‘s start configuration which are described by Table 3 on page 43.

Field

Description

Parameters

Primarily, the parameter field defines the UDP and TCP addresses the simulation agent should listen on. The syntax is:

[(udp|tcp):]<address>/<port> ..

where address is any IPv4 or IPv6 IP address or host name, port is the UDP or TCP port. By default 161 is used for SNMP agents, which requires super user privileges on UNIX systems. At least one address must be specified otherwise the agent will be started with udp:0.0.0.0/161.

In addition, boot counter and the persistent configuration storage file can be specified:

[-bc <bootCounterFile>]
[-c <configFile>]

By default AgenPro uses AgenProSim.bc as boot counter file and AgenProSim.cfg as config file. Both files are stored in the user‘s home directory.

Initial Configuration

The optional initial configuration file is read at agent startup and should initialize the simulation independent MIB objects, like VACM, USM, and notification MIB. The file format is one of the following:

1.   the SNMP4J properties format as defined by the PropertyMOInput class.

2.   a XML file that complies to the XML schema MIBConfig.xsd.

Simulation Data

With simulation data XML file the simulated MIB object values of the agent can be modified at runtime by modifying this file.

The file format is a XML file that complies to the XML schema MIBConfig.xsd.

Simulation Refresh

Defines how often (in seconds) the file specified by Simulation Data is checked for updates. If a new file (updated file) is detected, its content is read and the MIB objects of the agent are updated accordingly.

Table 3: Simulation agent start configuration settings.

 

8.1.1   Simulation Properties

There are four properties that define the content and behavior of a simulation agent: value, rows, traps, and object. Scalar and tabular data is defined by value and rows. Traps (notifications) are defined by traps and object. For a description of those properties see table “Code generation properties for SNMP4J-Agent.” on page 20.

The figure “Example properties to simulate table data.” on page 45 shows a MIB tree detail from the IF-MIB (RFC 2863). The properties tabs‘ content for those tree nodes with properties defined are shown by overlay tables.

SimulationProperties.jpg

 

Figure 5:   Example properties to simulate table data.

The first row shows the rows property defined for the ifEntry (1.3.6.1.2.1.2.2.1) object identifier. This property is then inherited by all columns under the table entry object. The inheritance has a welcome side effect: when entering the column instance value properties, you always see the rows property with the defined index value(s).

To ease entering the simulation data, row indexes and values are provided in their native format as described by Table 4 on page 46.

SMI Syntax

Native Format Description

OCTET STRING

Valid formats are:

1.   If the object type has a DISPLAY-HINT clause, then the native form is that format. A common example is the DisplayString textual con­vention. As that format specification uses ASCII characters, you can specify such a value by simply using its textual representation as long as it does not contain control characters.

2.   Otherwise, an OCTET STRING is specified as a hex-string where each byte is represented as a hexadecimal value and bytes are separated by colon or space. The string „Hello 1 world“ has to be formatted as „04 0d 48 65 6c 6c 6f 20 31 20 77 6f 72 6c 64“ for example.

OBJECT IDENTIFIER

Valid formats are:

1.   the object name: sysName

2.   a dotted OID string: 1.3.6.1.2.1.1.5

3.   an object name prefix and a dotted OID string suffix: sysName.0

Integer32, INTEGER, Counter32, Counter64, Gauge, Gauge32, Unsigned32

These values are provided as decimal numbers.

INTEGER { enum, ..}

Valid formats are:

1.   the enumerated value‘s label (e.g., enum) or

2.   the integer value associated with a label.

BITS { label1, ...}

Valid formats are:

1.   a binary string where each bit of a byte is represented as 1 or 0 and bytes are separated by spaces, for example, if bits 1, 5, and 9 are set, the their native format is „01000100 10000000

2.   a list of bit names enclosed in curly braces ({,}) and separated by com­mas, for example, provided that the bit labels are bit0 for first bit and bit7 for the eight, then the above BITS value can be written as „{bit1,bit5,bit9}“.

IpAddress

An dotted string with for numbers: 192.168.1.1

Opaque

a hex-string where each byte is represented as a hexadecimal value and bytes are separated by colon or space.

TimeTicks

An integer number represented in units of hundreds of a second.

Table 4: The native representation formats for all SMI base syntaxes.

To remove all properties within a sub-tree, use Remove Properties menu item in the MIB tree context menu of a MIB node.

The properties value and rows can be imported from a SNMP4J or MIB Explorer snapshot file by using the Import... button on the Agent tab. The import will add value and the corresponding rows properties for all variable bindings in the snapshot file. If a node of the MIB tree is selected, only those variable bindings are imported whose object identifiers belong to the selected sub-tree.

8.1.2   Simulation Data

As there are the properties value and rows to define simulation (and code generation) data information, you may ask why we need yet any other way to provide simulation data?

Properties are best to define initial and ad-hoc simulation data, but properties are not best suited to automate simulation data modification from third party applications or processes. For that purpose, XML is well supported and understood interchange format. The schema for AgenPro simulation data is defined by MIBConfig.xsd which is located in the xsd directory in the AgenPro accompanied files installation directory (see “Install Templates, Example Projects, and MIBs” on page 5 for information on how to install those files).

A simulation data XML file can be configured on the Agent tab as described by “Simulation agent start configuration settings.” on page 43. The file is read on agent startup after the configuration file (if present) and it is reread at the specified refresh rate. If the file is written by another application while AgenPro tries to read it, incomplete reads may occur which, in the worst case, prevent that the simulation data is being updated in this refresh cycle. To avoid such situations, it is recommended to replace the simulation data file by moving it on the file system instead of directly writing to it.

A XML simulation data file supports data initialization and delta updates:

The following XML file is a small usage example:

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="MIBConfig.xsd">

 <object name="nlmConfigGlobalAgeOut">
   <scalar>101</scalar>
 </object>

 <object name="nlmStatsLogTable">
   <row>
     <i>logName</i><i>1</i> <c>100</c><c>200</c>
   </row>
   <row>
     <i>logNameNext</i><i>2</i> <c>300</c><c>400</c>
   </row>
 </object>
</config>

This example can be loaded successfully only if the MIB module NOTIFICATION-LOG-MIB from RFC 3014 is loaded into AgenPro. Otherwise, AgenPro is not able to resolve the object names and it will not able to parse the values. As a simulation agent without corresponding MIB module(s) does not make any sense, this is not a real constraint, nevertheless important to bear in mind.

Instead of specifying object names, also object identifiers can be used:

<object oid="1.3.6.1.2.1.92.1.1.2">
 <scalar>101</scalar>
</object>

When using object names, it might by necessary to also specify the MIB module to avoid ambiguities:

 <object name="sysContact" module="SNMPv2-MIB"
        oid="1.3.6.1.2.1.1.4">
 <scalar>System Administrator</scalar>
</object>

Tabular data is defined row by row. For each row, a value (or null) has to be specified for each column. The object identifier of a particular cell of a table is defined as

class-oid.sub-index-1[.sub-index-2[...]]

where class-oid is the object identifier of the column OBJECT-TYPE definition, and sub-index-1 is the value of the first (virtual) object in the table‘s INDEX clause. The values of the index objects are encoded as OID. The simulation data XML provides two approaches to specify the index of a row:

1.   Using the index attribute of the row element. The index attribute must specifies the complete index OID value (everything after „class-oid.“) as dotted string.

2.   Using <i> elements (one <i> element per INDEX object). Each <i> element specifies a sub-index value in its native representation as described by “The native representation formats for all SMI base syn­taxes.” on page 46. An <i> element must contain an OID only if, the corresponding sub-index object type has the base syntax OBJECT IDENTIFIER.

The INDEX clause of the ifEntry OBJECT-TYPE definition is simple because it contains only a single sub-index object, the ifIndex OBJECT-TYPE.

The following example shows how the simple INDEX clause of the ifTable can be specified:

 <object name="ifTable" module="IF-MIB"
        oid="1.3.6.1.2.1.2.2.1">
 <row index="1000">
  <i>1000</i>
  <c>1000</c>
  <c>en1-0</c>
  <c>6</c>
  <c>1500</c>
  <c>100000000</c>
  <c>00:a0:f9:0c:4e:5b</c>
  <c>1</c>
  <c>1</c>
  <c>130156800</c>
  <c>1099008784</c>
  <c>1451652</c>
  <c>8240</c>
  <c>0</c>
  <c>0</c>
  <c>0</c>
  <c>1180600057</c>
  <c>1517714</c>
  <c>835</c>
  <c>0</c>
  <c>0</c>
  <c>0</c>
  <c>0.0</c>
 </row>
</object>

The INDEX clause of the tcpConnTable (TCP-MIB RFC 4022) has four sub-index values with base type IpAddress, INTEGER, IpAddress, and INTEGER:

 <object name="tcpConnTable" module="TCP-MIB"
        oid="1.3.6.1.2.1.6.13.1">
 <row index="0.0.0.0.161.0.0.0.0.0">
  <i>0.0.0.0</i>
  <i>161</i>
  <i>0.0.0.0</i>
  <i>0</i>
  <c>0</c>
  <c>0.0.0.0</c>
  <c>0</c>
  <c>0.0.0.0</c>
  <c>0</c>
 </row>
</object>

Exporting Simulation Data

When the simulation agent is running, its complete simulation data content can be exported as a XML file by using the Save Data... button on the Agent tab.

8.1.3   Simulation Agent Configuration with SNMP

Another way to configure the simulation agent is SNMP. Using SNMP has the advantage that a standard protocol is used that (to some extend) can be reused when developing the real agent generated by AgenPro.

The simulation agent has two modes: operation and config:

To change the agent‘s mode, set the MIB object agentppSimMode with OID 1.3.6.1.4.1.4976.2.1.1.0 to 1 (operation) or 2 (config).

Independently of the current mode, the objects agentppSimDeleteRow and agentppSimDeleteTableContents can be used to delete individual rows or all rows of a table.

To delete the row with index 100 of the ifTable, use the OID of an arbitrary object instance of that row, for example the ifDescr column:

SET 1.3.6.1.4.1.4976.2.1.2.0=1.3.6.1.2.1.2.2.1.2.100

To delete all rows of the ifTable table use the OID of the corresponding conceptual row object which is the ifEntry object:

SET 1.3.6.1.4.1.4976.2.1.3=1.3.6.1.2.1.2.2.1