Run-Time Modifiers

Run-time modifiers enable dynamic changes to OID responses for each simulated agent during every read operation.

Run-time modifiers have the following syntax:

//$type.modifer(args)

Where:

typetype of value returned by modifier (as defined by SMI), e.g., int, ipa, etc.
modifiermodifier name (described below), e.g., rnd()
argsmodifier-specific arguments

A line containing a run-time modifier is shown below:

.1.3.6.1.2.1.33.1.2.1.0 = INTEGER: 0 //$int.rnd(0,1,1,1,1,1,4)

Note: The value of “0” in the line above is the initial value which will be replaced with the random value generated by the modifier the first time that the OID is read.

Randomizer

A randomizer can be applied to counters and integers. It has the following syntax:

type.rnd(direction, scount_min, scount_max, svalue_min, svalue_max, value_min, value_max)

Where:

  • direction – describes how the value should be changed, -1 for decrement, 0 for random (increment or decrement), 1 for increment
  • scount_min – minimum number of steps in which the value is modified as specified by the direction parameter above
  • scount_max – maximum number of steps in which the value is modified as specified by the direction parameter above
  • svalue_min – minimum deviation between consecutive values
  • svalue_max – maximum deviation between consecutive values
  • value_min – lower bound of the value (cannot be negative for gauge and counter types)
  • value_max – upper bound of the value (cannot be negative for gauge and counter types)
ImportantEach of the above is executed per single read operation.

Integer examples:

  • //$int.rnd(0,0,0,1,1,0,100) – 1 or -1 in one step is always added, value is kept between 0 and 100
  • //$int.rnd(0,1,15,10,30,0,100) – additional value ranging between 10-30, and the direction of modifiers (+ or – sign) is random. Adding an operation is performed within 1 to 15 steps

Counter examples:

  • //$c32.rnd(1,1,1,1,1,0,100) – increment value in 2 steps by 1 to 100, and then re-start from 0
  • //$c32.rnd(1,1,3,2,10,0,100) – increment value in 2-4 steps by 2-10 up to 100 and re-start from 100
  • //$c32.rnd(1,0,0,1,1,0,100) – increment value in 1 steps by 1 up to 100 and re-starts from 0
  • //$c32.rnd(1,5,3,21,10,100,1) – increment value in 4-6 steps by 10-21 up to 100 and re-start from 1

Other types:

  • g32.rnd(params) – identical as c32.rnd but for Gauge32 type values
  • c64.rnd(params) – identical as c32.rnd but for Counter64 type values
  • c32.tmr(params) – works exactly like in case of c32.rnd, but the value change (increase or decrease) is driven by timer with 1 sec. interval (1step = 1 second), e.g.:
    //$c32.tmr(1,0,24,25,1000,0,4294967295)
  • g32.tmr(params) – identical as c32.tmr but for Gauge32 type values
  • c64.tmr(params) – identical as c32.tmr but for Counter64 type values
  • int.tmr(params) – identical as c32.tmr but for Integer type values
ParametersOutputRemarks
direction=1
scount_min=0
scount_max=0
svalue_min=0
svalue_max=10
value_min=0
value_max=100
Sawtooth randomizer outputDirection is 1, so the value will always increase. The result will always remain between 0 and 100. The deviation between each sample will range from 0 to maximum 10.
direction=0
scount_min=0
scount_max=0
svalue_min=0
svalue_max=100
value_min=0
value_max=100
Spike randomizer outputDirection is 0, so the value may increase or decrease. The values will change in random directions by values ranging from 0 to 100.
direction=0
scount_min=0
scount_max=0
svalue_min=0
svalue_max=0
value_min=-100
value_max=100
Flat randomizer outputIf direction is set to 0, so t means value may increase or decrease. The value of each sample will remain constant because the deviation is set to 0 (svalue_min = svalue_max = 0). In effect, this modifier will not be actually randomizing values.

Integer with arithmetic operator

This modifier performs arithmetic operations. It has following syntax:

//$int.opr(lhs,operator,rhs)

Where:

  • lhs – left hand side of the operation (constant integer or OID)
  • operator – operator to be executed (+, -, /, *)
  • rhs – right hand side of the operation (constant integer or OID)

For example:

(The following examples current values of .1.2.3.4.5.6.7.8.9.0 = 124 and .1.2.3.4.5.6.7.8.10.0 = 248)

  • //$int.opr(30000,+,oid(.1.2.3.4.5.6.7.8.9.0)) returns 30124 (30000+124)
  • //$int.opr(oid(.1.2.3.4.5.6.7.8.9.0),-,300) returns -176 (124-300)
  • //$int.opr(3,*,oid(.1.2.3.4.5.6.7.8.9.0)) returns 372 (3*124)
  • //$int.opr(oid(.1.2.3.4.5.6.7.8.10.0),/,oid(.1.2.3.4.5.6.7.8.9.0)) returns 2 (248/124)

Hexstring

Hexstring (hexadecimal string) generates a random hexadecimal string, with a prefix and a specific number of characters. It has the following syntax:

hex.rnd(prefix,separator,count,rnd)

Where:

  • prefix – prefix to be added
  • separator – separator used to separate individual characters (e.g., “:” for MAC addresses)
  • count – number of generated characters (octets)
  • rnd – available values: 1 – new value is generated for each read, 0 – the value is generated only once

For example:

  • //$hex.rnd(,:,6,0) generates a random MAC address is generated, separated with “:” sign, the generated MAC remains the same for subsequent reads, e.g., a3:b4:c5:d6:e7:33, a3:b4:c5:d6:e7:33,…
  • //$hex.rnd(, ,6,1) generates a random 6 bytes hex string separated with a space, a new value is generated for every read, e.g., a3 b4 c5 d6 e7 33, d5 fa f1 32 12 e2,..

IP address

Generates a random IP address. It has the following syntax:

ipa.rnd(prefix,separator,count,rnd)

Where:

  • prefix – prefix added before generated string
  • separator – string used as a separator (usually “.”)
  • count – number of generated bytes
  • rnd – 1 – new value is generated for each read, 0 – the value is generated only once

For example:

  • .1.3.6.1.2.1.4.20.1.1.0.0.0.0 = IpAddress: //$ipa.rnd(,.,4,0) generates a random IP address upon the first read, and unchanged value is returned every time the OID is read
  • .1.3.6.1.2.1.4.20.1.1.127.0.0.1 = IpAddress: //$ipa.rnd(,.,4,1) generates a random address every time the OID is read

MAC address

Generates a random MAC address. It has the following syntax:

mac.rnd(prefix,separator,count,rnd)

Where:

  • prefix – prefix added before generated string
  • separator – character used to separate bytes (usually “:”)
  • count – number of generated bytes
  • rnd – 1 – new value is generated for each character, 0 – the value is generated only once

The parameters are exactly the same as for the hex string, but MAC is kept in alphanumeric format.

Was this page helpful?